@jxsuite/studio 10.3.0 → 10.4.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.
- package/dist/chunks/{add-new-flow-3tkn72ey.js → add-new-flow-v0pm96mr.js} +2 -2
- package/dist/chunks/content-source-g38w0d3f.js +4 -0
- package/dist/chunks/{convert-to-repeater-gwzh9gar.js → convert-to-repeater-r8sfxjjm.js} +2 -2
- package/dist/chunks/entry-commands-t13dyw3c.js +4 -0
- package/dist/chunks/{extension-sections-338ee35t.js → extension-sections-vjzw46xb.js} +2 -2
- package/dist/chunks/file-ops-1sghzgcr.js +4 -0
- package/dist/chunks/{files-t07yqqej.js → files-zrqtgt41.js} +2 -2
- package/dist/chunks/{format-host-5ja5gxyk.js → format-host-9gy76erh.js} +2 -2
- package/dist/chunks/fs-events-45rhg3me.js +4 -0
- package/dist/chunks/grid-open-t4fq6bbm.js +4 -0
- package/dist/chunks/{grid-view-w9nfy203.js → grid-view-2f03wcgw.js} +2 -2
- package/dist/chunks/{iframe-host-wsg0bn73.js → iframe-host-9aq8ze3q.js} +2 -2
- package/dist/chunks/{jx-validate-ttr5ewf0.js → jx-validate-r4ax11e3.js} +2 -2
- package/dist/chunks/layers-panel-zr92pwdp.js +4 -0
- package/dist/chunks/media-library-j74rt0w4.js +4 -0
- package/dist/chunks/{media-open-yp9jm834.js → media-open-mypr0k6b.js} +2 -2
- package/dist/chunks/{media-picker-s41ngdfr.js → media-picker-pemtbsjv.js} +2 -2
- package/dist/chunks/{monaco-setup-g9kterhx.js → monaco-setup-0hw9f835.js} +2 -2
- package/dist/chunks/publish-panel-vg1n880b.js +4 -0
- package/dist/chunks/{publish-quick-w3nxd7q4.js → publish-quick-4fwngwrw.js} +2 -2
- package/dist/chunks/publish-workspace-jv4w2bx2.js +4 -0
- package/dist/chunks/quick-search-nh29rt8a.js +4 -0
- package/dist/chunks/right-panel-3ws9f2w0.js +4 -0
- package/dist/chunks/{source-control-6fk72me2.js → source-control-h3hcs5gy.js} +2 -2
- package/dist/chunks/{studio-jeb7hth3.js → studio-1ctnw3xv.js} +2 -2
- package/dist/chunks/{studio-15hwqgd8.js → studio-1y9mab9m.js} +2 -2
- package/dist/chunks/{studio-s7t4vp1d.js → studio-2e4hry72.js} +3 -3
- package/dist/chunks/{studio-0w3541dg.js → studio-2kpxm0eh.js} +3 -3
- package/dist/chunks/{studio-3c10v2q1.js → studio-2pk7kc7z.js} +2 -2
- package/dist/chunks/{studio-nwynxqtb.js → studio-2x972v58.js} +2 -2
- package/dist/chunks/{studio-fspe7m9t.js → studio-2zz4qbv9.js} +2 -2
- package/dist/chunks/{studio-ggx3j7nd.js → studio-3pz4t5a2.js} +2 -2
- package/dist/chunks/{studio-waekn290.js → studio-4bgvvzhv.js} +2 -2
- package/dist/chunks/{studio-y1b86ast.js → studio-61rg2cz5.js} +2 -2
- package/dist/chunks/{studio-nskxe9q1.js → studio-9gr7xs9r.js} +2 -2
- package/dist/chunks/{studio-wse1rs8t.js → studio-a88ej93p.js} +3 -3
- package/dist/chunks/{studio-zfdbmhp3.js → studio-acer0g8w.js} +2 -2
- package/dist/chunks/{studio-423tfdte.js → studio-amaz545p.js} +2 -2
- package/dist/chunks/{studio-ea6r1zyr.js → studio-az3wvyh2.js} +2 -2
- package/dist/chunks/{studio-5n193zqd.js → studio-bg8pzprg.js} +2 -2
- package/dist/chunks/{studio-bct64zmj.js → studio-bnc50f9h.js} +2 -2
- package/dist/chunks/{studio-3xk9zdgb.js → studio-brh8d2pr.js} +2 -2
- package/dist/chunks/{studio-fkrr7kgg.js → studio-c2fa783p.js} +3 -3
- package/dist/chunks/{studio-yzpskb0j.js → studio-cqxj4fcy.js} +2 -2
- package/dist/chunks/{studio-b4e0ftkt.js → studio-cw11h078.js} +2 -2
- package/dist/chunks/{studio-f8tyeyzt.js → studio-dn56z7sn.js} +3 -3
- package/dist/chunks/{studio-nn4f9m9c.js → studio-evq47j2z.js} +2 -2
- package/dist/chunks/{studio-e7vjyp04.js → studio-frc16j8v.js} +3 -3
- package/dist/chunks/{studio-wfct4h6n.js → studio-gnazwtv3.js} +2 -2
- package/dist/chunks/{studio-thz5t120.js → studio-hfqpfmpk.js} +2 -2
- package/dist/chunks/{studio-fj6c905s.js → studio-j5fcp6gj.js} +2 -2
- package/dist/chunks/{studio-s9fng7m8.js → studio-jd1qb1st.js} +3 -3
- package/dist/chunks/{studio-p2a03pgm.js → studio-jma2q8r9.js} +2 -2
- package/dist/chunks/{studio-yrcrncev.js → studio-knsjyx7n.js} +2 -2
- package/dist/chunks/{studio-8kx6m0rg.js → studio-mrjtnm62.js} +2 -2
- package/dist/chunks/{studio-b68k0z00.js → studio-nwf0c32p.js} +2 -2
- package/dist/chunks/{studio-hfxttkyr.js → studio-pj216fmn.js} +2 -2
- package/dist/chunks/{studio-x0gsfr1d.js → studio-pwctzka3.js} +3 -3
- package/dist/chunks/{studio-aam8zt8z.js → studio-q9hx2qp0.js} +2 -2
- package/dist/chunks/{studio-wgc54sxf.js → studio-qrzmfaf6.js} +2 -2
- package/dist/chunks/{studio-3q7mhbgx.js → studio-r6mx7vm5.js} +2 -2
- package/dist/chunks/{studio-stahswgb.js → studio-rr00ex23.js} +2 -2
- package/dist/chunks/{studio-321ym1tt.js → studio-s24mhq0z.js} +2 -2
- package/dist/chunks/{studio-bz0b5brj.js → studio-tmfcn347.js} +2 -2
- package/dist/chunks/{studio-a65kbs2e.js → studio-v7a7yb5w.js} +2 -2
- package/dist/chunks/{studio-2ggfzrrd.js → studio-wmjmsw0p.js} +3 -3
- package/dist/chunks/studio-xva3hzkv.js +5 -0
- package/dist/chunks/{studio-nf8esxxc.js → studio-xx3r3sb0.js} +2 -2
- package/dist/chunks/{studio-9qx1ywbv.js → studio-z3fztxrp.js} +4 -4
- package/dist/chunks/{studio-r050sez0.js → studio-z9453ypn.js} +2 -2
- package/dist/chunks/{workspace-9btkc8tk.js → workspace-6ztqcrsh.js} +2 -2
- package/dist/chunks/workspace-home-rse9h8a0.js +4 -0
- package/dist/manifest.json +46 -46
- package/dist/studio.js +10 -10
- package/package.json +11 -11
- package/src/surfaces/inspector-dock.json +3 -3
- package/dist/chunks/content-source-1vzxq1ba.js +0 -4
- package/dist/chunks/entry-commands-mx2whrjx.js +0 -4
- package/dist/chunks/file-ops-9bxvk59j.js +0 -4
- package/dist/chunks/fs-events-3424ezp3.js +0 -4
- package/dist/chunks/grid-open-1mpq9mzb.js +0 -4
- package/dist/chunks/layers-panel-hvy2e549.js +0 -4
- package/dist/chunks/media-library-ae67q4at.js +0 -4
- package/dist/chunks/publish-panel-gzfxcm0t.js +0 -4
- package/dist/chunks/publish-workspace-dppd82tc.js +0 -4
- package/dist/chunks/quick-search-tdxaam55.js +0 -4
- package/dist/chunks/right-panel-0yrw4cgz.js +0 -4
- package/dist/chunks/studio-53wy9ek3.js +0 -5
- package/dist/chunks/workspace-home-qcc4z5ag.js +0 -4
package/dist/studio.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{X}from"./chunks/studio-9c6cbq2c.js";import{Wb,LA,dC,IA,th,ei,Np,rx,sx,VL,RA}from"./chunks/studio-3q7mhbgx.js";import{jn,Fx,Wt,ln,go,mv,Qc,Hx,bh,qp,$a,ml,gv,Gp,Qs,UO,zx,vh,Wx,bv,qO,qm,Vx,ZC,lI,vv,Hn,Vr,Ux,yh,qx,GO,Gx,cI,Gm,an,XC,dI,JO,xn,Oe,XO,QO,eM,tM,nM,hI,pI,St,ti,Hi,qn,oM,mI,Se,pi,gl,To,Xx,rM,Fe,aM,Gn,ed,Sv,Z,Yd,dM,uM,bI,hM,pM,fM,t1,mM,or,Ym,n0,EM,TM,LM,$M,IM,n1,RM,fi,yI,m,h,qr,pn,Da,Sr,oc,r1,s1,a1,rc,bl,l1,Si,Cv,eu,_I,Ft,kI}from"./chunks/studio-yrcrncev.js";import{rt,Eo,Bp,EO,xr,zp,LO,$O}from"./chunks/studio-g9brbewz.js";import{cf,MI,Av,p,ye}from"./chunks/studio-4fnb5648.js";import{Lh,rf,ar,ta,w,$h,yl,sf,Iv}from"./chunks/studio-sce30r7b.js";import{Es,Co,A$,FC,ic,uO,to,wr,xx,Ts,Hp,hl,no,HC,Tx,F$,j$,Lx,Gc,H$,$x,gO,B$,zC,WC,bO,u,Bd,Ix,wO,W$,VC,zm,tv,nv,xO,ko,_O,Kc,uh,V$,SO,Rx,CO}from"./chunks/studio-x0gsfr1d.js";import{st,DM,bo,Ch,Zp,nd,NM,AM,OM,EI,Xp,Ev,Tv,tu,Qp,nu,ef}from"./chunks/studio-swedpd82.js";import{rg,af,Rv,jt,Ih,Dv,l0,sc,Wi,fn}from"./chunks/studio-aam8zt8z.js";import"./chunks/studio-nvcn2ykc.js";import{PC,Ne,Ea,ev,Uc}from"./chunks/studio-n9qba0gx.js";import{bt,jr,uC,ka,Vo,dl,Vb,nh,Bc,pC,AA,OA,fC,MA,qb,hi,Om,UL,Ql,ec,rh,FA,zc,sh,Gb,Ap,vC,HA,yC,GL,BA,zA,Uo,lx,wC,xC,ji,ah,KL,Kb,JL,WA,VA,Op,_C,qA,KA,JA,ux,Mp,Hr,YA,Pm,ZA,XA,CC,QA,kC,eO,EC,Fm,Pp,tO,nO,hx,Gs,lh,Fp,iO,oO,LC,XL,jm,$C,rO,IC,QL,sO,e$,t$,n$,aO,px,i$,RC,ch,lO,cO,dO,o$,r$,Yb,Zb,NC,tc,c$,u$,Vc,gx,bx,h$,p$,f$,m$,g$,b$,v$,y$,w$,x$,AC,C$,Qb,k$,T$,L$,$$,I$,vx,nc,D$,dh,N$,yx}from"./chunks/studio-53wy9ek3.js";import{su,Fv,gf,Rh,cg,Pa,QM,rd,Dh,Jt,Ut,VI,m0,m1,sd,Lo,Rs,g1}from"./chunks/studio-nzemfbkk.js";import{sS,ju,aS,XD,bw,yb,KE,QD}from"./chunks/studio-hfxttkyr.js";import{Wr,ft,io}from"./chunks/studio-5tet77de.js";import"./chunks/studio-4zd6an2b.js";import{Um}from"./chunks/studio-hh394phe.js";import{Wp,tI}from"./chunks/studio-bct64zmj.js";import"./chunks/studio-1ks5d9y4.js";import{zd,DO}from"./chunks/studio-y1b86ast.js";import{xL,Zw,XN}from"./chunks/studio-p2a03pgm.js";import"./chunks/studio-1410q5dw.js";import{ls,al,LL,Xw,iA}from"./chunks/studio-ggx3j7nd.js";import{sn,Zs,Tn,nt,dt,Z$,sv,X$,qo,Fn}from"./chunks/studio-tpxcryf2.js";import{jO,ae}from"./chunks/studio-wqfaqw4m.js";import{Hd,iC,oC,dA,AL,Bb,tr,ll,OL,ML,PL,Dp,FL,pA,fA,jL,Qu,mA,cl,Ca,gA,nx,bA,vA,yA,Dm,rC,cs,HL,BL,xA,ix,zb,sC,_A,Nm,SA,aC,CA,Xl,eh,kA,lC,zL,cC,Am,EA,ox,WL}from"./chunks/studio-xpx91fby.js";import{lA}from"./chunks/studio-stahswgb.js";import{qs,nA,sl}from"./chunks/studio-a65kbs2e.js";import{Ks,Js}from"./chunks/studio-90zkgne5.js";import{Nb,ss,Yl,$m,er,$p,WN,Ju,UN,US,Uw,Fr,KT,JT,Ip,YT}from"./chunks/studio-thz5t120.js";import{Cw,aN,lT,kw,Ul,cN,dN,xm,_m,Ew,Eb,hT,Tw,yN}from"./chunks/studio-9qx1ywbv.js";import{$w}from"./chunks/studio-yzpskb0j.js";import{zt}from"./chunks/studio-daksw8kh.js";import"./chunks/studio-k1wvtp03.js";import{Fd}from"./chunks/studio-e7vjyp04.js";import{Ky,Ou,am,ib,O_,hD,M_,P_,F_,j_,Jy,cE,pD,Yy,Zy,Xy,vp,fD,Ld,lm}from"./chunks/studio-fkrr7kgg.js";import{qu,kT,Dw,ES,TS}from"./chunks/studio-waekn290.js";import{lS,YE,ZE}from"./chunks/studio-nwynxqtb.js";import{qS,YN,ZN,Jw,GS,Im,Rm,Mb,ks,XT,JS,Pb,tL,nL,Fb,bL}from"./chunks/studio-8kx6m0rg.js";import{jS,zT}from"./chunks/studio-fspe7m9t.js";import"./chunks/studio-k2evngrj.js";import{Lb,IS,RN,DN,Nw,Aw,RS,NN,rl,Em,$T,IT,RT,DS,Ib,DT,_i,MS,AT,OT,Lm,MT}from"./chunks/studio-wse1rs8t.js";import{cb,il,Fu,$D,TE,G_,K_,Rd,LE,$E,J_,RD}from"./chunks/studio-0w3541dg.js";import{MD,PE}from"./chunks/studio-3c10v2q1.js";import{Ad,_S,ql,Lw,vT,SS,kN}from"./chunks/studio-b68k0z00.js";import{z_,uE,hE,W_,ob,pE}from"./chunks/studio-fj6c905s.js";import{ew,vD,yD,wD,xD,sb,fE,Nc,_D,mE,Mu,SD,cm,$d,ab,gE,Pu,tw,nw,iw,vE,V_,ow,yE,rw,U_,wE,CD,lb,xE,q_,_E}from"./chunks/studio-s9fng7m8.js";import{yp,fw,Ac,WD,VD,Q_,mw,HE,UD,qD,fm,Mc,KD,bm,JD,Wl,UE,YD,ZD}from"./chunks/studio-bz0b5brj.js";import"./chunks/studio-321ym1tt.js";import{I_,Wy,QR,mp,nE,R_,Ru,D_,Vy,eD,tD,nb,nD,iE,Uy,oE,N_,iD,oD,rD,qy,Fi,Du,Dc,Nu,sD,aD,gp,rm,Au,bp,Gy,rE,sE,lD,aE,cD,lE,dD,uD,sm,A_}from"./chunks/studio-s7t4vp1d.js";import{jE,mb}from"./chunks/studio-5n193zqd.js";import{om,YR,ZR,eE,tE,tb,Hl,Iu}from"./chunks/studio-f8tyeyzt.js";import{vS,yS,Dd,Sb,Nd,_a}from"./chunks/studio-423tfdte.js";import{mD,rb,gD,bD}from"./chunks/studio-ea6r1zyr.js";import{km,Ku}from"./chunks/studio-15hwqgd8.js";import{xN}from"./chunks/studio-wfct4h6n.js";import"./chunks/studio-k1xqrgm5.js";import{Bl,NE}from"./chunks/studio-nn4f9m9c.js";import{xb,oT}from"./chunks/studio-b4e0ftkt.js";import{Qy}from"./chunks/studio-0x6f3nk9.js";import{dm}from"./chunks/studio-3xk9zdgb.js";import{uw,ub,DD,ND,DE,AD,OD,um}from"./chunks/studio-7rrdbvex.js";import{FD}from"./chunks/studio-nf8esxxc.js";import"./chunks/studio-r050sez0.js";import{Vl}from"./chunks/studio-jeb7hth3.js";import{Pd,Sm,ST,Uu,kS,LN,$N,Rw,CT}from"./chunks/studio-45mj4jqe.js";import{LS}from"./chunks/studio-pm17wdc4.js";import{Bw}from"./chunks/studio-wgc54sxf.js";import{Vs,GT}from"./chunks/studio-j0zf5x2x.js";import"./chunks/studio-nskxe9q1.js";import{dv,Gd,Xc,hv}from"./chunks/studio-zfdbmhp3.js";import{d1,rr,Vt,zi,Cr,kh,kr,C,id,_n,u1,Th,RI,DI,PM,of,ig,og,sr,wn,vl,Na,HM}from"./chunks/studio-4f7thq0p.js";import{Ce,oe,df,na,ru,c0,d0}from"./chunks/studio-v5wktj6f.js";import{zM,WM,FI,Ve,hf,jI,Ln,VM,UM,u0,vt,E,JM,R}from"./chunks/studio-9dq7rwc7.js";import{Me}from"./chunks/studio-0gvvqj3h.js";import{me,te,Gr,Kr,g,le,ja}from"./chunks/studio-3qr08sxq.js";import{iR,v2,y2}from"./chunks/studio-vpevkfxw.js";import{w2}from"./chunks/studio-abh9kfdh.js";import{n,Y,Ze,Q,_,v,Pe,Jn,it}from"./chunks/studio-k3we3kqb.js";import{pp,pe,eo,ce,aF}from"./chunks/studio-0939t1q1.js";aF(import.meta.url,["rygv11vd","yp9jm834","hee7ne9b","vqyr5s9x","bwehrp7q","9btkc8tk","pa0g6ax7","kv0k65cy","m49nmwvx","k2mb9k0r","a51py33c","w5zqwva1","1mpq9mzb","arz2qsy9","mkbcz4z2","qcc4z5ag","3tkn72ey","xb8vvt2h","3424ezp3","ae67q4at","338ee35t","wsg0bn73","w9nfy203","ttr5ewf0","5ja5gxyk","9bxvk59j","t07yqqej","9c6cbq2c","3q7mhbgx","yrcrncev","g9brbewz","4fnb5648","sce30r7b","x0gsfr1d","swedpd82","aam8zt8z","nvcn2ykc","n9qba0gx","53wy9ek3","nzemfbkk","hfxttkyr","5tet77de","4zd6an2b","hh394phe","bct64zmj","1ks5d9y4","y1b86ast","p2a03pgm","1410q5dw","ggx3j7nd","tpxcryf2","wqfaqw4m","xpx91fby","stahswgb","a65kbs2e","90zkgne5","thz5t120","9qx1ywbv","yzpskb0j","daksw8kh","k1wvtp03","e7vjyp04","fkrr7kgg","waekn290","nwynxqtb","8kx6m0rg","fspe7m9t","k2evngrj","wse1rs8t","0w3541dg","3c10v2q1","b68k0z00","fj6c905s","s9fng7m8","bz0b5brj","321ym1tt","s7t4vp1d","5n193zqd","f8tyeyzt","423tfdte","ea6r1zyr","15hwqgd8","wfct4h6n","k1xqrgm5","nn4f9m9c","b4e0ftkt","0x6f3nk9","3xk9zdgb","7rrdbvex","nf8esxxc","r050sez0","jeb7hth3","45mj4jqe","pm17wdc4","wgc54sxf","j0zf5x2x","nskxe9q1","zfdbmhp3","4f7thq0p","v5wktj6f","9dq7rwc7","0gvvqj3h","3qr08sxq","vpevkfxw","abh9kfdh","k3we3kqb","0939t1q1","0khd8xtx","3na1r48j","ejrypvmq","f9qr7kzh","wvf5e6j9","g9kterhx","cfnn70h1","x7t8jbjn","4afr4y6a","gwzh9gar","6fk72me2","mx2whrjx","g0hxtcga","s41ngdfr","0yrw4cgz","tdxaam55","hnvad61x","hvy2e549","1vzxq1ba","906vx2dq","yjrfeks8","2ggfzrrd","gzfxcm0t","w3nxd7q4","dppd82tc","eqcddvc2","vj30te2h","hy2mws8v","k0xzrse2","q80fg1d6","egnjpyde","jg1dtphj"],[["./studio.js",27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106],["./chunks/media-open-yp9jm834.js",47,49,46,44,42,97,43,29,34,27,32,35,31,100,39,36,48,45],["./chunks/parse-hee7ne9b.js",27],["./chunks/references-vqyr5s9x.js",42,27,31],["./chunks/notify-bwehrp7q.js",32],["./chunks/workspace-9btkc8tk.js",29,34,32,35,31,36],["./chunks/monaco-buffer-pa0g6ax7.js",34,32],["./chunks/platform-kv0k65cy.js",31],["./chunks/layers-m49nmwvx.js",50,41,51,27,32,100,39,36],["./chunks/lit-html-k2mb9k0r.js",41],["./chunks/monaco-binding-a51py33c.js",107,108,105],["./chunks/components-w5zqwva1.js",37,31],["./chunks/grid-open-1mpq9mzb.js",66,61,56,96,54,49,53,52,28,38,37,33,30,55,46,50,41,44,42,97,51,43,29,34,27,32,35,31,100,39,36,48,45],["./chunks/ws-client-arz2qsy9.js",108,86],["./chunks/cf-settings-mkbcz4z2.js",83,30,32,31],["./chunks/workspace-home-qcc4z5ag.js",72,69,70,89,64,90,91,57,71,58,63,68,94,66,59,61,56,96,65,67,47,54,49,53,52,28,38,37,33,30,55,46,50,41,44,42,97,51,43,29,34,27,32,35,31,100,39,36,48,45,60],["./chunks/add-new-flow-3tkn72ey.js",27,31,32,41,39,36,50,51,35,29,34,61,42,43,44,52,30,33,53,54,28,45,46,48,49,38,37,55,56,65,66,47,67,68,59,75,58,60,79,63,57,40,73,85,80,69,87,90,91,94,96,97,98,100,102,105],["./chunks/cf-account-picker-xb8vvt2h.js",27,31,32,41,39,36,50,51,67,30,83,52,88,100,102],["./chunks/fs-events-3424ezp3.js",44,42,43,29,34,27,32,35,31,36],["./chunks/media-library-ae67q4at.js",64,90,63,59,56,96,47,54,49,53,52,28,38,37,33,30,55,46,50,41,44,42,97,51,43,29,34,27,32,35,31,100,39,36,48,45],["./chunks/extension-sections-338ee35t.js",31,35,27,32,29,34,36,39,58,41,50,51,59,60,81,71,30,33,82,66,42,43,44,52,53,54,28,61,45,46,48,49,38,37,55,56,96,97,100,102,105],["./chunks/iframe-host-wsg0bn73.js",38,37,33,30,55,97,51,43,29,34,27,32,35,31,39,36,45],["./chunks/grid-view-w9nfy203.js",31,35,36,41,39,50,32,51,27,63,43,29,34,42,44,45,46,61,52,30,33,53,54,28,48,49,38,37,55,56,92,96,109,97,100,101,102,105],["./chunks/jx-validate-ttr5ewf0.js",81],["./chunks/format-host-5ja5gxyk.js",35,31],["./chunks/file-ops-9bxvk59j.js",56,96,54,49,53,52,28,38,37,33,30,55,46,50,41,44,42,97,51,43,29,34,27,32,35,31,100,39,36,48,45],["./chunks/files-t07yqqej.js",68,94,66,59,61,56,96,65,67,47,54,49,53,52,28,38,37,33,30,55,46,50,41,44,42,97,51,43,29,34,27,32,35,31,100,39,36,48,45],["./chunks/studio-9c6cbq2c.js"],["./chunks/studio-3q7mhbgx.js",29,30,33,98,102],["./chunks/studio-yrcrncev.js",32,34,31,35,36,98,99,102,105,106],["./chunks/studio-g9brbewz.js",31,32],["./chunks/studio-4fnb5648.js",105],["./chunks/studio-sce30r7b.js",102,105],["./chunks/studio-x0gsfr1d.js",27,31,32,29,35,30,98,102,105,106],["./chunks/studio-swedpd82.js",32,102,105],["./chunks/studio-aam8zt8z.js",31,105,106],["./chunks/studio-nvcn2ykc.js"],["./chunks/studio-n9qba0gx.js",31,98,105],["./chunks/studio-53wy9ek3.js",31,29,32,34,35,37,43,45,39,55,51,33,97,98,99,101,102,104,105,106],["./chunks/studio-nzemfbkk.js",36,102,105,106],["./chunks/studio-hfxttkyr.js",37,38,29,33,98,99,102],["./chunks/studio-5tet77de.js"],["./chunks/studio-4zd6an2b.js",31,27,105],["./chunks/studio-hh394phe.js",36,102,105],["./chunks/studio-bct64zmj.js",31,42,43,29,98],["./chunks/studio-1ks5d9y4.js"],["./chunks/studio-y1b86ast.js",27,31,32,42,29,36,43,44,45,97,98,105],["./chunks/studio-p2a03pgm.js",29,32,31,43,45,46,48,49,113,100,102,105,106],["./chunks/studio-1410q5dw.js",45],["./chunks/studio-ggx3j7nd.js",27,31,32,36,29,42,46,48,98,100,102,105,106],["./chunks/studio-tpxcryf2.js",41,39,32,51,27,100,102,105],["./chunks/studio-wqfaqw4m.js",102],["./chunks/studio-xpx91fby.js",31,30,32,50,105],["./chunks/studio-stahswgb.js",31,52,51,33,98,100,102,105],["./chunks/studio-a65kbs2e.js",41,32,39,50,33,53,28,100,102],["./chunks/studio-90zkgne5.js",106],["./chunks/studio-thz5t120.js",31,27,42,32,29,35,44,46,49,39,50,38,33,54,96,99,102,105],["./chunks/studio-9qx1ywbv.js",31,27,29,35,36,43,45,46,61,51,38,56,58,94,113,98,99,100,102,105,106],["./chunks/studio-yzpskb0j.js",39,29,59,99,100,102,105],["./chunks/studio-daksw8kh.js",39,50,100,101,102],["./chunks/studio-k1wvtp03.js"],["./chunks/studio-e7vjyp04.js",31,29,35,36,44,38,56,98,102,105,106],["./chunks/studio-fkrr7kgg.js",39,29,33,37,38,90,98,99,100,102,105,106],["./chunks/studio-waekn290.js",31,50,43,45,46,97,98,100,101,102,106],["./chunks/studio-nwynxqtb.js",27,31,32,42,39,50,29,43,46,49,63,59,47,90,100,101,102,105,106],["./chunks/studio-8kx6m0rg.js",27,31,45,35,29,32,39,47,33,50,67,54,38,109,98,100,102,105,106],["./chunks/studio-fspe7m9t.js",29,31,35,50,44,61,56,98,100,102,105],["./chunks/studio-k2evngrj.js",27,32,39,50,100,102],["./chunks/studio-wse1rs8t.js",41,27,50,32,51,31,35,42,43,29,44,30,33,54,28,37,45,55,65,46,66,49,56,47,59,119,94,95,98,100,102,105,106],["./chunks/studio-0w3541dg.js",31,61,27,32,50,29,54,59,42,45,46,38,56,68,57,90,91,119,94,113,98,100,102,105,106],["./chunks/studio-3c10v2q1.js",27,51,31,50,33,53,54,65,38,89,98,100,102,105],["./chunks/studio-b68k0z00.js",51,27,29,33,50,100,102,105],["./chunks/studio-fj6c905s.js",29,64,69,70,71],["./chunks/studio-s9fng7m8.js",29,32,34,31,33,51,58,50,59,57,45,61,49,38,55,56,40,68,79,94,97,98,100,101,102,105,106],["./chunks/studio-bz0b5brj.js",41,29,32,34,31,35,39,28,33,50,51,58,37,38,55,40,59,63,42,96,98,99,100,101,102,105,106],["./chunks/studio-321ym1tt.js",46],["./chunks/studio-s7t4vp1d.js",41,29,32,34,33,28,37,39,62,42,50,51,38,55,74,59,87,119,98,99,100,101,102,105,106],["./chunks/studio-5n193zqd.js",31,35,50,51,29,68,98,100,102,105],["./chunks/studio-f8tyeyzt.js",29,33,39,62,74,50,51,58,38,59,42,73,98,99,100,102,105],["./chunks/studio-423tfdte.js",27,58,29,63,100,102,105,106],["./chunks/studio-ea6r1zyr.js",31,37,29,35,46,55,38,41,50,28,61,63,69,90,57,98,100,102,105,106],["./chunks/studio-15hwqgd8.js",128,105,106],["./chunks/studio-wfct4h6n.js",27,31,32,58,81,71,33,66,98,100,102,105],["./chunks/studio-k1xqrgm5.js",30],["./chunks/studio-nn4f9m9c.js",51,31,52,39,50,53,83,98,100,102,105,106],["./chunks/studio-b4e0ftkt.js",35,32,29,36,27,79,46,61,33,38,75,57,91,94,105,106],["./chunks/studio-0x6f3nk9.js"],["./chunks/studio-3xk9zdgb.js",27,29,32,31,37,50,75,56,33,98,99,105],["./chunks/studio-7rrdbvex.js",67,31,83,52,106],["./chunks/studio-nf8esxxc.js",31,51,52,32,50,27,29,33,53,54,46,65,98,106],["./chunks/studio-r050sez0.js",39,31,43,29,35,37,38,56,97,98,105],["./chunks/studio-jeb7hth3.js",29,57,38,106],["./chunks/studio-45mj4jqe.js",105],["./chunks/studio-pm17wdc4.js",105],["./chunks/studio-wgc54sxf.js",29,61,98,105],["./chunks/studio-j0zf5x2x.js",105],["./chunks/studio-nskxe9q1.js",31,98,35,99,105],["./chunks/studio-zfdbmhp3.js",31,36,43,29,98],["./chunks/studio-4f7thq0p.js",105],["./chunks/studio-v5wktj6f.js",105],["./chunks/studio-9dq7rwc7.js",39],["./chunks/studio-0gvvqj3h.js"],["./chunks/studio-3qr08sxq.js"],["./chunks/studio-vpevkfxw.js"],["./chunks/studio-abh9kfdh.js"],["./chunks/studio-k3we3kqb.js"],["./chunks/studio-0939t1q1.js"],["./chunks/studio-0khd8xtx.js",108,99,105],["./chunks/studio-3na1r48j.js",105],["./chunks/studio-ejrypvmq.js"],["./chunks/index-f9qr7kzh.js",107,108,95,99],["./chunks/editor-wvf5e6j9.js",132],["./chunks/monaco-setup-g9kterhx.js",132,135,60,128,104,105,106],["./chunks/studio-cfnn70h1.js"],["./chunks/image-editor-x7t8jbjn.js",39,36,100,101,102,105],["./chunks/image-bake-4afr4y6a.js",45,48],["./chunks/convert-to-repeater-gwzh9gar.js",29,32,34,31,35,36,41,39,50,51,27,74,58,60,28,30,33,37,43,45,38,55,40,59,63,42,44,46,96,97,98,99,100,102,105],["./chunks/source-control-6fk72me2.js",65,67,47,54,49,53,52,28,38,37,33,30,55,46,50,41,44,42,97,51,43,29,34,27,32,35,31,100,39,36,48,45],["./chunks/entry-commands-mx2whrjx.js",85,79,75,91,57,58,63,94,59,61,56,96,54,49,53,52,28,38,37,33,30,55,46,50,41,44,42,97,51,43,29,34,27,32,35,31,100,39,36,48,45,60],["./chunks/studio-g0hxtcga.js",101,105],["./chunks/media-picker-s41ngdfr.js",63,46,50,41,44,42,97,51,43,29,34,27,32,35,31,100,39,36,45],["./chunks/right-panel-0yrw4cgz.js",78,62,73,74,40,90,79,57,58,63,68,94,66,59,61,56,96,65,67,47,54,49,53,52,28,38,37,33,30,55,46,50,41,44,42,97,51,43,29,34,27,32,35,31,100,39,36,48,45,60],["./chunks/quick-search-tdxaam55.js",77,68,94,66,59,61,56,96,65,67,47,54,49,53,52,28,38,37,33,30,55,46,50,41,44,42,97,51,43,29,34,27,32,35,31,100,39,36,48,45],["./chunks/adapter-hnvad61x.js",55],["./chunks/layers-panel-hvy2e549.js",76,62,87,74,40,90,75,58,63,59,56,96,54,49,53,52,28,38,37,33,30,55,46,50,41,44,42,97,51,43,29,34,27,32,35,31,100,39,36,48,45,60],["./chunks/content-source-1vzxq1ba.js",61,56,96,54,49,53,52,28,38,37,33,30,55,46,50,41,44,42,97,51,43,29,34,27,32,35,31,100,39,36,48,45],["./chunks/2020-906vx2dq.js",136,106],["./chunks/index-yjrfeks8.js",136,106],["./chunks/studio-2ggfzrrd.js"],["./chunks/publish-panel-gzfxcm0t.js",84,83,53,52,33,30,50,41,51,29,34,27,32,35,31,100,39,36],["./chunks/publish-quick-w3nxd7q4.js",27,32,51,30,31,33,29,34,35,36,41,39,50,52,53,54,28,45,42,43,44,46,47,48,49,67,65,37,38,55,89,97,100,102],["./chunks/publish-workspace-dppd82tc.js",70,89,65,67,47,54,49,53,52,28,38,37,33,30,55,46,50,41,44,42,97,51,43,29,34,27,32,35,31,100,39,36,48,45],["./chunks/studio-eqcddvc2.js"],["./chunks/jsonMode-vj30te2h.js",132,137,135],["./chunks/javascript-hy2mws8v.js",132],["./chunks/studio-k0xzrse2.js",132,106],["./chunks/studio-q80fg1d6.js",106],["./chunks/studio-egnjpyde.js",132,135],["./chunks/tsMode-jg1dtphj.js",132,137,135]],0);
|
|
2
|
-
var BI=pe(function(Ske,HI){var du=Object.prototype.hasOwnProperty,zI=Object.prototype.toString,{defineProperty:PI,getOwnPropertyDescriptor:NI}=Object,AI=function e(t){if(typeof Array.isArray==="function")return Array.isArray(t);return zI.call(t)==="[object Array]"},II=function e(t){if(!t||zI.call(t)!=="[object Object]")return!1;var r=du.call(t,"constructor"),o=t.constructor&&t.constructor.prototype&&du.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!r&&!o)return!1;var a;for(a in t);return typeof a>"u"||du.call(t,a)},LI=function e(t,r){if(PI&&r.name==="__proto__")PI(t,r.name,{enumerable:!0,configurable:!0,value:r.newValue,writable:!0});else t[r.name]=r.newValue},OI=function e(t,r){if(r==="__proto__"){if(!du.call(t,r))return;else if(NI)return NI(t,r).value}return t[r]};HI.exports=function e(){var t,r,o,a,i,s,l=arguments[0],f=1,c=arguments.length,d=!1;if(typeof l==="boolean")d=l,l=arguments[1]||{},f=2;if(l==null||typeof l!=="object"&&typeof l!=="function")l={};for(;f<c;++f)if(t=arguments[f],t!=null){for(r in t)if(o=OI(l,r),a=OI(t,r),l!==a){if(d&&a&&(II(a)||(i=AI(a)))){if(i)i=!1,s=o&&AI(o)?o:[];else s=o&&II(o)?o:{};LI(l,{name:r,newValue:e(d,s,a)})}else if(typeof a<"u")LI(l,{name:r,newValue:a})}}return l}});var _w=[],mf=null,Fl=null;function f_(){mf=null;let e=Fl;if(!e)return;for(let t of _w.splice(0))e.call(document.head,t)}function h_(e){if(e instanceof HTMLLinkElement&&e.rel==="modulepreload"){if(_w.push(e),mf===null)mf=requestAnimationFrame(f_);return e}return Fl?Fl(e):e}function zw(){let e=document.head;if(!e||e.__modulePreloadsBatched)return;Fl=Node.prototype.appendChild.bind(e),e.__modulePreloadsBatched=!0,e.appendChild=h_}var An=new Map;function Hw(e){let t=An.get(e);if(t)return t;let r={map:null,step:-1,view:"visual"};return An.set(e,r),r}function ff(e,t){let r=Hw(e);r.map=t;let o=t?.steps.length??0;r.step=o===0?-1:Math.min(r.step,o-1)}function bf(e){return An.get(e)?.map??null}function _l(e){return An.get(e)?.map?.steps.length??0}function Vw(e){return An.get(e)?.step??-1}function Ww(e,t){let r=An.get(e),o=r?.map?.steps.length??0;if(!r||o===0)return null;let a=r.step===-1?t===1?0:o-1:r.step+t;if(a<0||a>=o)return null;return r.step=a,a}function Wo(e){return An.get(e)?.view??"visual"}function Xa(e,t){return!t||Wo(e)==="code"}function yf(e,t){Hw(e).view=t}function qw(e){An.delete(e)}var Gw={$schema:"https://jxsuite.com/schema/v1",$id:"StudioDiffToolbar",$description:"The Compare view's own bar: which half of a comparison is showing, how many changes there are, and how to walk them. `canvas/diff-toolbar.ts` keeps every decision — what the count means for the view that is showing, which step is reachable, whether this comparison has a visual half at all — and this document owns the markup, the ARIA, the keyboard and the style. The Visual/Code pair is a real radiogroup now rather than a role written by hand over a Spectrum button that overwrote it: `jx-action-group selects=\"single\"` is the group and `checked` is what makes each `jx-action-button` a radio, so the caret roves between them and `aria-checked` is the element's own rather than an attribute the template hoped would survive an upgrade.",tagName:"div",attributes:{part:"toolbar",role:"group","aria-label":"Changes against HEAD"},style:{$description:"`styles/canvas.css`'s `.diff-toolbar-inner` and the three text runs under it, keyed on `part`. The bar's POSITION is not here: the stage draws the absolutely-positioned host this mounts into (`surfaces/canvas-stage.json`, `[part=\"diff-toolbar\"]`), because where a floating bar sits over a pan/zoom surface is a fact about the stage rather than about the bar.",display:"flex",gap:"var(--jx-space-2)",alignItems:"center",padding:"4px var(--jx-space-2)",border:"1px solid var(--border)",borderRadius:"var(--radius)",background:"var(--bg)",boxShadow:"var(--jx-shadow-popover)",fontFamily:"var(--jx-font-sans)",'& [part="view"]':{$description:"Spacing only: the segmented look is `jx-action-group`'s own `compact`, exactly as it was Spectrum's.",flexShrink:"0"},'& [part="view-static"], & [part="count"], & [part="note"]':{color:"var(--fg)",fontSize:"var(--jx-text-sm)",whiteSpace:"nowrap"},'& [part="count"]':{$description:"Tabular figures so the counter does not jitter its neighbours as it steps.",fontVariantNumeric:"tabular-nums"},'& [part="note"]':{color:"var(--fg-dim)"},'& [part="stepper"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)"}},children:[{$description:'The Visual/Code pair, or a static label. A control that cannot move is not drawn as a control — the rule `editorKindTpl` states for a document with one editor kind — so a comparison the canvas cannot draw says "Code" in words rather than offering a Visual button it would have to disable.',tagName:"div",attributes:{part:"view-slot"},style:{display:"contents"},$switch:{$ref:"#/state/viewMode"},cases:{static:{tagName:"span",attributes:{part:"view-static"},textContent:"Code"},choice:{tagName:"jx-action-group",attributes:{part:"view"},$props:{selects:"single",compact:!0,label:"Diff view"},children:[{tagName:"jx-action-button",attributes:{part:"view-visual"},$props:{size:"sm",checked:"${state.visualChecked}",hint:"Show the change on the page"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/showVisual"},value:[]}]},children:[{tagName:"span",textContent:"Visual"}]},{tagName:"jx-action-button",attributes:{part:"view-code"},$props:{size:"sm",checked:"${state.codeChecked}",hint:"Show the change in the file's text"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/showCode"},value:[]}]},children:[{tagName:"span",textContent:"Code"}]}]}}},{$description:'The count, and — only when there is somewhere to step — the two buttons around it. Before the first step it reads "12 changes" rather than "0 of 12", because the author is not on a change yet. The counter is text rather than a button because it has no verb.',tagName:"div",attributes:{part:"stepper-slot"},style:{display:"contents"},$switch:{$ref:"#/state/stepper"},cases:{hidden:{tagName:"span",attributes:{part:"count"},textContent:"${state.countLabel}"},shown:{tagName:"span",attributes:{part:"stepper"},children:[{tagName:"jx-action-button",attributes:{part:"previous"},$props:{size:"sm",quiet:!0,icon:"caret-up",label:"Previous change",hint:"Previous change",disabled:{$ref:"#/state/prevDisabled"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/previous"},value:[]}]}},{tagName:"span",attributes:{part:"count"},textContent:"${state.countLabel}"},{tagName:"jx-action-button",attributes:{part:"next"},$props:{size:"sm",quiet:!0,icon:"caret-down",label:"Next change",hint:"Next change",disabled:{$ref:"#/state/nextDisabled"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/next"},value:[]}]}}]}}},{$description:"The alignment was degraded: a group of siblings was too large to pair up, so some changes are shown as an add and a remove rather than as one modification. Reported rather than hidden — a reader counting changes deserves to know the count is coarser than usual.",tagName:"div",attributes:{part:"degraded-slot"},style:{display:"contents"},$switch:{$ref:"#/state/degraded"},cases:{shown:{tagName:"span",attributes:{part:"note",title:"A group of siblings was too large to pair up"},textContent:"some shown as add/remove"}}},{$description:"A root key moved — `state`, `$media`, a document setting. Those are never tinted on the artboards, because they have no node to tint, so the bar states them in words and the tooltip names them.",tagName:"div",attributes:{part:"root-keys-slot"},style:{display:"contents"},$switch:{$ref:"#/state/rootKeys"},cases:{shown:{tagName:"span",attributes:{part:"note",title:"${state.rootKeysTitle}"},textContent:"document settings changed"}}}]};E("diff-toolbar",Gw);function Kw(e,t){e.viewMode=t.viewMode,e.visualChecked=t.visualChecked,e.codeChecked=t.codeChecked,e.countLabel=t.countLabel,e.stepper=t.stepper,e.prevDisabled=t.prevDisabled,e.nextDisabled=t.nextDisabled,e.degraded=t.degraded,e.rootKeys=t.rootKeys,e.rootKeysTitle=t.rootKeysTitle}function Yw(e,t,r){e.replaceChildren();let o=g({codeChecked:"false",countLabel:"",degraded:"hidden",next:r.next,nextDisabled:!0,prevDisabled:!0,previous:r.previous,rootKeys:"hidden",rootKeysTitle:"",showCode:r.showCode,showVisual:r.showVisual,stepper:"hidden",viewMode:"choice",visualChecked:"true"});Kw(o,t);let a=null,i=!1,s=R("diff-toolbar",o,e).then((l)=>{let f=l.root;if(i)return l.dispose(),f;return a=l,f});return{dispose(){i=!0,a?.dispose(),a=null},ready:s,update:(l)=>Kw(o,l)}}var Qa=new Map;function zl(e,t){let r=Qa.get(e);if(r&&r.host!==t)r.surface?.dispose(),Qa.delete(e);if(t&&!Qa.has(e))Qa.set(e,{host:t,surface:null})}var ax=()=>{};function cx(e){ax=e}var dx=null;function mx(e){dx=e}function fx(e){bo(e).prevCanvasMode=null,ax(e),dx?.()}function Jl(e){let t=Qa.get(e);if(!t)return;let r=y_(e);if(t.surface){t.surface.update(r);return}t.surface=Yw(t.host,r,{next:()=>ex(e,1),previous:()=>ex(e,-1),showCode:()=>Qw(e,"code"),showVisual:()=>Qw(e,"visual")})}function Qw(e,t){if(Wo(e)===t)return;yf(e,t),fx(e)}function b_(e,t,r){let o=e.kind==="modified"?"changed":e.kind;return`Change ${t+1} of ${r}, ${o}.`}function ex(e,t){wf(e,t).catch((r)=>{console.warn("stepDiffAndReveal:",r)})}async function wf(e,t){let r=Ww(e,t);if(r===null)return;Jl(e);let o=bf(e)?.steps[r],{panels:a}=bo(e),i=a[0]?.canvas,s=a[1]?.canvas;if(!o)return;let{hostForCanvas:l,measureInCanvas:f,revealCanvasPathIn:c}=await (ce("wsg0bn73"),import("./chunks/iframe-host-wsg0bn73.js")),b=(await Promise.all([o.originalPath&&i?f(i,o.originalPath):null,o.currentPath&&s?f(s,o.currentPath):null])).filter((j)=>j!==null),y=b_(o,r,_l(e));if(b.length===0){Lh(`${y} Not shown on the canvas.`);return}let x=Math.min(...b.map((j)=>j.top)),S=Math.max(...b.map((j)=>j.top+j.height));IC({height:S-x,top:x},bo(e));let P=o.currentPath&&s?l(s):null;if(P&&o.currentPath)await c(P,o.currentPath);Lh(y)}function y_(e){let t=bf(e),r=Wo(e)==="code"||t===null,o=r?0:_l(e),a=r?-1:Vw(e),i=r?"Changed lines are marked":o===0?"No changes":a<0?`${o} ${o===1?"change":"changes"}`:`${a+1} of ${o}`,s=Wo(e);return{codeChecked:s==="code"?"true":"false",countLabel:i,degraded:!r&&t.degraded?"shown":"hidden",nextDisabled:a>=o-1,prevDisabled:a<=0,rootKeys:!r&&t.rootKeys.length>0?"shown":"hidden",rootKeysTitle:`Changed: ${t?.rootKeys.join(", ")??""}`,stepper:o===0?"hidden":"shown",viewMode:t===null?"static":"choice",visualChecked:s==="visual"?"true":"false"}}function vf(e){let{pane:t}=e;return n(t)?t:m.activePaneId}var wx=Fe("Which pane to act on. Defaults to the focused one."),tx=Se({pane:wx},[]);function kx(){let e=(t)=>_l(t)>0;return[{args:tx,category:"View",group:"3_canvas",id:"diff.nextChange",keybinding:"f7",keyScope:"global",level:"document",menus:["palette"],requires:"a pane showing a comparison with changes",title:"Next Change",undo:"none",when:(t)=>t.editor.kind==="diff",enablement:()=>e(m.activePaneId),run:(t,r)=>wf(vf(r),1)},{args:tx,category:"View",group:"3_canvas",id:"diff.previousChange",keybinding:"shift+f7",keyScope:"global",level:"document",menus:["palette"],requires:"a pane showing a comparison with changes",title:"Previous Change",undo:"none",when:(t)=>t.editor.kind==="diff",enablement:()=>e(m.activePaneId),run:(t,r)=>wf(vf(r),-1)},{args:Se({pane:wx,view:pi(["visual","code"],"Which half of the comparison to show.")},["view"]),category:"View",group:"3_canvas",id:"diff.setView",level:"document",menus:["palette"],requires:"a pane showing a comparison",title:"Set Diff View",undo:"none",when:(t)=>t.editor.kind==="diff",run:(t,r)=>{let o=qn("diff.setView",r,"view",["visual","code"]),a=vf(r);if(Wo(a)===o)return;yf(a,o),fx(a)}}]}var v_=250000;class Sx{original=[];current=[];steps=[];rootKeys=[];degraded=!1;maxCells;seen=new Set;constructor(e){this.maxCells=e}emit(e,t,r){let o=`${e}:${t?JSON.stringify(t):""}:${r?JSON.stringify(r):""}`;if(this.seen.has(o))return;if(this.seen.add(o),t&&e!=="added")this.original.push({kind:e,path:t});if(r&&e!=="removed")this.current.push({kind:e,path:r});this.steps.push({currentPath:r,kind:e,originalPath:t})}diffNode(e,t,r,o){let a=e.length===0&&t.length===0,i=!1;for(let f of new Set([...Object.keys(r),...Object.keys(o)])){if(f==="children"||Vs(r[f],o[f]))continue;if(a){if(!this.rootKeys.includes(f))this.rootKeys.push(f)}else i=!0}if(i)this.emit("modified",e,t);let s=r.children,l=o.children;if(Array.isArray(s)&&Array.isArray(l))this.diffChildren(e,t,s,l);else if(!Vs(s,l)&&!a)this.emit("modified",e,t)}diffChildren(e,t,r,o){if(r.length*o.length>this.maxCells)this.degraded=!0;let a=GT(r,o,{maxCells:this.maxCells}),i=0,s=0;for(let l of a){for(;i<l.aIndex;i++)this.emitChild("removed",e,t,r[i],i,null);for(;s<l.bIndex;s++)this.emitChild("added",e,t,o[s],null,s);if(!l.identical){let f=r[l.aIndex],c=o[l.bIndex];if(v(f)&&v(c))this.diffNode([...e,"children",l.aIndex],[...t,"children",l.bIndex],f,c);else if(!Vs(f,c))this.emit("modified",e,t)}i=l.aIndex+1,s=l.bIndex+1}for(;i<r.length;i++)this.emitChild("removed",e,t,r[i],i,null);for(;s<o.length;s++)this.emitChild("added",e,t,o[s],null,s)}emitChild(e,t,r,o,a,i){if(!v(o)){this.emit("modified",t,r);return}this.emit(e,a===null?null:[...t,"children",a],i===null?null:[...r,"children",i])}}function Cx(e,t,r={}){let o=new Sx(r.maxCells??v_);return o.diffNode([],[],e,t),{current:o.current,degraded:o.degraded,original:o.original,rootKeys:o.rootKeys,steps:o.steps}}var Px={$schema:"https://jxsuite.com/schema/v1",$id:"StudioPaneGrid",$description:"The pane grid (studio.md §18.1): one cell per pane, with a splitter before every cell but the first. Every box here is EMPTY by design — the FOUR inside a cell are hosts other modules fill (`panels/tab-strip.ts` the strip, `panels/pane-context.ts` the chrome layer, `canvas/canvas-render.ts` the stage, `panels/pane-grid.ts` itself the right-edge drop zone), and the stage is an ISLAND in the studio-ui-guidelines.md §9.4 sense: the canvas host mounts a cross-origin `<iframe>` into it, so nothing this document draws may ever go inside it. What the document owns is the STRUCTURE and the STYLE — the cell's own two-row grid, the three row-2 children that share its lower cell, and the splitter — which is `styles/shell.css`'s `.pane*` block and `styles/canvas.css`'s `.pane-stage` rule, carried here and keyed on `part`. Two things are load-bearing and easy to undo. (1) **A row that moves reloads an iframe**, so the keyed `$map` is not an optimisation: `workspace.panes[0]` is always the primary and `MAX_PANES` is 2, the key is the pane id, and the runtime's forward-cursor pass therefore never moves a kept row — gaining or losing the side pane leaves the primary's node, and the frame inside it, untouched. (2) **The splitter must sit BETWEEN two cells and inside neither**, so each row is a `display: contents` wrapper holding its own leading splitter and its cell: the wrapper generates no box, so the splitter and the two cells are the grid items of `#pane-grid` in DOM order, and a pointer landing on the splitter is in no cell at all. Every selector below is a `>` chain from the root, because a pane's stage hosts other surface documents and a bare `[part=\"row\"]` descendant rule would reach into them.",tagName:"div",attributes:{part:"grid",role:"none"},style:{$description:"The pane's own layout, and the splitter's. The tracks of `#pane-grid` ITSELF are not here and must not be: the track count depends on `workspace.panes.length` and the split on `shell.paneSplit`, which is written on every `pointermove` of a drag — `panels/pane-grid.ts` writes them as one inline `grid-template-columns` on the host, so a drag moves a track edge and never a node. The splitter's own paint is not here either: `jx-split` owns the hairline, the cursors and the drag state it mirrors as `data-dragging`, so this block says only where the element is placed.",display:"contents",'& > [part="row"]':{$description:"One pane's row: its leading splitter and its cell, generating no box of their own so both are grid items of `#pane-grid`.",display:"contents"},'& > [part="row"] > [part="splitter-slot"]':{display:"contents"},'& > [part="row"] > [part="splitter-slot"] > jx-split':{$description:"WHERE the splitter sits, and nothing about what it looks like: the hairline, the two cursors, the hover and drag colours and the focus ring are `jx-split`'s own, and the `.dragging` class this block used to name is gone with the module that wrote it — the element mirrors its own gesture as `data-dragging` and paints itself. BOTH grid axes are `auto`: a definite row position — the `2 / 4` a column handle inherits on the APP grid, or the `1 / -1` this rule used to carry — moves the item into an earlier step of CSS Grid's auto-placement, so the splitter claimed column 1 and the two cells flowed around it into the 5px track and the second half. DOM order was already right; the placement algorithm was not reading it. `width: auto` with `justify-self: stretch` is what hands the thickness back to the TRACK `panels/pane-grid.ts` writes, so the element's own 5px default cannot disagree with the column it is placed in.",gridRow:"auto",gridColumn:"auto",justifySelf:"stretch",margin:"0",width:"auto",zIndex:"10"},'& > [part="row"] > [part="pane"]':{$description:'ONE PANE, and one COLUMN, declared. Three children name `grid-row: 2` in order to share the lower cell, and auto-placement answers that by inventing an implicit column each: the chrome layer, the stage and the drop zone lined up side by side (with a fourth, the jump bar, that has since moved to the status bar), the stage taking a fraction of the pane and pinning the document to the right edge. `grid-template-columns` is what makes "share the cell" mean it, and every row-2 child restates `grid-column: 1` so a future fourth one cannot re-open the same hole. No unit test can see this — happy-dom does no layout, so every rect is zero — which is why the screenshot lane is what caught it.',display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gridTemplateRows:"auto minmax(0, 1fr)",minWidth:"0",minHeight:"0"},'& > [part="row"] > [part="pane"] > [part="strip"]':{gridRow:"1",gridColumn:"1",minHeight:"0",minWidth:"0"},'& > [part="row"] > [part="pane"] > [part="strip"]:empty':{$description:"A pane with nothing to say costs no band. The strip host is empty until `panels/tab-strip.ts` mounts a document into it, and empty again the moment it disposes.",display:"none"},'& > [part="row"] > [part="pane"] > [part="chrome"]':{$description:"The pane context bar and the floating zoom pod. The layer itself is inert and only its children take the pointer; `surfaces/pane-context.json` owns what they look like.",gridRow:"2",gridColumn:"1",position:"relative",zIndex:"2",minWidth:"0",display:"flex",flexDirection:"column",justifyContent:"space-between",pointerEvents:"none"},'& > [part="row"] > [part="pane"] > [part="chrome"] > *':{pointerEvents:"auto"},'& > [part="row"] > [part="pane"] > [part="pane-stage"]':{$description:"The stage: the pane's own axis (`styles/canvas.css`) over its placement in the cell (`styles/shell.css`). Offset by the context bar stacked over this cell — `--pane-context-h`, written by `panels/pane-context.ts` onto the CELL, which is why this reads it by cascade — so the bar never covers the document, and by zero when no tab is open, so the welcome screen does not sit under a band nothing explains. A pane's address used to be a second bar stacked here (`--jump-bar-h`); it is the status bar's breadcrumb trail now, and costs the stage nothing.",gridRow:"2",gridColumn:"1",marginTop:"var(--pane-context-h, 0px)",position:"relative",overflow:"auto",background:"var(--bg-panel)",minWidth:"0",display:"flex",gap:"var(--jx-space-6)",alignItems:"flex-start"},'& > [part="row"] > [part="pane"] > [part="drop-zone"]':{$description:"The right-edge target that creates a second pane (§18.1). Sits ABOVE the stage (`z-index: 4` against the stage's own stacking, chrome's 2) so a drag reaches it before it reaches the cross-origin iframe underneath, which would otherwise swallow every drag event with no affordance to say so. `pointer-events: none` when unarmed — a mouse doing anything other than dragging a tab or a file must pass straight through to the stage — and `auto` only while `data-armed` is set, which `panels/pane-grid.ts`'s own arming monitor writes for the DURATION of a drag it recognises, never for a click.",gridRow:"2",gridColumn:"1",position:"relative",zIndex:"4",minWidth:"0",pointerEvents:"none"},'& > [part="row"] > [part="pane"] > [part="drop-zone"][data-armed]':{pointerEvents:"auto"},'& > [part="row"] > [part="pane"] > [part="drop-zone"][data-over]::after':{$description:"The right BAND, not the whole cell: the zone only ever ACCEPTS a drop in that band (`panels/pane-grid.ts`'s `edgeData`), so lighting the whole cell would promise a drop this element refuses everywhere else in it.",content:'""',position:"absolute",insetBlock:"0",insetInlineEnd:"0",insetInlineStart:"50%",background:"color-mix(in srgb, var(--accent) 14%, transparent)",borderInlineStart:"2px solid var(--accent)"}},children:[{$description:"Keyed on the PANE ID, and that is the whole of §18.1 rule 1's structural half: the key is what makes the runtime MOVE a kept row rather than rebuild it, and re-parenting is not a move for an `<iframe>` — it reloads, dropping its `iframe-channel` connection, its shadow document and every `ready` panel with it. A row renders complete (its cell, its four hosts and its splitter) inside the row's own effect scope before it is inserted, so there is no frame in which a cell exists with no stage inside it.",$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/id"},map:{tagName:"div",attributes:{part:"row",role:"none"},children:[{$description:"Present on every cell but the first. It is a child of the ROW rather than of either cell, so a splitter drag never reaches the cell's pane-focus listener — and it is created and destroyed with the second pane, so nothing re-inserts it while a pointer capture is live.",tagName:"div",attributes:{part:"splitter-slot",role:"none"},$switch:{$ref:"$map/item/split"},cases:{shown:{$description:'`jx-split` (ui.md §5.5), which is where `role="separator"`, the tab stop, `aria-valuenow` and the whole keyboard now live. This document used to write the role on a bare div and hand the div to `ui/panel-resize.ts`, which made the pane split the one dock-sized thing in Studio a reader could not move without a mouse — an SC 2.1.1 failure with a drag handle drawn on it, and an SC 2.5.7 one besides. Every prop below is a CONSTANT except `value`: `min` and `max` are the shell\'s own supported range, and `gap` is the pixel floor the element converts against the track it measures itself, which is why nothing here has to be recomputed when the window resizes. `collapse` is the even split rather than the floor, because both sides of this splitter are real panes: the first Enter or double click is the 50/50 reset this gesture has always been, and the second one is the return trip it never had.',tagName:"jx-split",attributes:{part:"splitter"},$props:{label:"Pane split",value:{$ref:"#/state/paneSplit"},min:{$ref:"#/state/splitMin"},max:{$ref:"#/state/splitMax"},gap:{$ref:"#/state/splitGap"},collapse:{$ref:"#/state/splitDefault"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/move"},value:[{$ref:"event#/target/value"}]}]},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/settle"},value:[]}]}}}},{$description:'One pane\'s cell. `pane.<id>` goes on the STAGE and `pane.<id>/tabs` on the strip, never on this element: nine shots crop `pane.primary` meaning "the canvas", and moving the id up one level would silently widen all nine to include the strip and the two bars, which no gate can tell from an intended crop.',tagName:"div",attributes:{part:"pane","data-pane-id":"${$map.item.id}"},children:[{tagName:"div",attributes:{part:"strip","data-jx-region":"${$map.item.stripRegion}"}},{$description:"The context bar is HANDED this box rather than resolving a region into it. It cannot resolve one the way the strip does: nothing inside the strip re-stamps `pane.<id>/tabs`, while the context bar stamps `pane.<id>/context` on markup it renders INSIDE this div — so a region on the wrapper as well would put the same id on two nested elements, and `resolveRegion` takes the LAST match. Sixty shots crop `pane.primary/context`; a second, larger element carrying it is a silently widened crop.",tagName:"div",attributes:{part:"chrome"}},{$description:"Drawn EMPTY and left empty. `canvas/canvas-render.ts` is this element's render root and `canvas/iframe-host.ts` mounts the artboards' iframes into it; a node cannot have two owners of its child list.",tagName:"div",attributes:{part:"pane-stage","data-jx-region":"${$map.item.region}"}},{$description:"The right-edge drop target (§18.1). No `data-jx-region`: `pane.<id>` uniqueness names the stage, and a second element answering to it would be a silently widened crop the moment a shot cropped this pane.",tagName:"div",attributes:{part:"drop-zone",role:"none","data-armed":"${state.armed ? '' : null}","data-over":"${state.edgePane === $map.item.id ? '' : null}"}}]}]}}]};E("pane-grid",Px);var x_="pane",k_="pane-stage",Gl=`[part="${x_}"]`,Ex=`[part="${k_}"]`,$_=new Map([["pane","pane"],["strip","strip"],["chrome","chrome"],["pane-stage","stage"],["drop-zone","dropZone"]]);function S_(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function C_(e){let t=e?.$map,r=v(t)?t.item:void 0,o=v(r)?r.id:void 0;return n(o)?o:""}function Nx(e,t,r,o){e.replaceChildren();let a=g({armed:!1,edgePane:"",move:o.move,paneSplit:r.value,rows:t,settle:o.settle,splitDefault:r.collapse,splitGap:r.gap,splitMax:r.max,splitMin:r.min}),i=null,s=!1,l=R("pane-grid",a,e,{onNodeCreated:(f,c,d,b)=>{let y=$_.get(S_(d));if(y)o.cellPart(C_(b),y,f)}}).then((f)=>{if(s){f.dispose();return}i=f});return{dispose(){s=!0,i?.dispose(),i=null,e.replaceChildren()},drag(f){a.armed=f.armed,a.edgePane=f.edgePane},ready:l,update(f,c){a.rows=f,a.paneSplit=c}}}var jx="--stage-scrollbar-w";function T_(e){return Math.max(0,e.offsetWidth-e.clientWidth)}function Ax(e){return Ch(e)?.closest(Gl)??document.documentElement}function Ox(e,t){if(e.stageScrollbar?.scroller===t)return;if(Za(e),!t)return;let r=Ax(e),a=new ResizeObserver(()=>{r.style.setProperty(jx,`${T_(t)}px`)});a.observe(t),e.stageScrollbar={observer:a,scroller:t}}function Za(e){e.stageScrollbar?.observer.disconnect(),e.stageScrollbar=null,Ax(e).style.setProperty(jx,"0px")}function E_(e){return`"${e.replaceAll("\\",String.raw`\\`).replaceAll('"',String.raw`\"`)}"`}function L_(e,t,r){return[`.yRemoteSelection-${e}{background-color:${t}44;}`,`.yRemoteSelectionHead-${e}{position:absolute;border-left:2px solid ${t};height:100%;box-sizing:border-box;}`,`.yRemoteSelectionHead-${e}::after{content:${E_(r)};position:absolute;top:-1.2em;left:-2px;padding:0 4px;border-radius:3px 3px 3px 0;font:10px/1.4 sans-serif;color:#fff;white-space:nowrap;background-color:${t};opacity:0;transition:opacity .15s;pointer-events:none;}`,`.yRemoteSelectionHead-${e}:hover::after{opacity:1;}`].join(`
|
|
1
|
+
import{X}from"./chunks/studio-9c6cbq2c.js";import{Wb,LA,dC,IA,th,ei,Np,rx,sx,VL,RA}from"./chunks/studio-r6mx7vm5.js";import{jn,Fx,Wt,ln,go,mv,Qc,Hx,bh,qp,$a,ml,gv,Gp,Qs,UO,zx,vh,Wx,bv,qO,qm,Vx,ZC,lI,vv,Hn,Vr,Ux,yh,qx,GO,Gx,cI,Gm,an,XC,dI,JO,xn,Oe,XO,QO,eM,tM,nM,hI,pI,St,ti,Hi,qn,oM,mI,Se,pi,gl,To,Xx,rM,Fe,aM,Gn,ed,Sv,Z,Yd,dM,uM,bI,hM,pM,fM,t1,mM,or,Ym,n0,EM,TM,LM,$M,IM,n1,RM,fi,yI,m,h,qr,pn,Da,Sr,oc,r1,s1,a1,rc,bl,l1,Si,Cv,eu,_I,Ft,kI}from"./chunks/studio-knsjyx7n.js";import{rt,Eo,Bp,EO,xr,zp,LO,$O}from"./chunks/studio-g9brbewz.js";import{cf,MI,Av,p,ye}from"./chunks/studio-4fnb5648.js";import{Lh,rf,ar,ta,w,$h,yl,sf,Iv}from"./chunks/studio-sce30r7b.js";import{Es,Co,A$,FC,ic,uO,to,wr,xx,Ts,Hp,hl,no,HC,Tx,F$,j$,Lx,Gc,H$,$x,gO,B$,zC,WC,bO,u,Bd,Ix,wO,W$,VC,zm,tv,nv,xO,ko,_O,Kc,uh,V$,SO,Rx,CO}from"./chunks/studio-pwctzka3.js";import{st,DM,bo,Ch,Zp,nd,NM,AM,OM,EI,Xp,Ev,Tv,tu,Qp,nu,ef}from"./chunks/studio-swedpd82.js";import{rg,af,Rv,jt,Ih,Dv,l0,sc,Wi,fn}from"./chunks/studio-q9hx2qp0.js";import"./chunks/studio-nvcn2ykc.js";import{PC,Ne,Ea,ev,Uc}from"./chunks/studio-n9qba0gx.js";import{bt,jr,uC,ka,Vo,dl,Vb,nh,Bc,pC,AA,OA,fC,MA,qb,hi,Om,UL,Ql,ec,rh,FA,zc,sh,Gb,Ap,vC,HA,yC,GL,BA,zA,Uo,lx,wC,xC,ji,ah,KL,Kb,JL,WA,VA,Op,_C,qA,KA,JA,ux,Mp,Hr,YA,Pm,ZA,XA,CC,QA,kC,eO,EC,Fm,Pp,tO,nO,hx,Gs,lh,Fp,iO,oO,LC,XL,jm,$C,rO,IC,QL,sO,e$,t$,n$,aO,px,i$,RC,ch,lO,cO,dO,o$,r$,Yb,Zb,NC,tc,c$,u$,Vc,gx,bx,h$,p$,f$,m$,g$,b$,v$,y$,w$,x$,AC,C$,Qb,k$,T$,L$,$$,I$,vx,nc,D$,dh,N$,yx}from"./chunks/studio-xva3hzkv.js";import{su,Fv,gf,Rh,cg,Pa,QM,rd,Dh,Jt,Ut,VI,m0,m1,sd,Lo,Rs,g1}from"./chunks/studio-nzemfbkk.js";import{sS,ju,aS,XD,bw,yb,KE,QD}from"./chunks/studio-pj216fmn.js";import{Wr,ft,io}from"./chunks/studio-5tet77de.js";import"./chunks/studio-4zd6an2b.js";import{Um}from"./chunks/studio-hh394phe.js";import{Wp,tI}from"./chunks/studio-bnc50f9h.js";import"./chunks/studio-1ks5d9y4.js";import{zd,DO}from"./chunks/studio-61rg2cz5.js";import{xL,Zw,XN}from"./chunks/studio-jma2q8r9.js";import"./chunks/studio-1410q5dw.js";import{ls,al,LL,Xw,iA}from"./chunks/studio-3pz4t5a2.js";import{sn,Zs,Tn,nt,dt,Z$,sv,X$,qo,Fn}from"./chunks/studio-tpxcryf2.js";import{jO,ae}from"./chunks/studio-wqfaqw4m.js";import{Hd,iC,oC,dA,AL,Bb,tr,ll,OL,ML,PL,Dp,FL,pA,fA,jL,Qu,mA,cl,Ca,gA,nx,bA,vA,yA,Dm,rC,cs,HL,BL,xA,ix,zb,sC,_A,Nm,SA,aC,CA,Xl,eh,kA,lC,zL,cC,Am,EA,ox,WL}from"./chunks/studio-xpx91fby.js";import{lA}from"./chunks/studio-rr00ex23.js";import{qs,nA,sl}from"./chunks/studio-v7a7yb5w.js";import{Ks,Js}from"./chunks/studio-90zkgne5.js";import{Nb,ss,Yl,$m,er,$p,WN,Ju,UN,US,Uw,Fr,KT,JT,Ip,YT}from"./chunks/studio-hfqpfmpk.js";import{Cw,aN,lT,kw,Ul,cN,dN,xm,_m,Ew,Eb,hT,Tw,yN}from"./chunks/studio-z3fztxrp.js";import{$w}from"./chunks/studio-cqxj4fcy.js";import{zt}from"./chunks/studio-daksw8kh.js";import"./chunks/studio-k1wvtp03.js";import{Fd}from"./chunks/studio-frc16j8v.js";import{Ky,Ou,am,ib,O_,hD,M_,P_,F_,j_,Jy,cE,pD,Yy,Zy,Xy,vp,fD,Ld,lm}from"./chunks/studio-c2fa783p.js";import{qu,kT,Dw,ES,TS}from"./chunks/studio-4bgvvzhv.js";import{lS,YE,ZE}from"./chunks/studio-2x972v58.js";import{qS,YN,ZN,Jw,GS,Im,Rm,Mb,ks,XT,JS,Pb,tL,nL,Fb,bL}from"./chunks/studio-mrjtnm62.js";import{jS,zT}from"./chunks/studio-2zz4qbv9.js";import"./chunks/studio-k2evngrj.js";import{Lb,IS,RN,DN,Nw,Aw,RS,NN,rl,Em,$T,IT,RT,DS,Ib,DT,_i,MS,AT,OT,Lm,MT}from"./chunks/studio-a88ej93p.js";import{cb,il,Fu,$D,TE,G_,K_,Rd,LE,$E,J_,RD}from"./chunks/studio-2kpxm0eh.js";import{MD,PE}from"./chunks/studio-2pk7kc7z.js";import{Ad,_S,ql,Lw,vT,SS,kN}from"./chunks/studio-nwf0c32p.js";import{z_,uE,hE,W_,ob,pE}from"./chunks/studio-j5fcp6gj.js";import{ew,vD,yD,wD,xD,sb,fE,Nc,_D,mE,Mu,SD,cm,$d,ab,gE,Pu,tw,nw,iw,vE,V_,ow,yE,rw,U_,wE,CD,lb,xE,q_,_E}from"./chunks/studio-jd1qb1st.js";import{yp,fw,Ac,WD,VD,Q_,mw,HE,UD,qD,fm,Mc,KD,bm,JD,Wl,UE,YD,ZD}from"./chunks/studio-tmfcn347.js";import"./chunks/studio-s24mhq0z.js";import{I_,Wy,QR,mp,nE,R_,Ru,D_,Vy,eD,tD,nb,nD,iE,Uy,oE,N_,iD,oD,rD,qy,Fi,Du,Dc,Nu,sD,aD,gp,rm,Au,bp,Gy,rE,sE,lD,aE,cD,lE,dD,uD,sm,A_}from"./chunks/studio-2e4hry72.js";import{jE,mb}from"./chunks/studio-bg8pzprg.js";import{om,YR,ZR,eE,tE,tb,Hl,Iu}from"./chunks/studio-dn56z7sn.js";import{vS,yS,Dd,Sb,Nd,_a}from"./chunks/studio-amaz545p.js";import{mD,rb,gD,bD}from"./chunks/studio-az3wvyh2.js";import{km,Ku}from"./chunks/studio-1y9mab9m.js";import{xN}from"./chunks/studio-gnazwtv3.js";import"./chunks/studio-k1xqrgm5.js";import{Bl,NE}from"./chunks/studio-evq47j2z.js";import{xb,oT}from"./chunks/studio-cw11h078.js";import{Qy}from"./chunks/studio-0x6f3nk9.js";import{dm}from"./chunks/studio-brh8d2pr.js";import{uw,ub,DD,ND,DE,AD,OD,um}from"./chunks/studio-7rrdbvex.js";import{FD}from"./chunks/studio-xx3r3sb0.js";import"./chunks/studio-z9453ypn.js";import{Vl}from"./chunks/studio-1ctnw3xv.js";import{Pd,Sm,ST,Uu,kS,LN,$N,Rw,CT}from"./chunks/studio-45mj4jqe.js";import{LS}from"./chunks/studio-pm17wdc4.js";import{Bw}from"./chunks/studio-qrzmfaf6.js";import{Vs,GT}from"./chunks/studio-j0zf5x2x.js";import"./chunks/studio-9gr7xs9r.js";import{dv,Gd,Xc,hv}from"./chunks/studio-acer0g8w.js";import{d1,rr,Vt,zi,Cr,kh,kr,C,id,_n,u1,Th,RI,DI,PM,of,ig,og,sr,wn,vl,Na,HM}from"./chunks/studio-4f7thq0p.js";import{Ce,oe,df,na,ru,c0,d0}from"./chunks/studio-v5wktj6f.js";import{zM,WM,FI,Ve,hf,jI,Ln,VM,UM,u0,vt,E,JM,R}from"./chunks/studio-9dq7rwc7.js";import{Me}from"./chunks/studio-0gvvqj3h.js";import{me,te,Gr,Kr,g,le,ja}from"./chunks/studio-3qr08sxq.js";import{iR,v2,y2}from"./chunks/studio-vpevkfxw.js";import{w2}from"./chunks/studio-abh9kfdh.js";import{n,Y,Ze,Q,_,v,Pe,Jn,it}from"./chunks/studio-k3we3kqb.js";import{pp,pe,eo,ce,aF}from"./chunks/studio-0939t1q1.js";aF(import.meta.url,["jkscwbt5","mypr0k6b","hee7ne9b","vqyr5s9x","bwehrp7q","6ztqcrsh","pa0g6ax7","kv0k65cy","m49nmwvx","k2mb9k0r","a51py33c","w5zqwva1","t4fq6bbm","arz2qsy9","mkbcz4z2","rse9h8a0","v0pm96mr","xb8vvt2h","45rhg3me","j74rt0w4","vjzw46xb","9aq8ze3q","2f03wcgw","r4ax11e3","9gy76erh","1sghzgcr","zrqtgt41","9c6cbq2c","r6mx7vm5","knsjyx7n","g9brbewz","4fnb5648","sce30r7b","pwctzka3","swedpd82","q9hx2qp0","nvcn2ykc","n9qba0gx","xva3hzkv","nzemfbkk","pj216fmn","5tet77de","4zd6an2b","hh394phe","bnc50f9h","1ks5d9y4","61rg2cz5","jma2q8r9","1410q5dw","3pz4t5a2","tpxcryf2","wqfaqw4m","xpx91fby","rr00ex23","v7a7yb5w","90zkgne5","hfqpfmpk","z3fztxrp","cqxj4fcy","daksw8kh","k1wvtp03","frc16j8v","c2fa783p","4bgvvzhv","2x972v58","mrjtnm62","2zz4qbv9","k2evngrj","a88ej93p","2kpxm0eh","2pk7kc7z","nwf0c32p","j5fcp6gj","jd1qb1st","tmfcn347","s24mhq0z","2e4hry72","bg8pzprg","dn56z7sn","amaz545p","az3wvyh2","1y9mab9m","gnazwtv3","k1xqrgm5","evq47j2z","cw11h078","0x6f3nk9","brh8d2pr","7rrdbvex","xx3r3sb0","z9453ypn","1ctnw3xv","45mj4jqe","pm17wdc4","qrzmfaf6","j0zf5x2x","9gr7xs9r","acer0g8w","4f7thq0p","v5wktj6f","9dq7rwc7","0gvvqj3h","3qr08sxq","vpevkfxw","abh9kfdh","k3we3kqb","0939t1q1","0khd8xtx","3na1r48j","ejrypvmq","f9qr7kzh","wvf5e6j9","0hw9f835","cfnn70h1","x7t8jbjn","4afr4y6a","r8sfxjjm","h3hcs5gy","t13dyw3c","g0hxtcga","pemtbsjv","3ws9f2w0","nh29rt8a","hnvad61x","zr92pwdp","g38w0d3f","906vx2dq","yjrfeks8","wmjmsw0p","vg1n880b","4fwngwrw","jv4w2bx2","eqcddvc2","vj30te2h","hy2mws8v","k0xzrse2","q80fg1d6","egnjpyde","jg1dtphj"],[["./studio.js",27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106],["./chunks/media-open-mypr0k6b.js",47,49,46,44,42,97,43,29,34,27,32,35,31,100,39,36,48,45],["./chunks/parse-hee7ne9b.js",27],["./chunks/references-vqyr5s9x.js",42,27,31],["./chunks/notify-bwehrp7q.js",32],["./chunks/workspace-6ztqcrsh.js",29,34,32,35,31,36],["./chunks/monaco-buffer-pa0g6ax7.js",34,32],["./chunks/platform-kv0k65cy.js",31],["./chunks/layers-m49nmwvx.js",50,41,51,27,32,100,39,36],["./chunks/lit-html-k2mb9k0r.js",41],["./chunks/monaco-binding-a51py33c.js",107,108,105],["./chunks/components-w5zqwva1.js",37,31],["./chunks/grid-open-t4fq6bbm.js",66,61,56,96,54,49,53,52,28,38,37,33,30,55,46,50,41,44,42,97,51,43,29,34,27,32,35,31,100,39,36,48,45],["./chunks/ws-client-arz2qsy9.js",108,86],["./chunks/cf-settings-mkbcz4z2.js",83,30,32,31],["./chunks/workspace-home-rse9h8a0.js",72,69,70,89,64,90,91,57,71,58,63,68,94,66,59,61,56,96,65,67,47,54,49,53,52,28,38,37,33,30,55,46,50,41,44,42,97,51,43,29,34,27,32,35,31,100,39,36,48,45,60],["./chunks/add-new-flow-v0pm96mr.js",27,31,32,41,39,36,50,51,35,29,34,61,42,43,44,52,30,33,53,54,28,45,46,48,49,38,37,55,56,65,66,47,67,68,59,75,58,60,79,63,57,40,73,85,80,69,87,90,91,94,96,97,98,100,102,105],["./chunks/cf-account-picker-xb8vvt2h.js",27,31,32,41,39,36,50,51,67,30,83,52,88,100,102],["./chunks/fs-events-45rhg3me.js",44,42,43,29,34,27,32,35,31,36],["./chunks/media-library-j74rt0w4.js",64,90,63,59,56,96,47,54,49,53,52,28,38,37,33,30,55,46,50,41,44,42,97,51,43,29,34,27,32,35,31,100,39,36,48,45],["./chunks/extension-sections-vjzw46xb.js",31,35,27,32,29,34,36,39,58,41,50,51,59,60,81,71,30,33,82,66,42,43,44,52,53,54,28,61,45,46,48,49,38,37,55,56,96,97,100,102,105],["./chunks/iframe-host-9aq8ze3q.js",38,37,33,30,55,97,51,43,29,34,27,32,35,31,39,36,45],["./chunks/grid-view-2f03wcgw.js",31,35,36,41,39,50,32,51,27,63,43,29,34,42,44,45,46,61,52,30,33,53,54,28,48,49,38,37,55,56,92,96,109,97,100,101,102,105],["./chunks/jx-validate-r4ax11e3.js",81],["./chunks/format-host-9gy76erh.js",35,31],["./chunks/file-ops-1sghzgcr.js",56,96,54,49,53,52,28,38,37,33,30,55,46,50,41,44,42,97,51,43,29,34,27,32,35,31,100,39,36,48,45],["./chunks/files-zrqtgt41.js",68,94,66,59,61,56,96,65,67,47,54,49,53,52,28,38,37,33,30,55,46,50,41,44,42,97,51,43,29,34,27,32,35,31,100,39,36,48,45],["./chunks/studio-9c6cbq2c.js"],["./chunks/studio-r6mx7vm5.js",29,30,33,98,102],["./chunks/studio-knsjyx7n.js",32,34,31,35,36,98,99,102,105,106],["./chunks/studio-g9brbewz.js",31,32],["./chunks/studio-4fnb5648.js",105],["./chunks/studio-sce30r7b.js",102,105],["./chunks/studio-pwctzka3.js",27,31,32,29,35,30,98,102,105,106],["./chunks/studio-swedpd82.js",32,102,105],["./chunks/studio-q9hx2qp0.js",31,105,106],["./chunks/studio-nvcn2ykc.js"],["./chunks/studio-n9qba0gx.js",31,98,105],["./chunks/studio-xva3hzkv.js",31,29,32,34,35,37,43,45,39,55,51,33,97,98,99,101,102,104,105,106],["./chunks/studio-nzemfbkk.js",36,102,105,106],["./chunks/studio-pj216fmn.js",37,38,29,33,98,99,102],["./chunks/studio-5tet77de.js"],["./chunks/studio-4zd6an2b.js",31,27,105],["./chunks/studio-hh394phe.js",36,102,105],["./chunks/studio-bnc50f9h.js",31,42,43,29,98],["./chunks/studio-1ks5d9y4.js"],["./chunks/studio-61rg2cz5.js",27,31,32,42,29,36,43,44,45,97,98,105],["./chunks/studio-jma2q8r9.js",29,32,31,43,45,46,48,49,113,100,102,105,106],["./chunks/studio-1410q5dw.js",45],["./chunks/studio-3pz4t5a2.js",27,31,32,36,29,42,46,48,98,100,102,105,106],["./chunks/studio-tpxcryf2.js",41,39,32,51,27,100,102,105],["./chunks/studio-wqfaqw4m.js",102],["./chunks/studio-xpx91fby.js",31,30,32,50,105],["./chunks/studio-rr00ex23.js",31,52,51,33,98,100,102,105],["./chunks/studio-v7a7yb5w.js",41,32,39,50,33,53,28,100,102],["./chunks/studio-90zkgne5.js",106],["./chunks/studio-hfqpfmpk.js",31,27,42,32,29,35,44,46,49,39,50,38,33,54,96,99,102,105],["./chunks/studio-z3fztxrp.js",31,27,29,35,36,43,45,46,61,51,38,56,58,94,113,98,99,100,102,105,106],["./chunks/studio-cqxj4fcy.js",39,29,59,99,100,102,105],["./chunks/studio-daksw8kh.js",39,50,100,101,102],["./chunks/studio-k1wvtp03.js"],["./chunks/studio-frc16j8v.js",31,29,35,36,44,38,56,98,102,105,106],["./chunks/studio-c2fa783p.js",39,29,33,37,38,90,98,99,100,102,105,106],["./chunks/studio-4bgvvzhv.js",31,50,43,45,46,97,98,100,101,102,106],["./chunks/studio-2x972v58.js",27,31,32,42,39,50,29,43,46,49,63,59,47,90,100,101,102,105,106],["./chunks/studio-mrjtnm62.js",27,31,45,35,29,32,39,47,33,50,67,54,38,109,98,100,102,105,106],["./chunks/studio-2zz4qbv9.js",29,31,35,50,44,61,56,98,100,102,105],["./chunks/studio-k2evngrj.js",27,32,39,50,100,102],["./chunks/studio-a88ej93p.js",41,27,50,32,51,31,35,42,43,29,44,30,33,54,28,37,45,55,65,46,66,49,56,47,59,119,94,95,98,100,102,105,106],["./chunks/studio-2kpxm0eh.js",31,61,27,32,50,29,54,59,42,45,46,38,56,68,57,90,91,119,94,113,98,100,102,105,106],["./chunks/studio-2pk7kc7z.js",27,51,31,50,33,53,54,65,38,89,98,100,102,105],["./chunks/studio-nwf0c32p.js",51,27,29,33,50,100,102,105],["./chunks/studio-j5fcp6gj.js",29,64,69,70,71],["./chunks/studio-jd1qb1st.js",29,32,34,31,33,51,58,50,59,57,45,61,49,38,55,56,40,68,79,94,97,98,100,101,102,105,106],["./chunks/studio-tmfcn347.js",41,29,32,34,31,35,39,28,33,50,51,58,37,38,55,40,59,63,42,96,98,99,100,101,102,105,106],["./chunks/studio-s24mhq0z.js",46],["./chunks/studio-2e4hry72.js",41,29,32,34,33,28,37,39,62,42,50,51,38,55,74,59,87,119,98,99,100,101,102,105,106],["./chunks/studio-bg8pzprg.js",31,35,50,51,29,68,98,100,102,105],["./chunks/studio-dn56z7sn.js",29,33,39,62,74,50,51,58,38,59,42,73,98,99,100,102,105],["./chunks/studio-amaz545p.js",27,58,29,63,100,102,105,106],["./chunks/studio-az3wvyh2.js",31,37,29,35,46,55,38,41,50,28,61,63,69,90,57,98,100,102,105,106],["./chunks/studio-1y9mab9m.js",128,105,106],["./chunks/studio-gnazwtv3.js",27,31,32,58,81,71,33,66,98,100,102,105],["./chunks/studio-k1xqrgm5.js",30],["./chunks/studio-evq47j2z.js",51,31,52,39,50,53,83,98,100,102,105,106],["./chunks/studio-cw11h078.js",35,32,29,36,27,79,46,61,33,38,75,57,91,94,105,106],["./chunks/studio-0x6f3nk9.js"],["./chunks/studio-brh8d2pr.js",27,29,32,31,37,50,75,56,33,98,99,105],["./chunks/studio-7rrdbvex.js",67,31,83,52,106],["./chunks/studio-xx3r3sb0.js",31,51,52,32,50,27,29,33,53,54,46,65,98,106],["./chunks/studio-z9453ypn.js",39,31,43,29,35,37,38,56,97,98,105],["./chunks/studio-1ctnw3xv.js",29,57,38,106],["./chunks/studio-45mj4jqe.js",105],["./chunks/studio-pm17wdc4.js",105],["./chunks/studio-qrzmfaf6.js",29,61,98,105],["./chunks/studio-j0zf5x2x.js",105],["./chunks/studio-9gr7xs9r.js",31,98,35,99,105],["./chunks/studio-acer0g8w.js",31,36,43,29,98],["./chunks/studio-4f7thq0p.js",105],["./chunks/studio-v5wktj6f.js",105],["./chunks/studio-9dq7rwc7.js",39],["./chunks/studio-0gvvqj3h.js"],["./chunks/studio-3qr08sxq.js"],["./chunks/studio-vpevkfxw.js"],["./chunks/studio-abh9kfdh.js"],["./chunks/studio-k3we3kqb.js"],["./chunks/studio-0939t1q1.js"],["./chunks/studio-0khd8xtx.js",108,99,105],["./chunks/studio-3na1r48j.js",105],["./chunks/studio-ejrypvmq.js"],["./chunks/index-f9qr7kzh.js",107,108,95,99],["./chunks/editor-wvf5e6j9.js",132],["./chunks/monaco-setup-0hw9f835.js",132,135,60,128,104,105,106],["./chunks/studio-cfnn70h1.js"],["./chunks/image-editor-x7t8jbjn.js",39,36,100,101,102,105],["./chunks/image-bake-4afr4y6a.js",45,48],["./chunks/convert-to-repeater-r8sfxjjm.js",29,32,34,31,35,36,41,39,50,51,27,74,58,60,28,30,33,37,43,45,38,55,40,59,63,42,44,46,96,97,98,99,100,102,105],["./chunks/source-control-h3hcs5gy.js",65,67,47,54,49,53,52,28,38,37,33,30,55,46,50,41,44,42,97,51,43,29,34,27,32,35,31,100,39,36,48,45],["./chunks/entry-commands-t13dyw3c.js",85,79,75,91,57,58,63,94,59,61,56,96,54,49,53,52,28,38,37,33,30,55,46,50,41,44,42,97,51,43,29,34,27,32,35,31,100,39,36,48,45,60],["./chunks/studio-g0hxtcga.js",101,105],["./chunks/media-picker-pemtbsjv.js",63,46,50,41,44,42,97,51,43,29,34,27,32,35,31,100,39,36,45],["./chunks/right-panel-3ws9f2w0.js",78,62,73,74,40,90,79,57,58,63,68,94,66,59,61,56,96,65,67,47,54,49,53,52,28,38,37,33,30,55,46,50,41,44,42,97,51,43,29,34,27,32,35,31,100,39,36,48,45,60],["./chunks/quick-search-nh29rt8a.js",77,68,94,66,59,61,56,96,65,67,47,54,49,53,52,28,38,37,33,30,55,46,50,41,44,42,97,51,43,29,34,27,32,35,31,100,39,36,48,45],["./chunks/adapter-hnvad61x.js",55],["./chunks/layers-panel-zr92pwdp.js",76,62,87,74,40,90,75,58,63,59,56,96,54,49,53,52,28,38,37,33,30,55,46,50,41,44,42,97,51,43,29,34,27,32,35,31,100,39,36,48,45,60],["./chunks/content-source-g38w0d3f.js",61,56,96,54,49,53,52,28,38,37,33,30,55,46,50,41,44,42,97,51,43,29,34,27,32,35,31,100,39,36,48,45],["./chunks/2020-906vx2dq.js",136,106],["./chunks/index-yjrfeks8.js",136,106],["./chunks/studio-wmjmsw0p.js"],["./chunks/publish-panel-vg1n880b.js",84,83,53,52,33,30,50,41,51,29,34,27,32,35,31,100,39,36],["./chunks/publish-quick-4fwngwrw.js",27,32,51,30,31,33,29,34,35,36,41,39,50,52,53,54,28,45,42,43,44,46,47,48,49,67,65,37,38,55,89,97,100,102],["./chunks/publish-workspace-jv4w2bx2.js",70,89,65,67,47,54,49,53,52,28,38,37,33,30,55,46,50,41,44,42,97,51,43,29,34,27,32,35,31,100,39,36,48,45],["./chunks/studio-eqcddvc2.js"],["./chunks/jsonMode-vj30te2h.js",132,137,135],["./chunks/javascript-hy2mws8v.js",132],["./chunks/studio-k0xzrse2.js",132,106],["./chunks/studio-q80fg1d6.js",106],["./chunks/studio-egnjpyde.js",132,135],["./chunks/tsMode-jg1dtphj.js",132,137,135]],0);
|
|
2
|
+
var BI=pe(function(Ske,HI){var du=Object.prototype.hasOwnProperty,zI=Object.prototype.toString,{defineProperty:PI,getOwnPropertyDescriptor:NI}=Object,AI=function e(t){if(typeof Array.isArray==="function")return Array.isArray(t);return zI.call(t)==="[object Array]"},II=function e(t){if(!t||zI.call(t)!=="[object Object]")return!1;var r=du.call(t,"constructor"),o=t.constructor&&t.constructor.prototype&&du.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!r&&!o)return!1;var a;for(a in t);return typeof a>"u"||du.call(t,a)},LI=function e(t,r){if(PI&&r.name==="__proto__")PI(t,r.name,{enumerable:!0,configurable:!0,value:r.newValue,writable:!0});else t[r.name]=r.newValue},OI=function e(t,r){if(r==="__proto__"){if(!du.call(t,r))return;else if(NI)return NI(t,r).value}return t[r]};HI.exports=function e(){var t,r,o,a,i,s,l=arguments[0],f=1,c=arguments.length,d=!1;if(typeof l==="boolean")d=l,l=arguments[1]||{},f=2;if(l==null||typeof l!=="object"&&typeof l!=="function")l={};for(;f<c;++f)if(t=arguments[f],t!=null){for(r in t)if(o=OI(l,r),a=OI(t,r),l!==a){if(d&&a&&(II(a)||(i=AI(a)))){if(i)i=!1,s=o&&AI(o)?o:[];else s=o&&II(o)?o:{};LI(l,{name:r,newValue:e(d,s,a)})}else if(typeof a<"u")LI(l,{name:r,newValue:a})}}return l}});var _w=[],mf=null,Fl=null;function f_(){mf=null;let e=Fl;if(!e)return;for(let t of _w.splice(0))e.call(document.head,t)}function h_(e){if(e instanceof HTMLLinkElement&&e.rel==="modulepreload"){if(_w.push(e),mf===null)mf=requestAnimationFrame(f_);return e}return Fl?Fl(e):e}function zw(){let e=document.head;if(!e||e.__modulePreloadsBatched)return;Fl=Node.prototype.appendChild.bind(e),e.__modulePreloadsBatched=!0,e.appendChild=h_}var An=new Map;function Hw(e){let t=An.get(e);if(t)return t;let r={map:null,step:-1,view:"visual"};return An.set(e,r),r}function ff(e,t){let r=Hw(e);r.map=t;let o=t?.steps.length??0;r.step=o===0?-1:Math.min(r.step,o-1)}function bf(e){return An.get(e)?.map??null}function _l(e){return An.get(e)?.map?.steps.length??0}function Vw(e){return An.get(e)?.step??-1}function Ww(e,t){let r=An.get(e),o=r?.map?.steps.length??0;if(!r||o===0)return null;let a=r.step===-1?t===1?0:o-1:r.step+t;if(a<0||a>=o)return null;return r.step=a,a}function Wo(e){return An.get(e)?.view??"visual"}function Xa(e,t){return!t||Wo(e)==="code"}function yf(e,t){Hw(e).view=t}function qw(e){An.delete(e)}var Gw={$schema:"https://jxsuite.com/schema/v1",$id:"StudioDiffToolbar",$description:"The Compare view's own bar: which half of a comparison is showing, how many changes there are, and how to walk them. `canvas/diff-toolbar.ts` keeps every decision — what the count means for the view that is showing, which step is reachable, whether this comparison has a visual half at all — and this document owns the markup, the ARIA, the keyboard and the style. The Visual/Code pair is a real radiogroup now rather than a role written by hand over a Spectrum button that overwrote it: `jx-action-group selects=\"single\"` is the group and `checked` is what makes each `jx-action-button` a radio, so the caret roves between them and `aria-checked` is the element's own rather than an attribute the template hoped would survive an upgrade.",tagName:"div",attributes:{part:"toolbar",role:"group","aria-label":"Changes against HEAD"},style:{$description:"`styles/canvas.css`'s `.diff-toolbar-inner` and the three text runs under it, keyed on `part`. The bar's POSITION is not here: the stage draws the absolutely-positioned host this mounts into (`surfaces/canvas-stage.json`, `[part=\"diff-toolbar\"]`), because where a floating bar sits over a pan/zoom surface is a fact about the stage rather than about the bar.",display:"flex",gap:"var(--jx-space-2)",alignItems:"center",padding:"4px var(--jx-space-2)",border:"1px solid var(--border)",borderRadius:"var(--radius)",background:"var(--bg)",boxShadow:"var(--jx-shadow-popover)",fontFamily:"var(--jx-font-sans)",'& [part="view"]':{$description:"Spacing only: the segmented look is `jx-action-group`'s own `compact`, exactly as it was Spectrum's.",flexShrink:"0"},'& [part="view-static"], & [part="count"], & [part="note"]':{color:"var(--fg)",fontSize:"var(--jx-text-sm)",whiteSpace:"nowrap"},'& [part="count"]':{$description:"Tabular figures so the counter does not jitter its neighbours as it steps.",fontVariantNumeric:"tabular-nums"},'& [part="note"]':{color:"var(--fg-dim)"},'& [part="stepper"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)"}},children:[{$description:'The Visual/Code pair, or a static label. A control that cannot move is not drawn as a control — the rule `editorKindTpl` states for a document with one editor kind — so a comparison the canvas cannot draw says "Code" in words rather than offering a Visual button it would have to disable.',tagName:"div",attributes:{part:"view-slot"},style:{display:"contents"},$switch:{$ref:"#/state/viewMode"},cases:{static:{tagName:"span",attributes:{part:"view-static"},textContent:"Code"},choice:{tagName:"jx-action-group",attributes:{part:"view"},$props:{selects:"single",compact:!0,label:"Diff view"},children:[{tagName:"jx-action-button",attributes:{part:"view-visual"},$props:{size:"sm",checked:"${state.visualChecked}",hint:"Show the change on the page"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/showVisual"},value:[]}]},children:[{tagName:"span",textContent:"Visual"}]},{tagName:"jx-action-button",attributes:{part:"view-code"},$props:{size:"sm",checked:"${state.codeChecked}",hint:"Show the change in the file's text"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/showCode"},value:[]}]},children:[{tagName:"span",textContent:"Code"}]}]}}},{$description:'The count, and — only when there is somewhere to step — the two buttons around it. Before the first step it reads "12 changes" rather than "0 of 12", because the author is not on a change yet. The counter is text rather than a button because it has no verb.',tagName:"div",attributes:{part:"stepper-slot"},style:{display:"contents"},$switch:{$ref:"#/state/stepper"},cases:{hidden:{tagName:"span",attributes:{part:"count"},textContent:"${state.countLabel}"},shown:{tagName:"span",attributes:{part:"stepper"},children:[{tagName:"jx-action-button",attributes:{part:"previous"},$props:{size:"sm",quiet:!0,icon:"caret-up",label:"Previous change",hint:"Previous change",disabled:{$ref:"#/state/prevDisabled"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/previous"},value:[]}]}},{tagName:"span",attributes:{part:"count"},textContent:"${state.countLabel}"},{tagName:"jx-action-button",attributes:{part:"next"},$props:{size:"sm",quiet:!0,icon:"caret-down",label:"Next change",hint:"Next change",disabled:{$ref:"#/state/nextDisabled"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/next"},value:[]}]}}]}}},{$description:"The alignment was degraded: a group of siblings was too large to pair up, so some changes are shown as an add and a remove rather than as one modification. Reported rather than hidden — a reader counting changes deserves to know the count is coarser than usual.",tagName:"div",attributes:{part:"degraded-slot"},style:{display:"contents"},$switch:{$ref:"#/state/degraded"},cases:{shown:{tagName:"span",attributes:{part:"note",title:"A group of siblings was too large to pair up"},textContent:"some shown as add/remove"}}},{$description:"A root key moved — `state`, `$media`, a document setting. Those are never tinted on the artboards, because they have no node to tint, so the bar states them in words and the tooltip names them.",tagName:"div",attributes:{part:"root-keys-slot"},style:{display:"contents"},$switch:{$ref:"#/state/rootKeys"},cases:{shown:{tagName:"span",attributes:{part:"note",title:"${state.rootKeysTitle}"},textContent:"document settings changed"}}}]};E("diff-toolbar",Gw);function Kw(e,t){e.viewMode=t.viewMode,e.visualChecked=t.visualChecked,e.codeChecked=t.codeChecked,e.countLabel=t.countLabel,e.stepper=t.stepper,e.prevDisabled=t.prevDisabled,e.nextDisabled=t.nextDisabled,e.degraded=t.degraded,e.rootKeys=t.rootKeys,e.rootKeysTitle=t.rootKeysTitle}function Yw(e,t,r){e.replaceChildren();let o=g({codeChecked:"false",countLabel:"",degraded:"hidden",next:r.next,nextDisabled:!0,prevDisabled:!0,previous:r.previous,rootKeys:"hidden",rootKeysTitle:"",showCode:r.showCode,showVisual:r.showVisual,stepper:"hidden",viewMode:"choice",visualChecked:"true"});Kw(o,t);let a=null,i=!1,s=R("diff-toolbar",o,e).then((l)=>{let f=l.root;if(i)return l.dispose(),f;return a=l,f});return{dispose(){i=!0,a?.dispose(),a=null},ready:s,update:(l)=>Kw(o,l)}}var Qa=new Map;function zl(e,t){let r=Qa.get(e);if(r&&r.host!==t)r.surface?.dispose(),Qa.delete(e);if(t&&!Qa.has(e))Qa.set(e,{host:t,surface:null})}var ax=()=>{};function cx(e){ax=e}var dx=null;function mx(e){dx=e}function fx(e){bo(e).prevCanvasMode=null,ax(e),dx?.()}function Jl(e){let t=Qa.get(e);if(!t)return;let r=y_(e);if(t.surface){t.surface.update(r);return}t.surface=Yw(t.host,r,{next:()=>ex(e,1),previous:()=>ex(e,-1),showCode:()=>Qw(e,"code"),showVisual:()=>Qw(e,"visual")})}function Qw(e,t){if(Wo(e)===t)return;yf(e,t),fx(e)}function b_(e,t,r){let o=e.kind==="modified"?"changed":e.kind;return`Change ${t+1} of ${r}, ${o}.`}function ex(e,t){wf(e,t).catch((r)=>{console.warn("stepDiffAndReveal:",r)})}async function wf(e,t){let r=Ww(e,t);if(r===null)return;Jl(e);let o=bf(e)?.steps[r],{panels:a}=bo(e),i=a[0]?.canvas,s=a[1]?.canvas;if(!o)return;let{hostForCanvas:l,measureInCanvas:f,revealCanvasPathIn:c}=await (ce("9aq8ze3q"),import("./chunks/iframe-host-9aq8ze3q.js")),b=(await Promise.all([o.originalPath&&i?f(i,o.originalPath):null,o.currentPath&&s?f(s,o.currentPath):null])).filter((j)=>j!==null),y=b_(o,r,_l(e));if(b.length===0){Lh(`${y} Not shown on the canvas.`);return}let x=Math.min(...b.map((j)=>j.top)),S=Math.max(...b.map((j)=>j.top+j.height));IC({height:S-x,top:x},bo(e));let P=o.currentPath&&s?l(s):null;if(P&&o.currentPath)await c(P,o.currentPath);Lh(y)}function y_(e){let t=bf(e),r=Wo(e)==="code"||t===null,o=r?0:_l(e),a=r?-1:Vw(e),i=r?"Changed lines are marked":o===0?"No changes":a<0?`${o} ${o===1?"change":"changes"}`:`${a+1} of ${o}`,s=Wo(e);return{codeChecked:s==="code"?"true":"false",countLabel:i,degraded:!r&&t.degraded?"shown":"hidden",nextDisabled:a>=o-1,prevDisabled:a<=0,rootKeys:!r&&t.rootKeys.length>0?"shown":"hidden",rootKeysTitle:`Changed: ${t?.rootKeys.join(", ")??""}`,stepper:o===0?"hidden":"shown",viewMode:t===null?"static":"choice",visualChecked:s==="visual"?"true":"false"}}function vf(e){let{pane:t}=e;return n(t)?t:m.activePaneId}var wx=Fe("Which pane to act on. Defaults to the focused one."),tx=Se({pane:wx},[]);function kx(){let e=(t)=>_l(t)>0;return[{args:tx,category:"View",group:"3_canvas",id:"diff.nextChange",keybinding:"f7",keyScope:"global",level:"document",menus:["palette"],requires:"a pane showing a comparison with changes",title:"Next Change",undo:"none",when:(t)=>t.editor.kind==="diff",enablement:()=>e(m.activePaneId),run:(t,r)=>wf(vf(r),1)},{args:tx,category:"View",group:"3_canvas",id:"diff.previousChange",keybinding:"shift+f7",keyScope:"global",level:"document",menus:["palette"],requires:"a pane showing a comparison with changes",title:"Previous Change",undo:"none",when:(t)=>t.editor.kind==="diff",enablement:()=>e(m.activePaneId),run:(t,r)=>wf(vf(r),-1)},{args:Se({pane:wx,view:pi(["visual","code"],"Which half of the comparison to show.")},["view"]),category:"View",group:"3_canvas",id:"diff.setView",level:"document",menus:["palette"],requires:"a pane showing a comparison",title:"Set Diff View",undo:"none",when:(t)=>t.editor.kind==="diff",run:(t,r)=>{let o=qn("diff.setView",r,"view",["visual","code"]),a=vf(r);if(Wo(a)===o)return;yf(a,o),fx(a)}}]}var v_=250000;class Sx{original=[];current=[];steps=[];rootKeys=[];degraded=!1;maxCells;seen=new Set;constructor(e){this.maxCells=e}emit(e,t,r){let o=`${e}:${t?JSON.stringify(t):""}:${r?JSON.stringify(r):""}`;if(this.seen.has(o))return;if(this.seen.add(o),t&&e!=="added")this.original.push({kind:e,path:t});if(r&&e!=="removed")this.current.push({kind:e,path:r});this.steps.push({currentPath:r,kind:e,originalPath:t})}diffNode(e,t,r,o){let a=e.length===0&&t.length===0,i=!1;for(let f of new Set([...Object.keys(r),...Object.keys(o)])){if(f==="children"||Vs(r[f],o[f]))continue;if(a){if(!this.rootKeys.includes(f))this.rootKeys.push(f)}else i=!0}if(i)this.emit("modified",e,t);let s=r.children,l=o.children;if(Array.isArray(s)&&Array.isArray(l))this.diffChildren(e,t,s,l);else if(!Vs(s,l)&&!a)this.emit("modified",e,t)}diffChildren(e,t,r,o){if(r.length*o.length>this.maxCells)this.degraded=!0;let a=GT(r,o,{maxCells:this.maxCells}),i=0,s=0;for(let l of a){for(;i<l.aIndex;i++)this.emitChild("removed",e,t,r[i],i,null);for(;s<l.bIndex;s++)this.emitChild("added",e,t,o[s],null,s);if(!l.identical){let f=r[l.aIndex],c=o[l.bIndex];if(v(f)&&v(c))this.diffNode([...e,"children",l.aIndex],[...t,"children",l.bIndex],f,c);else if(!Vs(f,c))this.emit("modified",e,t)}i=l.aIndex+1,s=l.bIndex+1}for(;i<r.length;i++)this.emitChild("removed",e,t,r[i],i,null);for(;s<o.length;s++)this.emitChild("added",e,t,o[s],null,s)}emitChild(e,t,r,o,a,i){if(!v(o)){this.emit("modified",t,r);return}this.emit(e,a===null?null:[...t,"children",a],i===null?null:[...r,"children",i])}}function Cx(e,t,r={}){let o=new Sx(r.maxCells??v_);return o.diffNode([],[],e,t),{current:o.current,degraded:o.degraded,original:o.original,rootKeys:o.rootKeys,steps:o.steps}}var Px={$schema:"https://jxsuite.com/schema/v1",$id:"StudioPaneGrid",$description:"The pane grid (studio.md §18.1): one cell per pane, with a splitter before every cell but the first. Every box here is EMPTY by design — the FOUR inside a cell are hosts other modules fill (`panels/tab-strip.ts` the strip, `panels/pane-context.ts` the chrome layer, `canvas/canvas-render.ts` the stage, `panels/pane-grid.ts` itself the right-edge drop zone), and the stage is an ISLAND in the studio-ui-guidelines.md §9.4 sense: the canvas host mounts a cross-origin `<iframe>` into it, so nothing this document draws may ever go inside it. What the document owns is the STRUCTURE and the STYLE — the cell's own two-row grid, the three row-2 children that share its lower cell, and the splitter — which is `styles/shell.css`'s `.pane*` block and `styles/canvas.css`'s `.pane-stage` rule, carried here and keyed on `part`. Two things are load-bearing and easy to undo. (1) **A row that moves reloads an iframe**, so the keyed `$map` is not an optimisation: `workspace.panes[0]` is always the primary and `MAX_PANES` is 2, the key is the pane id, and the runtime's forward-cursor pass therefore never moves a kept row — gaining or losing the side pane leaves the primary's node, and the frame inside it, untouched. (2) **The splitter must sit BETWEEN two cells and inside neither**, so each row is a `display: contents` wrapper holding its own leading splitter and its cell: the wrapper generates no box, so the splitter and the two cells are the grid items of `#pane-grid` in DOM order, and a pointer landing on the splitter is in no cell at all. Every selector below is a `>` chain from the root, because a pane's stage hosts other surface documents and a bare `[part=\"row\"]` descendant rule would reach into them.",tagName:"div",attributes:{part:"grid",role:"none"},style:{$description:"The pane's own layout, and the splitter's. The tracks of `#pane-grid` ITSELF are not here and must not be: the track count depends on `workspace.panes.length` and the split on `shell.paneSplit`, which is written on every `pointermove` of a drag — `panels/pane-grid.ts` writes them as one inline `grid-template-columns` on the host, so a drag moves a track edge and never a node. The splitter's own paint is not here either: `jx-split` owns the hairline, the cursors and the drag state it mirrors as `data-dragging`, so this block says only where the element is placed.",display:"contents",'& > [part="row"]':{$description:"One pane's row: its leading splitter and its cell, generating no box of their own so both are grid items of `#pane-grid`.",display:"contents"},'& > [part="row"] > [part="splitter-slot"]':{display:"contents"},'& > [part="row"] > [part="splitter-slot"] > jx-split':{$description:"WHERE the splitter sits, and nothing about what it looks like: the hairline, the two cursors, the hover and drag colours and the focus ring are `jx-split`'s own, and the `.dragging` class this block used to name is gone with the module that wrote it — the element mirrors its own gesture as `data-dragging` and paints itself. BOTH grid axes are `auto`: a definite row position — the `2 / 4` a column handle inherits on the APP grid, or the `1 / -1` this rule used to carry — moves the item into an earlier step of CSS Grid's auto-placement, so the splitter claimed column 1 and the two cells flowed around it into the 5px track and the second half. DOM order was already right; the placement algorithm was not reading it. `width: auto` with `justify-self: stretch` is what hands the thickness back to the TRACK `panels/pane-grid.ts` writes, so the element's own 5px default cannot disagree with the column it is placed in.",gridRow:"auto",gridColumn:"auto",justifySelf:"stretch",margin:"0",width:"auto",zIndex:"10"},'& > [part="row"] > [part="pane"]':{$description:'ONE PANE, and one COLUMN, declared. Three children name `grid-row: 2` in order to share the lower cell, and auto-placement answers that by inventing an implicit column each: the chrome layer, the stage and the drop zone lined up side by side (with a fourth, the jump bar, that has since moved to the status bar), the stage taking a fraction of the pane and pinning the document to the right edge. `grid-template-columns` is what makes "share the cell" mean it, and every row-2 child restates `grid-column: 1` so a future fourth one cannot re-open the same hole. No unit test can see this — happy-dom does no layout, so every rect is zero — which is why the screenshot lane is what caught it.',display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gridTemplateRows:"auto minmax(0, 1fr)",minWidth:"0",minHeight:"0"},'& > [part="row"] > [part="pane"] > [part="strip"]':{gridRow:"1",gridColumn:"1",minHeight:"0",minWidth:"0"},'& > [part="row"] > [part="pane"] > [part="strip"]:empty':{$description:"A pane with nothing to say costs no band. The strip host is empty until `panels/tab-strip.ts` mounts a document into it, and empty again the moment it disposes.",display:"none"},'& > [part="row"] > [part="pane"] > [part="chrome"]':{$description:"The pane context bar and the floating zoom pod. The layer itself is inert and only its children take the pointer; `surfaces/pane-context.json` owns what they look like.",gridRow:"2",gridColumn:"1",position:"relative",zIndex:"2",minWidth:"0",display:"flex",flexDirection:"column",justifyContent:"space-between",pointerEvents:"none"},'& > [part="row"] > [part="pane"] > [part="chrome"] > *':{pointerEvents:"auto"},'& > [part="row"] > [part="pane"] > [part="pane-stage"]':{$description:"The stage: the pane's own axis (`styles/canvas.css`) over its placement in the cell (`styles/shell.css`). Offset by the context bar stacked over this cell — `--pane-context-h`, written by `panels/pane-context.ts` onto the CELL, which is why this reads it by cascade — so the bar never covers the document, and by zero when no tab is open, so the welcome screen does not sit under a band nothing explains. A pane's address used to be a second bar stacked here (`--jump-bar-h`); it is the status bar's breadcrumb trail now, and costs the stage nothing.",gridRow:"2",gridColumn:"1",marginTop:"var(--pane-context-h, 0px)",position:"relative",overflow:"auto",background:"var(--bg-panel)",minWidth:"0",display:"flex",gap:"var(--jx-space-6)",alignItems:"flex-start"},'& > [part="row"] > [part="pane"] > [part="drop-zone"]':{$description:"The right-edge target that creates a second pane (§18.1). Sits ABOVE the stage (`z-index: 4` against the stage's own stacking, chrome's 2) so a drag reaches it before it reaches the cross-origin iframe underneath, which would otherwise swallow every drag event with no affordance to say so. `pointer-events: none` when unarmed — a mouse doing anything other than dragging a tab or a file must pass straight through to the stage — and `auto` only while `data-armed` is set, which `panels/pane-grid.ts`'s own arming monitor writes for the DURATION of a drag it recognises, never for a click.",gridRow:"2",gridColumn:"1",position:"relative",zIndex:"4",minWidth:"0",pointerEvents:"none"},'& > [part="row"] > [part="pane"] > [part="drop-zone"][data-armed]':{pointerEvents:"auto"},'& > [part="row"] > [part="pane"] > [part="drop-zone"][data-over]::after':{$description:"The right BAND, not the whole cell: the zone only ever ACCEPTS a drop in that band (`panels/pane-grid.ts`'s `edgeData`), so lighting the whole cell would promise a drop this element refuses everywhere else in it.",content:'""',position:"absolute",insetBlock:"0",insetInlineEnd:"0",insetInlineStart:"50%",background:"color-mix(in srgb, var(--accent) 14%, transparent)",borderInlineStart:"2px solid var(--accent)"}},children:[{$description:"Keyed on the PANE ID, and that is the whole of §18.1 rule 1's structural half: the key is what makes the runtime MOVE a kept row rather than rebuild it, and re-parenting is not a move for an `<iframe>` — it reloads, dropping its `iframe-channel` connection, its shadow document and every `ready` panel with it. A row renders complete (its cell, its four hosts and its splitter) inside the row's own effect scope before it is inserted, so there is no frame in which a cell exists with no stage inside it.",$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/id"},map:{tagName:"div",attributes:{part:"row",role:"none"},children:[{$description:"Present on every cell but the first. It is a child of the ROW rather than of either cell, so a splitter drag never reaches the cell's pane-focus listener — and it is created and destroyed with the second pane, so nothing re-inserts it while a pointer capture is live.",tagName:"div",attributes:{part:"splitter-slot",role:"none"},$switch:{$ref:"$map/item/split"},cases:{shown:{$description:'`jx-split` (ui.md §5.5), which is where `role="separator"`, the tab stop, `aria-valuenow` and the whole keyboard now live. This document used to write the role on a bare div and hand the div to `ui/panel-resize.ts`, which made the pane split the one dock-sized thing in Studio a reader could not move without a mouse — an SC 2.1.1 failure with a drag handle drawn on it, and an SC 2.5.7 one besides. Every prop below is a CONSTANT except `value`: `min` and `max` are the shell\'s own supported range, and `gap` is the pixel floor the element converts against the track it measures itself, which is why nothing here has to be recomputed when the window resizes. `collapse` is the even split rather than the floor, because both sides of this splitter are real panes: the first Enter or double click is the 50/50 reset this gesture has always been, and the second one is the return trip it never had.',tagName:"jx-split",attributes:{part:"splitter"},$props:{label:"Pane split",value:{$ref:"#/state/paneSplit"},min:{$ref:"#/state/splitMin"},max:{$ref:"#/state/splitMax"},gap:{$ref:"#/state/splitGap"},collapse:{$ref:"#/state/splitDefault"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/move"},value:[{$ref:"event#/target/value"}]}]},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/settle"},value:[]}]}}}},{$description:'One pane\'s cell. `pane.<id>` goes on the STAGE and `pane.<id>/tabs` on the strip, never on this element: nine shots crop `pane.primary` meaning "the canvas", and moving the id up one level would silently widen all nine to include the strip and the two bars, which no gate can tell from an intended crop.',tagName:"div",attributes:{part:"pane","data-pane-id":"${$map.item.id}"},children:[{tagName:"div",attributes:{part:"strip","data-jx-region":"${$map.item.stripRegion}"}},{$description:"The context bar is HANDED this box rather than resolving a region into it. It cannot resolve one the way the strip does: nothing inside the strip re-stamps `pane.<id>/tabs`, while the context bar stamps `pane.<id>/context` on markup it renders INSIDE this div — so a region on the wrapper as well would put the same id on two nested elements, and `resolveRegion` takes the LAST match. Sixty shots crop `pane.primary/context`; a second, larger element carrying it is a silently widened crop.",tagName:"div",attributes:{part:"chrome"}},{$description:"Drawn EMPTY and left empty. `canvas/canvas-render.ts` is this element's render root and `canvas/iframe-host.ts` mounts the artboards' iframes into it; a node cannot have two owners of its child list.",tagName:"div",attributes:{part:"pane-stage","data-jx-region":"${$map.item.region}"}},{$description:"The right-edge drop target (§18.1). No `data-jx-region`: `pane.<id>` uniqueness names the stage, and a second element answering to it would be a silently widened crop the moment a shot cropped this pane.",tagName:"div",attributes:{part:"drop-zone",role:"none","data-armed":"${state.armed ? '' : null}","data-over":"${state.edgePane === $map.item.id ? '' : null}"}}]}]}}]};E("pane-grid",Px);var x_="pane",k_="pane-stage",Gl=`[part="${x_}"]`,Ex=`[part="${k_}"]`,$_=new Map([["pane","pane"],["strip","strip"],["chrome","chrome"],["pane-stage","stage"],["drop-zone","dropZone"]]);function S_(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function C_(e){let t=e?.$map,r=v(t)?t.item:void 0,o=v(r)?r.id:void 0;return n(o)?o:""}function Nx(e,t,r,o){e.replaceChildren();let a=g({armed:!1,edgePane:"",move:o.move,paneSplit:r.value,rows:t,settle:o.settle,splitDefault:r.collapse,splitGap:r.gap,splitMax:r.max,splitMin:r.min}),i=null,s=!1,l=R("pane-grid",a,e,{onNodeCreated:(f,c,d,b)=>{let y=$_.get(S_(d));if(y)o.cellPart(C_(b),y,f)}}).then((f)=>{if(s){f.dispose();return}i=f});return{dispose(){s=!0,i?.dispose(),i=null,e.replaceChildren()},drag(f){a.armed=f.armed,a.edgePane=f.edgePane},ready:l,update(f,c){a.rows=f,a.paneSplit=c}}}var jx="--stage-scrollbar-w";function T_(e){return Math.max(0,e.offsetWidth-e.clientWidth)}function Ax(e){return Ch(e)?.closest(Gl)??document.documentElement}function Ox(e,t){if(e.stageScrollbar?.scroller===t)return;if(Za(e),!t)return;let r=Ax(e),a=new ResizeObserver(()=>{r.style.setProperty(jx,`${T_(t)}px`)});a.observe(t),e.stageScrollbar={observer:a,scroller:t}}function Za(e){e.stageScrollbar?.observer.disconnect(),e.stageScrollbar=null,Ax(e).style.setProperty(jx,"0px")}function E_(e){return`"${e.replaceAll("\\",String.raw`\\`).replaceAll('"',String.raw`\"`)}"`}function L_(e,t,r){return[`.yRemoteSelection-${e}{background-color:${t}44;}`,`.yRemoteSelectionHead-${e}{position:absolute;border-left:2px solid ${t};height:100%;box-sizing:border-box;}`,`.yRemoteSelectionHead-${e}::after{content:${E_(r)};position:absolute;top:-1.2em;left:-2px;padding:0 4px;border-radius:3px 3px 3px 0;font:10px/1.4 sans-serif;color:#fff;white-space:nowrap;background-color:${t};opacity:0;transition:opacity .15s;pointer-events:none;}`,`.yRemoteSelectionHead-${e}:hover::after{opacity:1;}`].join(`
|
|
3
3
|
`)}function __(e){let t=[];for(let[r,o]of e.getStates()){if(r===e.clientID)continue;let{user:a}=o;if(!a?.color)continue;t.push(L_(r,a.color,a.name??a.login??String(r)))}return t.join(`
|
|
4
|
-
`)}function Mx(e,t){let r=t.createElement("style");r.dataset.jxCollabCursors="true",t.head.append(r);let o=()=>{r.textContent=__(e)};return o(),e.on("change",o),()=>{e.off("change",o),r.remove()}}var Kl=null,Dx=null;function _x(){if(Kl)return Promise.resolve(Kl);return Dx??=(ce("w9nfy203"),import("./chunks/grid-view-w9nfy203.js")).then((e)=>(Kl=e,e)),Dx}function Bx(){return Kl}var Jx={$schema:"https://jxsuite.com/schema/v1",$id:"StudioGridPanel",$description:"The spreadsheet grid's frame: the toolbar, the row count, and the empty box Tabulator is handed. **The engine is an island and stays one** (studio-ui-guidelines.md §9.4): `[part=\"host\"]` is drawn empty and `grid/grid-panel.ts` attaches Tabulator into it through `onNodeCreated`, so nothing here knows what a column or a range is. What converted is the CHROME — every control in the toolbar, and the two popovers and the cell editor that hang off it, each its own document. The host node's identity across a repaint used to be guaranteed by a lit `guard()` and is now guaranteed by construction: a document reconciles its tree in place, so a Save-badge tick cannot destroy the node Tabulator owns.",tagName:"div",attributes:{part:"grid"},style:{$description:"The frame's own layout and the engine's theme, and nothing that was a class. The toolbar is a single row that never wraps: the chrome budget (studio-ui-guidelines.md §12.2) caps what may stand in it, and the count is the only thing pinned to the far end.",display:"flex",flexDirection:"column",height:"100%",minHeight:"0",background:"var(--bg)",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",'& [part="toolbar"]':{$description:"The band the toolbar sits in, and nothing about the row itself: `display: flex`, `align-items: center` and the `--jx-space-2` gap left with the `<div>` that used to carry them, because `jx-toolbar` declares all three in its own definition. What is left is what a BAND is — its inset, its hairline, its panel fill, and its refusal to shrink.",padding:"6px var(--jx-space-3)",borderBottom:"1px solid var(--border)",background:"var(--bg-panel)",flexShrink:"0"},'& [part="filter"]':{width:"200px",flex:"0 0 auto"},'& [part="spacer"]':{flex:"1"},'& [part="note"]':{$description:"A fact about the grid that the rows themselves cannot show — the grouping in force, or that saving will rewrite frontmatter. `cursor: help` because the whole of it is in the tooltip.",fontSize:"var(--jx-text-xs)",color:"var(--fg-dim)",border:"1px solid var(--border)",borderRadius:"var(--radius)",padding:"1px 6px",cursor:"help",whiteSpace:"nowrap"},'& [part="pager"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)"},'& [part="count"]':{fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)",whiteSpace:"nowrap"},'& [part="views"]':{$description:"The applied view's name, which an author may have made long. It ellipses rather than pushing the count off the end, and the `hint` carries the whole of it.",maxWidth:"160px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="host"]':{flex:"1",minHeight:"0"},'& [part="missing"]':{margin:"0",padding:"var(--jx-space-6)",color:"var(--fg-dim)"},"& .tabulator":{$description:"Tabulator's own DOM, styled from inside the document. The engine is an ISLAND (studio-ui-guidelines.md §9.4): it builds this subtree itself, so its own class names are the only hook there is — the document emits none of them. These rules were `.jx-grid .tabulator …` in styles/overlays.css and are dead there now, because the frame that carried `.jx-grid` is this document and it carries no class at all.",background:"var(--bg)",color:"var(--fg)",border:"none",fontSize:"var(--jx-text-sm)",height:"100%"},"& .tabulator .tabulator-header":{background:"var(--bg-panel)",color:"var(--fg)",borderBottom:"1px solid var(--border)"},"& .tabulator .tabulator-header .tabulator-col":{background:"var(--bg-panel)",borderRight:"1px solid var(--border)"},"& .tabulator .tabulator-header .tabulator-col .tabulator-col-title":{color:"var(--fg)",fontWeight:"600"},"& .tabulator .tabulator-header .tabulator-header-filter input":{background:"var(--bg)",color:"var(--fg)",border:"1px solid var(--border)",borderRadius:"var(--jx-radius-sm)",padding:"1px 4px",font:"inherit"},"& .tabulator .tabulator-tableholder":{background:"var(--bg)"},"& .tabulator .tabulator-row":{background:"var(--bg)",color:"var(--fg)",borderBottom:"1px solid color-mix(in srgb, var(--border) 55%, transparent)",minHeight:"26px"},"& .tabulator .tabulator-row.tabulator-row-even":{background:"color-mix(in srgb, var(--bg-panel) 45%, var(--bg))"},"& .tabulator .tabulator-row.tabulator-selected":{background:"color-mix(in srgb, var(--accent) 16%, var(--bg))"},"& .tabulator .tabulator-row .tabulator-cell":{borderRight:"1px solid color-mix(in srgb, var(--border) 55%, transparent)",padding:"3px 8px"},"& .tabulator .tabulator-row .tabulator-cell.tabulator-frozen":{background:"var(--bg-panel)",borderRight:"1px solid var(--border)"},"& .tabulator .tabulator-range":{border:"1px solid var(--accent)",background:"color-mix(in srgb, var(--accent) 10%, transparent)"},"& .tabulator .tabulator-range-overlay .tabulator-range-cell-active":{border:"2px solid var(--accent)"},"& .tabulator .tabulator-placeholder .tabulator-placeholder-contents":{color:"var(--fg-dim)",background:"transparent"},"& .tabulator-cell.jx-grid-cell--dirty":{$description:"The edit buffer's paint. `grid-view.ts` toggles these names on Tabulator's cells and rows, which is the island writing to its own DOM; the document only says what they look like.",boxShadow:"inset 2px 0 0 var(--accent)",background:"color-mix(in srgb, var(--accent) 8%, transparent)"},"& .tabulator-cell.jx-grid-cell--error":{boxShadow:"inset 2px 0 0 var(--danger)",background:"color-mix(in srgb, var(--danger) 12%, transparent)"},"& .tabulator-cell.jx-grid-cell--stale":{opacity:"0.65"},"& .tabulator-row.jx-grid-row--pending-delete .tabulator-cell":{textDecoration:"line-through",opacity:"0.55"},"& .tabulator-row.jx-grid-row--pending-insert":{background:"color-mix(in srgb, var(--success, var(--accent)) 10%, var(--bg))"},"& .tabulator-row.jx-grid-row--stale":{outline:"1px dashed var(--fg-dim)",outlineOffset:"-1px"},'& [part="load-error"]':{color:"var(--danger)"}},children:[{tagName:"div",attributes:{part:"view-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/view"},cases:{missing:{tagName:"p",attributes:{part:"missing","data-view":"missing"},textContent:"This tab has no grid source."},grid:{tagName:"div",attributes:{part:"frame",role:"none"},style:{display:"contents"},children:[{tagName:"jx-toolbar",$description:'The kit\'s toolbar, which is what the four lines this node used to carry have become: a hand-written `role="toolbar"`, a hand-written `aria-label`, no tab-order collapse at all, and no arrow keys. `jx-action-group` could not be it — that element roves `jx-action-button` and nothing else, and this row holds a `jx-button`, a `jx-divider` and the filter `jx-textfield` beside its action buttons, so it would have found two of the controls and left the rest as five more tab stops. The field keeps its own arrows while its caret has text to walk, which is the one thing that makes a text box legal in a toolbar at all (ui.md §5.5).',attributes:{part:"toolbar"},$props:{label:"Grid actions"},children:[{tagName:"jx-button",attributes:{part:"save"},$props:{variant:"accent",size:"sm",disabled:{$ref:"#/state/saveDisabled"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/save"},value:[]}]},children:[{tagName:"span",textContent:"${state.saveLabel}"}]},{tagName:"jx-action-button",attributes:{part:"refresh"},$props:{size:"sm",quiet:!0,label:"Refresh",hint:"Reload from source",disabled:{$ref:"#/state/refreshDisabled"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/refresh"},value:[]}]},children:[{tagName:"span",textContent:"Refresh"}]},{tagName:"jx-divider",attributes:{part:"divider"},$props:{orientation:"vertical"}},{tagName:"span",attributes:{part:"insert-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/canInsert"},cases:{true:{tagName:"jx-action-button",attributes:{part:"add-row"},$props:{size:"sm",quiet:!0,label:"Add Row",hint:"Add a row (saved on Save)"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/addRow"},value:[]}]},children:[{tagName:"span",textContent:"Add Row"}]}}},{tagName:"span",attributes:{part:"delete-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/canDelete"},cases:{true:{tagName:"jx-action-button",attributes:{part:"delete-rows"},$props:{size:"sm",quiet:!0,label:"Delete Rows",hint:"Mark selected rows for deletion"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/deleteRows"},value:[]}]},children:[{tagName:"span",textContent:"Delete Rows"}]}}},{tagName:"jx-action-button",attributes:{part:"fill-down"},$props:{size:"sm",quiet:!0,label:"Fill Down",hint:"Fill the selected range down from its first row (Ctrl/Cmd-D)"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/fillDown"},value:[]}]},children:[{tagName:"span",textContent:"Fill Down"}]},{tagName:"jx-action-button",attributes:{part:"replace"},$props:{size:"sm",quiet:!0,label:"Replace",hint:"Find & replace across text cells"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openReplace"},value:[{$ref:"event#/currentTarget"}]}]},children:[{tagName:"span",textContent:"Replace"}]},{tagName:"jx-action-button",attributes:{part:"views"},$props:{size:"sm",quiet:!0,label:"${state.viewLabel}",hint:"Saved views, columns, sort and grouping",haspopup:"dialog"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openViews"},value:[{$ref:"event#/currentTarget"}]}]},children:[{tagName:"span",textContent:"${state.viewLabel}"}],$description:"One control for the four facets a saved view is made of, because they are only ever adjusted together (studio-ui-guidelines.md §12.2). Its label is the applied view's name, so the toolbar says what is on screen before the panel is opened."},{tagName:"jx-textfield",attributes:{part:"filter"},$props:{type:"search",size:"sm",label:"Filter rows",placeholder:"Filter rows",clearable:!0,value:{$ref:"#/state/filter"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setFilter"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"span",attributes:{part:"spacer",role:"none"}},{tagName:"span",attributes:{part:"group-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/groupState"},cases:{shown:{tagName:"span",attributes:{part:"note","data-note":"grouping",title:"Rows are ordered so each group is contiguous."},textContent:"${state.groupNote}"}}},{tagName:"span",attributes:{part:"lossy-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/lossyState"},cases:{shown:{tagName:"span",attributes:{part:"note","data-note":"lossy",title:"Saving re-serializes frontmatter; YAML comments and key order are not preserved."},textContent:"rewrites frontmatter"}}},{tagName:"span",attributes:{part:"pager-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/pagerState"},cases:{shown:{tagName:"span",attributes:{part:"pager"},children:[{tagName:"jx-action-button",attributes:{part:"prev"},$props:{size:"sm",quiet:!0,label:"Previous page",hint:"Previous page",disabled:{$ref:"#/state/prevDisabled"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/prevPage"},value:[]}]},children:[{tagName:"span",textContent:"‹ Prev"}]},{tagName:"span",attributes:{part:"count"},textContent:"${state.pageRange}"},{tagName:"jx-action-button",attributes:{part:"next"},$props:{size:"sm",quiet:!0,label:"Next page",hint:"Next page",disabled:{$ref:"#/state/nextDisabled"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/nextPage"},value:[]}]},children:[{tagName:"span",textContent:"Next ›"}]}]}}},{tagName:"span",attributes:{part:"count"},children:[{tagName:"span",attributes:{part:"count-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/countState"},cases:{loading:{tagName:"span",attributes:{part:"count-text"},textContent:"Loading…"},error:{tagName:"span",attributes:{part:"load-error",role:"alert"},textContent:"${state.error}"},total:{tagName:"span",attributes:{part:"count-text"},textContent:"${state.countLabel}"}}}]}]},{$description:"Tabulator's node. Empty in the document, and filled by the adapter the moment it is created — a rendered child here would be destroyed by the engine's first build.",tagName:"div",attributes:{part:"host"}}]}}}]};E("grid-panel",Jx);function Kx(e,t){e.view=t.view,e.saveLabel=t.saveLabel,e.saveDisabled=t.saveDisabled,e.refreshDisabled=t.refreshDisabled,e.canInsert=t.canInsert,e.canDelete=t.canDelete,e.viewLabel=t.viewLabel,e.filter=t.filter,e.groupState=t.groupState,e.groupNote=t.groupNote,e.lossyState=t.lossyState,e.pagerState=t.pagerState,e.pageRange=t.pageRange,e.prevDisabled=t.prevDisabled,e.nextDisabled=t.nextDisabled,e.countState=t.countState,e.countLabel=t.countLabel,e.error=t.error}function B_(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function xf(e,t,r){e.replaceChildren();let o=g({addRow:r.addRow,canDelete:!1,canInsert:!1,countLabel:"",countState:"loading",deleteRows:r.deleteRows,error:"",fillDown:r.fillDown,filter:"",gridHost:r.gridHost,groupNote:"",groupState:"hidden",lossyState:"hidden",nextDisabled:!0,nextPage:r.nextPage,openReplace:r.openReplace,openViews:r.openViews,pageRange:"",pagerState:"hidden",prevDisabled:!0,prevPage:r.prevPage,refresh:r.refresh,refreshDisabled:!1,save:r.save,saveDisabled:!0,saveLabel:"Save",setFilter:r.setFilter,view:"grid",viewLabel:"View"});Kx(o,t);let a=null,i=!1,s=R("grid-panel",o,e,{onNodeCreated:(l,f,c)=>{if(B_(c)==="host"&&l instanceof HTMLElement)r.gridHost(l)}}).then((l)=>{let f=l.root;if(i)return l.dispose(),f;return a=l,f});return{dispose(){i=!0,a?.dispose(),a=null},ready:s,update:(l)=>Kx(o,l)}}var Yx={$schema:"https://jxsuite.com/schema/v1",$id:"StudioGridViews",$description:"The grid's View panel: the saved views, and the four facets one of them is made of — columns, sort, grouping, and the filter the toolbar box holds. ONE control rather than four, because the chrome budget caps what may stand in a toolbar (studio-ui-guidelines.md §12.2) and these four are only ever adjusted together. There is no Apply button: every edit writes the working layout and applies immediately, so the panel is never showing something the grid is not already doing.",tagName:"jx-popover",attributes:{part:"views-panel"},$props:{label:"Grid view",x:{$ref:"#/state/x"},y:{$ref:"#/state/y"}},children:[{tagName:"div",attributes:{part:"body"},style:{display:"flex",flexDirection:"column",gap:"var(--jx-space-2)",padding:"var(--jx-space-3)",minWidth:"280px",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",maxHeight:"60vh",overflowY:"auto",'& [part="title"]':{fontWeight:"600",fontSize:"var(--jx-text-sm)",margin:"0"},'& [part="empty"]':{margin:"0",color:"var(--fg-dim)",fontSize:"var(--jx-text-xs)"},'& [part="views"]':{display:"flex",flexDirection:"column",gap:"2px"},'& [part="view-row"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-1)"},'& [part="view-name"]':{flex:"1",textAlign:"left",background:"none",border:"none",color:"var(--fg)",font:"inherit",padding:"3px 6px",borderRadius:"var(--jx-radius-sm)",cursor:"pointer"},'& [part="view-name"]:hover':{background:"var(--bg-hover)"},'& [part="view-name"][data-active="true"]':{fontWeight:"600",background:"var(--bg-selected)"},'& [part="view-name"]:focus-visible':{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"},'& [part="actions"]':{display:"flex",gap:"var(--jx-space-2)"},'& [part="columns"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-1)"}},children:[{tagName:"p",attributes:{part:"title"},textContent:"Saved views"},{tagName:"div",attributes:{part:"views-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/viewsState"},cases:{empty:{tagName:"p",attributes:{part:"empty"},textContent:"No saved views yet. Arrange the grid, then save it under a name."},listed:{tagName:"div",attributes:{part:"views"},children:[{$prototype:"Array",items:{$ref:"#/state/views"},key:{$ref:"$map/item/key"},map:{$description:"One saved view: its name applies it, and the cross beside it asks before forgetting it. `$map/item` is the view, so the row hands its own name back rather than an index.",tagName:"div",attributes:{part:"view-row","data-view":"${$map.item.name}"},children:[{tagName:"button",attributes:{part:"view-name",type:"button","data-active":"${$map.item.active}","aria-current":"${$map.item.current}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/applyView"},value:[{$ref:"$map/item/name"}]}]},textContent:"${$map.item.name}"},{tagName:"jx-action-button",attributes:{part:"view-delete"},$props:{size:"sm",quiet:!0,icon:"x",label:"${$map.item.deleteLabel}",hint:"Delete this view"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/deleteView"},value:[{$ref:"$map/item/name"}]}]}}]}}]}}},{tagName:"div",attributes:{part:"actions"},children:[{tagName:"jx-button",attributes:{part:"save-view"},$props:{variant:"accent",size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/saveView"},value:[]}]},children:[{tagName:"span",textContent:"${state.saveLabel}"}]},{tagName:"jx-button",attributes:{part:"reset"},$props:{variant:"secondary",size:"sm",label:"Forget this grid's saved columns, sort, grouping and filter. Named views are kept."},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/reset"},value:[]}]},children:[{tagName:"span",textContent:"Reset"}]}]},{tagName:"p",attributes:{part:"title","data-title":"columns"},textContent:"Columns"},{tagName:"div",attributes:{part:"columns"},children:[{$prototype:"Array",items:{$ref:"#/state/columns"},key:{$ref:"$map/item/field"},map:{$description:"One column's visibility. The title is SLOTTED rather than passed as `label`: an empty `label` removes the aria-label, so the wrapping label's own text names the box instead of naming it twice — and the reader can see which column the box is for.",tagName:"jx-checkbox",attributes:{part:"column","data-field":"${$map.item.field}"},$props:{size:"sm",checked:{$ref:"$map/item/visible"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/toggleColumn"},value:[{$ref:"$map/item/field"},{$ref:"event#/target/checked"}]}]},children:[{tagName:"span",textContent:"${$map.item.title}"}]}}]},{tagName:"p",attributes:{part:"title","data-title":"sort"},textContent:"Sort"},{tagName:"jx-select",attributes:{part:"sort-field"},$props:{label:"Sort by",size:"sm",options:{$ref:"#/state/fieldOptions"},value:{$ref:"#/state/sortField"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setSortField"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"jx-select",attributes:{part:"sort-dir"},$props:{label:"Sort direction",size:"sm",disabled:{$ref:"#/state/sortDirDisabled"},options:{$ref:"#/state/dirOptions"},value:{$ref:"#/state/sortDir"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setSortDir"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"p",attributes:{part:"title","data-title":"group"},textContent:"Group by"},{tagName:"jx-select",attributes:{part:"group-field"},$props:{label:"Group by",size:"sm",options:{$ref:"#/state/groupOptions"},value:{$ref:"#/state/groupField"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setGroup"},value:[{$ref:"event#/target/value"}]}]}}]}]};E("grid-views",Yx);var X_="grid/views";function Qx(e,t){e.x=t.x,e.y=t.y,e.viewsState=t.viewsState,e.views=t.views,e.saveLabel=t.saveLabel,e.columns=t.columns,e.fieldOptions=t.fieldOptions,e.dirOptions=t.dirOptions,e.groupOptions=t.groupOptions,e.sortField=t.sortField,e.sortDir=t.sortDir,e.sortDirDisabled=t.sortDirDisabled,e.groupField=t.groupField}function Zx(e,t,r){let o=g({applyView:t.applyView,columns:[],deleteView:t.deleteView,dirOptions:[],fieldOptions:[],groupField:"",groupOptions:[],reset:t.reset,saveLabel:"Save view…",saveView:t.saveView,setGroup:t.setGroup,setSortDir:t.setSortDir,setSortField:t.setSortField,sortDir:"asc",sortDirDisabled:!0,sortField:"",toggleColumn:t.toggleColumn,views:[],viewsState:"empty",x:0,y:0});Qx(o,e);let a={anchor:r,name:"grid-views",scope:o,slot:X_};if(t.dismissed)a.onDismissed=t.dismissed;let i=qu(a);return{close:i.close,host:i.host,isOpen:i.isOpen,ready:i.ready,update:(s)=>{if(i.isOpen())Qx(o,s)}}}var ek={$schema:"https://jxsuite.com/schema/v1",$id:"StudioGridReplace",$description:"Find and replace across the grid's text cells. Every replacement is buffered as ONE undo group and nothing is written until the grid is saved, which is what the confirmation says out loud.",tagName:"jx-popover",attributes:{part:"replace-panel"},$props:{label:"Find and replace",x:{$ref:"#/state/x"},y:{$ref:"#/state/y"}},children:[{tagName:"div",attributes:{part:"body"},style:{display:"flex",flexDirection:"column",gap:"var(--jx-space-2)",padding:"var(--jx-space-3)",minWidth:"260px",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",'& [part="title"]':{fontWeight:"600",fontSize:"var(--jx-text-sm)",margin:"0"},'& [part="actions"]':{display:"flex",justifyContent:"flex-end",gap:"var(--jx-space-2)"}},children:[{tagName:"p",attributes:{part:"title"},textContent:"Find & Replace"},{tagName:"jx-textfield",attributes:{part:"find"},$props:{size:"sm",label:"Find",placeholder:"Find…",value:{$ref:"#/state/find"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setFind"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"jx-textfield",attributes:{part:"replace"},$props:{size:"sm",label:"Replace with",placeholder:"Replace with…",value:{$ref:"#/state/replace"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setReplace"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"div",attributes:{part:"actions"},children:[{tagName:"jx-button",attributes:{part:"cancel"},$props:{variant:"secondary",size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/cancel"},value:[]}]},children:[{tagName:"span",textContent:"Cancel"}]},{tagName:"jx-button",attributes:{part:"replace-all"},$props:{variant:"accent",size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/replaceAll"},value:[]}]},children:[{tagName:"span",textContent:"Replace All"}]}]}]}]};E("grid-replace",ek);var ez="grid/replace";function tk(e,t,r){let o=g({cancel:()=>{i.close(),t.dismissed?.()},find:"",replace:"",replaceAll:()=>{t.replaceAll(o.find,o.replace)},setFind:(s)=>{o.find=s},setReplace:(s)=>{o.replace=s},x:e.x,y:e.y}),a={anchor:r,name:"grid-replace",scope:o,slot:ez};if(t.dismissed)a.onDismissed=t.dismissed;let i=qu(a);return i}var Zl=new Map,kf=new Map;function oi(e){return Zl.get(e)??null}function ai(e){kf.get(e)?.dispose(),kf.delete(e);let t=Zl.get(e);if(!t)return;t.views?.close(),t.replace?.close(),t.view?.destroy(),t.scope.stop(),t.surface?.dispose(),Zl.delete(e)}function $f(e,t){let r=oi(e);return r!==null&&r.tabId===t.id&&r.wrap.isConnected}function tz(e){let t=kS(e);if(!t)return"View";return LN(e)?`${t} •`:t}function nz(e){let t=e.state.grouping;if(!t)return"";let r=e.state.columns.find((a)=>a.field===t)?.title??t,o=e.groups().length;return`Grouped by ${r} · ${o} group${o===1?"":"s"}`}function rz(e){let{state:t}=e,r=t.query.limit??50,o=t.query.offset??0;return`${t.total===0?0:o+1}–${Math.min(o+r,t.total)}`}function nk(e){let{state:t}=e,r=e.source.id,o=e.buffer.dirtyCount(),a=Yl(r),i=t.query.limit??50,s=t.query.offset??0,l=nz(e);return{canDelete:e.source.capabilities.delete===!0,canInsert:e.source.capabilities.insert===!0,countLabel:`${t.total} row${t.total===1?"":"s"}`,countState:t.loading?"loading":t.error?"error":"total",error:t.error??"",filter:Pd(r)?.filter??"",groupNote:l,groupState:l===""?"hidden":"shown",lossyState:a?.kind==="collection"||a?.kind==="pages"?"shown":"hidden",nextDisabled:s+i>=t.total||t.loading,pageRange:rz(e),pagerState:e.source.capabilities.remotePaging?"shown":"hidden",prevDisabled:s===0||t.loading,refreshDisabled:t.loading||t.saving,saveDisabled:o===0||t.saving,saveLabel:o>0?`Save (${o})`:"Save",view:"grid",viewLabel:tz(r)}}function rk(e,t){let r=e.source.id,o=Pd(r)??{},a=Uu(r),i=kS(r),s=new Set(o.hidden),l=o.sort??null,{columns:f}=e.state,c=f.map((d)=>({label:d.title,value:d.field}));return{columns:f.map((d)=>({field:d.field,title:d.title,visible:!s.has(d.field)})),dirOptions:[{label:"Ascending",value:"asc"},{label:"Descending",value:"desc"}],fieldOptions:[{label:"Source order",value:""},...c],groupField:e.state.grouping??"",groupOptions:[{label:"Ungrouped",value:""},...c],saveLabel:i?"Save as…":"Save view…",sortDir:l?.dir??"asc",sortDirDisabled:l===null,sortField:l?.field??"",views:a.map((d)=>({active:d.name===i?"true":"false",current:d.name===i?"true":"false",deleteLabel:`Delete the saved view ${d.name}`,key:d.name,name:d.name})),viewsState:a.length===0?"empty":"listed",x:t.x,y:t.y}}function oz(e,t,r){if(t.views?.isOpen()){t.views.close(),t.views=null;return}let o=Me(r),a={x:Math.max(4,o.left),y:o.bottom+4};t.viewsAt=a;let i=e.source.id,s=()=>{t.views?.close(),t.views=null},l=(c,d)=>{Sm(i,c),d(),t.bump()},f=(c)=>l({sort:c},()=>{e.setSort(c)});t.views=Zx(rk(e,a),{applyView:(c)=>{t.applyLayout(Rw(i,c)),s()},deleteView:(c)=>{az(i,c,t)},dismissed:()=>{t.views=null},reset:()=>{ST(i),t.applyLayout(null),s()},saveView:()=>{ok(e,t)},setGroup:(c)=>{l({groupBy:c||null},()=>e.setGrouping(c||null))},setSortDir:(c)=>{let d=Pd(i)?.sort??null;if(d)f({dir:c==="desc"?"desc":"asc",field:d.field})},setSortField:(c)=>{let d=Pd(i)?.sort??null;f(c===""?null:{dir:d?.dir??"asc",field:c})},toggleColumn:(c,d)=>{let b=new Set(Pd(i)?.hidden);if(d)b.delete(c);else b.add(c);l({hidden:[...b]},()=>t.remount())}},r),t.bump()}async function az(e,t,r){if(await qo("Delete View",`Delete the saved view "${t}"? The grid keeps its current layout.`,{confirmLabel:"Delete",destructive:!0})&&CT(e,t))r.bump()}async function ok(e,t){let r=e.source.id,o=await Fn("Save Grid View",{confirmLabel:"Save View",message:`Columns, sort, grouping and filter, saved for ${e.source.label}.`,placeholder:"Recent drafts",validate:(i)=>i.trim()===""?"Name the view.":"",value:kS(r)??""});if(o===null)return null;let a=$N(r,o);if(!a)return w.warn("Views cannot be saved — this browser has local storage disabled.",{key:"grid.saveView",source:"Data"}),null;return t.bump(),a.name}function iz(e,t,r){if(t.replace?.isOpen()){t.replace.close(),t.replace=null;return}let o=Me(r);t.replace=tk({x:Math.max(4,o.left),y:o.bottom+4},{dismissed:()=>{t.replace=null},replaceAll:(a,i)=>{let s=e.replaceAll(a,i);if(s===0){w.info("No matches.",{key:"grid.replaceAll"});return}w.success(`Replaced in ${s} cell${s===1?"":"s"} — save to apply.`,{action:"file.save",key:"grid.replaceAll"}),t.replace?.close(),t.replace=null}},r)}function ak(e,t){let{paneId:r,wrap:o}=e;if($f(r,t))return;ai(r);let a=er(t);if(!a&&t.documentPath?.toLowerCase().endsWith(".csv"))a=$p(t,jS(t.documentPath)),a.load();if(!a){kf.set(r,xf(o,cz(),dz()));return}let i=me(),s=g({views:0}),l=a,f=null;function c(y){if(d.view?.destroy(),d.view=null,!f)return;let x=f,S=Bx();if(S){let P=S.createGridView(x,l);d.view=P,y?.(P);return}_x().then(({createGridView:P})=>{if(oi(r)!==d||f!==x||d.view)return;let j=P(x,l);d.view=j,y?.(j),d.bump()})}let d={applyLayout(y){l.setSort(y?.sort??null),l.setGrouping(y?.groupBy??null),c((x)=>x.setSearch(y?.filter??"")),d.bump()},bump(){s.views+=1},paneId:r,remount(){c()},replace:null,scope:i,surface:null,tabId:t.id,view:null,views:null,viewsAt:{x:0,y:0},wrap:o};Zl.set(r,d),d.surface=xf(o,nk(l),{addRow:()=>l.addRow(),deleteRows:()=>l.deleteRows(d.view?.getSelectedRowKeys()??[]),fillDown:()=>d.view?.fillDown(),gridHost:(y)=>{f=y},nextPage:()=>{let y=l.state.query.limit??50;l.setQuery({...l.state.query,limit:y,offset:(l.state.query.offset??0)+y})},openReplace:(y)=>{iz(l,d,y)},openViews:(y)=>{oz(l,d,y)},prevPage:()=>{let y=l.state.query.limit??50;l.setQuery({...l.state.query,limit:y,offset:Math.max(0,(l.state.query.offset??0)-y)})},refresh:()=>{l.refresh()},save:()=>{l.save()},setFilter:(y)=>{Sm(l.source.id,{filter:y}),d.view?.setSearch(y)}}),d.surface.ready.then(()=>{if(oi(r)===d)d.bump()});let b=!1;i.run(()=>{te(()=>{if(oi(r)!==d)return;if(l.state.loading,l.state.saving,l.state.error,l.state.total,l.state.query.offset,l.state.grouping,l.buffer.dirtyCount(),s.views,d.surface?.update(nk(l)),d.views?.update(rk(l,d.viewsAt)),!d.view&&!l.state.loading&&l.state.columns.length>0&&f)c((y)=>{if(b)return;b=!0;let x=Pd(l.source.id);sz(l,x),y.setSearch(x?.filter??"")});lz(l,d,t.documentPath)})})}function sz(e,t){let r=t?.sort??null,{query:o,grouping:a}=e.state;if(!(r===null?o.orderBy===void 0:o.orderBy===r.field&&o.dir===r.dir))e.setSort(r);let s=t?.groupBy??null;if(a!==s)e.setGrouping(s)}function lz(e,t,r){let o=cN(r);if(o===void 0||!r||!t.view||e.state.loading)return;dN(r);let a=e.state.rows[o];if(a)t.view.revealRow(a.key)}function cz(){return{canDelete:!1,canInsert:!1,countLabel:"",countState:"total",error:"",filter:"",groupNote:"",groupState:"hidden",lossyState:"hidden",nextDisabled:!0,pageRange:"",pagerState:"hidden",prevDisabled:!0,refreshDisabled:!0,saveDisabled:!0,saveLabel:"Save",view:"missing",viewLabel:"View"}}function dz(){let e=()=>{};return{addRow:e,deleteRows:e,fillDown:e,gridHost:e,nextPage:e,openReplace:e,openViews:e,prevPage:e,refresh:e,save:e,setFilter:e}}function ri(){let e=er(h.value),t=oi(m.activePaneId);if(!e||!t||t.tabId!==e.tab.id)return null;return{controller:e,panel:t}}function ni(e){let t=ri();if(!t)throw Error(`command "${e}" needs a grid on screen`);return t}function pz(){let e=(t,r)=>{let{controller:o}=ni(t),a=o.source.id,i=St(t,r,"name"),s=Uu(a).map((l)=>l.name);if(!s.includes(i))throw RangeError(`command "${t}" argument "name": "${i}" is not a saved view of ${o.source.label} — it has: ${s.length>0?s.join(", "):"none"}`);return{gridId:a,name:i}};return[{category:"View",id:"grid.saveView",level:"document",menus:["palette"],group:"5_data",requires:"a grid on screen",when:(t)=>t.project.open,enablement:()=>ri()!==null,run:async()=>{let{controller:t,panel:r}=ni("grid.saveView");await ok(t,r)},title:"Save Grid View…"},{args:Se({name:Fe("The saved view's name.")}),category:"View",id:"grid.applyView",level:"document",menus:["palette"],group:"5_data",requires:"a grid on screen",when:(t)=>t.project.open,enablement:()=>ri()!==null,run:(t,r)=>{let{gridId:o,name:a}=e("grid.applyView",r),{panel:i}=ni("grid.applyView");i.applyLayout(Rw(o,a))},title:"Apply Grid View"},{args:Se({name:Fe("The saved view's name.")}),category:"View",id:"grid.deleteView",level:"document",menus:["palette"],group:"5_data",requires:"a grid on screen",destructive:!0,when:(t)=>t.project.open,enablement:()=>ri()!==null,run:(t,r)=>{let{gridId:o,name:a}=e("grid.deleteView",r);CT(o,a),ni("grid.deleteView").panel.bump()},title:"Delete Grid View"},{category:"View",id:"grid.resetView",level:"document",menus:["palette"],group:"5_data",requires:"a grid on screen",when:(t)=>t.project.open,enablement:()=>ri()!==null,run:()=>{let{controller:t,panel:r}=ni("grid.resetView");ST(t.source.id),r.applyLayout(null)},title:"Reset Grid View"}]}function ik(e){e.registerAll(pz())}function sk(){I$();let e=Yy(wr(h.value?.doc.document?.style));vx(e)}var lk={$schema:"https://jxsuite.com/schema/v1",$id:"StudioSettingsCssVars",$description:"The Styles workspace's Variables view, its editor (studio.md §7.1): the project's design tokens, grouped by what they name, each editable in place and each able to carry a different value in any rendering context the project declares. The view's own frame (`surfaces/styles-variables.json`) draws the heading and mounts this document into its `editor` island. The adapter (`surfaces/settings-css-vars.ts`) hands in the groups already grouped, each token already resolved — its swatch colour, the chip it wears when its value follows another token, the override rows it has, the contexts it could still be given one in and whether it is the token the Outline pointed at — and the document draws them. Nothing here reads `project.json` and nothing here decides what a token IS: `style/project-styles.ts` owns the vocabulary and `settings/css-vars-editor.ts` owns the writes. A context is DEFINED in Project Settings › Contexts and only overridden here, which is why the one thing the colour group says when no scheme exists is where to go and say it.",tagName:"section",attributes:{part:"cssvars"},style:{$description:"This section's whole look, keyed on `part`. Six of the rules it used to borrow are gone rather than moved: `.settings-section` never had a rule anywhere (it was on the orphan ledger), and `.css-var-swatch input[type=\"color\"]` plus the two chip spans are drawn here now because the lit helper that emitted them is drawn here now. Every `--spectrum-font-size-*` reference is re-pointed at the kit's scale: a document is mounted in the pane rather than inside `<sp-theme>`, so each of those would have silently taken its hard-coded fallback. Two part names are this document's own on purpose: the colour well is `well` and a font token's specimen is `font-preview`, because `swatch` and `preview` are parts INSIDE `jx-select` (its options' colour chip and its closed-state value), and this section draws a `jx-select` per token. The kit is light DOM, so `& [part=\"preview\"]` reached the Add override picker's own value and gave it this sheet's 108px indent, bottom padding and 13px type: a 36px control under a 20px field. The name column is a fixed width (`--name-col`) so every value field in a group starts at the same x, and the override list indents to that same column rather than to a literal that guessed it.","--name-col":"12rem",display:"block",'& [part="section-error"]':{$description:'A write that failed, said under the section title rather than pinned to a control. This section saves on change and the predecessor dropped every rejection on the floor, so a read-only file made each edit look as though it had been taken and then quietly forgotten. It is `section-error` rather than `error` because every text field and select in the section draws a permanent `[part="error"]` of its own in this same light-DOM tree, and a rule on that name would give their refusal sentences this margin and size too.',margin:"0 0 12px",fontSize:"var(--jx-text-md)",color:"var(--danger)"},'& [part="token-group"]':{marginBottom:"24px"},'& [part="token"][aria-current="true"]':{$description:"The token the Outline pointed the view at: a tinted band with the accent edge the Outline's own selected row wears, so the two say the same thing about one property.",borderRadius:"var(--radius)",background:"var(--accent-20)",boxShadow:"inset 2px 0 0 var(--accent)"},'& [part="group-title"]':{margin:"0 0 8px",fontSize:"13px",fontWeight:"600",color:"var(--fg)",textTransform:"uppercase",letterSpacing:"0.5px"},'& [part="row"]':{display:"flex",alignItems:"center",gap:"8px",padding:"4px 0"},'& [part="name"]':{$description:"A fixed column, not a minimum: with `minWidth` the value field started wherever its name ended, so a long name pushed its field out of line with every field above it. A name longer than the column is cut with an ellipsis and carries its whole self in `title`.",flex:"0 0 var(--name-col)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"},'& [part="swatch-slot"], & [part="chip-slot"]':{display:"contents"},'& [part="well"]':{$description:"The colour well. Its background is the value the token RESOLVES to, so an alias token is a colour rather than a blank square, and the native input over it is transparent — the well is what the reader sees and the input is only what they operate.",position:"relative",width:"24px",height:"24px",flex:"none",border:"1px solid var(--border)",borderRadius:"var(--radius)",overflow:"hidden",cursor:"pointer"},'& [part="swatch-input"]':{position:"absolute",inset:"0",width:"100%",height:"100%",opacity:"0",cursor:"pointer"},'& [part="value"]':{flex:"0 1 16rem",minWidth:"0"},'& [data-group="color"] [part="value"]':{flexBasis:"10rem"},'& [data-group="size"] [part="value"]':{flexBasis:"8rem"},'& [part="chip"]':{$description:'A value that is exactly `var(--token)` is a reference, and raw text is the one rendering that hides both which token and what it currently is. The chip says both. It is a span, not a button: it states, it does not navigate. Same border, same size and same radius as the provenance chips in the Inspector, because "this value comes from somewhere else" is the same sentence in both places.',display:"inline-flex",alignItems:"center",gap:"4px",flexShrink:"0",maxWidth:"14ch",overflow:"hidden",padding:"0 5px",border:"1px solid currentcolor",borderRadius:"var(--radius)",color:"var(--handler)",fontSize:"9px",lineHeight:"14px",whiteSpace:"nowrap"},'& [part="chip-swatch"]':{width:"8px",height:"8px",flexShrink:"0",border:"1px solid var(--border)",borderRadius:"var(--jx-radius-xs)"},'& [part="chip-label"]':{overflow:"hidden",textOverflow:"ellipsis"},'& [part="font-preview"]':{$description:"A font token is the one kind whose value cannot be read: `'Georgia', serif` is a name for a shape, so the shape is drawn. Indented to the value column (the name column and the gap after it), because it belongs to the field above it rather than to the section.",padding:"4px 0 12px calc(var(--name-col) + 8px)",fontSize:"13px",color:"var(--fg-dim)"},'& [part="overrides"]':{$description:"Indented to the value column: past the name column and its gap, and in the colour group past the well too, so an override value sits under the base value it overrides.",paddingLeft:"calc(var(--name-col) + 8px)",marginBottom:"8px"},'& [data-group="color"] [part="overrides"]':{paddingLeft:"calc(var(--name-col) + 40px)"},'& [part="override"]':{display:"flex",alignItems:"center",gap:"8px",padding:"2px 0"},'& [part="override-label"]':{fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)",minWidth:"60px"},'& [part="override-value"]':{flex:"none",maxWidth:"120px"},'& [data-group="color"] [part="override-value"]':{flex:"1",maxWidth:"160px"},'& [part="override-add"]':{$description:"The add-an-override control aligns with the override rows rather than with the token name: it belongs to the override list, and a control that lined up with the base value would read as a second base value.",display:"flex",alignItems:"center",padding:"2px 0"},'& [part="add-picker"]':{$description:"As compact as the fields beside it: sized to its own label rather than stretched, since it is a verb on the list above it and not a value of its own.",flex:"none",width:"auto"},'& [part="add"]':{display:"flex",alignItems:"center",gap:"8px",padding:"8px 0",marginTop:"8px",borderTop:"1px solid var(--border)"},'& [part="add-name"], & [part="add-value"]':{flex:"1",minWidth:"0"},'& [part="notice"]':{$description:"What the colour group says when the project declares no scheme: this level overrides a context, it never defines one, so the only thing it can offer is the way to the level that does.",display:"flex",alignItems:"center",flexWrap:"wrap",gap:"6px",margin:"0",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"}},children:[{tagName:"div",attributes:{part:"section-error-slot",role:"none"},$switch:{$ref:"#/state/hasError"},cases:{true:{tagName:"p",attributes:{part:"section-error",role:"alert"},textContent:"${state.error}"}}},{$prototype:"Array",items:{$ref:"#/state/groups"},key:{$ref:"$map/item/id"},map:{tagName:"div",attributes:{part:"token-group","data-group":"${$map.item.id}"},children:[{tagName:"h3",attributes:{part:"group-title"},textContent:"${$map.item.title}"},{$prototype:"Array",items:{$ref:"$map/item/tokens"},key:{$ref:"$map/item/name"},map:{tagName:"div",attributes:{part:"token","data-token":"${$map.item.name}","aria-current":"${$map.item.current ? 'true' : null}"},children:[{tagName:"div",attributes:{part:"row"},children:[{tagName:"div",attributes:{part:"swatch-slot",role:"none"},$switch:{$ref:"$map/item/swatchState"},cases:{swatch:{tagName:"div",attributes:{part:"well"},style:{background:{$ref:"$map/item/swatchBg"}},children:[{tagName:"input",attributes:{part:"swatch-input",type:"color","aria-label":"${$map.item.swatchLabel}"},value:{$ref:"$map/item/swatchInput"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setToken"},value:[{$ref:"$map/item/name"},{$ref:"event#/target/value"}]}]}}]}}},{tagName:"span",attributes:{part:"name",title:"${$map.item.label}"},textContent:"${$map.item.label}"},{tagName:"jx-textfield",attributes:{part:"value"},$props:{label:{$ref:"$map/item/label"},value:{$ref:"$map/item/value"},size:"sm"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setToken"},value:[{$ref:"$map/item/name"},{$ref:"event#/target/value"}]}]}},{tagName:"div",attributes:{part:"chip-slot",role:"none"},$switch:{$ref:"$map/item/chipState"},cases:{plain:{tagName:"span",attributes:{part:"chip",title:"${$map.item.chipTitle}"},children:[{tagName:"span",attributes:{part:"chip-label"},textContent:"${$map.item.chipLabel}"}]},swatch:{tagName:"span",attributes:{part:"chip",title:"${$map.item.chipTitle}"},children:[{tagName:"span",attributes:{part:"chip-swatch"},style:{background:{$ref:"$map/item/chipSwatch"}}},{tagName:"span",attributes:{part:"chip-label"},textContent:"${$map.item.chipLabel}"}]}}},{tagName:"jx-action-button",attributes:{part:"remove"},$props:{icon:"trash",size:"sm",label:{$ref:"$map/item/removeLabel"},hint:{$ref:"$map/item/removeLabel"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/removeToken"},value:[{$ref:"$map/item/name"}]}]}}]},{tagName:"div",attributes:{part:"preview-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/previewState"},cases:{font:{tagName:"div",attributes:{part:"font-preview"},style:{fontFamily:{$ref:"$map/item/previewFont"}},textContent:"The quick brown fox jumps over the lazy dog"}}},{tagName:"div",attributes:{part:"overrides-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/overrideState"},cases:{shown:{tagName:"div",attributes:{part:"overrides"},children:[{$prototype:"Array",items:{$ref:"$map/item/overrides"},key:{$ref:"$map/item/id"},map:{tagName:"div",attributes:{part:"override","data-kind":"${$map.item.kind}"},children:[{tagName:"span",attributes:{part:"override-label"},textContent:"${$map.item.label}"},{tagName:"div",attributes:{part:"swatch-slot",role:"none"},$switch:{$ref:"$map/item/swatchState"},cases:{swatch:{tagName:"div",attributes:{part:"well"},style:{background:{$ref:"$map/item/swatchBg"}},children:[{tagName:"input",attributes:{part:"swatch-input",type:"color","aria-label":"${$map.item.swatchLabel}"},value:{$ref:"$map/item/swatchInput"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setOverride"},value:[{$ref:"$map/item/token"},{$ref:"$map/item/ctx"},{$ref:"event#/target/value"}]}]}}]}}},{tagName:"jx-textfield",attributes:{part:"override-value"},$props:{label:{$ref:"$map/item/fieldLabel"},value:{$ref:"$map/item/value"},placeholder:"inherits",size:"sm"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setOverride"},value:[{$ref:"$map/item/token"},{$ref:"$map/item/ctx"},{$ref:"event#/target/value"}]}]}}]}},{tagName:"div",attributes:{part:"override-add-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/addState"},cases:{shown:{tagName:"div",attributes:{part:"override-add"},children:[{tagName:"jx-select",attributes:{part:"add-picker"},$props:{label:{$ref:"$map/item/addLabel"},options:{$ref:"$map/item/addOptions"},value:{$ref:"$map/item/addPick"},size:"sm"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/addOverride"},value:[{$ref:"$map/item/name"},{$ref:"event#/target/value"}]}]}}]}}}]}}}]}},{tagName:"div",attributes:{part:"add"},children:[{tagName:"jx-textfield",attributes:{part:"add-name"},$props:{label:{$ref:"$map/item/nameLabel"},placeholder:{$ref:"$map/item/nameHint"},value:{$ref:"$map/item/addName"},size:"sm"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setAddName"},value:[{$ref:"$map/item/id"},{$ref:"event#/target/value"}]}]}},{tagName:"jx-textfield",attributes:{part:"add-value"},$props:{label:{$ref:"$map/item/valueLabel"},placeholder:{$ref:"$map/item/valueHint"},value:{$ref:"$map/item/addValue"},size:"sm"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setAddValue"},value:[{$ref:"$map/item/id"},{$ref:"event#/target/value"}]}]}},{tagName:"jx-button",attributes:{part:"add-button"},$props:{size:"sm",label:{$ref:"$map/item/addLabel"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/addToken"},value:[{$ref:"$map/item/id"}]}]},children:[{tagName:"span",textContent:"Add"}]}]},{tagName:"div",attributes:{part:"notice-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/noticeState"},cases:{shown:{tagName:"p",attributes:{part:"notice"},children:[{tagName:"span",textContent:"No color scheme is defined yet, so these tokens have one value each."},{tagName:"jx-action-button",attributes:{part:"manage"},$props:{size:"sm",hint:"Define a color scheme in Project Settings › Contexts"},onclick:{$ref:"#/state/manageContexts"},children:[{tagName:"span",textContent:"Manage contexts…"}]}]}}}]}}]};E("settings-css-vars",lk);var ac=new WeakMap;function ck(e){return{...e,hasError:e.error!==""}}function dk(e,t,r){let o=ac.get(e);if(o&&(o.handle===null||o.handle.root.isConnected)){Object.assign(o.scope,ck(t));return}o?.handle?.dispose(),e.textContent="";let a=g({...ck(t),...r}),i={handle:null,scope:a};ac.set(e,i),R("settings-css-vars",a,e).then((s)=>{i.handle=s})}function pk(e,t){let r=ac.get(e);if(!r)return;setTimeout(()=>{let o=r.handle?.root;if(!(o instanceof HTMLElement)||!o.isConnected)return;let a=[...o.querySelectorAll('[part="token"]')].find((i)=>i.dataset.token===t);if(!a)return;a.scrollIntoView({behavior:"smooth",block:"nearest"}),a.querySelector('[part="value"] input')?.focus()},0)}function uk(e,t,r){let o=ac.get(e);if(!o)return;setTimeout(()=>{let a=o.handle?.root;if(!(a instanceof HTMLElement)||!a.isConnected)return;let i=[...a.querySelectorAll("[data-group]")].find((s)=>s.dataset.group===t);if(!i)return;if(i.scrollIntoView({behavior:"smooth",block:"start"}),r)i.querySelector('[part="add-name"] input')?.focus()},0)}var mk={color:{name:"Primary Blue",value:"#3b82f6"},font:{name:"Body Serif",value:"'Georgia', serif"},other:{name:"Custom Var",value:"value"},size:{name:"Spacing Large",value:"32px"}},mz="#3b82f6",fz="#111111",hz={label:"Add override…",value:""},fk=new WeakMap;function Jo(e){let t=fk.get(e);if(!t)t={add:{},current:null,error:""},fk.set(e,t);return t}function lc(e,t){let{add:r}=Jo(e);return r[t]??={name:"",value:""}}function gk(){return C?.projectConfig||{}}function Or(){return gk().style||{}}function Cf(){return j_(to(gk().$media))}function ii(e){sk(),si(e),gz(e)}async function gz(e){try{await no({style:{...Or()}}),Jo(e).error=""}catch(t){Jo(e).error=`Could not save project.json — ${X(t)}`}si(e)}function bk(e,t){let r=e===void 0?"transparent":String(e);return{swatchBg:r,swatchInput:r.startsWith("#")?r:t}}function bz(e,t,r,o){let a=Jy(o,t,e.name);return{ctx:t.name,fieldLabel:`${e.name} in ${t.label}`,id:`${e.name} ${t.name}`,kind:t.kind,label:t.label,swatchLabel:`${e.name} in ${t.label}`,swatchState:r?"swatch":"none",token:e.name,value:a===void 0?"":String(a),...bk(Ac(o,a),fz)}}function yz(e,t,r,o,a){let i=t.id==="color",s=String(e.value),l=Ac(r,e.value),f=yp(e.value),c=o.filter((b)=>i&&b.kind==="scheme"||Jy(r,b,e.name)!==void 0),d=s===""?[]:pD(r,o,e.name,c);return{addLabel:`Add an override for ${e.name}`,addOptions:[hz,...d.map((b)=>({label:b.label,value:b.name}))],addPick:"",addState:d.length===0?"none":"shown",chipLabel:f??"",chipState:f===null?"none":i&&l!==void 0?"swatch":"plain",chipSwatch:l===void 0?"":String(l),chipTitle:f===null?"":`${fw(f)} → ${l===void 0?"unresolved":String(l)}`,current:e.name===a,label:e.name,name:e.name,overrides:c.map((b)=>bz(e,b,i,r)),overrideState:c.length===0&&d.length===0?"none":"shown",previewFont:t.id==="font"?s:"",previewState:t.id==="font"?"font":"none",removeLabel:`Delete ${e.name}`,swatchLabel:`${e.name} color`,swatchState:i?"swatch":"none",value:s,...bk(i?l:void 0,mz)}}function vz(e){let t=Or(),r=Cf(),o=r.some((i)=>i.kind==="scheme"),a=[];for(let{group:i,tokens:s}of F_(t)){if(i.id==="other"&&s.length===0)continue;let l=lc(e,i.id);a.push({addLabel:`Add a ${i.title} variable`,addName:l.name,addValue:l.value,id:i.id,nameHint:mk[i.id].name,nameLabel:`New ${i.title} name`,noticeState:i.id==="color"&&!o?"shown":"none",title:i.title,tokens:s.map((f)=>yz(f,i,t,r,Jo(e).current)),valueHint:mk[i.id].value,valueLabel:`New ${i.title} value`})}return{error:Jo(e).error,groups:a}}function si(e){dk(e,vz(e),$z(e))}function Sf(e){return M_.find((t)=>t.id===e)}function wz(e,t){let r=Sf(t);if(!r)return;let o=lc(e,r.id),a=Sv(o.name,r.prefix);if(!a||!o.value)return;Or()[a]=o.value,o.name="",o.value="",ii(e)}function xz(e,t,r){let o=Or(),a=Cf().find((s)=>s.name===r);if(!a||Jy(o,a,t)!==void 0){si(e);return}let i=o[t];if(!n(i)&&!Y(i))return;cE(o,a,t,String(i)),ii(e)}function kz(){nt("settings.open",{section:"contexts"},"Styles")}var hk=new WeakMap;function $z(e){let t=hk.get(e);if(!t)t={addOverride:(r,o)=>{xz(e,r,o)},addToken:(r)=>{wz(e,r)},manageContexts:()=>{kz()},removeToken:(r)=>{delete Or()[r],ii(e)},setAddName:(r,o)=>{let a=Sf(r);if(a)lc(e,a.id).name=o},setAddValue:(r,o)=>{let a=Sf(r);if(a)lc(e,a.id).value=o},setOverride:(r,o,a)=>{let i=Cf().find((s)=>s.name===o);if(!i)return;cE(Or(),i,r,a),ii(e)},setToken:(r,o)=>{Or()[r]=o,ii(e)}},hk.set(e,t);return t}function Tf(e){si(e)}function Pf(e,t,r={}){if(Jo(e).current=t,si(e),t===null||r.reveal===!1)return;pk(e,t)}function yk(e,t,r={}){uk(e,t,r.add===!0)}var li=ja({focus:null,served:!0});function cc(e){if(e.kind==="variable")u.stylebook.variable=e.name;li.value={focus:e,served:!1}}function vk(){li.value={focus:null,served:!0}}var wk={$schema:"https://jxsuite.com/schema/v1",$id:"StudioStylesVariables",$description:"The Styles workspace's Variables view (studio.md §7.1): the project's CSS custom properties, the `--` keys of `project.json`'s root style block, edited in the pane over the same tab as the Elements view and the Code view. It draws the view's frame and nothing it edits: a heading, one sentence saying what these are, one saying when an edit reaches the file (a variable is written as it is changed, which also writes any element style edit still waiting for Save, because both live in the one file), the door to Project Settings › Contexts where colour schemes and breakpoints are declared, and an empty `editor` island the CSS Variables editor (`settings/css-vars-editor.ts`) is mounted into (studio-ui-guidelines.md §9.4). `style/variables-view.ts` decides every word.",tagName:"section",attributes:{part:"variables-view","aria-labelledby":"${state.headingId}","data-jx-region":"${state.region}"},style:{$description:"Fills the pane's stage by its own geometry, as the workspace home does (`workspace-home.json`): the stage is `position: relative`, so the view takes the whole of it and scrolls itself without the stage being restyled for it. The column is capped so a value field never stretches across a wide pane.",position:"absolute",inset:"0",overflowY:"auto",boxSizing:"border-box",padding:"var(--jx-space-6)",fontFamily:"var(--jx-font-sans)",color:"var(--fg)",background:"var(--bg-panel)",'& [part="column"]':{maxWidth:"760px",margin:"0 auto"},'& [part="head"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-2)",marginBottom:"var(--jx-space-5)"},'& [part="title"]':{margin:"0",fontSize:"var(--jx-text-lg)",fontWeight:"600"},'& [part="lede"], & [part="saving"]':{margin:"0",maxWidth:"68ch",lineHeight:"1.5",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"},'& [part="saving"]':{fontSize:"var(--jx-text-sm)"},'& [part="schemes"]':{display:"flex",alignItems:"center",flexWrap:"wrap",gap:"var(--jx-space-2)",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="schemes-text"]':{margin:"0"}},children:[{tagName:"div",attributes:{part:"column"},children:[{tagName:"header",attributes:{part:"head"},children:[{tagName:"h2",attributes:{part:"title",id:"${state.headingId}"},textContent:"${state.title}"},{tagName:"p",attributes:{part:"lede"},textContent:"${state.lede}"},{tagName:"p",attributes:{part:"saving"},textContent:"${state.saving}"},{tagName:"div",attributes:{part:"schemes"},children:[{tagName:"p",attributes:{part:"schemes-text"},textContent:"${state.schemes}"},{tagName:"jx-action-button",attributes:{part:"manage-contexts"},$props:{size:"sm",quiet:!0},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/manageContexts"},value:[]}],description:"Opens Project Settings on Contexts, the one place a colour scheme or a breakpoint is declared (studio.md §17.1)."},children:[{tagName:"span",textContent:"${state.manageLabel}"}]}]}]},{tagName:"div",attributes:{part:"editor",role:"none"}}]}]};E("styles-variables",wk);function Cz(e,t){Object.assign(e,t),e.headingId=`styles-variables-${t.region.replaceAll(/[^\w-]/g,"-")}`}function Tz(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function xk(e,t,r,o){e.replaceChildren();let a=g({headingId:"",lede:"",manageContexts:r.manageContexts,manageLabel:"",region:"",saving:"",schemes:"",title:""});Cz(a,t);let i=null,s=!1,l=R("styles-variables",a,e,{onNodeCreated:(f,c,d)=>{if(f instanceof HTMLElement&&Tz(d)==="editor")o.editorSlot(f)}}).then((f)=>{if(s){f.dispose();return}i=f});return{attached:()=>{if(s)return!1;let f=i?.root;return f===void 0?!0:e.contains(f)},dispose(){s=!0,i?.dispose(),i=null},ready:l}}var Pz="Variables",Ez="Your site's CSS custom properties, kept in the root style block of project.json. Every page and component can use one in any style value as var(--name).",Nz="Each change here is written to project.json as you make it, so there is nothing to save afterwards. The write also saves any Elements change still waiting for Save, because both live in that file. Undo is the exception: an undone change waits for Save like any other edit.",jz="To give a variable another value in a color scheme or at a breakpoint, use Add override under its row. The schemes and breakpoints themselves are declared in Project settings, under Contexts.";function Rz(e){return{lede:Ez,manageLabel:"Manage contexts…",region:Ln(e,"variables"),saving:Nz,schemes:jz,title:Pz}}var dc=new Map;function Ef(e,t){let r=dc.get(e);return r!==void 0&&r.tabId===t.id&&r.wrap.isConnected&&r.surface.attached()}function ci(e){let t=dc.get(e);if(!t)return;t.scope.stop(),t.surface.dispose(),dc.delete(e)}function Az(){nt("settings.open",{section:"contexts"},"Styles")}function kk(e){if(C&&e.documentPath===an)FC()}function Iz(e,t){if(t?.kind==="group"){yk(e,t.group,{add:t.add});return}Pf(e,t?.name??u.stylebook.variable)}function $k(e){let t=li.value;if(t.served)return!1;return t.served=!0,Iz(e,t.focus),!0}function Sk(e){Gr();try{e()}finally{Kr()}}function Ck(e,t){let{paneId:r,wrap:o}=e;if(Ef(r,t))return;ci(r),kk(t);let a=null,i=xk(o,Rz(r),{manageContexts:Az},{editorSlot:(l)=>{if(a=l,Tf(l),!$k(l)&&u.stylebook.variable!==null)Pf(l,u.stylebook.variable,{reveal:!1})}}),s=me();dc.set(r,{paneId:r,scope:s,surface:i,tabId:t.id,wrap:o}),s.run(()=>{let l=null;te(()=>{let{document:f}=t.doc,c=JSON.stringify([f.style??null,f.$media??null]);if(c===l)return;let d=l===null;l=c;let b=a;if(!d&&b)Sk(()=>{kk(t),Tf(b)})}),te(()=>{li.value;let f=a;if(f)Sk(()=>{$k(f)})})})}var Tk={$schema:"https://jxsuite.com/schema/v1",$id:"StudioAddRepo",$description:"The repository picker: every repository the platform's account link can reach, narrowed by name and account, and — once one is chosen — the folders it holds a project.json in, so a project that lives in a subfolder opens as itself. Two flows share it — Add existing repository, and Open Project on a platform whose projects ARE repositories — so the headline and the primary answer are state rather than text. A `jx-dialog`, so the platform owns modality, Escape, focus restoration and the backdrop. Choosing is two steps now, a repository and then its folder, so the dialog has a confirming button again; a double-click on a row still opens it in one gesture when the folder is unambiguous. Nothing here knows what `not_jx_project` means, which permission counts as write, which folder to preselect or that a Jx-tagged repository sorts first — `new-project/add-repo-modal.ts` keeps the listing, the ordering, the scan and the adoption, and hands over rows that are already strings and booleans.",tagName:"jx-dialog",$props:{headline:{$ref:"#/state/title"},confirmLabel:{$ref:"#/state/confirmLabel"},confirmDisabled:{$ref:"#/state/confirmDisabled"},cancelLabel:"Cancel",size:"xl"},attributes:{part:"add-repo"},onconfirm:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/confirm"},value:[]}]},oncancel:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},onclose:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},style:{$description:"The dialog is wide enough for two panes — the repositories on the left, the chosen repository's projects on the right — and the PANES scroll, never the dialog: `jx-dialog` pins its header and footer and scrolls its body, and this surface turns the body into a column the picker fills, so the filter above the lists, the summary under them and the access footer at the bottom all stay on screen however long a list is. That is what retired the two scrollbars the old picker drew side by side, its own 320px list inside a dialog that also scrolled. Below 40rem the panes stack.",'& > [part="dialog"] > [part="body"]':{$description:"The kit's body scrolls by default; here the picker is the body's only child and does its own scrolling inside two panes, so the body becomes the column it fills.",display:"flex",flexDirection:"column",overflow:"hidden"},'& [part="picker"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-3)",flex:"0 1 30rem",minHeight:"0",containerType:"inline-size",containerName:"add-repo"},'& [part="toolbar"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",flex:"none"},'& [part="filter"]':{flex:"1 1 auto",minWidth:"0"},'& [part="owner"]':{flex:"0 0 12rem"},'& [part="owner-slot"], & [part="list-slot"], & [part="detail-slot"], & [part="locations-slot"], & [part="failure-slot"], & [part="access-slot"], & [part="tag-slot"], & [part="private-slot"]':{display:"contents"},'& [part="panes"]':{display:"grid",gridTemplateColumns:"minmax(0, 1fr) minmax(0, 1fr)",gap:"var(--jx-space-3)",flex:"1 1 auto",minHeight:"0"},'& [part="repos"], & [part="detail"]':{$description:"Each pane is a framed box of its own height that scrolls its own content, so choosing a repository far down the list never scrolls its projects out of view.",display:"flex",flexDirection:"column",minHeight:"0",border:"1px solid var(--border)",borderRadius:"var(--radius)",overflow:"hidden"},'& [part="repo-list"]':{flex:"1 1 auto",minHeight:"0",overflowY:"auto",padding:"var(--jx-space-1)"},'& [part="location-list"]':{margin:"0 calc(-1 * var(--jx-space-2))"},'& [part="detail-body"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-3)",flex:"1 1 auto",minHeight:"0",overflowY:"auto",padding:"var(--jx-space-3)"},'& [part="detail-head"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-1)",flex:"none",minWidth:"0"},'& [part="detail-name"]':{fontWeight:"600",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="detail-meta"]':{fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="folder-row"]':{flex:"none"},'& [part="repo"] [part="description"], & [part="location"] [part="description"]':{$description:"The note gives way before the name does: a repository is found by its name, and a branch or a path cut short is still recognisable where a name cut short is not.",flexShrink:"4"},'& [part="badges"]':{display:"inline-flex",gap:"var(--jx-space-1)"},'& [part="badge"]':{padding:"0 var(--jx-space-2)",border:"1px solid currentColor",borderRadius:"var(--jx-radius-lg)",fontSize:"var(--jx-text-xs)",opacity:"0.8"},'& [part="empty"], & [part="note"]':{margin:"0",padding:"var(--jx-space-4) var(--jx-space-3)",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"},'& [part="note"]':{padding:"0"},'& [part="summary"]':{$description:"What confirming will do, in words: which repository, which folder, which branch. Polite and live, because the arrows in both fields change it without moving focus, and this is how a reader who cannot see the panes hears where they are.",margin:"0",flex:"none",minHeight:"var(--jx-leading-md)",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="install"], & [part="access-link"]':{color:"var(--accent)",textDecoration:"underline"},'& [part="failure"]':{$description:'The refusal from the last adoption, said above the footer the reader is still looking at, because the panes survive it: a folder with no readable project.json is a fact about that folder, and the rest are still on offer. It is `failure` rather than `error` because `jx-textfield` draws a `[part="error"]` of its own inside this same tree.',margin:"0",flex:"none",fontSize:"var(--jx-text-md)",color:"var(--danger)"},'& [part="access"]':{$description:"The listing is bounded by what the Jx Suite GitHub App was granted, so the dialog always offers a way out of that boundary rather than only saying the list is short. `center`, not `baseline`: a small kit button exports no baseline (surface-baseline-rows.test.ts).",display:"flex",flexWrap:"wrap",alignItems:"center",gap:"var(--jx-space-2)",flex:"none",paddingTop:"var(--jx-space-3)",borderTop:"1px solid var(--border)",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="access-note"]':{flex:"1 1 auto"},'& [part="access-links"]':{display:"flex",flexWrap:"wrap",gap:"var(--jx-space-3)"},"@container add-repo (max-width: 40rem)":{'& [part="panes"]':{gridTemplateColumns:"minmax(0, 1fr)",gridTemplateRows:"minmax(0, 1fr) minmax(0, 1fr)"},'& [part="owner"]':{flexBasis:"9rem"}}},children:[{tagName:"div",attributes:{part:"picker"},children:[{tagName:"div",attributes:{part:"toolbar"},children:[{tagName:"jx-textfield",attributes:{part:"filter"},$props:{label:"Filter repositories",placeholder:"Filter repositories…",type:"search",size:"sm",value:{$ref:"#/state/filter"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setFilter"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{ArrowDown:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/move"},value:[1]}],ArrowUp:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/move"},value:[-1]}],Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/confirm"},value:[]}]}}]}},{tagName:"div",attributes:{part:"owner-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasOwners"},cases:{true:{tagName:"jx-select",attributes:{part:"owner"},$props:{label:"Account",size:"sm",options:{$ref:"#/state/owners"},value:{$ref:"#/state/owner"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setOwner"},value:[{$ref:"event#/target/value"}]}]}}}}]},{tagName:"div",attributes:{part:"panes"},children:[{tagName:"section",attributes:{part:"repos","aria-label":"Repositories"},children:[{tagName:"div",attributes:{part:"list-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/listState"},cases:{loading:{tagName:"p",attributes:{part:"empty"},textContent:"Loading repositories…"},"empty-filter":{tagName:"p",attributes:{part:"empty"},textContent:"No repositories match the filter."},"empty-write":{tagName:"p",attributes:{part:"empty"},textContent:"Repositories you can write to are listed here. Widen the Jx Suite GitHub App's repository access below, or ask a repository admin for write access."},"empty-install":{tagName:"p",attributes:{part:"empty"},children:[{tagName:"span",textContent:"Repositories the Jx Suite GitHub App can reach are listed here. "},{tagName:"a",attributes:{part:"install",href:"${state.installUrl}",target:"_blank",rel:"noreferrer"},textContent:"Install the Jx Suite GitHub App"},{tagName:"span",textContent:" to grant repository access, then use Refresh below."}]},"empty-none":{tagName:"p",attributes:{part:"empty"},textContent:"Repositories the Jx Suite GitHub App can reach are listed here. Install the App, or widen its repository access, and try again."},listed:{tagName:"jx-listbox",attributes:{part:"repo-list",id:"add-repo-repos"},$props:{label:"Repositories",active:"${state.activeRepoId}"},onselect:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/select"},value:[{$ref:"event#/detail"}]}],description:"One handler for every row, because a row's `select` bubbles; its detail is the row's value, the repository's full name."},children:[{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/fullName"},map:{tagName:"jx-option",attributes:{part:"repo",id:"${$map.item.id}","data-repo":"${$map.item.fullName}",title:"${$map.item.fullName}"},$props:{value:{$ref:"$map/item/fullName"},label:{$ref:"$map/item/fullName"},description:{$ref:"$map/item/meta"}},ondblclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openRepo"},value:[{$ref:"$map/item/fullName"}]}]},children:[{tagName:"span",attributes:{part:"badges",slot:"end"},children:[{tagName:"span",attributes:{part:"tag-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/isJx"},cases:{true:{tagName:"span",attributes:{part:"badge"},textContent:"Jx"}}},{tagName:"span",attributes:{part:"private-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/isPrivate"},cases:{true:{tagName:"span",attributes:{part:"badge"},textContent:"private"}}}]}]}}]}}}]},{tagName:"section",attributes:{part:"detail","aria-label":"Project"},children:[{tagName:"div",attributes:{part:"detail-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasDetail"},cases:{false:{tagName:"p",attributes:{part:"empty"},textContent:"Choose a repository to see the Jx projects it holds and pick the one to open."},true:{tagName:"div",attributes:{part:"detail-body"},children:[{tagName:"div",attributes:{part:"detail-head"},children:[{tagName:"span",attributes:{part:"detail-name"},textContent:"${state.detailName}"},{tagName:"span",attributes:{part:"detail-meta"},textContent:"${state.detailMeta}"}]},{tagName:"jx-field",attributes:{part:"folder-row"},$props:{span:!0,label:"Project Folder",description:{$ref:"#/state/folderHelp"},invalid:{$ref:"#/state/folderInvalid"}},children:[{tagName:"jx-textfield",attributes:{part:"folder"},$props:{placeholder:"Repository root",size:"sm",mono:!0,value:{$ref:"#/state/folder"},invalid:{$ref:"#/state/folderInvalid"},error:{$ref:"#/state/folderError"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setFolder"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{ArrowDown:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/moveLocation"},value:[1]}],ArrowUp:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/moveLocation"},value:[-1]}],Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/confirm"},value:[]}]}}]}}]},{tagName:"div",attributes:{part:"locations-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/detailState"},cases:{loading:{tagName:"p",attributes:{part:"note"},textContent:"Looking for project.json files…"},listed:{tagName:"jx-listbox",attributes:{part:"location-list",id:"add-repo-locations"},$props:{label:"Projects in this repository",active:"${state.activeLocationId}"},onselect:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/pickLocation"},value:[{$ref:"event#/detail"}]}]},children:[{$prototype:"Array",items:{$ref:"#/state/locations"},key:{$ref:"$map/item/dir"},map:{tagName:"jx-option",attributes:{part:"location",id:"${$map.item.id}","data-dir":"${$map.item.dir}",title:"${$map.item.path}"},$props:{value:{$ref:"$map/item/dir"},label:{$ref:"$map/item/label"},description:{$ref:"$map/item/path"}},ondblclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/confirm"},value:[]}]},children:[{tagName:"jx-icon",attributes:{slot:"icon"},$props:{name:"folder"}}]}}]},empty:{tagName:"p",attributes:{part:"note"},textContent:"No folder in this repository holds a project.json yet. Name one above if it does, or create a new project instead."},unlisted:{tagName:"p",attributes:{part:"note"},textContent:"Name the folder that holds the project's project.json, or leave the field empty to open the repository root."},failed:{tagName:"p",attributes:{part:"note"},textContent:"Studio couldn't list this repository's projects. Name the folder that holds the project.json instead."}}}]}}}]}]},{tagName:"p",attributes:{part:"summary","aria-live":"polite"},textContent:"${state.summary}"},{tagName:"div",attributes:{part:"failure-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasFailure"},cases:{true:{tagName:"p",attributes:{part:"failure"},textContent:"${state.failure}"}}},{tagName:"div",attributes:{part:"access-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasAccess"},cases:{true:{tagName:"div",attributes:{part:"access"},children:[{tagName:"span",attributes:{part:"access-note"},textContent:"Missing a repository? Grant the Jx Suite GitHub App access to more of them:"},{tagName:"span",attributes:{part:"access-links"},children:[{$prototype:"Array",items:{$ref:"#/state/access"},key:{$ref:"$map/item/url"},map:{tagName:"a",attributes:{part:"access-link",href:"${$map.item.url}",target:"_blank",rel:"noreferrer",title:"${$map.item.title}"},textContent:"${$map.item.label}"}}]},{tagName:"jx-button",attributes:{part:"refresh"},$props:{size:"sm",disabled:{$ref:"#/state/refreshDisabled"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/refresh"},value:[]}]},children:[{tagName:"span",textContent:"Refresh"}]}]}}}]}]};E("add-repo",Tk);function Oz(e){return`add-repo-repo-${e}`}function Mz(e){return`add-repo-location-${e}`}function Pk(e){let t=e.rows.map((i,s)=>({...i,id:Oz(s)})),r=e.locations.map((i,s)=>({...i,id:Mz(s)})),o=t.find((i)=>i.fullName===e.selected),a=e.folderError===""?r.find((i)=>i.dir===e.chosenFolder):void 0;return{...e,activeLocationId:a?.id??"",activeRepoId:o?.id??"",confirmDisabled:!e.canConfirm,folderInvalid:e.folderError!=="",hasAccess:e.access.length>0,hasDetail:e.detailState!=="none",hasFailure:e.failure!=="",hasOwners:e.owners.length>0,listState:e.loading?"loading":t.length>0?"listed":`empty-${e.emptyState}`,locations:r,refreshDisabled:e.loading||e.busy,rows:t}}function Ek(e){let t=document.createElement("div");t.style.pointerEvents="auto",t.setAttribute(Ve,vt("dialog","add-repo")),e.layer.append(t);let r=!1,o=()=>{if(r)return;r=!0,e.onClosed()},a=()=>r,i=g({...Pk(e.view),closed:o,confirm:()=>{e.onConfirm()},move:(f)=>{e.onMove(f)},moveLocation:(f)=>{e.onMoveLocation(f)},openRepo:(f)=>{e.onOpenRepo(f)},pickLocation:(f)=>{e.onLocation(f)},refresh:()=>{e.onRefresh()},select:(f)=>{e.onSelect(f)},setFilter:(f)=>{i.filter=f,e.onFilter(f)},setFolder:(f)=>{i.folder=f,e.onFolder(f)},setOwner:(f)=>{i.owner=f,e.onOwner(f)}}),s=null,l=R("add-repo",i,t).then(async(f)=>{s=f;let c=f.root;if(a())return f.dispose(),c;if(await sn(c),a())return c;Jt(c);let d=c.querySelector('[part="filter"]');if(d)m1(d);return c});return{close(){let f=s?.root;if(f instanceof HTMLElement)Ut(f);s?.dispose(),s=null,t.remove(),o()},host:t,ready:l,update(f){Object.assign(i,Pk(f))}}}var Dz=250,Lt=null,Go="add",Kt=null,mi="",Ko="",ot="",Ot="",In=!1,gi="",kt=new Map,di=null,ui="",Mt="",Gt=!1,Nf=null;function jf(){let e=p();return Q(e.listRepos)&&Q(e.importProject)}function Rk(){return p().openProjectPicker==="repo-list"&&jf()}function Ak(){return Lk("add")}function Ik(){return Lk("open")}function Lk(e){if(Lt)return Promise.resolve(null);return Go=e,Kt=null,mi="",Ko="",ot="",Ot="",In=!1,gi="",kt=new Map,Mt="",Gt=!1,new Promise((t)=>{Nf=t,Lt=Ek({layer:dt("dialog"),onClosed:()=>{Ok(null)},onConfirm:()=>{If()},onFilter:(r)=>{mi=r,gt()},onFolder:(r)=>{Ot=r,In=!0,Mt="",gt()},onLocation:(r)=>{Ot=r,In=!0,Mt="",gt()},onMove:(r)=>{Fz(r)},onMoveLocation:(r)=>{zz(r)},onOpenRepo:(r)=>{Hz(r)},onOwner:(r)=>{Ko=r,gt()},onRefresh:()=>{Nk()},onSelect:(r)=>{pc(r,"now")},view:Vk()}),Nk()})}function Nk(){Kt=null,Mt="",Af(),kt=new Map,gt(),Hd().then(gt),p().listRepos?.().then((e)=>{if(Kt=e,ot)Fk(ot,"now")}).catch((e)=>{Kt=[],Mt=X(e)}).finally(()=>{gt()})}function gt(){Lt?.update(Vk())}function Ok(e){let t=Lt,r=Nf;Lt=null,Nf=null,Gt=!1,Af(),r?.(e),t?.close()}function Mk(){let e=Kt??[];if(Go!=="open")return e;let t=e.filter((r)=>r.permission==="admin"||r.permission==="write");return[...t.filter((r)=>r.isJxProject),...t.filter((r)=>!r.isJxProject)]}function Rf(){let e=mi.trim().toLowerCase(),t=Mk().filter((r)=>!Ko||r.owner===Ko);return e?t.filter((r)=>r.fullName.toLowerCase().includes(e)):t}function Dk(){return ot?(Kt??[]).find((e)=>e.fullName===ot):void 0}function pc(e,t){if(e===ot||Gt)return;ot=e,Ot="",In=!1,gi="",Mt="",Fk(e,t),gt()}function Fz(e){let t=Rf();if(t.length===0)return;let r=t.findIndex((i)=>i.fullName===ot),o=r===-1?e>0?0:t.length-1:Math.min(t.length-1,Math.max(0,r+e)),a=t[o];if(a)pc(a.fullName,"soon")}function _z(){let e=kt.get(ot);return e?.status==="done"?e.projects.locations:[]}function zz(e){let t=_z();if(t.length===0)return;let r=Bl(Ot),o=t.findIndex((s)=>s.dir===r),a=o===-1?e>0?0:t.length-1:(o+e+t.length)%t.length,i=t[a];if(i)Ot=i.dir,In=!0,Mt="",gt()}function Fk(e,t){let r=p(),o=(Kt??[]).find((i)=>i.fullName===e);if(!r.listRepoProjects||!o)return;let a=kt.get(e);if(a){if(a.status==="done")_k(e);return}if(Af(),kt.set(e,{status:"loading"}),t==="now"){jk(o);return}ui=e,di=setTimeout(()=>{di=null,ui="",jk(o)},Dz)}function Af(){if(di===null)return;if(clearTimeout(di),di=null,ui)kt.delete(ui),ui=""}async function jk(e){let t=Lt,r;try{r={projects:await p().listRepoProjects({name:e.name,owner:e.owner}),status:"done"}}catch(o){r={message:X(o),status:"failed"}}if(Lt!==t||kt.get(e.fullName)?.status!=="loading")return;if(kt.set(e.fullName,r),e.fullName===ot){if(_k(e.fullName),gi===e.fullName){if(gi="",r.status==="done"&&r.projects.locations.length===1){If();return}}}gt()}function _k(e){let t=kt.get(e);if(In||e!==ot||t?.status!=="done")return;let{locations:r}=t.projects;Ot=(r.find((o)=>o.dir==="")??r[0])?.dir??""}function Hz(e){pc(e,"now");let t=kt.get(e);if(t?.status==="loading"){gi=e;return}if(t?.status==="done"&&t.projects.locations.length>1&&!In)return;If()}function zk(){return Bl(Ot)===null?"A project folder is a path inside the repository, without . or .. segments.":""}function Hk(){let e=Dk();if(!e||Gt||zk()!=="")return!1;let t=kt.get(e.fullName);if(In||!t)return!0;return t.status==="failed"||t.status==="done"&&(t.projects.locations.length>0||t.projects.truncated)}function If(){if(!ot){let[e]=Rf();if(e)pc(e.fullName,"now");return}if(!Hk())return;Bk(ot,Bl(Ot)??"")}async function Bk(e,t,r=!1){let o=(Kt??[]).find((i)=>i.fullName===e);if(!o||Gt&&!r)return;let a=Lt;Gt=!0,Mt="",gt();try{let i={name:o.name,owner:o.owner},s=await p().importProject?.(t?{...i,dir:t}:i);if(Lt!==a)return;if(s){Ok(s);return}Mt="This platform cannot import repositories."}catch(i){if(Lt!==a)return;if(Mt=X(i),Gt=!1,gt(),!r&&await Am(i)&&Lt===a)await Bk(e,t,!0);return}Gt=!1,gt()}function Bz(e){return{fullName:e.fullName,isJx:e.isJxProject,isPrivate:e.private,meta:e.defaultBranch}}function Vz(e,t){let r=e.dir.slice(e.dir.lastIndexOf("/")+1);return{dir:e.dir,label:e.name??(e.dir?r:t.name),path:e.dir?`${e.dir}/`:"/"}}function Wz(){if(mi||Ko)return"filter";if(Go==="open"&&(Kt??[]).length>0)return"write";return oC()?"install":"none"}function qz(){let e=[...new Set(Mk().map((t)=>t.owner))].toSorted((t,r)=>t.localeCompare(r));if(e.length<2)return[];return[{label:"All accounts",value:""},...e.map((t)=>({label:t,value:t}))]}function Uz(){let e=dA();if(!e)return[];return[...e.manage.map((t)=>({label:t.account,title:`Manage repository access for ${t.account}`,url:t.url})),...e.installUrl?[{label:"Another account…",title:"Install the Jx Suite GitHub App on another account",url:e.installUrl}]:[]]}function Jz(e){if(!e)return{branch:"",detailMeta:"",detailName:"",detailState:"none",folderHelp:"",locations:[]};let t=kt.get(e.fullName),r=t?.status==="done"?t.projects.branch:e.defaultBranch,o=[],a={branch:r,detailMeta:[r,e.permission,...e.private?["private"]:[]].join(" · "),detailName:e.fullName,folderHelp:"The folder that holds project.json. Leave it empty for the repository root.",locations:o};if(!p().listRepoProjects)return{...a,detailState:"unlisted"};if(!t||t.status==="loading")return{...a,detailState:"loading"};if(t.status==="failed")return{...a,detailState:"failed"};let{locations:i,truncated:s}=t.projects,l={...a,detailState:i.length>0?"listed":"empty",locations:i.map((f)=>Vz(f,e))};if(s)l.folderHelp="This repository is too large to scan in full. Name the folder if its project isn't listed.";return l}function Vk(){let e=Dk(),{branch:t,...r}=Jz(e),o=zk(),a=Bl(Ot)??"",i=Go==="open"?"Open":"Add";return{...r,access:Uz(),busy:Gt,canConfirm:Hk(),confirmLabel:Gt?Go==="open"?"Opening…":"Adding…":i,emptyState:Wz(),failure:Mt,chosenFolder:a,filter:mi,folder:Ot,folderError:o,installUrl:iC()?.appInstallUrl??"",loading:Kt===null,owner:Ko,owners:qz(),rows:Rf().map((s)=>Bz(s)),selected:ot,summary:e&&o===""?`${i}s ${e.fullName} ${a?`at ${a}/`:"at the repository root"}${t?` on ${t}`:""}.`:"",title:Go==="open"?"Open Project":"Add existing repository"}}var Wk={$schema:"https://jxsuite.com/schema/v1",$id:"StudioWelcome",$description:"The Start pane, shown when no project is loaded and no document is open. The adapter hands in the start actions, whether the GitHub App still needs installing, the platform's own notices with the actions each offers, the recent projects with their distinguishing folders and last-opened labels, and the platform's catalogue; the document draws them in the order a first run needs them.",tagName:"div",attributes:{part:"screen"},style:{width:"100%",height:"100%",display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"10vh",overflowY:"auto",boxSizing:"border-box",fontFamily:"var(--jx-font-sans)",color:"var(--jx-fg)",'& > [part="content"]':{maxWidth:"560px",width:"100%",padding:"0 var(--jx-space-6) var(--jx-space-7)",boxSizing:"border-box"},'& [part="title"]':{fontSize:"28px",fontWeight:"300",letterSpacing:"-0.5px",margin:"0",color:"var(--jx-fg)"},'& [part="subtitle"]':{fontSize:"var(--jx-text-lg)",color:"var(--jx-fg-dim)",margin:"2px 0 0"},'& [part="section"]':{marginTop:"28px"},'& [part="section-title"]':{fontSize:"var(--jx-text-md)",fontWeight:"600",color:"var(--jx-fg)",margin:"0 0 var(--jx-space-3)",textTransform:"uppercase",letterSpacing:"0.3px"},'& [part="section-header"]':{$description:"`center`, not `baseline`: `Clear all` is a small kit button, and a small kit control is layout-contained so its outset hit area adds nothing to a scrolling ancestor's overflow, which leaves it with no baseline to export. A baseline row synthesised one from the button's bottom edge, which stood the header 33px tall with the title 10px under the button's label. The gap under the header is the HEADER's, because centring aligns MARGIN boxes: while the h2 kept its own 8px block-end margin its margin box was 26px, exactly the header's height, so `center` had nothing to move and left the h2 flush at the top with the button centred 3.6px below its baseline — a fix that measured right and still looked wrong. With the margin moved out, the two boxes are the only things in the line and they centre on each other.",display:"flex",alignItems:"center",justifyContent:"space-between",gap:"var(--jx-space-4)",marginBottom:"var(--jx-space-3)"},'& [part="section-header"] [part="section-title"]':{marginBlockEnd:"0"},'& [part="actions"]':{display:"flex",flexDirection:"column",alignItems:"stretch",gap:"2px"},'& [part="actions"] jx-button > [part="control"]':{justifyContent:"flex-start",textAlign:"left",color:"var(--jx-accent)"},'& [part="link"]':{display:"inline-flex",alignItems:"center",gap:"var(--jx-space-2)",minHeight:"var(--jx-control-h)",padding:"0 var(--jx-space-3)",borderRadius:"var(--jx-radius-sm)",color:"var(--jx-accent)",textDecoration:"none",":hover":{background:"var(--jx-hover-bg)"},":focus-visible":{outline:"var(--jx-focus-ring)",outlineOffset:"2px"}},'& [part="note"]':{margin:"var(--jx-space-2) var(--jx-space-3) 0",fontSize:"var(--jx-text-md)",color:"var(--jx-fg-dim)"},'& [part="list"]':{listStyle:"none",margin:"0",padding:"0"},'& [part="row"]':{display:"flex",alignItems:"center"},'& [part="recent"]':{flex:"1",minWidth:"0",display:"grid",gridTemplateColumns:"auto 1fr auto",alignItems:"baseline",gap:"var(--jx-space-4)",padding:"5px var(--jx-space-3)",margin:"0",background:"none",border:"none",borderRadius:"var(--jx-radius-sm)",font:"inherit",fontSize:"var(--jx-text-lg)",color:"var(--jx-fg)",cursor:"pointer",textAlign:"left",":hover":{background:"var(--jx-hover-bg)"},":focus-visible":{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"}},'& [part="name"]':{color:"var(--jx-accent)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="path"]':{color:"var(--jx-fg-dim)",fontSize:"var(--jx-text-md)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="when"]':{color:"var(--jx-fg-dim)",fontSize:"var(--jx-text-md)",whiteSpace:"nowrap"},'& [part="remove"]':{flexShrink:"0",opacity:"0"},'& [part="row"]:hover [part="remove"], & [part="remove"]:focus-within':{opacity:"1"}},children:[{tagName:"div",attributes:{part:"content"},children:[{tagName:"h1",attributes:{part:"title"},textContent:"Jx Studio"},{tagName:"p",attributes:{part:"subtitle"},textContent:"Design, build, and publish websites"},{tagName:"section",attributes:{part:"section"},children:[{tagName:"h2",attributes:{part:"section-title"},textContent:"Start"},{tagName:"div",attributes:{part:"actions"},children:[{$prototype:"Array",items:{$ref:"#/state/actions"},key:{$ref:"$map/item/id"},map:{tagName:"jx-button",$props:{quiet:!0},attributes:{part:"action","data-action":"${$map.item.id}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/run"},value:[{$ref:"$map/item/id"}]}]},children:[{tagName:"jx-icon",attributes:{slot:"icon"},$props:{name:{$ref:"$map/item/icon"}}},{tagName:"span",textContent:"${$map.item.title}"}]}}]}]},{tagName:"div",attributes:{part:"install-slot"},style:{display:"contents"},$switch:{$ref:"#/state/installNeeded"},cases:{true:{tagName:"section",attributes:{part:"section"},children:[{tagName:"h2",attributes:{part:"section-title"},textContent:"Repository access"},{tagName:"div",attributes:{part:"actions"},children:[{tagName:"a",attributes:{part:"link",href:"${state.installUrl}",target:"_blank",rel:"noreferrer"},children:[{tagName:"jx-icon",$props:{name:"link"}},{tagName:"span",textContent:"Install the Jx Suite GitHub App"}]}]},{tagName:"p",attributes:{part:"note"},textContent:"Grants repository access so you can create and open projects — choose “All repositories”."}]}}},{$prototype:"Array",items:{$ref:"#/state/notices"},key:{$ref:"$map/item/id"},map:{tagName:"section",attributes:{part:"section","data-section":"notice","data-notice":"${$map.item.id}","data-level":"${$map.item.level}"},children:[{tagName:"h2",attributes:{part:"section-title"},textContent:"${$map.item.title}"},{tagName:"p",attributes:{part:"note"},textContent:"${$map.item.message}"},{tagName:"div",attributes:{part:"actions"},children:[{$prototype:"Array",items:{$ref:"$map/item/actions"},key:{$ref:"$map/item/key"},map:{tagName:"jx-button",$props:{variant:{$ref:"$map/item/variant"}},attributes:{part:"notice-action","data-action":"${$map.item.key}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/noticeRun"},value:[{$ref:"$map/item/key"}]}]},children:[{tagName:"span",textContent:"${$map.item.label}"}]}}]}]}},{tagName:"div",attributes:{part:"recent-slot"},style:{display:"contents"},$switch:{$ref:"#/state/hasRecent"},cases:{true:{tagName:"section",attributes:{part:"section"},children:[{tagName:"div",attributes:{part:"section-header"},children:[{tagName:"h2",attributes:{part:"section-title"},textContent:"Recent"},{tagName:"jx-button",$props:{quiet:!0,size:"sm"},attributes:{part:"clear"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/clear"}}]},children:[{tagName:"span",textContent:"Clear all"}]}]},{tagName:"ul",attributes:{part:"list"},children:[{$prototype:"Array",items:{$ref:"#/state/recent"},key:{$ref:"$map/item/root"},map:{tagName:"li",attributes:{part:"row"},children:[{tagName:"button",attributes:{part:"recent",type:"button",title:"${$map.item.root}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/open"},value:[{$ref:"$map/item/root"}]}]},children:[{tagName:"span",attributes:{part:"name"},textContent:"${$map.item.name}"},{tagName:"span",attributes:{part:"path"},textContent:"${$map.item.location}"},{tagName:"span",attributes:{part:"when"},textContent:"${$map.item.when}"}]},{tagName:"jx-action-button",$props:{icon:"x",size:"sm",label:"Remove ${$map.item.name} from Recent",hint:"Remove ${$map.item.name} from Recent"},attributes:{part:"remove"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/remove"},value:[{$ref:"$map/item/root"}]}]}}]}}]}]}}},{tagName:"div",attributes:{part:"catalogue-slot"},style:{display:"contents"},$switch:{$ref:"#/state/hasCatalogue"},cases:{true:{tagName:"section",attributes:{part:"section"},children:[{tagName:"h2",attributes:{part:"section-title"},textContent:"Projects"},{tagName:"ul",attributes:{part:"list"},children:[{$prototype:"Array",items:{$ref:"#/state/catalogue"},key:{$ref:"$map/item/root"},map:{tagName:"li",attributes:{part:"row"},children:[{tagName:"button",attributes:{part:"recent","data-catalogue":"",type:"button",title:"${$map.item.root}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/open"},value:[{$ref:"$map/item/root"}]}]},children:[{tagName:"span",attributes:{part:"name"},textContent:"${$map.item.name}"},{tagName:"span",attributes:{part:"path"},textContent:"${$map.item.detail}"}]}]}}]}]}}}]}]};E("welcome",Wk);var Yo=null;function Kk(e){Yo=e}function Of(e){let t=/^\/(?:home|Users)\/[^/]+(?=\/|$)/.exec(e);return t?`~${e.slice(t[0].length)}`:e}function Yk(e){return Of(e).split("/").filter(Boolean).slice(0,-1)}function qk(e,t){let r=Yk(e);if(r.length===0)return Of(e);let o=r.slice(Math.max(0,r.length-t));if(o.length<r.length)return`…/${o.join("/")}`;return o[0]==="~"||!e.startsWith("/")?o.join("/"):`/${o.join("/")}`}function Uk(e){let t=new Map;for(let o of e){let a=t.get(o.name);if(a)a.push(o);else t.set(o.name,[o])}let r=new Map;for(let o of t.values()){let a=Math.max(...o.map((s)=>Yk(s.root).length),1),i=o.map((s)=>qk(s.root,a));for(let s=1;s<=a;s++){let l=o.map((f)=>qk(f.root,s));if(new Set(l).size===o.length){i=l;break}}if(new Set(i).size!==o.length)i=o.map((s)=>Of(s.root));for(let[s,l]of o.entries())r.set(l.root,i[s])}return r}var Lf=60*rf,Jk=24*Lf;function Kz(e,t=ar()){let r=Math.max(0,t-e);if(r<rf)return"just now";if(r<Lf){let i=Math.floor(r/rf);return`${i} minute${i===1?"":"s"} ago`}if(r<Jk){let i=Math.floor(r/Lf);return`${i} hour${i===1?"":"s"} ago`}let o=Math.floor(r/Jk);if(o===1)return"yesterday";if(o<30)return`${o} days ago`;let a=Math.floor(o/30);return a<12?`${a} month${a===1?"":"s"} ago`:"over a year ago"}var Gk=null,uc=null,bi=null,Mr=null;function Yz(){let e=Nw(),t=YN().filter((i)=>!e.some((s)=>s.root===i.root)),r=Uk(e),o=Uk(t);return{actions:[{icon:"plus",id:"new",title:"New Project…"},...cf(p())?[{icon:"folder-open",id:"open",title:"Open Project…"}]:[],...Pb()?[{icon:"download-simple",id:"clone",title:"Clone Git Repository…"}]:[],...jf()?[{icon:"cube",id:"add",title:"Add Existing Repository…"}]:[]],catalogue:t.map((i)=>({detail:i.description??o.get(i.root)??i.root,name:i.name,root:i.root})),hasCatalogue:t.length>0,hasRecent:e.length>0,installNeeded:oC(),installUrl:iC()?.appInstallUrl??"#",notices:AL().map((i)=>Xz(i)),recent:e.map((i)=>({location:r.get(i.root)??i.root,name:i.name,root:i.root,when:Kz(i.timestamp)}))}}function Xz(e){return{actions:(e.actions??[]).map((t)=>({key:`${e.id}/${t.id}`,label:t.label,variant:t.primary?"accent":"secondary"})),id:e.id,level:e.level??"info",message:e.message,title:e.title}}function Qz(e){for(let t of AL())for(let r of t.actions??[])if(`${t.id}/${r.id}`===e)return r;return null}function Xk(){return Gk??=g({actions:[],catalogue:[],clear:()=>{NN(),mc()},hasCatalogue:!1,hasRecent:!1,installNeeded:!1,installUrl:"#",noticeRun:(e)=>{let t=Qz(e);if(t)ox(t).then(mc)},notices:[],open:(e)=>{Yo?.openRecentProject(e)},recent:[],remove:(e)=>{RS(e),mc()},run:(e)=>{switch(e){case"new":{Yo?.openNewProject();break}case"open":{Yo?.openProject();break}case"clone":{Yo?.cloneRepository();break}case"add":{Yo?.addExistingRepo();break}default:break}}}),Gk}function mc(){Object.assign(Xk(),Yz())}function Qk(e){if(mc(),uc===e&&Mr!==null&&Mr.root.isConnected)return;if(bi&&uc===e&&!Mr)return;Zz(),uc=e;let r=R("welcome",Xk(),e);bi=r,r.then((o)=>{if(bi===r)Mr=o;else o.dispose()})}function Zz(){let e=bi;if(bi=null,Mr)Mr.dispose(),Mr=null;else if(e)e.then((t)=>t.dispose());uc=null}var Zk={$schema:"https://jxsuite.com/schema/v1",$id:"StudioWritingBanner",$description:"The writing-mode banner (specs/studio.md §22.5): one slim line above the canvas while a collection entry is written inside its template's layout, saying what the arrangement is (the text and media are editable, the layout is locked) with the door to the template, which opens it in Design. `content/writing-banner.ts` decides whether there is a template to open and what it is called; this document draws a sentence and, when there is one, the button.",tagName:"div",attributes:{part:"banner",role:"note","data-jx-region":"${state.region}"},style:{$description:"A quiet band, the Content-Entry board's: the canvas is the subject, so the banner is a tinted line rather than a panel, and its action is a quiet button.",display:"flex",alignItems:"center",flexWrap:"wrap",gap:"var(--jx-space-2)",padding:"var(--jx-space-1) var(--jx-space-4)",background:"color-mix(in srgb, var(--accent) 10%, var(--bg-panel))",borderBottom:"1px solid var(--border)",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)",'& [part="glyph"]':{flexShrink:"0",color:"var(--accent)"},'& [part="text"]':{flex:"1",minWidth:"0"},'& [part="action-slot"]':{display:"contents"}},children:[{tagName:"jx-icon",attributes:{part:"glyph"},$props:{name:"lock-simple"}},{tagName:"span",attributes:{part:"text"},textContent:"${state.text}"},{tagName:"div",attributes:{part:"action-slot",role:"none"},$switch:{$ref:"#/state/actionState"},cases:{shown:{tagName:"jx-action-button",attributes:{part:"edit-template"},$props:{size:"sm",quiet:!0},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openTemplate"},value:[]}],description:"Opening the template is activating it, which enters Design (studio.md §22.1)."},children:[{tagName:"span",textContent:"${state.actionLabel}"}]}}}]};E("writing-banner",Zk);function a$(e,t,r){let o=g({...t,...r}),a=null,i=!1,s=R("writing-banner",o,e).then((l)=>{if(i)l.dispose();else a=l;return l});return{dispose(){i=!0,a?.dispose(),a=null},ready:s,update(l){o.region=l.region,o.text=l.text,o.actionLabel=l.actionLabel,o.actionState=l.actionState}}}var s$="Writing mode: text and media are editable, the layout is locked";function l$(e){let t=Gn(e.documentPath);if(!t)return null;let r=Ql(t.name)?.item??"entry",o=sh(t.name,zc(e.documentPath));if(o)return{actionLabel:`Design the ${r} page`,path:o.path};let a=e.doc.document.$layout??e.doc.content.frontmatter.$layout,i=vC(n(a)||a===!1?a:void 0,o??null);if(!i)return null;return{actionLabel:`Edit the ${qb(i)} template in Design`,path:i.replace(/^\.\//,"")}}function d$(e,t){let r=l$(t);return{actionLabel:r?.actionLabel??"",actionState:r?"shown":"hidden",region:Ln(e,"writing-banner"),text:s$}}var Dr=new Map,Mf=null;async function tH(e){let t=Dr.get(e)?.tabId,r=t?m.tabs.get(t):void 0,o=r?l$(r):null;if(!o)return;let{openFileInTab:a}=await (ce("t07yqqej"),import("./chunks/files-t07yqqej.js"));await a(o.path)}function nH(){for(let[e,t]of Dr){let r=t.tabId?m.tabs.get(t.tabId):void 0;if(r)t.handle.update(d$(e,r))}}function Df(e,t){let r=Dr.get(e);if(r?.host===t)return;if(r)r.handle.dispose(),Dr.delete(e);if(!t)return;Mf??=Ap(nH);let o=a$(t,{actionLabel:"",actionState:"hidden",region:Ln(e,"writing-banner"),text:s$},{openTemplate:()=>{tH(e)}});Dr.set(e,{handle:o,host:t,tabId:null})}function S$(e,t){let r=Dr.get(e);if(!r)return;r.tabId=t.id,r.handle.update(d$(e,t))}function yi(e){Df(e,null)}function P$(){for(let e of Dr.keys())yi(e);Mf?.(),Mf=null}var E$={$schema:"https://jxsuite.com/schema/v1",$id:"StudioCanvasStage",$description:'The canvas\'s own chrome: the artboards, the boxes around them, and the empty hosts the islands attach to. `canvas/canvas-render.ts` keeps every decision — which mode this pane is in, which breakpoints the document declares, how wide Edit\'s column is, whether a comparison has a visual half — and `canvas/canvas-utils.ts` keeps the geometry; this document owns the markup and the style, and it draws NOTHING it decides for itself.\n\n**Every island stays an island** (studio-ui-guidelines.md §9.4). Monaco gets `[part="source-editor"]` or `[part="diff-code-editor"]`, the artboard\'s iframe gets `[part="panel-canvas"]`, the writing-mode banner gets `[part="writing-banner"]`, the Compare bar gets `[part="diff-toolbar"]` and the Project Styles bar gets `[part="chrome-host"]` — each drawn empty and announced through `onNodeCreated`, one reconcile step before it is in the page.\n\n**Three of the five frames share one artboard vocabulary**, which is why `framePart` and `innerPart` are bound rather than written: Preview, the pan/zoom surface and Edit\'s column are all "a box holding N artboards", differing only in what the box is and what else stands in it. Writing the artboard three times would be three places for a breakpoint\'s viewport to drift.\n\n**The stage draws no box of its own.** Its root is `display: contents`, so the frame and whatever leads it are the flex items of the pane\'s own stage cell — the axis `canvas-render.ts` sets on that cell still reaches them, and no depth was added between the stage and the artboards for the pan maths to have to account for.',tagName:"div",attributes:{part:"stage"},style:{$description:"`styles/canvas.css`'s `.panzoom-wrap`, `.canvas-panel*`, `.source-*`, `.content-edit-*`, `.edit-width-handle`, `.preview-stage` and `.diff-code-*` rules, keyed on `part`, plus the writing-mode banner's host. One selector reaches FOREIGN DOM and says so where it stands: `.is-resizing` is written by `canvas/edit-width-drag.ts` onto the column this document draws — the same shape `grid-panel.json` uses for Tabulator's theme. The width handles are `jx-split` elements, which paint their own hover, drag and focus states; this sheet says only where they stand and how wide they are.",display:"contents",'& [part="panzoom"]':{$description:"The transformed surface. `applyTransform` writes `transform` on it imperatively, so only the origin is declared here. `--boards-inset` is the Project Styles bar's clearance: that bar floats over the stage, so the boards start below it. It is a MARGIN, not padding: padding sits inside the box the transform scales, so at a 25% fit a 40px clearance drew as 10px and the bar covered the first specimen. A margin is outside the transform and stays 40 screen pixels at every zoom, and `applyGeometricFit` subtracts the same length from the height it fits into.",display:"inline-flex",gap:"24px",alignItems:"flex-start",transformOrigin:"0 0",marginBlock:"auto",marginTop:"var(--boards-inset, auto)"},'& [part="chrome-host"]':{$description:"The Project Styles bar's host generates no box. The bar inside it is absolutely positioned over the stage, but an empty host in flow is a flex item of the stage cell, whose `gap` then pushed the artboards 24px right of where the fit arithmetic put them, so the last board ran off the pane's edge.",display:"contents"},'& [part="panel"]':{flexShrink:"0"},'& [part="panel"][data-full-width]':{minWidth:"0"},'& [part="panel-header"]':{$description:"The breakpoint's name over its board, and a click target: it sets the pane's active breakpoint. `data-active` is written by `updateActivePanelHeaders` rather than bound, because the answer is a fact about the pane's session that changes without the stage being rebuilt — the same reason the pan transform is written rather than bound.",padding:"4px var(--jx-space-2)",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)",background:"var(--bg-panel)",border:"1px solid var(--border)",borderBottom:"none",borderRadius:"var(--radius) var(--radius) 0 0",textAlign:"center",cursor:"pointer",userSelect:"none",fontFamily:"var(--font-mono)"},'& [part="panel-header"][data-active]':{color:"var(--accent)",borderColor:"var(--accent)"},'& [part="panel-viewport"]':{$description:"The white page surface. `color-scheme: light` is pinned whatever the chrome theme is: the author's document renders against paper, and native form controls and scrollbars inside it must match that rather than the editor around it. The background is the `white` KEYWORD and not a token, for the same reason: it was `var(--spectrum-white, #fff)`, which resolved to white inside `<sp-theme>` and to its fallback everywhere else, so a token was never what it meant. A themed token here would put the editor's ground under the author's page in the dark chrome. The width is a variable so the one declaration serves a board with a declared breakpoint and one without.",position:"relative",width:"var(--panel-viewport-w, auto)",background:"white",border:"1px solid var(--border)",colorScheme:"light"},'& [part="panel-header"][data-active] + [part="panel-viewport"]':{borderColor:"var(--accent)"},'& [part="panel-canvas"]':{$description:"The iframe's host. `isolation: isolate` keeps the artboard's own stacking context off the chrome's. `applyEditZoom` writes `width` and `transform` here imperatively for the content zoom, and an inline write beats this declaration by construction.",isolation:"isolate",width:"var(--panel-canvas-w, auto)"},'& [part="panel-canvas"] *':{cursor:"default"},'& [part="source-wrap"]':{$description:"`width`, `flex` and `min-width` are all three load-bearing, and their absence is a bug only a browser could show: the stage is a flex container, so a child with no width and no grow collapses to its CONTENT width — and Monaco's internals are absolutely positioned, so they contribute none.",display:"flex",flexDirection:"column",width:"100%",height:"100%",flex:"1",minWidth:"0"},'& [part="source-editor"]':{flex:"1",minHeight:"0"},'& [part="diff-code-wrap"]':{$description:"The Code half of a comparison: one Monaco diff editor filling the stage, no artboards and no pan/zoom. It follows the CHROME theme rather than the canvas ramp, because a code editor is chrome. The top inset is the floating bar's clearance. Same three load-bearing declarations as `source-wrap`, for the same reason.",display:"flex",flexDirection:"column",width:"100%",height:"100%",flex:"1",minWidth:"0",paddingTop:"40px"},'& [part="diff-code-editor"]':{flex:"1",minWidth:"0",minHeight:"0"},'& [part="diff-toolbar"]':{$description:"Absolutely positioned OVER the stage rather than in flow: the artboards live on a pan/zoom surface whose origin the transform maths depends on, and a flow sibling would move it. The bar itself is `surfaces/diff-toolbar.json`, mounted into this box.",position:"absolute",zIndex:"2",top:"var(--jx-space-2)",left:"50%",transform:"translateX(-50%)"},'& [part="edit-canvas"]':{$description:"The side gutter is LOAD-BEARING, not breathing room: the resize handles hang outside the column's own box — flex siblings with a negative margin, so they take no width from it — and this container clips horizontally, so without it the handles would be unreachable at exactly the width where dragging inward matters most. It must stay at least as wide as `EDIT_CANVAS_GUTTER` in `canvas/edit-width.ts`, which is what the drag's own ceiling subtracts. This box is also the TRACK the two `jx-split`s measure: the first ancestor of a handle that generates a box, which is why the handles are drawn here beside the column rather than inside it — inside, the column would have been the track, and the track cannot be the thing being resized.",width:"100%",height:"100%",overflowY:"auto",overflowX:"hidden",display:"flex",justifyContent:"center",padding:"32px 16px"},'& [part="edit-column"]':{$description:"The page's column. `max-width` is written imperatively after the render and never bound — see the note on the width in `canvas-render.ts`. `position: relative` is for the live readout drawn as its `::after` while a drag is on.",width:"100%",minHeight:"100%",position:"relative"},'& [part="edit-column"][data-hug]':{$description:"A content PAGE fills the viewport, a document-like surface you can click into below the text. A component DEFINITION is a fragment — flooring its column to the viewport and letting the flex parent stretch it leaves dead scrollable space below a short component — so it hugs its iframe and sits at the top.",minHeight:"0",alignSelf:"flex-start"},'& [part="edit-column"] [part="panel"][data-full-width]':{flex:"1",minWidth:"0"},'& [part="edit-column"] [part="panel-viewport"]':{border:"none",background:"transparent"},'& [part="edit-column"].is-resizing::after':{$description:"FOREIGN CLASS: `canvas/edit-width-drag.ts` writes `is-resizing` and `data-edit-width` on the column with the same bare style pass that moves it, so the live readout costs no element and no render.",content:"attr(data-edit-width)",position:"absolute",top:"var(--jx-space-2)",left:"50%",transform:"translateX(-50%)",zIndex:"3",padding:"2px var(--jx-space-2)",borderRadius:"10px",background:"var(--accent)",color:"var(--bg-panel)",fontSize:"var(--jx-text-sm)",fontVariantNumeric:"tabular-nums",pointerEvents:"none"},'& [part="edit-handle"]':{$description:"The two `jx-split`s (ui.md §5.5), one on each side of the column and dragged symmetrically about its centre. They are flex SIBLINGS of the column in the canvas's row, and each pulls itself outside the column with a negative margin on its outer side so its margin box is zero wide: the column keeps the full content width and the handle's 9px strip stands in the gutter, exactly where the absolutely positioned div it replaces stood. Stretched to the row, so the grab target is the canvas's height whatever the column's — which is the same height the old `top: 0; bottom: 0` resolved to, the column being a stretched item itself. Invisible at rest as it has always been: the element's own `--jx-border` bar beside the page would be new chrome. The weight is the substance, and a browser found it: the element's rules are `[data-jx]` (0,1,0) and its hover `[data-jx]:hover` (0,2,0), which is exactly what this document's `[data-jx] [part]` rules weigh — so `background: transparent` here TIED the element's accent on hover and won on source order, and the handle lit to half opacity of nothing. The lit look is restated below one attribute heavier, the same move `styles/shell-frame.json` makes for the docks. Physical `margin-left`/`margin-right` rather than logical properties, and deliberately: the sign the drag applies is physical too, and Studio's own chrome is never mirrored — the artboard's `dir` is a property of the document INSIDE the iframe.",width:"9px",background:"transparent"},'& [part="edit-handle"][data-side="start"]':{marginLeft:"-9px"},'& [part="edit-handle"][data-side="end"]':{marginRight:"-9px"},'& [part="edit-handle"]:hover, & [part="edit-handle"][data-dragging]':{$description:"The element's own hover and drag paint, restated at (0,3,0) because the rest rule above ties its (0,2,0) and would otherwise win — see that rule. `[data-dragging]` is the element's mirror of its own gesture, so the highlight outlives the pointer leaving the 9px strip.",background:"var(--jx-accent)",opacity:"0.5"},'& [part="preview-stage"]':{$description:"Preview is the fidelity view: one frame, sized to the pane, scrolling its own document so sticky positioning, scroll-driven animation and IntersectionObserver reveals behave as they will in production. That means no pan/zoom surface and no content-height growth — so every box between the stage and the iframe needs a definite height for the frame's `height: 100%` to resolve against, and the artboard chrome is dropped: this is the page, not a specimen of it. Centred, because the stage is as wide as the chosen breakpoint rather than the pane, and a 640px preview pinned to the left edge of a 1400px pane reads as a broken layout rather than a phone.",display:"flex",width:"100%",height:"100%",margin:"0 auto",maxWidth:"var(--preview-w, none)"},'& [part="preview-stage"] [part="panel"]':{flex:"1",minWidth:"0",height:"100%"},'& [part="preview-stage"] [part="panel-viewport"]':{flex:"1",height:"100%",border:"none"},'& [part="preview-stage"] [part="panel-canvas"]':{height:"100%"},'& [part="writing-banner"]':{$description:"A band across the pane at 1:1, so its width is the pane's rather than the breakpoint's and the page scrolls under it. It never shrinks: it is one line.",flexShrink:"0"}},children:[{$description:"What stands over the frame: the writing-mode banner above Edit's scrolling column for a collection entry (whose fields are the Inspector's), the Compare bar over a comparison, or the Project Styles bar over the catalogue. Each is an empty host — the surface that fills it is mounted by the module that owns it.",tagName:"div",attributes:{part:"lead-slot"},style:{display:"contents"},$switch:{$ref:"#/state/lead"},cases:{banner:{$description:"The writing-mode banner over a collection entry written on the canvas (studio.md §22.5): an empty host the banner surface is mounted into by `content/writing-banner.ts`. An entry's fields are edited in the Inspector's Entry tab; the banner only says the layout is locked and where to edit it.",tagName:"div",attributes:{part:"writing-banner"}},toolbar:{tagName:"div",attributes:{part:"diff-toolbar"}},chrome:{$description:'`chrome-host`, not `chrome`: the bar that stands here is `surfaces/stylebook-chrome.json`, whose own root is `[part="chrome"]`. A host and its occupant sharing one name makes every selector over the pair ambiguous.',tagName:"div",attributes:{part:"chrome-host"}}}},{$description:"The frame. Three of its five shapes are the same two boxes with different parts — Preview's centred column, the pan/zoom surface and Edit's scrolling column all hold artboards — so they share one case and differ in `framePart` / `innerPart`. Monaco's two shapes are their own cases, because a code editor holds no artboards and an empty `$map` inside its host would leave nodes in a box the editor is about to take over.",tagName:"div",attributes:{part:"frame-slot"},style:{display:"contents"},$switch:{$ref:"#/state/frame"},cases:{boards:{$description:"The frame's box. `part` is BOUND — a Preview column, a pan/zoom surface and an Edit canvas are one shape with three names — and `data-slot` is the static one beside it, because a host is announced as it is BUILT, one step before its attributes are settled: the adapter reads the static mark and translates it through the view it just wrote.",tagName:"div",attributes:{part:"${state.framePart}","data-slot":"frame",style:"${state.frameVars}"},children:[{$description:'The two width handles — `jx-split`s, ui.md §5.5 — drawn only where there is a column to size, and drawn BESIDE it rather than inside it, one slot before the inner box and one after. The placement is the track: a `jx-split` measures the first ancestor of its own that generates a box, and inside the column that would have been the column, whose width is the very thing the gesture changes. Out here the track is the canvas, a box the drag does not move, and the doubling that keeps an edge under the pointer falls out of the share arithmetic in `canvas/edit-width-drag.ts` rather than being a special case. In the Preview and pan/zoom frames both slots are empty `display: contents` wrappers and cost the row nothing. The element brings what the div it replaces could not: `role="separator"`, a tab stop, `aria-valuenow`, the arrows and Home/End, and Enter or a double click to return to the breakpoint\'s declared width. Its share, its bounds and its collapse point are written by `mountEditWidthHandle`, which also runs the snap onto the document\'s breakpoints from the modifiers the element reports on every `input`, with Alt as the way through.',tagName:"div",attributes:{part:"handle-start-slot"},style:{display:"contents"},$switch:{$ref:"#/state/handles"},cases:{shown:{tagName:"jx-split",attributes:{part:"edit-handle","data-side":"start",title:"Drag, or use the arrow keys, to resize the page — hold Alt to skip the breakpoints"},$props:{orientation:"vertical",label:"Resize the page from its left edge"}}}},{tagName:"div",attributes:{part:"${state.innerPart}","data-slot":"inner","data-hug":"${state.hug ? '' : null}"},style:{$description:"`boards` is a pass-through: Preview and the pan/zoom surface hold their artboards directly, and only Edit's column is a box of its own. Declaring the pass-through here rather than adding a wrapper to two of the three frames is what lets one subtree serve all three.",'&[part="boards"]':{display:"contents"}},children:[{$prototype:"Array",items:{$ref:"#/state/panels"},key:{$ref:"$map/item/key"},map:{$description:"One artboard: its breakpoint's name, the white page under it, and the empty box the iframe mounts into. Keyed on the breakpoint, because each board owns a live iframe and the declared set changes with the document's `$media` — position-based reuse would hand one breakpoint's frame to another's width, which is a live document rendered at the wrong viewport rather than a cosmetic diff.",tagName:"div",attributes:{part:"panel","data-media":"${$map.item.mediaAttr}","data-full-width":"${$map.item.fullWidth ? '' : null}",style:"${$map.item.widthVars}"},children:[{tagName:"div",attributes:{part:"header-slot"},style:{display:"contents"},$switch:{$ref:"$map/item/header"},cases:{shown:{$description:"The breakpoint belongs to the tab of the pane that MOUNTED this artboard — the parent-side twin of the iframe's `hit` message, resolved the same way. Writing the FOCUSED pane's tab instead set another document's breakpoint, and the Style panel then edited a compound block the person never opened.",tagName:"div",attributes:{part:"panel-header"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/pickPanel"},value:[{$ref:"$map/item/key"}]}]},textContent:"${$map.item.label}"}}},{tagName:"div",attributes:{part:"panel-viewport"},children:[{tagName:"div",attributes:{part:"panel-canvas"}}]}]}}]},{tagName:"div",attributes:{part:"handle-end-slot"},style:{display:"contents"},$switch:{$ref:"#/state/handles"},cases:{shown:{tagName:"jx-split",attributes:{part:"edit-handle","data-side":"end",title:"Drag, or use the arrow keys, to resize the page — hold Alt to skip the breakpoints"},$props:{orientation:"vertical",label:"Resize the page from its right edge"}}}}]},source:{tagName:"div",attributes:{part:"source-wrap"},children:[{tagName:"div",attributes:{part:"source-editor"}}]},code:{tagName:"div",attributes:{part:"diff-code-wrap"},children:[{tagName:"div",attributes:{part:"diff-code-editor"}}]}}}]};E("canvas-stage",E$);function Ff(e,t){let r=n(e)?void 0:e.attributes?.[t];return n(r)?r:""}function oH(e){let t=e?.$map,r=v(t)?t.item:void 0,o=v(r)?r.key:"";return n(o)?o:""}var aH=new Set(["panel","panel-viewport","panel-canvas"]);function iH(e,t,r,o){let a=e.get(t);if(!a)a=new Map,e.set(t,a);a.set(r,o)}function R$(e,t){e.frame=t.frame,e.framePart=t.framePart,e.innerPart=t.innerPart,e.frameVars=t.frameVars,e.hug=t.hug,e.lead=t.lead,e.handles=t.handles,e.panels=t.panels}function O$(e,t,r){e.replaceChildren();let o=new Map,a=g({frame:"boards",framePart:"panzoom",frameVars:"",handles:"hidden",hug:!1,innerPart:"boards",lead:"none",panels:[],pickPanel:r.pickPanel});R$(a,t);let i=null,s=!1,l=R("canvas-stage",a,e,{onNodeCreated:(f,c,d,b)=>{let y=Ff(d,"part");if(aH.has(y)&&f instanceof HTMLElement)iH(o,oH(b),y,f);else if(y&&f instanceof HTMLElement){let x=Ff(d,"data-slot"),S=x==="frame"?a.framePart:x==="inner"?a.innerPart:y;r.host(S,f,Ff(d,"data-side"))}}}).then((f)=>{if(s){f.dispose(),o.clear();return}i=f});return{dispose(){s=!0,i?.dispose(),i=null,o.clear()},panelNode:(f,c)=>o.get(f)?.get(c)??null,ready:l,update(f){let c=new Set(f.panels.map((d)=>d.key));for(let d of o.keys())if(!c.has(d))o.delete(d);return R$(a,f),l.then(()=>{})}}}var sH={x:160,y:120},lH=0.5,M$=[{axis:"x",dock:"left",grow:1,selector:"#resize-left"},{axis:"x",dock:"right",grow:-1,selector:"#resize-right"},{axis:"y",dock:"bottom",grow:-1,selector:"#resize-bottom"}];function cH(e,t,r){let o=(i)=>Math.min(e.max(),Math.max(e.min(),i)),a=o(t);if(!e.snap)return a;return o(e.snap(a,r))}function vi(e,t,r){let o=e.scale(),i=((e.lead?.(r)??0)+t/Math.abs(o))/r;return o>0?i:1-i}function dH(e,t,r){let o=e.scale(),a=e.lead?.(r)??0;return((o>0?t:1-t)*r-a)*Math.abs(o)}function Hf(e,t){let r=()=>{let i=m0(e,t.axis==="x");if(i<=0)return;let s=vi(t,t.min(),i),l=vi(t,t.max(),i);e.min=Math.min(s,l),e.max=Math.max(s,l),e.collapse=vi(t,t.reset(),i),e.value=vi(t,t.read(),i)},o=(i)=>{let s=m0(e,t.axis==="x");if(s<=0)return;let l=dH(t,e.value,s),f=cH(t,l,VI(i));t.write(f),e.value=vi(t,f,s)},a=()=>{t.settle()};return e.addEventListener("input",o),e.addEventListener("change",a),e.addEventListener("pointerdown",r,!0),e.addEventListener("keydown",r,!0),globalThis.addEventListener("resize",r),r(),_f.set(e,r),()=>{e.removeEventListener("input",o),e.removeEventListener("change",a),e.removeEventListener("pointerdown",r,!0),e.removeEventListener("keydown",r,!0),globalThis.removeEventListener("resize",r),_f.delete(e)}}var _f=new Map;function pH(){for(let e of _f.values())e()}function uH(e){return(e==="x"?window.innerWidth:window.innerHeight)*lH}function mH(e,t,r){return{axis:t,lead:()=>fH[e],max:()=>uH(t),min:()=>sH[t],read:()=>u.docks[e].size,reset:()=>gO[e],scale:()=>r,settle:()=>Bd(),write:(o)=>_O(e,Math.round(o))}}var fH={bottom:24,left:56,right:0};function hH(){for(let{axis:e,dock:t,grow:r,selector:o}of M$){let a=document.querySelector(o);if(a)_$.push(Hf(a,mH(t,e,r)))}zf=te(()=>{for(let{dock:e}of M$)u.docks[e].size;pH()})}var _$=[],zf=null;function gH(){for(let e of _$.splice(0))e();zf?.(),zf=null}nv({mount:hH,unmount:gH});function bH(e,t,r){let o=bt(e.paneId);if(!o)return;if(t.style.maxWidth=`${Math.round(r)}px`,o.session.ui.editZoom!==1)lh(e);let a=Me(t).width||r;EC(e.paneId,o,a),t.dataset.editWidth=`${Math.round(a)}px`,t.classList.add("is-resizing")}function yH(e,t,r){let o=()=>bt(e.paneId),a=()=>(t.parentElement?.clientWidth??0)/2;return{axis:"x",lead:(i)=>r===1?a():i-a(),max:()=>{let i=t.parentElement?.clientWidth??0;return i>0?Math.max(Pm,i-2*XA):Number.POSITIVE_INFINITY},min:()=>Pm,read:()=>Me(t).width||(o()?CC(o()):Pm),reset:()=>{let i=o();return i?CC(i):Pm},scale:()=>2*r,settle:()=>{t.classList.remove("is-resizing"),lh(e)},snap:(i,s)=>{let l=o();if(s.altKey||!l)return i;return YA(i,eO(l),ZA)},write:(i)=>{bH(e,t,i)}}}var fc=new Map;function vH(){for(let[e,t]of fc)if(!e.isConnected)t(),fc.delete(e)}function Bf(e,t,r,o){if(vH(),!t||!r||fc.has(t))return;fc.set(t,Hf(t,yH(e,r,o)))}var hc=null,z$=null,Vf=!1;function q$(e){hc=e,z$=me(),z$.run(()=>{te(()=>{let t=h.value;if(!t)return;t.session.selection.map((r)=>r.join("/")).join("|"),t.session.hover,t.doc.mode,t.session.ui.activeMedia,wi()})})}function wi(){if(!hc)return;if(!Vf)Vf=!0,queueMicrotask(wH)}function wH(){if(Vf=!1,!hc)return;if(!h.value)return;px(),hc.renderBlockActionBar()}var Q$=null;function eS(e){Q$=e}function xH(e){let t=Wi(e.doc.sourceFormat);return t?Uw(t.mediaType)?.split("/").pop()??"plaintext":"json"}async function tS(e){if(Wi(e.doc.sourceFormat))return Ju(e);return Co(e.doc.document,e.doc.layout??null)}var Wf=new Map;function Br(e=m.activePaneId){if(Wf.has(e))return;Wf.set(e,requestAnimationFrame(()=>{Wf.delete(e);try{$t(e)}catch(t){console.error("renderCanvas error:",t)}}))}function nS(e){Qb(e),e.textContent="",delete e._$litPart$}var gc=new WeakMap,Uf=new WeakMap,J$=new WeakMap;function kH(e){let t=gc.get(e);if(!t)t=new Map,gc.set(e,t);return t}function _r(e,t){return gc.get(e)?.get(t)??null}function $H(e){let t=J$.get(e);if(t)return t;return t={host:(r,o,a)=>{if(kH(e).set(a?`${r}:${a}`:r,o),r==="panzoom")e.panzoomWrap=o;else if(r==="writing-banner")Df(e.paneId,o);else if(r==="diff-toolbar")zl(e.paneId,o)},pickPanel:(r)=>nO(Uf.get(e)??[],r)},J$.set(e,t),t}function On(e,t,r){Uf.set(e,r);let o=e.stage,a=o??O$(e.wrap,t,$H(e));return e.stage=a,(o?a.update(t):a.ready).then(()=>{if(e.stage!==a)return null;return tO(r,a),a})}function G$(e){return{frame:e,framePart:"panzoom",frameVars:"",handles:"hidden",hug:!1,innerPart:"boards",lead:e==="code"?"toolbar":"none",panels:[]}}function rS(e){if(!e.stage)return;e.stage.dispose(),e.stage=null,gc.delete(e),Uf.delete(e),zl(e.paneId,null)}function bc(e){e.sourceCollabCleanup?.(),e.sourceCollabCleanup=null}async function SH(e,t,r){let{bindMonacoToYText:o}=await (ce("a51py33c"),import("./chunks/monaco-binding-a51py33c.js")),a=o({awareness:r.awareness,editors:[t],model:e,origin:r.localOrigin,text:r.text}),i=Mx(r.awareness,document);return()=>{i(),a(),r.leave()}}function xi(e){let t=e.monacoEditor;if(!t)return;Tv(t,"source"),t.getModel()?.dispose(),t.dispose(),e.monacoEditor=null}function ki(e){let t=e.monacoDiffEditor;if(!t)return;let r=t.getModel();t.setModel(null),r?.original.dispose(),r?.modified.dispose(),t.dispose(),e.monacoDiffEditor=null}function K$(e,t){return e?.map((r)=>({kind:r.kind==="modified"?t:r.kind,path:r.path}))??null}async function CH(e,t,r){let{paneId:o}=e,a=r.filePath;if(e.monacoDiffEditor&&e.monacoDiffEditor._diffKey!==a)ki(e);let i=await rg();if(!Rv(t,e.monacoDiffEditor,()=>Vo(o)==="git-diff"&&Xa(o,Mb(a))))return;let s=v2(o,a||"document.json"),l=y2(a||"document.json"),f=i.editor.createModel(r.originalContent||"",l,i.Uri.parse(s.head)),c=i.editor.createModel(r.currentContent||"",l,i.Uri.parse(s.work)),d=i.editor.createDiffEditor(t,{automaticLayout:!0,fontFamily:"'JetBrains Mono', 'SF Mono', 'Fira Code', 'Consolas', monospace",fontSize:12,minimap:{enabled:!1},originalEditable:!1,readOnly:!0,renderSideBySide:!0,scrollBeyondLastLine:!1,theme:zm()});d.setModel({modified:c,original:f}),d._diffKey=a,e.monacoDiffEditor=d}function Y$(e){let t=e.wrap,{paneId:r}=e;if(ai(r),Tw(r),yi(r),Zw(r),Xw(r),ci(r),ob(r),bc(e),xi(e),ki(e),e.centerObserver)e.centerObserver.disconnect(),e.centerObserver=null;Za(e);for(let o of e.panels)o.renderScope?.stop(),o.renderScope=null;e.panels.length=0,nS(t),e.panzoomWrap=null,t.style.padding="",t.style.alignItems="",t.style.flexDirection="",t.style.gap="",t.style.display="",t.style.overflow="",N_(),oE(),sm(),mp(),e.prevCanvasMode=null}async function TH(e,t,r,o,a){let{paneId:i}=t,s=await rg();if(!Rv(r,t.monacoEditor,()=>bt(i)===e&&Vo(i)==="source"))return;let l=s.Uri.parse(iR(o)),f=s.editor.createModel("",a,l),c=nM(e);if(c)c.enter().then(async()=>{let y=t.monacoEditor;if(!y||y.getModel()!==f){c.leave();return}let x=await SH(f,y,c);if(t.monacoEditor!==y||y.getModel()!==f){x();return}if(t.sourceCollabCleanup=x,y._writes?.markShared(),c.readOnly)y.updateOptions({readOnly:!0})}).catch(()=>{c.leave();let y=t.monacoEditor;if(y&&y.getModel()===f)y.updateOptions({readOnly:!0})});else tS(e).then((y)=>{let x=t.monacoEditor;if(x&&x.getModel()===f&&!Qp(x,""))x._ignoreNextChange=!0,f.setValue(y),x._writes?.markSettled()}).catch(()=>{});let d=s.editor.create(r,{automaticLayout:!0,fontFamily:"'JetBrains Mono', 'SF Mono', 'Fira Code', 'Consolas', monospace",fontSize:12,lineNumbers:"on",minimap:{enabled:!1},model:f,scrollBeyondLastLine:!1,tabSize:2,theme:zm(),wordWrap:"on"});t.monacoEditor=d,d._editingTab=e;let b=Ev(d);if(c)return;d.onDidChangeModelContent(()=>{if(t.monacoEditor!==d)return;if(d._ignoreNextChange){d._ignoreNextChange=!1;return}b.markTyped(),qm(e.id),b.arm(Xp,600,async()=>{if(!bl(e)||!tu(d))return;if(Wi(e.doc.sourceFormat)&&e.documentPath)try{let{document:y,frontmatter:x}=await Fr(e.documentPath,d.getValue());if(!bl(e))return;e.doc.document=y,e.doc.content.frontmatter=x,e.doc.source=d.getValue(),e.doc.dirty=!0,b.markSettled()}catch{}else if(a==="json")try{let y=Es(d.getValue()),x=y.document;e.doc.bareRepeaters=Gm(x),e.doc.document=x,e.doc.layout=y.layout,e.doc.dirty=!0,b.markSettled()}catch{}})})}function $t(e=m.activePaneId){let t=bo(e);wC(GL,()=>{PH(t)})}function oS(e,t){let r=$$(e,t);for(let o of m.panes)$t(o.id);return r}function qf(e,t,r=null){e.wrap.style.display="block";let o=ae(),a=o?.get("pane.pin");io(Pu(e.wrap,{message:t,...r&&{detail:`${$d(r)} is still open here.`},...r&&a&&{actions:[{label:a.title,run:()=>{o?.run(a.id)}}]}}),e.wrap)}function PH(e){let t=Ch(e);if(!t)return;let r=e.panels,o=bt(e.paneId);if(!o){Y$(e);let F=jr(e.paneId);if(F){qf(e,F.reason||"Looking for something to show here…");return}if(!C?.isSiteProject)Qk(t);return}let a=jr(e.paneId);if(a?.status==="unavailable"&&a.reason){Y$(e),qf(e,a.reason,a.kind==="companion"?o:null);return}let i=Q$,s={document:o.doc.document,mode:o.doc.mode,ui:o.session.ui},l=Vo(e.paneId),f=l==="edit"&&jr(e.paneId)?.kind!=="lens"&&Boolean(C?.isSiteProject)&&rh(o.documentPath);if(!f)yi(e.paneId);e.renderGeneration=DM(),Uo.fullRenders+=1;let c=l!==e.prevCanvasMode;if(c&&t._$litPart$)nS(t);if(c&&l!=="git-diff")ki(e);let d=l==="source"&&e.monacoEditor?af():null;if(d&&e.monacoEditor){let F=d.Uri.parse(iR(o.documentPath||"document.json"));if(e.monacoEditor.getModel()?.uri.toString()!==F.toString())bc(e),xi(e)}if(l==="source"&&e.monacoEditor&&!c){let F=e.monacoEditor;tS(o).then((B)=>{if(e.monacoEditor!==F)return;if(!Qp(F)&&F.getValue()!==B)F._ignoreNextChange=!0,F.setValue(B),F._writes?.markSettled()}).catch(()=>{});return}if(l==="grid"&&$f(e.paneId,o)&&!c)return;if(l==="entry"&&hT(e.paneId,o)&&!c)return;if(l==="media"&&xL(e.paneId,o)&&!c)return;if(l===ls&&LL(e.paneId,o)&&!c)return;if(l===am&&Ef(e.paneId,o)&&!c)return;if(z_(l)&&W_(e.paneId,o)&&!c)return;if(l==="stylebook"&&!c){let F=u.stylebook.filter,B=u.stylebook.customizedOnly;if(!(F!==e.prevStylebookFilter||B!==e.prevStylebookCustomizedOnly||dl(e.paneId)!==e.prevStylebookMedia)){let U=Yy(wr(o.doc.document.style));if(vx(U)>0)return}}e.prevCanvasMode=l,yx();for(let F of r)F.renderScope?.stop(),F.renderScope=null;if(r.length=0,c){if(e.centerObserver)e.centerObserver.disconnect(),e.centerObserver=null;Za(e),ai(e.paneId),Tw(e.paneId),Zw(e.paneId),Xw(e.paneId),ci(e.paneId),ob(e.paneId),bc(e),xi(e),Qb(t),rS(e),io(ft,t),e.panzoomWrap=null,t.style.padding="",t.style.alignItems="",t.style.flexDirection="",t.style.gap="",t.style.display="",t.style.overflow="",N_(),oE(),sm(),mp()}if(l==="stylebook"){e.prevStylebookFilter=u.stylebook.filter,e.prevStylebookCustomizedOnly=u.stylebook.customizedOnly,e.prevStylebookMedia=dl(e.paneId),fD(e,{applyTransform:Gs,canvasPanelEntry:Pp,drawStage:On,observeCenterUntilStable:hx,stageHost:_r,updateActivePanelHeaders:px}).then(()=>{if(c)$C(e)});return}if(l==="preview"){if(c)t.style.padding="0",t.style.display="block",t.style.overflow="hidden";let{baseWidth:F,sizeBreakpoints:B}=Hr(to(s.document.$media)),L=dl(e.paneId),U=B.find((J)=>J.name===L)?.width??F,W=Pp(null,null,!0);r.push(W.panel);let{featureToggles:z}=s.ui;On(e,{frame:"boards",framePart:"preview-stage",frameVars:`--preview-w:${U}px`,handles:"hidden",hug:!1,innerPart:"boards",lead:"none",panels:[W.item]},[W]).then((J)=>{if(!J)return;zr(e,W.panel,z)});return}if(l==="entry"){t.style.padding="0",t.style.display="block",yN(e,o);return}if(l==="media"){t.style.padding="0",t.style.display="block",XN(e,o);return}if(l===ls){t.style.padding="0",t.style.display="block",iA(e,o);return}if(l===am){Ck(e,o);return}if(z_(l)){pE(e,o);return}if(l==="grid"){t.style.padding="0",t.style.display="block",ak(e,o);return}if(l==="source"){t.style.padding="0",t.style.display="block";let F=o.documentPath||"document.json",B=xH(o);On(e,G$("source"),[]).then((L)=>{if(!L)return;let U=_r(e,"source-editor");if(U)TH(o,e,U,F,B)});return}if(l==="git-diff"){let F=jr(e.paneId),B=F?.kind==="lens"&&F.preset==="diff",L=B?F.diff:i.gitDiffState;if(!L){if(B){qf(e,F.reason||"Loading this file's changes…");return}i.setCanvasMode(o,"design"),$t(e.paneId);return}if(c)t.style.padding="0",t.style.overflow="hidden";let U=Mb(L.filePath);if(Xa(e.paneId,U)){if(!U)ff(e.paneId,null);xi(e),On(e,G$("code"),[]).then(($e)=>{if(!$e)return;Jl(e.paneId);let A=_r(e,"diff-code-editor");if(A)CH(e,A,L)});return}ki(e);let W=800,z=Pp("git-diff-original","Original",!1,W),J=Pp("git-diff-current","Current",!1,W),K=On(e,{frame:"boards",framePart:"panzoom",frameVars:"",handles:"hidden",hug:!1,innerPart:"boards",lead:"toolbar",panels:[z.item,J.item]},[z,J]);r.push(z.panel,J.panel);let ie=($e)=>{let A=L.filePath;if(fn(A))return Fr(A,$e).then((ve)=>ve.document);return Promise.resolve().then(()=>{try{return JSON.parse($e)}catch{return{children:[{tagName:"p",textContent:"Failed to parse"}],tagName:"div"}}})},{featureToggles:se}=s.ui,be=e.renderGeneration;Promise.all([K,ie(L.originalContent||""),ie(L.currentContent||"")]).then(([$e,A,ve])=>{let Ie=null;try{Ie=Cx(A,ve)}catch(I){console.warn("buildChangeMap:",I)}if(!$e)return;ff(e.paneId,Ie),Jl(e.paneId),zr(e,z.panel,se,A,K$(Ie?.original,"modified-before"),be),zr(e,J.panel,se,ve,K$(Ie?.current,"modified-after"),be)}),K.then(($e)=>{if(!$e)return;if(Gs(e),c)hx(e)});return}if(l==="edit"){if(c)t.style.padding="0",t.style.overflow="hidden",kC(e.paneId);let F=QA(e,o),B=Pp(null,null,!0),L=s.document.tagName,U=n(L)&&L.includes("-"),{featureToggles:W}=s.ui,z=f;t.style.flexDirection=z?"column":"",t.style.alignItems=z?"stretch":"",t.style.gap=z?"0px":"",On(e,{frame:"boards",framePart:"edit-canvas",frameVars:"",handles:"shown",hug:U,innerPart:"edit-column",lead:f?"banner":"none",panels:[B.item]},[B]).then((J)=>{if(!J)return;if(f)S$(e.paneId,o);let K=_r(e,"edit-column"),ie=_r(e,"edit-canvas");if(B.panel.scrollContainer=ie,Ox(e,ie),K)K.style.maxWidth=`${Math.round(F)}px`,Bf(e,_r(e,"edit-handle:start")??void 0,K,-1),Bf(e,_r(e,"edit-handle:end")??void 0,K,1);zr(e,B.panel,W),lh(e)}),r.push(B.panel);return}if(c)t.style.padding="0",t.style.overflow="hidden";let{sizeBreakpoints:b,featureQueries:y,baseWidth:x}=Hr(to(s.document.$media)),S=b.length>0,{featureToggles:P}=s.ui;if(!S){let B=to(s.document.$media)["--"],L=B?`${ji("--")} (${x}px)`:null,U=Pp(B?"base":null,L,!B,B?x:void 0);On(e,{frame:"boards",framePart:"panzoom",frameVars:"",handles:"hidden",hug:!1,innerPart:"boards",lead:"none",panels:[U.item]},[U]).then((W)=>{if(!W)return;if(zr(e,U.panel,P),Gs(e),c)$C(e),hx(e)}),r.push(U.panel);return}let j=[{displayName:ji("--"),name:"base",width:x}];for(let F of b)j.push({displayName:ji(F.name),name:F.name,width:F.width});let k=jr(e.paneId),T=k?.kind==="lens"&&k.preset==="breakpoint"?k.media??"base":null,N=T===null?j:j.filter((F)=>F.name===T),D=(N.length>0?N:j).map((F)=>Pp(F.name,`${F.displayName} (${F.width}px)`,!1,F.width)),M=On(e,{frame:"boards",framePart:"panzoom",frameVars:"",handles:"hidden",hug:!1,innerPart:"boards",lead:"none",panels:D.map((F)=>F.item)},D),V=e.renderGeneration;for(let{panel:F}of D)r.push(F);M.then((F)=>{if(!F)return;for(let B=0;B<D.length;B++){let{panel:L}=D[B];if(B===0)zr(e,L,P,null,null,V);else setTimeout(()=>zr(e,L,P,null,null,V),0)}if(px(e),Gs(e),c)$C(e),hx(e)})}function zr(e,t,r,o=null,a=null,i=null){let s=i??e.renderGeneration,l=bt(e.paneId),f=o||l?.doc.document,{canvas:c}=t;Uo.panelRenders+=1,t.ready=!1,u$(c,Vo(e.paneId)==="preview"),xC(BA,()=>k$(s,f,c,t._width,o?null:l?.id??null,l,Vo(e.paneId),a)).then(()=>{if(s===e.renderGeneration)t.ready=!o,HM(l,{error:null,scope:null,status:"ready"})}).catch(EH)}function EH(e){w.error("The canvas could not be mounted.",{detail:X(e),key:"canvas.mount",source:"Canvas"})}cx($t);OM((e)=>{ki(e),qw(e.paneId),zl(e.paneId,null),ai(e.paneId),Tw(e.paneId),Zw(e.paneId),Xw(e.paneId),ci(e.paneId),ob(e.paneId),yi(e.paneId),bc(e),xi(e),e.centerObserver?.disconnect(),e.centerObserver=null,Za(e),e.panzoomWrap=null,rS(e)});function iS(){wi()}function NH(e){return/^[A-Za-z_$][\w$]*/.exec(e)?.[0]??""}function jH(e){let t=h.value;if(!t)throw RangeError('command "insert.data" needs an open document; no tab is active');let r=NH(e),o=t.doc.document.state??{};if(r==="state"){if(!((e.split(".")[1]??"")in o)){let i=Object.keys(o);throw RangeError(`command "insert.data" argument "token": "${e}" names no state entry — this `+`document defines: ${i.length>0?i.join(", "):"nothing"}`)}return}if(r==="item"||r==="index"){let a=nc().snapshot?.path??Oe(t.session.selection);if(!I_(t.doc.document,a))throw RangeError(`command "insert.data" argument "token": "${e}" is a repeater-scope token, and the caret is not inside a repeater template`);return}throw RangeError(`command "insert.data" argument "token": "${e}" is not an insertable token — a token `+'reads "state.<name>", "item", "item.<field>" or "index"')}function RH(){return[{args:Se({path:Xx("The document path to select — an array of keys and indexes. [] is the document "+"root; null clears the selection.",!0)}),category:"Selection",id:"selection.set",level:"document",menus:["palette"],group:"2_navigate",requires:"an open document",when:(e)=>e.document.open,aiTool:{description:"Select the element at a document path so the Inspector, the Outline and the canvas overlay all address it. Pass null to clear the selection.",name:"select_node",report:({after:e})=>e.selection.count===0?"Cleared the selection.":`Selected ${e.selection.kind||"the element"} at [${(e.selection.paths.at(-1)??[]).join(", ")}]; the Inspector and the Outline now address it.`},run:(e,t)=>{let r=oM("selection.set",t,"path"),o=h.value;if(!o)throw RangeError('command "selection.set" needs an open document; no tab is active');if(r!==null&&r.length>0&&!oe(o.doc.document,r))throw RangeError(`command "selection.set" argument "path": [${r.join(", ")}] addresses no node in ${o.documentPath??"the open document"}`);o.session.selection=r===null?[]:[r]},title:"Select Element"},{args:Se({paths:rM("The document paths to select, in order — an array of paths. The LAST one becomes the "+"primary (what the Inspector edits); the first is the anchor a shift-range extends from. [] selects nothing.")}),category:"Selection",id:"selection.setPaths",level:"document",menus:["palette"],group:"2_navigate",requires:"an open document",when:(e)=>e.document.open,run:(e,t)=>{let r=mI("selection.setPaths",t,"paths"),o=h.value;if(!o)throw RangeError('command "selection.setPaths" needs an open document; no tab is active');for(let a of r)if(a.length>0&&!oe(o.doc.document,a))throw RangeError(`command "selection.setPaths" argument "paths": [${a.join(", ")}] addresses no node in ${o.documentPath??"the open document"}`);o.session.selection=XO(r)},title:"Select Elements"},{args:Se({token:Fe('The token to insert, without the ${…} wrapper — "state.<name>", "item", '+'"item.<field>" or "index".')}),category:"Insert",id:"insert.data",level:"selection",keyScope:"caret",menus:["palette"],group:"5_data",undo:"document",requires:"a live text caret in the canvas",when:(e)=>e.caret.inCanvas,run:(e,t)=>{let r=St("insert.data",t,"token");jH(r),dh({command:"insertData",token:r})},title:"Insert Data"},{category:"Insert",id:"insert.openSlashMenu",level:"selection",keyScope:"caret",menus:["palette"],group:"5_data",undo:"document",requires:"a live text caret in the canvas",when:(e)=>e.caret.inCanvas,run:()=>{N$()},title:"Insert Block…"}]}function cS(e){e.registerAll(RH())}var pS=null,Jf=new WeakMap;function uS(e){pS=e,aM({apply:OH,classify:LH,escalate:AH,markConsumed:(t,r)=>{Jf.set(le(t),new Set(mS(r).map((o)=>o.paneId)))}})}function mS(e){return uC(e).filter((t)=>{let r=Vo(t.paneId);return r==="design"||r==="edit"})}function fS(e,t){let r=le(e),o=Jf.get(r);if(!o?.has(t))return!1;if(o.delete(t),o.size===0)Jf.delete(r);return Uo.skippedFullRenders+=1,!0}function AH(e,t=null){lx(e);for(let r of uC(t))pS?.scheduleCanvasRender(r.paneId)}function $i(e){return e.includes("cases")}function yc(e,t,r=!0){if($i(t))return"structure-on-cases-path";if(t.includes("map"))return"structure-on-map-path";let o=e.doc.document,a=oe(o,t);if(!a)return"node-not-found";if(t.length>0&&n(a.tagName)&&a.tagName.includes("-"))return"structure-in-custom-element";if(a.innerHTML)return"structure-with-innerhtml";if(r&&!Array.isArray(a.children))return"structure-children-not-array";return null}function dS(e,t){if(t.length===0)return"replace-root";if($i(t))return"replace-on-cases-path";let r=Vt(t);if(!r)return"replace-no-parent";if(r.includes("map"))return"structure-on-map-path";let o=oe(e.doc.document,r);if(!o)return"node-not-found";if(o.innerHTML)return"structure-with-innerhtml";return oe(e.doc.document,t)===void 0?"node-not-found":null}function IH(e,t){switch(t.op){case"set-style":{if($i(t.path))return"style-on-cases-path";return oe(e.doc.document,t.path)?null:"node-not-found"}case"set-text":{if($i(t.path))return"text-on-cases-path";let r=oe(e.doc.document,t.path);if(!r)return"node-not-found";if(n(r.tagName)&&r.tagName.includes("-"))return"text-on-custom-element";if(r.innerHTML)return"text-with-innerhtml";let o=r.children;if(Array.isArray(o)?o.length>0:o!=null)return"text-with-children";return null}case"set-prop":return t.isEvent?null:dS(e,t.path);case"set-attr":case"replace":return dS(e,t.path);case"insert":return yc(e,t.parentPath);case"remove":{let r=Vt(t.path);return r===null?"remove-no-parent":yc(e,r)}case"move":{if($i(t.fromPath))return"structure-on-cases-path";let r=Vt(t.fromPath);if(r===null)return"move-no-parent";return yc(e,r)??yc(e,t.toParentPath)}default:return`${t.op}-unsupported`}}function LH(e,t){let r=(s)=>(lx(s),{patchable:!1,reason:s}),o=uC(e);if(o.length===0)return r("inactive-tab");let a=mS(e);if(a.length===0){let s=Vo(o[0].paneId);return r(`mode-${s||"unknown"}`)}for(let s of a){let{panels:l}=s;if(l.length===0)return r("no-panels");if(!l.every((f)=>f.ready))return r("panels-not-ready")}let i=new Set;for(let s of t)if(s.op==="set-prop"&&s.key==="children"||s.op==="replace")i.add(JSON.stringify(s.path));for(let s of t){if(s.op==="set-text"&&i.has(JSON.stringify(s.path)))continue;let l=IH(e,s);if(l)return r(l)}return{patchable:!0,reason:""}}function OH(e,t,r){wC(zA,()=>{let o=(r?.docOps??[]).map((i)=>i.forward);if(AC(o,e.id)===0)throw Error("no-ready-iframe-host");Uo.patchedOps+=o.length})}function hS(e,t){Wy(e,"",{onSelect:(r)=>{let o=r.component===!0?_C(r.tag):null,a=o??ah(r.tag),{insertParentPath:i,index:s}=t,l=[...i,"children",s],f=h.value;Z(f,(c)=>{if(or(c,i,s,a),o)Op(c,o.tagName);c.session.selection=[l]})},showFilter:!0})}var gS={dismiss:()=>mp(),nav:(e)=>nE(e),show:({rect:e,filter:t,showFilter:r,onSelect:o,onDismiss:a})=>QR(e,t,{onDismiss:a,onSelect:o,showFilter:r===!0})};function bS(){return{dismiss:()=>sm(),show:({path:e,clientX:t,clientY:r})=>{if(!e)return;let o=JA(h.value?.doc.document,e),a=new MouseEvent("contextmenu",{clientX:t,clientY:r});A_(a,o)}}}var wS={$schema:"https://jxsuite.com/schema/v1",$id:"StudioJumpBar",$description:"The jump bar: the focused pane's address as a breadcrumb trail, the document first and the selected element last, every step a command the adapter has already resolved against the registry. It is the status bar's DOCUMENT field, mounted into the slot `surfaces/statusbar.json` leaves for it. A step is a button when its command can run and a readout when it cannot — an address with a hole in it is a lie about containment, so a step never disappears. A step with more than one place to go carries the chevron that opens its siblings, upward, because the bar is the window's floor; one alternative is not a choice and draws no control. Nothing here decides what the bar says, which step is where you are, or what a chevron opens.",tagName:"nav",attributes:{part:"bar","aria-label":"Location","data-jx-region":"${state.region}",hidden:"${state.empty ? '' : null}"},style:{$description:"A field of the status bar, so it takes the bar's own row, font and colour rather than drawing a band of its own. It scrolls rather than wraps, because a deep selection must not grow the status bar a second line.",display:"flex",alignItems:"center",gap:"1px",flex:"1",height:"100%",padding:"0 var(--jx-space-2)",minWidth:"0",overflowX:"auto",scrollbarWidth:"none",whiteSpace:"nowrap",boxSizing:"border-box","&[hidden]":{display:"none"},"&::-webkit-scrollbar":{display:"none"},'& [part="step"]':{display:"flex",alignItems:"center",flexShrink:"0"},'& [part="separator"]':{flexShrink:"0",padding:"0 1px",color:"var(--jx-fg-dim)",opacity:"0.6"},'& [part="crumb"]':{maxWidth:"32ch",overflow:"hidden",margin:"0",padding:"0 var(--jx-space-2)",border:"none",borderRadius:"var(--jx-radius-xs)",background:"transparent",color:"inherit",font:"inherit",lineHeight:"1",whiteSpace:"nowrap",textOverflow:"ellipsis"},'& button[part="crumb"]':{cursor:"pointer",":hover:not(:disabled)":{color:"var(--jx-fg)",background:"var(--jx-hover-bg)"},":disabled":{cursor:"default",opacity:"0.6"},":focus-visible":{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"}},'& [part="crumb"][aria-current]':{$description:"Where you ARE is stated by weight, not by taking the control away: the leaf still selects, which is how a stray click in the canvas is undone without leaving the bar.",color:"var(--jx-fg)",fontWeight:"600"},'& span[part="crumb"]':{$description:"A step with no runnable command is a readout, not a dead button. No hover, no pointer, no promise.",cursor:"default"},'& [part="alternatives"]':{padding:"0 1px",border:"none",borderRadius:"var(--jx-radius-xs)",background:"transparent",color:"inherit",font:"inherit",lineHeight:"1",cursor:"pointer",":hover":{color:"var(--jx-fg)",background:"var(--jx-hover-bg)"},":focus-visible":{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"}}},children:[{$prototype:"Array",items:{$ref:"#/state/segments"},key:{$ref:"$map/item/key"},map:{tagName:"span",attributes:{part:"step","data-jump-kind":"${$map.item.kind}"},children:[{tagName:"span",attributes:{part:"separator-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/leading"},cases:{false:{tagName:"span",attributes:{part:"separator","aria-hidden":"true"},textContent:"›"}}},{tagName:"span",attributes:{part:"crumb-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/control"},cases:{button:{tagName:"button",attributes:{part:"crumb",type:"button",title:"${$map.item.title}","aria-current":"${$map.item.current ? 'true' : null}",disabled:{$ref:"$map/item/disabled"}},textContent:"${$map.item.label}",onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/run"},value:[{$ref:"$map/item/key"}]}]}},readout:{tagName:"span",attributes:{part:"crumb",title:"${$map.item.title}","aria-current":"${$map.item.current ? 'true' : null}"},textContent:"${$map.item.label}"}}},{tagName:"span",attributes:{part:"alternatives-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasChoices"},cases:{true:{tagName:"button",attributes:{part:"alternatives",type:"button","aria-haspopup":"menu","aria-label":"${$map.item.altsLabel}",title:"${$map.item.altsLabel}"},textContent:"⌃",onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/choose"},value:[{$ref:"$map/item/key"},{$ref:"event#/currentTarget"}]}]}}}}]}}]};E("jump-bar",wS);function xS(e,t,r){let o=g({...r,empty:!0,region:t,segments:[]});e.replaceChildren();let a=null,i=!1;return R("jump-bar",o,e).then((s)=>{if(i){s.dispose();return}a=s}),{dispose(){i=!0,a?.dispose(),a=null,e.replaceChildren()},update(s){o.segments=[...s],o.empty=s.length===0}}}var DH="statusbar/document",FH="block-start span-inline-end";function $S(e){if(!e)return"Untitled";let t=C?.projectRoot;return t&&e.startsWith(`${t}/`)?e.slice(t.length+1):e}function _H(e){if(e.documentPath)return{label:$S(e.documentPath),title:e.documentPath};let t=gv(e.id);if(t)return{label:t,title:`The ${t} workspace's home, a view rather than a file`};let r=$m(e.id);if(r)return{label:r,title:`${r}, a view of many files rather than one`};return{label:$S(null),title:"Not saved to disk yet"}}function zH(e,t){let r=[];for(let o=0;o<t.length;){let a=t[o],i=a==="map"?1:2,s=t.slice(0,o+i),l=oe(e,s),f=l?.tag,c=l?.$prototype==="Array"?"Repeater":it(l?.tagName)||(n(f)?f:"")||(a==="cases"?String(t[o+1]):`[${t[o+1]}]`);r.push({label:c,path:s}),o+=i}return r}function HH(e,t,r){let o=t[r];if(!o)return[];let a=r===0?[]:t[r-1].path,i=oe(e,a),s=o.path.at(-2),l=o.path;if(s==="cases"){let c=i?.cases;if(!_(c))return[];return Object.keys(c).map((d)=>{let b=[...a,"cases",d];return CS(e,b,d,l)})}if(s!=="children")return[];let f=[];for(let[c,d]of rr(i).entries()){if(n(d))continue;let b=[...a,"children",c];f.push(CS(e,b,kr(d),l))}return f}function CS(e,t,r,o){let a=oe(e,t),i=a?kr(a):r,s={args:{path:t},command:"selection.set",label:i};return Cr(t,o)?{...s,current:!0}:s}function BH(e,t=null){if(!e)return[];let r=[{choices:[],command:t?"pane.pin":"palette.openFiles",kind:"file",..._H(e)}],{editingFormula:o,editingFunction:a}=e.session.ui;if(a)return r.push(PS("ƒ",a)),r;if(o)return r.push(PS("fx",o)),r;let i=Oe(e.session.selection);if(i&&i.length>0){let s=zH(e.doc.document,i);for(let[l,f]of s.entries()){let c=oe(e.doc.document,f.path);r.push({args:{path:f.path},choices:HH(e.doc.document,s,l),command:"selection.set",kind:"node",label:l===s.length-1&&c?kr(c):f.label,title:f.path.join(" / ")})}}return r}function PS(e,t){return{choices:[],command:null,kind:"editor",label:`${e} ${t.defName??t.eventKey??"editor"}`}}function VH(e){let t=e.args?.path;return e.kind==="node"&&Array.isArray(t)?`node:${t.join("/")}`:e.kind}function WH(e,t){return t!==null&&Boolean(e?.get(t))&&e.isVisible(t)}function qH(e,t,r){let o=e.get(r),a=e.disabledReason(r),i=e.keymap.formatBinding(r),s=a?`${o.title} — requires ${a}`:i?`${o.title} (${i})`:o.title;return t.title?`${t.title} · ${s}`:s}function UH(e,t,r,o){let a=t.command,i=WH(e,a);return{altsLabel:`Siblings of ${t.label}`,control:i?"button":"readout",current:o,disabled:i&&e.disabledReason(a)!==void 0,hasChoices:e!==null&&t.choices.length>1,key:VH(t),kind:t.kind,label:t.label,leading:r,title:i?qH(e,t,a):t.title??t.label}}var Yt=null,Ci=null,Ti=null;function vc(){let e=Ti;Ti=null,e?.close()}function JH(e,t){let r=ae();if(!r)return;vc();let o=e.choices.map((s,l)=>({checked:s.current===!0?"true":"false",destructive:!1,disabled:!1,dividerAbove:!1,id:String(l),run:()=>{Tn(r,s.command,s.args,"Jump Bar")},title:s.label})),a={label:`Go to a sibling of ${e.label}`,onClosed:(s)=>{if(Ti===s)Ti=null},opener:t,placement:FH,region:"jump-bar",rows:o};if(t)a.place=(s)=>GH(t,s);Ti=zt(a)}function GH(e,t){let r=Me(e);return{x:Math.round(r.left),y:Math.max(0,Math.round(r.top-t.height))}}function KH(){let e=qr().id,t=BH(bt(e),jr(e)),r=ae();return{segments:t,steps:t.map((o,a)=>UH(r,o,a===0,a===t.length-1))}}function NS(){if(!Yt)return;vc();let{segments:e,steps:t}=KH();Yt.segments=new Map(t.map((r,o)=>[r.key,e[o]])),Yt.surface.update(t)}function Gf(e){if(Yt?.host===e)return;if(Yt)vc(),Yt.surface.dispose(),Yt=null;if(!e)return;Yt={host:e,segments:new Map,surface:xS(e,DH,{choose:(t,r)=>{let o=Yt?.segments.get(t);if(o)JH(o,r)},run:(t)=>{let r=Yt?.segments.get(t),o=ae();if(r?.command&&o)Tn(o,r.command,r.args,"Jump Bar")}})},NS()}function AS(){Ci?.stop(),Ci=me(),Ci.run(()=>{te(()=>{ae(),C?.name,m.activePaneId,m.panes.length;let e=bt(qr().id);if(e)e.doc.document,e.documentPath,e.session.selection.map((t)=>t.join("/")).join("|"),e.session.ui.editingFormula,e.session.ui.editingFunction;NS()})})}function OS(){vc(),Ci?.stop(),Ci=null,Gf(null)}var FS={$schema:"https://jxsuite.com/schema/v1",$id:"StudioStatusbar",$description:"The status bar: ambient state in the shell's level order, PROJECT then DOCUMENT then SELECTION. The adapter hands in the fields either side of the DOCUMENT field (`leading` and `trailing`), each with its region and its items; an item with a command is a button that runs it through `run`, and an item without one is a readout. The DOCUMENT field between them is the `trail` slot, an empty box `panels/jump-bar.ts` mounts the breadcrumb trail into. Nothing here decides what the bar says.",tagName:"div",attributes:{part:"bar"},style:{display:"flex",alignItems:"stretch",flex:"1",minWidth:"0",'& > [part="field"]':{display:"flex",alignItems:"center",gap:"2px",minWidth:"0",padding:"0 var(--jx-space-3)"},'& > [part="field"]:last-child':{overflow:"hidden"},"& > :not([hidden]) ~ :not([hidden])":{$description:'A rule between fields rather than a run of "|" characters: the boundary between PROJECT, DOCUMENT and SELECTION is structural. Every visible field after a visible field draws one, so a hidden DOCUMENT slot leaves no doubled rule behind.',borderLeft:"1px solid var(--jx-border)"},'& > [part="trail"]':{$description:"The DOCUMENT field, filled by `panels/jump-bar.ts`. It takes the width the other two fields leave, so a deep trail scrolls inside it instead of pushing the SELECTION field off the bar.",display:"flex",flex:"1",minWidth:"0"},'& > [part="trail"][hidden]':{display:"none"},'& [part="item"], & [part="state"]':{maxWidth:"32ch",overflow:"hidden",margin:"0",padding:"0 var(--jx-space-2)",border:"none",borderRadius:"var(--jx-radius-xs)",background:"transparent",color:"inherit",font:"inherit",lineHeight:"1",whiteSpace:"nowrap",textOverflow:"ellipsis"},'& [part="item"]':{cursor:"pointer",":hover:not(:disabled)":{color:"var(--jx-fg)",background:"var(--jx-hover-bg)"},":disabled":{cursor:"default",opacity:"0.6"},":focus-visible":{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"}},'& [part="state"]':{cursor:"default"}},children:[{$prototype:"Array",items:{$ref:"#/state/leading"},key:{$ref:"$map/item/id"},map:{tagName:"div",attributes:{part:"field","data-jx-region":"${$map.item.region}"},children:[{$prototype:"Array",items:{$ref:"$map/item/items"},key:{$ref:"$map/item/key"},map:{tagName:"span",attributes:{part:"slot"},style:{display:"contents"},$switch:{$ref:"$map/item/kind"},cases:{button:{tagName:"button",attributes:{part:"item",type:"button",title:"${$map.item.title}",disabled:{$ref:"$map/item/disabled"}},textContent:"${$map.item.label}",onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/run"},value:[{$ref:"$map/item/key"}]}]}},state:{tagName:"span",attributes:{part:"state",title:"${$map.item.title}"},textContent:"${$map.item.label}"}}}}]}},{$description:"The DOCUMENT field's slot. Empty by design: the jump bar is handed this box and mounts its own document into it, so nothing here may ever render a child. `aria-live=\"off\"` because the bar's host is the app's polite status region, and a trail that changes on every click in the canvas would be read aloud on every click; the trail is a `nav` a reader visits, not news.",tagName:"div",attributes:{part:"trail","aria-live":"off",hidden:"${state.hasDocument ? null : ''}"}},{$prototype:"Array",items:{$ref:"#/state/trailing"},key:{$ref:"$map/item/id"},map:{tagName:"div",attributes:{part:"field","data-jx-region":"${$map.item.region}"},children:[{$prototype:"Array",items:{$ref:"$map/item/items"},key:{$ref:"$map/item/key"},map:{tagName:"span",attributes:{part:"slot"},style:{display:"contents"},$switch:{$ref:"$map/item/kind"},cases:{button:{tagName:"button",attributes:{part:"item",type:"button",title:"${$map.item.title}",disabled:{$ref:"$map/item/disabled"}},textContent:"${$map.item.label}",onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/run"},value:[{$ref:"$map/item/key"}]}]}},state:{tagName:"span",attributes:{part:"state",title:"${$map.item.title}"},textContent:"${$map.item.label}"}}}}]}}]};E("statusbar",FS);var xc=null;function XH(e,t,r){if(r.command===null)return{args:void 0,command:null,disabled:!1,key:`${t}:${r.label}`,kind:"state",label:r.label,title:r.title??r.label};let o=r.command;if(!e?.get(o)||!e.isVisible(o))return null;let a=e.get(o),i=e.disabledReason(o),s=e.keymap.formatBinding(o),l=i?`${a.title} — requires ${i}`:s?`${a.title} (${s})`:a.title;return{args:r.args,command:o,disabled:i!==void 0,key:`${t}:${o}`,kind:"button",label:r.label,title:r.title?`${r.title} · ${l}`:l}}function Kf(e,t,r){let o=`statusbar/${t}`,a=r.flatMap((i)=>{let s=i===null?null:XH(e,o,i);return s===null?[]:[s]});if(a.length===0)return null;return{id:t,items:a,region:o}}function QH(e,t){return`${e>0?` ↑${e}`:""}${t>0?` ↓${t}`:""}`}function ZH(e){if(e===0)return"No changes";return e===1?"1 changed file":`${e} changed files`}function eB(e){let t=C,{status:r}=u.git,o=Iv(),a=lA(),i=h.value?xn(h.value).peers.length:0;return Kf(e,"project",[t?{command:"project.openRecent",label:t.name}:{command:"project.open",label:"No project"},r?.isRepo===!0&&r.branch?{args:{tab:"review"},command:"publish.open",label:`⑂ ${r.branch}${QH(r.ahead,r.behind)}`,title:`${ZH(r.files.length)} on ${r.branch}`}:null,a?{command:a.command,label:a.label,title:a.title}:null,o>0?{args:{tab:"problems"},command:"view.setBottomTab",label:`⚠ ${o}`,title:o===1?"1 problem":`${o} problems`}:null,i>0?{command:"collab.showStatus",label:`${i} peer${i===1?"":"s"}`,title:`${i} peer${i===1?"":"s"} in this document`}:null])}function tB(e){let t=h.value;if(t?.session.ui.canvasMode===Ou){let o=om(t);return o?Kf(e,"selection",[{command:null,label:o.replaceAll(" "," › "),title:"The style rule being edited"}]):null}let r=t?.session.selection??[];return r.length>1?Kf(e,"selection",[{command:null,label:`${r.length} selected`,title:`${r.length} elements are selected; the trail names the primary`}]):null}function zS(e){return e.filter((t)=>t!==null)}var Pi=null,Ei=null,wc=null;function HS(){return Pi??=g({hasDocument:!1,leading:[],run:(e)=>{let t=[...Pi?.leading??[],...Pi?.trailing??[]].flatMap((o)=>o.items).find((o)=>o.key===e),r=ae();if(t?.command&&r)Tn(r,t.command,t.args,"Status Bar")},trailing:[]}),Pi}function nB(){let e=DI;if(Ei||!e)return;let t=R("statusbar",HS(),e);Ei=t,t.then((r)=>{if(Ei!==t)return;wc=r,Gf(e.querySelector('[part="trail"]'))})}function Yf(){let e=ae(),t=HS();t.leading=zS([eB(e)]),t.hasDocument=h.value!==null,t.trailing=zS([tB(e)]),nB()}function BS(){rB(),AS(),xc=me(),xc.run(()=>{te(()=>{ae(),u.stylebook.selection,h.value?.session.ui.canvasMode,u.git.status,ta.length;let e=h.value;if(e)e.session.selection.length,xn(e).peers.length;Yf()})})}function rB(){xc?.stop(),xc=null;let e=Ei;if(Ei=null,OS(),wc)wc.dispose(),wc=null;else if(e)e.then((t)=>t.dispose());Pi=null}var VS={$schema:"https://jxsuite.com/schema/v1",$id:"StudioPanelElements",$description:"The Insert panel: the palette a page is built out of. One filter, then one accordion — the project's own components first, then the HTML elements by category — and a card per thing that can be inserted. The adapter (`surfaces/panel-elements.ts`) is handed sections whose cards are already filtered, already open or closed, and already carry the tag they insert, so nothing here asks what an element is, which npm components the document has enabled, or what the filter means. A card is inserted by CLICK from this document and by DRAG from `panels/dnd.ts`, which registers against the painted card — that seam is why three class names survive the conversion, and the style block says why.",tagName:"div",attributes:{part:"palette"},style:{$description:"What this block does NOT contain is most of the conversion. `.elements-list` and `.elements-list sp-accordion-item` are gone rather than moved: the first removed a border Spectrum's accordion drew and the kit's does not, and the second drew the hairline between two sections and set an 11px header — `jx-accordion` draws that separator itself (`& > :not([hidden]) ~ *`) and `jx-accordion-item` owns its own summary, so transcribing either would be re-deciding something the kit has already decided. `.element-card`, `.element-card-preview` and `.element-card-label` are NOT this document's to take, and that is why they are still spelled as classes here: the same card is drawn by `panels/stylebook-doc.ts` for its specimens and re-declared inside the canvas iframe by `canvas/iframe-render.ts`, and `panels/dnd.ts` addresses `.components-section` and `.element-card-preview` BY SELECTOR to hang the drag on a row and to fill its preview with a live element. A card is a shared object with three readers; moving its look in here would fork it. An element card's preview is drawn EMPTY for the same reason: `dnd.ts` fills it with the element rendered live, and it fills only a preview it finds with no children in it. What is left below is what belongs to the palette alone.",display:"flex",flexDirection:"column",minHeight:"0",fontFamily:"var(--jx-font-sans)",color:"var(--fg)",'& [part="filter"]':{$description:"The filter is inset from the panel's edges; `.panel-body` sets `padding: 0`, so the field sat flush against three of them. It stretches because the palette is a flex column, which is also what `sp-search` got for free from being a block.",margin:"var(--jx-space-2)"},'& [part="empty"]':{$description:"The one empty-state pattern (`panels/empty-state.ts`), drawn here because a document cannot render a lit helper. `.empty-state` and `.empty-state--teach` keep their stylesheet — every panel still lit renders through that helper — so this is a copy rather than a move, and it goes when the last of them converts. Its 13px was the one value with no token behind it; the kit's `--jx-text-md` is the scale this chrome is on.",display:"flex",flexDirection:"column",alignItems:"center",gap:"var(--jx-space-3)",padding:"var(--jx-space-6)",textAlign:"center",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"},'& [part="empty-message"]':{margin:"0",maxWidth:"34ch",lineHeight:"1.5"},'& [part="component-tag"]':{$description:"What a component card shows until `panels/dnd.ts` replaces it with the component rendered live. It was an inline `style=` reading `--spectrum-font-size-50` with an 11px fallback — a name that resolves only inside `<sp-theme>`, and this document is mounted into the Navigator's panel body, where that element is not an ancestor — so the size is the kit's scale and the colour the studio layer's.",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)",fontStyle:"italic"}},children:[{tagName:"jx-textfield",attributes:{part:"filter"},$props:{size:"sm",type:"search",clearable:!0,label:"Filter elements",placeholder:"Filter elements…",value:{$ref:"#/state/filter"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setFilter"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"div",attributes:{part:"empty-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/emptyState"},cases:{filtered:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",attributes:{part:"empty-message"},textContent:"Nothing here matches “${state.filter}”."},{tagName:"div",attributes:{part:"empty-actions"},children:[{tagName:"jx-button",$props:{size:"sm"},attributes:{part:"clear-filter"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/clearFilter"}}]},children:[{tagName:"span",textContent:"Clear the filter"}]}]}]},empty:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",attributes:{part:"empty-message"},textContent:"Elements you can drop onto the page live here — text, images, layout containers and your own components."}]}}},{tagName:"jx-accordion",attributes:{part:"list"},children:[{tagName:"div",attributes:{part:"components-slot",role:"none",hidden:"${state.hasComponents ? null : ''}"},style:{$description:"The section stands or falls as a whole, so the slot is `display: contents` — the accordion item inside it has to be the accordion's own layout child. `hidden` is what keeps the separator honest: `jx-accordion` gives a top border to every child that FOLLOWS a visible one, so an empty slot left visible would draw a line above the first category with nothing above it.",display:"contents"},$switch:{$ref:"#/state/hasComponents"},cases:{true:{tagName:"jx-accordion-item",$props:{label:"Components",open:{$ref:"#/state/componentsOpen"}},attributes:{"data-section":"components"},ontoggle:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setComponentsOpen"},value:[{$ref:"event#/detail"}]}]},children:[{tagName:"div",attributes:{class:"components-section"},children:[{$prototype:"Array",items:{$ref:"#/state/components"},key:{$ref:"$map/item/tagName"},map:{tagName:"div",attributes:{class:"element-card","data-component-tag":"${$map.item.tagName}",title:"${$map.item.title}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/insertComponent"},value:[{$ref:"$map/item/tagName"}]}]},children:[{tagName:"div",attributes:{class:"element-card-preview"},children:[{tagName:"span",attributes:{part:"component-tag"},textContent:"<${$map.item.tagName}>"}]},{tagName:"div",attributes:{class:"element-card-label"},textContent:"${$map.item.tagName}"}]}}]}]}}},{$prototype:"Array",items:{$ref:"#/state/categories"},key:{$ref:"$map/item/name"},map:{tagName:"jx-accordion-item",$props:{label:{$ref:"$map/item/name"},open:{$ref:"$map/item/open"}},attributes:{"data-section":"${$map.item.name}"},ontoggle:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setSectionOpen"},value:[{$ref:"$map/item/name"},{$ref:"event#/detail"}]}]},children:[{$prototype:"Array",items:{$ref:"$map/item/elements"},key:{$ref:"$map/item/tag"},map:{tagName:"div",attributes:{class:"element-card","data-block-tag":"${$map.item.tag}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/insertElement"},value:[{$ref:"$map/item/tag"}]}]},children:[{tagName:"div",attributes:{class:"element-card-preview"}},{tagName:"div",attributes:{class:"element-card-label"},textContent:"<${$map.item.tag}>"}]}}]}}]}]};E("panel-elements",VS);function WS(e,t){e.filter=t.filter,e.categories=t.categories,e.components=t.components,e.componentsOpen=t.componentsOpen,e.hasComponents=t.hasComponents,e.emptyState=t.emptyState}function KS(e,t,r){let o=g({categories:[],clearFilter:r.clearFilter,components:[],componentsOpen:!0,emptyState:"none",filter:"",hasComponents:!1,insertComponent:r.insertComponent,insertElement:r.insertElement,setComponentsOpen:r.setComponentsOpen,setFilter:r.setFilter,setSectionOpen:r.setSectionOpen});WS(o,t);let a=null,i=!1,s=R("panel-elements",o,e).then((l)=>{if(i){l.dispose();return}a=l});return{connected:()=>!i&&(a===null||a.root.parentNode===e),dispose(){i=!0,a?.dispose(),a=null},ready:s,update:(l)=>WS(o,l)}}var QS="Components",Ur=null,hn=null;function aB(){return st.elementsFilter.toLowerCase()}function iB(e,t){let r=[];for(let[o,a]of Object.entries(e.elements??{})){let i=t?a.filter((s)=>s.tag.includes(t)):a;if(i.length===0)continue;r.push({elements:i.map(({tag:s})=>({tag:s})),name:o,open:!st.elementsCollapsed.has(o)})}return r}function sB(){let e=h.value,t=xx(e?.doc.document?.$elements),r=new Set;for(let o of t){if(!n(o))continue;let a=Ne.find((i)=>i.source==="npm"&&i.modulePath&&o===`${i.package}/${i.modulePath}`);if(a){r.add(a.tagName);continue}for(let i of Ne)if(i.source==="npm"&&i.package===o)r.add(i.tagName)}return r}function lB(e){if(Ne.length===0)return[];let t=sB();return Ne.filter((r)=>r.source!=="npm"||t.has(r.tagName)).filter((r)=>!e||r.tagName.toLowerCase().includes(e)).map((r)=>({tagName:r.tagName,title:r.source==="npm"?`${r.package}: <${r.tagName}>`:r.path??r.tagName}))}function ZS(e){let t=aB(),r=iB(e.webdata,t),o=lB(t),a=r.length===0&&o.length===0;return{categories:r,components:o,componentsOpen:!st.elementsCollapsed.has(QS),emptyState:a?t?"filtered":"empty":"none",filter:st.elementsFilter,hasComponents:o.length>0}}function YS(e){let t=h.value;if(!t)return;let r=Oe(t.session.selection)??[],o=oe(t.doc.document,r),a=rr(o).length;Z(t,(i)=>{or(i,r,a,structuredClone(e)),Op(i,e.tagName)})}function Ni(){let e=hn;if(!e||!Ur)return;e.handle.update(ZS(Ur)),e.handle.ready.then(()=>{if(hn!==e)return;Ur?.registerElementsDnD(),Ur?.registerComponentsDnD()})}var cB={clearFilter:()=>{st.elementsFilter="",Ni()},insertComponent:(e)=>{let t=Ne.find((r)=>r.tagName===e);if(t)YS(Uc(t))},insertElement:(e)=>{if(Ur)YS(Ur.defaultDef(e))},setComponentsOpen:(e)=>{XS(QS,!e),Ni()},setFilter:(e)=>{st.elementsFilter=e,Ni()},setSectionOpen:(e,t)=>{XS(e,!t),Ni()}};function XS(e,t){if(t)st.elementsCollapsed.add(e);else st.elementsCollapsed.delete(e)}function dB(e,t){Ur=e.deps;let r=t.querySelector(".panel-content")??t;if(hn&&(hn.host!==r||!hn.handle.connected()))hn.handle.dispose(),hn=null;if(!hn)hn={handle:KS(r,ZS(e.deps),cB),host:r};Ni()}function eC(){ei({id:"insert",title:"Insert",level:"document",dock:"navigator",icon:"grid-four",rail:!1,render:()=>ft,afterRender:(e,t)=>{dB(e,t)}})}var tC={$schema:"https://jxsuite.com/schema/v1",$id:"StudioPanelI18n",$description:"The Languages panel: a grid over ABSENCE, one row per translation key and one column per declared locale, drawn from the projection `panels/i18n-panel.ts` hands in. Every square is a button and every button is a command run by id, so the document draws a state, a glyph and a sentence and decides nothing: which command a cell runs, whether it is refused and what the refusal says are all settled before the scope is written. Three bodies rather than one, because a monolingual project and a project still being read are not empty versions of the grid — they are different answers to the same question.",tagName:"div",attributes:{part:"panel"},style:{$description:"The panel's own look, taken out of `styles/panels.css`'s `.i18n-*` block. Three tokens changed meaning on the way: `--spectrum-font-size-50`, `--spectrum-font-size-75` and `--spectrum-corner-radius-75` resolved only inside `<sp-theme>`, and this document is mounted into the Navigator's `.panel-body`, where that element is not an ancestor — every one of them would silently have taken its px fallback. They are the kit's scale here (`--jx-text-sm`, `--jx-text-md`, `--jx-radius-xs`), which is what those three Spectrum steps were.",display:"flex",flexDirection:"column",gap:"8px",padding:"8px",minWidth:"0",fontFamily:"var(--jx-font-sans)",color:"var(--fg)",'& [part="empty"]':{$description:"The teaching empty state, drawn here rather than borrowed from `panels/empty-state.ts`: that helper is a lit template and a document cannot call one. Its rules are what is kept — one sentence saying what the region is FOR, then where its content comes from, then the action that fills it — in the centred shape a whole empty region uses.",display:"flex",flexDirection:"column",alignItems:"center",gap:"8px",padding:"24px",textAlign:"center",fontSize:"13px",color:"var(--fg-dim)"},'& [part="empty"][data-compact="true"]':{$description:"The same state as a note INSIDE an otherwise populated panel — the grid's summary and its Rescan button are still above it, so a centred block with 24px of air around it would read as a second, emptier panel.",alignItems:"flex-start",gap:"4px",padding:"8px 12px",textAlign:"left",fontSize:"var(--jx-text-sm)"},'& [part="empty-message"], & [part="empty-detail"]':{margin:"0",maxWidth:"34ch",lineHeight:"1.5"},'& [part="empty-detail"]':{fontSize:"var(--jx-text-sm)",opacity:"0.8"},'& [part="empty-actions"]':{display:"flex",flexWrap:"wrap",justifyContent:"center",gap:"8px"},'& [part="actions"]':{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:"8px"},'& [part="summary"]':{margin:"0",minWidth:"0",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)"},'& [part="rescan"]':{flex:"none",padding:"2px 8px",border:"1px solid var(--border)",borderRadius:"var(--jx-radius-xs)",background:"transparent",color:"var(--fg-dim)",font:"inherit",fontSize:"var(--jx-text-sm)",cursor:"pointer"},'& [part="rescan"]:hover':{color:"var(--fg)",background:"var(--hover-bg)"},'& [part="incomplete"]':{$description:"A directory the scan could not read makes the whole grid a partial answer, so it says so ABOVE the table rather than letting an unreadable `content/` read as a project with no content.",margin:"0",padding:"4px 6px",borderLeft:"3px solid var(--warning)",borderRadius:"var(--radius)",background:"var(--bg-panel)",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)"},'& [part="parity"]':{$description:"The Navigator is narrow and a key is a path, so the table scrolls sideways rather than wrapping every path onto four lines.",display:"block",overflowX:"auto",borderCollapse:"collapse",fontSize:"var(--jx-text-md)"},'& [part="key-head"], & [part="locale-head"]':{padding:"2px 6px",borderBottom:"1px solid var(--border)",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)",fontWeight:"700",textAlign:"start",textTransform:"uppercase",letterSpacing:"0.04em",whiteSpace:"nowrap"},'& [part="default-mark"]':{marginInlineStart:"4px",color:"var(--accent)",fontWeight:"400",textTransform:"none",letterSpacing:"normal"},'& [part="row"]:hover':{background:"var(--hover-bg)"},'& [part="key"]':{maxWidth:"220px",overflow:"hidden",padding:"2px 6px",color:"var(--fg)",fontFamily:"var(--font-mono)",fontSize:"var(--jx-text-sm)",fontWeight:"400",textAlign:"start",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="cell"]':{padding:"2px 6px",textAlign:"center"},'& [part="cell-button"]':{$description:"The glyph carries the state and the colour repeats it, the way a problem row's severity does, because a column of squares is read by scanning rather than by reading. The state is an attribute rather than a class: a document styles through `part` and the data it already carries, never through a class name (ui.md §3.1).",inlineSize:"22px",blockSize:"18px",border:"1px solid var(--border)",borderRadius:"var(--jx-radius-xs)",background:"transparent",color:"var(--fg-dim)",font:"inherit",fontSize:"var(--jx-text-md)",lineHeight:"1",cursor:"pointer"},'& [part="cell-button"]:hover:not(:disabled)':{background:"var(--hover-bg)"},'& [part="cell-button"]:disabled':{cursor:"default",opacity:"0.45"},'& [part="cell-button"][data-state="present"]':{color:"var(--success)"},'& [part="cell-button"][data-state="stale"]':{color:"var(--warning)",borderColor:"var(--warning)"},'& [part="cell-button"][data-state="missing"]':{color:"var(--accent)",borderStyle:"dashed"},'& [part="truncated"]':{margin:"0",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)"}},children:[{tagName:"div",attributes:{part:"body-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/mode"},cases:{mono:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",attributes:{part:"empty-message"},textContent:"This project is written in one language."},{tagName:"p",attributes:{part:"empty-detail"},textContent:"Declare them under Locales in the project's settings, then a page's translations are sibling files under a directory named for each language."},{tagName:"div",attributes:{part:"empty-actions"},children:[{tagName:"jx-button",$props:{size:"sm",disabled:{$ref:"#/state/settingsDisabled"}},attributes:{part:"settings"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openSettings"}}]},children:[{tagName:"span",textContent:"Open project settings…"}]}]}]},scanning:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",attributes:{part:"empty-message"},textContent:"Looking for translations…"},{tagName:"p",attributes:{part:"empty-detail"},textContent:"Reading pages/ and content/ to find out which languages each page is written in."}]},grid:{tagName:"div",attributes:{part:"grid",role:"none"},style:{display:"contents"},children:[{tagName:"div",attributes:{part:"actions"},children:[{tagName:"p",attributes:{part:"summary"},textContent:"${state.summary}"},{tagName:"button",attributes:{part:"rescan",type:"button",title:"Read pages/ and content/ again"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/rescan"}}]},textContent:"Rescan"}]},{tagName:"div",attributes:{part:"incomplete-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasIncomplete"},cases:{true:{tagName:"p",attributes:{part:"incomplete"},children:[{tagName:"span",textContent:"This list is incomplete — "},{tagName:"span",textContent:"${state.incomplete}"}]}}},{tagName:"div",attributes:{part:"list-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasRows"},cases:{false:{tagName:"div",attributes:{part:"empty","data-compact":"true"},children:[{tagName:"p",attributes:{part:"empty-message"},textContent:"There is nothing to translate yet."},{tagName:"p",attributes:{part:"empty-detail"},textContent:"Add a page under pages/, or an entry to a content collection."}]},true:{tagName:"table",attributes:{part:"parity"},children:[{tagName:"thead",children:[{tagName:"tr",children:[{tagName:"th",attributes:{part:"key-head",scope:"col"},textContent:"Page"},{$prototype:"Array",items:{$ref:"#/state/heads"},key:{$ref:"$map/item/locale"},map:{tagName:"th",attributes:{part:"locale-head",scope:"col",title:"${$map.item.locale}"},children:[{tagName:"span",textContent:"${$map.item.label}"},{tagName:"span",attributes:{part:"default-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/isDefault"},cases:{true:{tagName:"span",attributes:{part:"default-mark"},textContent:"source"}}}]}}]}]},{tagName:"tbody",children:[{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/key"},map:{tagName:"tr",attributes:{part:"row"},children:[{tagName:"th",attributes:{part:"key",scope:"row",title:"${$map.item.key}"},textContent:"${$map.item.key}"},{$prototype:"Array",items:{$ref:"$map/item/cells"},key:{$ref:"$map/item/locale"},map:{tagName:"td",attributes:{part:"cell"},children:[{tagName:"button",attributes:{part:"cell-button",type:"button","data-state":"${$map.item.state}",disabled:{$ref:"$map/item/disabled"},title:"${$map.item.title}","aria-label":"${$map.item.title}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/runCell"},value:[{$ref:"$map/item/command"},{$ref:"$map/item/locale"},{$ref:"$map/item/rowPath"}]}]},children:[{tagName:"span",attributes:{"aria-hidden":"true"},textContent:"${$map.item.glyph}"}]}]}}]}}]}]}}},{tagName:"div",attributes:{part:"truncated-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasTruncated"},cases:{true:{tagName:"p",attributes:{part:"truncated"},textContent:"${state.truncated}"}}}]}}}]};E("panel-i18n",tC);function nC(e,t){if(t.mode!==void 0)e.mode=t.mode;if(t.settingsDisabled!==void 0)e.settingsDisabled=t.settingsDisabled;if(t.summary!==void 0)e.summary=t.summary;if(t.incomplete!==void 0)e.incomplete=t.incomplete,e.hasIncomplete=t.incomplete!=="";if(t.truncated!==void 0)e.truncated=t.truncated,e.hasTruncated=t.truncated!=="";if(t.heads!==void 0)e.heads=t.heads;if(t.rows!==void 0)e.rows=t.rows,e.hasRows=t.rows.length>0}function mC(e,t,r){let o=g({hasIncomplete:!1,hasRows:!1,hasTruncated:!1,heads:[],incomplete:"",mode:"scanning",openSettings:r.openSettings,rescan:r.rescan,rows:[],runCell:r.runCell,settingsDisabled:!1,summary:"",truncated:""});nC(o,t);let a=null,i=!1;return R("panel-i18n",o,e).then((s)=>{if(i){s.dispose();return}a=s}),{connected:()=>!i&&(a===null||a.root.parentNode===e),dispose(){i=!0,a?.dispose(),a=null},update:(s)=>nC(o,s)}}var hC=["pages","content"],gC=200,Dn=null,kc=null;function uB(){Dn=null,kc=null}async function mB(e,t){try{let r=await xm(hC,p());Dn={declared:await fB(r.files),failures:r.failures,files:r.files,root:e}}catch(r){Dn={declared:new Map,failures:[{dir:hC.join(", "),error:X(r)}],files:[],root:e}}kc=null,t()}async function fB(e){let t=p(),r=e.filter((i)=>!i.media&&i.path.startsWith("pages/")),o=await Promise.all(r.map(async(i)=>{try{return await t.readFile(i.path)}catch{return null}})),a=new Map;for(let[i,s]of r.entries()){let l=o[i];if(!l?.includes("$translationKey"))continue;let f=/"\$translationKey"\s*:\s*"((?:[^"\\]|\\.)*)"/.exec(l)?.[1];if(f!==void 0&&f!=="")a.set(s.path,f.replaceAll(/\$\{(\w+)\}/g,"[$1]").replaceAll(/^\/+|\/+$/g,""))}return a}function bC(e){if(!e)return null;let t=Date.parse(e);return Number.isNaN(t)?null:t}function hB(e,t,r=new Map){let o=new Map,a=new Set(e.flatMap((l)=>l.media?[]:[mv(l.path,t)])),i=(l)=>{let f=r.get(l.path);if(f===void 0)return mv(l.path,t);let c=/\.[^./]+$/.exec(l.path)?.[0]??"";for(let d of[`pages/${f}${c}`,`pages/${f}/index${c}`])if(a.has(d))return d;return`pages/${f}${c}`};for(let l of e){if(l.media)continue;let f=i(l),c=go(l.path,t)??t.defaultLocale,d=o.get(f)??new Map;if(!d.has(c)||l.path===Qc(f,c,t))d.set(c,l);o.set(f,d)}let s=[];for(let[l,f]of o){let c=f.get(t.defaultLocale),d=bC(c?.modified),b=new Map;for(let y of t.locales){let x=f.get(y);if(!x){b.set(y,{path:Qc(l,y,t),state:"missing"});continue}let S=bC(x.modified),P=c!==void 0&&c.path!==x.path&&d!==null&&S!==null&&d>S;b.set(y,P?{behind:c.path,path:x.path,state:"stale"}:{path:x.path,state:"present"})}s.push({cells:b,key:l})}return s.toSorted((l,f)=>l.key.localeCompare(f.key))}var TC="settings.open",gB={missing:"i18n.createTranslation",present:"i18n.openTranslation",stale:"i18n.openTranslation"},bB={missing:"+",present:"✓",stale:"!"};function yB(e,t){let r=e.cells.get(t.defaultLocale);if(r&&r.state!=="missing")return r.path;for(let o of e.cells.values())if(o.state!=="missing")return o.path;return e.key}function vB(e,t){if(e.state==="missing"&&e.path===null)return"a file that can hold a locale directory — this one is under no collection";let r=ae();if(!r?.get(t))return"the Languages commands, which this window has not registered";return r.disabledReason(t)}function wB(e,t,r){let o=Wt(t),a=e.state==="missing"?e.path===null?`No place for a ${o} copy of this file`:`Create ${e.path}`:e.state==="stale"?`Open ${e.path} — older than ${e.behind}`:`Open ${e.path}`;return r===void 0?a:`${a} — requires ${r}`}function SC(e,t={}){let r=ae();if(!r?.get(e))return;Tn(r,e,t,"Languages")}function xB(e,t){let r=yB(e,t);return{cells:t.locales.map((a)=>{let i=e.cells.get(a)??{path:null,state:"missing"},s=gB[i.state],l=vB(i,s);return{command:s,disabled:l!==void 0,glyph:bB[i.state],locale:a,rowPath:r,state:i.state,title:wB(i,a,l)}}),key:e.key}}function kB(e){let t=0,r=0;for(let o of e)for(let a of o.cells.values())if(a.state==="missing")t+=1;else if(a.state==="stale")r+=1;return{missing:t,stale:r}}function $B(e){let{missing:t,stale:r}=kB(e),o=`${e.length} page${e.length===1?"":"s"}`;if(t===0&&r===0)return`${o}, translated into every declared language.`;let a=[];if(t>0)a.push(`${t} not written`);if(r>0)a.push(`${r} older than their source`);return`${o} — ${a.join(", ")}.`}function Xf(e){return{heads:[],incomplete:"",mode:e,rows:[],settingsDisabled:ae()?.get(TC)===void 0,summary:"",truncated:""}}function SB(e){let t=Ts();if(t===null||t.locales.length<2)return Xf("mono");let r=C?.projectRoot??"";if(Dn===null||Dn.root!==r){if(kc!==r)kc=r,mB(r,e.rerender);return Xf("scanning")}let o=hB(Dn.files,t,Dn.declared),a=o.slice(0,gC),i=o.length-a.length;return{...Xf("grid"),heads:t.locales.map((s)=>({isDefault:s===t.defaultLocale,label:Wt(s),locale:s})),incomplete:Dn.failures.map((s)=>`${s.dir} (${s.error})`).join("; "),rows:a.map((s)=>xB(s,t)),summary:$B(o),truncated:i>0?`${i} more page${i===1?" is":"s are"} not shown — the grid stops at `+`${gC}.`:""}}var jC=()=>{},CB={openSettings:()=>{SC(TC,{section:"locales"})},rescan:()=>{uB(),jC()},runCell:(e,t,r)=>{SC(e,{locale:t,path:r})}},Mn=null;function TB(e,t){({rerender:jC}=e);let r=t.querySelector(".panel-content")??t;if(Mn&&(Mn.host!==r||!Mn.handle.connected()))Mn.handle.dispose(),Mn=null;let o=SB(e);if(Mn){Mn.handle.update(o);return}Mn={handle:mC(r,o,CB),host:r}}function OC(){ei({id:"i18n",title:"Languages",level:"project",dock:"navigator",icon:"globe",rail:!1,when:(e)=>e.project.isMultilingual,render:()=>ft,afterRender:(e,t)=>{TB(e,t)}})}var MC={$schema:"https://jxsuite.com/schema/v1",$id:"StudioPanelImports",$description:"The Navigator's Packages panel: what the thing in front of you is allowed to use. It has two moods and one shape. Over `project.json` it lists the project's imported modules and offers the two npm verbs a project has — install a package, uninstall one; over a page, layout or component it lists that document's `$ref` imports and the picker that adds one. Both moods then draw the same thing underneath — one section per npm package the registry knows, with a checkbox per element, which is the cherry-pick. The adapter (`surfaces/panel-imports.ts`) hands in rows that are already strings and booleans: nothing here asks what a specifier is, whether an element is already imported, or which of the two moods a document is in. A component row carries an `id` the flow minted, because the two arrays are NESTED and `$map/item` inside the inner one is the element rather than the package it came from — so the row cannot name its own package and does not have to.",tagName:"div",attributes:{part:"imports"},style:{$description:"The panel's own look, keyed on `part`. Thirteen `.import*` rules in `styles/panels.css` become the parts below — `.imports-panel`'s own scroll and padding are the root's declarations here — and exactly one does not come with them: `.import-add-form sp-textfield` reached INSIDE another component to widen it, which is a thing a part cannot do and no longer has to, because `[part=\"field\"]` is the field itself. Five names that never had a rule at all travel with them and stop being names: `imports-component-list`, `import-component-row`, `import-component-label`, `import-add-name` and `import-add-path` were handles rather than styling, and a `part` is the handle now. Two token repairs came too. `--spectrum-font-size-50` resolved only inside `<sp-theme>` and a document is mounted outside it, so every row that read it would silently have taken its 11px fallback; each is `--jx-text-sm` here. And `.imports-count` read `--text-hint`, a name NO stylesheet in this package defines — an unresolvable custom property makes the whole declaration invalid at computed-value time, so the count has been inheriting its colour all along rather than taking the one that was written for it. It says `--fg-dim`, which is what it was drawing anyway.",display:"block",overflowY:"auto",padding:"var(--jx-space-2)",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-sm)",color:"var(--fg)",'& [part="section"]':{marginBottom:"var(--jx-space-4)"},'& [part="section-header"]':{$description:'The uppercase band every section opens with. It is the only thing that ever styled a section title, which is why `[part="title"]` below carries one declaration and not six: the weight, the size, the colour and the letter-spacing are all inherited from here.',display:"flex",alignItems:"center",gap:"6px",padding:"6px 8px 2px",fontSize:"var(--jx-text-sm)",fontWeight:"600",color:"var(--fg-dim)",textTransform:"uppercase",letterSpacing:"0.5px"},'& [part="title"][data-mono]':{$description:"A package name is an identifier, so it is set in the monospace face and NOT uppercased. The uppercasing is the header's, and it applied to these titles too: `@acme/kit` was drawn as `@ACME/KIT`, which is a name npm does not have. Case is meaning here, so the band's transform stops at this one part.",fontFamily:"var(--font-mono)",textTransform:"none"},'& [part="count"]':{fontWeight:"400",color:"var(--fg-dim)"},'& [part="list"]':{padding:"0 var(--jx-space-2)"},'& [part="components"]':{padding:"0 var(--jx-space-2)"},'& [part="row"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",padding:"3px var(--jx-space-2)",borderRadius:"var(--radius)"},'& [part="row"]:hover':{background:"var(--hover-bg)"},'& [part="name"]':{fontWeight:"500",whiteSpace:"nowrap"},'& [part="path"]':{$description:"The specifier: a module path or a `$ref`. It takes the row's slack and ellipses rather than wrapping, because a row is a line and a wrapped path would push the remove button off the one the eye is on. The `title` attribute beside it is what makes the full text readable when it does.",flex:"1",minWidth:"0",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontFamily:"var(--font-mono)",fontSize:"var(--jx-text-xs)",color:"var(--fg-dim)"},'& [part="empty"]':{$description:"The compact teaching state, drawn here rather than by `panels/empty-state.ts`: that helper is a lit template, and a surface is a document or a lit template and never a mix. It keeps the compact variant's shape — left-aligned, above the add form that IS its action, so it offers no button of its own (empty-state rule 2's stated exception).",margin:"0",padding:"var(--jx-space-3) var(--jx-space-4)",maxWidth:"34ch",lineHeight:"1.5",color:"var(--fg-dim)"},'& [part="add"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",padding:"var(--jx-space-2)"},'& [part="field"]':{flex:"1",minWidth:"0"},'& [part="picker"]':{width:"100%"},'& [part="component-label"]':{fontFamily:"var(--font-mono)"}},children:[{tagName:"div",attributes:{part:"mood-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/mode"},cases:{site:{tagName:"div",attributes:{part:"section","data-section":"modules"},children:[{tagName:"div",attributes:{part:"section-header"},children:[{tagName:"span",attributes:{part:"title"},textContent:"Imported Modules"},{tagName:"span",attributes:{part:"count"},textContent:"${state.moduleCount}"}]},{tagName:"div",attributes:{part:"modules-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/moduleState"},cases:{empty:{tagName:"p",attributes:{part:"empty"},textContent:"Imported modules give this project extra kinds of data — a content collection, a CMS, an API client. Name one below."},listed:{tagName:"div",attributes:{part:"list"},children:[{$prototype:"Array",items:{$ref:"#/state/modules"},key:{$ref:"$map/item/name"},map:{tagName:"div",attributes:{part:"row","data-import":"${$map.item.name}"},children:[{tagName:"span",attributes:{part:"name",title:"${$map.item.path}"},textContent:"${$map.item.name}"},{tagName:"span",attributes:{part:"path"},textContent:"${$map.item.path}"},{tagName:"jx-action-button",attributes:{part:"remove"},$props:{icon:"x",size:"sm",quiet:!0,label:"Remove the ${$map.item.name} import",hint:"Remove"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/removeModule"},value:[{$ref:"$map/item/name"}]}]}}]}}]}}},{tagName:"div",attributes:{part:"add","data-add":"import"},children:[{tagName:"jx-textfield",attributes:{part:"field","data-field":"name"},$props:{label:"Import name",placeholder:"Name",size:"sm",value:{$ref:"#/state/addName"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editName"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"jx-textfield",attributes:{part:"field","data-field":"path"},$props:{label:"Import path",placeholder:"Path",size:"sm",mono:!0,value:{$ref:"#/state/addPath"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editPath"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"jx-action-button",attributes:{part:"add-button","data-add":"import"},$props:{icon:"plus",size:"sm",quiet:!0,label:"Add import",hint:"Add import"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/addModule"},value:[]}]}}]}]},document:{tagName:"div",attributes:{part:"section","data-section":"refs"},children:[{tagName:"div",attributes:{part:"section-header"},children:[{tagName:"span",attributes:{part:"title"},textContent:"Components"},{tagName:"span",attributes:{part:"count"},textContent:"${state.refCount}"}]},{tagName:"div",attributes:{part:"refs-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/refState"},cases:{empty:{tagName:"p",attributes:{part:"empty"},textContent:"${state.refEmptyMessage}"},listed:{tagName:"div",attributes:{part:"list"},children:[{$prototype:"Array",items:{$ref:"#/state/refs"},key:{$ref:"$map/item/ref"},map:{tagName:"div",attributes:{part:"row","data-ref":"${$map.item.ref}"},children:[{tagName:"span",attributes:{part:"path",title:"${$map.item.ref}"},textContent:"${$map.item.ref}"},{tagName:"jx-action-button",attributes:{part:"remove"},$props:{icon:"x",size:"sm",quiet:!0,label:"Remove the ${$map.item.ref} import",hint:"Remove"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/removeRef"},value:[{$ref:"$map/item/ref"}]}]}}]}}]}}},{tagName:"div",attributes:{part:"picker-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasOptions"},cases:{true:{tagName:"div",attributes:{part:"add","data-add":"component"},children:[{tagName:"jx-select",attributes:{part:"picker"},$props:{label:"Add component",size:"sm",options:{$ref:"#/state/pickerOptions"},value:{$ref:"#/state/pickerValue"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/pick"},value:[{$ref:"event#/target/value"}]}]}}]}}}]}}},{$prototype:"Array",items:{$ref:"#/state/packages"},key:{$ref:"$map/item/name"},map:{tagName:"div",attributes:{part:"section","data-package":"${$map.item.name}"},children:[{tagName:"div",attributes:{part:"section-header"},children:[{tagName:"span",attributes:{part:"title","data-mono":"true"},textContent:"${$map.item.name}"},{tagName:"div",attributes:{part:"remove-package-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/canRemove"},cases:{true:{tagName:"jx-action-button",attributes:{part:"remove-package"},$props:{icon:"x",size:"sm",quiet:!0,label:"Remove the ${$map.item.name} package",hint:"Remove package"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/removePackage"},value:[{$ref:"$map/item/name"}]}]}}}}]},{tagName:"div",attributes:{part:"components"},children:[{$prototype:"Array",items:{$ref:"$map/item/components"},key:{$ref:"$map/item/id"},map:{tagName:"div",attributes:{part:"row","data-component":"${$map.item.id}"},children:[{tagName:"jx-checkbox",attributes:{part:"component"},$props:{size:"sm",checked:{$ref:"$map/item/enabled"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/toggleComponent"},value:[{$ref:"$map/item/id"},{$ref:"event#/target/checked"}]}]},children:[{tagName:"span",attributes:{part:"component-label"},textContent:"${$map.item.label}"}]}]}}]}]}},{tagName:"div",attributes:{part:"dependency-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/mode"},cases:{site:{tagName:"div",attributes:{part:"section","data-section":"add-dependency"},children:[{tagName:"div",attributes:{part:"section-header"},children:[{tagName:"span",attributes:{part:"title"},textContent:"Add Dependency"}]},{tagName:"div",attributes:{part:"add","data-add":"package"},children:[{tagName:"jx-textfield",attributes:{part:"field","data-field":"package"},$props:{label:"Package name",placeholder:"Package name…",size:"sm",value:{$ref:"#/state/addPackageValue"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editPackage"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/addPackage"},value:[]}]}}]}},{tagName:"jx-action-button",attributes:{part:"add-button","data-add":"package"},$props:{icon:"plus",size:"sm",quiet:!0,label:"Add package",hint:"Add package"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/addPackage"},value:[]}]}}]}]}}}]};E("panel-imports",MC);var DC=new WeakMap,EB={label:"Add component…",value:""};function BC(e){return{...e,hasOptions:e.pickerOptions.length>0,moduleCount:e.modules.length,moduleState:e.modules.length===0?"empty":"listed",pickerOptions:[EB,...e.pickerOptions],refCount:e.refs.length,refState:e.refs.length===0?"empty":"listed"}}function qC(e,t,r){let o=DC.get(e);if(o&&(o.handle===null||o.handle.root.isConnected)){Object.assign(o.scope,BC(t));return}o?.handle?.dispose(),e.textContent="";let a=g({...BC(t),...r}),i={handle:null,scope:a};DC.set(e,i),R("panel-imports",a,e).then((s)=>{i.handle=s})}var $c=null,Sc=null,Xo="",Qo="",Zo="",Cc="",Qf=new Map;function NB(e,t){return`${e}::${t.tagName}`}function jB(){let e=new Map;for(let t of Ne){if(t.source!=="npm"||!t.package||!t.modulePath)continue;let r=e.get(t.package);if(!r)r=[],e.set(t.package,r);r.push(t)}return e}function Zf(){return C?.projectConfig?.$elements??[]}function UC(e,t,r){return Qf.clear(),[...jB().entries()].map(([o,a])=>({canRemove:r,components:a.map((i)=>{let s=NB(o,i);return Qf.set(s,i),{enabled:KL(e,i,t),id:s,label:`<${i.tagName}>`}}),name:o}))}function RB(){let e=C?.projectConfig?.imports??{};return{addName:Xo,addPackageValue:Zo,addPath:Qo,mode:"site",modules:Object.entries(e).map(([t,r])=>({name:t,path:String(r)})),packages:UC(Zf(),null,!0),pickerOptions:[],pickerValue:"",refEmptyMessage:"",refs:[]}}function AB(e){let{documentElements:t,documentPath:r}=e,o=t.flatMap((l)=>{let f=_(l)?l.$ref:void 0;return n(f)?[{ref:f}]:[]}),a=t.filter((l)=>n(l)),i=new Set(o.map((l)=>l.ref)),s=Ne.filter((l)=>l.source!=="npm"&&l.path!=null&&!i.has(`./${l.path}`)&&!i.has(l.path)).map((l)=>({label:`<${l.tagName}>`,value:l.tagName}));return{addName:Xo,addPackageValue:Zo,addPath:Qo,mode:"document",modules:[],packages:UC(a,r,!1),pickerOptions:s,pickerValue:Cc,refEmptyMessage:s.length>0?"Components you add here can be dropped onto this page. Pick one below.":"Components you add here can be dropped onto this page. "+"This project has none yet — create one from any selection on the canvas.",refs:o}}function IB(e){return e.documentPath?.endsWith("project.json")?RB():AB(e)}function zn(){if(!$c||!Sc)return;qC($c,IB(Sc),HB)}function Jr(){return Sc}async function LB(){let e=Xo.trim(),t=Qo.trim();if(!e||!t)return;let r=C?.projectConfig?.imports??{};Xo="",Qo="",zn(),await no({imports:{...r,[e]:t}}),Jr()?.renderLeftPanel()}async function OB(e){let t={...C?.projectConfig?.imports};delete t[e],await no({imports:t}),Jr()?.renderLeftPanel()}async function MB(){let e=Zo.trim();if(!e)return;Zo="",zn();try{await p().addPackage(e);let{loadComponentRegistry:t}=await (ce("w5zqwva1"),import("./chunks/components-w5zqwva1.js"));await t(),Jr()?.renderLeftPanel()}catch(t){console.error("Failed to add package:",t)}}async function DB(e){if(!await qo("Remove Package",`Remove ${e}?`,{confirmLabel:"Remove",destructive:!0}))return;try{await p().removePackage(e);let r=WA(Zf(),e),{loadComponentRegistry:o}=await (ce("w5zqwva1"),import("./chunks/components-w5zqwva1.js"));await o(),await no({$elements:r}),Jr()?.renderLeftPanel()}catch(r){console.error("Failed to remove package:",r)}}async function FB(e,t){let r=Jr(),o=Qf.get(e);if(!r||!o)return;if(r.documentPath?.endsWith("project.json")){let a=Zf(),i=t?Kb(a,o,null):JL(a,o,null);await no({$elements:i}),r.renderLeftPanel();return}r.applyMutation((a)=>{let i=a.$elements??[];a.$elements=t?Kb(i,o,r.documentPath):JL(i,o,r.documentPath)}),r.renderLeftPanel()}function _B(e){let t=Jr();if(Cc=e,zn(),Cc="",zn(),!t||!e)return;let r=Ne.find((o)=>o.tagName===e);if(!r?.path)return;t.applyMutation((o)=>{o.$elements=Kb(o.$elements??[],r,t.documentPath)}),t.renderLeftPanel()}function zB(e){let t=Jr();if(!t)return;t.applyMutation((r)=>{r.$elements=VA(r.$elements??[],e)}),t.renderLeftPanel()}var HB={addModule:()=>{LB()},addPackage:()=>{MB()},editName:(e)=>{Xo=e,zn()},editPackage:(e)=>{Zo=e,zn()},editPath:(e)=>{Qo=e,zn()},pick:_B,removeModule:(e)=>{OB(e)},removePackage:(e)=>{DB(e)},removeRef:zB,toggleComponent:(e,t)=>{FB(e,t)}};function BB(e,t){if(e!==$c)Xo="",Qo="",Zo="",Cc="";$c=e,Sc=t,zn()}function VB(e){return e.querySelector(".panel-content")??e}function JC(){ei({id:"packages",title:"Packages",level:"document",dock:"navigator",icon:"cube",rail:"developer",requiresDocument:"Open a page to choose which components it can use.",render:()=>ft,afterRender:(e,t)=>{BB(VB(t),{applyMutation:(r)=>{Yd(h.value,r)},documentElements:e.doc?.document.$elements??[],documentPath:e.doc?.documentPath??null,renderLeftPanel:e.rerender})}})}var GC={$schema:"https://jxsuite.com/schema/v1",$id:"StudioPanelProblems",$description:"The Bottom dock's Problems tab: everything that must be fixed, listed until it is. The adapter hands in one projection per row — its severity glyph, its message, the file it names, the captured log, and, where a recovery command exists, that command's own title and gate — grouped under the source that raised them in first-seen order. Nothing here reads the notification store or the command registry; a row asks the host to open, to run, or to dismiss, by the id it was given.",tagName:"div",attributes:{part:"panel"},style:{$description:"What `.problems-panel`, `.problems-clear`, `.problem-group`, `.problem-group-title`, `.problem-list`, `.problem-row`, `.problem-icon`, `.problem-body`, `.problem-message`, `.problem-path`, `.problem-detail`, `.problem-action` and `.problem-dismiss` said in `styles/panels.css`, keyed on `part` and re-pointed at the studio token layer. Six of those rules are SHARED SELECTORS — `.problems-clear, .activity-clear` and five `.problem-*, .activity-*` pairs — so this document carries its own copy rather than moving one: the `.problem-*` half of each pair is dead the moment this lands, and the stylesheet rule itself can only go when the Activity panel has moved too. Nothing is deleted from `styles/panels.css` here. Three token names could not come with the declarations: `var(--spectrum-font-size-50, 11px)` (the Clear button, the group heading, the path and the log), `var(--spectrum-font-size-75, 12px)` (the row) and `var(--spectrum-corner-radius-75, 2px)` (three rules). Every one of them resolves only inside `<sp-theme>`, and a document mounted in the dock body would have taken the hard-coded fallback every time, so they are the kit's `--jx-text-sm`, `--jx-text-md` and `--jx-radius-xs` instead.",display:"flex",flexDirection:"column",minHeight:"0",fontFamily:"var(--jx-font-sans)",color:"var(--fg)",'& [part="body"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-3)",padding:"var(--jx-space-3)"},'& [part="actions"]':{display:"flex",justifyContent:"flex-end"},'& [part="clear"] > [part="control"]':{$description:"Bordered but unfilled, and dimmed until it is wanted: emptying the list is the one destructive control on this surface and it sits above rows the reader has not finished reading yet.",padding:"0 var(--jx-space-3)",border:"1px solid var(--border)",borderRadius:"var(--jx-radius-xs)",background:"transparent",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)",":hover":{color:"var(--fg)",background:"var(--hover-bg)"}},'& [part="group"]':{$description:"One source's rows, under its heading. A section rather than a run of rows so the heading and the problems it names cannot be separated by a scroll position.",display:"flex",flexDirection:"column",gap:"var(--jx-space-2)"},'& [part="group-title"]':{margin:"0 0 var(--jx-space-1)",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)",fontWeight:"700",textTransform:"uppercase",letterSpacing:"0.04em"},'& [part="list"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-2)",margin:"0",padding:"0",listStyle:"none"},'& [part="row"]':{display:"flex",alignItems:"flex-start",gap:"var(--jx-space-3)",padding:"6px var(--jx-space-3)",border:"1px solid var(--border)",borderLeft:"3px solid var(--fg-dim)",borderRadius:"var(--radius)",background:"var(--bg-panel)",color:"var(--fg)",fontSize:"var(--jx-text-md)"},'& [part="row"][data-severity="success"]':{borderLeftColor:"var(--success)"},'& [part="row"][data-severity="info"]':{borderLeftColor:"var(--accent)"},'& [part="row"][data-severity="warn"]':{borderLeftColor:"var(--warning)"},'& [part="row"][data-severity="error"]':{borderLeftColor:"var(--danger)"},'& [part="row"] > [part="icon"]':{$description:"The severity, twice: as the glyph and as the row's left edge. Colour is never the only encoding here, which is what keeps the row readable in the forced-colours block below, where every author colour is replaced by the user's palette.",flex:"none",width:"14px",textAlign:"center",fontWeight:"700",lineHeight:"1.5"},'& [part="row"][data-severity="success"] > [part="icon"]':{color:"var(--success)"},'& [part="row"][data-severity="info"] > [part="icon"]':{color:"var(--accent)"},'& [part="row"][data-severity="warn"] > [part="icon"]':{color:"var(--warning)"},'& [part="row"][data-severity="error"] > [part="icon"]':{color:"var(--danger)"},'& [part="row-body"]':{flex:"1",minWidth:"0",display:"flex",flexDirection:"column",gap:"var(--jx-space-1)"},'& [part="message"]':{overflowWrap:"anywhere"},'& [part="file-path"]':{$description:'The path is a control, not a label: it opens the file the problem is about, which is the click-through §16.1 asks for. Underlined on hover only — a permanently underlined path in a dense list reads as a paragraph of links. A plain button rather than a `jx-button`, for the reason the status bar\'s items are: what it has to look like is a line of text, and every fill, border and control height the kit draws would have to be taken back off again. Named `file-path` and not `path` because `jx-icon` puts `part="path"` on the `<path>` of every glyph it draws, so `[part="path"]` inside a row selects this button and both SVG paths beside it — a styling rule that reaches into the kit\'s own drawing, and a test or a devtools query that cannot tell them apart.',alignSelf:"flex-start",maxWidth:"100%",overflow:"hidden",margin:"0",padding:"0",border:"none",borderRadius:"var(--jx-radius-xs)",background:"none",color:"var(--accent)",font:"inherit",fontFamily:"var(--font-mono)",fontSize:"var(--jx-text-sm)",textOverflow:"ellipsis",whiteSpace:"nowrap",textAlign:"left",cursor:"pointer",":hover":{textDecoration:"underline"},":focus-visible":{outline:"var(--jx-focus-ring)",outlineOffset:"2px"}},'& [part="detail"]':{$description:"The captured log the progress modal used to own. It scrolls inside the row rather than growing it, so one 400-line `bun install` failure does not become the whole panel. It is the one part of a problem row that is selectable against the root's `user-select: none`: the log is what a reader pastes into a bug report, and the row offers no copy action.",userSelect:"text",maxHeight:"180px",margin:"var(--jx-space-1) 0 0",padding:"6px",overflow:"auto",borderRadius:"var(--jx-radius-xs)",background:"var(--bg)",color:"var(--fg-dim)",fontFamily:"var(--font-mono)",fontSize:"var(--jx-text-sm)",whiteSpace:"pre-wrap"},'& [part="action"]':{flex:"none"},'& [part="action"] > [part="control"]':{$description:"The recovery button wears the command's own title, so it is read as a verb and not as a decoration: the accent says it acts, and a refused command is dimmed with the reason it names in its tooltip.",border:"1px solid var(--border)",borderRadius:"var(--jx-radius-xs)",background:"transparent",color:"var(--accent)",":hover:not(:disabled)":{background:"var(--hover-bg)"},":disabled":{color:"var(--fg-dim)"}},'& [part="dismiss"]':{flex:"none"},'& [part="empty"]':{$description:"The teaching empty state, drawn here rather than borrowed from `panels/empty-state.ts`: that helper is a lit template, and a document cannot call one. What is kept is the pattern's rules (studio-ui-guidelines.md §11) — one sentence saying what the region is FOR, then where its content comes from. It offers no action, because the action that fills this region is a failure and nothing here should invite one.",display:"flex",flexDirection:"column",alignItems:"center",gap:"var(--jx-space-3)",padding:"var(--jx-space-6)",textAlign:"center",color:"var(--fg-dim)",fontSize:"13px"},'& [part="empty-message"], & [part="empty-detail"]':{margin:"0",maxWidth:"34ch",lineHeight:"1.5"},'& [part="empty-detail"]':{fontSize:"var(--jx-text-sm)",opacity:"0.8"},"@(forced-colors: active)":{'& [part="row"]':{$description:"The severity bar, redrawn. In forced colours every author colour is replaced by one from the user's palette, so the four left-edge colours collapse into one and the row loses the marker `styles/forced-colors.css` restored for `.problem-row` while this surface was lit.",borderLeft:"2px solid Highlight"}}},children:[{tagName:"div",attributes:{part:"body-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasProblems"},cases:{false:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",attributes:{part:"empty-message"},textContent:"Nothing needs fixing."},{tagName:"p",attributes:{part:"empty-detail"},textContent:"Failed writes, validation errors and render failures are listed here until fixed."}]},true:{tagName:"div",attributes:{part:"body"},children:[{tagName:"div",attributes:{part:"actions"},children:[{tagName:"jx-button",$props:{size:"sm"},attributes:{part:"clear"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/clearAll"}}]},children:[{tagName:"span",textContent:"${state.clearLabel}"}]}]},{$prototype:"Array",items:{$ref:"#/state/groups"},key:{$ref:"$map/item/source"},map:{tagName:"section",attributes:{part:"group","data-source":"${$map.item.source}"},children:[{tagName:"h3",attributes:{part:"group-title"},textContent:"${$map.item.source}"},{tagName:"ul",attributes:{part:"list"},children:[{$prototype:"Array",items:{$ref:"$map/item/rows"},key:{$ref:"$map/item/id"},map:{tagName:"li",attributes:{part:"row","data-severity":"${$map.item.severity}"},children:[{tagName:"span",attributes:{part:"icon","aria-hidden":"true"},textContent:"${$map.item.icon}"},{tagName:"div",attributes:{part:"row-body"},children:[{tagName:"div",attributes:{part:"message"},textContent:"${$map.item.message}"},{tagName:"span",attributes:{part:"file-path-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasPath"},cases:{true:{tagName:"button",attributes:{part:"file-path",type:"button",title:"${$map.item.pathTitle}"},textContent:"${$map.item.path}",onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openPath"},value:[{$ref:"$map/item/path"}]}]}}}},{tagName:"span",attributes:{part:"detail-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasDetail"},cases:{true:{tagName:"pre",attributes:{part:"detail"},textContent:"${$map.item.detail}"}}}]},{tagName:"span",attributes:{part:"action-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasAction"},cases:{true:{tagName:"jx-button",$props:{size:"sm",disabled:{$ref:"$map/item/actionDisabled"}},attributes:{part:"action",title:"${$map.item.actionTitle}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/runAction"},value:[{$ref:"$map/item/id"}]}]},children:[{tagName:"span",textContent:"${$map.item.actionLabel}"}]}}},{tagName:"jx-action-button",$props:{size:"sm",icon:"x",hint:"Dismiss",label:{$ref:"$map/item/dismissLabel"}},attributes:{part:"dismiss"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/dismissRow"},value:[{$ref:"$map/item/id"}]}]}}]}}]}]}}]}}}]};E("panel-problems",GC);function KC(e,t){e.hasProblems=t.hasProblems,e.clearLabel=t.clearLabel,e.groups=t.groups}function YC(e,t,r){let o=g({clearAll:r.clearAll,clearLabel:"",dismissRow:r.dismissRow,groups:[],hasProblems:!1,openPath:r.openPath,runAction:r.runAction});KC(o,t);let a=null,i=!1;return R("panel-problems",o,e).then((s)=>{if(i){s.dispose();return}a=s}),{connected:()=>!i&&(a===null||a.root.parentNode===e),dispose(){i=!0,a?.dispose(),a=null},update:(s)=>{KC(o,s)}}}var qB={error:"✕",info:"ℹ",success:"✓",warn:"!"},UB="Elsewhere";function JB(e=ta){let t=[];for(let r of e){let o=r.source??UB,a=t.find((i)=>i.source===o);if(a)a.records.push(r);else t.push({records:[r],source:o})}return t}function GB(e){(ce("t07yqqej"),import("./chunks/files-t07yqqej.js")).then((t)=>t.openFileInTab(e))}function KB(e){let t=e.action,r=t===void 0?null:ae(),o=r&&t!==void 0?r.get(t):void 0,a=o&&t!==void 0&&r.isVisible(t)?o:null,i=a&&t!==void 0?r.disabledReason(t):void 0;return{actionDisabled:i!==void 0,actionLabel:a?.title??"",actionTitle:a===null?"":i===void 0?a.title:`${a.title} — requires ${i}`,detail:e.detail??"",dismissLabel:`Dismiss: ${e.message}`,hasAction:a!==null,hasDetail:Boolean(e.detail),hasPath:Boolean(e.path),icon:qB[e.severity],id:e.id,message:e.message,path:e.path??"",pathTitle:`Open ${e.path??""}`,severity:e.severity}}function QC(){let e=JB().map((t)=>({rows:t.records.map((r)=>KB(r)),source:t.source}));return{clearLabel:`Clear ${Iv()}`,groups:e,hasProblems:e.length>0}}var YB={clearAll:()=>{yl()},dismissRow:(e)=>{$h(e)},openPath:(e)=>{GB(e)},runAction:(e)=>{let t=ta.find((o)=>o.id===e),r=ae();if(t?.action===void 0||!r)return;Tn(r,t.action,t.actionArgs,"Problems")}},Yr=null,oh=!1;function eT(){if(!Yr)return;Yr.scope.stop(),Yr.handle.dispose(),Yr=null}function XB(e){let t=oh;if(oh=!1,!t){eT();return}if(Yr?.host===e&&Yr.handle.connected())return;eT();let r=YC(e,QC(),YB),o=me();o.run(()=>{te(()=>{ae(),r.update(QC())})}),Yr={handle:r,host:e,scope:o}}function tT(){ei({id:"problems",title:"Problems",level:"project",dock:"bottom",rail:!1,icon:"warning-circle",badge:()=>Iv()||null,render:()=>(oh=!0,ft),afterRender:(e,t)=>{XB(t)}})}var nT={$schema:"https://jxsuite.com/schema/v1",$id:"StudioBottomDock",$description:"The Bottom dock's chrome (studio.md §16.3) as a Jx document over the kit: a real `tablist` of the dock's tabs, the button that shuts it, and ONE `tabpanel` for whichever tab is showing. Every tab names that one panel — the dock draws the selected tab's body and no other, so there is exactly one panel element and its `aria-labelledby` follows the selection, which is the same shape `surfaces/publish-workspace.json` uses for its four sub-tabs. It draws no tab BODY: `panels/bottom-dock.ts` keeps the panel registry, the `when` filter, the badge in each tab's label, the Logic reveal and every tab's `afterRender`, and renders the active record into the one empty `[part=\"dock-body\"]` island this document leaves for it (studio-ui-guidelines.md §9.4).",tagName:"div",attributes:{part:"bottom-dock"},style:{$description:"`styles/shell.css`'s four `.bd-*` rules, keyed on `part` and carried here — plus the flex column `#bottom-dock` itself was, because the document root is now the box between the shell cell and the strip and a column that stopped one level up would leave the body unable to scroll. Two rules are DELETED rather than moved: the close button's own padding, radius, hover fill and pointer are `jx-action-button`, and the strip's selected-tab underline is `jx-tab`.",display:"flex",flexDirection:"column",height:"100%",minHeight:"0",fontFamily:"var(--jx-font-sans)",color:"var(--fg)",'& [part="strip"]':{display:"flex",flexShrink:"0",alignItems:"center",gap:"var(--jx-space-1)",padding:"0 var(--jx-space-1)",borderBottom:"1px solid var(--border)"},'& [part="tabs"]':{flex:"1",minWidth:"0",border:"0",overflowX:"auto",fontSize:"var(--jx-text-sm)"},'& [part="close"]':{flexShrink:"0"},'& [part="panel"]':{$description:"The one scrolling region. `min-height: 0` because a flex item's auto minimum is its content, which would push the dock past its own track instead of scrolling inside it.",flex:"1",minHeight:"0",padding:"0",overflowY:"auto"},'& [part="dock-body"]':{display:"block",minHeight:"0"}},children:[{tagName:"div",attributes:{part:"strip"},children:[{tagName:"jx-tabs",attributes:{part:"tabs",selected:"${state.tab}"},$props:{label:"Bottom dock"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/selectTab"},value:[{$ref:"event#/detail"}]}]},children:[{$prototype:"Array",items:{$ref:"#/state/tabs"},key:{$ref:"$map/item/key"},map:{tagName:"jx-tab",attributes:{part:"tab",id:"${$map.item.tabId}","data-tab":"${$map.item.key}",value:"${$map.item.key}",label:"${$map.item.label}",panel:"bottom-dock-panel"}}}]},{tagName:"jx-action-button",attributes:{part:"close","data-action":"close"},$props:{icon:"x",size:"sm",quiet:!0,label:"Close the Bottom dock",hint:"Close the Bottom dock"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closeDock"},value:[]}]}}]},{tagName:"jx-tab-panel",attributes:{part:"panel",id:"bottom-dock-panel"},$props:{active:!0,labelledby:{$ref:"#/state/tabId"}},children:[{$description:"The island, and it stays empty: every tab of this dock is a `PanelRecord` whose `render` returns a lit template, so `panels/bottom-dock.ts` paints here and runs each tab's `afterRender` against this element. It is a slotted child rather than the panel itself because `jx-tab-panel` distributes its own slot.",tagName:"div",attributes:{part:"dock-body","data-jx-region":"${state.bodyRegion || null}"}}]}]};E("bottom-dock",nT);function ZB(e,t){e.tab=t.tab,e.tabId=t.tabId,e.bodyRegion=t.bodyRegion,e.tabs=t.tabs}function eV(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function rT(e,t,r,o){let a=g({...t,...r});e.textContent="",delete e._$litPart$;let i=null,s=!1;return R("bottom-dock",a,e,{onNodeCreated:(l,f,c)=>{if(l instanceof HTMLElement&&eV(c)==="dock-body")o.onBody(l)}}).then((l)=>{if(s){l.dispose();return}i=l}),{dispose(){s=!0,i?.dispose(),i=null},update:(l)=>{ZB(a,l)}}}var tV="#bottom-dock";function ph(){if(rx("bottom").length>0)return;tT(),UD(),nA()}function sT(){ph();let e=[];for(let t of Tx){let r=Np(t);if(r)e.push(r)}return e}function cT(e=th()){return sT().filter((t)=>sx(t,e))}function mh(e=th()){let t=cT(e),r=j$(u.bottomTab)?u.bottomTab:F$;return t.find((o)=>o.id===r)??t[0]??null}function dT(){return{deps:{},doc:null,rerender:pT}}function nV(e,t){let r=e.badge?.(t)??null;return r===null||r===0||r===""?e.title:`${e.title} ${r}`}function aT(e=th()){let t=mh(e);return{bodyRegion:t?u0(t.id):"",tab:t?.id??"",tabId:t?`bottom-dock-tab-${t.id}`:"",tabs:cT(e).map((r)=>({key:r.id,label:nV(r,e),tabId:`bottom-dock-tab-${r.id}`}))}}var Ri=null,yt=null,Xr=null,Ai=null,ih=null;function rV(){let e=mw();return e?`${e.surface} ${JSON.stringify(e.editing)}`:null}function pT(){if(!yt)return;if(u.docks.bottom.collapsed){yt.removeAttribute(Ve),Xr?.dispose(),Xr=null,Ai=null,fh(yt);return}if(yt.setAttribute(Ve,"dock.bottom"),!Xr){Xr=rT(yt,aT(),{closeDock:()=>{ko("bottom",!0)},selectTab:(e)=>{if(e!==""&&e!==mh()?.id)uh(e)}},{onBody:(e)=>{Ai=e,queueMicrotask(()=>{if(Ai===e)iT()})}});return}Xr.update(aT()),iT()}function iT(){let e=Ai;if(!e)return;let t=mh();io(t?t.render(dT()):Pu(e,{message:"Nothing to show here yet."}),e),fh(e)}function fh(e){let t=dT();for(let r of sT())r.afterRender?.(t,e)}function oV(){if(Ri)return;if(yt=document.querySelector(tV),!yt)return;Ri=me(),Ri.run(()=>{te(()=>{let e=rV();if(e!==null&&e!==ih)HE();ih=e}),te(()=>{u.docks.bottom.collapsed,u.bottomTab,pT()})})}nv({mount:oV,unmount:aV});function aV(){if(Ri?.stop(),Ri=null,ih=null,Xr?.dispose(),Xr=null,Ai=null,yt)yt.removeAttribute(Ve),io(ft,yt),yt.textContent="",fh(yt),yt=null}var uT={$schema:"https://jxsuite.com/schema/v1",$id:"StudioCollectionsPanel",$description:"The Collections panel (specs/studio.md §22.5): the Content workspace's Navigator. With no entry being written it lists the built-in Pages and every collection the project declares, each with its entry count and its saved grid views beneath it, and **+ New collection** at the foot; choosing a collection shows it in the Content home. While an entry is being written it lists that collection's entries instead (thumbnail, title, status) under **‹ <Collection>** to go back, with **+ New <item>** at the foot. `panels/collections-panel.ts` keeps every decision; this document draws rows whose every field is already a string.",tagName:"div",attributes:{part:"collections"},style:{$description:"The Collections panel's own look, keyed on `part`. Rows are native buttons, because a row opens one thing and a button is the element that says so to every reader; the selected row is the one whose `data-selected` is true, which the flow sets from what the focused pane shows. A collection's saved views are indented under it, and the entries list leads with a back row, the Content-Entry board's list.",display:"flex",flexDirection:"column",height:"100%",minHeight:"0",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",'& [part="list"], & [part="entries"]':{display:"flex",flexDirection:"column",flex:"1",minHeight:"0",overflowY:"auto",padding:"var(--jx-space-2) 0 var(--jx-space-4)"},'& [part="rows"], & [part="views"]':{display:"flex",flexDirection:"column"},'& [part="views"][hidden]':{display:"none"},'& [part="collection-row"], & [part="view-row"], & [part="entry-row"], & [part="back"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",width:"100%",boxSizing:"border-box",minHeight:"28px",padding:"var(--jx-space-1) var(--jx-space-3)",border:"none",background:"transparent",color:"inherit",font:"inherit",textAlign:"start",cursor:"pointer",":hover":{background:"var(--hover-bg)"},":focus-visible":{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"}},'& [part="view-row"]':{paddingLeft:"calc(var(--jx-space-3) + var(--jx-space-4))",color:"var(--fg-dim)"},'& [part="back"]':{fontWeight:"600",borderBottom:"1px solid var(--border)",marginBottom:"var(--jx-space-1)"},'& [data-selected="true"]':{background:"var(--accent-15)",color:"var(--fg)"},'& [part="row-label"]':{flex:"1",minWidth:"0",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="row-count"]':{flexShrink:"0",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)",fontVariantNumeric:"tabular-nums"},'& [part="view-glyph"], & [part="back-glyph"]':{flexShrink:"0",color:"var(--fg-dim)"},'& [part="entry-row"]':{minHeight:"44px"},'& [part="entry-art"]':{display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0",width:"36px",height:"36px",overflow:"hidden",borderRadius:"var(--jx-radius-md)",background:"var(--bg-panel)",border:"1px solid var(--border)"},'& [part="entry-thumb"]':{width:"100%",height:"100%",objectFit:"cover"},'& [part="entry-glyph"]':{color:"var(--fg-dim)"},'& [part="entry-text"]':{display:"flex",flexDirection:"column",flex:"1",minWidth:"0"},'& [part="entry-title"]':{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="entry-status"]':{fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="entry-status"]:empty':{display:"none"},'& [part="entry-locale"]':{fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="entry-locale"]:empty':{display:"none"},'& [part="entry-status"][data-status="Draft"]':{color:"var(--warning)"},'& [part="note"], & [part="no-project"]':{margin:"0",padding:"var(--jx-space-2) var(--jx-space-3)",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="foot"]':{padding:"var(--jx-space-2) var(--jx-space-2) 0"}},children:[{tagName:"div",attributes:{part:"body-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/body"},cases:{none:{tagName:"p",attributes:{part:"no-project"},textContent:"Open a project to see its pages and collections."},list:{tagName:"div",attributes:{part:"list"},children:[{tagName:"div",attributes:{part:"rows",role:"list"},children:[{$prototype:"Array",items:{$ref:"#/state/collections"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"collection",role:"listitem","data-collection":"${$map.item.key}"},children:[{tagName:"button",attributes:{part:"collection-row",type:"button","data-selected":"${$map.item.selected}","aria-current":"${$map.item.selected === 'true' ? 'true' : null}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/showCollection"},value:[{$ref:"$map/item/key"}]}]},children:[{tagName:"span",attributes:{part:"row-label"},textContent:"${$map.item.title}"},{tagName:"span",attributes:{part:"row-count"},textContent:"${$map.item.count}"}]},{tagName:"div",$description:'Hidden while the collection has no saved views: an empty list is still a list to a screen reader, announced as "Saved views, list, 0 items" under every collection.',attributes:{part:"views",role:"list","aria-label":"Saved views",hidden:"${$map.item.views.length > 0 ? null : ''}"},children:[{$prototype:"Array",items:{$ref:"$map/item/views"},key:{$ref:"$map/item/key"},map:{$description:"The list item. A button keeps its own role, so the item is the wrapper around it, as a collection row's is.",tagName:"div",attributes:{part:"view-item",role:"listitem"},children:[{tagName:"button",attributes:{part:"view-row",type:"button",title:"Open the grid on this saved view"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/applyView"},value:[{$ref:"$map/item/key"},{$ref:"$map/item/name"}]}]},children:[{tagName:"jx-icon",attributes:{part:"view-glyph"},$props:{name:"rows"}},{tagName:"span",attributes:{part:"row-label"},textContent:"${$map.item.name}"}]}]}}]}]}}]},{tagName:"div",attributes:{part:"foot"},children:[{tagName:"jx-action-button",attributes:{part:"new-collection"},$props:{size:"sm",quiet:!0,icon:"plus",haspopup:"dialog"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/newCollection"},value:[]}],description:'Add new on its Collection kind (`file.new { kind: "collection" }`).'},children:[{tagName:"span",textContent:"New collection"}]}]}]},entries:{tagName:"div",attributes:{part:"entries"},children:[{tagName:"button",attributes:{part:"back",type:"button",title:"Back to the collection","aria-label":"Back to ${state.backTitle}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/back"},value:[]}],description:"Back to the collection in the Content home (`content.showCollection`)."},children:[{tagName:"jx-icon",attributes:{part:"back-glyph"},$props:{name:"caret-left"}},{tagName:"span",attributes:{part:"row-label"},textContent:"${state.backTitle}"},{tagName:"span",attributes:{part:"row-count"},textContent:"${state.backCount}"}]},{tagName:"div",attributes:{part:"entries-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/entriesState"},cases:{loading:{tagName:"p",attributes:{part:"note"},textContent:"Reading the entries…"},empty:{tagName:"p",attributes:{part:"note"},textContent:"No entries yet."},listed:{tagName:"div",attributes:{part:"rows",role:"list"},children:[{$prototype:"Array",items:{$ref:"#/state/entries"},key:{$ref:"$map/item/path"},map:{$description:"The list item. A button keeps its own role, so the item is the wrapper around it, as a collection row's is.",tagName:"div",attributes:{part:"entry-item",role:"listitem"},children:[{tagName:"button",attributes:{part:"entry-row",type:"button","data-path":"${$map.item.path}","data-selected":"${$map.item.selected}","aria-current":"${$map.item.selected === 'true' ? 'true' : null}",title:"${$map.item.path}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openEntry"},value:[{$ref:"$map/item/path"}]}]},children:[{tagName:"span",attributes:{part:"entry-art"},children:[{tagName:"span",attributes:{part:"art-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/art"},cases:{image:{tagName:"img",attributes:{part:"entry-thumb",src:"${$map.item.thumb}",alt:"",loading:"lazy"}},glyph:{tagName:"jx-icon",attributes:{part:"entry-glyph"},$props:{name:"file-text"}}}}]},{tagName:"span",attributes:{part:"entry-text"},children:[{tagName:"span",attributes:{part:"entry-title"},textContent:"${$map.item.title}"},{tagName:"span",attributes:{part:"entry-status","data-status":"${$map.item.status}"},textContent:"${$map.item.status}"},{$description:"The language an entry of a multilingual collection is written in, by its autonym; empty, and not drawn, in a collection of one language.",tagName:"span",attributes:{part:"entry-locale",lang:"${$map.item.lang}"},textContent:"${$map.item.locale}"}]}]}]}}]}}},{tagName:"div",attributes:{part:"foot"},children:[{tagName:"jx-action-button",attributes:{part:"new-entry"},$props:{size:"sm",quiet:!0,icon:"plus",haspopup:"dialog"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/newEntry"},value:[]}],description:'Add new on its Entry kind, in this collection (`file.new { kind: "entry", collection }`).'},children:[{tagName:"span",textContent:"${state.newLabel}"}]}]}]}}}]};E("collections-panel",uT);function hh(){return{backTitle:"",backCount:"",body:"none",collections:[],entries:[],entriesState:"loading",newLabel:""}}function mT(e,t){e.body=t.body,e.collections=t.collections,e.backTitle=t.backTitle,e.backCount=t.backCount,e.entriesState=t.entriesState,e.entries=t.entries,e.newLabel=t.newLabel}function fT(e,t,r){let o=g({...hh(),...r});mT(o,t);let a=null,i=!1,s=R("collections-panel",o,e).then((l)=>{if(i)return l.dispose(),l;return a=l,l});return{connected:()=>{if(i)return!1;let l=a?.root;return l===void 0?!0:e.contains(l)},dispose(){i=!0,a?.dispose(),a=null},ready:s,update:(l)=>mT(o,l)}}var Ii="Collections";function bT(e){return e===hi?ss({kind:"pages"}):ss({kind:"collection",name:e})}function gh(e){let t=ec(e?.documentPath);return t!==null&&t!==hi&&!Ql(t)?.fileBacked?t:null}function sV(e){let t=ec(e.documentPath);return t!==null&&Ql(t)?.fileBacked===!0?t:null}function lV(e){if(!e)return null;if(e.id===$a("content"))return Fu();let t=Yl(e.id);if(t?.kind==="pages")return hi;return t?.kind==="collection"?t.name:sV(e)}function cV(e){let t=LE(),r=lV(e);return Om().map((o)=>{let a=t?.get(o.key);return{count:t===null?"":String(a??0),key:o.key,selected:o.key===r?"true":"false",title:o.title,views:Uu(bT(o.key)).map((i)=>({key:`${o.key}
|
|
5
|
-
${i.name}`,name:i.name}))}})}function gT(){let e=hh();if(!C)return e;let t=h.value,r=gh(t);if(r===null)return{...e,body:"list",collections:cV(t)};let o=Ql(r),a=LE(),i=J_(r),s=a===null?null:Cw(r,i),l=il(r).locale,f=(s??[]).flatMap((c)=>{let d=zc(c.path)??"";if(l!==""&&d!==l)return[];return[{art:c.thumb===""?"glyph":"image",lang:d,locale:d===""?"":Wt(d),path:c.path,selected:c.path===t?.documentPath?"true":"false",status:c.status,thumb:c.thumb,title:c.title}]});return{...e,backTitle:o?.title??r,backCount:a===null?"":String(i.length),body:"entries",entries:f,entriesState:s===null?"loading":f.length===0?"empty":"listed",newLabel:`New ${o?.item??"entry"}`}}async function dV(e,t){let r=bT(e),o=h.value?.id===r;if(Rw(r,t),o){await nt("grid.applyView",{name:t},Ii);return}let{openCollectionGrid:a,openPagesGrid:i}=await (ce("
|
|
6
|
-
`);dV(r,t)},back:()=>{let e=gh(h.value);if(e!==null)nt("content.showCollection",{collection:e},Ii)},newCollection:()=>{nt("file.new",{kind:"collection"},Ii)},newEntry:()=>{let e=gh(h.value);nt("file.new",e===null?{kind:"entry"}:{collection:e,kind:"entry",...uV(e)},Ii)},openEntry:(e)=>{Vl(e)},showCollection:(e)=>{nt("content.showCollection",{collection:e},Ii)}};function uV(e){let{i18n:t}=ln(C?.projectConfig??{}),r=h.value?.documentPath??null,a=(r===null?null:go(r,t))??il(e).locale;return a===""?{}:{locale:a}}var Xt=null,wh=null;function mV(){wn("leftPanel")}function fV(e){if(wh??=kw(mV),Xt&&(Xt.host!==e||!Xt.handle.connected()))Xt.handle.dispose(),Xt=null;if(Xt){Xt.handle.update(gT());return}Xt={handle:fT(e,gT(),pV),host:e}}function hV(e){return e.querySelector(".panel-content")??e}function yT(){ei({id:"collections",title:"Collections",level:"project",dock:"navigator",icon:"stack",rail:!1,render:()=>ft,afterRender:(e,t)=>{fV(hV(t))}})}function wT(){Xt?.handle.dispose(),Xt=null,wh?.(),wh=null}var xT={$schema:"https://jxsuite.com/schema/v1",$id:"StudioSettingsContexts",$description:"Project Settings › Contexts: the base width, and the three groups of `$media` entries — size breakpoints, colour schemes and feature queries — a project's pages may be rendered under. The adapter hands in `groups`, already classified and already carrying each row's refusal, plus the base width and the two whole-file messages; nothing here decides what a context IS. Every control is the kit's, so the `+` that used to be typed into an add button's text and the `×` that stood in for a remove icon are glyphs now rather than characters.",tagName:"div",attributes:{part:"contexts"},style:{$description:"What `.settings-media-list`, `.settings-media-row`, `.settings-media-name`, `.settings-media-name-fixed`, `.settings-media-value` and `.settings-section-notice` used to say in `styles/overlays.css`, keyed on `part` and re-pointed at the studio token layer. Those six were this section's alone and go with it. `.settings-section-title`, `.settings-field`, `.settings-field-label`, `.settings-field-desc` and `.settings-field-error` are NOT deleted with them: nine other settings sections are still lit and still name them, so those rules keep their stylesheet and this document carries its own copy of each until the last of those sections converts.",display:"block",'& [part="title"]':{margin:"0 0 16px",fontSize:"16px",fontWeight:"600",color:"var(--fg)"},'& [part="intro"], & [part="field-desc"], & [part="empty"]':{$description:"The 12px secondary line, three times: the section's own sentence, a group's sentence, and the sentence a group shows instead of rows. It read `var(--spectrum-font-size-75, 12px)`, which resolved only inside `<sp-theme>` — a document is mounted in the pane, where that name is not in scope and every one of them would have taken the hard-coded fallback.",margin:"0 0 6px",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"},'& [part="empty"]':{margin:"0"},'& [part="field"]':{marginBottom:"20px"},'& [part="field-label"]':{$description:"A heading, where the lit section had a `<label>` that named nothing: a group label sits over a LIST of controls, so `for` had nowhere to point and the element was a label in class name only. Each control carries its own name instead, and the reader gets a heading they can navigate by.",display:"block",margin:"0 0 2px",fontSize:"13px",fontWeight:"500",color:"var(--fg)"},'& [part="list"]':{display:"flex",flexDirection:"column",gap:"6px"},'& [part="row"]':{display:"flex",gap:"6px",alignItems:"center"},'& [part="name-fixed"]':{$description:"The base width's name column, which is a word rather than a field. It is the same 80px the editable name fields below it are, so the base row and the group rows line up down one edge.",width:"var(--jx-field-label-w)",fontSize:"var(--jx-text-md)",fontWeight:"500",color:"var(--fg-dim)",padding:"0 8px"},'& [part="name"]':{width:"var(--jx-field-label-w)",flex:"none"},'& [part="value"]':{flex:"1",minWidth:"0",width:"100%"},'& [part="value-slot"]':{$description:"The one cell a size row fills with a text field and a scheme row fills with a select. It is the `$switch` container, so it — not the control — is what the row's flex line measures.",display:"flex",flex:"1",minWidth:"0"},'& [part="row-error"]':{margin:"6px 0 0",fontSize:"var(--jx-text-md)",color:"var(--danger)"},'& [part="section-error"]':{margin:"6px 0 0",fontSize:"var(--jx-text-md)",color:"var(--danger)"},'& [part="notice"]':{$description:"A problem `project.json` already had, said once at section level. Deliberately not the danger colour: it refused nothing and it belongs to no control, so it is a warning about the file rather than a rejection of an edit.",margin:"6px 0 0",fontSize:"var(--jx-text-md)",color:"var(--warning)"}},children:[{tagName:"h3",attributes:{part:"title"},textContent:"Contexts"},{tagName:"p",attributes:{part:"intro"},textContent:"The conditions this project's pages are rendered under. Define them once here; choose between them on the pane's context control while you edit."},{tagName:"div",attributes:{part:"section-error-slot",role:"none"},$switch:{$ref:"#/state/hasSectionError"},cases:{true:{tagName:"p",attributes:{part:"section-error",role:"alert"},textContent:"${state.sectionError}"}}},{tagName:"div",attributes:{part:"notice-slot",role:"none"},$switch:{$ref:"#/state/hasNotice"},cases:{true:{tagName:"p",attributes:{part:"notice",role:"status"},textContent:"${state.notice}"}}},{tagName:"div",attributes:{part:"field"},children:[{tagName:"h4",attributes:{part:"field-label"},textContent:"Base width"},{tagName:"p",attributes:{part:"field-desc"},textContent:"How wide the canvas is when no other context applies. Styles written here apply everywhere."},{tagName:"div",attributes:{part:"row"},children:[{tagName:"span",attributes:{part:"name-fixed"},textContent:"Base"},{tagName:"jx-textfield",$props:{label:"Base width",value:{$ref:"#/state/base"},placeholder:"1280px",invalid:{$ref:"#/state/baseInvalid"},size:"sm"},attributes:{part:"value","data-context":"base"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setBase"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"div",attributes:{part:"base-error-slot",role:"none"},$switch:{$ref:"#/state/baseInvalid"},cases:{true:{tagName:"p",attributes:{part:"row-error",role:"alert"},textContent:"${state.baseError}"}}}]},{$prototype:"Array",items:{$ref:"#/state/groups"},key:{$ref:"$map/item/kind"},map:{tagName:"div",attributes:{part:"field","data-context-group":"${$map.item.kind}"},children:[{tagName:"h4",attributes:{part:"field-label"},textContent:"${$map.item.label}"},{tagName:"p",attributes:{part:"field-desc"},textContent:"${$map.item.desc}"},{tagName:"div",attributes:{part:"list-slot",role:"none"},$switch:{$ref:"$map/item/hasRows"},cases:{false:{tagName:"p",attributes:{part:"empty"},textContent:"${$map.item.empty}"},true:{tagName:"div",attributes:{part:"list"},children:[{$prototype:"Array",items:{$ref:"$map/item/rows"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"row-block","data-context":"${$map.item.key}"},children:[{tagName:"div",attributes:{part:"row"},children:[{tagName:"jx-textfield",$props:{label:{$ref:"$map/item/nameLabel"},value:{$ref:"$map/item/name"},placeholder:"name",invalid:{$ref:"$map/item/invalid"},size:"sm"},attributes:{part:"name"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/rename"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},{tagName:"div",attributes:{part:"value-slot",role:"none"},$switch:{$ref:"$map/item/control"},cases:{query:{tagName:"jx-textfield",$props:{label:{$ref:"$map/item/valueLabel"},value:{$ref:"$map/item/query"},placeholder:{$ref:"#/state/queryPlaceholder"},invalid:{$ref:"$map/item/invalid"},size:"sm"},attributes:{part:"value"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setQuery"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},scheme:{tagName:"jx-select",$props:{label:{$ref:"$map/item/valueLabel"},options:[{value:"light",label:"Light"},{value:"dark",label:"Dark"}],value:{$ref:"$map/item/scheme"},size:"sm"},attributes:{part:"value"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setScheme"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}}}},{tagName:"jx-action-button",$props:{label:{$ref:"$map/item/removeLabel"},hint:{$ref:"$map/item/removeLabel"},icon:"x",quiet:!0,size:"sm"},attributes:{part:"remove","data-remove":"${$map.item.key}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/remove"},value:[{$ref:"$map/item/key"}]}]}}]},{tagName:"div",attributes:{part:"row-error-slot",role:"none"},$switch:{$ref:"$map/item/invalid"},cases:{true:{tagName:"p",attributes:{part:"row-error",role:"alert"},textContent:"${$map.item.error}"}}}]}}]}}},{tagName:"jx-action-button",$props:{label:{$ref:"$map/item/addLabel"},icon:"plus",size:"sm"},attributes:{part:"add","data-add":"${$map.item.kind}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/add"},value:[{$ref:"$map/item/kind"}]}]},children:[{tagName:"span",textContent:"${$map.item.addLabel}"}]}]}}]};E("settings-contexts",xT);function bV(){return{base:"",baseError:"",baseInvalid:!1,groups:[],notice:"",queryPlaceholder:"",sectionError:""}}function TT(e,t){e.textContent="";let r=g({...bV(),add:t.add,hasNotice:!1,hasSectionError:!1,remove:t.remove,rename:t.rename,setBase:t.setBase,setQuery:t.setQuery,setScheme:t.setScheme}),o=null,a=!1,i=R("settings-contexts",r,e).then((s)=>{let l=s.root;if(a)return s.dispose(),l;return o=s,l});return{attached:()=>{if(a)return!1;let s=o?.root;return s===void 0?!0:s instanceof HTMLElement&&e.contains(s)},dispose(){a=!0,o?.dispose(),o=null},host:e,ready:i,update(s){r.base=s.base,r.baseError=s.baseError,r.baseInvalid=s.baseInvalid,r.groups=s.groups,r.notice=s.notice,r.queryPlaceholder=s.queryPlaceholder,r.sectionError=s.sectionError,r.hasNotice=s.notice!=="",r.hasSectionError=s.sectionError!==""}}}var Tc="--",ET="(max-width: 768px)",yV="(prefers-reduced-motion: reduce)";function vV(e){if(ux(e))return"scheme";return/(?:min|max)-width:/.test(e)?"size":"feature"}function wV(e){let t=e??{},r=[];for(let[o,a]of Object.entries(t)){if(o===Tc)continue;let i=String(a);r.push({key:o,kind:vV(i),query:i})}return{base:String(t[Tc]??""),entries:r}}function xV(e){let t=e.trim().replace(/^-+/,"").toLowerCase().replaceAll(/[^a-z0-9]+/g,"-").replaceAll(/^-+|-+$/g,"");return t?`--${t}`:""}var NT=[{addLabel:"Add breakpoint",desc:"Screen widths that get their own canvas and their own style values.",empty:"No breakpoints yet — every width uses the base styles.",kind:"size",label:"Size breakpoints",newQuery:ET,stem:"breakpoint"},{addLabel:"Add colour scheme",desc:"Light and dark renderings. Defining one turns on the Auto / Light / Dark control.",empty:"No colour schemes yet — the project renders one way.",kind:"scheme",label:"Colour schemes",newQuery:"(prefers-color-scheme: dark)",stem:"dark"},{addLabel:"Add feature query",desc:"Anything else a media query can ask: reduced motion, print, hover, orientation.",empty:"No feature queries yet.",kind:"feature",label:"Feature queries",newQuery:yV,stem:"feature"}],Pc=new WeakMap,jT=new WeakMap,PT=new WeakMap;function LT(){return C?.projectConfig??{}}function Qr(){return LT().$media??{}}function ra(e,t,r){Pc.set(e,{message:r,target:t}),Ec(e)}async function ea(e,t,r){let o=LT(),a={...o,$media:t},i=[],s=[];try{s=await Ku(o),i=(await Ku(a)).filter((f)=>!s.includes(f))}catch(l){ra(e,r,`Could not validate project.json — ${X(l)}`);return}if(i.length>0){ra(e,r,i.join("; "));return}jT.set(e,s);try{await no({$media:t}),Pc.delete(e)}catch(l){Pc.set(e,{message:`Could not save project.json — ${X(l)}`,target:r})}Ec(e)}function kV(e){return{add(t){let r=NT.find((s)=>s.kind===t);if(!r)return;let o=Qr(),a=`--${r.stem}`,i=2;while(a in o)a=`--${r.stem}-${i}`,i+=1;ea(e,{...o,[a]:r.newQuery},a)},remove(t){let r={...Qr()};delete r[t],ea(e,r,"section")},rename(t,r){let o=Qr(),a=xV(r);if(!a){ra(e,t,"A context needs a name.");return}if(a===t)return;if(a in o){ra(e,t,`"${ji(a)}" is already defined.`);return}let i={};for(let[s,l]of Object.entries(o))i[s===t?a:s]=l;ea(e,i,a)},setBase(t){let r=t.trim();if(r&&!/^\d+px$/.test(r)){ra(e,"base","Enter a width in pixels, like 1280px.");return}let o={...Qr()};if(r)o[Tc]=r;else delete o[Tc];ea(e,o,"base")},setQuery(t,r){let o=r.trim();if(!o){ra(e,t,"A context needs a media query, like (max-width: 768px).");return}ea(e,{...Qr(),[t]:o},t)},setScheme(t,r){ea(e,{...Qr(),[t]:`(prefers-color-scheme: ${r})`},t)}}}function $V(e,t){let r=ji(e.key),o=t?.target===e.key;return{control:e.kind==="scheme"?"scheme":"query",error:o?t.message:"",invalid:o,key:e.key,name:e.key.replace(/^--/,""),nameLabel:`Name for ${r}`,query:e.query,removeLabel:`Remove ${r}`,scheme:Mp(e.query)??"dark",valueLabel:e.kind==="scheme"?`Colour scheme for ${r}`:`Media query for ${r}`}}function SV(e){if(e.length===0)return"";let t=e.length===1?"problem":"problems";return`project.json has ${e.length} pre-existing schema ${t} that this section did not cause: ${e.join("; ")}`}function CV(e){let t=Pc.get(e),{base:r,entries:o}=wV(Qr()),a=NT.map((i)=>{let s=o.filter((l)=>l.kind===i.kind).map((l)=>$V(l,t));return{addLabel:i.addLabel,desc:i.desc,empty:i.empty,hasRows:s.length>0,kind:i.kind,label:i.label,rows:s}});return{base:r,baseError:t?.target==="base"?t.message:"",baseInvalid:t?.target==="base",groups:a,notice:SV(jT.get(e)??[]),queryPlaceholder:ET,sectionError:t?.target==="section"?t.message:""}}function Ec(e){let t=PT.get(e);if(!t?.attached())t?.dispose(),t=TT(e,kV(e)),PT.set(e,t);t.update(CV(e))}var FT={$schema:"https://jxsuite.com/schema/v1",$id:"StudioSettingsDefs",$description:"Project Settings › Data Shapes: the project-level `$defs` editor. The left column lists the shapes and the right one edits the selected shape's fields, each field a name, a type, an optional format and whether it is required — plus the target of a reference and the children of an object. The adapter (`surfaces/settings-defs.ts`) hands in the shapes, the fields already classified, and every draft the reader is part-way through typing; `settings/defs-editor.ts` decides what a name may be and what reaches `project.json`. Nothing here reads the configuration: a document that re-read the file while drawing would be a second opinion about what one module already owns.",tagName:"section",attributes:{part:"defs"},style:{$description:"What `.settings-two-col`, `.settings-list-panel`, `.settings-editor-panel`, `.settings-editor-header`, `.settings-empty-state`, `.settings-inline-form`, `.schema-field-list`, `.schema-field-card`, `.schema-field-row`, `.schema-field-nested`, `.schema-field-name-input`, `.schema-nested-add`, `.schema-add-field` and `.settings-section-title` said in `styles/overlays.css`, keyed on `part` and re-pointed at the studio token layer. NONE of those rules is deleted from the stylesheet: `settings/contributed-section.ts` draws the same two-column editor and `ui/form-controls.ts` draws the same field cards, both still lit, so this document carries its own copy of each until they convert. Two values could not come with them. `.settings-editor-header h3` read `var(--spectrum-font-size-100, 14px)` and `.schema-field-card--nested` read `var(--spectrum-gray-300, #444)`, and a document is mounted in the pane rather than inside `<sp-theme>`, so both would have taken their hard-coded fallback every time; they are the kit's `--jx-text-lg` and the studio layer's `--border`.",display:"block",'& [part="title"]':{margin:"0 0 16px",fontSize:"16px",fontWeight:"600",color:"var(--fg)"},'& [part="columns"]':{$description:"The 1px gap over the border colour is the divider between the two columns: two panels on `--bg-panel` with `--border` showing through the gap, so nothing draws a rule of its own.",display:"flex",height:"100%",gap:"1px",background:"var(--border)"},'& [part="list"]':{display:"flex",flexDirection:"column",gap:"4px",padding:"12px",width:"200px",minWidth:"200px",background:"var(--bg-panel)",overflowY:"auto"},'& [part="shape"], & [part="new-open"]':{width:"100%"},'& [part="shape"] > [part="control"], & [part="new-open"] > [part="control"]':{$description:"`.settings-list-panel sp-action-button` said `width: 100%; justify-content: flex-start`, and both halves belong to the button the row is made of rather than to the row: a kit action button centres its glyph and its label, which reads as a list of centred names.",width:"100%",justifyContent:"flex-start"},'& [part="new-form"]':{display:"flex",alignItems:"center",gap:"6px"},'& [part="new-field"]':{flex:"1",minWidth:"0"},'& [part="empty"]':{flex:"1",display:"flex",alignItems:"center",justifyContent:"center",background:"var(--bg-panel)",color:"var(--fg-dim)",fontSize:"13px"},'& [part="editor"]':{flex:"1",padding:"16px",background:"var(--bg-panel)",overflowY:"auto"},'& [part="editor-header"]':{display:"flex",alignItems:"center",gap:"12px",marginBottom:"16px"},'& [part="editor-name"]':{margin:"0",fontSize:"var(--jx-text-lg)",fontWeight:"600",color:"var(--fg)"},'& [part="fields"]':{display:"flex",flexDirection:"column",gap:"4px",marginBottom:"12px"},'& [part="card"], & [part="nested-card"]':{border:"1px solid var(--border)",borderRadius:"var(--radius)",padding:"6px 10px"},'& [part="field-row"]':{display:"flex",alignItems:"center",gap:"8px"},'& [part="field-label"]':{$description:"The field's name in words, which `.schema-field-label` named and no stylesheet ever styled: it was an `sp-field-label` beside the raw-key field, at whatever size Spectrum drew it. It is a caption on the row rather than a label for a control, so it says so in the type ramp and the dim colour instead of borrowing a control's typography.",flex:"none",minWidth:"84px",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)",overflowWrap:"anywhere"},'& [part="field-name"]':{flex:"1",maxWidth:"140px"},'& [part="nested"]':{marginLeft:"16px",marginTop:"6px",paddingLeft:"8px",borderLeft:"2px solid var(--border)",display:"flex",flexDirection:"column",gap:"4px"},'& [part="ref-target"]':{display:"flex",marginTop:"6px",maxWidth:"220px"},'& [part="nested-add"]':{display:"flex",alignItems:"center",gap:"6px",padding:"4px 0"},'& [part="nested-add-name"]':{flex:"1",maxWidth:"120px"},'& [part="add-form"]':{display:"flex",alignItems:"center",gap:"8px",padding:"8px 0"}},children:[{tagName:"h3",attributes:{part:"title"},textContent:"Data Shapes"},{tagName:"div",attributes:{part:"columns"},children:[{tagName:"div",attributes:{part:"list"},children:[{$prototype:"Array",items:{$ref:"#/state/defs"},key:{$ref:"$map/item/name"},map:{tagName:"jx-action-button",attributes:{part:"shape","data-shape":"${$map.item.name}"},$props:{label:"${$map.item.name}",selected:{$ref:"$map/item/selected"},quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/select"},value:[{$ref:"$map/item/name"}]}]},children:[{tagName:"span",textContent:"${$map.item.name}"}]}},{tagName:"div",attributes:{part:"new-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/newState"},cases:{closed:{tagName:"jx-action-button",attributes:{part:"new-open"},$props:{label:"New Data Shape",icon:"plus",quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openNew"},value:[]}]},children:[{tagName:"span",textContent:"New Data Shape"}]},open:{tagName:"div",attributes:{part:"new-form"},children:[{tagName:"jx-textfield",attributes:{part:"new-field"},$props:{label:"New data shape name",placeholder:"ProductReview",size:"sm",value:{$ref:"#/state/newName"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editNew"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/createNew"},value:[]}],Escape:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/cancelNew"},value:[]}]}}]}},{tagName:"jx-button",attributes:{part:"new-create"},$props:{size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/createNew"},value:[]}]},children:[{tagName:"span",textContent:"Create"}]}]}}}]},{tagName:"div",attributes:{part:"editor-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/editorState"},cases:{empty:{tagName:"div",attributes:{part:"empty"},textContent:"Pick a data shape on the left, or create one."},editing:{tagName:"div",attributes:{part:"editor"},children:[{tagName:"div",attributes:{part:"editor-header"},children:[{tagName:"h4",attributes:{part:"editor-name"},textContent:"${state.selected}"},{tagName:"jx-action-button",attributes:{part:"delete-shape"},$props:{label:"Delete data shape",hint:"Delete data shape",icon:"trash",quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/removeSelected"},value:[]}]}}]},{tagName:"div",attributes:{part:"fields"},children:[{$prototype:"Array",items:{$ref:"#/state/fields"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"card","data-field":"${$map.item.key}"},children:[{tagName:"div",attributes:{part:"field-row"},children:[{tagName:"span",attributes:{part:"field-label"},textContent:"${$map.item.label}"},{tagName:"jx-textfield",attributes:{part:"field-name"},$props:{label:"Name for ${$map.item.label}",size:"sm",value:{$ref:"$map/item/name"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/renameField"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},{tagName:"jx-select",attributes:{part:"field-type"},$props:{label:"Type for ${$map.item.label}",size:"sm",options:{$ref:"#/state/typeOptions"},value:{$ref:"$map/item/type"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setType"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},{tagName:"div",attributes:{part:"format-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasFormat"},cases:{true:{tagName:"jx-select",attributes:{part:"field-format"},$props:{label:"Format for ${$map.item.label}",size:"sm",options:{$ref:"#/state/formatOptions"},value:{$ref:"$map/item/format"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setFormat"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}}}},{tagName:"jx-switch",$description:"Whether the shape requires this field. The word on screen is the name: `Req` is slotted rather than passed as `label`, because the kit's switch wraps its control in the label the slot lands in, and a second name would be announced over the top of it. Which row it belongs to is the tooltip's job instead, which is what `hint` is.",attributes:{part:"field-required"},$props:{hint:"Require ${$map.item.label}",size:"sm",checked:{$ref:"$map/item/required"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setRequired"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/checked"}]}]},children:[{tagName:"span",textContent:"Req"}]},{tagName:"jx-action-button",attributes:{part:"field-delete"},$props:{label:"Delete ${$map.item.label}",hint:"Delete ${$map.item.label}",icon:"trash",quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/removeField"},value:[{$ref:"$map/item/key"}]}]}}]},{tagName:"div",attributes:{part:"extra-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/extra"},cases:{reference:{tagName:"div",attributes:{part:"ref-target"},children:[{tagName:"jx-select",attributes:{part:"ref-target-select"},$props:{label:"Target for ${$map.item.label}",size:"sm",options:{$ref:"#/state/targets"},value:{$ref:"$map/item/refTarget"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setTarget"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}}]},nested:{tagName:"div",attributes:{part:"nested"},children:[{$prototype:"Array",items:{$ref:"$map/item/children"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"nested-card","data-nested":"${$map.item.key}"},children:[{tagName:"div",attributes:{part:"field-row"},children:[{tagName:"jx-textfield",attributes:{part:"field-name"},$props:{label:"Name for ${$map.item.parent}.${$map.item.key}",size:"sm",value:{$ref:"$map/item/name"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/renameNested"},value:[{$ref:"$map/item/parent"},{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},{tagName:"jx-select",attributes:{part:"field-type"},$props:{label:"Type for ${$map.item.parent}.${$map.item.key}",size:"sm",options:{$ref:"#/state/typeOptions"},value:{$ref:"$map/item/type"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setNestedType"},value:[{$ref:"$map/item/parent"},{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},{tagName:"div",attributes:{part:"format-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasFormat"},cases:{true:{tagName:"jx-select",attributes:{part:"field-format"},$props:{label:"Format for ${$map.item.parent}.${$map.item.key}",size:"sm",options:{$ref:"#/state/formatOptions"},value:{$ref:"$map/item/format"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setNestedFormat"},value:[{$ref:"$map/item/parent"},{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}}}},{tagName:"jx-switch",attributes:{part:"field-required"},$props:{hint:"Require ${$map.item.parent}.${$map.item.key}",size:"sm",checked:{$ref:"$map/item/required"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setNestedRequired"},value:[{$ref:"$map/item/parent"},{$ref:"$map/item/key"},{$ref:"event#/target/checked"}]}]},children:[{tagName:"span",textContent:"Req"}]},{tagName:"jx-action-button",attributes:{part:"field-delete"},$props:{label:"Delete ${$map.item.parent}.${$map.item.key}",hint:"Delete ${$map.item.parent}.${$map.item.key}",icon:"trash",quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/removeNested"},value:[{$ref:"$map/item/parent"},{$ref:"$map/item/key"}]}]}}]}]}},{tagName:"div",attributes:{part:"nested-add"},children:[{tagName:"jx-textfield",attributes:{part:"nested-add-name"},$props:{label:"New field in ${$map.item.label}",placeholder:"field name",size:"sm",value:{$ref:"$map/item/draftName"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editDraftName"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/addNested"},value:[{$ref:"$map/item/key"}]}]}}]}},{tagName:"jx-select",attributes:{part:"nested-add-type"},$props:{label:"Type of the new field in ${$map.item.label}",size:"sm",options:{$ref:"#/state/typeOptions"},value:{$ref:"$map/item/draftType"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editDraftType"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},{tagName:"jx-action-button",attributes:{part:"nested-add-button"},$props:{label:"Add a field to ${$map.item.label}",hint:"Add a field to ${$map.item.label}",icon:"plus",quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/addNested"},value:[{$ref:"$map/item/key"}]}]}}]}]}}}]}}]},{tagName:"div",attributes:{part:"add-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/addState"},cases:{closed:{tagName:"jx-action-button",attributes:{part:"add-open"},$props:{label:"Add Field",icon:"plus",quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openAdd"},value:[]}]},children:[{tagName:"span",textContent:"Add Field"}]},open:{tagName:"div",attributes:{part:"add-form"},children:[{tagName:"jx-textfield",attributes:{part:"add-name"},$props:{label:"New field name",placeholder:"Field name",size:"sm",value:{$ref:"#/state/addName"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editAddName"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/confirmAdd"},value:[]}],Escape:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/cancelAdd"},value:[]}]}}]}},{tagName:"jx-select",attributes:{part:"add-type"},$props:{label:"Type of the new field",size:"sm",options:{$ref:"#/state/typeOptions"},value:{$ref:"#/state/addType"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editAddType"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"div",attributes:{part:"add-format-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/addHasFormat"},cases:{true:{tagName:"jx-select",attributes:{part:"add-format"},$props:{label:"Format of the new field",size:"sm",options:{$ref:"#/state/formatOptions"},value:{$ref:"#/state/addFormat"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editAddFormat"},value:[{$ref:"event#/target/value"}]}]}}}},{tagName:"jx-switch",attributes:{part:"add-required"},$props:{hint:"Require the new field",size:"sm",checked:{$ref:"#/state/addRequired"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editAddRequired"},value:[{$ref:"event#/target/checked"}]}]},children:[{tagName:"span",textContent:"Required"}]},{tagName:"jx-button",attributes:{part:"add-confirm"},$props:{size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/confirmAdd"},value:[]}]},children:[{tagName:"span",textContent:"Add"}]},{tagName:"jx-button",attributes:{part:"add-cancel"},$props:{size:"sm",quiet:!0},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/cancelAdd"},value:[]}]},children:[{tagName:"span",textContent:"Cancel"}]}]}}}]}}}]}]};E("settings-defs",FT);function PV(){return{addFormat:"",addHasFormat:!0,addName:"",addRequired:!1,addState:"closed",addType:"string",defs:[],editorState:"empty",fields:[],formatOptions:[],newName:"",newState:"closed",selected:"",targets:[],typeOptions:[]}}function _T(e,t){e.textContent="";let r=g({...PV(),...t}),o=null,a=!1,i=R("settings-defs",r,e).then((s)=>{let l=s.root;if(a)return s.dispose(),l;return o=s,l});return{attached:()=>{if(a)return!1;let s=o?.root;return s===void 0?!0:s instanceof HTMLElement&&e.contains(s)},dispose(){a=!0,o?.dispose(),o=null},host:e,ready:i,update(s){r.addFormat=s.addFormat,r.addHasFormat=s.addHasFormat,r.addName=s.addName,r.addRequired=s.addRequired,r.addState=s.addState,r.addType=s.addType,r.defs=s.defs,r.editorState=s.editorState,r.fields=s.fields,r.formatOptions=s.formatOptions,r.newName=s.newName,r.newState=s.newState,r.selected=s.selected,r.targets=s.targets,r.typeOptions=s.typeOptions}}}var EV=vS.map((e)=>({label:e,value:e})),NV=yS.map((e)=>({label:e||"(none)",value:e})),HT=new WeakMap,BT=new WeakMap;function Lc(e){let t=HT.get(e);if(!t)t={add:{...Dd},addOpen:!1,drafts:new Map,echo:null,newName:"",newOpen:!1,selected:null},HT.set(e,t);return t}function Rc(e){return`name:${e}`}function Ic(e){return`required:${e}`}function xh(e,t){return`${e} ${t}`}function jc(e,t,r){Lc(e).echo={id:t,value:r},Oc(e)}function VT(e){Lc(e).echo=null}function UT(e,t,r){return e.echo?.id===t&&n(e.echo.value)?e.echo.value:r}function QT(e,t,r){return e.echo?.id===t&&Ze(e.echo.value)?e.echo.value:r}function jV(){ic()}function Sh(){return C?.projectConfig?.$defs}function gn(e){return e.selected===null?void 0:Sh()?.[e.selected]}function RV(){let e=C?.projectConfig?.content;return v(e)?Object.keys(e):[]}var WT=[],qT=" ";function AV(){let e=RV(),t=e.join(" ");if(t!==qT)qT=t,WT=e.map((r)=>({label:r,value:r}));return WT}function Li(e){return e==="string"||e==="array"}function IV(e,t,r,o,a){let i=xh(t,r),s=Sb(o);return{format:Nd(o),hasFormat:Li(s),key:r,name:UT(e,Rc(i),r),parent:t,required:QT(e,Ic(i),a),type:s}}function LV(e,t,r,o,a){let i=Sb(r),s=i==="object",l=e.drafts.get(t),f=r.required??[];return{children:s?Object.entries(r.properties??{}).map(([c,d])=>IV(e,t,c,d,f.includes(c))):[],draftName:l?.name??"",draftType:l?.type??"string",extra:i==="reference"&&a?"reference":s?"nested":"none",format:Nd(r),hasFormat:Li(i),key:t,label:ed(t),name:UT(e,Rc(t),t),refTarget:r.$ref?r.$ref.replace(/^#\/[^/]+\//,""):"",required:QT(e,Ic(t),o),type:i}}function OV(e){let t=Lc(e),r=Sh()??{},o=gn(t),a=AV(),i=o?.properties??{},s=o?.required??[];return{addFormat:t.add.format,addHasFormat:Li(t.add.type),addName:t.add.name,addRequired:t.add.required,addState:t.addOpen&&o?"open":"closed",addType:t.add.type,defs:Object.keys(r).map((l)=>({name:l,selected:l===t.selected})),editorState:o?"editing":"empty",fields:Object.entries(i).map(([l,f])=>LV(t,l,f,s.includes(l),a.length>0)),formatOptions:NV,newName:t.newName,newState:t.newOpen?"open":"closed",selected:o&&t.selected!==null?t.selected:"",targets:a,typeOptions:EV}}function MV(e){let t=Lc(e),r=()=>Oc(e),o=(c)=>gn(t)?.properties?.[c],a=(c)=>{let d=t.drafts.get(c);if(!d)d={name:"",type:"string"},t.drafts.set(c,d);return d},i=(c,d,b)=>{let y={};for(let[x,S]of Object.entries(c))y[x===d?b:x]=S,delete c[x];Object.assign(c,y)},s=(c,d,b)=>{if(!c.required)c.required=[];let y=c.required.indexOf(d);if(b&&y===-1)c.required.push(d);if(!b&&y!==-1)c.required.splice(y,1)},l=()=>{VT(e),r()},f=()=>{VT(e),r(),jV()};return{addNested(c){let d=a(c),b=d.name.trim(),y=o(c);if(!b||!y)return;if(!y.properties)y.properties={};y.properties[b]=_a(d.type||"string"),d.name="",f()},cancelAdd(){t.addOpen=!1,t.add={...Dd},r()},cancelNew(){t.newOpen=!1,t.newName="",r()},confirmAdd(){let c=t.add.name.trim(),d=gn(t);if(!c||!d)return;if(!d.properties)d.properties={};if(d.properties[c]=_a(t.add.type,t.add.format||void 0),t.add.required)s(d,c,!0);t.addOpen=!1,t.add={...Dd},f()},createNew(){let c=t.newName.trim(),d=C?.projectConfig;if(!c||!d)return;if(!d.$defs)d.$defs={};if(d.$defs[c])return;d.$defs[c]={properties:{},required:[],type:"object"},t.selected=c,t.newOpen=!1,t.newName="",f()},editAddFormat(c){t.add.format=c,r()},editAddName(c){t.add.name=c,r()},editAddRequired(c){t.add.required=c,r()},editAddType(c){t.add.type=c,r()},editDraftName(c,d){a(c).name=d,r()},editDraftType(c,d){a(c).type=d,r()},editNew(c){t.newName=c,r()},openAdd(){t.addOpen=!0,t.add={...Dd},r()},openNew(){t.newOpen=!0,t.newName="",r()},removeField(c){let d=gn(t);if(!d?.properties)return;if(delete d.properties[c],d.required)d.required=d.required.filter((b)=>b!==c);f()},removeNested(c,d){let b=o(c);if(!b?.properties)return;if(delete b.properties[d],b.required)b.required=b.required.filter((y)=>y!==d);f()},removeSelected(){let c=Sh();if(t.selected===null||!c?.[t.selected])return;delete c[t.selected],t.selected=null,t.addOpen=!1,f()},renameField(c,d){jc(e,Rc(c),d);let b=gn(t),y=d.trim();if(!b?.properties||!y||y===c||b.properties[y]){l();return}if(i(b.properties,c,y),b.required)b.required=b.required.map((x)=>x===c?y:x);f()},renameNested(c,d,b){jc(e,Rc(xh(c,d)),b);let y=o(c),x=b.trim();if(!y?.properties||!x||x===d||y.properties[x]){l();return}if(i(y.properties,d,x),y.required)y.required=y.required.map((S)=>S===d?x:S);f()},select(c){t.selected=c,t.addOpen=!1,r()},setFormat(c,d){let b=gn(t),y=b?.properties?.[c];if(!b?.properties||!y)return;b.properties[c]=_a(y.type||"string",d||void 0),f()},setNestedFormat(c,d,b){let y=o(c),x=y?.properties?.[d];if(!y?.properties||!x)return;y.properties[d]=_a(x.type||"string",b||void 0),f()},setNestedRequired(c,d,b){jc(e,Ic(xh(c,d)),b);let y=o(c);if(!y){l();return}s(y,d,b),f()},setNestedType(c,d,b){let y=o(c),x=y?.properties?.[d];if(!y?.properties||!x)return;let S=Li(b)?Nd(x):void 0;y.properties[d]=_a(b,S||void 0),f()},setRequired(c,d){jc(e,Ic(c),d);let b=gn(t);if(!b){l();return}s(b,c,d),f()},setTarget(c,d){let b=gn(t);if(!b?.properties?.[c])return;b.properties[c]={$ref:`#/content/${d}`},f()},setType(c,d){let b=gn(t),y=b?.properties?.[c];if(!b?.properties||!y)return;let x=Li(d)?Nd(y):void 0;b.properties[c]=_a(d,x||void 0),f()}}}function Oc(e){let t=BT.get(e);if(!t?.attached())t?.dispose(),t=_T(e,MV(e)),BT.set(e,t);t.update(OV(e))}var ZT={$schema:"https://jxsuite.com/schema/v1",$id:"StudioSettingsPackages",$description:'Project Settings › Packages: the project\'s npm dependencies, each with the version it is pinned at and the newest one the registry has, and the four verbs that reach `bun` — add, update, remove, reinstall. The adapter (`surfaces/settings-packages.ts`) hands in one row per dependency, already told whether it can be updated and to what; nothing here asks the registry, compares two versions or decides what an update means. A row\'s Latest is a STRING the adapter chose, `—` included, because "the registry did not answer" and "the registry answered 0.0.0" are the same absence to a document and only one of them is true.',tagName:"section",attributes:{part:"packages"},style:{$description:"The section's own look. Three borrowings end here. `.settings-section` was an orphan class with no rule anywhere, so the section's rhythm was carried by the toolbar's inline `margin-bottom`; it is drawn below instead of implied. `.settings-section-title` and `.settings-field-desc` keep their stylesheet — nine settings sections are still lit and still name them — so this document carries its own copy of each, with `--spectrum-font-size-75` re-pointed at the kit's scale: a document is mounted outside `<sp-theme>`, where that name resolves to nothing and every one of these would silently have taken its 12px fallback. And the table is drawn here rather than by `sp-table`, which is the one thing on this surface the kit has no element for: four Spectrum tags went, and a `<table>` with three column headers replaced them, so the columns are announced as columns and a row is a row rather than a `role=\"row\"` a component asserts.",display:"block",fontFamily:"var(--jx-font-sans)",'& [part="title"]':{margin:"0 0 var(--jx-space-2)",fontSize:"16px",fontWeight:"600",color:"var(--fg)"},'& [part="intro"]':{margin:"0 0 var(--jx-space-4)",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"},'& [part="toolbar"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-3)",marginBottom:"var(--jx-space-4)"},'& [part="add-field"]':{$description:"The one control on this surface a reader types into. It takes the space the row's buttons do not, and stops there: a package name is short, and a field that eats a 900px pane says the section is mostly about typing when it is mostly about reading a table.",flex:"1",minWidth:"0",maxWidth:"280px"},'& [part="spacer"]':{$description:"What pushes Update all and Reinstall to the far end. The two groups act on different things — one package you are naming, every package you already have — and the gap between them is what says so.",flex:"1"},'& [part="status"]':{$description:'"Loading…" and "No dependencies.", the two lines drawn where the table would be. They are one part rather than two because they are one sentence in two moods, and the difference between them is already in the words.',margin:"0",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"},'& [part="table"]':{width:"100%",borderCollapse:"collapse",fontSize:"var(--jx-text-md)",color:"var(--fg)"},'& [part="column"]':{padding:"var(--jx-space-2) var(--jx-space-3)",textAlign:"start",fontWeight:"500",color:"var(--fg-dim)",borderBottom:"1px solid var(--border)"},'& [part="name-cell"], & [part="current"], & [part="latest"], & [part="row-actions"]':{padding:"var(--jx-space-2) var(--jx-space-3)",verticalAlign:"middle",borderBottom:"1px solid var(--border)"},'& [part="name-cell"]':{overflowWrap:"anywhere"},'& [part="dev"]':{$description:"Which of the two dependency blocks the row is in, said beside the name rather than in a column of its own: a column would be empty for most projects and this is a footnote on a name, not a fact worth four percent of the width.",marginInlineStart:"var(--jx-space-2)",fontSize:"var(--jx-text-xs)",color:"var(--fg-dim)"},'& [part="current"], & [part="latest"]':{$description:"Both version columns in the monospace face. A range and a release read as versions rather than as prose, and `^0.19.0` beside `0.22.0` only lines up digit under digit in a fixed pitch.",fontFamily:"var(--font-mono)",whiteSpace:"nowrap"},'& [part="actions"]':{$description:"The row's two buttons, held at the right edge and never wrapped: they are the same pair on every row, so the eye finds them by position and a row that wrapped one under the other would break that.",display:"flex",justifyContent:"flex-end",gap:"var(--jx-space-1)",whiteSpace:"nowrap"},'& [part="hidden-label"]':{$description:`The actions column's header, named for a screen reader and drawn for nobody: the column holds two icon buttons whose own names say which row they act on, and a visible "Actions" over them would be a word explaining a column that explains itself.`,position:"absolute",width:"1px",height:"1px",margin:"-1px",overflow:"hidden",clipPath:"inset(50%)",whiteSpace:"nowrap"}},children:[{tagName:"h3",attributes:{part:"title"},textContent:"Packages"},{tagName:"p",attributes:{part:"intro"},textContent:"This project's npm dependencies. Adding, updating, removing and reinstalling each run bun in the project root."},{tagName:"div",attributes:{part:"toolbar"},children:[{tagName:"jx-textfield",attributes:{part:"add-field"},$props:{label:"Package name",placeholder:"package-name",size:"sm",value:{$ref:"#/state/addName"},disabled:{$ref:"#/state/busy"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/edit"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/add"},value:[]}]}}]}},{tagName:"jx-button",attributes:{part:"add-button"},$props:{size:"sm",disabled:{$ref:"#/state/busy"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/add"},value:[]}]},children:[{tagName:"span",textContent:"Add"}]},{tagName:"span",attributes:{part:"spacer","aria-hidden":"true"}},{tagName:"span",attributes:{part:"update-all-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasUpdates"},cases:{true:{tagName:"jx-button",attributes:{part:"update-all"},$props:{size:"sm",disabled:{$ref:"#/state/busy"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/updateAll"},value:[]}]},children:[{tagName:"span",textContent:"Update all"}]}}},{tagName:"jx-button",attributes:{part:"reinstall"},$props:{size:"sm",quiet:!0,disabled:{$ref:"#/state/busy"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/reinstall"},value:[]}]},children:[{tagName:"span",textContent:"Reinstall"}]}]},{tagName:"div",attributes:{part:"body",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/listState"},cases:{loading:{tagName:"p",attributes:{part:"status"},textContent:"Loading…"},empty:{tagName:"p",attributes:{part:"status"},textContent:"No dependencies."},listed:{tagName:"table",attributes:{part:"table"},children:[{tagName:"thead",children:[{tagName:"tr",children:[{tagName:"th",attributes:{part:"column",scope:"col"},textContent:"Package"},{tagName:"th",attributes:{part:"column",scope:"col"},textContent:"Current"},{tagName:"th",attributes:{part:"column",scope:"col"},textContent:"Latest"},{tagName:"th",attributes:{part:"column",scope:"col"},children:[{tagName:"span",attributes:{part:"hidden-label"},textContent:"Actions"}]}]}]},{tagName:"tbody",attributes:{part:"rows"},children:[{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/name"},map:{tagName:"tr",attributes:{part:"row","data-package":"${$map.item.name}"},children:[{tagName:"td",attributes:{part:"name-cell"},children:[{tagName:"span",attributes:{part:"package-name"},textContent:"${$map.item.name}"},{tagName:"span",attributes:{part:"dev-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/dev"},cases:{true:{tagName:"span",attributes:{part:"dev"},textContent:"· dev"}}}]},{tagName:"td",attributes:{part:"current"},textContent:"${$map.item.version}"},{tagName:"td",attributes:{part:"latest"},textContent:"${$map.item.latest}"},{tagName:"td",attributes:{part:"row-actions"},children:[{tagName:"div",attributes:{part:"actions"},children:[{tagName:"span",attributes:{part:"update-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/canUpdate"},cases:{true:{tagName:"jx-action-button",attributes:{part:"update"},$props:{icon:"arrows-clockwise",size:"sm",quiet:!0,label:"Update ${$map.item.name} to ${$map.item.upgrade}",hint:"Update ${$map.item.name} to ${$map.item.upgrade}",disabled:{$ref:"#/state/busy"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/update"},value:[{$ref:"$map/item/name"}]}]}}}},{tagName:"jx-action-button",attributes:{part:"remove"},$props:{icon:"trash",size:"sm",quiet:!0,label:"Remove ${$map.item.name}",hint:"Remove ${$map.item.name}",disabled:{$ref:"#/state/busy"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/remove"},value:[{$ref:"$map/item/name"}]}]}}]}]}]}}]}]}}}]};E("settings-packages",ZT);var eP=new WeakMap;function tP(e){let t=e.rows.map((r)=>({...r,canUpdate:r.upgrade!==""}));return{addName:e.addName,busy:e.busy,hasUpdates:t.some((r)=>r.canUpdate),listState:e.loading?"loading":t.length===0?"empty":"listed",loading:e.loading,rows:t}}function nP(e,t,r){let o=eP.get(e);if(o&&(o.handle===null||o.handle.root.isConnected)){Object.assign(o.scope,tP(t));return}o?.handle?.dispose(),e.textContent="";let a=g({...tP(t),...r}),i={handle:null,scope:a};eP.set(e,i),R("settings-packages",a,e).then((s)=>{i.handle=s})}var Ph=null,Zr=null,Eh=new Map,Fc=!1,Oi="";function rP(e){return Eh.get(e.name)??null}function Nh(e){let t=rP(e);return t&&GS(e.version,t)?t:null}function FV(e){return(Zr??[]).find((t)=>t.name===e)}async function oP(){let e=p();try{Zr=await e.listPackages()}catch{Zr=[]}if(Eh=new Map,e.packageVersions)try{for(let t of await e.packageVersions())Eh.set(t.name,t.latest)}catch{}_c()}async function Mi(e){if(Fc)return;Fc=!0,_c();let t=sl({status:"Running bun…",title:"Updating dependencies"});try{await e(),t.done()}catch(r){t.fail(r instanceof Error?r.message:String(r))}finally{Fc=!1,await oP()}}async function _V(){let e=Oi.trim();if(!e)return;await Mi(async()=>{await p().addPackage(e),Oi="",w.success(`Added ${e}.`)})}async function zV(e){await Mi(async()=>{await p().removePackage(e),w.success(`Removed ${e}.`)})}async function HV(e){let t=p(),r=FV(e),o=r?Nh(r):null;if(!t.setPackageVersions||!r||!o)return;await Mi(async()=>{let a=Jw(o),i=await t.setPackageVersions([{dev:Boolean(r.dev),name:r.name,version:`^${a}`}]);if(!i.ok)throw Error(i.log??"Update failed");w.success(`Updated ${r.name} to ${a}.`)})}async function BV(){let e=p();if(!e.setPackageVersions)return;let t=(Zr??[]).map((r)=>{let o=Nh(r);return o?{dev:Boolean(r.dev),name:r.name,version:`^${Jw(o)}`}:null}).filter((r)=>r!==null);if(t.length===0)return;await Mi(async()=>{let r=await e.setPackageVersions(t);if(!r.ok)throw Error(r.log??"Update failed");w.success(`Updated ${t.length} package(s).`)})}async function VV(){let e=p();if(!e.installDependencies)return;await Mi(async()=>{let t=await e.installDependencies();if(!t.ok)throw Error(t.log??"Install failed");w.success("Dependencies reinstalled.")})}function WV(e){return{dev:Boolean(e.dev),latest:rP(e)??"—",name:e.name,upgrade:Nh(e)??"",version:e.version}}function qV(){return{addName:Oi,busy:Fc,loading:Zr===null,rows:(Zr??[]).map((e)=>WV(e))}}var UV={add:()=>{_V()},edit:(e)=>{Oi=e,_c()},reinstall:()=>{VV()},remove:(e)=>{zV(e)},update:(e)=>{HV(e)},updateAll:()=>{BV()}};function _c(){if(!Ph)return;nP(Ph,qV(),UV)}function aP(e){Ph=e,Zr=null,Oi="",_c(),oP()}function JV(){return C?.projectConfig??{}}function oa(){return JV().extensions??[]}function Bn(e=null){let t=new Set(oa()),r=new Set((e??[]).map((i)=>i.name)),o=new Map(Dv().map((i)=>[i.name,i])),a=[];for(let i of l0()){let s=i.specifier??i.name,l=i.installed??r.has(i.name),f=o.get(i.name),c={broken:t.has(s)&&!l,enabled:t.has(s),installed:l,name:i.name,origin:i.source==="first-party"?"catalog":"installed",sections:f?f.contributions.map((d)=>d.project.key):i.sections.map((d)=>d.key),specifier:s,title:i.title??i.name};if(i.description!==void 0)c.description=i.description;if(i.problem!==void 0)c.unavailable=i.problem;a.push(c)}for(let i of t){if(a.some((f)=>f.specifier===i))continue;let s=o.get(i),l={broken:!r.has(i)&&s===void 0,enabled:!0,installed:r.has(i),name:i,origin:"configured",sections:s?s.contributions.map((f)=>f.project.key):[],specifier:i,title:s?.title??i};if(s?.description!==void 0)l.description=s.description;a.push(l)}return a}var wt=null,Di=[];function jh(){return wt}function sP(){return Bn().filter((e)=>e.unavailable===void 0).map((e)=>e.name)}async function Ah(e){if(wt!==null)throw Error(`Another extension operation is running (${wt}).`);let t=Bn().find((o)=>o.specifier===e||o.name===e);if(t===void 0)throw RangeError(`command "project.enableExtension" argument "package": "${e}" is not an extension `+`this backend offers and is not installed — offered: ${sP().join(", ")||"none"}`);if(t.unavailable!==void 0)throw RangeError(`command "project.enableExtension" argument "package": "${e}" cannot be enabled on `+`this backend — ${t.unavailable}`);if(Di=[],t.enabled)return;wt=t.name;let r=!1;Ad();try{if(!t.installed){let o=qs({source:"Extensions",status:"Running bun…",title:`Install ${t.name}`});try{await p().addPackage(t.name),r=!0}catch(a){throw o.fail(`Could not install ${t.name} — ${a instanceof Error?a.message:String(a)}`),a}o.done()}await no({extensions:[...oa(),t.specifier]}),Di=r?["project.json","package.json"]:["project.json"]}finally{wt=null,Ad()}}async function Oh(e){if(wt!==null)throw Error(`Another extension operation is running (${wt}).`);let t=oa();if(!t.includes(e))return;wt=e,Ad();try{await no({extensions:t.filter((r)=>r!==e)})}finally{wt=null,Ad()}}async function Mh(e){if(oa().includes(e))throw RangeError(`command "packages.remove" argument "package": "${e}" is still enabled in project.json `+'"extensions" — disable it first, or the next build will fail on a missing package.');if(wt!==null)throw Error(`Another extension operation is running (${wt}).`);wt=e,Ad();try{await p().removePackage(e),w.success(`Removed ${e}.`)}finally{wt=null,Ad()}}function GV(e){return Bn().find((t)=>t.name===e||t.specifier===e)?.sections??[]}function iP(){return Bn().filter((e)=>e.enabled).map((e)=>e.specifier).join(", ")||"none"}function KV(){return[{args:Se({package:gl(sP,'The extension package to turn on, e.g. "@jxsuite/parser". A package that is not installed is installed first.')}),category:"Project",group:"7_settings_extensions",id:"project.enableExtension",level:"project",menus:["palette"],requires:"an open project",enablement:(e)=>e.project.open,undo:"none",aiTool:{description:'Turn on a Jx extension for this project: install its npm package if it is missing and add it to project.json "extensions". Enable an extension BEFORE writing the project.json section it owns, because a section belonging to a disabled extension is a schema error.',name:"enable_extension",report:({args:e})=>{let t=St("project.enableExtension",e,"package"),r=GV(t),o=r.length>0?` Its project.json sections are ${Di.length>0?"now ":""}valid: ${r.join(", ")}.`:"";return{summary:`${Di.length>0?`Enabled ${t}.`:`${t} was already enabled.`}${o} Enabled extensions: ${iP()}.`,wrote:Di}}},run:async(e,t)=>Ah(St("project.enableExtension",t,"package")),title:"Enable Extension"},{args:Se({package:gl(oa,"The extension to turn off. Its npm package stays installed.")}),category:"Project",group:"7_settings_extensions",id:"project.disableExtension",level:"project",menus:["palette"],requires:"an open project",enablement:(e)=>e.project.open,undo:"project",aiTool:{description:'Remove an extension from project.json "extensions". Its npm package stays installed, and the settings sections it contributed disappear. Remove any project.json sections it owns first, or the configuration will not validate.',name:"disable_extension",report:({args:e})=>`Disabled ${St("project.disableExtension",e,"package")}; its npm package is still installed. Ask before uninstalling it. Enabled extensions: ${iP()}.`},run:async(e,t)=>Oh(St("project.disableExtension",t,"package")),title:"Disable Extension"},{args:Se({package:Fe("The npm package to uninstall from this project.")}),category:"Project",destructive:!0,group:"9_danger",id:"packages.remove",level:"project",menus:["palette"],requires:"an open project",enablement:(e)=>e.project.open,undo:"none",run:async(e,t)=>Mh(St("packages.remove",t,"package")),title:"Remove Package"}]}function lP(e){e.registerAll(KV())}var cP={$schema:"https://jxsuite.com/schema/v1",$id:"StudioSettingsExtensions",$description:"Project Settings › Extensions: what this backend offers, what the project already has, and what `project.json` names that nothing could describe. The adapter (`surfaces/settings-extensions.ts`) hands in the groups already composed — each row carrying its own title, its package name, the sections it owns, the sentence its state deserves and why its switch cannot be used — plus whatever the last operation failed with. The document draws them and hands every flip straight back with what the switch now holds. Nothing here reads `project.json` or the catalogue: which extensions exist is the backend's answer, and a second definition of it in the markup would be wrong for a fork.",tagName:"div",attributes:{part:"extensions"},style:{$description:"The Extensions section's own look — what `.settings-extension-group`, `.settings-extension-group-title`, `.settings-toggle-row`, `.settings-toggle-row--broken`, `.settings-toggle-body`, `.settings-toggle-title`, `.settings-toggle-package`, `.settings-toggle-desc`, `.settings-toggle-sections`, `.settings-toggle-section`, `.settings-toggle-note`, `.settings-toggle-note--warn`, `.settings-toggle-actions`, `.settings-extension-toggle` and `.settings-extension-remove` used to say in `styles/panels.css`, keyed on `part` and re-pointed at the studio token layer. Those fifteen were this section's alone and go with it. Every one of them sized text with `var(--spectrum-font-size-75, 12px)` or a bare `10px`, and the first of those resolved only inside `<sp-theme>` — a document is mounted in the settings pane, where that name is not in scope and every rule would have taken its hard-coded fallback — so the sizes here are the kit's scale. `.settings-section-title`, `.settings-field-desc` and `.settings-field-error` are NOT deleted with them: seven other settings sections are still lit and still name them, so those rules keep their stylesheet and this document carries its own copy of each until the last of those converts.",display:"block",'& [part="title"]':{margin:"0 0 16px",fontSize:"16px",fontWeight:"600",color:"var(--fg)"},'& [part="intro"], & [part="group-desc"]':{$description:"The secondary line, twice: the section's own sentence and the sentence over each group. Both were `.settings-field-desc`.",margin:"0 0 6px",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"},'& [part="section-error"]':{$description:'The last operation that failed, said under the section title. Not a second announcement: `updateSiteConfig` already files a Problem for a rejected write and `activity.fail` files one for a rejected install. studio-ui-guidelines.md §13.1 makes INLINE the tier for "the value is on screen, and nothing else is the right place" — the Problem is about the file, and this line is about the switch the reader is looking at. It is `section-error` rather than `error`, the name every settings section uses, because every kit field draws a permanent `[part="error"]` of its own and the kit is light DOM: a rule on that name here would reach any field the section ever holds.',margin:"6px 0 0",fontSize:"var(--jx-text-md)",color:"var(--danger)"},'& [part="group"]':{display:"flex",flexDirection:"column",marginBottom:"16px"},'& [part="group-title"]':{margin:"0 0 2px",fontSize:"var(--jx-text-md)",fontWeight:"600",color:"var(--fg)"},'& [part="row"]':{$description:"A wrapping row, never an overflowing one (studio-ui-guidelines.md §4.6): the package name is author-supplied and unbounded, and Project Settings renders at two very different widths.",display:"flex",flexWrap:"wrap",alignItems:"flex-start",gap:"8px",padding:"8px",border:"1px solid var(--border)",borderRadius:"var(--radius)",marginTop:"4px"},'& [part="row"][data-broken]':{$description:"Enabled in `project.json` and not installed — the one state that fails the next build, so the row says so at its edge as well as in its note.",borderColor:"var(--warning)"},'& [part="body"]':{$description:"`min-width: 0` is the declaration that makes the wrap work: without it the package name below refuses to shrink past its min-content and sets the row's width.",flex:"1 1 220px",minWidth:"0",display:"flex",flexDirection:"column",gap:"2px"},'& [part="row-title"]':{fontSize:"var(--jx-text-md)",fontWeight:"600",color:"var(--fg)"},'& [part="package"]':{fontFamily:"var(--font-mono)",fontSize:"var(--jx-text-xs)",color:"var(--fg-dim)",overflowWrap:"anywhere"},'& [part="desc"]':{margin:"2px 0 0",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"},'& [part="sections"]':{display:"flex",flexWrap:"wrap",gap:"4px",marginTop:"4px"},'& [part="section"]':{$description:"One `project.json` key this extension owns, drawn as a chip so the reader can see what enabling it adds to the file.",padding:"1px 6px",borderRadius:"var(--radius)",background:"var(--accent-15)",fontFamily:"var(--font-mono)",fontSize:"var(--jx-text-xs)",color:"var(--fg)"},'& [part="note"], & [part="note-warn"]':{margin:"4px 0 0",fontSize:"var(--jx-text-xs)",color:"var(--fg-dim)"},'& [part="note-warn"]':{color:"var(--warning)"},'& [part="actions"]':{display:"flex",alignItems:"center",gap:"4px",flexShrink:"0"},'& [part="toggle"]':{$description:"The switch and the Remove button sit at the row's edges and do not take part in its wrap.",flexShrink:"0",marginTop:"2px"},'& [part="remove"]':{flexShrink:"0"},'& [part="empty"]':{$description:'The teaching empty state, drawn here rather than borrowed from `panels/empty-state.ts`: that helper is a lit template, and a document cannot call one. What is kept is the pattern\'s rules (studio-ui-guidelines.md §11) — one sentence saying what the region is FOR, never "no extensions", then where its content comes from — in the compact shape, which reads as a note inside an otherwise populated pane rather than as a whole empty region. It offers no action because there is nothing here to act on: a backend that lists no catalogue is not a project waiting to be filled in.',display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"4px",padding:"8px 12px",textAlign:"left",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="empty-message"], & [part="empty-detail"]':{margin:"0",maxWidth:"34ch",lineHeight:"1.5"},'& [part="empty-detail"]':{opacity:"0.8"}},children:[{tagName:"h3",attributes:{part:"title"},textContent:"Extensions"},{tagName:"p",attributes:{part:"intro"},textContent:"Extensions add what the core does not do on its own: content collections, search, feeds, sign-ins and databases. Turning one on installs its package and enables it; turning it off leaves the package installed."},{tagName:"div",attributes:{part:"section-error-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasError"},cases:{true:{tagName:"p",attributes:{part:"section-error",role:"alert"},textContent:"${state.error}"}}},{tagName:"div",attributes:{part:"list-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/listState"},cases:{empty:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",attributes:{part:"empty-message"},textContent:"Extensions add what the core does not do on its own: content collections, search, feeds, sign-ins and databases."},{tagName:"p",attributes:{part:"empty-detail"},textContent:"This backend lists no catalogue, so nothing can be offered here yet."}]},groups:{tagName:"div",attributes:{part:"groups",role:"none"},style:{display:"contents"},children:[{$prototype:"Array",items:{$ref:"#/state/groups"},key:{$ref:"$map/item/origin"},map:{tagName:"div",attributes:{part:"group","data-origin":"${$map.item.origin}"},children:[{tagName:"h4",attributes:{part:"group-title"},textContent:"${$map.item.label}"},{tagName:"p",attributes:{part:"group-desc"},textContent:"${$map.item.blurb}"},{$prototype:"Array",items:{$ref:"$map/item/rows"},key:{$ref:"$map/item/name"},map:{tagName:"div",attributes:{part:"row","data-package":"${$map.item.name}","data-broken":"${$map.item.broken ? '' : null}"},children:[{tagName:"jx-switch",attributes:{part:"toggle"},$props:{size:"sm",label:{$ref:"$map/item/title"},checked:{$ref:"$map/item/enabled"},disabled:{$ref:"$map/item/blocked"},hint:{$ref:"$map/item/blockedReason"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/toggle"},value:[{$ref:"$map/item/specifier"},{$ref:"event#/target/checked"}]}]}},{tagName:"div",attributes:{part:"body"},children:[{tagName:"span",attributes:{part:"row-title"},textContent:"${$map.item.title}"},{tagName:"code",attributes:{part:"package"},textContent:"${$map.item.name}"},{tagName:"div",attributes:{part:"desc-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasDescription"},cases:{true:{tagName:"p",attributes:{part:"desc"},textContent:"${$map.item.description}"}}},{tagName:"div",attributes:{part:"sections-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasSections"},cases:{true:{tagName:"div",attributes:{part:"sections"},children:[{$prototype:"Array",items:{$ref:"$map/item/sections"},key:{$ref:"$map/item/key"},map:{tagName:"span",attributes:{part:"section"},textContent:"${$map.item.key}"}}]}}},{tagName:"div",attributes:{part:"note-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/noteTone"},cases:{note:{tagName:"p",attributes:{part:"note"},textContent:"${$map.item.note}"},warn:{tagName:"p",attributes:{part:"note-warn"},textContent:"${$map.item.note}"}}}]},{tagName:"div",attributes:{part:"actions"},children:[{tagName:"div",attributes:{part:"remove-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/canRemove"},cases:{true:{tagName:"jx-action-button",attributes:{part:"remove"},$props:{icon:"trash",size:"sm",label:{$ref:"$map/item/removeLabel"},hint:{$ref:"$map/item/removeHint"},disabled:{$ref:"$map/item/removeDisabled"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/remove"},value:[{$ref:"$map/item/name"}]}]}}}}]}]}}]}}]}}}]};E("settings-extensions",cP);function dP(e,t){e.groups=t.groups,e.listState=t.groups.length===0?"empty":"groups",e.error=t.error,e.hasError=t.error!==""}function pP(e,t,r){let o=g({error:"",groups:[],hasError:!1,listState:"empty",remove:r.remove,toggle:r.toggle});dP(o,t),e.replaceChildren();let a=null,i=!1;return R("settings-extensions",o,e).then((s)=>{if(i){s.dispose();return}a=s}),{connected:()=>!i&&(a===null?e.childNodes.length===0:a.root.parentNode===e),dispose(){i=!0,a?.dispose(),a=null},echo(s,l){for(let f of o.groups)for(let c of f.rows)if(c.specifier===s)c.enabled=l},update:(s)=>dP(o,s)}}var XV=[{blurb:"Extensions this project can turn on. Enabling one installs its package first if it is missing.",label:"Available",origin:"catalog"},{blurb:"Extension packages already in this project's dependencies.",label:"Installed",origin:"installed"},{blurb:"Named in project.json, but this backend does not describe them. You can still turn them off.",label:"Named in project.json",origin:"configured"}],Hc=null,Fh=new WeakMap,Bi=new WeakMap;function QV(e){if(e.unavailable!==void 0)return{note:e.unavailable,noteTone:"warn"};if(e.broken)return{note:`${e.name} is named in project.json but is not installed, so the next build will fail. Turn it off, or turn it off and on again to install it.`,noteTone:"warn"};if(!e.installed)return{note:"Not installed. Turning this on installs it first.",noteTone:"note"};return{note:"",noteTone:"none"}}function ZV(e){if(e.unavailable!==void 0&&!e.enabled)return e.unavailable;let t=jh();return t===null?"":`Waiting for ${t} to finish.`}function eW(e){let t=e.enabled?`Turn ${e.title} off first. Removing the package while project.json still names it would fail the next build.`:"";return{canRemove:e.installed,removeDisabled:t!==""||jh()!==null,removeHint:t===""?`Remove ${e.name}`:t,removeLabel:`Remove ${e.name}`}}function tW(e){let t=ZV(e);return{blocked:t!=="",blockedReason:t,broken:e.broken,description:e.description??"",enabled:e.enabled,hasDescription:(e.description??"")!=="",hasSections:e.sections.length>0,name:e.name,sections:e.sections.map((r)=>({key:r})),specifier:e.specifier,title:e.title,...QV(e),...eW(e)}}function uP(e){let t=Bn(Hc),r=[];for(let o of XV){let a=t.filter((i)=>i.origin===o.origin);if(a.length>0)r.push({blurb:o.blurb,label:o.label,origin:o.origin,rows:a.map((i)=>tW(i))})}return{error:Bi.get(e)??"",groups:r}}function Vi(e){let t=Fh.get(e);if(t?.connected()){t.update(uP(e));return}t?.dispose(),Fh.set(e,pP(e,uP(e),oW(e)))}async function _h(e){try{Hc=await p().listPackages()}catch{Hc=[]}Vi(e)}async function nW(e,t,r){Fh.get(e)?.echo(t,r),Bi.delete(e);let o=Bn(Hc).find((i)=>i.specifier===t);if(o===void 0){Vi(e);return}let a=o.enabled?Oh(o.specifier):Ah(o.specifier);Vi(e);try{await a}catch(i){Bi.set(e,X(i))}await _h(e)}async function rW(e,t){Bi.delete(e);let r=Mh(t);Vi(e);try{await r}catch(o){Bi.set(e,X(o))}await _h(e)}var mP=new WeakMap;function oW(e){let t=mP.get(e);if(!t)t={remove:(r)=>{rW(e,r)},toggle:(r,o)=>{nW(e,r,o)}},mP.set(e,t);return t}function fP(e){Vi(e),_h(e)}var hP={$schema:"https://jxsuite.com/schema/v1",$id:"StudioSettingsOverview",$description:"Project Settings › Overview: the project's identity. Its name, the description meta a search result reads, the production URL a sitemap is built from, its favicon, and the way through to Project Styles. Every row is a `jx-field` and every text control a `jx-textfield`, so the label, the sentence under it, the naming of the control and the announced refusal are all the kit's — this document draws the section's own rhythm and the favicon row, and nothing else. The adapter decides what is written and what is refused; nothing here reads `project.json`.",tagName:"div",attributes:{part:"overview"},style:{$description:"What is NOT in this block is the conversion. Four stylesheet rules had no counterpart to write: `.settings-field-label` and `.settings-field-desc` drew a row's label and the sentence under it, and `jx-field` draws both — with the label actually NAMING the control, which the bare `<label>` they styled never did; `.settings-field-error` drew a refused value's sentence, and `jx-textfield` draws that into a permanent live region under the field, so the first refusal is announced rather than only a later one; and `.settings-site-description`'s `min-height` sized a textarea the kit already gives three rows. What is left is what this section decides for itself.",display:"flex",flexDirection:"column",gap:"20px",fontFamily:"var(--jx-font-sans)",color:"var(--fg)",'& [part="heading"]':{margin:"0",fontSize:"16px",fontWeight:"600",color:"var(--fg)"},"& jx-textfield":{$description:"How wide a text control may grow. A name field spanning a 900px pane is a line the eye has to travel to read six characters; 420px is the measure `.settings-site-name`, `.settings-site-url` and `.settings-site-description` shared, and it is the one thing those three rules said that the kit does not.",width:"100%",maxWidth:"420px"},'& [part="favicon-row"], & [part="styles-row"]':{$description:'The two rows whose control is not a single field, and the reason each opens with a plain `div`: `jx-field` names the first thing slotted into it, and a button named by its row would be announced as "Favicon" or "Global Styles" instead of the verb it carries. A `div` observes no naming, so the row leaves it alone and the buttons keep the names they say on screen.',display:"flex",alignItems:"center",gap:"var(--jx-space-4)"},'& [part="favicon"], & [part="favicon-empty"]':{$description:"One box, whether or not there is an icon in it, so the row does not resize the moment an upload lands.",width:"32px",height:"32px",boxSizing:"border-box",borderRadius:"var(--radius)"},'& [part="favicon"]':{objectFit:"contain",border:"1px solid var(--border)",padding:"2px"},'& [part="favicon-empty"]':{display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed var(--border)",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)"},'& [part="favicon-path"]':{$description:"Where the icon came from. It read `--spectrum-font-size-50` with an 11px fallback, which resolved only inside `<sp-theme>` — this document is mounted in the settings pane, where that name is not in scope and every one of these would have taken the fallback — so the size is the kit's scale and the colour is the studio layer's.",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)",wordBreak:"break-all"},'& [part="section-error"], & [part="favicon-error"]':{$description:'A failed write with no control of its own to sit under. Settings save on change, so a rejection nobody shows reads as "my edit just vanished"; the sentence stands, in the danger colour, until a later write succeeds.',margin:"0",fontSize:"var(--jx-text-sm)",color:"var(--danger)"}},children:[{tagName:"h3",attributes:{part:"title"},textContent:"Overview"},{tagName:"div",attributes:{part:"section-error-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasSectionError"},cases:{true:{tagName:"p",attributes:{part:"section-error",role:"alert"},textContent:"${state.sectionError}"}}},{tagName:"jx-field",$props:{span:!0,label:"Site Name",description:"What this site is called — used in page titles and the project list.",invalid:{$ref:"#/state/nameInvalid"}},attributes:{part:"row","data-field":"name"},children:[{tagName:"jx-textfield",$props:{size:"sm",placeholder:"My Site",value:{$ref:"#/state/nameValue"},invalid:{$ref:"#/state/nameInvalid"},error:{$ref:"#/state/nameError"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setName"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{span:!0,label:"Description",description:"One or two sentences about the site. Search engines and link previews show this.",invalid:{$ref:"#/state/descriptionInvalid"}},attributes:{part:"row","data-field":"description"},children:[{tagName:"jx-textfield",$props:{size:"sm",multiline:!0,placeholder:"A short description of the site",value:{$ref:"#/state/descriptionValue"},invalid:{$ref:"#/state/descriptionInvalid"},error:{$ref:"#/state/descriptionError"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setDescription"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{span:!0,label:"Production URL",description:"Where the published site lives. Sitemaps and absolute links are built from it.",invalid:{$ref:"#/state/urlInvalid"}},attributes:{part:"row","data-field":"url"},children:[{tagName:"jx-textfield",$props:{size:"sm",type:"url",placeholder:"https://example.com",value:{$ref:"#/state/urlValue"},invalid:{$ref:"#/state/urlInvalid"},error:{$ref:"#/state/urlError"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setUrl"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{span:!0,label:"Favicon",description:"Upload an image to use as the site favicon."},attributes:{part:"row","data-field":"favicon"},children:[{tagName:"div",attributes:{part:"favicon-row"},children:[{tagName:"div",attributes:{part:"favicon-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasFavicon"},cases:{true:{tagName:"img",attributes:{part:"favicon",src:"${state.faviconSrc}",alt:"Current favicon"}},false:{tagName:"div",attributes:{part:"favicon-empty","aria-hidden":"true"},textContent:"—"}}},{tagName:"jx-button",$props:{size:"sm"},attributes:{part:"favicon-upload"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/uploadFavicon"}}]},children:[{tagName:"span",textContent:"Upload Favicon"}]},{tagName:"span",attributes:{part:"favicon-path-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasFavicon"},cases:{true:{tagName:"span",attributes:{part:"favicon-path"},textContent:"${state.favicon}"}}}]},{tagName:"div",attributes:{part:"favicon-error-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasFaviconError"},cases:{true:{tagName:"p",attributes:{part:"favicon-error",role:"alert"},textContent:"${state.faviconError}"}}}]},{tagName:"jx-field",$props:{span:!0,label:"Global Styles",description:"The CSS variables and the default element styles that apply across every page live in the Styles workspace, which edits this same file."},attributes:{part:"row","data-field":"styles"},children:[{tagName:"div",attributes:{part:"styles-row"},children:[{tagName:"jx-button",$props:{size:"sm",disabled:{$ref:"#/state/stylesDisabled"}},attributes:{part:"styles-open",title:"${state.stylesTitle}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openStyles"}}]},children:[{tagName:"span",textContent:"Go to Styles"}]}]}]}]};E("settings-overview",hP);function qi(e,t){return e?.field===t?e.message:""}function gP(e,t){if(t.name!==void 0)e.nameValue=t.name;if(t.description!==void 0)e.descriptionValue=t.description;if(t.url!==void 0)e.urlValue=t.url;if(t.favicon!==void 0)e.favicon=t.favicon,e.hasFavicon=t.favicon!=="";if(t.faviconSrc!==void 0)e.faviconSrc=t.faviconSrc;if(t.stylesTitle!==void 0)e.stylesTitle=t.stylesTitle;if(t.stylesDisabled!==void 0)e.stylesDisabled=t.stylesDisabled;if(t.error!==void 0){let{error:r}=t;e.nameError=qi(r,"name"),e.nameInvalid=e.nameError!=="",e.descriptionError=qi(r,"description"),e.descriptionInvalid=e.descriptionError!=="",e.urlError=qi(r,"url"),e.urlInvalid=e.urlError!=="",e.faviconError=qi(r,"favicon"),e.hasFaviconError=e.faviconError!=="",e.sectionError=qi(r,"section"),e.hasSectionError=e.sectionError!==""}}function bP(e,t,r){let o=g({descriptionError:"",descriptionInvalid:!1,descriptionValue:"",favicon:"",faviconError:"",faviconSrc:"",hasFavicon:!1,hasFaviconError:!1,hasSectionError:!1,nameError:"",nameInvalid:!1,nameValue:"",openStyles:r.openStyles,sectionError:"",setDescription:r.setDescription,setName:r.setName,setUrl:r.setUrl,stylesDisabled:!1,stylesTitle:"",uploadFavicon:r.uploadFavicon,urlError:"",urlInvalid:!1,urlValue:""});gP(o,t),e.replaceChildren();let a=null,i=!1;return R("settings-overview",o,e).then((s)=>{if(i){s.dispose();return}a=s}),{connected:()=>!i&&(a===null?e.childNodes.length===0:a.root.parentNode===e),dispose(){i=!0,a?.dispose(),a=null},update:(s)=>gP(o,s)}}var Wc=new WeakMap,zh=new WeakMap;function Hh(){return C?.projectConfig||{}}function qc(e){return e.tagName==="meta"&&e.attributes?.name==="description"}function iW(e){let r=(e.$head??[]).find((o)=>qc(o))?.attributes?.content;return n(r)?r:""}function sW(e,t){let r=t.trim();if(!e.some((o)=>qc(o)))return r?[...e,{attributes:{content:r,name:"description"},tagName:"meta"}]:[...e];if(!r)return e.filter((o)=>!qc(o));return e.map((o)=>qc(o)?{...o,attributes:{...o.attributes,content:r}}:o)}function Bh(e){let t=e.attributes?.rel;return e.tagName==="link"&&n(t)&&t.toLowerCase().split(/\s+/u).some((r)=>r==="icon")}function yP(e){let t=(e.$head??[]).find((r)=>Bh(r))?.attributes?.href;return n(t)?t:""}function lW(e,t){if(!e.some((r)=>Bh(r)))return[...e,{attributes:{href:t,rel:"icon"},tagName:"link"}];return e.map((r)=>{if(!Bh(r))return r;let{type:o,...a}=r.attributes??{};return{...r,attributes:{...a,href:t}}})}function cW(e){let t=e.name.lastIndexOf("."),r=t>0?e.name.slice(t+1).toLowerCase():"";return/^[a-z0-9]+$/u.test(r)?`favicon.${r}`:"favicon.ico"}var dW={url:void 0},pW="workspace.focus.styles";function vP(e){let t=Hh(),r=ae()?.get(pW);return{description:iW(t),error:Wc.get(e)??null,favicon:yP(t),faviconSrc:hv(yP(t),an),name:t.name??"",stylesDisabled:r===void 0,stylesTitle:r?.title??"",url:t.url??""}}function uW(e){let t=(i)=>{zh.get(e)?.update(i)},r=async(i,s="section")=>{try{await no(i),Wc.delete(e)}catch(l){Wc.set(e,{field:s,message:`Could not save project.json — ${X(l)}`})}Jc(e)},o=(i,s)=>{Wc.set(e,{field:i,message:s}),Jc(e)};return{openStyles:()=>{nt("view.setWorkspace",{workspace:"styles"},"Settings")},setDescription:(i)=>{t({description:i}),r({$head:sW(Hh().$head??[],i)},"description")},setName:(i)=>{t({name:i});let s=i.trim();if(!s){o("name","A project name is required.");return}r({name:s},"name")},setUrl:(i)=>{t({url:i});let s=i.trim();if(s&&!/^https?:\/\/\S+$/.test(s)){o("url","Enter a full address starting with http:// or https://");return}r(s?{url:s}:dW,"url")},uploadFavicon:()=>{let i=document.createElement("input");i.type="file",i.accept="image/*,.ico,.svg",i.addEventListener("change",async()=>{let s=i.files?.[0];if(!s)return;let l=cW(s);try{await p().uploadFile(`public/${l}`,s)}catch(f){o("favicon",`Could not upload the favicon — ${X(f)}`);return}await r({$head:lW(Hh().$head??[],`/${l}`)},"favicon")}),i.click()}}}function Jc(e){let t=zh.get(e);if(t?.connected()){t.update(vP(e));return}t?.dispose(),zh.set(e,bP(e,vP(e),uW(e)))}var wP={$schema:"https://jxsuite.com/schema/v1",$id:"StudioSettingsHead",$description:"Project Settings › Site head: the project-level Google Fonts the site imports, and the raw `$head` tags it emits on every page. The adapter hands in one projection row per `$head` entry — which field set to draw, and the strings each field holds — so this document decides nothing about what an entry means, only what it looks like.",tagName:"div",attributes:{part:"head-settings"},style:{$description:"The section's own look. `.head-code-editor` is gone rather than moved: it drew a mono face, a padded box on `--bg-input`, a border, a radius and a vertical resize handle around a bare `<textarea>`, and a `jx-textfield` with `multiline`, `mono` and `rows` is all six — so the code boxes lost a rule and gained nothing. `.head-entry-fields`, `.head-entry-body`, `.head-entries` and `.head-add-actions` had no stylesheet rule at all; their layout was carried by inline `style=` attributes, which is what the parts below replace.",display:"block",'& [part="section"] + [part="section"]':{$description:"The gap between Google Fonts and Head. `.settings-section` was an orphan class with no rule anywhere, so the two sections ran together and only the add-row's inline `margin-top` kept them apart — the separation is drawn here instead of implied.",marginTop:"var(--jx-space-6)"},'& [part="section-title"]':{margin:"0 0 var(--jx-space-5)",fontSize:"16px",fontWeight:"600",color:"var(--fg)"},'& [part="section-desc"]':{margin:"0 0 6px",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"},'& [part="entry"], & [part="font-row"]':{border:"1px solid var(--border)",borderRadius:"var(--radius)",padding:"var(--jx-space-4)",marginBottom:"var(--jx-space-3)"},'& [part="font-row"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-3)"},'& [part="font-name"]':{flex:"1",minWidth:"0",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--fg)"},'& [part="fonts"]':{marginBottom:"var(--jx-space-4)"},'& [part="font-add"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-3)"},'& [part="font-input"]':{flex:"1",minWidth:"0"},'& [part="empty"]':{margin:"0",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"},'& [part="entry-header"]':{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"var(--jx-space-3)"},'& [part="entry-tag"]':{fontSize:"var(--jx-text-md)",fontWeight:"600",color:"var(--fg)"},'& [part="entry-fields"]':{$description:"One column, gapped. The rows used to space themselves with `margin-bottom` on each `.settings-field-row`, which left a trailing margin under the last one inside the entry's own padding.",display:"flex",flexDirection:"column",gap:"var(--jx-space-3)",minWidth:"0"},'& [part="field-row"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-3)",minWidth:"0"},'& [part="field-wide"]':{flex:"1",minWidth:"0"},'& [part="body-field"]':{width:"100%"},'& [part="add-actions"]':{display:"flex",gap:"var(--jx-space-3)",marginTop:"var(--jx-space-4)"}},children:[{tagName:"section",attributes:{part:"section","data-section":"fonts"},children:[{tagName:"h3",attributes:{part:"section-title"},textContent:"Google Fonts"},{tagName:"p",attributes:{part:"section-desc"},textContent:"Manage Google Fonts imported across all pages in this project."},{tagName:"div",attributes:{part:"fonts",role:"none"},$switch:{$ref:"#/state/fontsState"},cases:{empty:{tagName:"p",attributes:{part:"empty"},textContent:"No fonts imported."},listed:{tagName:"div",attributes:{part:"font-list",role:"none"},children:[{$prototype:"Array",items:{$ref:"#/state/fonts"},key:{$ref:"$map/item/id"},map:{tagName:"div",attributes:{part:"font-row"},children:[{tagName:"span",attributes:{part:"font-name"},textContent:"${$map.item.family}"},{tagName:"jx-action-button",$props:{icon:"trash",size:"sm",label:"Remove ${$map.item.family}",hint:"Remove ${$map.item.family}"},attributes:{part:"remove-font"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/removeFont"},value:[{$ref:"$map/item/id"}]}]}}]}}]}}},{tagName:"div",attributes:{part:"font-add"},children:[{tagName:"jx-textfield",$props:{size:"sm",label:"Font family name",placeholder:"Font family name…",value:{$ref:"#/state/fontDraft"}},attributes:{part:"font-input"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/draftFont"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/addFont"},value:[]}]}}]}},{tagName:"jx-button",$props:{size:"sm"},attributes:{part:"add-font"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/addFont"},value:[]}]},children:[{tagName:"span",textContent:"+ Add"}]}]}]},{tagName:"section",attributes:{part:"section","data-section":"head"},children:[{tagName:"h3",attributes:{part:"section-title"},textContent:"Head"},{tagName:"p",attributes:{part:"section-desc"},textContent:"Manage global <head> tags — stylesheets, meta tags, scripts, and inline styles."},{tagName:"div",attributes:{part:"entries",role:"none"},children:[{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/id"},map:{tagName:"div",attributes:{part:"entry"},children:[{tagName:"div",attributes:{part:"entry-header"},children:[{tagName:"span",attributes:{part:"entry-tag"},textContent:"<${$map.item.tag}>"},{tagName:"jx-action-button",$props:{icon:"trash",size:"sm",label:"Remove the <${$map.item.tag}> tag",hint:"Remove the <${$map.item.tag}> tag"},attributes:{part:"remove-entry"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/remove"},value:[{$ref:"$map/item/id"}]}]}}]},{tagName:"div",attributes:{part:"entry-fields",role:"none"},$switch:{$ref:"$map/item/kind"},cases:{link:{tagName:"div",attributes:{part:"field-row"},children:[{tagName:"jx-textfield",$props:{size:"sm",label:"rel",value:"${$map.item.rel}"},attributes:{part:"field","data-key":"rel"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/edit"},value:[{$ref:"$map/item/id"},"rel",{$ref:"event#/target/value"}]}]}},{tagName:"jx-textfield",$props:{size:"sm",label:"href",value:"${$map.item.href}"},attributes:{part:"field-wide","data-key":"href"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/edit"},value:[{$ref:"$map/item/id"},"href",{$ref:"event#/target/value"}]}]}}]},meta:{tagName:"div",attributes:{part:"field-row"},children:[{tagName:"jx-textfield",$props:{size:"sm",label:"name",value:"${$map.item.name}"},attributes:{part:"field","data-key":"name"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/edit"},value:[{$ref:"$map/item/id"},"name",{$ref:"event#/target/value"}]}]}},{tagName:"jx-textfield",$props:{size:"sm",label:"content",value:"${$map.item.content}"},attributes:{part:"field-wide","data-key":"content"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/edit"},value:[{$ref:"$map/item/id"},"content",{$ref:"event#/target/value"}]}]}}]},script:{tagName:"div",attributes:{part:"field-row"},children:[{tagName:"jx-textfield",$props:{size:"sm",label:"src",placeholder:"URL or leave empty for inline",value:"${$map.item.src}"},attributes:{part:"field-wide","data-key":"src"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/edit"},value:[{$ref:"$map/item/id"},"src",{$ref:"event#/target/value"}]}]}}]},"script-inline":{tagName:"div",attributes:{part:"field-group",role:"none"},style:{display:"contents"},children:[{tagName:"div",attributes:{part:"field-row"},children:[{tagName:"jx-textfield",$props:{size:"sm",label:"src",placeholder:"URL or leave empty for inline",value:"${$map.item.src}"},attributes:{part:"field-wide","data-key":"src"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/edit"},value:[{$ref:"$map/item/id"},"src",{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{label:"Script body",span:!0},attributes:{part:"body-row"},children:[{tagName:"jx-textfield",$props:{size:"sm",multiline:!0,mono:!0,rows:"6",value:"${$map.item.body}"},attributes:{part:"body-field","data-key":"content",spellcheck:"false"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/edit"},value:[{$ref:"$map/item/id"},"content",{$ref:"event#/target/value"}]}]}}]}]},style:{tagName:"jx-field",$props:{label:"Style body",span:!0},attributes:{part:"body-row"},children:[{tagName:"jx-textfield",$props:{size:"sm",multiline:!0,mono:!0,rows:"8",value:"${$map.item.body}"},attributes:{part:"body-field","data-key":"content",spellcheck:"false"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/edit"},value:[{$ref:"$map/item/id"},"content",{$ref:"event#/target/value"}]}]}}]}}}]}}]},{tagName:"div",attributes:{part:"add-actions"},children:[{$prototype:"Array",items:{$ref:"#/state/tags"},key:{$ref:"$map/item/tag"},map:{tagName:"jx-button",$props:{size:"sm"},attributes:{part:"add-entry","data-tag":"${$map.item.tag}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/add"},value:[{$ref:"$map/item/tag"}]}]},children:[{tagName:"span",textContent:"${$map.item.label}"}]}}]}]}]};E("settings-head",wP);var fW=[{label:"+ Link",tag:"link"},{label:"+ Meta",tag:"meta"},{label:"+ Script",tag:"script"},{label:"+ Style",tag:"style"}],Xi=new WeakMap,xP=0;function $P(e){let t=Xi.get(e);if(t===void 0)xP+=1,t=`head-${xP}`,Xi.set(e,t);return t}var kP=null,Vh=[];function ro(){let e=C?.projectConfig??null;if(e!==kP){if(kP=e,Vh=[],td)td.fontDraft=""}let t=e?.$head;if(Array.isArray(t))Vh=t;return Vh}function hW(e){return ro().find((t)=>Xi.get(t)===e)}function Vn(e){return n(e)?e:""}function gW(e){let t=e.attributes??{},r=Vn(t.src),o=Vn(e.tagName),a=new Map([["link","link"],["meta","meta"],["script",r===""?"script-inline":"script"],["style","style"]]);return{body:Vn(e.textContent),content:Vn(t.content),href:Vn(t.href),id:$P(e),kind:a.get(o)??"none",name:Vn(t.name),rel:Vn(t.rel),src:r,tag:o}}function bW(){let e=ro(),t=e.filter((r)=>ew(r));return{fonts:t.map((r)=>({family:vD(Vn(r.attributes?.href)),id:$P(r)})),fontsState:t.length===0?"empty":"listed",rows:e.map((r)=>gW(r))}}function Ui(){no({$head:ro()})}var Gi=new Map;function Yc(){for(let e of Gi.values())clearTimeout(e.timer),e.commit();Gi.clear()}function yW(e,t,r){let o=hW(e);if(!o)return;if(t==="content"&&(o.tagName==="script"||o.tagName==="style"))o.textContent=r;else o.attributes??={},o.attributes[t]=r;Ui()}var td=null;function Ji(){Object.assign(Ki(),bW())}function Ki(){return td??=g({add(e){Yc();let t={},r={attributes:t,tagName:e};if(e==="link")t.rel="stylesheet",t.href="";else if(e==="meta")t.name="",t.content="";else if(e==="script")t.src="";else if(e==="style")r.textContent="";ro().push(r),Ui(),Ji()},addFont(){Yc();let e=Ki().fontDraft.trim();if(e==="")return;let t=ro();wD(t),t.push({attributes:{href:yD(e),rel:"stylesheet"},tagName:"link"}),Ki().fontDraft="",Ui(),Ji()},draftFont(e){Ki().fontDraft=e},edit(e,t,r){let o=`${e}:${t}`;clearTimeout(Gi.get(o)?.timer);let a=()=>{Gi.delete(o),yW(e,t,r)};Gi.set(o,{commit:a,timer:setTimeout(a,d1)})},fonts:[],fontDraft:"",fontsState:"empty",remove(e){Yc();let t=ro(),r=t.findIndex((o)=>Xi.get(o)===e);if(r===-1)return;t.splice(r,1),Ui(),Ji()},removeFont(e){Yc();let t=ro(),r=t.findIndex((a)=>Xi.get(a)===e);if(r===-1)return;t.splice(r,1);let o=xD(t);if(o!==t)t.length=0,t.push(...o);Ui(),Ji()},rows:[],tags:fW}),td}var Zc=null,Yi=null,aa=null;function vW(){let e=Yi;if(Yi=null,aa)aa.dispose(),aa=null;else if(e)e.then((t)=>{t.dispose()});Zc=null}function Wh(e){if(Ji(),Zc===e&&aa?.root.parentNode===e)return;if(Yi!==null&&Zc===e&&aa===null)return;vW(),Zc=e,e.textContent="";let t=R("settings-head",Ki(),e);Yi=t,t.then((r)=>{if(Yi===t)aa=r;else r.dispose()})}var SP={$schema:"https://jxsuite.com/schema/v1",$id:"StudioSettingsLocales",$description:"Project Settings → Locales: the languages this site is written in, which of them a page is written in when its file carries no locale directory, and how a locale is spelled in a URL. The adapter (`surfaces/settings-locales.ts`) hands in the declared list AS THE AUTHOR WROTE IT, the two option lists, what the pending tag refuses to be and whatever the last write left to say; the document draws them and hands every edit straight back. Nothing here reads `project.json` — a section that re-read the config while drawing would be a second opinion about a file one module already owns.",tagName:"section",attributes:{part:"locales"},style:{$description:"The Locales section's own look. Three of the rules it used to borrow are gone rather than moved: `.settings-field-label` and `.settings-field-desc` are what `jx-field` draws for a labelled row (and it also names the control the label belongs to, which a bare `<label class=…>` never did), and the refusal under the tag field is `jx-textfield`'s own `error` sentence, whose region is permanent so the FIRST refusal is announced rather than only a later one.",display:"block",'& [part="title"]':{margin:"0 0 16px",fontSize:"16px",fontWeight:"600",color:"var(--fg)"},'& [part="intro"]':{margin:"0 0 16px",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"},'& [part="section-error"]':{$description:"A write that failed, said under the section title rather than pinned to a control: settings save on change, so a silent rejection would read as \"my edit just vanished\", and the whole file failed rather than one field. It is `section-error` rather than `error` because the tag field's refusal IS the kit's own `[part=\"error\"]` sentence, in this same light-DOM tree: a rule on that name gave the tag field's refusal this margin and size, and reached the two pickers' empty regions as well.",margin:"6px 0 0",fontSize:"var(--jx-text-md)",color:"var(--danger)"},'& [part="field"]':{marginBottom:"20px"},'& [part="panel"]':{$description:"The language list. It used to borrow `.settings-list-panel`, whose `width: 200px` is the LEFT NAV of the two-column editors that class was written for — a fixed 200px column is not what a list of languages under a 320px picker wants, so the width it takes here is the one that lines up with the two controls below it. Its `overflow-y: auto` went the same way: nothing constrains this panel's height, so the declaration could never do anything.",display:"flex",flexDirection:"column",gap:"4px",padding:"12px",maxWidth:"320px",background:"var(--bg-panel)",borderRadius:"var(--radius)"},'& [part="row"]':{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px",padding:"4px 8px"},'& [part="name"]':{fontSize:"var(--jx-text-md)",color:"var(--fg)",overflowWrap:"anywhere"},'& [part="tag"]':{$description:`The raw BCP 47 tag beside the language's own name. Both are shown because they answer different questions — "which language is this" is the autonym, "what do I type in a path" is the tag — and a row showing only one of them sends the author to the docs to find the other.`,marginInlineStart:"auto",fontFamily:"var(--font-mono)",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"},'& [part="empty"]':{$description:"Drawn as a row rather than as a centred panel: `.settings-empty-state` centres itself because in a two-column editor it fills the whole right pane, and this one is a line where the first language will be.",padding:"4px 8px",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"},'& [part="add"]':{display:"flex",alignItems:"center",gap:"6px"},'& [part="add-field"]':{flex:"1",minWidth:"0"},'& [part="default"], & [part="routing"]':{maxWidth:"320px"}},children:[{tagName:"h3",attributes:{part:"title"},textContent:"Locales"},{tagName:"p",attributes:{part:"intro"},textContent:"The languages this site is written in. A translation is a file under the locale's directory — pages/fr/about.json beside pages/about.json — so declaring a language here is what makes that directory mean something to the build and to Studio."},{tagName:"div",attributes:{part:"section-error-slot",role:"none"},$switch:{$ref:"#/state/hasError"},cases:{true:{tagName:"p",attributes:{part:"section-error",role:"alert"},textContent:"${state.error}"}}},{tagName:"jx-field",attributes:{part:"field"},$props:{label:"Languages",span:!0},children:[{tagName:"div",attributes:{part:"panel"},children:[{tagName:"div",attributes:{part:"list",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/listState"},cases:{empty:{tagName:"div",attributes:{part:"empty"},textContent:"No languages declared."},listed:{tagName:"div",attributes:{part:"rows",role:"none"},style:{display:"contents"},children:[{$prototype:"Array",items:{$ref:"#/state/locales"},key:{$ref:"$map/item/tag"},map:{tagName:"div",attributes:{part:"row"},children:[{tagName:"span",attributes:{part:"name"},textContent:"${$map.item.label}"},{tagName:"span",attributes:{part:"tag"},textContent:"${$map.item.tag}"},{tagName:"jx-action-button",attributes:{part:"remove"},$props:{icon:"trash",size:"sm",label:"Remove ${$map.item.tag}",hint:"Remove ${$map.item.tag}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/remove"},value:[{$ref:"$map/item/tag"}]}]}}]}}]}}},{tagName:"div",attributes:{part:"add"},children:[{tagName:"jx-textfield",attributes:{part:"add-field"},$props:{label:"Language tag",placeholder:"fr-CA",size:"sm",value:{$ref:"#/state/pending"},invalid:{$ref:"#/state/invalid"},error:{$ref:"#/state/refusal"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/edit"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/add"},value:[]}]}}]}},{tagName:"jx-button",attributes:{part:"add-button"},$props:{size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/add"},value:[]}]},children:[{tagName:"span",textContent:"Add"}]}]}]}]},{tagName:"jx-field",attributes:{part:"field"},$props:{label:"Default Language",description:"The language a page is written in when its file carries no locale directory.",span:!0},children:[{tagName:"jx-select",attributes:{part:"default"},$props:{label:"Default Language",size:"sm",options:{$ref:"#/state/localeOptions"},value:{$ref:"#/state/defaultLocale"},disabled:{$ref:"#/state/noLocales"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/chooseDefault"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",attributes:{part:"field"},$props:{label:"URL Routing",description:"Whether the default language owns the unprefixed URLs, or every language is named in its own.",span:!0},children:[{tagName:"jx-select",attributes:{part:"routing"},$props:{label:"URL Routing",size:"sm",options:{$ref:"#/state/routings"},value:{$ref:"#/state/routing"},disabled:{$ref:"#/state/noLocales"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/chooseRouting"},value:[{$ref:"event#/target/value"}]}]}}]}]};E("settings-locales",SP);var CP=new WeakMap;function TP(e){return{...e,hasError:e.error!=="",invalid:e.refusal!=="",listState:e.locales.length===0?"empty":"listed",noLocales:e.locales.length===0}}function PP(e,t,r){let o=CP.get(e);if(o&&(o.handle===null||o.handle.root.isConnected)){Object.assign(o.scope,TP(t));return}o?.handle?.dispose(),e.textContent="";let a=g({...TP(t),...r}),i={handle:null,scope:a};CP.set(e,i),R("settings-locales",a,e).then((s)=>{i.handle=s})}var EP=new WeakMap;function oo(e){let t=EP.get(e);if(!t)t={error:"",pending:""},EP.set(e,t);return t}async function Qi(e,t){try{await no(t),oo(e).error=""}catch(r){oo(e).error=`Could not save project.json — ${X(r)}`}qh(e)}function ao(){return C?.projectConfig??{}}var xW={i18n:void 0},jP=[{label:"Prefix every locale but the default",value:"prefix-except-default"},{label:"Prefix every locale",value:"prefix-always"}];function Zi(){let e=ao().i18n?.locales;return Array.isArray(e)?e.filter((t)=>typeof t==="string"):[]}function RP(e){let t=jn(e);return Zi().some((r)=>jn(r)===t)}async function AP(e){let t=jn(e);if(t===null)return w.error(`"${e}" is not a well-formed language tag.`,{detail:"Languages are BCP 47 tags — a language, optionally a script and a region: `fr`, "+"`pt-BR`, `zh-Hant`. Underscores and spaces are not part of the grammar.",source:"Languages"}),!1;if(RP(t))return w.info(`${Wt(t)} is already one of this project's languages.`,{source:"Languages"}),!1;return await no({i18n:{...ao().i18n,locales:[...Zi(),t]}}),!0}function IP(e){let t=oo(e).pending.trim();if(t==="")return"";if(!Fx(t))return`"${t}" is not a well-formed language tag. Try \`fr\`, \`pt-BR\` or \`zh-Hant\`.`;return RP(t)?`${Wt(t)} is already declared.`:""}function kW(e){let t=Zi(),{i18n:r}=ao(),{error:o,pending:a}=oo(e);return{defaultLocale:r?.defaultLocale??t[0]??"",error:o,localeOptions:t.map((i)=>({label:Wt(i),value:i})),locales:t.map((i)=>({label:Wt(i),tag:i})),pending:a,refusal:IP(e),routing:r?.routing??"prefix-except-default",routings:jP.map((i)=>({label:i.label,value:i.value}))}}function qh(e){PP(e,kW(e),CW(e))}function $W(e){let t=oo(e).pending.trim();if(t===""||IP(e)!=="")return;oo(e).pending="",Qi(e,{i18n:{...ao().i18n,locales:[...Zi(),jn(t)]}})}function SW(e,t){let r=Zi().filter((s)=>s!==t);if(r.length===0){Qi(e,xW);return}let o=ao().i18n,a=o?.defaultLocale!==void 0&&jn(o.defaultLocale)===jn(t),i={...o};if(a)i.defaultLocale=r[0];i.locales=r,Qi(e,{i18n:i})}var NP=new WeakMap;function CW(e){let t=NP.get(e);if(!t)t={add:()=>{$W(e)},chooseDefault:(r)=>{Qi(e,{i18n:{...ao().i18n,defaultLocale:r}})},chooseRouting:(r)=>{let o=jP.find((a)=>a.value===r)?.value;if(o===void 0)return;Qi(e,{i18n:{...ao().i18n,routing:o}})},edit:(r)=>{oo(e).pending=r,qh(e)},remove:(r)=>{SW(e,r)}},NP.set(e,t);return t}function LP(e){qh(e)}var TW=ib.code,OP=hD;ql({group:"general",icon:"sliders-horizontal",key:"overview",label:"Overview",order:10,render:Jc});ql({group:"general",icon:"globe",key:"locales",label:"Locales",order:25,render:LP});ql({group:"integrations",icon:"share-network",key:"extensions",label:"Extensions",order:5,render:fP});ql({group:"advanced",icon:"browser",key:"contexts",label:"Contexts",order:15,render:Ec});ql({group:"advanced",icon:"file-code",key:"head",label:"Site head",order:20,render:Wh});ql({group:"advanced",icon:"brackets-curly",key:"definitions",label:"Data Shapes",order:40,render:Oc});ql({group:"advanced",icon:"cube",key:"dependencies",label:"Packages",order:60,render:aP});ql({group:"advanced",icon:"code",key:"rawJson",label:"Raw JSON",order:900,render:(e)=>{MD(e,{editAsCode:()=>{bn(TW)}})}});function Uh(e){if(e===ib.variables||e===ib.elements)u.stylebook.view=e}function bn(e=u.stylebook.view){let t=C;if(!t)return null;Uh(e);let r=m.tabs.get(an);if(r){for(let a of OP.toReversed())if(!r.capabilities.modes.includes(a))r.capabilities.modes.unshift(a);return r.session.ui.canvasMode=e,r.session.ui.preview=!1,PW(r)}let o=Si({capabilities:{modes:[...OP]},document:t.projectConfig??{},documentPath:an,id:an});return o.session.ui.canvasMode=e,o.session.ui.preview=!1,A$(o),o}function PW(e){for(let t of m.panes)if(t.tabOrder.includes(e.id)){t.activeTabId=e.id,Sr(t.id);break}return e}async function EW(e){if(e!==void 0)SS(e);let t=ae();if(!t)throw Error(`command "settings.open" needs the window's command registry`);await t.run("view.setWorkspace",{workspace:"settings"});let r=Da($a("settings"))?.id;if(r!==void 0)kN(r);try{let{syncExtensionSettingsSections:o}=await (ce("338ee35t"),import("./chunks/extension-sections-338ee35t.js"));await o()}catch(o){w.warn(`Could not load extension settings sections — ${X(o)}`,{key:"settings:sections",path:an,source:"Settings",tier:"problem"})}Ad()}function NW(){return[{args:{additionalProperties:!1,properties:{entry:Fe("An entry key inside the named section (map-layout sections only), e.g. a content type or a data connection."),section:Fe("The settings section key to show. Defaults to the section shown last, or Overview.")},required:[],type:"object"},category:"Project",id:"settings.open",level:"project",keybinding:"mod+shift+,",menus:["commandbar/overflow","settings/menu","palette"],group:"7_settings",requires:"an open project",enablement:(e)=>e.project.open,run:async(e,t)=>{let r=ti("settings.open",t,"section"),o=ti("settings.open",t,"entry");if(await EW(r),r===void 0){if(o!==void 0)throw RangeError('command "settings.open" argument "entry" needs a "section" to name an entry of');return}let a=vT();if(!a.includes(r))throw RangeError(`command "settings.open" argument "section": "${r}" is not a registered `+`settings section — registered: ${a.join(", ")}`);if(o===void 0)return;let i=xN(r,o);if(i!==null)throw RangeError(`command "settings.open" argument "entry": "${o}" is not an entry of settings section "${r}" — entries: ${i.join(", ")||"none"}`);Ad()},title:"Open Project Settings"},{args:Se({view:pi(O_,"Which view of the project's styles to show: elements (element defaults by tag name), variables (the CSS custom properties) or code (project.json as text). Defaults to the view the Styles workspace was left in.")},[]),category:"Project",id:"styles.open",level:"project",menus:["never"],group:"7_settings_styles",requires:"an open project",enablement:(e)=>e.project.open,run:async(e,t)=>{let r=t.view===void 0?null:qn("styles.open",t,"view",O_),o=ae();if(!o)throw Error(`command "styles.open" needs the window's command registry`);if(await o.run("view.setWorkspace",{workspace:"styles"}),r!==null)bn(ib[r])},title:`Open ${Ky}`}]}function MP(e){e.registerAll(NW())}var DP={$schema:"https://jxsuite.com/schema/v1",$id:"StudioStylesPanel",$description:"The Styles panel (specs/studio.md §7.1): the Styles workspace's Navigator, and the way into everything the workspace edits. Three sections, in the order a visit usually needs them. VARIABLES lists every CSS custom property in project.json's root style block, by its real name, grouped as the Variables view groups them (Colors, Fonts, Sizes & Spacing, and Other when anything lands there), each group with its count and each colour with a swatch of what it resolves to; a group heading or a variable shows it in the Variables view, and Add variable focuses the view's own add row. ELEMENTS lists the element defaults by tag name, the specimen catalogue's tags and the project's components, with a dot on every tag project.json already styles; a row selects that tag on the Elements view's canvas, with the Inspector on its style. COLOR SCHEMES lists the schemes the project declares, with Manage color schemes leading to Project Settings › Contexts, where they are defined. `panels/styles-panel.ts` keeps every decision; this document draws rows whose every field is already a string.",tagName:"div",attributes:{part:"styles"},style:{$description:"The Styles panel's own look, keyed on `part`. Rows are native buttons, because a row opens one thing and a button is the element that says so to every reader, and they are the Outline's 24px row so the Navigator reads as one family. A group heading is a row too, at the section's weight, carrying its count. The swatch is the one value this document takes from data: its colour is the variable's resolved value, written as the swatch's background by the binding, never by a style attribute. THE INDENT IS A VARIABLE for the reason `panel-data.json` gives: one shared rule reads `--row-indent`.",display:"flex",flexDirection:"column",minHeight:"0",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",'& [part="sections"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-3)",padding:"var(--jx-space-2) 0 var(--jx-space-4)"},'& [part="section"]':{display:"flex",flexDirection:"column"},'& [part="section-head"]':{display:"flex",alignItems:"baseline",gap:"var(--jx-space-2)",padding:"var(--jx-space-2) var(--jx-space-3) var(--jx-space-1)"},'& [part="section-title"]':{flex:"1",margin:"0",fontSize:"var(--jx-text-sm)",fontWeight:"600",letterSpacing:"0.04em",textTransform:"uppercase",color:"var(--fg-dim)"},'& [part="section-count"], & [part="row-count"]':{flexShrink:"0",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)",fontVariantNumeric:"tabular-nums"},'& [part="rows"]':{display:"flex",flexDirection:"column",margin:"0",padding:"0",listStyle:"none"},'& [part="group-row"], & [part="variable-row"], & [part="element-row"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",width:"100%",blockSize:"24px",boxSizing:"border-box",margin:"0",padding:"0 var(--jx-space-3)",paddingInlineStart:"var(--row-indent, var(--jx-space-3))",border:"none",borderInlineStart:"2px solid transparent",background:"none",color:"inherit",font:"inherit",textAlign:"start",whiteSpace:"nowrap",cursor:"pointer",":hover":{background:"var(--hover-bg)"},":focus-visible":{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"}},'& [part="group-row"]':{fontWeight:"600"},'& [part="variable-row"]':{paddingInlineStart:"calc(var(--jx-space-3) + var(--jx-space-4))"},'& [aria-current="true"]':{background:"var(--accent-20)",borderInlineStartColor:"var(--accent)"},'& [part="row-label"]':{flex:"1",minWidth:"0",overflow:"hidden",textOverflow:"ellipsis"},'& [part="var-name"], & [part="tag"]':{flex:"1",minWidth:"0",overflow:"hidden",textOverflow:"ellipsis",fontFamily:"var(--font-mono)",fontSize:"var(--jx-text-sm)"},'& [part="var-value"]':{flexShrink:"1",maxWidth:"90px",overflow:"hidden",textOverflow:"ellipsis",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)"},'& [part="swatch"]':{$description:"What the colour resolves to, drawn as a 12px chip with a hairline so a white or transparent value still reads as a chip.",flexShrink:"0",width:"12px",height:"12px",borderRadius:"var(--jx-radius-xs)",border:"1px solid var(--border)",boxSizing:"border-box"},'& [part="element-group-label"]':{padding:"var(--jx-space-1) var(--jx-space-3) 0",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="dot"]':{$description:"project.json already styles this tag. The kit's neutral disc in the accent.",background:"var(--accent)"},'& [part="scheme-row"]':{display:"flex",alignItems:"baseline",gap:"var(--jx-space-2)",padding:"var(--jx-space-1) var(--jx-space-3)"},'& [part="scheme-query"]':{flex:"1",minWidth:"0",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontFamily:"var(--font-mono)",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="note"], & [part="no-project"]':{margin:"0",padding:"var(--jx-space-1) var(--jx-space-3)",fontSize:"var(--jx-text-sm)",lineHeight:"1.5",color:"var(--fg-dim)"},'& [part="foot"]':{padding:"var(--jx-space-1) var(--jx-space-2) 0"},"@(forced-colors: active)":{'& [aria-current="true"]':{$description:"The current row, redrawn: in forced colours the accent wash collapses into the page and the leading edge is the marker left.",borderInlineStartColor:"Highlight"},'& [part="swatch"]':{forcedColorAdjust:"none"}}},children:[{tagName:"div",attributes:{part:"body-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/body"},cases:{none:{tagName:"p",attributes:{part:"no-project"},textContent:"Open a project to edit its styles."},styles:{tagName:"div",attributes:{part:"sections"},children:[{tagName:"section",attributes:{part:"section","data-section":"variables","aria-labelledby":"styles-panel-variables"},children:[{tagName:"div",attributes:{part:"section-head"},children:[{tagName:"h3",attributes:{part:"section-title",id:"styles-panel-variables"},textContent:"Variables"},{tagName:"span",attributes:{part:"section-count"},textContent:"${state.variableCount}"}]},{tagName:"div",attributes:{part:"variables-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/variablesState"},cases:{empty:{tagName:"p",attributes:{part:"note"},textContent:"Every CSS custom property in project.json's root style block is listed here, by its name. Add the first one with Add variable."},listed:{tagName:"div",attributes:{part:"groups",role:"none"},children:[{$prototype:"Array",items:{$ref:"#/state/groups"},key:{$ref:"$map/item/id"},map:{tagName:"div",attributes:{part:"group","data-group":"${$map.item.id}"},children:[{tagName:"button",attributes:{part:"group-row",type:"button",title:"Show ${$map.item.title} in the Variables view"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/showGroup"},value:[{$ref:"$map/item/id"}]}],description:"Switches the pane to the Variables view and scrolls this group's heading into view."},children:[{tagName:"span",attributes:{part:"row-label"},textContent:"${$map.item.title}"},{tagName:"span",attributes:{part:"row-count","aria-label":"${$map.item.countLabel}"},textContent:"${$map.item.count}"}]},{tagName:"ul",attributes:{part:"rows","aria-label":"${$map.item.title}"},children:[{$prototype:"Array",items:{$ref:"$map/item/variables"},key:{$ref:"$map/item/name"},map:{tagName:"li",attributes:{part:"item"},children:[{tagName:"button",attributes:{part:"variable-row",type:"button","data-token":"${$map.item.name}","aria-current":"${$map.item.selected ? 'true' : null}",title:"Edit ${$map.item.name} in the Variables view"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/selectVariable"},value:[{$ref:"$map/item/name"}]}],description:"Switches the pane to the Variables view, scrolls this custom property's row into view and puts the keyboard on its value."},children:[{tagName:"span",attributes:{part:"swatch-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/swatchState"},cases:{swatch:{tagName:"span",attributes:{part:"swatch","aria-hidden":"true"},style:{background:{$ref:"$map/item/swatch"}}}}},{tagName:"span",attributes:{part:"var-name"},textContent:"${$map.item.name}"},{tagName:"span",attributes:{part:"var-value"},textContent:"${$map.item.value}"}]}]}}]}]}}]}}},{tagName:"div",attributes:{part:"foot"},children:[{tagName:"jx-action-button",attributes:{part:"add-variable"},$props:{size:"sm",quiet:!0,icon:"plus",hint:"Add a CSS custom property in the Variables view"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/addVariable"},value:[]}],description:"Switches the pane to the Variables view and puts the keyboard on the add row of the current group (Colors when none is current)."},children:[{tagName:"span",textContent:"Add variable"}]}]}]},{tagName:"section",attributes:{part:"section","data-section":"elements","aria-labelledby":"styles-panel-elements"},children:[{tagName:"div",attributes:{part:"section-head"},children:[{tagName:"h3",attributes:{part:"section-title",id:"styles-panel-elements"},textContent:"Elements"},{tagName:"span",attributes:{part:"section-count","aria-label":"${state.customizedLabel}"},textContent:"${state.customizedCount}"}]},{$prototype:"Array",items:{$ref:"#/state/elementGroups"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"element-group","data-group":"${$map.item.key}"},children:[{tagName:"div",attributes:{part:"element-group-label"},textContent:"${$map.item.label}"},{tagName:"ul",attributes:{part:"rows","aria-label":"${$map.item.label}"},children:[{$prototype:"Array",items:{$ref:"$map/item/rows"},key:{$ref:"$map/item/key"},map:{tagName:"li",attributes:{part:"item"},children:[{tagName:"button",attributes:{part:"element-row",type:"button","data-path":"${$map.item.key}","aria-current":"${$map.item.selected ? 'true' : null}",title:"Style every ${$map.item.tag} on the site"},style:{"--row-indent":{$ref:"$map/item/indent"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/selectElement"},value:[{$ref:"$map/item/key"}]}],description:"Switches the pane to the Elements view, selects this tag on its canvas and shows its style in the Inspector."},children:[{tagName:"span",attributes:{part:"tag"},textContent:"${$map.item.tag}"},{tagName:"span",attributes:{part:"dot-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/customized"},cases:{true:{tagName:"jx-dot",attributes:{part:"dot",role:"img","aria-label":"Styled in project.json"}}}}]}]}}]}]}}]},{tagName:"section",attributes:{part:"section","data-section":"schemes","aria-labelledby":"styles-panel-schemes"},children:[{tagName:"div",attributes:{part:"section-head"},children:[{tagName:"h3",attributes:{part:"section-title",id:"styles-panel-schemes"},textContent:"Color schemes"}]},{tagName:"div",attributes:{part:"schemes-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/schemesState"},cases:{empty:{tagName:"p",attributes:{part:"note"},textContent:"The light and dark schemes declared in Contexts are listed here, and each lets a color variable take a value of its own in it."},listed:{tagName:"ul",attributes:{part:"rows","aria-label":"Color schemes"},children:[{$prototype:"Array",items:{$ref:"#/state/schemes"},key:{$ref:"$map/item/key"},map:{tagName:"li",attributes:{part:"scheme-row","data-scheme":"${$map.item.key}"},children:[{tagName:"span",attributes:{part:"row-label"},textContent:"${$map.item.label}"},{tagName:"span",attributes:{part:"scheme-query"},textContent:"${$map.item.query}"}]}}]}}},{tagName:"div",attributes:{part:"foot"},children:[{tagName:"jx-action-button",attributes:{part:"manage-schemes"},$props:{size:"sm",quiet:!0,haspopup:"dialog",hint:"Open Project Settings on Contexts, where color schemes are declared"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/manageSchemes"},value:[]}],description:'Project Settings on Contexts (`settings.open { section: "contexts" }`).'},children:[{tagName:"span",textContent:"Manage color schemes…"}]}]}]}]}}}]};E("styles-panel",DP);function RW(){return{body:"none",customizedCount:"0",customizedLabel:"",elementGroups:[],groups:[],schemes:[],schemesState:"empty",variableCount:"0",variablesState:"empty"}}function FP(e,t){e.body=t.body,e.variableCount=t.variableCount,e.variablesState=t.variablesState,e.groups=t.groups,e.elementGroups=t.elementGroups,e.customizedCount=t.customizedCount,e.customizedLabel=t.customizedLabel,e.schemesState=t.schemesState,e.schemes=t.schemes}function _P(e,t,r){let o=g({...RW(),...r});FP(o,t);let a=null,i=!1,s=R("styles-panel",o,e).then((l)=>{if(i)return l.dispose(),l;return a=l,l});return{connected:()=>{if(i)return!1;let l=a?.root;return l===void 0?!0:e.contains(l)},dispose(){i=!0,a?.dispose(),a=null},ready:s,update:(l)=>{FP(o,l)}}}var AW="Styles";function IW(){let e=m.tabs.get(an);return(e?e.doc.document:C?.projectConfig)??null}function LW(){return{catalogue:vp,components:Ne,config:C?IW():null,selection:u.stylebook.selection,variable:u.stylebook.variable}}function zP(e,t){return`${e} ${t}${e===1?"":"s"}`}function OW(e,t){return F_(e).filter(({group:r,tokens:o})=>r.id!=="other"||o.length>0).map(({group:r,tokens:o})=>({count:String(o.length),countLabel:zP(o.length,"variable"),id:r.id,title:r.title,variables:o.map((a)=>{let i=r.id==="color"?Ac(e,a.value):void 0;return{name:a.name,selected:a.name===t,swatch:i===void 0?"":String(i),swatchState:r.id==="color"?"swatch":"none",value:String(a.value)}})}))}function MW(e,t){let r=e.catalogue.$sections.map((o)=>({key:o.label,label:o.label,rows:Xy(o.elements,e.selection).map((a)=>({customized:Zy(t,a.path),indent:`${bp+a.depth*Gy}px`,key:a.path,selected:a.selected,tag:a.tag}))}));if(e.components.length>0)r.push({key:"components",label:"Components",rows:e.components.map((o)=>({customized:Zy(t,o.tagName),indent:`${bp}px`,key:o.tagName,selected:o.tagName===e.selection,tag:o.tagName}))});return r}function DW(e){return j_(e).filter((t)=>t.kind==="scheme").map((t)=>{let r=e?.[t.name];return{key:t.name,label:t.label,query:n(r)?r:""}})}function Jh(e=LW()){if(!e.config)return{body:"none",customizedCount:"0",customizedLabel:"",elementGroups:[],groups:[],schemes:[],schemesState:"empty",variableCount:"0",variablesState:"empty"};let t=_(e.config.style)?e.config.style:{},r=OW(t,e.variable),o=r.reduce((l,f)=>l+f.variables.length,0),a=MW(e,t),i=a.reduce((l,f)=>l+f.rows.filter((c)=>c.customized).length,0),s=DW(e.config.$media);return{body:"styles",customizedCount:`${i} styled`,customizedLabel:`${zP(i,"tag")} styled`,elementGroups:a,groups:r,schemes:s,schemesState:s.length>0?"listed":"empty",variableCount:String(o),variablesState:o>0?"listed":"empty"}}function FW(e){return e==="color"||e==="font"||e==="size"||e==="other"}function _W(e=u.stylebook.variable){return e===null?"color":P_(e)}var zW={addVariable:()=>{bn("tokens"),cc({add:!0,group:_W(),kind:"group"})},manageSchemes:()=>{nt("settings.open",{section:"contexts"},AW)},selectElement:(e)=>{bn("stylebook"),Ld(e,void 0,{panCanvas:!0}),ko("right",!1)},selectVariable:(e)=>{bn("tokens"),cc({kind:"variable",name:e})},showGroup:(e)=>{if(!FW(e))return;bn("tokens"),cc({add:!1,group:e,kind:"group"})}},yn=null;function HW(e){if(yn&&(yn.host!==e||!yn.handle.connected()))Gh();if(yn){yn.handle.update(Jh());return}let t=_P(e,Jh(),zW),r=me();r.run(()=>{te(()=>{t.update(Jh())})}),yn={handle:t,host:e,scope:r}}function BW(e){return e.querySelector(".panel-content")??e}function HP(){ei({id:"styles",title:"Styles",level:"project",dock:"navigator",icon:"paint-brush",rail:!1,render:()=>ft,afterRender:(e,t)=>{HW(BW(t))}})}function Gh(){yn?.scope.stop(),yn?.handle.dispose(),yn=null}var VW=()=>!1;function es(){if(Np("site"))return;gD(),yT(),HP(),MT(),ei({id:"search",title:"Search",level:"project",dock:"navigator",icon:"magnifying-glass",rail:!1,when:VW,render:()=>WW()}),OC(),aE(),VD(),JC(),eC(),ph()}function WW(){throw Error("This Navigator panel is declared but not built — its `when` predicate should have hidden it.")}function BP(){return es(),[...RA(),...rx("navigator").filter((e)=>e.rail===!1)]}var so=(e)=>e.document.open&&zx(e);function VP(e){let t=h.value;if(!t)return;let r=Oe(t.session.selection);if(!r){t.session.selection=[[]];return}let o=Vt(r);if(!o)return;let a=oe(t.doc.document,o),i=zi(r)+e;if(i>=0&&i<rr(a).length)t.session.selection=[[...o,"children",i]]}function qW(){let e=h.value;if(!e)return;let t=Oe(e.session.selection),r=(t?Vt(t):null)??[],o=oe(e.doc.document,r),a=rr(o).flatMap((i,s)=>_(i)?[[...r,"children",s]]:[]);if(a.length>0)e.session.selection=a}function UW(){let e=h.value,t=Oe(e?.session.selection);if(!e||!t)return;let r=oe(e.doc.document,t);if(rr(r).length>0)e.session.selection=[[...t,"children",0]]}function JW(){let e=h.value,t=Oe(e?.session.selection);if(!e||!t)return;let r=Vt(t);e.session.selection=t.length>=2&&r?[r]:[]}function GW(){let e=h.value,t=Oe(e?.session.selection);if(!e||!t)return;let r=Vt(t);if(!r)return;let o=zi(t),a=[...r,"children",o+1];Z(e,(i)=>{or(i,r,o+1,{tagName:"p",textContent:""}),i.session.selection=[a]})}function KW(){let e=h.value,t=e?.session.selection??[];if(e&&t.length>0)Z(e,(r)=>n0(r,t))}function YW(){let e=h.value,t=(e?.session.selection??[]).filter((r)=>r.length>=2);if(e&&t.length>0)Z(e,(r)=>Ym(r,t))}function XW(){let e=m.activeTabId;if(e)ab(e)}function QW(){let e=h.value;if(e)t1(e)}function ZW(){let e=h.value;if(e)mM(e)}var WP=1.2,e2=34,t2=300;function UP(e){return e.canvas.view==="edit"}function n2(e,t){if(UP(e)){Fp(1);return}let r=h.value;if(!r)return;r.session.ui.zoom=1,t()}function qP(e,t,r){let o=h.value;if(!o)return;if(UP(e)){Fp(o.session.ui.editZoom*t);return}jm(Fm()*t),r()}var r2={inspector:"right",navigator:"left"};function o2(e,t){if(t==="bottom"){let o=!u.docks.right.collapsed&&Hl()==="assistant";Yh(e,"view.setAssistant",{open:!o});return}let r=r2[t];ko(r,!u.docks[r].collapsed)}function Yh(e,t,r){if(e.get(t)&&e.isEnabled(t))Tn(e,t,r,"Keyboard")}var od=null;function a2(){if(od){let t=od;od=null;for(let r of $x)ko(r,t[r]??!1);return}let e={};for(let t of $x)e[t]=u.docks[t].collapsed,ko(t,!0);od=e}var Kh=["rail","navigator","pane","inspector","dock","status"];function i2(e,t,r){let o=Kh.indexOf(e),a=Kh.length;for(let i=1;i<=a;i++){let s=Kh[(o+t*i+a*a)%a];if(r(s))return s}return null}var s2='a[href], button, input, textarea, select, [tabindex]:not([tabindex="-1"])';function ad(e){let t=hf(jI[e]);if(!t)return!1;u.focusRegion=e;let r=t.querySelector(s2);if(r)return r.focus(),!0;return t.tabIndex=-1,t.focus(),!0}function l2(e){let t=i2(u.focusRegion,e,(r)=>Boolean(hf(jI[r])));if(t)ad(t)}function c2(e){let t=HC(e,"panel.focus");if(u.leftTab===t&&!u.docks.left.collapsed&&u.focusRegion==="navigator"){ko("left",!0),ad("pane");return}Kc(t),ad("navigator")}function d2(e,t){if(ko("right",!1),t==="assistant")Yh(e,"view.setAssistant",{open:!0});else Yh(e,"view.setRightTab",{tab:t});ad("inspector")}var p2={focused:"That project was already open — bringing its window to the front.",newWindow:"Opened the project in a new window.",opened:"Opened the project in this window."};function u2(e){return new Promise((t)=>{let r=!1,o=(i)=>{if(r)return;r=!0,a.close(),t(i)},a=Zs({cancelLabel:"Cancel",confirmLabel:"New Window",headline:"Open Project",layer:dt("dialog"),message:`${e} is open in this window. Where should the project you pick open?`,onCancel:()=>o("cancel"),onClosed:()=>o("cancel"),onConfirm:()=>o("newWindow"),onSecondary:()=>o("thisWindow"),region:"project/open-target",secondaryLabel:"This Window",size:"sm"})})}async function m2(e){let t=ye()?p():null,r=t!==null&&Q(t.openProjectInNewWindow)&&Q(t.pickProject);if(!C||!r){await e.openProject("thisWindow");return}let o=C.name,a=await u2(o);if(a==="cancel")return;let i=await e.openProject(a);if(i==="cancelled")return;w.info(p2[i],{key:"project.open",source:"Project"})}function f2(e){let t=()=>{e().setPan(16,16),e().applyTransform()},r=()=>e().applyTransform();return[...lE(),{category:"Edit",group:"1_clipboard",id:"edit.paste",keybinding:"mod+v",keyScope:"canvas",level:"document",requires:"an open document",run:()=>{cD()},title:"Paste",undo:"document",when:so},{category:"Selection",group:"3_structure",id:"selection.insertSibling",keybinding:"enter",keyScope:"canvas",level:"selection",requires:"an element selection that is not the document root",run:()=>GW(),title:"Insert Paragraph After",undo:"document",when:Wx},{category:"Selection",group:"2_navigate",id:"selection.selectPrevious",keybinding:"arrowup",keyScope:"canvas",level:"selection",requires:"an open document",run:()=>VP(-1),title:"Select Previous Sibling",undo:"none",when:so},{category:"Selection",group:"2_navigate",id:"selection.selectNext",keybinding:"arrowdown",keyScope:"canvas",level:"selection",requires:"an open document",run:()=>VP(1),title:"Select Next Sibling",undo:"none",when:so},{category:"Selection",group:"2_navigate",id:"selection.selectAll",keybinding:"mod+a",keyScope:"canvas",level:"selection",requires:"an open document",run:()=>qW(),title:"Select All",undo:"none",when:so},{category:"Selection",group:"2_navigate",id:"selection.selectFirstChild",keybinding:"arrowright",keyScope:"canvas",level:"selection",requires:"an element selection with children",run:()=>UW(),title:"Select First Child",undo:"none",when:vh},{category:"View",group:"6_zoom",id:"canvas.zoomReset",keyScope:"canvas",level:"document",requires:"an open document",run:(o)=>n2(o,t),title:"Reset Zoom",undo:"none",when:so},{category:"View",group:"6_zoom",id:"canvas.zoomIn",keybinding:["mod+=","mod++","mod+shift++"],keyScope:"canvas",level:"document",requires:"an open document",run:(o)=>qP(o,WP,r),title:"Zoom In",undo:"none",when:so},{category:"View",group:"6_zoom",id:"canvas.zoomOut",keybinding:"mod+-",keyScope:"canvas",level:"document",requires:"an open document",run:(o)=>qP(o,1/WP,r),title:"Zoom Out",undo:"none",when:so}]}function JP(e,t,r){let o=()=>r(bo(m.activePaneId));e.registerAll(lm({closeDocument:XW,cycleRegion:l2,deleteSelection:YW,duplicateSelection:KW,focusInspectorTab:(a)=>d2(e,a),focusPanel:c2,buildSite:()=>t.buildSite(),openInBrowser:()=>t.openInBrowser(),openPalette:(a)=>{mb(a)},newWindow:()=>{(ye()?p():null)?.newWindow?.()},panelRoster:BP(),openProject:()=>m2(t),redo:ZW,saveDocument:()=>t.saveDocument(),selectParent:JW,toggleDock:(a)=>{o2(e,a)},toggleZen:a2,undo:QW})),e.registerAll(f2(o))}function h2(e,t){let r=e.handleKeyEvent(t,qO(e.context()));if(r)t.preventDefault();return r}function GP(e,t){jO(e),KP=t,window.addEventListener("resize",()=>{for(let r of Zp())if(Vo(r.paneId)==="edit")lh(r)}),document.addEventListener("keydown",(r)=>{h2(e,r)}),document.addEventListener("wheel",(r)=>{let{target:o}=r;if((r.ctrlKey||r.metaKey)&&!(o instanceof Element&&o.closest(Ex)))r.preventDefault()},{passive:!1})}var g2=new Set(["content-home","entry","grid","media","image","media-home","preview","publish-home","settings-home","tokens"]);function b2(e,t,r){let{target:o}=e,a=o instanceof Element?o:o instanceof Node?o.parentElement:null;while(a&&a!==t){if(a instanceof HTMLElement&&a!==r&&x2(a,e.deltaX,e.deltaY))return!0;a=a.parentElement}return!1}function x2(e,t,r){let o=r>0&&e.scrollTop<e.scrollHeight-e.clientHeight-1,a=r<0&&e.scrollTop>0,i=t>0&&e.scrollLeft<e.scrollWidth-e.clientWidth-1||t<0&&e.scrollLeft>0;if(!o&&!a&&!i)return!1;let s=getComputedStyle(e),l=(f)=>f==="auto"||f==="scroll"||f==="overlay";return(o||a?l(s.overflowY):!1)||(i?l(s.overflowX):!1)}var KP=null;function YP(e){let t=e.wrap,r=null,o,a=!1,i=()=>{let c=r;if(!c||a)return;a=!0,c.settle().then((d)=>{a=!1;let b=t.querySelector('[part="edit-canvas"]');if(d!==null&&b)b.scrollTop+=d-c.top})},s=()=>KP?.(e)??$2(),l=new AbortController,{signal:f}=l;return t.addEventListener("wheel",(c)=>{let{canvasMode:d,panX:b,panY:y,setPan:x,applyTransform:S}=s(),P=bt(e.paneId);if(d==="edit"){if(c.ctrlKey||c.metaKey){c.preventDefault();let k=P?.session.ui.editZoom??1,T=e.panels[0]?.canvas;r??=T?c$(T):null,iO(k*(1+-c.deltaY*0.005),e,c.clientY),setTimeout(i,e2),clearTimeout(o),o=setTimeout(()=>{i(),r=null},t2);return}let j=t.querySelector('[part="edit-canvas"]');if(j&&!b2(c,t,j))c.preventDefault(),j.scrollTop+=c.deltaY,j.scrollLeft+=c.deltaX;return}if(g2.has(d)){if(c.ctrlKey||c.metaKey)c.preventDefault();return}if(c.preventDefault(),c.ctrlKey||c.metaKey){jm(Fm(e)*(1+-c.deltaY*0.005),e,{clientX:c.clientX,clientY:c.clientY});return}else if(c.shiftKey)x(b-c.deltaY,y);else x(b-c.deltaX,y-c.deltaY);S()},{passive:!1,signal:f}),t.addEventListener("pointerdown",(c)=>{let d=s();if(d.canvasMode==="edit"||d.canvasMode==="preview")return;if(c.button!==1)return;c.preventDefault(),t.setPointerCapture(c.pointerId);let{clientX:b,clientY:y}=c,x=(P)=>{let{panX:j,panY:k,setPan:T,applyTransform:N}=s();T(j+(P.clientX-b),k+(P.clientY-y)),b=P.clientX,y=P.clientY,N()},S=()=>{t.releasePointerCapture(c.pointerId),t.removeEventListener("pointermove",x),t.removeEventListener("pointerup",S)};t.addEventListener("pointermove",x),t.addEventListener("pointerup",S)},{signal:f}),t.addEventListener("click",(c)=>{if(!k2(c.target,t,e.panzoomWrap))return;let d=bt(e.paneId);if(!d?.session.selection.length)return;d.session.selection=[]},{signal:f}),()=>{clearTimeout(o),l.abort()}}function k2(e,t,r){if(e===t||r!==null&&e===r)return!0;return e instanceof HTMLElement&&e.dataset.slot==="frame"&&t.contains(e)}function $2(){return{applyTransform:()=>{},canvasMode:"design",panX:0,panY:0,setPan:()=>{}}}var XP={$schema:"https://jxsuite.com/schema/v1",$id:"StudioPaneContext",$description:"The pane's own chrome — the pane context bar and the floating zoom pod, one mount per pane. It replaces `#tab-bar`, a 28px band styled identically to the tab strip above it that held five unrelated axes with no labels on any of them; the three axes here each say what they are, and the label is what stops the band re-accreting into an anonymous strip of chips. `panels/pane-context.ts` keeps every decision — which editor kinds a document declares, which canvas views it has, whether preview is a flag over them, what a lens may not write, which pane's stage a zoom verb lands on, and what a route param's candidate values are — and hands this document one projection of words, booleans and keyed rows. The bar and the banner share `[part=\"band\"]` so the adapter can MEASURE what the stage must clear: a banner's height is its wrapped text, and only layout knows how many lines that is.",tagName:"div",attributes:{part:"chrome"},style:{$description:"The `.pc-*` rules of `styles/canvas.css`, keyed on `part` and carried here, plus `.jx-collab-banner` from `styles/shell.css` — the banner rides in this band and the rule rides with it. Three token repairs travel with them, all of one shape: `--spectrum-font-size-75` and `--spectrum-font-size-50` resolved only inside `<sp-theme>` and a document mounts outside it, so every rule reading one would silently have taken its px fallback; they are `--jx-text-md` (12px) and `--jx-text-sm` (11px) here, at the same values. Four rules are DELETED rather than moved because the kit already draws them: `.pc-derive-trigger`'s hand-built 22×20 box and its hover are `jx-action-button` quiet, `.pc-preview-toggle[selected]`'s four Spectrum custom-property overrides are the `emphasized` prop, and `.pc-ctx-manage:hover`'s underline is the only half of that rule worth keeping. The one rule ADDED is `pointer-events: auto` on the band, the pod and the popovers: `.pane-chrome` is `pointer-events: none` and gave it to its direct children through `.pane-chrome > *`, which a document root with `display: contents` is not — so the three surfaces that take the pointer say so themselves, which is also the honest place for it.",display:"contents",'& [part="band"]':{$description:"The pane's top band: the bar plus the standing statements that must be readable before the first keystroke. One element so the adapter can MEASURE what the stage has to clear — a banner's height is its wrapped text, which only layout knows.",minWidth:"0",pointerEvents:"auto"},'& [part="bar"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-4)",height:"28px",padding:"0 var(--jx-space-3)",borderBottom:"1px solid var(--border)",background:"var(--bg-panel)",minWidth:"0",overflow:"hidden"},'& [part="spacer"]':{$description:"What pushes the other axes right, and where Back, the Editor axis and §18.4's preset trigger go. It stays in a lens, which draws no trigger: dropping it would move the one control a lens does draw. It grows but never shrinks below what it holds: at `min-width: 0` a narrow pane squeezed it under its own Editor segments, which then painted over the View and Context axes; now the bar's `overflow: hidden` clips at the trailing end instead.",display:"flex",flex:"1 0 auto",alignItems:"center",gap:"var(--jx-space-2)"},'& [part="back"]':{flexShrink:"0"},'& [part="axis"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",minWidth:"0"},'& [part="axis-label"]':{$description:"The label is the point: five unlabelled controls on a 28px band is what this replaces, and the name is what stops the band re-accreting into an anonymous strip of chips.",fontSize:"var(--jx-text-sm)",textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--fg-dim)",whiteSpace:"nowrap"},'& [part="static"]':{fontSize:"var(--jx-text-md)",color:"var(--fg)",whiteSpace:"nowrap"},'& [part="editor-kind"]':{$description:"A segmented strip that holds its width: the spacer it sits in is what gives way.",flexShrink:"0"},'& [part="views"]':{flexShrink:"0"},'& [part="preview-toggle"]':{$description:"Not a third radio, and it must not read as one: it says the canvas is inert. The margin separates the two axes the eye is being asked to read as separate; the accent fill is the kit's `emphasized`, which is what deleted the four Spectrum custom properties this rule used to carry. The toggle is `quiet: false`, so it rests as a framed button of its own beside the framed View switch, as the Spectrum button did; quiet, it read as a fourth loose word once the switch beside it drew its frame.",flexShrink:"0",marginInlineStart:"6px"},'& jx-action-button[part="preview-toggle"] > [part="control"]':{$description:"The text padding the View switch's segments get from their group, which this toggle stands outside: the small size's 2px is for a glyph, and 6px is what the group gives a text segment. (0,3,1) outranks the kit's small padding at (0,3,0).",paddingInline:"6px"},'& [part="context-trigger"]':{fontVariantNumeric:"tabular-nums"},'& [part="resolving-trigger"]':{fontVariantNumeric:"tabular-nums",flexShrink:"0"},'& [part="resolving-trigger-caret"]':{"--jx-icon-size":"12px"},'& [part="export"]':{flexShrink:"0"},'& [part="banner"]':{$description:"A standing statement, not an after-the-fact refusal: a guest without write access used to watch their edits apply locally and vanish at the publish gate. Inside the band the stage is offset by, so it pushes the document down instead of covering the one it is warning about.",padding:"6px 10px",borderBottom:"1px solid var(--border)",background:"var(--hover-bg)",color:"var(--fg-dim)",fontSize:"var(--jx-text-md)"},'& [part="pod"]':{$description:"Bottom-right of the pane, over the stage — a viewport control, which is not a document axis and so never belonged in a band beside one. It is a ROW of two controls and draws no box of its own: a 1px border and a 6px radius round 2px/4px of padding framed the zoom group's own frame and the Fit select's own frame, a frame inside a frame and busier than any other group in the chrome. Each control draws itself and takes `--pod-lift` to stand off the document under it, which is what the pod's fill and border used to do for both at once, and the gap between them says they are two controls rather than one strip with a seam. The right inset ADDS `--stage-scrollbar-w` because the chrome layer spans the whole cell, scrollbar gutter included: a fixed 12px put the pod 3px into Edit's 15px track, painting over it and swallowing its clicks. CSS cannot measure a scrollbar and this document cannot see the scroller, so `canvas/stage-scrollbar.ts` measures the stage's own and writes the width on the cell, where this reads it by cascade. It is 0 wherever the stage does not scroll or the scrollbar is an overlay. Physical right on purpose: Studio's chrome is never mirrored.","--pod-lift":"0 2px 8px rgb(0 0 0 / 25%)",alignSelf:"flex-end",display:"flex",alignItems:"center",gap:"var(--jx-space-2)",pointerEvents:"auto",margin:"0 calc(var(--jx-space-4) + var(--stage-scrollbar-w, 0px)) var(--jx-space-4) 0"},'& [part="zoom-group"]':{$description:"The segmented frame floats on its own now that the pod draws no box around it. The radius is the one the first and last segments already draw, so the shadow follows the shape of the strip instead of a rectangle around it — the host's box IS that strip, since the group has no padding and each member's -1px pulls its own host in by a pixel.",borderRadius:"var(--jx-radius-sm)",boxShadow:"var(--pod-lift)"},'& [part="pod"] > [part="zoom-group"][data-compact] > jx-action-button > [part="control"]':{$description:"One resting ink across the pod. A compact group rests its unselected members on `--jx-fg-dim` and brightens the chosen one, which is how a segmented control says which segment is on — and nothing in this pod is ever chosen: the three are a viewport verb, a readout and a verb. So the dim ink said nothing here and made `100%` read as disabled beside the Fit select's value, which is the same kind of readout at `--jx-fg`. (0,5,1) over the group's own resting rule at (0,4,1); the group's hover is (0,6,1) and still wins, which now leaves it only the wash.",color:"var(--fg)"},'& [part="zoom-label"]':{$description:"A floor under the percentage, so the pod does not shift as the value changes length. The width is the host's and the face is the control's, below: the control sets its own font and sits inside the host at its content width, so this rule used to carry a mono face nothing inherited and to open a 6px hole in the segmented frame before the `+` segment (measured: a 48px host round a 41.8px control, drawn in Inter).",minWidth:"48px"},'& [part="zoom-label"] > [part="control"]':{$description:"The control fills its 48px host, closing the frame, and draws the percentage in the mono face with tabular digits so a changing value does not jitter. (0,3,0) outranks the kit control's own face at (0,2,0).",flex:"1",fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums"},'& [part="fit"]':{maxWidth:"120px"},'& [part="fit"] > [part="control"]':{$description:"The pod's second control lifts off the document the way the first does, on the frame the kit's select already draws. On the control rather than the host, because the host is a column whose error region and help slot are the select's neighbours: the shadow has to follow the box that is painted.",boxShadow:"var(--pod-lift)"},'& [part="popover"]':{$description:"Both panels take the pointer that `.pane-chrome` withholds. A popover is in the top layer while it shows, which changes where it PAINTS and not where it is in the tree, so it inherits `pointer-events: none` from the chrome layer exactly as the band does.",pointerEvents:"auto"},'& [part="ctx"]':{$description:"One column of labelled groups over a footer that leaves for the definition site. This control only SELECTS; the definitions live in Project Settings › Contexts (§6.2), and nothing in it defines a breakpoint, a scheme or a feature query.",display:"flex",flexDirection:"column",gap:"10px",padding:"var(--jx-space-2) var(--jx-space-3)",minWidth:"240px",maxWidth:"340px"},'& [part="ctx-group"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-2)"},'& [part="ctx-group-label"]':{fontSize:"var(--jx-text-sm)",textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--fg-dim)"},'& [part="features"]':{$description:"The group that WRAPS, and the reason it is not a segmented control. A feature list is as long as the project makes it and this popover is a 240–340px column, so it folds onto a second line in any project with more than a few; a compact group cannot draw that — its seam is written in tree order, no selector can find the ends of a flex line, and it therefore refuses to wrap and would overflow the column instead (ui.md §5.4). Chips instead: each member draws its own rounded frame (`quiet: false`, since the group no longer frames it) and the chosen one takes the accent edge below. The gap is --jx-space-2 rather than the group's own 2px, which puts every small chip's hit area at the 24px floor on both axes instead of the 22px two overlapping extensions leave (§4.3). The size list used to wrap here beside it; it is a segmented group on the bar now, which clips at its trailing end rather than wrapping.",flexWrap:"wrap",gap:"var(--jx-space-2)"},'& [part="features-item"][data-selected] > [part="control"]':{$description:"A chosen chip reads the way a chosen segment does: the accent tint with an accent EDGE. A member's own selected state is a 15% tint over its neutral border, which among framed neighbours reads as a faint wash rather than as the one that is on — the measurement that gave the compact group its selected rule, restated here at the one place the group does not draw it. (0,4,0) over the member's own (0,3,0).",borderColor:"var(--jx-accent)",background:"var(--jx-accent-20)"},'& [part="fields"]':{$description:"The fields, stacked. They were a row on the bar capped at 140px; in the popover each takes the full column so a route value or a JSON test prop is readable while you type it.",display:"flex",flexDirection:"column",gap:"var(--jx-space-2)"},'& [part="param"]':{display:"block",width:"100%",maxWidth:"100%"},'& [part="prop"]':{display:"block",width:"100%",maxWidth:"100%"},'& [part="layout-switch"]':{margin:"0"},'& [part="manage"]':{alignSelf:"flex-start",padding:"var(--jx-space-1) 0",border:"none",background:"none",color:"var(--accent)",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",cursor:"pointer"},'& [part="manage"]:hover':{textDecoration:"underline"},'& [part="sizes"], & [part="schemes"]':{$description:"Segmented strips that hold their width; the bar clips at its trailing end rather than squeezing a segment.",flexShrink:"0"}},children:[{tagName:"div",attributes:{part:"band"},children:[{tagName:"div",attributes:{part:"bar","data-jx-region":"${state.contextRegion}"},children:[{tagName:"div",attributes:{part:"spacer"},children:[{$description:"Back to the workspace home, in a workspace that draws no tab strip (Media, Styles, Publish): the way out of a view opened beside the home — a media file, a comparison, `project.json` as Code — with the destination named, because there is no chip to click and no close button to press. It leads the bar so it sits where the strip's chips would have been. Escape runs the same command (`pane.backToHome`) wherever no text field or code editor owns the key.",tagName:"div",attributes:{part:"back-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/backState"},cases:{shown:{tagName:"jx-action-button",attributes:{part:"back"},$props:{size:"sm",quiet:!0,icon:"arrow-left",hint:{$ref:"#/state/backHint"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/goBack"},value:[]}]},children:[{tagName:"span",textContent:"${state.backLabel}"}]}}},{tagName:"div",attributes:{part:"editor-axis-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/editorState"},cases:{shown:{tagName:"div",attributes:{part:"axis","data-axis":"editor"},children:[{tagName:"span",attributes:{part:"axis-label"},textContent:"Editor"},{tagName:"div",attributes:{part:"editor-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/editorMode"},cases:{static:{tagName:"span",attributes:{part:"static","data-static":"editor"},textContent:"${state.editorLabel}"},picker:{tagName:"jx-action-group",attributes:{part:"editor-kind"},$props:{selects:"single",compact:!0,label:"Editor"},children:[{$prototype:"Array",items:{$ref:"#/state/editors"},key:{$ref:"$map/item/key"},map:{tagName:"jx-action-button",attributes:{part:"editor-kind-item","data-value":"${$map.item.value}"},$props:{size:"sm",checked:{$ref:"$map/item/checked"},hint:{$ref:"$map/item/hint"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/chooseEditor"},value:[{$ref:"$map/item/value"}]}]},children:[{tagName:"span",textContent:"${$map.item.label}"}]}}]}},$description:"The Editor axis leads the bar, beside Back: which editor the document is open in is the first thing the pane says about it, and the axes to its right describe that editor. Drawn only in the full bar (`hidden` in a lens, whose tab is the pane beside it). Several declared kinds are a segmented `jx-action-group`, like the View axis: they are few, and every one of them stays on screen rather than behind a dropdown."}]}}},{tagName:"div",attributes:{part:"preset-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/presetState"},cases:{shown:{tagName:"jx-action-button",attributes:{part:"preset"},$props:{size:"sm",quiet:!0,icon:"arrows-clockwise",label:"Show code, diff or layout beside",hint:"Show this document's code, diff, layout or another breakpoint beside it",haspopup:"menu"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openPresetMenu"},value:[{$ref:"event#/currentTarget"}]}]}}}}]},{tagName:"div",attributes:{part:"bar-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/barMode"},cases:{lens:{tagName:"div",attributes:{part:"axis","data-axis":"context"},children:[{tagName:"span",attributes:{part:"axis-label"},textContent:"Context"},{tagName:"span",attributes:{part:"static","data-static":"summary"},textContent:"${state.summary}"}]},full:{tagName:"div",attributes:{part:"axes",role:"none"},style:{display:"contents"},children:[{tagName:"div",attributes:{part:"view-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/viewState"},cases:{shown:{tagName:"div",attributes:{part:"axis","data-axis":"view"},children:[{tagName:"span",attributes:{part:"axis-label"},textContent:"View"},{tagName:"jx-action-group",attributes:{part:"views"},$props:{selects:"single",compact:!0,label:"Canvas view"},children:[{$prototype:"Array",items:{$ref:"#/state/views"},key:{$ref:"$map/item/key"},map:{tagName:"jx-action-button",attributes:{part:"views-item","data-value":"${$map.item.value}"},$props:{size:"sm",checked:{$ref:"$map/item/checked"},hint:{$ref:"$map/item/hint"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/chooseView"},value:[{$ref:"$map/item/value"}]}]},children:[{tagName:"span",textContent:"${$map.item.label}"}]}}]},{tagName:"div",attributes:{part:"preview-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/previewState"},cases:{shown:{tagName:"jx-action-button",attributes:{part:"preview-toggle","data-on":"${state.previewOn ? '' : null}"},$props:{size:"sm",quiet:!1,toggles:!0,emphasized:!0,selected:{$ref:"#/state/previewOn"},hint:{$ref:"#/state/previewHint"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/togglePreview"},value:[]}]},children:[{tagName:"span",textContent:"Preview"}]}}}]}}},{tagName:"div",attributes:{part:"context-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/contextState"},cases:{shown:{tagName:"div",attributes:{part:"axis","data-axis":"context"},children:[{tagName:"span",attributes:{part:"axis-label"},textContent:"Context"},{tagName:"div",attributes:{part:"sizes-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/sizesState"},cases:{shown:{tagName:"jx-action-group",attributes:{part:"sizes"},$props:{selects:"single",compact:!0,label:"Size"},children:[{$prototype:"Array",items:{$ref:"#/state/sizes"},key:{$ref:"$map/item/key"},map:{tagName:"jx-action-button",attributes:{part:"sizes-item","data-value":"${$map.item.value}"},$props:{size:"sm",checked:{$ref:"$map/item/checked"},hint:{$ref:"$map/item/hint"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setBreakpoint"},value:[{$ref:"$map/item/value"}]}]},children:[{tagName:"span",textContent:"${$map.item.label}"}]}}]}}},{tagName:"div",attributes:{part:"scheme-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/schemeState"},cases:{shown:{tagName:"jx-action-group",attributes:{part:"schemes"},$props:{selects:"single",compact:!0,label:"Color scheme"},children:[{$prototype:"Array",items:{$ref:"#/state/schemes"},key:{$ref:"$map/item/key"},map:{tagName:"jx-action-button",attributes:{part:"schemes-item","data-value":"${$map.item.value}"},$props:{size:"sm",checked:{$ref:"$map/item/checked"},hint:{$ref:"$map/item/hint"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setScheme"},value:[{$ref:"$map/item/value"}]}]},children:[{tagName:"span",textContent:"${$map.item.label}"}]}}]}}},{tagName:"div",attributes:{part:"resolving-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/resolvingState"},cases:{shown:{tagName:"jx-action-button",attributes:{part:"resolving-trigger"},$props:{size:"sm",quiet:!0,haspopup:"dialog",expanded:{$ref:"#/state/resolvingOpen"},hint:"The values this document is being rendered with"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openResolving"},value:[{$ref:"event#/currentTarget"}]}]},children:[{tagName:"span",textContent:"${state.resolvingLabel}"},{tagName:"jx-icon",attributes:{part:"resolving-trigger-caret"},$props:{name:"caret-down"}}]}}},{tagName:"jx-action-button",attributes:{part:"context-trigger"},$props:{size:"sm",quiet:!0,icon:"sliders-horizontal",label:"More rendering context",haspopup:"dialog",expanded:{$ref:"#/state/contextOpen"},hint:"Language, feature queries, layout, and Manage contexts"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openContext"},value:[{$ref:"event#/currentTarget"}]}]},children:[{tagName:"span",textContent:"${state.contextSummary}"}]}],$description:"The rendering context, on the bar: the size and the color scheme are segmented groups the reader picks from directly, because they are what a canvas is switched between all day; the resolving-with values and the rarer choices (language, feature queries, layout, Manage contexts) stay behind their popovers."}}},{tagName:"div",attributes:{part:"export-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/exportState"},cases:{shown:{tagName:"jx-action-button",attributes:{part:"export"},$props:{size:"sm",icon:"export"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/exportFile"},value:[]}]},children:[{tagName:"span",textContent:"Export"}]}}}]}}}]},{tagName:"div",attributes:{part:"banner-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/bannerState"},cases:{shown:{tagName:"div",attributes:{part:"banner",role:"status","data-kind":"read-only"},textContent:"You have read access to this session. You can explore and edit locally, but your changes are not published to the other people in it."}}}]},{tagName:"div",attributes:{part:"pod-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/podState"},cases:{shown:{tagName:"div",attributes:{part:"pod","data-jx-region":"${state.zoomRegion}"},children:[{tagName:"jx-action-group",attributes:{part:"zoom-group"},$props:{compact:!0,label:"Zoom"},children:[{tagName:"jx-action-button",attributes:{part:"zoom-out"},$props:{size:"sm",icon:"minus",label:"Zoom out",hint:"Zoom out (Ctrl+-)"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/zoomOut"},value:[]}]}},{tagName:"jx-action-button",attributes:{part:"zoom-label"},$props:{size:"sm",hint:"Reset to 100% (Ctrl+0)",label:"Reset zoom"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/zoomReset"},value:[]}]},children:[{tagName:"span",textContent:"${state.zoomLabel}"}]},{tagName:"jx-action-button",attributes:{part:"zoom-in"},$props:{size:"sm",icon:"plus",label:"Zoom in",hint:"Zoom in (Ctrl+=)"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/zoomIn"},value:[]}]}}]},{tagName:"div",attributes:{part:"fit-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/fitState"},cases:{shown:{tagName:"jx-select",attributes:{part:"fit"},$props:{label:"Fit",size:"sm",options:{$ref:"#/state/fitOptions"},value:{$ref:"#/state/fitValue"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/chooseFit"},value:[{$ref:"event#/target/value"}]}]}}}}]}}},{tagName:"jx-popover",attributes:{part:"popover","data-popover":"context",id:"${state.contextPopoverId}"},$props:{label:"More rendering context",placement:"block-end span-inline-start",x:{$ref:"#/state/contextX"},y:{$ref:"#/state/contextY"}},children:[{tagName:"div",attributes:{part:"ctx"},children:[{tagName:"div",attributes:{part:"locale-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/localeState"},cases:{shown:{tagName:"div",attributes:{part:"ctx-group","data-group":"language"},children:[{tagName:"span",attributes:{part:"ctx-group-label"},textContent:"Language"},{tagName:"jx-action-group",attributes:{part:"locales",title:"${state.localeHint}"},$props:{selects:"single",compact:!0,label:"Language"},children:[{$prototype:"Array",items:{$ref:"#/state/locales"},key:{$ref:"$map/item/key"},map:{tagName:"jx-action-button",attributes:{part:"locales-item","data-value":"${$map.item.value}"},$props:{size:"sm",checked:{$ref:"$map/item/checked"},hint:{$ref:"$map/item/hint"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setLocale"},value:[{$ref:"$map/item/value"}]}]},children:[{tagName:"span",textContent:"${$map.item.label}"}]}}]}]}}},{tagName:"div",attributes:{part:"feature-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/featureState"},cases:{shown:{tagName:"div",attributes:{part:"ctx-group","data-group":"features"},children:[{tagName:"span",attributes:{part:"ctx-group-label"},textContent:"Features"},{tagName:"jx-action-group",attributes:{part:"features"},$props:{selects:"multiple",compact:!1,label:"Features"},children:[{$prototype:"Array",items:{$ref:"#/state/features"},key:{$ref:"$map/item/key"},map:{tagName:"jx-action-button",attributes:{part:"features-item","data-value":"${$map.item.value}"},$props:{size:"sm",quiet:!1,toggles:!0,selected:{$ref:"$map/item/selected"},hint:{$ref:"$map/item/hint"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/toggleFeature"},value:[{$ref:"$map/item/value"}]}]},children:[{tagName:"span",textContent:"${$map.item.label}"}]}}]}]}}},{tagName:"div",attributes:{part:"layout-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/layoutState"},cases:{shown:{tagName:"div",attributes:{part:"ctx-group","data-group":"layout"},children:[{tagName:"span",attributes:{part:"ctx-group-label"},textContent:"Layout"},{tagName:"jx-switch",attributes:{part:"layout-switch"},$props:{size:"sm",checked:{$ref:"#/state/layoutOn"},label:"Show layout elements"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/toggleLayout"},value:[]}]},children:[{tagName:"span",textContent:"Show layout elements"}]}]}}},{tagName:"button",attributes:{part:"manage",type:"button",title:"Breakpoints, schemes and feature queries are defined in Project Settings › Contexts"},onclick:{$ref:"#/state/manageContexts"},textContent:"Manage contexts…"}]}],$description:"What is left of the rendering context once Size and Color scheme moved onto the bar: the language, the feature queries, the layout switch, and Manage contexts. They are chosen rarely, and Manage contexts is always here, so the trigger always is too."},{tagName:"jx-popover",attributes:{part:"popover","data-popover":"resolving",id:"${state.resolvingPopoverId}"},$props:{label:"Resolving with",placement:"block-end span-inline-start",x:{$ref:"#/state/resolvingX"},y:{$ref:"#/state/resolvingY"}},children:[{tagName:"div",attributes:{part:"resolving-body",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/resolvingState"},cases:{shown:{tagName:"div",attributes:{part:"ctx"},children:[{tagName:"div",attributes:{part:"ctx-group","data-group":"resolving"},children:[{tagName:"span",attributes:{part:"ctx-group-label"},textContent:"resolving with"},{tagName:"div",attributes:{part:"fields-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/resolvingKind"},cases:{params:{tagName:"div",attributes:{part:"fields","data-fields":"params"},children:[{$prototype:"Array",items:{$ref:"#/state/params"},key:{$ref:"$map/item/key"},map:{tagName:"jx-select",attributes:{part:"param","data-param":"${$map.item.name}"},$props:{size:"sm",label:{$ref:"$map/item/label"},options:{$ref:"$map/item/options"},value:{$ref:"$map/item/value"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setParam"},value:[{$ref:"$map/item/name"},{$ref:"event#/target/value"}]}]}}}]},props:{tagName:"div",attributes:{part:"fields","data-fields":"props"},children:[{$prototype:"Array",items:{$ref:"#/state/props"},key:{$ref:"$map/item/key"},map:{tagName:"jx-textfield",attributes:{part:"prop","data-prop-name":"${$map.item.name}","data-jx-region":"${$map.item.region}"},$props:{size:"sm",label:{$ref:"$map/item/label"},placeholder:{$ref:"$map/item/name"},value:{$ref:"$map/item/value"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setProp"},value:[{$ref:"$map/item/name"},{$ref:"event#/target/value"}]}]}}}]}}}]}]}}}]}]};E("pane-context",XP);function QP(e,t){e.contextRegion=t.contextRegion,e.zoomRegion=t.zoomRegion,e.barMode=t.barMode,e.presetState=t.presetState,e.backState=t.backState,e.backLabel=t.backLabel,e.backHint=t.backHint,e.bannerState=t.bannerState,e.summary=t.summary,e.editorState=t.editorState,e.editorMode=t.editorMode,e.editorLabel=t.editorLabel,e.editors=t.editors,e.viewState=t.viewState,e.contextState=t.contextState,e.views=t.views,e.previewState=t.previewState,e.previewOn=t.previewOn,e.previewHint=t.previewHint,e.contextSummary=t.contextSummary,e.resolvingState=t.resolvingState,e.resolvingLabel=t.resolvingLabel,e.resolvingKind=t.resolvingKind,e.params=t.params,e.props=t.props,e.sizes=t.sizes,e.sizesState=t.sizesState,e.schemeState=t.schemeState,e.schemes=t.schemes,e.localeState=t.localeState,e.localeHint=t.localeHint,e.locales=t.locales,e.featureState=t.featureState,e.features=t.features,e.layoutState=t.layoutState,e.layoutOn=t.layoutOn,e.exportState=t.exportState,e.podState=t.podState,e.zoomLabel=t.zoomLabel,e.fitState=t.fitState,e.fitValue=t.fitValue,e.fitOptions=t.fitOptions}function Xh(){return{backHint:"",backLabel:"",backState:"hidden",bannerState:"hidden",barMode:"full",contextRegion:"",contextState:"shown",contextSummary:"",editorLabel:"",editorMode:"static",editorState:"hidden",editors:[],exportState:"hidden",featureState:"hidden",features:[],fitOptions:[],fitState:"hidden",fitValue:"",layoutOn:!0,layoutState:"hidden",localeHint:"",locales:[],localeState:"hidden",params:[],podState:"hidden",presetState:"hidden",previewHint:"",previewOn:!1,previewState:"hidden",props:[],resolvingKind:"params",resolvingLabel:"Defaults",resolvingState:"hidden",schemes:[],schemeState:"hidden",sizesState:"hidden",sizes:[],summary:"Base",views:[],viewState:"hidden",zoomLabel:"100%",zoomRegion:""}}function ZP(e,t){let r=n(e)?void 0:e.attributes?.[t];return n(r)?r:""}function dE(e,t){let r=Me(e),o=t?Me(t).width:0,a=Math.max(0,r.right-o);return{x:Math.round(a),y:Math.round(r.bottom)}}function bE(e,t,r,o){let a=`pane-context-${e}`,i=g({...Xh(),...o,contextOpen:!1,contextPopoverId:`${a}-context`,contextX:0,contextY:0,openContext:(S)=>{y("context",S)},openResolving:(S)=>{y("resolving",S)},resolvingOpen:!1,resolvingPopoverId:`${a}-resolving`,resolvingX:0,resolvingY:0});QP(i,r);let s=new Map,l=null,f=!1,c=(S)=>s.get(`popover:${S}`)??null,d=(S,P)=>{let j=c(S);if(!j)return;let k=(T)=>{if(S==="context")i.contextX=T.x,i.contextY=T.y;else i.resolvingX=T.x,i.resolvingY=T.y};if(k(dE(P,j)),S==="context")i.contextOpen=!0;else i.resolvingOpen=!0;rd(j,P),k(dE(P,j))},b=(S)=>{if(S==="context")i.contextOpen=!1;else i.resolvingOpen=!1;let P=c(S);if(P)Dh(P)};function y(S,P){if(S==="context"?i.contextOpen:i.resolvingOpen){b(S);return}d(S,P)}let x=R("pane-context",i,t,{onNodeCreated:(S,P,j)=>{let k=ZP(j,"part");if(k===""||!(S instanceof HTMLElement))return;if(k==="popover"){let T=ZP(j,"data-popover");if(T)s.set(`popover:${T}`,S),S.addEventListener("toggle",(N)=>{let O=N.newState==="open";if(T==="context")i.contextOpen=O;else i.resolvingOpen=O});return}if(k==="band"||k==="resolving-trigger"||k==="context-trigger")s.set(k,S)}}).then((S)=>{if(f){S.dispose();return}l=S});return{band:()=>{let S=s.get("band");return S?.isConnected===!0?S:null},connected:()=>!f&&(l===null||l.root.parentNode===t),dispose(){f=!0,b("context"),b("resolving"),l?.dispose(),l=null,s.clear()},isResolvingOpen:()=>i.resolvingOpen,ready:x,setResolvingOpen:(S)=>{if(i.resolvingOpen===S)return;if(!S){b("resolving");return}let P=s.get("resolving-trigger");if(P?.isConnected===!0)d("resolving",P)},update:(S)=>{QP(i,S)}}}var C2="source";function ld(e,t=u.workspace){if(!e||tv(t)||sb(e)!==t)return null;if(t==="styles"){if(e.documentPath!==an||e.session.ui.canvasMode!==C2)return null;let o=u.stylebook.view,a=Gp[Qs(o)];return{hint:`Leave the Code view for the ${a} view of your styles`,kind:"view",label:`Back to ${a}`,mode:o}}if(!qp(t)||ml(e.id)===t)return null;let r=bh(t).title;return{hint:`Close this view and return to ${r}`,kind:"close",label:`Back to ${r}`}}function T2(e){return ld(bt(e))}async function Qh(e,t){let r=bt(e),o=ld(r);if(!r||!o)return!1;if(o.kind==="view")return r.session.ui.preview=!1,t.setCanvasMode(r,o.mode),!0;let a=u.workspace;if(await t.closeTab(r.id),!m.tabs.has(r.id))t.focusHome?.(e,a);return!0}function kE(e){return[{args:Se({pane:Fe("Which pane to go back in. Defaults to the focused one.")},[]),id:"pane.backToHome",title:"Back to Workspace Home",category:"View",level:"document",keybinding:"escape",menus:["palette"],group:"5_pane",when:(t)=>!t.caret.active&&t.editor.kind!=="code"&&!X$()&&T2(m.activePaneId)!==null,requires:"a view opened beside a workspace home",undo:"none",run:async(t,r)=>{let o=ti("pane.backToHome",r,"pane")??m.activePaneId;if(!await Qh(o,e))throw RangeError(`command "pane.backToHome": pane "${o}" shows no view opened beside a workspace home, so there is nothing to go back from`)}}]}var P2="--pane-context-h",AE=28,cd=new Map,Wn=new Map,dd=null,SE=null,Zh={design:"Design",edit:"Edit",preview:"Preview"},E2=[["auto","Auto","Follow the OS color scheme"],["light","Light","Force the light scheme"],["dark","Dark","Force the dark scheme"]];function md(e,t){let r=cd.get(e);if(r===t)return;if(r)eg(e),ns(0,r);if(t)cd.set(e,t),OE(e,t);else cd.delete(e)}function eg(e){ts.get(e)?.observer.disconnect(),ts.delete(e),Wn.get(e)?.dispose(),Wn.delete(e)}var ts=new Map;function CE(e,t,r){let o=r.band(),a=ts.get(e);if(a&&a.band===o)return;if(a?.observer.disconnect(),ts.delete(e),ns(EE(r),t),!o||typeof ResizeObserver>"u")return;let i=new ResizeObserver(()=>{if(Wn.get(e)===r)ns(EE(r),t)});i.observe(o),ts.set(e,{band:o,observer:i})}function IE(e,t){dd=t,md(fi,e),SE=me(),SE.run(()=>{te(()=>{for(let r of m.panes){let o=bt(r.id);if(!o)continue;o.doc.document,o.doc.document.$layout,o.doc.mode,o.documentPath,o.capabilities.modes,o.session.ui.activeMedia,o.session.ui.canvasMode,o.session.ui.editZoom,o.session.ui.featureToggles,o.session.ui.preview,o.session.ui.previewColorScheme,o.session.ui.previewLocale,o.session.ui.previewParams,o.session.ui.previewProps,o.session.ui.showLayout,o.session.ui.zoom,xn(o).active,xn(o).readOnly}fd()})})}function ns(e,t){(t?.closest(Gl)??document.documentElement).style.setProperty(P2,`${e}px`)}function EE(e){return Math.max(e.band()?.offsetHeight??0,AE)}function fd(){for(let[e,t]of cd)OE(e,t)}function OE(e,t){if(!dd)return;try{let r=bt(e);if(r===null){eg(e),ns(0,t);return}let o=L2(r,e,dd),a=Wn.get(e);if(!a||!a.connected()){eg(e),a=bE(e,t,o,U2(e,dd)),Wn.set(e,a),ns(AE,t),a.ready.then(()=>{let i=Wn.get(e);if(i)CE(e,t,i)});return}a.update(o),CE(e,t,a)}catch(r){console.error("pane-context render error:",r)}}var ud=null;function N2(){ud?.close(),ud=null}function j2(e,t){if(N2(),!ae())return;let o=I2(e);ud=zt({label:"Show beside this pane",opener:t,onClosed:()=>{ud=null},place:(a)=>{let i=Me(t);return{x:Math.round(Math.min(i.left,window.innerWidth-a.width-4)),y:Math.round(i.bottom)}},region:"derive-presets",rows:o.map((a)=>R2(a))})}function R2(e){let t={destructive:!1,disabled:e.disabled!==null,dividerAbove:!1,id:A2(e),run:()=>{Sr(e.pane),ae()?.run(e.command,e.args)},title:e.label};if(e.disabled!==null)t.requires=e.disabled;return t}function A2(e){let t=[e.command];for(let r of["preset","media","locale"]){let o=e.args[r];if(n(o))t.push(o)}return t.join(":")}function I2(e){let t=ae(),r=bt(e),o=jr(e),a=yb(e),i=[];for(let l of sS){if(l==="breakpoint"||l==="locale")continue;i.push({args:{preset:l},command:"pane.derive",disabled:a??bw(l,e,null),label:ju[l],pane:e})}for(let l of r&&!o?aS(r):[])i.push({args:l===null?{preset:"breakpoint"}:{media:l,preset:"breakpoint"},command:"pane.derive",disabled:a??bw("breakpoint",e,l),label:`${ju.breakpoint} ${l?ji(l):"Base"}`,pane:e});for(let l of r&&!o?Ts()?.locales??[]:[])i.push({args:{locale:l,preset:"locale"},command:"pane.derive",disabled:a??bw("locale",e,null,l),label:`${ju.locale} ${Wt(l)}`,pane:e});let s=[["pane.pin",KE(e)],["pane.unsplit",m.panes.length>1?null:t?.get("pane.unsplit")?.requires??null]];for(let[l,f]of s){let c=t?.get(l);if(c)i.push({args:{},command:l,disabled:f,label:c.title,pane:e})}return i}function L2(e,t,r){let o=jr(t)?.kind==="lens",a=xn(e).active&&xn(e).readOnly,i={...O2(t),presetState:o?"hidden":"shown",bannerState:!o&&a?"shown":"hidden",barMode:o?"lens":"full",...q2(e,t)};if(o)return i.summary=M2(t),i;let s=ld(e);if(s)i.backState="shown",i.backLabel=s.label,i.backHint=s.hint;if(Object.assign(i,D2(e)),XC(e)==="canvas")Object.assign(i,F2(e));if(XC(e)==="home")return i.contextState="hidden",i.presetState="hidden",i;return Object.assign(i,_2(e,t,r)),i.exportState=ka(e)==="source"?"shown":"hidden",i}function O2(e){return{...Xh(),contextRegion:Ln(e,"context"),zoomRegion:Ln(e,"zoom")}}function M2(e){let t=dl(e),r=ME(bt(e));return`${t?ji(t):"Base"}${r?.overridden?` · ${Wt(r.effective)}`:""}`}var tg=new Set(["diff"]);function D2(e){let t=XC(e),r=tg.has(t)?[t]:dI(e).filter((o)=>!tg.has(o)&&(o!=="image"||o===t||!xn(e).readOnly));if(r.length<2)return{editorLabel:Gp[t],editorMode:"static",editorState:"shown"};return{editorMode:"picker",editorState:"shown",editors:r.map((o)=>({checked:o===t?"true":"false",hint:`Open this document in ${Gp[o]}`,key:o,label:Gp[o],value:o}))}}function F2(e){let t=sO(e);if(t.length===0)return{};let r=e$(e),o=t$(e);return{previewHint:o.on?`Stop previewing — back to ${Zh[r??"edit"]}`:"Preview: the page as it ships, with editing off",previewOn:o.on,previewState:o.available?"shown":"hidden",views:t.map((a)=>({checked:a===r?"true":"false",hint:`Show this document in ${Zh[a]}`,key:a,label:Zh[a],value:a})),viewState:"shown"}}function RE(e){let t=e.documentPath;return Boolean(t&&C?.isSiteProject&&(t.startsWith("pages/")||t.startsWith("./pages/")))}function ME(e){let t=Ts();if(!e||t===null||t.locales.length<2)return null;let r=go(e.documentPath??"",t),o=Hp(null,e.documentPath)??t.defaultLocale,a=Hp(e.session.ui.previewLocale,e.documentPath)??o;return{effective:a,i18n:t,overridden:a!==o,pathLocale:r}}function _2(e,t,r){let{ui:o}=e.session,{featureQueries:a,sizeBreakpoints:i}=r.parseMediaEntries(to(e.doc.document.$media)),s=a.filter(({query:N})=>ux(N)),l=a.filter(({query:N})=>!ux(N)),f=o.previewColorScheme,{activeMedia:c}=o,d=ME(e),b=RE(e)&&Boolean(hl(e.doc.document.$layout))||Boolean(C?.isSiteProject)&&rh(e.documentPath),y=l.filter(({name:N})=>o.featureToggles[N]).length,x=[d?.overridden?Wt(d.effective):null,y>0?`${y} ${y===1?"query":"queries"}`:null,b&&o.showLayout===!1?"No layout":null].filter((N)=>N!==null).join(" · "),S=RE(e),P=S?Y2(e):[],j=S?[]:Q2(e,t),k=S?Object.values(o.previewParams).filter((N)=>N!=="").length:Object.keys(o.previewProps??{}).length,T=S?P.length>0:j.length>0;return{contextSummary:x,featureState:l.length>0?"shown":"hidden",features:l.map(({name:N,query:O})=>({hint:O,key:N,label:ji(N),selected:Boolean(o.featureToggles[N]),value:N})),layoutOn:o.showLayout!==!1,layoutState:b?"shown":"hidden",...H2(d),params:P,props:j,resolvingKind:S?"params":"props",resolvingLabel:k>0?`${k} set`:"Defaults",resolvingState:T?"shown":"hidden",schemes:E2.map(([N,O,D])=>({checked:f===N?"true":"false",hint:D,key:N,label:O,value:N})),schemeState:s.length>0?"shown":"hidden",sizes:z2(i,c),sizesState:i.length>0?"shown":"hidden"}}function z2(e,t){return[{checked:t===null?"true":"false",hint:"The base rendering, with no breakpoint applied",key:"--base",label:"Base",value:""},...e.map(({name:r,width:o})=>({checked:t===r?"true":"false",hint:`${ji(r)} — ${o}px`,key:r,label:ji(r),value:r}))]}function H2(e){if(!e)return{localeState:"hidden"};return{localeHint:"The language this pane renders as — its lang and direction only. The text is whatever file is open.",locales:e.i18n.locales.map((t)=>({checked:e.effective===t?"true":"false",hint:t===e.pathLocale?`${Wt(t)} — the language of the file this pane has open`:`Render as ${Wt(t)} (${t})`,key:t,label:Wt(t),value:t})),localeState:"shown"}}var FE=[{fit:"page",label:"Fit page",value:"page"},{fit:"width",label:"Fit width",value:"width"},{fit:1,label:"Actual size",value:"actual"},{fit:"none",label:"No fit",value:"none"}];function B2(e){if(Y(e))return e===1?"actual":"";return e}var V2=new Set(["design","stylebook","git-diff"]);function W2(e){let t=jr(e);return(t?.kind==="lens"&&t.preset==="diff"?t.diff:u.git.diffState)?.filePath??""}function q2(e,t){let r=Vo(t),o=bo(t);if(r==="edit"){let{editZoom:i}=e.session.ui;return{podState:"shown",zoomLabel:`${Math.round(i*100)}%`}}if(!V2.has(r))return{podState:"hidden"};if(r==="git-diff"&&Xa(t,Mb(W2(t))))return{podState:"hidden"};let a=Fm(o);return{fitOptions:FE.map(({label:i,value:s})=>({label:i,value:s})),fitState:"shown",fitValue:B2(LC(o)),podState:"shown",zoomLabel:`${Math.round(a*100)}%`}}function lo(e,t,r){ae()?.run(t,{...r,pane:e})}function U2(e,t){let r=()=>bt(e);return{chooseEditor:(o)=>{let a=r();if(!a)return;let i=dI(a).find((l)=>l===o&&!tg.has(l)),s=i&&JO(a,i);if(!s)return;a.session.ui.preview=!1,t.setCanvasMode(a,s)},chooseFit:(o)=>{let a=FE.find((s)=>s.value===o);if(!a)return;let i=bo(e);if(a.fit==="page"){oO({surface:i});return}XL(a.fit,i)},chooseView:(o)=>{let a=r(),i=QL.find((s)=>s===o);if(a&&i)n$(a,i,t.setCanvasMode)},exportFile:t.exportFile,goBack:()=>{Sr(e);let{closeTab:o}=t;if(!o){lo(e,"pane.backToHome",{});return}Qh(e,{closeTab:o,setCanvasMode:t.setCanvasMode,...t.focusHome&&{focusHome:t.focusHome}})},manageContexts:()=>{ae()?.run("settings.open",{section:"contexts"})},openPresetMenu:(o)=>{j2(e,o)},setBreakpoint:(o)=>{lo(e,"canvas.setBreakpoint",{media:o===""?null:o})},setLocale:(o)=>{lo(e,"i18n.switchLocale",{locale:o})},setParam:(o,a)=>{lo(e,"canvas.setRouteParam",{name:o,value:a})},setProp:(o,a)=>{lo(e,"canvas.setTestProp",{name:o,value:a===""?null:X2(a)})},setScheme:(o)=>{lo(e,"canvas.setColorScheme",{scheme:o})},toggleFeature:(o)=>{let a=r();if(a)Na(a,"featureToggles",{...a.session.ui.featureToggles,[o]:!a.session.ui.featureToggles[o]})},toggleLayout:()=>{lo(e,"canvas.setLayoutVisible",{visible:r()?.session.ui.showLayout===!1})},togglePreview:()=>{let o=r();if(!o)return;let a=t$(o),i=e$(o);n$(o,a.on?i??"edit":"preview",t.setCanvasMode)},zoomIn:()=>{let o=r(),a=bo(e);if(Vo(e)==="edit"){Fp((o?.session.ui.editZoom??1)*1.2,a);return}jm(Fm(a)*1.2,a)},zoomOut:()=>{let o=r(),a=bo(e);if(Vo(e)==="edit"){Fp((o?.session.ui.editZoom??1)/1.2,a);return}jm(Fm(a)/1.2,a)},zoomReset:()=>{let o=bo(e);if(Vo(e)==="edit"){Fp(1,o);return}rO(o)}}}function J2(e){return Wn.get(e)?.isResolvingOpen()??!1}function zE(e,t){if(J2(e)===t)return;Wn.get(e)?.setResolvingOpen(t)}var ng=new Map,pd=new Set;function BE(){ng.clear(),pd.clear()}function G2(e){let t=pC({document:e.doc.document,frontmatter:e.doc.content.frontmatter});if(!t&&Bc(e.documentPath).length===0)return null;let r=`${e.documentPath??""}::${JSON.stringify(t)}`,o=ng.get(r);if(o)return o;if(pd.has(r))return null;return pd.add(r),OA(e.documentPath,t).then((a)=>{if(pd.delete(r),!m.panes.some((i)=>i.activeTabId===e.id))return;ng.set(r,a),K2(e,a),fd()}),null}function K2(e,t){let r=e.session.ui.previewParams,o={};for(let[a,i]of Object.entries(t))if(!r[a]&&i.length>0)o[a]=i[0];if(Object.keys(o).length>0)Na(e,"previewParams",{...r,...o})}function Y2(e){let t=G2(e),r=new Set(Bc(e.documentPath));for(let a of Object.keys(t??{}))r.add(a);let{previewParams:o}=e.session.ui;return[...r].map((a)=>({key:a,label:`Preview value for [${a}]`,name:a,options:(t?.[a]??[]).map((i)=>({label:i,value:i})),value:o[a]??""}))}function X2(e){try{return JSON.parse(e)}catch{return e}}function Q2(e,t){let r=e.doc.document;if(!fC(r))return[];let{previewProps:o}=e.session.ui,a=(i)=>i===void 0?"":n(i)?i:JSON.stringify(i);return MA(r).map(({name:i})=>({key:i,label:`Test value for ${i}`,name:i,region:Ln(t,`prop:${i}`),value:a(o?.[i])}))}var co=new Map,rs=null,vn=null,sg=null,os=[],as=null,ag=null;function eq(e){return e.root!==null&&e.strip!==null&&e.chrome!==null&&e.stage!==null&&e.dropZone!==null&&e.surface!==null}function VE(e){let t=co.get(e);return t!==void 0&&eq(t)?t:null}function WE(){return sg??Promise.resolve()}function tq(e){let t=co.get(e);if(t)return t;let r={chrome:null,dropZone:null,paneId:e,releaseDropZone:null,releaseGestures:null,root:null,stage:null,strip:null,surface:null};return co.set(e,r),r}function nq(e,t){t.addEventListener("pointerdown",()=>{Sr(e)},{capture:!0})}function rq(e,t){e.stage=t;let r=AM(e.paneId);e.surface=r,NM(e.paneId,t),e.releaseGestures=YP(r),Br(e.paneId)}function oq(e,t,r){if(m.panes.length>=yI||m.panes.at(-1)?.id!==e)return{type:"pane-edge-refused"};let o=Me(r),a=Math.min(120,o.width/2);if(t.clientX<o.right-a)return{type:"pane-edge-refused"};return{paneId:e,type:"pane-edge"}}function aq(e,t){return Ks({canDrop({source:r}){return Mu(r.data)},element:t,getData({input:r}){return oq(e,r,t)}})}function iq(e,t,r){let o=tq(e);if(t==="pane"){o.root=r,nq(e,r);return}if(t==="strip"){o.strip=r;return}if(t==="chrome"){o.chrome=r,md(e,r);return}if(t==="dropZone"){o.dropZone=r,o.releaseDropZone=aq(e,r);return}rq(o,r)}function qE(e){if(e.releaseDropZone?.(),e.releaseDropZone=null,md(e.paneId,null),e.releaseGestures?.(),e.releaseGestures=null,e.stage)Qb(e.stage);EI(e.paneId),co.delete(e.paneId)}function JE(){return m.panes.map((e,t)=>({id:e.id,region:Ln(e.id),split:t>0?"shown":"hidden",stripRegion:VM(e.id)}))}function sq(e,t){return e.length===t.length&&e.every((r,o)=>r===t[o])}var lq=320;function cq(){let e=rs;if(!e||!vn)return;let t=JE(),r=t.map((o)=>o.id);if(!sq(r,os)){for(let o of os)if(!r.includes(o)){let a=co.get(o);if(a)qE(a)}os=r,vn.update(t,u.paneSplit)}dq(e)}function dq(e){if(m.panes.length<2){e.style.gridTemplateColumns="minmax(0, 1fr)";return}let t=u.paneSplit;e.style.gridTemplateColumns=`minmax(0, ${t}fr) 5px minmax(0, ${1-t}fr)`}function pq(){if(as)return;if(rs=document.querySelector("#pane-grid"),!rs)return;let e=JE();os=e.map((t)=>t.id),vn=Nx(rs,e,{collapse:B$,gap:lq,max:WC,min:zC,value:u.paneSplit},{cellPart:iq,move:bO,settle:Bd}),sg=vn.ready,ag=Js({canMonitor({source:t}){return Mu(t.data)},onDrag({location:t}){let[r]=t.current.dropTargets,o=r?.data.paneId,a=r?.data.type==="pane-edge"&&n(o)?o:"";vn?.drag({armed:!0,edgePane:a})},onDragStart(){vn?.drag({armed:!0,edgePane:""})},onDrop(){vn?.drag({armed:!1,edgePane:""})}}),as=me(),as.run(()=>{te(()=>{for(let t of m.panes)t.id;u.paneSplit,cq()})})}function uq(){as?.stop(),as=null,ag?.(),ag=null;let e=[...co.values()];for(let t of e)qE(t);vn?.dispose(),vn=null,sg=null,os=[],co.clear(),rs=null}nv({mount:pq,unmount:uq});var mq=/\/packages\/studio\/src\/surfaces\/([\w-]+)\.json$/,fq=/\/packages\/ui\/components\/(jx-[\w-]+)\.json$/;function hq(e,t){let r=e.replaceAll("\\","/").replace(/\/+$/,""),o=t.replaceAll("\\","/").replace(/^\.?\//,"");return`${r}/${o}`}function gq(e,t){if(!e||!t)return null;let r=hq(e,t),o=mq.exec(r);if(o)return{kind:"surface",name:o[1]};let a=fq.exec(r);if(a)return{kind:"element",tag:a[1]};return null}function bq(e,t){return new URL(t.replaceAll("\\","/").replace(/^\.?\//,""),Gd(e)).href}async function yq(e,t){if(e.kind==="surface"){if(!JM(e.name))return{refused:`no surface is registered as "${e.name}"`,remounted:0,target:e};E(e.name,t);let o=WM(e.name);return await Promise.all(o.map((a)=>a.remount())),{remounted:o.length,target:e}}if(t.tagName!==e.tag)return{refused:`the document names <${String(t.tagName)}>, but the file is ${e.tag}.json`,remounted:0,target:e};await QM(t,g1);let r=zM(e.tag);return await Promise.all(r.map((o)=>o.remount())),{remounted:r.length,target:e}}function vq(e){let t=e.target.kind==="surface"?`surface ${e.target.name}`:e.target.tag,r=`live-chrome:${t}`;if(e.refused)return{key:r,level:"warn",message:`Not applied to the running shell: ${e.refused}.`};let o=e.canvases===void 0||e.canvases===0?"":e.canvases===1?" and on the canvas":` and on ${e.canvases} canvases`;if(e.remounted===0)return{key:r,level:"info",message:`${t} saved; nothing in the shell is drawn from it${o?`, redefined${o}`:""}.`};let a=e.remounted===1?"1 place":`${e.remounted} places`;return{key:r,level:"info",message:`${t} saved and re-mounted in ${a}${o}.`}}function GE(e){return async(t,r)=>{let o=e.workspace.projectRoot,a=gq(o,t);if(!a||!r||!o||!t)return null;let i=await yq(a,r);if(a.kind==="element"&&!i.refused)i={...i,canvases:e.redefineOnCanvases(r,bq(o,t))};let s=vq(i);if(s.level==="warn")e.notify.warn(s.message,{key:s.key,source:"Studio",tier:"problem"});else e.notify.info(s.message,{key:s.key,source:"Studio"});return i}}var XE=0;function hd(){return XE+=1,`msg_${Date.now()}_${XE}`}function Qt(e){return typeof e==="string"}function is(e){return typeof e==="object"&&e!==null}function wq(e){try{let t=JSON.parse(e);return is(t)&&"success"in t&&t.success===!1}catch{return!1}}function dg(e){if(e.role==="tool"){let r=Qt(e.content)?e.content:"";return[{type:"tool_result",callId:Qt(e.toolCallId)?e.toolCallId:"",isError:wq(r),content:r}]}let t=[];if(e.role==="assistant"&&Qt(e.reasoningContent))t.push({type:"reasoning",text:e.reasoningContent});if(Qt(e.content)&&e.content)t.push({type:"text",text:e.content});if(e.role==="assistant"&&Array.isArray(e.toolCalls)){let r=e.toolCalls;for(let o of r){if(!is(o))continue;let{id:a,name:i,arguments:s}=o;t.push({type:"tool_call",id:Qt(a)?a:"",name:Qt(i)?i:"",argumentsText:Qt(s)?s:""})}}return t}function QE(e){return typeof e==="object"&&e!==null}function eN(e){if(e.type!=="reasoning")return{...e};let{provenance:t,...r}=e;return t===void 0?r:{...r,provenance:{...t}}}function lg(e,t){if(Object.is(e,t))return!0;if(!QE(e)||!QE(t))return!1;if(Array.isArray(e)||Array.isArray(t))return Array.isArray(e)&&Array.isArray(t)&&e.length===t.length&&e.every((a,i)=>lg(a,t[i]));let r=Object.entries(e).filter(([,a])=>a!==void 0),o=Object.entries(t).filter(([,a])=>a!==void 0);return r.length===o.length&&r.every(([a,i])=>lg(i,t[a]))}function tN(e,t){let r="";for(let o of e)if(o.type===t)r+=o.text;return r}function ds(e){if(e.role!=="assistant")return!1;return!(e.blocks??dg(e)).some((r)=>r.type==="tool_call"||r.type==="text"&&r.text!=="")}function Un(e){return e.map((t)=>{let{id:r,role:o,timestamp:a,meta:i}=t,s=t.blocks?[...t.blocks]:dg(t),l={id:r,role:o,blocks:s,timestamp:a};return i?{...l,meta:i}:l})}function pg(e){return e.map((t)=>{let r={id:t.id,role:t.role,content:tN(t.blocks,"text"),timestamp:t.timestamp};if(t.role==="tool"){let a=t.blocks.find((i)=>i.type==="tool_result");if(a)r.content=a.content,r.toolCallId=a.callId}else if(t.role==="assistant"){if(t.blocks.some((i)=>i.type==="reasoning"))r.reasoningContent=tN(t.blocks,"reasoning");let a=t.blocks.filter((i)=>i.type==="tool_call");if(a.length>0)r.toolCalls=a.map((i)=>({id:i.id,name:i.name,arguments:i.argumentsText}))}let o=dg(r).map((a)=>eN(a));if(!lg(o,t.blocks.map((a)=>eN(a))))r.blocks=[...t.blocks];if(t.meta)r.meta=t.meta;return r})}function xq(e,t){return(e.provenance?.family??t.meta?.family??"openai-compat")==="openai-compat"&&e.redacted===void 0}function ps(e){let t=[];for(let r of e)if(r.role==="assistant"){if(ds(r))continue;let o="",a="",i=[];for(let l of r.blocks)if(l.type==="text")o+=l.text;else if(l.type==="reasoning"&&xq(l,r))a+=l.text;else if(l.type==="tool_call")i.push({id:l.id,type:"function",function:{name:l.name,arguments:l.argumentsText}});let s={role:"assistant",content:i.length>0?o||null:o};if(a)s.reasoning_content=a;if(i.length>0)s.tool_calls=i;t.push(s)}else if(r.role==="tool"){for(let o of r.blocks)if(o.type==="tool_result")t.push({role:"tool",tool_call_id:o.callId,content:o.content})}else{let o="";for(let a of r.blocks)if(a.type==="text")o+=a.text;t.push({role:r.role,content:o})}return t}function gd(e){return e.map((t)=>{let r={name:t.name,description:t.description,parameters:t.inputSchema};if(t.strict===!0)r.strict=!0;return{type:"function",function:r}})}function ug(e){return e.map((t,r)=>{let o=t,a=is(o.function)?o.function:void 0;if(o.type!=="function"||a===void 0||!Qt(a.name)||!Qt(a.description)||!is(a.parameters))throw TypeError(`tools[${r}] is not an OpenAI function tool with a name, a description and parameters`);let i=a.parameters;if(a.strict===!0)return{name:a.name,description:a.description,inputSchema:i,strict:!0};return{name:a.name,description:a.description,inputSchema:i}})}var mg=hd;function fg(e){return typeof e==="number"&&Number.isFinite(e)&&e>=0}function hg(e={}){let t=e.model||"gpt-4o",r=g({messages:[],status:"idle",streamingContent:"",pendingToolCalls:[],error:null,model:t,tokenCount:0,contextWarning:!1,usage:null}),o=null;function a(F){if(r.status==="streaming")return;let B={id:mg(),role:"user",content:F,timestamp:Date.now()};r.messages.push(B),i()}function i(){if(r.status==="streaming")return;r.error=null,r.streamingContent="",r.pendingToolCalls=[],r.status="streaming",o={id:mg(),role:"assistant",content:"",timestamp:Date.now()},r.messages.push(o),o=r.messages.at(-1)??null}function s(F,B){r.messages.push({id:mg(),role:"tool",toolCallId:F,content:B,timestamp:Date.now()})}function l(F){if(r.status!=="streaming"||!o)return;r.streamingContent+=F,o.content=r.streamingContent}function f(F){if(r.status!=="streaming"||!o)return;o.reasoningContent=(o.reasoningContent??"")+F}function c(F,B){if(r.status!=="streaming")return;let L={id:F,name:B,arguments:"",result:null};if(r.pendingToolCalls.push(L),o){if(!o.toolCalls)o.toolCalls=[];o.toolCalls.push(L)}}function d(F,B){let L=r.pendingToolCalls.find((U)=>U.id===F);if(L)L.arguments+=B}function b(F){}function y(F,B){let L=r.messages.length-1;while(L>=0&&r.messages[L].role==="tool")L-=1;let U=r.messages[L],W=U?.role==="assistant"?U.toolCalls?.find((z)=>z.id===F):null;if(W)W.result=B}function x(F){r.status="idle",r.streamingContent="",r.pendingToolCalls=[],o=null}function S(F){if(r.status="error",r.error=F,r.streamingContent="",r.pendingToolCalls=[],o){let B=r.messages.lastIndexOf(o);if(B!==-1)r.messages.splice(B,1)}o=null}function P(){if(o){let F=r.messages.lastIndexOf(o);if(F!==-1)r.messages.splice(F,1)}r.status="idle",r.streamingContent="",r.pendingToolCalls=[],o=null,r.error=null}function j(){r.messages.length=0,r.status="idle",r.streamingContent="",r.pendingToolCalls=[],r.error=null,r.contextWarning=!1,r.usage=null,o=null}function k(){while(r.messages.length>0&&r.messages.at(-1).role!=="user")r.messages.pop();if(r.messages.length>0&&r.messages.at(-1).role==="user")r.messages.pop();r.status="idle",r.error=null}function T(F){r.model=F}function N(F){r.tokenCount=F}function O(F,B={}){if(!fg(F.inputTokens)||!fg(F.outputTokens))return;let{type:L,...U}=F,W=o??r.messages.at(-1),[z]=W?ps(Un([W])):[],K=z?.role==="assistant"&&Boolean(z.reasoning_content)||!fg(F.reasoningTokens)?0:F.reasoningTokens,ie=Math.max(0,F.inputTokens+F.outputTokens-K),se={...U,contextTokens:ie,lastMessageId:r.messages.at(-1)?.id??"",messageCount:r.messages.length};if(B.systemTokens!==void 0)se.systemTokens=B.systemTokens;r.usage=se,r.tokenCount=ie}function D(){r.usage=null}function M(F){r.contextWarning=F}function V(){return ps(Un(r.messages))}return Object.assign(r,{sendMessage:a,beginAssistantTurn:i,appendDelta:l,appendReasoning:f,appendToolCallStart:c,appendToolCallDelta:d,appendToolCallEnd:b,appendToolResult:y,pushToolResultMessage:s,finishStream:x,setError:S,cancelStream:P,clearChat:j,retryLast:k,setModel:T,setTokenCount:N,recordUsage:O,clearUsage:D,setContextWarning:M,toMessagesArray:V})}class bd extends Error{constructor(e){super(`A turn is already running (${e}).`);this.name="LaneBusyError"}}function gg(){let e=null,t=0;return{acquire(r){if(e!==null)return null;e=r,t+=1;let o=t;return()=>{if(t===o)e=null}},get active(){return e}}}function bg(e){return e.map((t)=>t.text).join("")}var yd=4,us={maxWorkRounds:5,maxRounds:25,estimateTokens:(e)=>Math.ceil(e.length/yd),capText:({maxWorkRounds:e,applied:t,errors:r})=>{let o=[...new Set(r)],a=t.length>0?`
|
|
4
|
+
`)}function Mx(e,t){let r=t.createElement("style");r.dataset.jxCollabCursors="true",t.head.append(r);let o=()=>{r.textContent=__(e)};return o(),e.on("change",o),()=>{e.off("change",o),r.remove()}}var Kl=null,Dx=null;function _x(){if(Kl)return Promise.resolve(Kl);return Dx??=(ce("2f03wcgw"),import("./chunks/grid-view-2f03wcgw.js")).then((e)=>(Kl=e,e)),Dx}function Bx(){return Kl}var Jx={$schema:"https://jxsuite.com/schema/v1",$id:"StudioGridPanel",$description:"The spreadsheet grid's frame: the toolbar, the row count, and the empty box Tabulator is handed. **The engine is an island and stays one** (studio-ui-guidelines.md §9.4): `[part=\"host\"]` is drawn empty and `grid/grid-panel.ts` attaches Tabulator into it through `onNodeCreated`, so nothing here knows what a column or a range is. What converted is the CHROME — every control in the toolbar, and the two popovers and the cell editor that hang off it, each its own document. The host node's identity across a repaint used to be guaranteed by a lit `guard()` and is now guaranteed by construction: a document reconciles its tree in place, so a Save-badge tick cannot destroy the node Tabulator owns.",tagName:"div",attributes:{part:"grid"},style:{$description:"The frame's own layout and the engine's theme, and nothing that was a class. The toolbar is a single row that never wraps: the chrome budget (studio-ui-guidelines.md §12.2) caps what may stand in it, and the count is the only thing pinned to the far end.",display:"flex",flexDirection:"column",height:"100%",minHeight:"0",background:"var(--bg)",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",'& [part="toolbar"]':{$description:"The band the toolbar sits in, and nothing about the row itself: `display: flex`, `align-items: center` and the `--jx-space-2` gap left with the `<div>` that used to carry them, because `jx-toolbar` declares all three in its own definition. What is left is what a BAND is — its inset, its hairline, its panel fill, and its refusal to shrink.",padding:"6px var(--jx-space-3)",borderBottom:"1px solid var(--border)",background:"var(--bg-panel)",flexShrink:"0"},'& [part="filter"]':{width:"200px",flex:"0 0 auto"},'& [part="spacer"]':{flex:"1"},'& [part="note"]':{$description:"A fact about the grid that the rows themselves cannot show — the grouping in force, or that saving will rewrite frontmatter. `cursor: help` because the whole of it is in the tooltip.",fontSize:"var(--jx-text-xs)",color:"var(--fg-dim)",border:"1px solid var(--border)",borderRadius:"var(--radius)",padding:"1px 6px",cursor:"help",whiteSpace:"nowrap"},'& [part="pager"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)"},'& [part="count"]':{fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)",whiteSpace:"nowrap"},'& [part="views"]':{$description:"The applied view's name, which an author may have made long. It ellipses rather than pushing the count off the end, and the `hint` carries the whole of it.",maxWidth:"160px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="host"]':{flex:"1",minHeight:"0"},'& [part="missing"]':{margin:"0",padding:"var(--jx-space-6)",color:"var(--fg-dim)"},"& .tabulator":{$description:"Tabulator's own DOM, styled from inside the document. The engine is an ISLAND (studio-ui-guidelines.md §9.4): it builds this subtree itself, so its own class names are the only hook there is — the document emits none of them. These rules were `.jx-grid .tabulator …` in styles/overlays.css and are dead there now, because the frame that carried `.jx-grid` is this document and it carries no class at all.",background:"var(--bg)",color:"var(--fg)",border:"none",fontSize:"var(--jx-text-sm)",height:"100%"},"& .tabulator .tabulator-header":{background:"var(--bg-panel)",color:"var(--fg)",borderBottom:"1px solid var(--border)"},"& .tabulator .tabulator-header .tabulator-col":{background:"var(--bg-panel)",borderRight:"1px solid var(--border)"},"& .tabulator .tabulator-header .tabulator-col .tabulator-col-title":{color:"var(--fg)",fontWeight:"600"},"& .tabulator .tabulator-header .tabulator-header-filter input":{background:"var(--bg)",color:"var(--fg)",border:"1px solid var(--border)",borderRadius:"var(--jx-radius-sm)",padding:"1px 4px",font:"inherit"},"& .tabulator .tabulator-tableholder":{background:"var(--bg)"},"& .tabulator .tabulator-row":{background:"var(--bg)",color:"var(--fg)",borderBottom:"1px solid color-mix(in srgb, var(--border) 55%, transparent)",minHeight:"26px"},"& .tabulator .tabulator-row.tabulator-row-even":{background:"color-mix(in srgb, var(--bg-panel) 45%, var(--bg))"},"& .tabulator .tabulator-row.tabulator-selected":{background:"color-mix(in srgb, var(--accent) 16%, var(--bg))"},"& .tabulator .tabulator-row .tabulator-cell":{borderRight:"1px solid color-mix(in srgb, var(--border) 55%, transparent)",padding:"3px 8px"},"& .tabulator .tabulator-row .tabulator-cell.tabulator-frozen":{background:"var(--bg-panel)",borderRight:"1px solid var(--border)"},"& .tabulator .tabulator-range":{border:"1px solid var(--accent)",background:"color-mix(in srgb, var(--accent) 10%, transparent)"},"& .tabulator .tabulator-range-overlay .tabulator-range-cell-active":{border:"2px solid var(--accent)"},"& .tabulator .tabulator-placeholder .tabulator-placeholder-contents":{color:"var(--fg-dim)",background:"transparent"},"& .tabulator-cell.jx-grid-cell--dirty":{$description:"The edit buffer's paint. `grid-view.ts` toggles these names on Tabulator's cells and rows, which is the island writing to its own DOM; the document only says what they look like.",boxShadow:"inset 2px 0 0 var(--accent)",background:"color-mix(in srgb, var(--accent) 8%, transparent)"},"& .tabulator-cell.jx-grid-cell--error":{boxShadow:"inset 2px 0 0 var(--danger)",background:"color-mix(in srgb, var(--danger) 12%, transparent)"},"& .tabulator-cell.jx-grid-cell--stale":{opacity:"0.65"},"& .tabulator-row.jx-grid-row--pending-delete .tabulator-cell":{textDecoration:"line-through",opacity:"0.55"},"& .tabulator-row.jx-grid-row--pending-insert":{background:"color-mix(in srgb, var(--success, var(--accent)) 10%, var(--bg))"},"& .tabulator-row.jx-grid-row--stale":{outline:"1px dashed var(--fg-dim)",outlineOffset:"-1px"},'& [part="load-error"]':{color:"var(--danger)"}},children:[{tagName:"div",attributes:{part:"view-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/view"},cases:{missing:{tagName:"p",attributes:{part:"missing","data-view":"missing"},textContent:"This tab has no grid source."},grid:{tagName:"div",attributes:{part:"frame",role:"none"},style:{display:"contents"},children:[{tagName:"jx-toolbar",$description:'The kit\'s toolbar, which is what the four lines this node used to carry have become: a hand-written `role="toolbar"`, a hand-written `aria-label`, no tab-order collapse at all, and no arrow keys. `jx-action-group` could not be it — that element roves `jx-action-button` and nothing else, and this row holds a `jx-button`, a `jx-divider` and the filter `jx-textfield` beside its action buttons, so it would have found two of the controls and left the rest as five more tab stops. The field keeps its own arrows while its caret has text to walk, which is the one thing that makes a text box legal in a toolbar at all (ui.md §5.5).',attributes:{part:"toolbar"},$props:{label:"Grid actions"},children:[{tagName:"jx-button",attributes:{part:"save"},$props:{variant:"accent",size:"sm",disabled:{$ref:"#/state/saveDisabled"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/save"},value:[]}]},children:[{tagName:"span",textContent:"${state.saveLabel}"}]},{tagName:"jx-action-button",attributes:{part:"refresh"},$props:{size:"sm",quiet:!0,label:"Refresh",hint:"Reload from source",disabled:{$ref:"#/state/refreshDisabled"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/refresh"},value:[]}]},children:[{tagName:"span",textContent:"Refresh"}]},{tagName:"jx-divider",attributes:{part:"divider"},$props:{orientation:"vertical"}},{tagName:"span",attributes:{part:"insert-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/canInsert"},cases:{true:{tagName:"jx-action-button",attributes:{part:"add-row"},$props:{size:"sm",quiet:!0,label:"Add Row",hint:"Add a row (saved on Save)"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/addRow"},value:[]}]},children:[{tagName:"span",textContent:"Add Row"}]}}},{tagName:"span",attributes:{part:"delete-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/canDelete"},cases:{true:{tagName:"jx-action-button",attributes:{part:"delete-rows"},$props:{size:"sm",quiet:!0,label:"Delete Rows",hint:"Mark selected rows for deletion"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/deleteRows"},value:[]}]},children:[{tagName:"span",textContent:"Delete Rows"}]}}},{tagName:"jx-action-button",attributes:{part:"fill-down"},$props:{size:"sm",quiet:!0,label:"Fill Down",hint:"Fill the selected range down from its first row (Ctrl/Cmd-D)"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/fillDown"},value:[]}]},children:[{tagName:"span",textContent:"Fill Down"}]},{tagName:"jx-action-button",attributes:{part:"replace"},$props:{size:"sm",quiet:!0,label:"Replace",hint:"Find & replace across text cells"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openReplace"},value:[{$ref:"event#/currentTarget"}]}]},children:[{tagName:"span",textContent:"Replace"}]},{tagName:"jx-action-button",attributes:{part:"views"},$props:{size:"sm",quiet:!0,label:"${state.viewLabel}",hint:"Saved views, columns, sort and grouping",haspopup:"dialog"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openViews"},value:[{$ref:"event#/currentTarget"}]}]},children:[{tagName:"span",textContent:"${state.viewLabel}"}],$description:"One control for the four facets a saved view is made of, because they are only ever adjusted together (studio-ui-guidelines.md §12.2). Its label is the applied view's name, so the toolbar says what is on screen before the panel is opened."},{tagName:"jx-textfield",attributes:{part:"filter"},$props:{type:"search",size:"sm",label:"Filter rows",placeholder:"Filter rows",clearable:!0,value:{$ref:"#/state/filter"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setFilter"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"span",attributes:{part:"spacer",role:"none"}},{tagName:"span",attributes:{part:"group-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/groupState"},cases:{shown:{tagName:"span",attributes:{part:"note","data-note":"grouping",title:"Rows are ordered so each group is contiguous."},textContent:"${state.groupNote}"}}},{tagName:"span",attributes:{part:"lossy-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/lossyState"},cases:{shown:{tagName:"span",attributes:{part:"note","data-note":"lossy",title:"Saving re-serializes frontmatter; YAML comments and key order are not preserved."},textContent:"rewrites frontmatter"}}},{tagName:"span",attributes:{part:"pager-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/pagerState"},cases:{shown:{tagName:"span",attributes:{part:"pager"},children:[{tagName:"jx-action-button",attributes:{part:"prev"},$props:{size:"sm",quiet:!0,label:"Previous page",hint:"Previous page",disabled:{$ref:"#/state/prevDisabled"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/prevPage"},value:[]}]},children:[{tagName:"span",textContent:"‹ Prev"}]},{tagName:"span",attributes:{part:"count"},textContent:"${state.pageRange}"},{tagName:"jx-action-button",attributes:{part:"next"},$props:{size:"sm",quiet:!0,label:"Next page",hint:"Next page",disabled:{$ref:"#/state/nextDisabled"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/nextPage"},value:[]}]},children:[{tagName:"span",textContent:"Next ›"}]}]}}},{tagName:"span",attributes:{part:"count"},children:[{tagName:"span",attributes:{part:"count-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/countState"},cases:{loading:{tagName:"span",attributes:{part:"count-text"},textContent:"Loading…"},error:{tagName:"span",attributes:{part:"load-error",role:"alert"},textContent:"${state.error}"},total:{tagName:"span",attributes:{part:"count-text"},textContent:"${state.countLabel}"}}}]}]},{$description:"Tabulator's node. Empty in the document, and filled by the adapter the moment it is created — a rendered child here would be destroyed by the engine's first build.",tagName:"div",attributes:{part:"host"}}]}}}]};E("grid-panel",Jx);function Kx(e,t){e.view=t.view,e.saveLabel=t.saveLabel,e.saveDisabled=t.saveDisabled,e.refreshDisabled=t.refreshDisabled,e.canInsert=t.canInsert,e.canDelete=t.canDelete,e.viewLabel=t.viewLabel,e.filter=t.filter,e.groupState=t.groupState,e.groupNote=t.groupNote,e.lossyState=t.lossyState,e.pagerState=t.pagerState,e.pageRange=t.pageRange,e.prevDisabled=t.prevDisabled,e.nextDisabled=t.nextDisabled,e.countState=t.countState,e.countLabel=t.countLabel,e.error=t.error}function B_(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function xf(e,t,r){e.replaceChildren();let o=g({addRow:r.addRow,canDelete:!1,canInsert:!1,countLabel:"",countState:"loading",deleteRows:r.deleteRows,error:"",fillDown:r.fillDown,filter:"",gridHost:r.gridHost,groupNote:"",groupState:"hidden",lossyState:"hidden",nextDisabled:!0,nextPage:r.nextPage,openReplace:r.openReplace,openViews:r.openViews,pageRange:"",pagerState:"hidden",prevDisabled:!0,prevPage:r.prevPage,refresh:r.refresh,refreshDisabled:!1,save:r.save,saveDisabled:!0,saveLabel:"Save",setFilter:r.setFilter,view:"grid",viewLabel:"View"});Kx(o,t);let a=null,i=!1,s=R("grid-panel",o,e,{onNodeCreated:(l,f,c)=>{if(B_(c)==="host"&&l instanceof HTMLElement)r.gridHost(l)}}).then((l)=>{let f=l.root;if(i)return l.dispose(),f;return a=l,f});return{dispose(){i=!0,a?.dispose(),a=null},ready:s,update:(l)=>Kx(o,l)}}var Yx={$schema:"https://jxsuite.com/schema/v1",$id:"StudioGridViews",$description:"The grid's View panel: the saved views, and the four facets one of them is made of — columns, sort, grouping, and the filter the toolbar box holds. ONE control rather than four, because the chrome budget caps what may stand in a toolbar (studio-ui-guidelines.md §12.2) and these four are only ever adjusted together. There is no Apply button: every edit writes the working layout and applies immediately, so the panel is never showing something the grid is not already doing.",tagName:"jx-popover",attributes:{part:"views-panel"},$props:{label:"Grid view",x:{$ref:"#/state/x"},y:{$ref:"#/state/y"}},children:[{tagName:"div",attributes:{part:"body"},style:{display:"flex",flexDirection:"column",gap:"var(--jx-space-2)",padding:"var(--jx-space-3)",minWidth:"280px",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",maxHeight:"60vh",overflowY:"auto",'& [part="title"]':{fontWeight:"600",fontSize:"var(--jx-text-sm)",margin:"0"},'& [part="empty"]':{margin:"0",color:"var(--fg-dim)",fontSize:"var(--jx-text-xs)"},'& [part="views"]':{display:"flex",flexDirection:"column",gap:"2px"},'& [part="view-row"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-1)"},'& [part="view-name"]':{flex:"1",textAlign:"left",background:"none",border:"none",color:"var(--fg)",font:"inherit",padding:"3px 6px",borderRadius:"var(--jx-radius-sm)",cursor:"pointer"},'& [part="view-name"]:hover':{background:"var(--bg-hover)"},'& [part="view-name"][data-active="true"]':{fontWeight:"600",background:"var(--bg-selected)"},'& [part="view-name"]:focus-visible':{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"},'& [part="actions"]':{display:"flex",gap:"var(--jx-space-2)"},'& [part="columns"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-1)"}},children:[{tagName:"p",attributes:{part:"title"},textContent:"Saved views"},{tagName:"div",attributes:{part:"views-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/viewsState"},cases:{empty:{tagName:"p",attributes:{part:"empty"},textContent:"No saved views yet. Arrange the grid, then save it under a name."},listed:{tagName:"div",attributes:{part:"views"},children:[{$prototype:"Array",items:{$ref:"#/state/views"},key:{$ref:"$map/item/key"},map:{$description:"One saved view: its name applies it, and the cross beside it asks before forgetting it. `$map/item` is the view, so the row hands its own name back rather than an index.",tagName:"div",attributes:{part:"view-row","data-view":"${$map.item.name}"},children:[{tagName:"button",attributes:{part:"view-name",type:"button","data-active":"${$map.item.active}","aria-current":"${$map.item.current}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/applyView"},value:[{$ref:"$map/item/name"}]}]},textContent:"${$map.item.name}"},{tagName:"jx-action-button",attributes:{part:"view-delete"},$props:{size:"sm",quiet:!0,icon:"x",label:"${$map.item.deleteLabel}",hint:"Delete this view"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/deleteView"},value:[{$ref:"$map/item/name"}]}]}}]}}]}}},{tagName:"div",attributes:{part:"actions"},children:[{tagName:"jx-button",attributes:{part:"save-view"},$props:{variant:"accent",size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/saveView"},value:[]}]},children:[{tagName:"span",textContent:"${state.saveLabel}"}]},{tagName:"jx-button",attributes:{part:"reset"},$props:{variant:"secondary",size:"sm",label:"Forget this grid's saved columns, sort, grouping and filter. Named views are kept."},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/reset"},value:[]}]},children:[{tagName:"span",textContent:"Reset"}]}]},{tagName:"p",attributes:{part:"title","data-title":"columns"},textContent:"Columns"},{tagName:"div",attributes:{part:"columns"},children:[{$prototype:"Array",items:{$ref:"#/state/columns"},key:{$ref:"$map/item/field"},map:{$description:"One column's visibility. The title is SLOTTED rather than passed as `label`: an empty `label` removes the aria-label, so the wrapping label's own text names the box instead of naming it twice — and the reader can see which column the box is for.",tagName:"jx-checkbox",attributes:{part:"column","data-field":"${$map.item.field}"},$props:{size:"sm",checked:{$ref:"$map/item/visible"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/toggleColumn"},value:[{$ref:"$map/item/field"},{$ref:"event#/target/checked"}]}]},children:[{tagName:"span",textContent:"${$map.item.title}"}]}}]},{tagName:"p",attributes:{part:"title","data-title":"sort"},textContent:"Sort"},{tagName:"jx-select",attributes:{part:"sort-field"},$props:{label:"Sort by",size:"sm",options:{$ref:"#/state/fieldOptions"},value:{$ref:"#/state/sortField"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setSortField"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"jx-select",attributes:{part:"sort-dir"},$props:{label:"Sort direction",size:"sm",disabled:{$ref:"#/state/sortDirDisabled"},options:{$ref:"#/state/dirOptions"},value:{$ref:"#/state/sortDir"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setSortDir"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"p",attributes:{part:"title","data-title":"group"},textContent:"Group by"},{tagName:"jx-select",attributes:{part:"group-field"},$props:{label:"Group by",size:"sm",options:{$ref:"#/state/groupOptions"},value:{$ref:"#/state/groupField"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setGroup"},value:[{$ref:"event#/target/value"}]}]}}]}]};E("grid-views",Yx);var X_="grid/views";function Qx(e,t){e.x=t.x,e.y=t.y,e.viewsState=t.viewsState,e.views=t.views,e.saveLabel=t.saveLabel,e.columns=t.columns,e.fieldOptions=t.fieldOptions,e.dirOptions=t.dirOptions,e.groupOptions=t.groupOptions,e.sortField=t.sortField,e.sortDir=t.sortDir,e.sortDirDisabled=t.sortDirDisabled,e.groupField=t.groupField}function Zx(e,t,r){let o=g({applyView:t.applyView,columns:[],deleteView:t.deleteView,dirOptions:[],fieldOptions:[],groupField:"",groupOptions:[],reset:t.reset,saveLabel:"Save view…",saveView:t.saveView,setGroup:t.setGroup,setSortDir:t.setSortDir,setSortField:t.setSortField,sortDir:"asc",sortDirDisabled:!0,sortField:"",toggleColumn:t.toggleColumn,views:[],viewsState:"empty",x:0,y:0});Qx(o,e);let a={anchor:r,name:"grid-views",scope:o,slot:X_};if(t.dismissed)a.onDismissed=t.dismissed;let i=qu(a);return{close:i.close,host:i.host,isOpen:i.isOpen,ready:i.ready,update:(s)=>{if(i.isOpen())Qx(o,s)}}}var ek={$schema:"https://jxsuite.com/schema/v1",$id:"StudioGridReplace",$description:"Find and replace across the grid's text cells. Every replacement is buffered as ONE undo group and nothing is written until the grid is saved, which is what the confirmation says out loud.",tagName:"jx-popover",attributes:{part:"replace-panel"},$props:{label:"Find and replace",x:{$ref:"#/state/x"},y:{$ref:"#/state/y"}},children:[{tagName:"div",attributes:{part:"body"},style:{display:"flex",flexDirection:"column",gap:"var(--jx-space-2)",padding:"var(--jx-space-3)",minWidth:"260px",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",'& [part="title"]':{fontWeight:"600",fontSize:"var(--jx-text-sm)",margin:"0"},'& [part="actions"]':{display:"flex",justifyContent:"flex-end",gap:"var(--jx-space-2)"}},children:[{tagName:"p",attributes:{part:"title"},textContent:"Find & Replace"},{tagName:"jx-textfield",attributes:{part:"find"},$props:{size:"sm",label:"Find",placeholder:"Find…",value:{$ref:"#/state/find"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setFind"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"jx-textfield",attributes:{part:"replace"},$props:{size:"sm",label:"Replace with",placeholder:"Replace with…",value:{$ref:"#/state/replace"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setReplace"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"div",attributes:{part:"actions"},children:[{tagName:"jx-button",attributes:{part:"cancel"},$props:{variant:"secondary",size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/cancel"},value:[]}]},children:[{tagName:"span",textContent:"Cancel"}]},{tagName:"jx-button",attributes:{part:"replace-all"},$props:{variant:"accent",size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/replaceAll"},value:[]}]},children:[{tagName:"span",textContent:"Replace All"}]}]}]}]};E("grid-replace",ek);var ez="grid/replace";function tk(e,t,r){let o=g({cancel:()=>{i.close(),t.dismissed?.()},find:"",replace:"",replaceAll:()=>{t.replaceAll(o.find,o.replace)},setFind:(s)=>{o.find=s},setReplace:(s)=>{o.replace=s},x:e.x,y:e.y}),a={anchor:r,name:"grid-replace",scope:o,slot:ez};if(t.dismissed)a.onDismissed=t.dismissed;let i=qu(a);return i}var Zl=new Map,kf=new Map;function oi(e){return Zl.get(e)??null}function ai(e){kf.get(e)?.dispose(),kf.delete(e);let t=Zl.get(e);if(!t)return;t.views?.close(),t.replace?.close(),t.view?.destroy(),t.scope.stop(),t.surface?.dispose(),Zl.delete(e)}function $f(e,t){let r=oi(e);return r!==null&&r.tabId===t.id&&r.wrap.isConnected}function tz(e){let t=kS(e);if(!t)return"View";return LN(e)?`${t} •`:t}function nz(e){let t=e.state.grouping;if(!t)return"";let r=e.state.columns.find((a)=>a.field===t)?.title??t,o=e.groups().length;return`Grouped by ${r} · ${o} group${o===1?"":"s"}`}function rz(e){let{state:t}=e,r=t.query.limit??50,o=t.query.offset??0;return`${t.total===0?0:o+1}–${Math.min(o+r,t.total)}`}function nk(e){let{state:t}=e,r=e.source.id,o=e.buffer.dirtyCount(),a=Yl(r),i=t.query.limit??50,s=t.query.offset??0,l=nz(e);return{canDelete:e.source.capabilities.delete===!0,canInsert:e.source.capabilities.insert===!0,countLabel:`${t.total} row${t.total===1?"":"s"}`,countState:t.loading?"loading":t.error?"error":"total",error:t.error??"",filter:Pd(r)?.filter??"",groupNote:l,groupState:l===""?"hidden":"shown",lossyState:a?.kind==="collection"||a?.kind==="pages"?"shown":"hidden",nextDisabled:s+i>=t.total||t.loading,pageRange:rz(e),pagerState:e.source.capabilities.remotePaging?"shown":"hidden",prevDisabled:s===0||t.loading,refreshDisabled:t.loading||t.saving,saveDisabled:o===0||t.saving,saveLabel:o>0?`Save (${o})`:"Save",view:"grid",viewLabel:tz(r)}}function rk(e,t){let r=e.source.id,o=Pd(r)??{},a=Uu(r),i=kS(r),s=new Set(o.hidden),l=o.sort??null,{columns:f}=e.state,c=f.map((d)=>({label:d.title,value:d.field}));return{columns:f.map((d)=>({field:d.field,title:d.title,visible:!s.has(d.field)})),dirOptions:[{label:"Ascending",value:"asc"},{label:"Descending",value:"desc"}],fieldOptions:[{label:"Source order",value:""},...c],groupField:e.state.grouping??"",groupOptions:[{label:"Ungrouped",value:""},...c],saveLabel:i?"Save as…":"Save view…",sortDir:l?.dir??"asc",sortDirDisabled:l===null,sortField:l?.field??"",views:a.map((d)=>({active:d.name===i?"true":"false",current:d.name===i?"true":"false",deleteLabel:`Delete the saved view ${d.name}`,key:d.name,name:d.name})),viewsState:a.length===0?"empty":"listed",x:t.x,y:t.y}}function oz(e,t,r){if(t.views?.isOpen()){t.views.close(),t.views=null;return}let o=Me(r),a={x:Math.max(4,o.left),y:o.bottom+4};t.viewsAt=a;let i=e.source.id,s=()=>{t.views?.close(),t.views=null},l=(c,d)=>{Sm(i,c),d(),t.bump()},f=(c)=>l({sort:c},()=>{e.setSort(c)});t.views=Zx(rk(e,a),{applyView:(c)=>{t.applyLayout(Rw(i,c)),s()},deleteView:(c)=>{az(i,c,t)},dismissed:()=>{t.views=null},reset:()=>{ST(i),t.applyLayout(null),s()},saveView:()=>{ok(e,t)},setGroup:(c)=>{l({groupBy:c||null},()=>e.setGrouping(c||null))},setSortDir:(c)=>{let d=Pd(i)?.sort??null;if(d)f({dir:c==="desc"?"desc":"asc",field:d.field})},setSortField:(c)=>{let d=Pd(i)?.sort??null;f(c===""?null:{dir:d?.dir??"asc",field:c})},toggleColumn:(c,d)=>{let b=new Set(Pd(i)?.hidden);if(d)b.delete(c);else b.add(c);l({hidden:[...b]},()=>t.remount())}},r),t.bump()}async function az(e,t,r){if(await qo("Delete View",`Delete the saved view "${t}"? The grid keeps its current layout.`,{confirmLabel:"Delete",destructive:!0})&&CT(e,t))r.bump()}async function ok(e,t){let r=e.source.id,o=await Fn("Save Grid View",{confirmLabel:"Save View",message:`Columns, sort, grouping and filter, saved for ${e.source.label}.`,placeholder:"Recent drafts",validate:(i)=>i.trim()===""?"Name the view.":"",value:kS(r)??""});if(o===null)return null;let a=$N(r,o);if(!a)return w.warn("Views cannot be saved — this browser has local storage disabled.",{key:"grid.saveView",source:"Data"}),null;return t.bump(),a.name}function iz(e,t,r){if(t.replace?.isOpen()){t.replace.close(),t.replace=null;return}let o=Me(r);t.replace=tk({x:Math.max(4,o.left),y:o.bottom+4},{dismissed:()=>{t.replace=null},replaceAll:(a,i)=>{let s=e.replaceAll(a,i);if(s===0){w.info("No matches.",{key:"grid.replaceAll"});return}w.success(`Replaced in ${s} cell${s===1?"":"s"} — save to apply.`,{action:"file.save",key:"grid.replaceAll"}),t.replace?.close(),t.replace=null}},r)}function ak(e,t){let{paneId:r,wrap:o}=e;if($f(r,t))return;ai(r);let a=er(t);if(!a&&t.documentPath?.toLowerCase().endsWith(".csv"))a=$p(t,jS(t.documentPath)),a.load();if(!a){kf.set(r,xf(o,cz(),dz()));return}let i=me(),s=g({views:0}),l=a,f=null;function c(y){if(d.view?.destroy(),d.view=null,!f)return;let x=f,S=Bx();if(S){let P=S.createGridView(x,l);d.view=P,y?.(P);return}_x().then(({createGridView:P})=>{if(oi(r)!==d||f!==x||d.view)return;let j=P(x,l);d.view=j,y?.(j),d.bump()})}let d={applyLayout(y){l.setSort(y?.sort??null),l.setGrouping(y?.groupBy??null),c((x)=>x.setSearch(y?.filter??"")),d.bump()},bump(){s.views+=1},paneId:r,remount(){c()},replace:null,scope:i,surface:null,tabId:t.id,view:null,views:null,viewsAt:{x:0,y:0},wrap:o};Zl.set(r,d),d.surface=xf(o,nk(l),{addRow:()=>l.addRow(),deleteRows:()=>l.deleteRows(d.view?.getSelectedRowKeys()??[]),fillDown:()=>d.view?.fillDown(),gridHost:(y)=>{f=y},nextPage:()=>{let y=l.state.query.limit??50;l.setQuery({...l.state.query,limit:y,offset:(l.state.query.offset??0)+y})},openReplace:(y)=>{iz(l,d,y)},openViews:(y)=>{oz(l,d,y)},prevPage:()=>{let y=l.state.query.limit??50;l.setQuery({...l.state.query,limit:y,offset:Math.max(0,(l.state.query.offset??0)-y)})},refresh:()=>{l.refresh()},save:()=>{l.save()},setFilter:(y)=>{Sm(l.source.id,{filter:y}),d.view?.setSearch(y)}}),d.surface.ready.then(()=>{if(oi(r)===d)d.bump()});let b=!1;i.run(()=>{te(()=>{if(oi(r)!==d)return;if(l.state.loading,l.state.saving,l.state.error,l.state.total,l.state.query.offset,l.state.grouping,l.buffer.dirtyCount(),s.views,d.surface?.update(nk(l)),d.views?.update(rk(l,d.viewsAt)),!d.view&&!l.state.loading&&l.state.columns.length>0&&f)c((y)=>{if(b)return;b=!0;let x=Pd(l.source.id);sz(l,x),y.setSearch(x?.filter??"")});lz(l,d,t.documentPath)})})}function sz(e,t){let r=t?.sort??null,{query:o,grouping:a}=e.state;if(!(r===null?o.orderBy===void 0:o.orderBy===r.field&&o.dir===r.dir))e.setSort(r);let s=t?.groupBy??null;if(a!==s)e.setGrouping(s)}function lz(e,t,r){let o=cN(r);if(o===void 0||!r||!t.view||e.state.loading)return;dN(r);let a=e.state.rows[o];if(a)t.view.revealRow(a.key)}function cz(){return{canDelete:!1,canInsert:!1,countLabel:"",countState:"total",error:"",filter:"",groupNote:"",groupState:"hidden",lossyState:"hidden",nextDisabled:!0,pageRange:"",pagerState:"hidden",prevDisabled:!0,refreshDisabled:!0,saveDisabled:!0,saveLabel:"Save",view:"missing",viewLabel:"View"}}function dz(){let e=()=>{};return{addRow:e,deleteRows:e,fillDown:e,gridHost:e,nextPage:e,openReplace:e,openViews:e,prevPage:e,refresh:e,save:e,setFilter:e}}function ri(){let e=er(h.value),t=oi(m.activePaneId);if(!e||!t||t.tabId!==e.tab.id)return null;return{controller:e,panel:t}}function ni(e){let t=ri();if(!t)throw Error(`command "${e}" needs a grid on screen`);return t}function pz(){let e=(t,r)=>{let{controller:o}=ni(t),a=o.source.id,i=St(t,r,"name"),s=Uu(a).map((l)=>l.name);if(!s.includes(i))throw RangeError(`command "${t}" argument "name": "${i}" is not a saved view of ${o.source.label} — it has: ${s.length>0?s.join(", "):"none"}`);return{gridId:a,name:i}};return[{category:"View",id:"grid.saveView",level:"document",menus:["palette"],group:"5_data",requires:"a grid on screen",when:(t)=>t.project.open,enablement:()=>ri()!==null,run:async()=>{let{controller:t,panel:r}=ni("grid.saveView");await ok(t,r)},title:"Save Grid View…"},{args:Se({name:Fe("The saved view's name.")}),category:"View",id:"grid.applyView",level:"document",menus:["palette"],group:"5_data",requires:"a grid on screen",when:(t)=>t.project.open,enablement:()=>ri()!==null,run:(t,r)=>{let{gridId:o,name:a}=e("grid.applyView",r),{panel:i}=ni("grid.applyView");i.applyLayout(Rw(o,a))},title:"Apply Grid View"},{args:Se({name:Fe("The saved view's name.")}),category:"View",id:"grid.deleteView",level:"document",menus:["palette"],group:"5_data",requires:"a grid on screen",destructive:!0,when:(t)=>t.project.open,enablement:()=>ri()!==null,run:(t,r)=>{let{gridId:o,name:a}=e("grid.deleteView",r);CT(o,a),ni("grid.deleteView").panel.bump()},title:"Delete Grid View"},{category:"View",id:"grid.resetView",level:"document",menus:["palette"],group:"5_data",requires:"a grid on screen",when:(t)=>t.project.open,enablement:()=>ri()!==null,run:()=>{let{controller:t,panel:r}=ni("grid.resetView");ST(t.source.id),r.applyLayout(null)},title:"Reset Grid View"}]}function ik(e){e.registerAll(pz())}function sk(){I$();let e=Yy(wr(h.value?.doc.document?.style));vx(e)}var lk={$schema:"https://jxsuite.com/schema/v1",$id:"StudioSettingsCssVars",$description:"The Styles workspace's Variables view, its editor (studio.md §7.1): the project's design tokens, grouped by what they name, each editable in place and each able to carry a different value in any rendering context the project declares. The view's own frame (`surfaces/styles-variables.json`) draws the heading and mounts this document into its `editor` island. The adapter (`surfaces/settings-css-vars.ts`) hands in the groups already grouped, each token already resolved — its swatch colour, the chip it wears when its value follows another token, the override rows it has, the contexts it could still be given one in and whether it is the token the Outline pointed at — and the document draws them. Nothing here reads `project.json` and nothing here decides what a token IS: `style/project-styles.ts` owns the vocabulary and `settings/css-vars-editor.ts` owns the writes. A context is DEFINED in Project Settings › Contexts and only overridden here, which is why the one thing the colour group says when no scheme exists is where to go and say it.",tagName:"section",attributes:{part:"cssvars"},style:{$description:"This section's whole look, keyed on `part`. Six of the rules it used to borrow are gone rather than moved: `.settings-section` never had a rule anywhere (it was on the orphan ledger), and `.css-var-swatch input[type=\"color\"]` plus the two chip spans are drawn here now because the lit helper that emitted them is drawn here now. Every `--spectrum-font-size-*` reference is re-pointed at the kit's scale: a document is mounted in the pane rather than inside `<sp-theme>`, so each of those would have silently taken its hard-coded fallback. Two part names are this document's own on purpose: the colour well is `well` and a font token's specimen is `font-preview`, because `swatch` and `preview` are parts INSIDE `jx-select` (its options' colour chip and its closed-state value), and this section draws a `jx-select` per token. The kit is light DOM, so `& [part=\"preview\"]` reached the Add override picker's own value and gave it this sheet's 108px indent, bottom padding and 13px type: a 36px control under a 20px field. The name column is a fixed width (`--name-col`) so every value field in a group starts at the same x, and the override list indents to that same column rather than to a literal that guessed it.","--name-col":"12rem",display:"block",'& [part="section-error"]':{$description:'A write that failed, said under the section title rather than pinned to a control. This section saves on change and the predecessor dropped every rejection on the floor, so a read-only file made each edit look as though it had been taken and then quietly forgotten. It is `section-error` rather than `error` because every text field and select in the section draws a permanent `[part="error"]` of its own in this same light-DOM tree, and a rule on that name would give their refusal sentences this margin and size too.',margin:"0 0 12px",fontSize:"var(--jx-text-md)",color:"var(--danger)"},'& [part="token-group"]':{marginBottom:"24px"},'& [part="token"][aria-current="true"]':{$description:"The token the Outline pointed the view at: a tinted band with the accent edge the Outline's own selected row wears, so the two say the same thing about one property.",borderRadius:"var(--radius)",background:"var(--accent-20)",boxShadow:"inset 2px 0 0 var(--accent)"},'& [part="group-title"]':{margin:"0 0 8px",fontSize:"13px",fontWeight:"600",color:"var(--fg)",textTransform:"uppercase",letterSpacing:"0.5px"},'& [part="row"]':{display:"flex",alignItems:"center",gap:"8px",padding:"4px 0"},'& [part="name"]':{$description:"A fixed column, not a minimum: with `minWidth` the value field started wherever its name ended, so a long name pushed its field out of line with every field above it. A name longer than the column is cut with an ellipsis and carries its whole self in `title`.",flex:"0 0 var(--name-col)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"},'& [part="swatch-slot"], & [part="chip-slot"]':{display:"contents"},'& [part="well"]':{$description:"The colour well. Its background is the value the token RESOLVES to, so an alias token is a colour rather than a blank square, and the native input over it is transparent — the well is what the reader sees and the input is only what they operate.",position:"relative",width:"24px",height:"24px",flex:"none",border:"1px solid var(--border)",borderRadius:"var(--radius)",overflow:"hidden",cursor:"pointer"},'& [part="swatch-input"]':{position:"absolute",inset:"0",width:"100%",height:"100%",opacity:"0",cursor:"pointer"},'& [part="value"]':{flex:"0 1 16rem",minWidth:"0"},'& [data-group="color"] [part="value"]':{flexBasis:"10rem"},'& [data-group="size"] [part="value"]':{flexBasis:"8rem"},'& [part="chip"]':{$description:'A value that is exactly `var(--token)` is a reference, and raw text is the one rendering that hides both which token and what it currently is. The chip says both. It is a span, not a button: it states, it does not navigate. Same border, same size and same radius as the provenance chips in the Inspector, because "this value comes from somewhere else" is the same sentence in both places.',display:"inline-flex",alignItems:"center",gap:"4px",flexShrink:"0",maxWidth:"14ch",overflow:"hidden",padding:"0 5px",border:"1px solid currentcolor",borderRadius:"var(--radius)",color:"var(--handler)",fontSize:"9px",lineHeight:"14px",whiteSpace:"nowrap"},'& [part="chip-swatch"]':{width:"8px",height:"8px",flexShrink:"0",border:"1px solid var(--border)",borderRadius:"var(--jx-radius-xs)"},'& [part="chip-label"]':{overflow:"hidden",textOverflow:"ellipsis"},'& [part="font-preview"]':{$description:"A font token is the one kind whose value cannot be read: `'Georgia', serif` is a name for a shape, so the shape is drawn. Indented to the value column (the name column and the gap after it), because it belongs to the field above it rather than to the section.",padding:"4px 0 12px calc(var(--name-col) + 8px)",fontSize:"13px",color:"var(--fg-dim)"},'& [part="overrides"]':{$description:"Indented to the value column: past the name column and its gap, and in the colour group past the well too, so an override value sits under the base value it overrides.",paddingLeft:"calc(var(--name-col) + 8px)",marginBottom:"8px"},'& [data-group="color"] [part="overrides"]':{paddingLeft:"calc(var(--name-col) + 40px)"},'& [part="override"]':{display:"flex",alignItems:"center",gap:"8px",padding:"2px 0"},'& [part="override-label"]':{fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)",minWidth:"60px"},'& [part="override-value"]':{flex:"none",maxWidth:"120px"},'& [data-group="color"] [part="override-value"]':{flex:"1",maxWidth:"160px"},'& [part="override-add"]':{$description:"The add-an-override control aligns with the override rows rather than with the token name: it belongs to the override list, and a control that lined up with the base value would read as a second base value.",display:"flex",alignItems:"center",padding:"2px 0"},'& [part="add-picker"]':{$description:"As compact as the fields beside it: sized to its own label rather than stretched, since it is a verb on the list above it and not a value of its own.",flex:"none",width:"auto"},'& [part="add"]':{display:"flex",alignItems:"center",gap:"8px",padding:"8px 0",marginTop:"8px",borderTop:"1px solid var(--border)"},'& [part="add-name"], & [part="add-value"]':{flex:"1",minWidth:"0"},'& [part="notice"]':{$description:"What the colour group says when the project declares no scheme: this level overrides a context, it never defines one, so the only thing it can offer is the way to the level that does.",display:"flex",alignItems:"center",flexWrap:"wrap",gap:"6px",margin:"0",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"}},children:[{tagName:"div",attributes:{part:"section-error-slot",role:"none"},$switch:{$ref:"#/state/hasError"},cases:{true:{tagName:"p",attributes:{part:"section-error",role:"alert"},textContent:"${state.error}"}}},{$prototype:"Array",items:{$ref:"#/state/groups"},key:{$ref:"$map/item/id"},map:{tagName:"div",attributes:{part:"token-group","data-group":"${$map.item.id}"},children:[{tagName:"h3",attributes:{part:"group-title"},textContent:"${$map.item.title}"},{$prototype:"Array",items:{$ref:"$map/item/tokens"},key:{$ref:"$map/item/name"},map:{tagName:"div",attributes:{part:"token","data-token":"${$map.item.name}","aria-current":"${$map.item.current ? 'true' : null}"},children:[{tagName:"div",attributes:{part:"row"},children:[{tagName:"div",attributes:{part:"swatch-slot",role:"none"},$switch:{$ref:"$map/item/swatchState"},cases:{swatch:{tagName:"div",attributes:{part:"well"},style:{background:{$ref:"$map/item/swatchBg"}},children:[{tagName:"input",attributes:{part:"swatch-input",type:"color","aria-label":"${$map.item.swatchLabel}"},value:{$ref:"$map/item/swatchInput"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setToken"},value:[{$ref:"$map/item/name"},{$ref:"event#/target/value"}]}]}}]}}},{tagName:"span",attributes:{part:"name",title:"${$map.item.label}"},textContent:"${$map.item.label}"},{tagName:"jx-textfield",attributes:{part:"value"},$props:{label:{$ref:"$map/item/label"},value:{$ref:"$map/item/value"},size:"sm"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setToken"},value:[{$ref:"$map/item/name"},{$ref:"event#/target/value"}]}]}},{tagName:"div",attributes:{part:"chip-slot",role:"none"},$switch:{$ref:"$map/item/chipState"},cases:{plain:{tagName:"span",attributes:{part:"chip",title:"${$map.item.chipTitle}"},children:[{tagName:"span",attributes:{part:"chip-label"},textContent:"${$map.item.chipLabel}"}]},swatch:{tagName:"span",attributes:{part:"chip",title:"${$map.item.chipTitle}"},children:[{tagName:"span",attributes:{part:"chip-swatch"},style:{background:{$ref:"$map/item/chipSwatch"}}},{tagName:"span",attributes:{part:"chip-label"},textContent:"${$map.item.chipLabel}"}]}}},{tagName:"jx-action-button",attributes:{part:"remove"},$props:{icon:"trash",size:"sm",label:{$ref:"$map/item/removeLabel"},hint:{$ref:"$map/item/removeLabel"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/removeToken"},value:[{$ref:"$map/item/name"}]}]}}]},{tagName:"div",attributes:{part:"preview-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/previewState"},cases:{font:{tagName:"div",attributes:{part:"font-preview"},style:{fontFamily:{$ref:"$map/item/previewFont"}},textContent:"The quick brown fox jumps over the lazy dog"}}},{tagName:"div",attributes:{part:"overrides-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/overrideState"},cases:{shown:{tagName:"div",attributes:{part:"overrides"},children:[{$prototype:"Array",items:{$ref:"$map/item/overrides"},key:{$ref:"$map/item/id"},map:{tagName:"div",attributes:{part:"override","data-kind":"${$map.item.kind}"},children:[{tagName:"span",attributes:{part:"override-label"},textContent:"${$map.item.label}"},{tagName:"div",attributes:{part:"swatch-slot",role:"none"},$switch:{$ref:"$map/item/swatchState"},cases:{swatch:{tagName:"div",attributes:{part:"well"},style:{background:{$ref:"$map/item/swatchBg"}},children:[{tagName:"input",attributes:{part:"swatch-input",type:"color","aria-label":"${$map.item.swatchLabel}"},value:{$ref:"$map/item/swatchInput"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setOverride"},value:[{$ref:"$map/item/token"},{$ref:"$map/item/ctx"},{$ref:"event#/target/value"}]}]}}]}}},{tagName:"jx-textfield",attributes:{part:"override-value"},$props:{label:{$ref:"$map/item/fieldLabel"},value:{$ref:"$map/item/value"},placeholder:"inherits",size:"sm"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setOverride"},value:[{$ref:"$map/item/token"},{$ref:"$map/item/ctx"},{$ref:"event#/target/value"}]}]}}]}},{tagName:"div",attributes:{part:"override-add-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/addState"},cases:{shown:{tagName:"div",attributes:{part:"override-add"},children:[{tagName:"jx-select",attributes:{part:"add-picker"},$props:{label:{$ref:"$map/item/addLabel"},options:{$ref:"$map/item/addOptions"},value:{$ref:"$map/item/addPick"},size:"sm"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/addOverride"},value:[{$ref:"$map/item/name"},{$ref:"event#/target/value"}]}]}}]}}}]}}}]}},{tagName:"div",attributes:{part:"add"},children:[{tagName:"jx-textfield",attributes:{part:"add-name"},$props:{label:{$ref:"$map/item/nameLabel"},placeholder:{$ref:"$map/item/nameHint"},value:{$ref:"$map/item/addName"},size:"sm"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setAddName"},value:[{$ref:"$map/item/id"},{$ref:"event#/target/value"}]}]}},{tagName:"jx-textfield",attributes:{part:"add-value"},$props:{label:{$ref:"$map/item/valueLabel"},placeholder:{$ref:"$map/item/valueHint"},value:{$ref:"$map/item/addValue"},size:"sm"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setAddValue"},value:[{$ref:"$map/item/id"},{$ref:"event#/target/value"}]}]}},{tagName:"jx-button",attributes:{part:"add-button"},$props:{size:"sm",label:{$ref:"$map/item/addLabel"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/addToken"},value:[{$ref:"$map/item/id"}]}]},children:[{tagName:"span",textContent:"Add"}]}]},{tagName:"div",attributes:{part:"notice-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/noticeState"},cases:{shown:{tagName:"p",attributes:{part:"notice"},children:[{tagName:"span",textContent:"No color scheme is defined yet, so these tokens have one value each."},{tagName:"jx-action-button",attributes:{part:"manage"},$props:{size:"sm",hint:"Define a color scheme in Project Settings › Contexts"},onclick:{$ref:"#/state/manageContexts"},children:[{tagName:"span",textContent:"Manage contexts…"}]}]}}}]}}]};E("settings-css-vars",lk);var ac=new WeakMap;function ck(e){return{...e,hasError:e.error!==""}}function dk(e,t,r){let o=ac.get(e);if(o&&(o.handle===null||o.handle.root.isConnected)){Object.assign(o.scope,ck(t));return}o?.handle?.dispose(),e.textContent="";let a=g({...ck(t),...r}),i={handle:null,scope:a};ac.set(e,i),R("settings-css-vars",a,e).then((s)=>{i.handle=s})}function pk(e,t){let r=ac.get(e);if(!r)return;setTimeout(()=>{let o=r.handle?.root;if(!(o instanceof HTMLElement)||!o.isConnected)return;let a=[...o.querySelectorAll('[part="token"]')].find((i)=>i.dataset.token===t);if(!a)return;a.scrollIntoView({behavior:"smooth",block:"nearest"}),a.querySelector('[part="value"] input')?.focus()},0)}function uk(e,t,r){let o=ac.get(e);if(!o)return;setTimeout(()=>{let a=o.handle?.root;if(!(a instanceof HTMLElement)||!a.isConnected)return;let i=[...a.querySelectorAll("[data-group]")].find((s)=>s.dataset.group===t);if(!i)return;if(i.scrollIntoView({behavior:"smooth",block:"start"}),r)i.querySelector('[part="add-name"] input')?.focus()},0)}var mk={color:{name:"Primary Blue",value:"#3b82f6"},font:{name:"Body Serif",value:"'Georgia', serif"},other:{name:"Custom Var",value:"value"},size:{name:"Spacing Large",value:"32px"}},mz="#3b82f6",fz="#111111",hz={label:"Add override…",value:""},fk=new WeakMap;function Jo(e){let t=fk.get(e);if(!t)t={add:{},current:null,error:""},fk.set(e,t);return t}function lc(e,t){let{add:r}=Jo(e);return r[t]??={name:"",value:""}}function gk(){return C?.projectConfig||{}}function Or(){return gk().style||{}}function Cf(){return j_(to(gk().$media))}function ii(e){sk(),si(e),gz(e)}async function gz(e){try{await no({style:{...Or()}}),Jo(e).error=""}catch(t){Jo(e).error=`Could not save project.json — ${X(t)}`}si(e)}function bk(e,t){let r=e===void 0?"transparent":String(e);return{swatchBg:r,swatchInput:r.startsWith("#")?r:t}}function bz(e,t,r,o){let a=Jy(o,t,e.name);return{ctx:t.name,fieldLabel:`${e.name} in ${t.label}`,id:`${e.name} ${t.name}`,kind:t.kind,label:t.label,swatchLabel:`${e.name} in ${t.label}`,swatchState:r?"swatch":"none",token:e.name,value:a===void 0?"":String(a),...bk(Ac(o,a),fz)}}function yz(e,t,r,o,a){let i=t.id==="color",s=String(e.value),l=Ac(r,e.value),f=yp(e.value),c=o.filter((b)=>i&&b.kind==="scheme"||Jy(r,b,e.name)!==void 0),d=s===""?[]:pD(r,o,e.name,c);return{addLabel:`Add an override for ${e.name}`,addOptions:[hz,...d.map((b)=>({label:b.label,value:b.name}))],addPick:"",addState:d.length===0?"none":"shown",chipLabel:f??"",chipState:f===null?"none":i&&l!==void 0?"swatch":"plain",chipSwatch:l===void 0?"":String(l),chipTitle:f===null?"":`${fw(f)} → ${l===void 0?"unresolved":String(l)}`,current:e.name===a,label:e.name,name:e.name,overrides:c.map((b)=>bz(e,b,i,r)),overrideState:c.length===0&&d.length===0?"none":"shown",previewFont:t.id==="font"?s:"",previewState:t.id==="font"?"font":"none",removeLabel:`Delete ${e.name}`,swatchLabel:`${e.name} color`,swatchState:i?"swatch":"none",value:s,...bk(i?l:void 0,mz)}}function vz(e){let t=Or(),r=Cf(),o=r.some((i)=>i.kind==="scheme"),a=[];for(let{group:i,tokens:s}of F_(t)){if(i.id==="other"&&s.length===0)continue;let l=lc(e,i.id);a.push({addLabel:`Add a ${i.title} variable`,addName:l.name,addValue:l.value,id:i.id,nameHint:mk[i.id].name,nameLabel:`New ${i.title} name`,noticeState:i.id==="color"&&!o?"shown":"none",title:i.title,tokens:s.map((f)=>yz(f,i,t,r,Jo(e).current)),valueHint:mk[i.id].value,valueLabel:`New ${i.title} value`})}return{error:Jo(e).error,groups:a}}function si(e){dk(e,vz(e),$z(e))}function Sf(e){return M_.find((t)=>t.id===e)}function wz(e,t){let r=Sf(t);if(!r)return;let o=lc(e,r.id),a=Sv(o.name,r.prefix);if(!a||!o.value)return;Or()[a]=o.value,o.name="",o.value="",ii(e)}function xz(e,t,r){let o=Or(),a=Cf().find((s)=>s.name===r);if(!a||Jy(o,a,t)!==void 0){si(e);return}let i=o[t];if(!n(i)&&!Y(i))return;cE(o,a,t,String(i)),ii(e)}function kz(){nt("settings.open",{section:"contexts"},"Styles")}var hk=new WeakMap;function $z(e){let t=hk.get(e);if(!t)t={addOverride:(r,o)=>{xz(e,r,o)},addToken:(r)=>{wz(e,r)},manageContexts:()=>{kz()},removeToken:(r)=>{delete Or()[r],ii(e)},setAddName:(r,o)=>{let a=Sf(r);if(a)lc(e,a.id).name=o},setAddValue:(r,o)=>{let a=Sf(r);if(a)lc(e,a.id).value=o},setOverride:(r,o,a)=>{let i=Cf().find((s)=>s.name===o);if(!i)return;cE(Or(),i,r,a),ii(e)},setToken:(r,o)=>{Or()[r]=o,ii(e)}},hk.set(e,t);return t}function Tf(e){si(e)}function Pf(e,t,r={}){if(Jo(e).current=t,si(e),t===null||r.reveal===!1)return;pk(e,t)}function yk(e,t,r={}){uk(e,t,r.add===!0)}var li=ja({focus:null,served:!0});function cc(e){if(e.kind==="variable")u.stylebook.variable=e.name;li.value={focus:e,served:!1}}function vk(){li.value={focus:null,served:!0}}var wk={$schema:"https://jxsuite.com/schema/v1",$id:"StudioStylesVariables",$description:"The Styles workspace's Variables view (studio.md §7.1): the project's CSS custom properties, the `--` keys of `project.json`'s root style block, edited in the pane over the same tab as the Elements view and the Code view. It draws the view's frame and nothing it edits: a heading, one sentence saying what these are, one saying when an edit reaches the file (a variable is written as it is changed, which also writes any element style edit still waiting for Save, because both live in the one file), the door to Project Settings › Contexts where colour schemes and breakpoints are declared, and an empty `editor` island the CSS Variables editor (`settings/css-vars-editor.ts`) is mounted into (studio-ui-guidelines.md §9.4). `style/variables-view.ts` decides every word.",tagName:"section",attributes:{part:"variables-view","aria-labelledby":"${state.headingId}","data-jx-region":"${state.region}"},style:{$description:"Fills the pane's stage by its own geometry, as the workspace home does (`workspace-home.json`): the stage is `position: relative`, so the view takes the whole of it and scrolls itself without the stage being restyled for it. The column is capped so a value field never stretches across a wide pane.",position:"absolute",inset:"0",overflowY:"auto",boxSizing:"border-box",padding:"var(--jx-space-6)",fontFamily:"var(--jx-font-sans)",color:"var(--fg)",background:"var(--bg-panel)",'& [part="column"]':{maxWidth:"760px",margin:"0 auto"},'& [part="head"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-2)",marginBottom:"var(--jx-space-5)"},'& [part="title"]':{margin:"0",fontSize:"var(--jx-text-lg)",fontWeight:"600"},'& [part="lede"], & [part="saving"]':{margin:"0",maxWidth:"68ch",lineHeight:"1.5",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"},'& [part="saving"]':{fontSize:"var(--jx-text-sm)"},'& [part="schemes"]':{display:"flex",alignItems:"center",flexWrap:"wrap",gap:"var(--jx-space-2)",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="schemes-text"]':{margin:"0"}},children:[{tagName:"div",attributes:{part:"column"},children:[{tagName:"header",attributes:{part:"head"},children:[{tagName:"h2",attributes:{part:"title",id:"${state.headingId}"},textContent:"${state.title}"},{tagName:"p",attributes:{part:"lede"},textContent:"${state.lede}"},{tagName:"p",attributes:{part:"saving"},textContent:"${state.saving}"},{tagName:"div",attributes:{part:"schemes"},children:[{tagName:"p",attributes:{part:"schemes-text"},textContent:"${state.schemes}"},{tagName:"jx-action-button",attributes:{part:"manage-contexts"},$props:{size:"sm",quiet:!0},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/manageContexts"},value:[]}],description:"Opens Project Settings on Contexts, the one place a colour scheme or a breakpoint is declared (studio.md §17.1)."},children:[{tagName:"span",textContent:"${state.manageLabel}"}]}]}]},{tagName:"div",attributes:{part:"editor",role:"none"}}]}]};E("styles-variables",wk);function Cz(e,t){Object.assign(e,t),e.headingId=`styles-variables-${t.region.replaceAll(/[^\w-]/g,"-")}`}function Tz(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function xk(e,t,r,o){e.replaceChildren();let a=g({headingId:"",lede:"",manageContexts:r.manageContexts,manageLabel:"",region:"",saving:"",schemes:"",title:""});Cz(a,t);let i=null,s=!1,l=R("styles-variables",a,e,{onNodeCreated:(f,c,d)=>{if(f instanceof HTMLElement&&Tz(d)==="editor")o.editorSlot(f)}}).then((f)=>{if(s){f.dispose();return}i=f});return{attached:()=>{if(s)return!1;let f=i?.root;return f===void 0?!0:e.contains(f)},dispose(){s=!0,i?.dispose(),i=null},ready:l}}var Pz="Variables",Ez="Your site's CSS custom properties, kept in the root style block of project.json. Every page and component can use one in any style value as var(--name).",Nz="Each change here is written to project.json as you make it, so there is nothing to save afterwards. The write also saves any Elements change still waiting for Save, because both live in that file. Undo is the exception: an undone change waits for Save like any other edit.",jz="To give a variable another value in a color scheme or at a breakpoint, use Add override under its row. The schemes and breakpoints themselves are declared in Project settings, under Contexts.";function Rz(e){return{lede:Ez,manageLabel:"Manage contexts…",region:Ln(e,"variables"),saving:Nz,schemes:jz,title:Pz}}var dc=new Map;function Ef(e,t){let r=dc.get(e);return r!==void 0&&r.tabId===t.id&&r.wrap.isConnected&&r.surface.attached()}function ci(e){let t=dc.get(e);if(!t)return;t.scope.stop(),t.surface.dispose(),dc.delete(e)}function Az(){nt("settings.open",{section:"contexts"},"Styles")}function kk(e){if(C&&e.documentPath===an)FC()}function Iz(e,t){if(t?.kind==="group"){yk(e,t.group,{add:t.add});return}Pf(e,t?.name??u.stylebook.variable)}function $k(e){let t=li.value;if(t.served)return!1;return t.served=!0,Iz(e,t.focus),!0}function Sk(e){Gr();try{e()}finally{Kr()}}function Ck(e,t){let{paneId:r,wrap:o}=e;if(Ef(r,t))return;ci(r),kk(t);let a=null,i=xk(o,Rz(r),{manageContexts:Az},{editorSlot:(l)=>{if(a=l,Tf(l),!$k(l)&&u.stylebook.variable!==null)Pf(l,u.stylebook.variable,{reveal:!1})}}),s=me();dc.set(r,{paneId:r,scope:s,surface:i,tabId:t.id,wrap:o}),s.run(()=>{let l=null;te(()=>{let{document:f}=t.doc,c=JSON.stringify([f.style??null,f.$media??null]);if(c===l)return;let d=l===null;l=c;let b=a;if(!d&&b)Sk(()=>{kk(t),Tf(b)})}),te(()=>{li.value;let f=a;if(f)Sk(()=>{$k(f)})})})}var Tk={$schema:"https://jxsuite.com/schema/v1",$id:"StudioAddRepo",$description:"The repository picker: every repository the platform's account link can reach, narrowed by name and account, and — once one is chosen — the folders it holds a project.json in, so a project that lives in a subfolder opens as itself. Two flows share it — Add existing repository, and Open Project on a platform whose projects ARE repositories — so the headline and the primary answer are state rather than text. A `jx-dialog`, so the platform owns modality, Escape, focus restoration and the backdrop. Choosing is two steps now, a repository and then its folder, so the dialog has a confirming button again; a double-click on a row still opens it in one gesture when the folder is unambiguous. Nothing here knows what `not_jx_project` means, which permission counts as write, which folder to preselect or that a Jx-tagged repository sorts first — `new-project/add-repo-modal.ts` keeps the listing, the ordering, the scan and the adoption, and hands over rows that are already strings and booleans.",tagName:"jx-dialog",$props:{headline:{$ref:"#/state/title"},confirmLabel:{$ref:"#/state/confirmLabel"},confirmDisabled:{$ref:"#/state/confirmDisabled"},cancelLabel:"Cancel",size:"xl"},attributes:{part:"add-repo"},onconfirm:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/confirm"},value:[]}]},oncancel:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},onclose:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},style:{$description:"The dialog is wide enough for two panes — the repositories on the left, the chosen repository's projects on the right — and the PANES scroll, never the dialog: `jx-dialog` pins its header and footer and scrolls its body, and this surface turns the body into a column the picker fills, so the filter above the lists, the summary under them and the access footer at the bottom all stay on screen however long a list is. That is what retired the two scrollbars the old picker drew side by side, its own 320px list inside a dialog that also scrolled. Below 40rem the panes stack.",'& > [part="dialog"] > [part="body"]':{$description:"The kit's body scrolls by default; here the picker is the body's only child and does its own scrolling inside two panes, so the body becomes the column it fills.",display:"flex",flexDirection:"column",overflow:"hidden"},'& [part="picker"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-3)",flex:"0 1 30rem",minHeight:"0",containerType:"inline-size",containerName:"add-repo"},'& [part="toolbar"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",flex:"none"},'& [part="filter"]':{flex:"1 1 auto",minWidth:"0"},'& [part="owner"]':{flex:"0 0 12rem"},'& [part="owner-slot"], & [part="list-slot"], & [part="detail-slot"], & [part="locations-slot"], & [part="failure-slot"], & [part="access-slot"], & [part="tag-slot"], & [part="private-slot"]':{display:"contents"},'& [part="panes"]':{display:"grid",gridTemplateColumns:"minmax(0, 1fr) minmax(0, 1fr)",gap:"var(--jx-space-3)",flex:"1 1 auto",minHeight:"0"},'& [part="repos"], & [part="detail"]':{$description:"Each pane is a framed box of its own height that scrolls its own content, so choosing a repository far down the list never scrolls its projects out of view.",display:"flex",flexDirection:"column",minHeight:"0",border:"1px solid var(--border)",borderRadius:"var(--radius)",overflow:"hidden"},'& [part="repo-list"]':{flex:"1 1 auto",minHeight:"0",overflowY:"auto",padding:"var(--jx-space-1)"},'& [part="location-list"]':{margin:"0 calc(-1 * var(--jx-space-2))"},'& [part="detail-body"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-3)",flex:"1 1 auto",minHeight:"0",overflowY:"auto",padding:"var(--jx-space-3)"},'& [part="detail-head"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-1)",flex:"none",minWidth:"0"},'& [part="detail-name"]':{fontWeight:"600",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="detail-meta"]':{fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="folder-row"]':{flex:"none"},'& [part="repo"] [part="description"], & [part="location"] [part="description"]':{$description:"The note gives way before the name does: a repository is found by its name, and a branch or a path cut short is still recognisable where a name cut short is not.",flexShrink:"4"},'& [part="badges"]':{display:"inline-flex",gap:"var(--jx-space-1)"},'& [part="badge"]':{padding:"0 var(--jx-space-2)",border:"1px solid currentColor",borderRadius:"var(--jx-radius-lg)",fontSize:"var(--jx-text-xs)",opacity:"0.8"},'& [part="empty"], & [part="note"]':{margin:"0",padding:"var(--jx-space-4) var(--jx-space-3)",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"},'& [part="note"]':{padding:"0"},'& [part="summary"]':{$description:"What confirming will do, in words: which repository, which folder, which branch. Polite and live, because the arrows in both fields change it without moving focus, and this is how a reader who cannot see the panes hears where they are.",margin:"0",flex:"none",minHeight:"var(--jx-leading-md)",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="install"], & [part="access-link"]':{color:"var(--accent)",textDecoration:"underline"},'& [part="failure"]':{$description:'The refusal from the last adoption, said above the footer the reader is still looking at, because the panes survive it: a folder with no readable project.json is a fact about that folder, and the rest are still on offer. It is `failure` rather than `error` because `jx-textfield` draws a `[part="error"]` of its own inside this same tree.',margin:"0",flex:"none",fontSize:"var(--jx-text-md)",color:"var(--danger)"},'& [part="access"]':{$description:"The listing is bounded by what the Jx Suite GitHub App was granted, so the dialog always offers a way out of that boundary rather than only saying the list is short. `center`, not `baseline`: a small kit button exports no baseline (surface-baseline-rows.test.ts).",display:"flex",flexWrap:"wrap",alignItems:"center",gap:"var(--jx-space-2)",flex:"none",paddingTop:"var(--jx-space-3)",borderTop:"1px solid var(--border)",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="access-note"]':{flex:"1 1 auto"},'& [part="access-links"]':{display:"flex",flexWrap:"wrap",gap:"var(--jx-space-3)"},"@container add-repo (max-width: 40rem)":{'& [part="panes"]':{gridTemplateColumns:"minmax(0, 1fr)",gridTemplateRows:"minmax(0, 1fr) minmax(0, 1fr)"},'& [part="owner"]':{flexBasis:"9rem"}}},children:[{tagName:"div",attributes:{part:"picker"},children:[{tagName:"div",attributes:{part:"toolbar"},children:[{tagName:"jx-textfield",attributes:{part:"filter"},$props:{label:"Filter repositories",placeholder:"Filter repositories…",type:"search",size:"sm",value:{$ref:"#/state/filter"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setFilter"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{ArrowDown:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/move"},value:[1]}],ArrowUp:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/move"},value:[-1]}],Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/confirm"},value:[]}]}}]}},{tagName:"div",attributes:{part:"owner-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasOwners"},cases:{true:{tagName:"jx-select",attributes:{part:"owner"},$props:{label:"Account",size:"sm",options:{$ref:"#/state/owners"},value:{$ref:"#/state/owner"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setOwner"},value:[{$ref:"event#/target/value"}]}]}}}}]},{tagName:"div",attributes:{part:"panes"},children:[{tagName:"section",attributes:{part:"repos","aria-label":"Repositories"},children:[{tagName:"div",attributes:{part:"list-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/listState"},cases:{loading:{tagName:"p",attributes:{part:"empty"},textContent:"Loading repositories…"},"empty-filter":{tagName:"p",attributes:{part:"empty"},textContent:"No repositories match the filter."},"empty-write":{tagName:"p",attributes:{part:"empty"},textContent:"Repositories you can write to are listed here. Widen the Jx Suite GitHub App's repository access below, or ask a repository admin for write access."},"empty-install":{tagName:"p",attributes:{part:"empty"},children:[{tagName:"span",textContent:"Repositories the Jx Suite GitHub App can reach are listed here. "},{tagName:"a",attributes:{part:"install",href:"${state.installUrl}",target:"_blank",rel:"noreferrer"},textContent:"Install the Jx Suite GitHub App"},{tagName:"span",textContent:" to grant repository access, then use Refresh below."}]},"empty-none":{tagName:"p",attributes:{part:"empty"},textContent:"Repositories the Jx Suite GitHub App can reach are listed here. Install the App, or widen its repository access, and try again."},listed:{tagName:"jx-listbox",attributes:{part:"repo-list",id:"add-repo-repos"},$props:{label:"Repositories",active:"${state.activeRepoId}"},onselect:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/select"},value:[{$ref:"event#/detail"}]}],description:"One handler for every row, because a row's `select` bubbles; its detail is the row's value, the repository's full name."},children:[{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/fullName"},map:{tagName:"jx-option",attributes:{part:"repo",id:"${$map.item.id}","data-repo":"${$map.item.fullName}",title:"${$map.item.fullName}"},$props:{value:{$ref:"$map/item/fullName"},label:{$ref:"$map/item/fullName"},description:{$ref:"$map/item/meta"}},ondblclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openRepo"},value:[{$ref:"$map/item/fullName"}]}]},children:[{tagName:"span",attributes:{part:"badges",slot:"end"},children:[{tagName:"span",attributes:{part:"tag-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/isJx"},cases:{true:{tagName:"span",attributes:{part:"badge"},textContent:"Jx"}}},{tagName:"span",attributes:{part:"private-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/isPrivate"},cases:{true:{tagName:"span",attributes:{part:"badge"},textContent:"private"}}}]}]}}]}}}]},{tagName:"section",attributes:{part:"detail","aria-label":"Project"},children:[{tagName:"div",attributes:{part:"detail-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasDetail"},cases:{false:{tagName:"p",attributes:{part:"empty"},textContent:"Choose a repository to see the Jx projects it holds and pick the one to open."},true:{tagName:"div",attributes:{part:"detail-body"},children:[{tagName:"div",attributes:{part:"detail-head"},children:[{tagName:"span",attributes:{part:"detail-name"},textContent:"${state.detailName}"},{tagName:"span",attributes:{part:"detail-meta"},textContent:"${state.detailMeta}"}]},{tagName:"jx-field",attributes:{part:"folder-row"},$props:{span:!0,label:"Project Folder",description:{$ref:"#/state/folderHelp"},invalid:{$ref:"#/state/folderInvalid"}},children:[{tagName:"jx-textfield",attributes:{part:"folder"},$props:{placeholder:"Repository root",size:"sm",mono:!0,value:{$ref:"#/state/folder"},invalid:{$ref:"#/state/folderInvalid"},error:{$ref:"#/state/folderError"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setFolder"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{ArrowDown:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/moveLocation"},value:[1]}],ArrowUp:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/moveLocation"},value:[-1]}],Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/confirm"},value:[]}]}}]}}]},{tagName:"div",attributes:{part:"locations-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/detailState"},cases:{loading:{tagName:"p",attributes:{part:"note"},textContent:"Looking for project.json files…"},listed:{tagName:"jx-listbox",attributes:{part:"location-list",id:"add-repo-locations"},$props:{label:"Projects in this repository",active:"${state.activeLocationId}"},onselect:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/pickLocation"},value:[{$ref:"event#/detail"}]}]},children:[{$prototype:"Array",items:{$ref:"#/state/locations"},key:{$ref:"$map/item/dir"},map:{tagName:"jx-option",attributes:{part:"location",id:"${$map.item.id}","data-dir":"${$map.item.dir}",title:"${$map.item.path}"},$props:{value:{$ref:"$map/item/dir"},label:{$ref:"$map/item/label"},description:{$ref:"$map/item/path"}},ondblclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/confirm"},value:[]}]},children:[{tagName:"jx-icon",attributes:{slot:"icon"},$props:{name:"folder"}}]}}]},empty:{tagName:"p",attributes:{part:"note"},textContent:"No folder in this repository holds a project.json yet. Name one above if it does, or create a new project instead."},unlisted:{tagName:"p",attributes:{part:"note"},textContent:"Name the folder that holds the project's project.json, or leave the field empty to open the repository root."},failed:{tagName:"p",attributes:{part:"note"},textContent:"Studio couldn't list this repository's projects. Name the folder that holds the project.json instead."}}}]}}}]}]},{tagName:"p",attributes:{part:"summary","aria-live":"polite"},textContent:"${state.summary}"},{tagName:"div",attributes:{part:"failure-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasFailure"},cases:{true:{tagName:"p",attributes:{part:"failure"},textContent:"${state.failure}"}}},{tagName:"div",attributes:{part:"access-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasAccess"},cases:{true:{tagName:"div",attributes:{part:"access"},children:[{tagName:"span",attributes:{part:"access-note"},textContent:"Missing a repository? Grant the Jx Suite GitHub App access to more of them:"},{tagName:"span",attributes:{part:"access-links"},children:[{$prototype:"Array",items:{$ref:"#/state/access"},key:{$ref:"$map/item/url"},map:{tagName:"a",attributes:{part:"access-link",href:"${$map.item.url}",target:"_blank",rel:"noreferrer",title:"${$map.item.title}"},textContent:"${$map.item.label}"}}]},{tagName:"jx-button",attributes:{part:"refresh"},$props:{size:"sm",disabled:{$ref:"#/state/refreshDisabled"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/refresh"},value:[]}]},children:[{tagName:"span",textContent:"Refresh"}]}]}}}]}]};E("add-repo",Tk);function Oz(e){return`add-repo-repo-${e}`}function Mz(e){return`add-repo-location-${e}`}function Pk(e){let t=e.rows.map((i,s)=>({...i,id:Oz(s)})),r=e.locations.map((i,s)=>({...i,id:Mz(s)})),o=t.find((i)=>i.fullName===e.selected),a=e.folderError===""?r.find((i)=>i.dir===e.chosenFolder):void 0;return{...e,activeLocationId:a?.id??"",activeRepoId:o?.id??"",confirmDisabled:!e.canConfirm,folderInvalid:e.folderError!=="",hasAccess:e.access.length>0,hasDetail:e.detailState!=="none",hasFailure:e.failure!=="",hasOwners:e.owners.length>0,listState:e.loading?"loading":t.length>0?"listed":`empty-${e.emptyState}`,locations:r,refreshDisabled:e.loading||e.busy,rows:t}}function Ek(e){let t=document.createElement("div");t.style.pointerEvents="auto",t.setAttribute(Ve,vt("dialog","add-repo")),e.layer.append(t);let r=!1,o=()=>{if(r)return;r=!0,e.onClosed()},a=()=>r,i=g({...Pk(e.view),closed:o,confirm:()=>{e.onConfirm()},move:(f)=>{e.onMove(f)},moveLocation:(f)=>{e.onMoveLocation(f)},openRepo:(f)=>{e.onOpenRepo(f)},pickLocation:(f)=>{e.onLocation(f)},refresh:()=>{e.onRefresh()},select:(f)=>{e.onSelect(f)},setFilter:(f)=>{i.filter=f,e.onFilter(f)},setFolder:(f)=>{i.folder=f,e.onFolder(f)},setOwner:(f)=>{i.owner=f,e.onOwner(f)}}),s=null,l=R("add-repo",i,t).then(async(f)=>{s=f;let c=f.root;if(a())return f.dispose(),c;if(await sn(c),a())return c;Jt(c);let d=c.querySelector('[part="filter"]');if(d)m1(d);return c});return{close(){let f=s?.root;if(f instanceof HTMLElement)Ut(f);s?.dispose(),s=null,t.remove(),o()},host:t,ready:l,update(f){Object.assign(i,Pk(f))}}}var Dz=250,Lt=null,Go="add",Kt=null,mi="",Ko="",ot="",Ot="",In=!1,gi="",kt=new Map,di=null,ui="",Mt="",Gt=!1,Nf=null;function jf(){let e=p();return Q(e.listRepos)&&Q(e.importProject)}function Rk(){return p().openProjectPicker==="repo-list"&&jf()}function Ak(){return Lk("add")}function Ik(){return Lk("open")}function Lk(e){if(Lt)return Promise.resolve(null);return Go=e,Kt=null,mi="",Ko="",ot="",Ot="",In=!1,gi="",kt=new Map,Mt="",Gt=!1,new Promise((t)=>{Nf=t,Lt=Ek({layer:dt("dialog"),onClosed:()=>{Ok(null)},onConfirm:()=>{If()},onFilter:(r)=>{mi=r,gt()},onFolder:(r)=>{Ot=r,In=!0,Mt="",gt()},onLocation:(r)=>{Ot=r,In=!0,Mt="",gt()},onMove:(r)=>{Fz(r)},onMoveLocation:(r)=>{zz(r)},onOpenRepo:(r)=>{Hz(r)},onOwner:(r)=>{Ko=r,gt()},onRefresh:()=>{Nk()},onSelect:(r)=>{pc(r,"now")},view:Vk()}),Nk()})}function Nk(){Kt=null,Mt="",Af(),kt=new Map,gt(),Hd().then(gt),p().listRepos?.().then((e)=>{if(Kt=e,ot)Fk(ot,"now")}).catch((e)=>{Kt=[],Mt=X(e)}).finally(()=>{gt()})}function gt(){Lt?.update(Vk())}function Ok(e){let t=Lt,r=Nf;Lt=null,Nf=null,Gt=!1,Af(),r?.(e),t?.close()}function Mk(){let e=Kt??[];if(Go!=="open")return e;let t=e.filter((r)=>r.permission==="admin"||r.permission==="write");return[...t.filter((r)=>r.isJxProject),...t.filter((r)=>!r.isJxProject)]}function Rf(){let e=mi.trim().toLowerCase(),t=Mk().filter((r)=>!Ko||r.owner===Ko);return e?t.filter((r)=>r.fullName.toLowerCase().includes(e)):t}function Dk(){return ot?(Kt??[]).find((e)=>e.fullName===ot):void 0}function pc(e,t){if(e===ot||Gt)return;ot=e,Ot="",In=!1,gi="",Mt="",Fk(e,t),gt()}function Fz(e){let t=Rf();if(t.length===0)return;let r=t.findIndex((i)=>i.fullName===ot),o=r===-1?e>0?0:t.length-1:Math.min(t.length-1,Math.max(0,r+e)),a=t[o];if(a)pc(a.fullName,"soon")}function _z(){let e=kt.get(ot);return e?.status==="done"?e.projects.locations:[]}function zz(e){let t=_z();if(t.length===0)return;let r=Bl(Ot),o=t.findIndex((s)=>s.dir===r),a=o===-1?e>0?0:t.length-1:(o+e+t.length)%t.length,i=t[a];if(i)Ot=i.dir,In=!0,Mt="",gt()}function Fk(e,t){let r=p(),o=(Kt??[]).find((i)=>i.fullName===e);if(!r.listRepoProjects||!o)return;let a=kt.get(e);if(a){if(a.status==="done")_k(e);return}if(Af(),kt.set(e,{status:"loading"}),t==="now"){jk(o);return}ui=e,di=setTimeout(()=>{di=null,ui="",jk(o)},Dz)}function Af(){if(di===null)return;if(clearTimeout(di),di=null,ui)kt.delete(ui),ui=""}async function jk(e){let t=Lt,r;try{r={projects:await p().listRepoProjects({name:e.name,owner:e.owner}),status:"done"}}catch(o){r={message:X(o),status:"failed"}}if(Lt!==t||kt.get(e.fullName)?.status!=="loading")return;if(kt.set(e.fullName,r),e.fullName===ot){if(_k(e.fullName),gi===e.fullName){if(gi="",r.status==="done"&&r.projects.locations.length===1){If();return}}}gt()}function _k(e){let t=kt.get(e);if(In||e!==ot||t?.status!=="done")return;let{locations:r}=t.projects;Ot=(r.find((o)=>o.dir==="")??r[0])?.dir??""}function Hz(e){pc(e,"now");let t=kt.get(e);if(t?.status==="loading"){gi=e;return}if(t?.status==="done"&&t.projects.locations.length>1&&!In)return;If()}function zk(){return Bl(Ot)===null?"A project folder is a path inside the repository, without . or .. segments.":""}function Hk(){let e=Dk();if(!e||Gt||zk()!=="")return!1;let t=kt.get(e.fullName);if(In||!t)return!0;return t.status==="failed"||t.status==="done"&&(t.projects.locations.length>0||t.projects.truncated)}function If(){if(!ot){let[e]=Rf();if(e)pc(e.fullName,"now");return}if(!Hk())return;Bk(ot,Bl(Ot)??"")}async function Bk(e,t,r=!1){let o=(Kt??[]).find((i)=>i.fullName===e);if(!o||Gt&&!r)return;let a=Lt;Gt=!0,Mt="",gt();try{let i={name:o.name,owner:o.owner},s=await p().importProject?.(t?{...i,dir:t}:i);if(Lt!==a)return;if(s){Ok(s);return}Mt="This platform cannot import repositories."}catch(i){if(Lt!==a)return;if(Mt=X(i),Gt=!1,gt(),!r&&await Am(i)&&Lt===a)await Bk(e,t,!0);return}Gt=!1,gt()}function Bz(e){return{fullName:e.fullName,isJx:e.isJxProject,isPrivate:e.private,meta:e.defaultBranch}}function Vz(e,t){let r=e.dir.slice(e.dir.lastIndexOf("/")+1);return{dir:e.dir,label:e.name??(e.dir?r:t.name),path:e.dir?`${e.dir}/`:"/"}}function Wz(){if(mi||Ko)return"filter";if(Go==="open"&&(Kt??[]).length>0)return"write";return oC()?"install":"none"}function qz(){let e=[...new Set(Mk().map((t)=>t.owner))].toSorted((t,r)=>t.localeCompare(r));if(e.length<2)return[];return[{label:"All accounts",value:""},...e.map((t)=>({label:t,value:t}))]}function Uz(){let e=dA();if(!e)return[];return[...e.manage.map((t)=>({label:t.account,title:`Manage repository access for ${t.account}`,url:t.url})),...e.installUrl?[{label:"Another account…",title:"Install the Jx Suite GitHub App on another account",url:e.installUrl}]:[]]}function Jz(e){if(!e)return{branch:"",detailMeta:"",detailName:"",detailState:"none",folderHelp:"",locations:[]};let t=kt.get(e.fullName),r=t?.status==="done"?t.projects.branch:e.defaultBranch,o=[],a={branch:r,detailMeta:[r,e.permission,...e.private?["private"]:[]].join(" · "),detailName:e.fullName,folderHelp:"The folder that holds project.json. Leave it empty for the repository root.",locations:o};if(!p().listRepoProjects)return{...a,detailState:"unlisted"};if(!t||t.status==="loading")return{...a,detailState:"loading"};if(t.status==="failed")return{...a,detailState:"failed"};let{locations:i,truncated:s}=t.projects,l={...a,detailState:i.length>0?"listed":"empty",locations:i.map((f)=>Vz(f,e))};if(s)l.folderHelp="This repository is too large to scan in full. Name the folder if its project isn't listed.";return l}function Vk(){let e=Dk(),{branch:t,...r}=Jz(e),o=zk(),a=Bl(Ot)??"",i=Go==="open"?"Open":"Add";return{...r,access:Uz(),busy:Gt,canConfirm:Hk(),confirmLabel:Gt?Go==="open"?"Opening…":"Adding…":i,emptyState:Wz(),failure:Mt,chosenFolder:a,filter:mi,folder:Ot,folderError:o,installUrl:iC()?.appInstallUrl??"",loading:Kt===null,owner:Ko,owners:qz(),rows:Rf().map((s)=>Bz(s)),selected:ot,summary:e&&o===""?`${i}s ${e.fullName} ${a?`at ${a}/`:"at the repository root"}${t?` on ${t}`:""}.`:"",title:Go==="open"?"Open Project":"Add existing repository"}}var Wk={$schema:"https://jxsuite.com/schema/v1",$id:"StudioWelcome",$description:"The Start pane, shown when no project is loaded and no document is open. The adapter hands in the start actions, whether the GitHub App still needs installing, the platform's own notices with the actions each offers, the recent projects with their distinguishing folders and last-opened labels, and the platform's catalogue; the document draws them in the order a first run needs them.",tagName:"div",attributes:{part:"screen"},style:{width:"100%",height:"100%",display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"10vh",overflowY:"auto",boxSizing:"border-box",fontFamily:"var(--jx-font-sans)",color:"var(--jx-fg)",'& > [part="content"]':{maxWidth:"560px",width:"100%",padding:"0 var(--jx-space-6) var(--jx-space-7)",boxSizing:"border-box"},'& [part="title"]':{fontSize:"28px",fontWeight:"300",letterSpacing:"-0.5px",margin:"0",color:"var(--jx-fg)"},'& [part="subtitle"]':{fontSize:"var(--jx-text-lg)",color:"var(--jx-fg-dim)",margin:"2px 0 0"},'& [part="section"]':{marginTop:"28px"},'& [part="section-title"]':{fontSize:"var(--jx-text-md)",fontWeight:"600",color:"var(--jx-fg)",margin:"0 0 var(--jx-space-3)",textTransform:"uppercase",letterSpacing:"0.3px"},'& [part="section-header"]':{$description:"`center`, not `baseline`: `Clear all` is a small kit button, and a small kit control is layout-contained so its outset hit area adds nothing to a scrolling ancestor's overflow, which leaves it with no baseline to export. A baseline row synthesised one from the button's bottom edge, which stood the header 33px tall with the title 10px under the button's label. The gap under the header is the HEADER's, because centring aligns MARGIN boxes: while the h2 kept its own 8px block-end margin its margin box was 26px, exactly the header's height, so `center` had nothing to move and left the h2 flush at the top with the button centred 3.6px below its baseline — a fix that measured right and still looked wrong. With the margin moved out, the two boxes are the only things in the line and they centre on each other.",display:"flex",alignItems:"center",justifyContent:"space-between",gap:"var(--jx-space-4)",marginBottom:"var(--jx-space-3)"},'& [part="section-header"] [part="section-title"]':{marginBlockEnd:"0"},'& [part="actions"]':{display:"flex",flexDirection:"column",alignItems:"stretch",gap:"2px"},'& [part="actions"] jx-button > [part="control"]':{justifyContent:"flex-start",textAlign:"left",color:"var(--jx-accent)"},'& [part="link"]':{display:"inline-flex",alignItems:"center",gap:"var(--jx-space-2)",minHeight:"var(--jx-control-h)",padding:"0 var(--jx-space-3)",borderRadius:"var(--jx-radius-sm)",color:"var(--jx-accent)",textDecoration:"none",":hover":{background:"var(--jx-hover-bg)"},":focus-visible":{outline:"var(--jx-focus-ring)",outlineOffset:"2px"}},'& [part="note"]':{margin:"var(--jx-space-2) var(--jx-space-3) 0",fontSize:"var(--jx-text-md)",color:"var(--jx-fg-dim)"},'& [part="list"]':{listStyle:"none",margin:"0",padding:"0"},'& [part="row"]':{display:"flex",alignItems:"center"},'& [part="recent"]':{flex:"1",minWidth:"0",display:"grid",gridTemplateColumns:"auto 1fr auto",alignItems:"baseline",gap:"var(--jx-space-4)",padding:"5px var(--jx-space-3)",margin:"0",background:"none",border:"none",borderRadius:"var(--jx-radius-sm)",font:"inherit",fontSize:"var(--jx-text-lg)",color:"var(--jx-fg)",cursor:"pointer",textAlign:"left",":hover":{background:"var(--jx-hover-bg)"},":focus-visible":{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"}},'& [part="name"]':{color:"var(--jx-accent)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="path"]':{color:"var(--jx-fg-dim)",fontSize:"var(--jx-text-md)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="when"]':{color:"var(--jx-fg-dim)",fontSize:"var(--jx-text-md)",whiteSpace:"nowrap"},'& [part="remove"]':{flexShrink:"0",opacity:"0"},'& [part="row"]:hover [part="remove"], & [part="remove"]:focus-within':{opacity:"1"}},children:[{tagName:"div",attributes:{part:"content"},children:[{tagName:"h1",attributes:{part:"title"},textContent:"Jx Studio"},{tagName:"p",attributes:{part:"subtitle"},textContent:"Design, build, and publish websites"},{tagName:"section",attributes:{part:"section"},children:[{tagName:"h2",attributes:{part:"section-title"},textContent:"Start"},{tagName:"div",attributes:{part:"actions"},children:[{$prototype:"Array",items:{$ref:"#/state/actions"},key:{$ref:"$map/item/id"},map:{tagName:"jx-button",$props:{quiet:!0},attributes:{part:"action","data-action":"${$map.item.id}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/run"},value:[{$ref:"$map/item/id"}]}]},children:[{tagName:"jx-icon",attributes:{slot:"icon"},$props:{name:{$ref:"$map/item/icon"}}},{tagName:"span",textContent:"${$map.item.title}"}]}}]}]},{tagName:"div",attributes:{part:"install-slot"},style:{display:"contents"},$switch:{$ref:"#/state/installNeeded"},cases:{true:{tagName:"section",attributes:{part:"section"},children:[{tagName:"h2",attributes:{part:"section-title"},textContent:"Repository access"},{tagName:"div",attributes:{part:"actions"},children:[{tagName:"a",attributes:{part:"link",href:"${state.installUrl}",target:"_blank",rel:"noreferrer"},children:[{tagName:"jx-icon",$props:{name:"link"}},{tagName:"span",textContent:"Install the Jx Suite GitHub App"}]}]},{tagName:"p",attributes:{part:"note"},textContent:"Grants repository access so you can create and open projects — choose “All repositories”."}]}}},{$prototype:"Array",items:{$ref:"#/state/notices"},key:{$ref:"$map/item/id"},map:{tagName:"section",attributes:{part:"section","data-section":"notice","data-notice":"${$map.item.id}","data-level":"${$map.item.level}"},children:[{tagName:"h2",attributes:{part:"section-title"},textContent:"${$map.item.title}"},{tagName:"p",attributes:{part:"note"},textContent:"${$map.item.message}"},{tagName:"div",attributes:{part:"actions"},children:[{$prototype:"Array",items:{$ref:"$map/item/actions"},key:{$ref:"$map/item/key"},map:{tagName:"jx-button",$props:{variant:{$ref:"$map/item/variant"}},attributes:{part:"notice-action","data-action":"${$map.item.key}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/noticeRun"},value:[{$ref:"$map/item/key"}]}]},children:[{tagName:"span",textContent:"${$map.item.label}"}]}}]}]}},{tagName:"div",attributes:{part:"recent-slot"},style:{display:"contents"},$switch:{$ref:"#/state/hasRecent"},cases:{true:{tagName:"section",attributes:{part:"section"},children:[{tagName:"div",attributes:{part:"section-header"},children:[{tagName:"h2",attributes:{part:"section-title"},textContent:"Recent"},{tagName:"jx-button",$props:{quiet:!0,size:"sm"},attributes:{part:"clear"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/clear"}}]},children:[{tagName:"span",textContent:"Clear all"}]}]},{tagName:"ul",attributes:{part:"list"},children:[{$prototype:"Array",items:{$ref:"#/state/recent"},key:{$ref:"$map/item/root"},map:{tagName:"li",attributes:{part:"row"},children:[{tagName:"button",attributes:{part:"recent",type:"button",title:"${$map.item.root}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/open"},value:[{$ref:"$map/item/root"}]}]},children:[{tagName:"span",attributes:{part:"name"},textContent:"${$map.item.name}"},{tagName:"span",attributes:{part:"path"},textContent:"${$map.item.location}"},{tagName:"span",attributes:{part:"when"},textContent:"${$map.item.when}"}]},{tagName:"jx-action-button",$props:{icon:"x",size:"sm",label:"Remove ${$map.item.name} from Recent",hint:"Remove ${$map.item.name} from Recent"},attributes:{part:"remove"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/remove"},value:[{$ref:"$map/item/root"}]}]}}]}}]}]}}},{tagName:"div",attributes:{part:"catalogue-slot"},style:{display:"contents"},$switch:{$ref:"#/state/hasCatalogue"},cases:{true:{tagName:"section",attributes:{part:"section"},children:[{tagName:"h2",attributes:{part:"section-title"},textContent:"Projects"},{tagName:"ul",attributes:{part:"list"},children:[{$prototype:"Array",items:{$ref:"#/state/catalogue"},key:{$ref:"$map/item/root"},map:{tagName:"li",attributes:{part:"row"},children:[{tagName:"button",attributes:{part:"recent","data-catalogue":"",type:"button",title:"${$map.item.root}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/open"},value:[{$ref:"$map/item/root"}]}]},children:[{tagName:"span",attributes:{part:"name"},textContent:"${$map.item.name}"},{tagName:"span",attributes:{part:"path"},textContent:"${$map.item.detail}"}]}]}}]}]}}}]}]};E("welcome",Wk);var Yo=null;function Kk(e){Yo=e}function Of(e){let t=/^\/(?:home|Users)\/[^/]+(?=\/|$)/.exec(e);return t?`~${e.slice(t[0].length)}`:e}function Yk(e){return Of(e).split("/").filter(Boolean).slice(0,-1)}function qk(e,t){let r=Yk(e);if(r.length===0)return Of(e);let o=r.slice(Math.max(0,r.length-t));if(o.length<r.length)return`…/${o.join("/")}`;return o[0]==="~"||!e.startsWith("/")?o.join("/"):`/${o.join("/")}`}function Uk(e){let t=new Map;for(let o of e){let a=t.get(o.name);if(a)a.push(o);else t.set(o.name,[o])}let r=new Map;for(let o of t.values()){let a=Math.max(...o.map((s)=>Yk(s.root).length),1),i=o.map((s)=>qk(s.root,a));for(let s=1;s<=a;s++){let l=o.map((f)=>qk(f.root,s));if(new Set(l).size===o.length){i=l;break}}if(new Set(i).size!==o.length)i=o.map((s)=>Of(s.root));for(let[s,l]of o.entries())r.set(l.root,i[s])}return r}var Lf=60*rf,Jk=24*Lf;function Kz(e,t=ar()){let r=Math.max(0,t-e);if(r<rf)return"just now";if(r<Lf){let i=Math.floor(r/rf);return`${i} minute${i===1?"":"s"} ago`}if(r<Jk){let i=Math.floor(r/Lf);return`${i} hour${i===1?"":"s"} ago`}let o=Math.floor(r/Jk);if(o===1)return"yesterday";if(o<30)return`${o} days ago`;let a=Math.floor(o/30);return a<12?`${a} month${a===1?"":"s"} ago`:"over a year ago"}var Gk=null,uc=null,bi=null,Mr=null;function Yz(){let e=Nw(),t=YN().filter((i)=>!e.some((s)=>s.root===i.root)),r=Uk(e),o=Uk(t);return{actions:[{icon:"plus",id:"new",title:"New Project…"},...cf(p())?[{icon:"folder-open",id:"open",title:"Open Project…"}]:[],...Pb()?[{icon:"download-simple",id:"clone",title:"Clone Git Repository…"}]:[],...jf()?[{icon:"cube",id:"add",title:"Add Existing Repository…"}]:[]],catalogue:t.map((i)=>({detail:i.description??o.get(i.root)??i.root,name:i.name,root:i.root})),hasCatalogue:t.length>0,hasRecent:e.length>0,installNeeded:oC(),installUrl:iC()?.appInstallUrl??"#",notices:AL().map((i)=>Xz(i)),recent:e.map((i)=>({location:r.get(i.root)??i.root,name:i.name,root:i.root,when:Kz(i.timestamp)}))}}function Xz(e){return{actions:(e.actions??[]).map((t)=>({key:`${e.id}/${t.id}`,label:t.label,variant:t.primary?"accent":"secondary"})),id:e.id,level:e.level??"info",message:e.message,title:e.title}}function Qz(e){for(let t of AL())for(let r of t.actions??[])if(`${t.id}/${r.id}`===e)return r;return null}function Xk(){return Gk??=g({actions:[],catalogue:[],clear:()=>{NN(),mc()},hasCatalogue:!1,hasRecent:!1,installNeeded:!1,installUrl:"#",noticeRun:(e)=>{let t=Qz(e);if(t)ox(t).then(mc)},notices:[],open:(e)=>{Yo?.openRecentProject(e)},recent:[],remove:(e)=>{RS(e),mc()},run:(e)=>{switch(e){case"new":{Yo?.openNewProject();break}case"open":{Yo?.openProject();break}case"clone":{Yo?.cloneRepository();break}case"add":{Yo?.addExistingRepo();break}default:break}}}),Gk}function mc(){Object.assign(Xk(),Yz())}function Qk(e){if(mc(),uc===e&&Mr!==null&&Mr.root.isConnected)return;if(bi&&uc===e&&!Mr)return;Zz(),uc=e;let r=R("welcome",Xk(),e);bi=r,r.then((o)=>{if(bi===r)Mr=o;else o.dispose()})}function Zz(){let e=bi;if(bi=null,Mr)Mr.dispose(),Mr=null;else if(e)e.then((t)=>t.dispose());uc=null}var Zk={$schema:"https://jxsuite.com/schema/v1",$id:"StudioWritingBanner",$description:"The writing-mode banner (specs/studio.md §22.5): one slim line above the canvas while a collection entry is written inside its template's layout, saying what the arrangement is (the text and media are editable, the layout is locked) with the door to the template, which opens it in Design. `content/writing-banner.ts` decides whether there is a template to open and what it is called; this document draws a sentence and, when there is one, the button.",tagName:"div",attributes:{part:"banner",role:"note","data-jx-region":"${state.region}"},style:{$description:"A quiet band, the Content-Entry board's: the canvas is the subject, so the banner is a tinted line rather than a panel, and its action is a quiet button.",display:"flex",alignItems:"center",flexWrap:"wrap",gap:"var(--jx-space-2)",padding:"var(--jx-space-1) var(--jx-space-4)",background:"color-mix(in srgb, var(--accent) 10%, var(--bg-panel))",borderBottom:"1px solid var(--border)",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)",'& [part="glyph"]':{flexShrink:"0",color:"var(--accent)"},'& [part="text"]':{flex:"1",minWidth:"0"},'& [part="action-slot"]':{display:"contents"}},children:[{tagName:"jx-icon",attributes:{part:"glyph"},$props:{name:"lock-simple"}},{tagName:"span",attributes:{part:"text"},textContent:"${state.text}"},{tagName:"div",attributes:{part:"action-slot",role:"none"},$switch:{$ref:"#/state/actionState"},cases:{shown:{tagName:"jx-action-button",attributes:{part:"edit-template"},$props:{size:"sm",quiet:!0},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openTemplate"},value:[]}],description:"Opening the template is activating it, which enters Design (studio.md §22.1)."},children:[{tagName:"span",textContent:"${state.actionLabel}"}]}}}]};E("writing-banner",Zk);function a$(e,t,r){let o=g({...t,...r}),a=null,i=!1,s=R("writing-banner",o,e).then((l)=>{if(i)l.dispose();else a=l;return l});return{dispose(){i=!0,a?.dispose(),a=null},ready:s,update(l){o.region=l.region,o.text=l.text,o.actionLabel=l.actionLabel,o.actionState=l.actionState}}}var s$="Writing mode: text and media are editable, the layout is locked";function l$(e){let t=Gn(e.documentPath);if(!t)return null;let r=Ql(t.name)?.item??"entry",o=sh(t.name,zc(e.documentPath));if(o)return{actionLabel:`Design the ${r} page`,path:o.path};let a=e.doc.document.$layout??e.doc.content.frontmatter.$layout,i=vC(n(a)||a===!1?a:void 0,o??null);if(!i)return null;return{actionLabel:`Edit the ${qb(i)} template in Design`,path:i.replace(/^\.\//,"")}}function d$(e,t){let r=l$(t);return{actionLabel:r?.actionLabel??"",actionState:r?"shown":"hidden",region:Ln(e,"writing-banner"),text:s$}}var Dr=new Map,Mf=null;async function tH(e){let t=Dr.get(e)?.tabId,r=t?m.tabs.get(t):void 0,o=r?l$(r):null;if(!o)return;let{openFileInTab:a}=await (ce("zrqtgt41"),import("./chunks/files-zrqtgt41.js"));await a(o.path)}function nH(){for(let[e,t]of Dr){let r=t.tabId?m.tabs.get(t.tabId):void 0;if(r)t.handle.update(d$(e,r))}}function Df(e,t){let r=Dr.get(e);if(r?.host===t)return;if(r)r.handle.dispose(),Dr.delete(e);if(!t)return;Mf??=Ap(nH);let o=a$(t,{actionLabel:"",actionState:"hidden",region:Ln(e,"writing-banner"),text:s$},{openTemplate:()=>{tH(e)}});Dr.set(e,{handle:o,host:t,tabId:null})}function S$(e,t){let r=Dr.get(e);if(!r)return;r.tabId=t.id,r.handle.update(d$(e,t))}function yi(e){Df(e,null)}function P$(){for(let e of Dr.keys())yi(e);Mf?.(),Mf=null}var E$={$schema:"https://jxsuite.com/schema/v1",$id:"StudioCanvasStage",$description:'The canvas\'s own chrome: the artboards, the boxes around them, and the empty hosts the islands attach to. `canvas/canvas-render.ts` keeps every decision — which mode this pane is in, which breakpoints the document declares, how wide Edit\'s column is, whether a comparison has a visual half — and `canvas/canvas-utils.ts` keeps the geometry; this document owns the markup and the style, and it draws NOTHING it decides for itself.\n\n**Every island stays an island** (studio-ui-guidelines.md §9.4). Monaco gets `[part="source-editor"]` or `[part="diff-code-editor"]`, the artboard\'s iframe gets `[part="panel-canvas"]`, the writing-mode banner gets `[part="writing-banner"]`, the Compare bar gets `[part="diff-toolbar"]` and the Project Styles bar gets `[part="chrome-host"]` — each drawn empty and announced through `onNodeCreated`, one reconcile step before it is in the page.\n\n**Three of the five frames share one artboard vocabulary**, which is why `framePart` and `innerPart` are bound rather than written: Preview, the pan/zoom surface and Edit\'s column are all "a box holding N artboards", differing only in what the box is and what else stands in it. Writing the artboard three times would be three places for a breakpoint\'s viewport to drift.\n\n**The stage draws no box of its own.** Its root is `display: contents`, so the frame and whatever leads it are the flex items of the pane\'s own stage cell — the axis `canvas-render.ts` sets on that cell still reaches them, and no depth was added between the stage and the artboards for the pan maths to have to account for.',tagName:"div",attributes:{part:"stage"},style:{$description:"`styles/canvas.css`'s `.panzoom-wrap`, `.canvas-panel*`, `.source-*`, `.content-edit-*`, `.edit-width-handle`, `.preview-stage` and `.diff-code-*` rules, keyed on `part`, plus the writing-mode banner's host. One selector reaches FOREIGN DOM and says so where it stands: `.is-resizing` is written by `canvas/edit-width-drag.ts` onto the column this document draws — the same shape `grid-panel.json` uses for Tabulator's theme. The width handles are `jx-split` elements, which paint their own hover, drag and focus states; this sheet says only where they stand and how wide they are.",display:"contents",'& [part="panzoom"]':{$description:"The transformed surface. `applyTransform` writes `transform` on it imperatively, so only the origin is declared here. `--boards-inset` is the Project Styles bar's clearance: that bar floats over the stage, so the boards start below it. It is a MARGIN, not padding: padding sits inside the box the transform scales, so at a 25% fit a 40px clearance drew as 10px and the bar covered the first specimen. A margin is outside the transform and stays 40 screen pixels at every zoom, and `applyGeometricFit` subtracts the same length from the height it fits into.",display:"inline-flex",gap:"24px",alignItems:"flex-start",transformOrigin:"0 0",marginBlock:"auto",marginTop:"var(--boards-inset, auto)"},'& [part="chrome-host"]':{$description:"The Project Styles bar's host generates no box. The bar inside it is absolutely positioned over the stage, but an empty host in flow is a flex item of the stage cell, whose `gap` then pushed the artboards 24px right of where the fit arithmetic put them, so the last board ran off the pane's edge.",display:"contents"},'& [part="panel"]':{flexShrink:"0"},'& [part="panel"][data-full-width]':{minWidth:"0"},'& [part="panel-header"]':{$description:"The breakpoint's name over its board, and a click target: it sets the pane's active breakpoint. `data-active` is written by `updateActivePanelHeaders` rather than bound, because the answer is a fact about the pane's session that changes without the stage being rebuilt — the same reason the pan transform is written rather than bound.",padding:"4px var(--jx-space-2)",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)",background:"var(--bg-panel)",border:"1px solid var(--border)",borderBottom:"none",borderRadius:"var(--radius) var(--radius) 0 0",textAlign:"center",cursor:"pointer",userSelect:"none",fontFamily:"var(--font-mono)"},'& [part="panel-header"][data-active]':{color:"var(--accent)",borderColor:"var(--accent)"},'& [part="panel-viewport"]':{$description:"The white page surface. `color-scheme: light` is pinned whatever the chrome theme is: the author's document renders against paper, and native form controls and scrollbars inside it must match that rather than the editor around it. The background is the `white` KEYWORD and not a token, for the same reason: it was `var(--spectrum-white, #fff)`, which resolved to white inside `<sp-theme>` and to its fallback everywhere else, so a token was never what it meant. A themed token here would put the editor's ground under the author's page in the dark chrome. The width is a variable so the one declaration serves a board with a declared breakpoint and one without.",position:"relative",width:"var(--panel-viewport-w, auto)",background:"white",border:"1px solid var(--border)",colorScheme:"light"},'& [part="panel-header"][data-active] + [part="panel-viewport"]':{borderColor:"var(--accent)"},'& [part="panel-canvas"]':{$description:"The iframe's host. `isolation: isolate` keeps the artboard's own stacking context off the chrome's. `applyEditZoom` writes `width` and `transform` here imperatively for the content zoom, and an inline write beats this declaration by construction.",isolation:"isolate",width:"var(--panel-canvas-w, auto)"},'& [part="panel-canvas"] *':{cursor:"default"},'& [part="source-wrap"]':{$description:"`width`, `flex` and `min-width` are all three load-bearing, and their absence is a bug only a browser could show: the stage is a flex container, so a child with no width and no grow collapses to its CONTENT width — and Monaco's internals are absolutely positioned, so they contribute none.",display:"flex",flexDirection:"column",width:"100%",height:"100%",flex:"1",minWidth:"0"},'& [part="source-editor"]':{flex:"1",minHeight:"0"},'& [part="diff-code-wrap"]':{$description:"The Code half of a comparison: one Monaco diff editor filling the stage, no artboards and no pan/zoom. It follows the CHROME theme rather than the canvas ramp, because a code editor is chrome. The top inset is the floating bar's clearance. Same three load-bearing declarations as `source-wrap`, for the same reason.",display:"flex",flexDirection:"column",width:"100%",height:"100%",flex:"1",minWidth:"0",paddingTop:"40px"},'& [part="diff-code-editor"]':{flex:"1",minWidth:"0",minHeight:"0"},'& [part="diff-toolbar"]':{$description:"Absolutely positioned OVER the stage rather than in flow: the artboards live on a pan/zoom surface whose origin the transform maths depends on, and a flow sibling would move it. The bar itself is `surfaces/diff-toolbar.json`, mounted into this box.",position:"absolute",zIndex:"2",top:"var(--jx-space-2)",left:"50%",transform:"translateX(-50%)"},'& [part="edit-canvas"]':{$description:"The side gutter is LOAD-BEARING, not breathing room: the resize handles hang outside the column's own box — flex siblings with a negative margin, so they take no width from it — and this container clips horizontally, so without it the handles would be unreachable at exactly the width where dragging inward matters most. It must stay at least as wide as `EDIT_CANVAS_GUTTER` in `canvas/edit-width.ts`, which is what the drag's own ceiling subtracts. This box is also the TRACK the two `jx-split`s measure: the first ancestor of a handle that generates a box, which is why the handles are drawn here beside the column rather than inside it — inside, the column would have been the track, and the track cannot be the thing being resized.",width:"100%",height:"100%",overflowY:"auto",overflowX:"hidden",display:"flex",justifyContent:"center",padding:"32px 16px"},'& [part="edit-column"]':{$description:"The page's column. `max-width` is written imperatively after the render and never bound — see the note on the width in `canvas-render.ts`. `position: relative` is for the live readout drawn as its `::after` while a drag is on.",width:"100%",minHeight:"100%",position:"relative"},'& [part="edit-column"][data-hug]':{$description:"A content PAGE fills the viewport, a document-like surface you can click into below the text. A component DEFINITION is a fragment — flooring its column to the viewport and letting the flex parent stretch it leaves dead scrollable space below a short component — so it hugs its iframe and sits at the top.",minHeight:"0",alignSelf:"flex-start"},'& [part="edit-column"] [part="panel"][data-full-width]':{flex:"1",minWidth:"0"},'& [part="edit-column"] [part="panel-viewport"]':{border:"none",background:"transparent"},'& [part="edit-column"].is-resizing::after':{$description:"FOREIGN CLASS: `canvas/edit-width-drag.ts` writes `is-resizing` and `data-edit-width` on the column with the same bare style pass that moves it, so the live readout costs no element and no render.",content:"attr(data-edit-width)",position:"absolute",top:"var(--jx-space-2)",left:"50%",transform:"translateX(-50%)",zIndex:"3",padding:"2px var(--jx-space-2)",borderRadius:"10px",background:"var(--accent)",color:"var(--bg-panel)",fontSize:"var(--jx-text-sm)",fontVariantNumeric:"tabular-nums",pointerEvents:"none"},'& [part="edit-handle"]':{$description:"The two `jx-split`s (ui.md §5.5), one on each side of the column and dragged symmetrically about its centre. They are flex SIBLINGS of the column in the canvas's row, and each pulls itself outside the column with a negative margin on its outer side so its margin box is zero wide: the column keeps the full content width and the handle's 9px strip stands in the gutter, exactly where the absolutely positioned div it replaces stood. Stretched to the row, so the grab target is the canvas's height whatever the column's — which is the same height the old `top: 0; bottom: 0` resolved to, the column being a stretched item itself. Invisible at rest as it has always been: the element's own `--jx-border` bar beside the page would be new chrome. The weight is the substance, and a browser found it: the element's rules are `[data-jx]` (0,1,0) and its hover `[data-jx]:hover` (0,2,0), which is exactly what this document's `[data-jx] [part]` rules weigh — so `background: transparent` here TIED the element's accent on hover and won on source order, and the handle lit to half opacity of nothing. The lit look is restated below one attribute heavier, the same move `styles/shell-frame.json` makes for the docks. Physical `margin-left`/`margin-right` rather than logical properties, and deliberately: the sign the drag applies is physical too, and Studio's own chrome is never mirrored — the artboard's `dir` is a property of the document INSIDE the iframe.",width:"9px",background:"transparent"},'& [part="edit-handle"][data-side="start"]':{marginLeft:"-9px"},'& [part="edit-handle"][data-side="end"]':{marginRight:"-9px"},'& [part="edit-handle"]:hover, & [part="edit-handle"][data-dragging]':{$description:"The element's own hover and drag paint, restated at (0,3,0) because the rest rule above ties its (0,2,0) and would otherwise win — see that rule. `[data-dragging]` is the element's mirror of its own gesture, so the highlight outlives the pointer leaving the 9px strip.",background:"var(--jx-accent)",opacity:"0.5"},'& [part="preview-stage"]':{$description:"Preview is the fidelity view: one frame, sized to the pane, scrolling its own document so sticky positioning, scroll-driven animation and IntersectionObserver reveals behave as they will in production. That means no pan/zoom surface and no content-height growth — so every box between the stage and the iframe needs a definite height for the frame's `height: 100%` to resolve against, and the artboard chrome is dropped: this is the page, not a specimen of it. Centred, because the stage is as wide as the chosen breakpoint rather than the pane, and a 640px preview pinned to the left edge of a 1400px pane reads as a broken layout rather than a phone.",display:"flex",width:"100%",height:"100%",margin:"0 auto",maxWidth:"var(--preview-w, none)"},'& [part="preview-stage"] [part="panel"]':{flex:"1",minWidth:"0",height:"100%"},'& [part="preview-stage"] [part="panel-viewport"]':{flex:"1",height:"100%",border:"none"},'& [part="preview-stage"] [part="panel-canvas"]':{height:"100%"},'& [part="writing-banner"]':{$description:"A band across the pane at 1:1, so its width is the pane's rather than the breakpoint's and the page scrolls under it. It never shrinks: it is one line.",flexShrink:"0"}},children:[{$description:"What stands over the frame: the writing-mode banner above Edit's scrolling column for a collection entry (whose fields are the Inspector's), the Compare bar over a comparison, or the Project Styles bar over the catalogue. Each is an empty host — the surface that fills it is mounted by the module that owns it.",tagName:"div",attributes:{part:"lead-slot"},style:{display:"contents"},$switch:{$ref:"#/state/lead"},cases:{banner:{$description:"The writing-mode banner over a collection entry written on the canvas (studio.md §22.5): an empty host the banner surface is mounted into by `content/writing-banner.ts`. An entry's fields are edited in the Inspector's Entry tab; the banner only says the layout is locked and where to edit it.",tagName:"div",attributes:{part:"writing-banner"}},toolbar:{tagName:"div",attributes:{part:"diff-toolbar"}},chrome:{$description:'`chrome-host`, not `chrome`: the bar that stands here is `surfaces/stylebook-chrome.json`, whose own root is `[part="chrome"]`. A host and its occupant sharing one name makes every selector over the pair ambiguous.',tagName:"div",attributes:{part:"chrome-host"}}}},{$description:"The frame. Three of its five shapes are the same two boxes with different parts — Preview's centred column, the pan/zoom surface and Edit's scrolling column all hold artboards — so they share one case and differ in `framePart` / `innerPart`. Monaco's two shapes are their own cases, because a code editor holds no artboards and an empty `$map` inside its host would leave nodes in a box the editor is about to take over.",tagName:"div",attributes:{part:"frame-slot"},style:{display:"contents"},$switch:{$ref:"#/state/frame"},cases:{boards:{$description:"The frame's box. `part` is BOUND — a Preview column, a pan/zoom surface and an Edit canvas are one shape with three names — and `data-slot` is the static one beside it, because a host is announced as it is BUILT, one step before its attributes are settled: the adapter reads the static mark and translates it through the view it just wrote.",tagName:"div",attributes:{part:"${state.framePart}","data-slot":"frame",style:"${state.frameVars}"},children:[{$description:'The two width handles — `jx-split`s, ui.md §5.5 — drawn only where there is a column to size, and drawn BESIDE it rather than inside it, one slot before the inner box and one after. The placement is the track: a `jx-split` measures the first ancestor of its own that generates a box, and inside the column that would have been the column, whose width is the very thing the gesture changes. Out here the track is the canvas, a box the drag does not move, and the doubling that keeps an edge under the pointer falls out of the share arithmetic in `canvas/edit-width-drag.ts` rather than being a special case. In the Preview and pan/zoom frames both slots are empty `display: contents` wrappers and cost the row nothing. The element brings what the div it replaces could not: `role="separator"`, a tab stop, `aria-valuenow`, the arrows and Home/End, and Enter or a double click to return to the breakpoint\'s declared width. Its share, its bounds and its collapse point are written by `mountEditWidthHandle`, which also runs the snap onto the document\'s breakpoints from the modifiers the element reports on every `input`, with Alt as the way through.',tagName:"div",attributes:{part:"handle-start-slot"},style:{display:"contents"},$switch:{$ref:"#/state/handles"},cases:{shown:{tagName:"jx-split",attributes:{part:"edit-handle","data-side":"start",title:"Drag, or use the arrow keys, to resize the page — hold Alt to skip the breakpoints"},$props:{orientation:"vertical",label:"Resize the page from its left edge"}}}},{tagName:"div",attributes:{part:"${state.innerPart}","data-slot":"inner","data-hug":"${state.hug ? '' : null}"},style:{$description:"`boards` is a pass-through: Preview and the pan/zoom surface hold their artboards directly, and only Edit's column is a box of its own. Declaring the pass-through here rather than adding a wrapper to two of the three frames is what lets one subtree serve all three.",'&[part="boards"]':{display:"contents"}},children:[{$prototype:"Array",items:{$ref:"#/state/panels"},key:{$ref:"$map/item/key"},map:{$description:"One artboard: its breakpoint's name, the white page under it, and the empty box the iframe mounts into. Keyed on the breakpoint, because each board owns a live iframe and the declared set changes with the document's `$media` — position-based reuse would hand one breakpoint's frame to another's width, which is a live document rendered at the wrong viewport rather than a cosmetic diff.",tagName:"div",attributes:{part:"panel","data-media":"${$map.item.mediaAttr}","data-full-width":"${$map.item.fullWidth ? '' : null}",style:"${$map.item.widthVars}"},children:[{tagName:"div",attributes:{part:"header-slot"},style:{display:"contents"},$switch:{$ref:"$map/item/header"},cases:{shown:{$description:"The breakpoint belongs to the tab of the pane that MOUNTED this artboard — the parent-side twin of the iframe's `hit` message, resolved the same way. Writing the FOCUSED pane's tab instead set another document's breakpoint, and the Style panel then edited a compound block the person never opened.",tagName:"div",attributes:{part:"panel-header"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/pickPanel"},value:[{$ref:"$map/item/key"}]}]},textContent:"${$map.item.label}"}}},{tagName:"div",attributes:{part:"panel-viewport"},children:[{tagName:"div",attributes:{part:"panel-canvas"}}]}]}}]},{tagName:"div",attributes:{part:"handle-end-slot"},style:{display:"contents"},$switch:{$ref:"#/state/handles"},cases:{shown:{tagName:"jx-split",attributes:{part:"edit-handle","data-side":"end",title:"Drag, or use the arrow keys, to resize the page — hold Alt to skip the breakpoints"},$props:{orientation:"vertical",label:"Resize the page from its right edge"}}}}]},source:{tagName:"div",attributes:{part:"source-wrap"},children:[{tagName:"div",attributes:{part:"source-editor"}}]},code:{tagName:"div",attributes:{part:"diff-code-wrap"},children:[{tagName:"div",attributes:{part:"diff-code-editor"}}]}}}]};E("canvas-stage",E$);function Ff(e,t){let r=n(e)?void 0:e.attributes?.[t];return n(r)?r:""}function oH(e){let t=e?.$map,r=v(t)?t.item:void 0,o=v(r)?r.key:"";return n(o)?o:""}var aH=new Set(["panel","panel-viewport","panel-canvas"]);function iH(e,t,r,o){let a=e.get(t);if(!a)a=new Map,e.set(t,a);a.set(r,o)}function R$(e,t){e.frame=t.frame,e.framePart=t.framePart,e.innerPart=t.innerPart,e.frameVars=t.frameVars,e.hug=t.hug,e.lead=t.lead,e.handles=t.handles,e.panels=t.panels}function O$(e,t,r){e.replaceChildren();let o=new Map,a=g({frame:"boards",framePart:"panzoom",frameVars:"",handles:"hidden",hug:!1,innerPart:"boards",lead:"none",panels:[],pickPanel:r.pickPanel});R$(a,t);let i=null,s=!1,l=R("canvas-stage",a,e,{onNodeCreated:(f,c,d,b)=>{let y=Ff(d,"part");if(aH.has(y)&&f instanceof HTMLElement)iH(o,oH(b),y,f);else if(y&&f instanceof HTMLElement){let x=Ff(d,"data-slot"),S=x==="frame"?a.framePart:x==="inner"?a.innerPart:y;r.host(S,f,Ff(d,"data-side"))}}}).then((f)=>{if(s){f.dispose(),o.clear();return}i=f});return{dispose(){s=!0,i?.dispose(),i=null,o.clear()},panelNode:(f,c)=>o.get(f)?.get(c)??null,ready:l,update(f){let c=new Set(f.panels.map((d)=>d.key));for(let d of o.keys())if(!c.has(d))o.delete(d);return R$(a,f),l.then(()=>{})}}}var sH={x:160,y:120},lH=0.5,M$=[{axis:"x",dock:"left",grow:1,selector:"#resize-left"},{axis:"x",dock:"right",grow:-1,selector:"#resize-right"},{axis:"y",dock:"bottom",grow:-1,selector:"#resize-bottom"}];function cH(e,t,r){let o=(i)=>Math.min(e.max(),Math.max(e.min(),i)),a=o(t);if(!e.snap)return a;return o(e.snap(a,r))}function vi(e,t,r){let o=e.scale(),i=((e.lead?.(r)??0)+t/Math.abs(o))/r;return o>0?i:1-i}function dH(e,t,r){let o=e.scale(),a=e.lead?.(r)??0;return((o>0?t:1-t)*r-a)*Math.abs(o)}function Hf(e,t){let r=()=>{let i=m0(e,t.axis==="x");if(i<=0)return;let s=vi(t,t.min(),i),l=vi(t,t.max(),i);e.min=Math.min(s,l),e.max=Math.max(s,l),e.collapse=vi(t,t.reset(),i),e.value=vi(t,t.read(),i)},o=(i)=>{let s=m0(e,t.axis==="x");if(s<=0)return;let l=dH(t,e.value,s),f=cH(t,l,VI(i));t.write(f),e.value=vi(t,f,s)},a=()=>{t.settle()};return e.addEventListener("input",o),e.addEventListener("change",a),e.addEventListener("pointerdown",r,!0),e.addEventListener("keydown",r,!0),globalThis.addEventListener("resize",r),r(),_f.set(e,r),()=>{e.removeEventListener("input",o),e.removeEventListener("change",a),e.removeEventListener("pointerdown",r,!0),e.removeEventListener("keydown",r,!0),globalThis.removeEventListener("resize",r),_f.delete(e)}}var _f=new Map;function pH(){for(let e of _f.values())e()}function uH(e){return(e==="x"?window.innerWidth:window.innerHeight)*lH}function mH(e,t,r){return{axis:t,lead:()=>fH[e],max:()=>uH(t),min:()=>sH[t],read:()=>u.docks[e].size,reset:()=>gO[e],scale:()=>r,settle:()=>Bd(),write:(o)=>_O(e,Math.round(o))}}var fH={bottom:24,left:56,right:0};function hH(){for(let{axis:e,dock:t,grow:r,selector:o}of M$){let a=document.querySelector(o);if(a)_$.push(Hf(a,mH(t,e,r)))}zf=te(()=>{for(let{dock:e}of M$)u.docks[e].size;pH()})}var _$=[],zf=null;function gH(){for(let e of _$.splice(0))e();zf?.(),zf=null}nv({mount:hH,unmount:gH});function bH(e,t,r){let o=bt(e.paneId);if(!o)return;if(t.style.maxWidth=`${Math.round(r)}px`,o.session.ui.editZoom!==1)lh(e);let a=Me(t).width||r;EC(e.paneId,o,a),t.dataset.editWidth=`${Math.round(a)}px`,t.classList.add("is-resizing")}function yH(e,t,r){let o=()=>bt(e.paneId),a=()=>(t.parentElement?.clientWidth??0)/2;return{axis:"x",lead:(i)=>r===1?a():i-a(),max:()=>{let i=t.parentElement?.clientWidth??0;return i>0?Math.max(Pm,i-2*XA):Number.POSITIVE_INFINITY},min:()=>Pm,read:()=>Me(t).width||(o()?CC(o()):Pm),reset:()=>{let i=o();return i?CC(i):Pm},scale:()=>2*r,settle:()=>{t.classList.remove("is-resizing"),lh(e)},snap:(i,s)=>{let l=o();if(s.altKey||!l)return i;return YA(i,eO(l),ZA)},write:(i)=>{bH(e,t,i)}}}var fc=new Map;function vH(){for(let[e,t]of fc)if(!e.isConnected)t(),fc.delete(e)}function Bf(e,t,r,o){if(vH(),!t||!r||fc.has(t))return;fc.set(t,Hf(t,yH(e,r,o)))}var hc=null,z$=null,Vf=!1;function q$(e){hc=e,z$=me(),z$.run(()=>{te(()=>{let t=h.value;if(!t)return;t.session.selection.map((r)=>r.join("/")).join("|"),t.session.hover,t.doc.mode,t.session.ui.activeMedia,wi()})})}function wi(){if(!hc)return;if(!Vf)Vf=!0,queueMicrotask(wH)}function wH(){if(Vf=!1,!hc)return;if(!h.value)return;px(),hc.renderBlockActionBar()}var Q$=null;function eS(e){Q$=e}function xH(e){let t=Wi(e.doc.sourceFormat);return t?Uw(t.mediaType)?.split("/").pop()??"plaintext":"json"}async function tS(e){if(Wi(e.doc.sourceFormat))return Ju(e);return Co(e.doc.document,e.doc.layout??null)}var Wf=new Map;function Br(e=m.activePaneId){if(Wf.has(e))return;Wf.set(e,requestAnimationFrame(()=>{Wf.delete(e);try{$t(e)}catch(t){console.error("renderCanvas error:",t)}}))}function nS(e){Qb(e),e.textContent="",delete e._$litPart$}var gc=new WeakMap,Uf=new WeakMap,J$=new WeakMap;function kH(e){let t=gc.get(e);if(!t)t=new Map,gc.set(e,t);return t}function _r(e,t){return gc.get(e)?.get(t)??null}function $H(e){let t=J$.get(e);if(t)return t;return t={host:(r,o,a)=>{if(kH(e).set(a?`${r}:${a}`:r,o),r==="panzoom")e.panzoomWrap=o;else if(r==="writing-banner")Df(e.paneId,o);else if(r==="diff-toolbar")zl(e.paneId,o)},pickPanel:(r)=>nO(Uf.get(e)??[],r)},J$.set(e,t),t}function On(e,t,r){Uf.set(e,r);let o=e.stage,a=o??O$(e.wrap,t,$H(e));return e.stage=a,(o?a.update(t):a.ready).then(()=>{if(e.stage!==a)return null;return tO(r,a),a})}function G$(e){return{frame:e,framePart:"panzoom",frameVars:"",handles:"hidden",hug:!1,innerPart:"boards",lead:e==="code"?"toolbar":"none",panels:[]}}function rS(e){if(!e.stage)return;e.stage.dispose(),e.stage=null,gc.delete(e),Uf.delete(e),zl(e.paneId,null)}function bc(e){e.sourceCollabCleanup?.(),e.sourceCollabCleanup=null}async function SH(e,t,r){let{bindMonacoToYText:o}=await (ce("a51py33c"),import("./chunks/monaco-binding-a51py33c.js")),a=o({awareness:r.awareness,editors:[t],model:e,origin:r.localOrigin,text:r.text}),i=Mx(r.awareness,document);return()=>{i(),a(),r.leave()}}function xi(e){let t=e.monacoEditor;if(!t)return;Tv(t,"source"),t.getModel()?.dispose(),t.dispose(),e.monacoEditor=null}function ki(e){let t=e.monacoDiffEditor;if(!t)return;let r=t.getModel();t.setModel(null),r?.original.dispose(),r?.modified.dispose(),t.dispose(),e.monacoDiffEditor=null}function K$(e,t){return e?.map((r)=>({kind:r.kind==="modified"?t:r.kind,path:r.path}))??null}async function CH(e,t,r){let{paneId:o}=e,a=r.filePath;if(e.monacoDiffEditor&&e.monacoDiffEditor._diffKey!==a)ki(e);let i=await rg();if(!Rv(t,e.monacoDiffEditor,()=>Vo(o)==="git-diff"&&Xa(o,Mb(a))))return;let s=v2(o,a||"document.json"),l=y2(a||"document.json"),f=i.editor.createModel(r.originalContent||"",l,i.Uri.parse(s.head)),c=i.editor.createModel(r.currentContent||"",l,i.Uri.parse(s.work)),d=i.editor.createDiffEditor(t,{automaticLayout:!0,fontFamily:"'JetBrains Mono', 'SF Mono', 'Fira Code', 'Consolas', monospace",fontSize:12,minimap:{enabled:!1},originalEditable:!1,readOnly:!0,renderSideBySide:!0,scrollBeyondLastLine:!1,theme:zm()});d.setModel({modified:c,original:f}),d._diffKey=a,e.monacoDiffEditor=d}function Y$(e){let t=e.wrap,{paneId:r}=e;if(ai(r),Tw(r),yi(r),Zw(r),Xw(r),ci(r),ob(r),bc(e),xi(e),ki(e),e.centerObserver)e.centerObserver.disconnect(),e.centerObserver=null;Za(e);for(let o of e.panels)o.renderScope?.stop(),o.renderScope=null;e.panels.length=0,nS(t),e.panzoomWrap=null,t.style.padding="",t.style.alignItems="",t.style.flexDirection="",t.style.gap="",t.style.display="",t.style.overflow="",N_(),oE(),sm(),mp(),e.prevCanvasMode=null}async function TH(e,t,r,o,a){let{paneId:i}=t,s=await rg();if(!Rv(r,t.monacoEditor,()=>bt(i)===e&&Vo(i)==="source"))return;let l=s.Uri.parse(iR(o)),f=s.editor.createModel("",a,l),c=nM(e);if(c)c.enter().then(async()=>{let y=t.monacoEditor;if(!y||y.getModel()!==f){c.leave();return}let x=await SH(f,y,c);if(t.monacoEditor!==y||y.getModel()!==f){x();return}if(t.sourceCollabCleanup=x,y._writes?.markShared(),c.readOnly)y.updateOptions({readOnly:!0})}).catch(()=>{c.leave();let y=t.monacoEditor;if(y&&y.getModel()===f)y.updateOptions({readOnly:!0})});else tS(e).then((y)=>{let x=t.monacoEditor;if(x&&x.getModel()===f&&!Qp(x,""))x._ignoreNextChange=!0,f.setValue(y),x._writes?.markSettled()}).catch(()=>{});let d=s.editor.create(r,{automaticLayout:!0,fontFamily:"'JetBrains Mono', 'SF Mono', 'Fira Code', 'Consolas', monospace",fontSize:12,lineNumbers:"on",minimap:{enabled:!1},model:f,scrollBeyondLastLine:!1,tabSize:2,theme:zm(),wordWrap:"on"});t.monacoEditor=d,d._editingTab=e;let b=Ev(d);if(c)return;d.onDidChangeModelContent(()=>{if(t.monacoEditor!==d)return;if(d._ignoreNextChange){d._ignoreNextChange=!1;return}b.markTyped(),qm(e.id),b.arm(Xp,600,async()=>{if(!bl(e)||!tu(d))return;if(Wi(e.doc.sourceFormat)&&e.documentPath)try{let{document:y,frontmatter:x}=await Fr(e.documentPath,d.getValue());if(!bl(e))return;e.doc.document=y,e.doc.content.frontmatter=x,e.doc.source=d.getValue(),e.doc.dirty=!0,b.markSettled()}catch{}else if(a==="json")try{let y=Es(d.getValue()),x=y.document;e.doc.bareRepeaters=Gm(x),e.doc.document=x,e.doc.layout=y.layout,e.doc.dirty=!0,b.markSettled()}catch{}})})}function $t(e=m.activePaneId){let t=bo(e);wC(GL,()=>{PH(t)})}function oS(e,t){let r=$$(e,t);for(let o of m.panes)$t(o.id);return r}function qf(e,t,r=null){e.wrap.style.display="block";let o=ae(),a=o?.get("pane.pin");io(Pu(e.wrap,{message:t,...r&&{detail:`${$d(r)} is still open here.`},...r&&a&&{actions:[{label:a.title,run:()=>{o?.run(a.id)}}]}}),e.wrap)}function PH(e){let t=Ch(e);if(!t)return;let r=e.panels,o=bt(e.paneId);if(!o){Y$(e);let F=jr(e.paneId);if(F){qf(e,F.reason||"Looking for something to show here…");return}if(!C?.isSiteProject)Qk(t);return}let a=jr(e.paneId);if(a?.status==="unavailable"&&a.reason){Y$(e),qf(e,a.reason,a.kind==="companion"?o:null);return}let i=Q$,s={document:o.doc.document,mode:o.doc.mode,ui:o.session.ui},l=Vo(e.paneId),f=l==="edit"&&jr(e.paneId)?.kind!=="lens"&&Boolean(C?.isSiteProject)&&rh(o.documentPath);if(!f)yi(e.paneId);e.renderGeneration=DM(),Uo.fullRenders+=1;let c=l!==e.prevCanvasMode;if(c&&t._$litPart$)nS(t);if(c&&l!=="git-diff")ki(e);let d=l==="source"&&e.monacoEditor?af():null;if(d&&e.monacoEditor){let F=d.Uri.parse(iR(o.documentPath||"document.json"));if(e.monacoEditor.getModel()?.uri.toString()!==F.toString())bc(e),xi(e)}if(l==="source"&&e.monacoEditor&&!c){let F=e.monacoEditor;tS(o).then((B)=>{if(e.monacoEditor!==F)return;if(!Qp(F)&&F.getValue()!==B)F._ignoreNextChange=!0,F.setValue(B),F._writes?.markSettled()}).catch(()=>{});return}if(l==="grid"&&$f(e.paneId,o)&&!c)return;if(l==="entry"&&hT(e.paneId,o)&&!c)return;if(l==="media"&&xL(e.paneId,o)&&!c)return;if(l===ls&&LL(e.paneId,o)&&!c)return;if(l===am&&Ef(e.paneId,o)&&!c)return;if(z_(l)&&W_(e.paneId,o)&&!c)return;if(l==="stylebook"&&!c){let F=u.stylebook.filter,B=u.stylebook.customizedOnly;if(!(F!==e.prevStylebookFilter||B!==e.prevStylebookCustomizedOnly||dl(e.paneId)!==e.prevStylebookMedia)){let U=Yy(wr(o.doc.document.style));if(vx(U)>0)return}}e.prevCanvasMode=l,yx();for(let F of r)F.renderScope?.stop(),F.renderScope=null;if(r.length=0,c){if(e.centerObserver)e.centerObserver.disconnect(),e.centerObserver=null;Za(e),ai(e.paneId),Tw(e.paneId),Zw(e.paneId),Xw(e.paneId),ci(e.paneId),ob(e.paneId),bc(e),xi(e),Qb(t),rS(e),io(ft,t),e.panzoomWrap=null,t.style.padding="",t.style.alignItems="",t.style.flexDirection="",t.style.gap="",t.style.display="",t.style.overflow="",N_(),oE(),sm(),mp()}if(l==="stylebook"){e.prevStylebookFilter=u.stylebook.filter,e.prevStylebookCustomizedOnly=u.stylebook.customizedOnly,e.prevStylebookMedia=dl(e.paneId),fD(e,{applyTransform:Gs,canvasPanelEntry:Pp,drawStage:On,observeCenterUntilStable:hx,stageHost:_r,updateActivePanelHeaders:px}).then(()=>{if(c)$C(e)});return}if(l==="preview"){if(c)t.style.padding="0",t.style.display="block",t.style.overflow="hidden";let{baseWidth:F,sizeBreakpoints:B}=Hr(to(s.document.$media)),L=dl(e.paneId),U=B.find((J)=>J.name===L)?.width??F,W=Pp(null,null,!0);r.push(W.panel);let{featureToggles:z}=s.ui;On(e,{frame:"boards",framePart:"preview-stage",frameVars:`--preview-w:${U}px`,handles:"hidden",hug:!1,innerPart:"boards",lead:"none",panels:[W.item]},[W]).then((J)=>{if(!J)return;zr(e,W.panel,z)});return}if(l==="entry"){t.style.padding="0",t.style.display="block",yN(e,o);return}if(l==="media"){t.style.padding="0",t.style.display="block",XN(e,o);return}if(l===ls){t.style.padding="0",t.style.display="block",iA(e,o);return}if(l===am){Ck(e,o);return}if(z_(l)){pE(e,o);return}if(l==="grid"){t.style.padding="0",t.style.display="block",ak(e,o);return}if(l==="source"){t.style.padding="0",t.style.display="block";let F=o.documentPath||"document.json",B=xH(o);On(e,G$("source"),[]).then((L)=>{if(!L)return;let U=_r(e,"source-editor");if(U)TH(o,e,U,F,B)});return}if(l==="git-diff"){let F=jr(e.paneId),B=F?.kind==="lens"&&F.preset==="diff",L=B?F.diff:i.gitDiffState;if(!L){if(B){qf(e,F.reason||"Loading this file's changes…");return}i.setCanvasMode(o,"design"),$t(e.paneId);return}if(c)t.style.padding="0",t.style.overflow="hidden";let U=Mb(L.filePath);if(Xa(e.paneId,U)){if(!U)ff(e.paneId,null);xi(e),On(e,G$("code"),[]).then(($e)=>{if(!$e)return;Jl(e.paneId);let A=_r(e,"diff-code-editor");if(A)CH(e,A,L)});return}ki(e);let W=800,z=Pp("git-diff-original","Original",!1,W),J=Pp("git-diff-current","Current",!1,W),K=On(e,{frame:"boards",framePart:"panzoom",frameVars:"",handles:"hidden",hug:!1,innerPart:"boards",lead:"toolbar",panels:[z.item,J.item]},[z,J]);r.push(z.panel,J.panel);let ie=($e)=>{let A=L.filePath;if(fn(A))return Fr(A,$e).then((ve)=>ve.document);return Promise.resolve().then(()=>{try{return JSON.parse($e)}catch{return{children:[{tagName:"p",textContent:"Failed to parse"}],tagName:"div"}}})},{featureToggles:se}=s.ui,be=e.renderGeneration;Promise.all([K,ie(L.originalContent||""),ie(L.currentContent||"")]).then(([$e,A,ve])=>{let Ie=null;try{Ie=Cx(A,ve)}catch(I){console.warn("buildChangeMap:",I)}if(!$e)return;ff(e.paneId,Ie),Jl(e.paneId),zr(e,z.panel,se,A,K$(Ie?.original,"modified-before"),be),zr(e,J.panel,se,ve,K$(Ie?.current,"modified-after"),be)}),K.then(($e)=>{if(!$e)return;if(Gs(e),c)hx(e)});return}if(l==="edit"){if(c)t.style.padding="0",t.style.overflow="hidden",kC(e.paneId);let F=QA(e,o),B=Pp(null,null,!0),L=s.document.tagName,U=n(L)&&L.includes("-"),{featureToggles:W}=s.ui,z=f;t.style.flexDirection=z?"column":"",t.style.alignItems=z?"stretch":"",t.style.gap=z?"0px":"",On(e,{frame:"boards",framePart:"edit-canvas",frameVars:"",handles:"shown",hug:U,innerPart:"edit-column",lead:f?"banner":"none",panels:[B.item]},[B]).then((J)=>{if(!J)return;if(f)S$(e.paneId,o);let K=_r(e,"edit-column"),ie=_r(e,"edit-canvas");if(B.panel.scrollContainer=ie,Ox(e,ie),K)K.style.maxWidth=`${Math.round(F)}px`,Bf(e,_r(e,"edit-handle:start")??void 0,K,-1),Bf(e,_r(e,"edit-handle:end")??void 0,K,1);zr(e,B.panel,W),lh(e)}),r.push(B.panel);return}if(c)t.style.padding="0",t.style.overflow="hidden";let{sizeBreakpoints:b,featureQueries:y,baseWidth:x}=Hr(to(s.document.$media)),S=b.length>0,{featureToggles:P}=s.ui;if(!S){let B=to(s.document.$media)["--"],L=B?`${ji("--")} (${x}px)`:null,U=Pp(B?"base":null,L,!B,B?x:void 0);On(e,{frame:"boards",framePart:"panzoom",frameVars:"",handles:"hidden",hug:!1,innerPart:"boards",lead:"none",panels:[U.item]},[U]).then((W)=>{if(!W)return;if(zr(e,U.panel,P),Gs(e),c)$C(e),hx(e)}),r.push(U.panel);return}let j=[{displayName:ji("--"),name:"base",width:x}];for(let F of b)j.push({displayName:ji(F.name),name:F.name,width:F.width});let k=jr(e.paneId),T=k?.kind==="lens"&&k.preset==="breakpoint"?k.media??"base":null,N=T===null?j:j.filter((F)=>F.name===T),D=(N.length>0?N:j).map((F)=>Pp(F.name,`${F.displayName} (${F.width}px)`,!1,F.width)),M=On(e,{frame:"boards",framePart:"panzoom",frameVars:"",handles:"hidden",hug:!1,innerPart:"boards",lead:"none",panels:D.map((F)=>F.item)},D),V=e.renderGeneration;for(let{panel:F}of D)r.push(F);M.then((F)=>{if(!F)return;for(let B=0;B<D.length;B++){let{panel:L}=D[B];if(B===0)zr(e,L,P,null,null,V);else setTimeout(()=>zr(e,L,P,null,null,V),0)}if(px(e),Gs(e),c)$C(e),hx(e)})}function zr(e,t,r,o=null,a=null,i=null){let s=i??e.renderGeneration,l=bt(e.paneId),f=o||l?.doc.document,{canvas:c}=t;Uo.panelRenders+=1,t.ready=!1,u$(c,Vo(e.paneId)==="preview"),xC(BA,()=>k$(s,f,c,t._width,o?null:l?.id??null,l,Vo(e.paneId),a)).then(()=>{if(s===e.renderGeneration)t.ready=!o,HM(l,{error:null,scope:null,status:"ready"})}).catch(EH)}function EH(e){w.error("The canvas could not be mounted.",{detail:X(e),key:"canvas.mount",source:"Canvas"})}cx($t);OM((e)=>{ki(e),qw(e.paneId),zl(e.paneId,null),ai(e.paneId),Tw(e.paneId),Zw(e.paneId),Xw(e.paneId),ci(e.paneId),ob(e.paneId),yi(e.paneId),bc(e),xi(e),e.centerObserver?.disconnect(),e.centerObserver=null,Za(e),e.panzoomWrap=null,rS(e)});function iS(){wi()}function NH(e){return/^[A-Za-z_$][\w$]*/.exec(e)?.[0]??""}function jH(e){let t=h.value;if(!t)throw RangeError('command "insert.data" needs an open document; no tab is active');let r=NH(e),o=t.doc.document.state??{};if(r==="state"){if(!((e.split(".")[1]??"")in o)){let i=Object.keys(o);throw RangeError(`command "insert.data" argument "token": "${e}" names no state entry — this `+`document defines: ${i.length>0?i.join(", "):"nothing"}`)}return}if(r==="item"||r==="index"){let a=nc().snapshot?.path??Oe(t.session.selection);if(!I_(t.doc.document,a))throw RangeError(`command "insert.data" argument "token": "${e}" is a repeater-scope token, and the caret is not inside a repeater template`);return}throw RangeError(`command "insert.data" argument "token": "${e}" is not an insertable token — a token `+'reads "state.<name>", "item", "item.<field>" or "index"')}function RH(){return[{args:Se({path:Xx("The document path to select — an array of keys and indexes. [] is the document "+"root; null clears the selection.",!0)}),category:"Selection",id:"selection.set",level:"document",menus:["palette"],group:"2_navigate",requires:"an open document",when:(e)=>e.document.open,aiTool:{description:"Select the element at a document path so the Inspector, the Outline and the canvas overlay all address it. Pass null to clear the selection.",name:"select_node",report:({after:e})=>e.selection.count===0?"Cleared the selection.":`Selected ${e.selection.kind||"the element"} at [${(e.selection.paths.at(-1)??[]).join(", ")}]; the Inspector and the Outline now address it.`},run:(e,t)=>{let r=oM("selection.set",t,"path"),o=h.value;if(!o)throw RangeError('command "selection.set" needs an open document; no tab is active');if(r!==null&&r.length>0&&!oe(o.doc.document,r))throw RangeError(`command "selection.set" argument "path": [${r.join(", ")}] addresses no node in ${o.documentPath??"the open document"}`);o.session.selection=r===null?[]:[r]},title:"Select Element"},{args:Se({paths:rM("The document paths to select, in order — an array of paths. The LAST one becomes the "+"primary (what the Inspector edits); the first is the anchor a shift-range extends from. [] selects nothing.")}),category:"Selection",id:"selection.setPaths",level:"document",menus:["palette"],group:"2_navigate",requires:"an open document",when:(e)=>e.document.open,run:(e,t)=>{let r=mI("selection.setPaths",t,"paths"),o=h.value;if(!o)throw RangeError('command "selection.setPaths" needs an open document; no tab is active');for(let a of r)if(a.length>0&&!oe(o.doc.document,a))throw RangeError(`command "selection.setPaths" argument "paths": [${a.join(", ")}] addresses no node in ${o.documentPath??"the open document"}`);o.session.selection=XO(r)},title:"Select Elements"},{args:Se({token:Fe('The token to insert, without the ${…} wrapper — "state.<name>", "item", '+'"item.<field>" or "index".')}),category:"Insert",id:"insert.data",level:"selection",keyScope:"caret",menus:["palette"],group:"5_data",undo:"document",requires:"a live text caret in the canvas",when:(e)=>e.caret.inCanvas,run:(e,t)=>{let r=St("insert.data",t,"token");jH(r),dh({command:"insertData",token:r})},title:"Insert Data"},{category:"Insert",id:"insert.openSlashMenu",level:"selection",keyScope:"caret",menus:["palette"],group:"5_data",undo:"document",requires:"a live text caret in the canvas",when:(e)=>e.caret.inCanvas,run:()=>{N$()},title:"Insert Block…"}]}function cS(e){e.registerAll(RH())}var pS=null,Jf=new WeakMap;function uS(e){pS=e,aM({apply:OH,classify:LH,escalate:AH,markConsumed:(t,r)=>{Jf.set(le(t),new Set(mS(r).map((o)=>o.paneId)))}})}function mS(e){return uC(e).filter((t)=>{let r=Vo(t.paneId);return r==="design"||r==="edit"})}function fS(e,t){let r=le(e),o=Jf.get(r);if(!o?.has(t))return!1;if(o.delete(t),o.size===0)Jf.delete(r);return Uo.skippedFullRenders+=1,!0}function AH(e,t=null){lx(e);for(let r of uC(t))pS?.scheduleCanvasRender(r.paneId)}function $i(e){return e.includes("cases")}function yc(e,t,r=!0){if($i(t))return"structure-on-cases-path";if(t.includes("map"))return"structure-on-map-path";let o=e.doc.document,a=oe(o,t);if(!a)return"node-not-found";if(t.length>0&&n(a.tagName)&&a.tagName.includes("-"))return"structure-in-custom-element";if(a.innerHTML)return"structure-with-innerhtml";if(r&&!Array.isArray(a.children))return"structure-children-not-array";return null}function dS(e,t){if(t.length===0)return"replace-root";if($i(t))return"replace-on-cases-path";let r=Vt(t);if(!r)return"replace-no-parent";if(r.includes("map"))return"structure-on-map-path";let o=oe(e.doc.document,r);if(!o)return"node-not-found";if(o.innerHTML)return"structure-with-innerhtml";return oe(e.doc.document,t)===void 0?"node-not-found":null}function IH(e,t){switch(t.op){case"set-style":{if($i(t.path))return"style-on-cases-path";return oe(e.doc.document,t.path)?null:"node-not-found"}case"set-text":{if($i(t.path))return"text-on-cases-path";let r=oe(e.doc.document,t.path);if(!r)return"node-not-found";if(n(r.tagName)&&r.tagName.includes("-"))return"text-on-custom-element";if(r.innerHTML)return"text-with-innerhtml";let o=r.children;if(Array.isArray(o)?o.length>0:o!=null)return"text-with-children";return null}case"set-prop":return t.isEvent?null:dS(e,t.path);case"set-attr":case"replace":return dS(e,t.path);case"insert":return yc(e,t.parentPath);case"remove":{let r=Vt(t.path);return r===null?"remove-no-parent":yc(e,r)}case"move":{if($i(t.fromPath))return"structure-on-cases-path";let r=Vt(t.fromPath);if(r===null)return"move-no-parent";return yc(e,r)??yc(e,t.toParentPath)}default:return`${t.op}-unsupported`}}function LH(e,t){let r=(s)=>(lx(s),{patchable:!1,reason:s}),o=uC(e);if(o.length===0)return r("inactive-tab");let a=mS(e);if(a.length===0){let s=Vo(o[0].paneId);return r(`mode-${s||"unknown"}`)}for(let s of a){let{panels:l}=s;if(l.length===0)return r("no-panels");if(!l.every((f)=>f.ready))return r("panels-not-ready")}let i=new Set;for(let s of t)if(s.op==="set-prop"&&s.key==="children"||s.op==="replace")i.add(JSON.stringify(s.path));for(let s of t){if(s.op==="set-text"&&i.has(JSON.stringify(s.path)))continue;let l=IH(e,s);if(l)return r(l)}return{patchable:!0,reason:""}}function OH(e,t,r){wC(zA,()=>{let o=(r?.docOps??[]).map((i)=>i.forward);if(AC(o,e.id)===0)throw Error("no-ready-iframe-host");Uo.patchedOps+=o.length})}function hS(e,t){Wy(e,"",{onSelect:(r)=>{let o=r.component===!0?_C(r.tag):null,a=o??ah(r.tag),{insertParentPath:i,index:s}=t,l=[...i,"children",s],f=h.value;Z(f,(c)=>{if(or(c,i,s,a),o)Op(c,o.tagName);c.session.selection=[l]})},showFilter:!0})}var gS={dismiss:()=>mp(),nav:(e)=>nE(e),show:({rect:e,filter:t,showFilter:r,onSelect:o,onDismiss:a})=>QR(e,t,{onDismiss:a,onSelect:o,showFilter:r===!0})};function bS(){return{dismiss:()=>sm(),show:({path:e,clientX:t,clientY:r})=>{if(!e)return;let o=JA(h.value?.doc.document,e),a=new MouseEvent("contextmenu",{clientX:t,clientY:r});A_(a,o)}}}var wS={$schema:"https://jxsuite.com/schema/v1",$id:"StudioJumpBar",$description:"The jump bar: the focused pane's address as a breadcrumb trail, the document first and the selected element last, every step a command the adapter has already resolved against the registry. It is the status bar's DOCUMENT field, mounted into the slot `surfaces/statusbar.json` leaves for it. A step is a button when its command can run and a readout when it cannot — an address with a hole in it is a lie about containment, so a step never disappears. A step with more than one place to go carries the chevron that opens its siblings, upward, because the bar is the window's floor; one alternative is not a choice and draws no control. Nothing here decides what the bar says, which step is where you are, or what a chevron opens.",tagName:"nav",attributes:{part:"bar","aria-label":"Location","data-jx-region":"${state.region}",hidden:"${state.empty ? '' : null}"},style:{$description:"A field of the status bar, so it takes the bar's own row, font and colour rather than drawing a band of its own. It scrolls rather than wraps, because a deep selection must not grow the status bar a second line.",display:"flex",alignItems:"center",gap:"1px",flex:"1",height:"100%",padding:"0 var(--jx-space-2)",minWidth:"0",overflowX:"auto",scrollbarWidth:"none",whiteSpace:"nowrap",boxSizing:"border-box","&[hidden]":{display:"none"},"&::-webkit-scrollbar":{display:"none"},'& [part="step"]':{display:"flex",alignItems:"center",flexShrink:"0"},'& [part="separator"]':{flexShrink:"0",padding:"0 1px",color:"var(--jx-fg-dim)",opacity:"0.6"},'& [part="crumb"]':{maxWidth:"32ch",overflow:"hidden",margin:"0",padding:"0 var(--jx-space-2)",border:"none",borderRadius:"var(--jx-radius-xs)",background:"transparent",color:"inherit",font:"inherit",lineHeight:"1",whiteSpace:"nowrap",textOverflow:"ellipsis"},'& button[part="crumb"]':{cursor:"pointer",":hover:not(:disabled)":{color:"var(--jx-fg)",background:"var(--jx-hover-bg)"},":disabled":{cursor:"default",opacity:"0.6"},":focus-visible":{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"}},'& [part="crumb"][aria-current]':{$description:"Where you ARE is stated by weight, not by taking the control away: the leaf still selects, which is how a stray click in the canvas is undone without leaving the bar.",color:"var(--jx-fg)",fontWeight:"600"},'& span[part="crumb"]':{$description:"A step with no runnable command is a readout, not a dead button. No hover, no pointer, no promise.",cursor:"default"},'& [part="alternatives"]':{padding:"0 1px",border:"none",borderRadius:"var(--jx-radius-xs)",background:"transparent",color:"inherit",font:"inherit",lineHeight:"1",cursor:"pointer",":hover":{color:"var(--jx-fg)",background:"var(--jx-hover-bg)"},":focus-visible":{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"}}},children:[{$prototype:"Array",items:{$ref:"#/state/segments"},key:{$ref:"$map/item/key"},map:{tagName:"span",attributes:{part:"step","data-jump-kind":"${$map.item.kind}"},children:[{tagName:"span",attributes:{part:"separator-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/leading"},cases:{false:{tagName:"span",attributes:{part:"separator","aria-hidden":"true"},textContent:"›"}}},{tagName:"span",attributes:{part:"crumb-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/control"},cases:{button:{tagName:"button",attributes:{part:"crumb",type:"button",title:"${$map.item.title}","aria-current":"${$map.item.current ? 'true' : null}",disabled:{$ref:"$map/item/disabled"}},textContent:"${$map.item.label}",onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/run"},value:[{$ref:"$map/item/key"}]}]}},readout:{tagName:"span",attributes:{part:"crumb",title:"${$map.item.title}","aria-current":"${$map.item.current ? 'true' : null}"},textContent:"${$map.item.label}"}}},{tagName:"span",attributes:{part:"alternatives-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasChoices"},cases:{true:{tagName:"button",attributes:{part:"alternatives",type:"button","aria-haspopup":"menu","aria-label":"${$map.item.altsLabel}",title:"${$map.item.altsLabel}"},textContent:"⌃",onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/choose"},value:[{$ref:"$map/item/key"},{$ref:"event#/currentTarget"}]}]}}}}]}}]};E("jump-bar",wS);function xS(e,t,r){let o=g({...r,empty:!0,region:t,segments:[]});e.replaceChildren();let a=null,i=!1;return R("jump-bar",o,e).then((s)=>{if(i){s.dispose();return}a=s}),{dispose(){i=!0,a?.dispose(),a=null,e.replaceChildren()},update(s){o.segments=[...s],o.empty=s.length===0}}}var DH="statusbar/document",FH="block-start span-inline-end";function $S(e){if(!e)return"Untitled";let t=C?.projectRoot;return t&&e.startsWith(`${t}/`)?e.slice(t.length+1):e}function _H(e){if(e.documentPath)return{label:$S(e.documentPath),title:e.documentPath};let t=gv(e.id);if(t)return{label:t,title:`The ${t} workspace's home, a view rather than a file`};let r=$m(e.id);if(r)return{label:r,title:`${r}, a view of many files rather than one`};return{label:$S(null),title:"Not saved to disk yet"}}function zH(e,t){let r=[];for(let o=0;o<t.length;){let a=t[o],i=a==="map"?1:2,s=t.slice(0,o+i),l=oe(e,s),f=l?.tag,c=l?.$prototype==="Array"?"Repeater":it(l?.tagName)||(n(f)?f:"")||(a==="cases"?String(t[o+1]):`[${t[o+1]}]`);r.push({label:c,path:s}),o+=i}return r}function HH(e,t,r){let o=t[r];if(!o)return[];let a=r===0?[]:t[r-1].path,i=oe(e,a),s=o.path.at(-2),l=o.path;if(s==="cases"){let c=i?.cases;if(!_(c))return[];return Object.keys(c).map((d)=>{let b=[...a,"cases",d];return CS(e,b,d,l)})}if(s!=="children")return[];let f=[];for(let[c,d]of rr(i).entries()){if(n(d))continue;let b=[...a,"children",c];f.push(CS(e,b,kr(d),l))}return f}function CS(e,t,r,o){let a=oe(e,t),i=a?kr(a):r,s={args:{path:t},command:"selection.set",label:i};return Cr(t,o)?{...s,current:!0}:s}function BH(e,t=null){if(!e)return[];let r=[{choices:[],command:t?"pane.pin":"palette.openFiles",kind:"file",..._H(e)}],{editingFormula:o,editingFunction:a}=e.session.ui;if(a)return r.push(PS("ƒ",a)),r;if(o)return r.push(PS("fx",o)),r;let i=Oe(e.session.selection);if(i&&i.length>0){let s=zH(e.doc.document,i);for(let[l,f]of s.entries()){let c=oe(e.doc.document,f.path);r.push({args:{path:f.path},choices:HH(e.doc.document,s,l),command:"selection.set",kind:"node",label:l===s.length-1&&c?kr(c):f.label,title:f.path.join(" / ")})}}return r}function PS(e,t){return{choices:[],command:null,kind:"editor",label:`${e} ${t.defName??t.eventKey??"editor"}`}}function VH(e){let t=e.args?.path;return e.kind==="node"&&Array.isArray(t)?`node:${t.join("/")}`:e.kind}function WH(e,t){return t!==null&&Boolean(e?.get(t))&&e.isVisible(t)}function qH(e,t,r){let o=e.get(r),a=e.disabledReason(r),i=e.keymap.formatBinding(r),s=a?`${o.title} — requires ${a}`:i?`${o.title} (${i})`:o.title;return t.title?`${t.title} · ${s}`:s}function UH(e,t,r,o){let a=t.command,i=WH(e,a);return{altsLabel:`Siblings of ${t.label}`,control:i?"button":"readout",current:o,disabled:i&&e.disabledReason(a)!==void 0,hasChoices:e!==null&&t.choices.length>1,key:VH(t),kind:t.kind,label:t.label,leading:r,title:i?qH(e,t,a):t.title??t.label}}var Yt=null,Ci=null,Ti=null;function vc(){let e=Ti;Ti=null,e?.close()}function JH(e,t){let r=ae();if(!r)return;vc();let o=e.choices.map((s,l)=>({checked:s.current===!0?"true":"false",destructive:!1,disabled:!1,dividerAbove:!1,id:String(l),run:()=>{Tn(r,s.command,s.args,"Jump Bar")},title:s.label})),a={label:`Go to a sibling of ${e.label}`,onClosed:(s)=>{if(Ti===s)Ti=null},opener:t,placement:FH,region:"jump-bar",rows:o};if(t)a.place=(s)=>GH(t,s);Ti=zt(a)}function GH(e,t){let r=Me(e);return{x:Math.round(r.left),y:Math.max(0,Math.round(r.top-t.height))}}function KH(){let e=qr().id,t=BH(bt(e),jr(e)),r=ae();return{segments:t,steps:t.map((o,a)=>UH(r,o,a===0,a===t.length-1))}}function NS(){if(!Yt)return;vc();let{segments:e,steps:t}=KH();Yt.segments=new Map(t.map((r,o)=>[r.key,e[o]])),Yt.surface.update(t)}function Gf(e){if(Yt?.host===e)return;if(Yt)vc(),Yt.surface.dispose(),Yt=null;if(!e)return;Yt={host:e,segments:new Map,surface:xS(e,DH,{choose:(t,r)=>{let o=Yt?.segments.get(t);if(o)JH(o,r)},run:(t)=>{let r=Yt?.segments.get(t),o=ae();if(r?.command&&o)Tn(o,r.command,r.args,"Jump Bar")}})},NS()}function AS(){Ci?.stop(),Ci=me(),Ci.run(()=>{te(()=>{ae(),C?.name,m.activePaneId,m.panes.length;let e=bt(qr().id);if(e)e.doc.document,e.documentPath,e.session.selection.map((t)=>t.join("/")).join("|"),e.session.ui.editingFormula,e.session.ui.editingFunction;NS()})})}function OS(){vc(),Ci?.stop(),Ci=null,Gf(null)}var FS={$schema:"https://jxsuite.com/schema/v1",$id:"StudioStatusbar",$description:"The status bar: ambient state in the shell's level order, PROJECT then DOCUMENT then SELECTION. The adapter hands in the fields either side of the DOCUMENT field (`leading` and `trailing`), each with its region and its items; an item with a command is a button that runs it through `run`, and an item without one is a readout. The DOCUMENT field between them is the `trail` slot, an empty box `panels/jump-bar.ts` mounts the breadcrumb trail into. Nothing here decides what the bar says.",tagName:"div",attributes:{part:"bar"},style:{display:"flex",alignItems:"stretch",flex:"1",minWidth:"0",'& > [part="field"]':{display:"flex",alignItems:"center",gap:"2px",minWidth:"0",padding:"0 var(--jx-space-3)"},'& > [part="field"]:last-child':{overflow:"hidden"},"& > :not([hidden]) ~ :not([hidden])":{$description:'A rule between fields rather than a run of "|" characters: the boundary between PROJECT, DOCUMENT and SELECTION is structural. Every visible field after a visible field draws one, so a hidden DOCUMENT slot leaves no doubled rule behind.',borderLeft:"1px solid var(--jx-border)"},'& > [part="trail"]':{$description:"The DOCUMENT field, filled by `panels/jump-bar.ts`. It takes the width the other two fields leave, so a deep trail scrolls inside it instead of pushing the SELECTION field off the bar.",display:"flex",flex:"1",minWidth:"0"},'& > [part="trail"][hidden]':{display:"none"},'& [part="item"], & [part="state"]':{maxWidth:"32ch",overflow:"hidden",margin:"0",padding:"0 var(--jx-space-2)",border:"none",borderRadius:"var(--jx-radius-xs)",background:"transparent",color:"inherit",font:"inherit",lineHeight:"1",whiteSpace:"nowrap",textOverflow:"ellipsis"},'& [part="item"]':{cursor:"pointer",":hover:not(:disabled)":{color:"var(--jx-fg)",background:"var(--jx-hover-bg)"},":disabled":{cursor:"default",opacity:"0.6"},":focus-visible":{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"}},'& [part="state"]':{cursor:"default"}},children:[{$prototype:"Array",items:{$ref:"#/state/leading"},key:{$ref:"$map/item/id"},map:{tagName:"div",attributes:{part:"field","data-jx-region":"${$map.item.region}"},children:[{$prototype:"Array",items:{$ref:"$map/item/items"},key:{$ref:"$map/item/key"},map:{tagName:"span",attributes:{part:"slot"},style:{display:"contents"},$switch:{$ref:"$map/item/kind"},cases:{button:{tagName:"button",attributes:{part:"item",type:"button",title:"${$map.item.title}",disabled:{$ref:"$map/item/disabled"}},textContent:"${$map.item.label}",onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/run"},value:[{$ref:"$map/item/key"}]}]}},state:{tagName:"span",attributes:{part:"state",title:"${$map.item.title}"},textContent:"${$map.item.label}"}}}}]}},{$description:"The DOCUMENT field's slot. Empty by design: the jump bar is handed this box and mounts its own document into it, so nothing here may ever render a child. `aria-live=\"off\"` because the bar's host is the app's polite status region, and a trail that changes on every click in the canvas would be read aloud on every click; the trail is a `nav` a reader visits, not news.",tagName:"div",attributes:{part:"trail","aria-live":"off",hidden:"${state.hasDocument ? null : ''}"}},{$prototype:"Array",items:{$ref:"#/state/trailing"},key:{$ref:"$map/item/id"},map:{tagName:"div",attributes:{part:"field","data-jx-region":"${$map.item.region}"},children:[{$prototype:"Array",items:{$ref:"$map/item/items"},key:{$ref:"$map/item/key"},map:{tagName:"span",attributes:{part:"slot"},style:{display:"contents"},$switch:{$ref:"$map/item/kind"},cases:{button:{tagName:"button",attributes:{part:"item",type:"button",title:"${$map.item.title}",disabled:{$ref:"$map/item/disabled"}},textContent:"${$map.item.label}",onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/run"},value:[{$ref:"$map/item/key"}]}]}},state:{tagName:"span",attributes:{part:"state",title:"${$map.item.title}"},textContent:"${$map.item.label}"}}}}]}}]};E("statusbar",FS);var xc=null;function XH(e,t,r){if(r.command===null)return{args:void 0,command:null,disabled:!1,key:`${t}:${r.label}`,kind:"state",label:r.label,title:r.title??r.label};let o=r.command;if(!e?.get(o)||!e.isVisible(o))return null;let a=e.get(o),i=e.disabledReason(o),s=e.keymap.formatBinding(o),l=i?`${a.title} — requires ${i}`:s?`${a.title} (${s})`:a.title;return{args:r.args,command:o,disabled:i!==void 0,key:`${t}:${o}`,kind:"button",label:r.label,title:r.title?`${r.title} · ${l}`:l}}function Kf(e,t,r){let o=`statusbar/${t}`,a=r.flatMap((i)=>{let s=i===null?null:XH(e,o,i);return s===null?[]:[s]});if(a.length===0)return null;return{id:t,items:a,region:o}}function QH(e,t){return`${e>0?` ↑${e}`:""}${t>0?` ↓${t}`:""}`}function ZH(e){if(e===0)return"No changes";return e===1?"1 changed file":`${e} changed files`}function eB(e){let t=C,{status:r}=u.git,o=Iv(),a=lA(),i=h.value?xn(h.value).peers.length:0;return Kf(e,"project",[t?{command:"project.openRecent",label:t.name}:{command:"project.open",label:"No project"},r?.isRepo===!0&&r.branch?{args:{tab:"review"},command:"publish.open",label:`⑂ ${r.branch}${QH(r.ahead,r.behind)}`,title:`${ZH(r.files.length)} on ${r.branch}`}:null,a?{command:a.command,label:a.label,title:a.title}:null,o>0?{args:{tab:"problems"},command:"view.setBottomTab",label:`⚠ ${o}`,title:o===1?"1 problem":`${o} problems`}:null,i>0?{command:"collab.showStatus",label:`${i} peer${i===1?"":"s"}`,title:`${i} peer${i===1?"":"s"} in this document`}:null])}function tB(e){let t=h.value;if(t?.session.ui.canvasMode===Ou){let o=om(t);return o?Kf(e,"selection",[{command:null,label:o.replaceAll(" "," › "),title:"The style rule being edited"}]):null}let r=t?.session.selection??[];return r.length>1?Kf(e,"selection",[{command:null,label:`${r.length} selected`,title:`${r.length} elements are selected; the trail names the primary`}]):null}function zS(e){return e.filter((t)=>t!==null)}var Pi=null,Ei=null,wc=null;function HS(){return Pi??=g({hasDocument:!1,leading:[],run:(e)=>{let t=[...Pi?.leading??[],...Pi?.trailing??[]].flatMap((o)=>o.items).find((o)=>o.key===e),r=ae();if(t?.command&&r)Tn(r,t.command,t.args,"Status Bar")},trailing:[]}),Pi}function nB(){let e=DI;if(Ei||!e)return;let t=R("statusbar",HS(),e);Ei=t,t.then((r)=>{if(Ei!==t)return;wc=r,Gf(e.querySelector('[part="trail"]'))})}function Yf(){let e=ae(),t=HS();t.leading=zS([eB(e)]),t.hasDocument=h.value!==null,t.trailing=zS([tB(e)]),nB()}function BS(){rB(),AS(),xc=me(),xc.run(()=>{te(()=>{ae(),u.stylebook.selection,h.value?.session.ui.canvasMode,u.git.status,ta.length;let e=h.value;if(e)e.session.selection.length,xn(e).peers.length;Yf()})})}function rB(){xc?.stop(),xc=null;let e=Ei;if(Ei=null,OS(),wc)wc.dispose(),wc=null;else if(e)e.then((t)=>t.dispose());Pi=null}var VS={$schema:"https://jxsuite.com/schema/v1",$id:"StudioPanelElements",$description:"The Insert panel: the palette a page is built out of. One filter, then one accordion — the project's own components first, then the HTML elements by category — and a card per thing that can be inserted. The adapter (`surfaces/panel-elements.ts`) is handed sections whose cards are already filtered, already open or closed, and already carry the tag they insert, so nothing here asks what an element is, which npm components the document has enabled, or what the filter means. A card is inserted by CLICK from this document and by DRAG from `panels/dnd.ts`, which registers against the painted card — that seam is why three class names survive the conversion, and the style block says why.",tagName:"div",attributes:{part:"palette"},style:{$description:"What this block does NOT contain is most of the conversion. `.elements-list` and `.elements-list sp-accordion-item` are gone rather than moved: the first removed a border Spectrum's accordion drew and the kit's does not, and the second drew the hairline between two sections and set an 11px header — `jx-accordion` draws that separator itself (`& > :not([hidden]) ~ *`) and `jx-accordion-item` owns its own summary, so transcribing either would be re-deciding something the kit has already decided. `.element-card`, `.element-card-preview` and `.element-card-label` are NOT this document's to take, and that is why they are still spelled as classes here: the same card is drawn by `panels/stylebook-doc.ts` for its specimens and re-declared inside the canvas iframe by `canvas/iframe-render.ts`, and `panels/dnd.ts` addresses `.components-section` and `.element-card-preview` BY SELECTOR to hang the drag on a row and to fill its preview with a live element. A card is a shared object with three readers; moving its look in here would fork it. An element card's preview is drawn EMPTY for the same reason: `dnd.ts` fills it with the element rendered live, and it fills only a preview it finds with no children in it. What is left below is what belongs to the palette alone.",display:"flex",flexDirection:"column",minHeight:"0",fontFamily:"var(--jx-font-sans)",color:"var(--fg)",'& [part="filter"]':{$description:"The filter is inset from the panel's edges; `.panel-body` sets `padding: 0`, so the field sat flush against three of them. It stretches because the palette is a flex column, which is also what `sp-search` got for free from being a block.",margin:"var(--jx-space-2)"},'& [part="empty"]':{$description:"The one empty-state pattern (`panels/empty-state.ts`), drawn here because a document cannot render a lit helper. `.empty-state` and `.empty-state--teach` keep their stylesheet — every panel still lit renders through that helper — so this is a copy rather than a move, and it goes when the last of them converts. Its 13px was the one value with no token behind it; the kit's `--jx-text-md` is the scale this chrome is on.",display:"flex",flexDirection:"column",alignItems:"center",gap:"var(--jx-space-3)",padding:"var(--jx-space-6)",textAlign:"center",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"},'& [part="empty-message"]':{margin:"0",maxWidth:"34ch",lineHeight:"1.5"},'& [part="component-tag"]':{$description:"What a component card shows until `panels/dnd.ts` replaces it with the component rendered live. It was an inline `style=` reading `--spectrum-font-size-50` with an 11px fallback — a name that resolves only inside `<sp-theme>`, and this document is mounted into the Navigator's panel body, where that element is not an ancestor — so the size is the kit's scale and the colour the studio layer's.",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)",fontStyle:"italic"}},children:[{tagName:"jx-textfield",attributes:{part:"filter"},$props:{size:"sm",type:"search",clearable:!0,label:"Filter elements",placeholder:"Filter elements…",value:{$ref:"#/state/filter"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setFilter"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"div",attributes:{part:"empty-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/emptyState"},cases:{filtered:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",attributes:{part:"empty-message"},textContent:"Nothing here matches “${state.filter}”."},{tagName:"div",attributes:{part:"empty-actions"},children:[{tagName:"jx-button",$props:{size:"sm"},attributes:{part:"clear-filter"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/clearFilter"}}]},children:[{tagName:"span",textContent:"Clear the filter"}]}]}]},empty:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",attributes:{part:"empty-message"},textContent:"Elements you can drop onto the page live here — text, images, layout containers and your own components."}]}}},{tagName:"jx-accordion",attributes:{part:"list"},children:[{tagName:"div",attributes:{part:"components-slot",role:"none",hidden:"${state.hasComponents ? null : ''}"},style:{$description:"The section stands or falls as a whole, so the slot is `display: contents` — the accordion item inside it has to be the accordion's own layout child. `hidden` is what keeps the separator honest: `jx-accordion` gives a top border to every child that FOLLOWS a visible one, so an empty slot left visible would draw a line above the first category with nothing above it.",display:"contents"},$switch:{$ref:"#/state/hasComponents"},cases:{true:{tagName:"jx-accordion-item",$props:{label:"Components",open:{$ref:"#/state/componentsOpen"}},attributes:{"data-section":"components"},ontoggle:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setComponentsOpen"},value:[{$ref:"event#/detail"}]}]},children:[{tagName:"div",attributes:{class:"components-section"},children:[{$prototype:"Array",items:{$ref:"#/state/components"},key:{$ref:"$map/item/tagName"},map:{tagName:"div",attributes:{class:"element-card","data-component-tag":"${$map.item.tagName}",title:"${$map.item.title}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/insertComponent"},value:[{$ref:"$map/item/tagName"}]}]},children:[{tagName:"div",attributes:{class:"element-card-preview"},children:[{tagName:"span",attributes:{part:"component-tag"},textContent:"<${$map.item.tagName}>"}]},{tagName:"div",attributes:{class:"element-card-label"},textContent:"${$map.item.tagName}"}]}}]}]}}},{$prototype:"Array",items:{$ref:"#/state/categories"},key:{$ref:"$map/item/name"},map:{tagName:"jx-accordion-item",$props:{label:{$ref:"$map/item/name"},open:{$ref:"$map/item/open"}},attributes:{"data-section":"${$map.item.name}"},ontoggle:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setSectionOpen"},value:[{$ref:"$map/item/name"},{$ref:"event#/detail"}]}]},children:[{$prototype:"Array",items:{$ref:"$map/item/elements"},key:{$ref:"$map/item/tag"},map:{tagName:"div",attributes:{class:"element-card","data-block-tag":"${$map.item.tag}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/insertElement"},value:[{$ref:"$map/item/tag"}]}]},children:[{tagName:"div",attributes:{class:"element-card-preview"}},{tagName:"div",attributes:{class:"element-card-label"},textContent:"<${$map.item.tag}>"}]}}]}}]}]};E("panel-elements",VS);function WS(e,t){e.filter=t.filter,e.categories=t.categories,e.components=t.components,e.componentsOpen=t.componentsOpen,e.hasComponents=t.hasComponents,e.emptyState=t.emptyState}function KS(e,t,r){let o=g({categories:[],clearFilter:r.clearFilter,components:[],componentsOpen:!0,emptyState:"none",filter:"",hasComponents:!1,insertComponent:r.insertComponent,insertElement:r.insertElement,setComponentsOpen:r.setComponentsOpen,setFilter:r.setFilter,setSectionOpen:r.setSectionOpen});WS(o,t);let a=null,i=!1,s=R("panel-elements",o,e).then((l)=>{if(i){l.dispose();return}a=l});return{connected:()=>!i&&(a===null||a.root.parentNode===e),dispose(){i=!0,a?.dispose(),a=null},ready:s,update:(l)=>WS(o,l)}}var QS="Components",Ur=null,hn=null;function aB(){return st.elementsFilter.toLowerCase()}function iB(e,t){let r=[];for(let[o,a]of Object.entries(e.elements??{})){let i=t?a.filter((s)=>s.tag.includes(t)):a;if(i.length===0)continue;r.push({elements:i.map(({tag:s})=>({tag:s})),name:o,open:!st.elementsCollapsed.has(o)})}return r}function sB(){let e=h.value,t=xx(e?.doc.document?.$elements),r=new Set;for(let o of t){if(!n(o))continue;let a=Ne.find((i)=>i.source==="npm"&&i.modulePath&&o===`${i.package}/${i.modulePath}`);if(a){r.add(a.tagName);continue}for(let i of Ne)if(i.source==="npm"&&i.package===o)r.add(i.tagName)}return r}function lB(e){if(Ne.length===0)return[];let t=sB();return Ne.filter((r)=>r.source!=="npm"||t.has(r.tagName)).filter((r)=>!e||r.tagName.toLowerCase().includes(e)).map((r)=>({tagName:r.tagName,title:r.source==="npm"?`${r.package}: <${r.tagName}>`:r.path??r.tagName}))}function ZS(e){let t=aB(),r=iB(e.webdata,t),o=lB(t),a=r.length===0&&o.length===0;return{categories:r,components:o,componentsOpen:!st.elementsCollapsed.has(QS),emptyState:a?t?"filtered":"empty":"none",filter:st.elementsFilter,hasComponents:o.length>0}}function YS(e){let t=h.value;if(!t)return;let r=Oe(t.session.selection)??[],o=oe(t.doc.document,r),a=rr(o).length;Z(t,(i)=>{or(i,r,a,structuredClone(e)),Op(i,e.tagName)})}function Ni(){let e=hn;if(!e||!Ur)return;e.handle.update(ZS(Ur)),e.handle.ready.then(()=>{if(hn!==e)return;Ur?.registerElementsDnD(),Ur?.registerComponentsDnD()})}var cB={clearFilter:()=>{st.elementsFilter="",Ni()},insertComponent:(e)=>{let t=Ne.find((r)=>r.tagName===e);if(t)YS(Uc(t))},insertElement:(e)=>{if(Ur)YS(Ur.defaultDef(e))},setComponentsOpen:(e)=>{XS(QS,!e),Ni()},setFilter:(e)=>{st.elementsFilter=e,Ni()},setSectionOpen:(e,t)=>{XS(e,!t),Ni()}};function XS(e,t){if(t)st.elementsCollapsed.add(e);else st.elementsCollapsed.delete(e)}function dB(e,t){Ur=e.deps;let r=t.querySelector(".panel-content")??t;if(hn&&(hn.host!==r||!hn.handle.connected()))hn.handle.dispose(),hn=null;if(!hn)hn={handle:KS(r,ZS(e.deps),cB),host:r};Ni()}function eC(){ei({id:"insert",title:"Insert",level:"document",dock:"navigator",icon:"grid-four",rail:!1,render:()=>ft,afterRender:(e,t)=>{dB(e,t)}})}var tC={$schema:"https://jxsuite.com/schema/v1",$id:"StudioPanelI18n",$description:"The Languages panel: a grid over ABSENCE, one row per translation key and one column per declared locale, drawn from the projection `panels/i18n-panel.ts` hands in. Every square is a button and every button is a command run by id, so the document draws a state, a glyph and a sentence and decides nothing: which command a cell runs, whether it is refused and what the refusal says are all settled before the scope is written. Three bodies rather than one, because a monolingual project and a project still being read are not empty versions of the grid — they are different answers to the same question.",tagName:"div",attributes:{part:"panel"},style:{$description:"The panel's own look, taken out of `styles/panels.css`'s `.i18n-*` block. Three tokens changed meaning on the way: `--spectrum-font-size-50`, `--spectrum-font-size-75` and `--spectrum-corner-radius-75` resolved only inside `<sp-theme>`, and this document is mounted into the Navigator's `.panel-body`, where that element is not an ancestor — every one of them would silently have taken its px fallback. They are the kit's scale here (`--jx-text-sm`, `--jx-text-md`, `--jx-radius-xs`), which is what those three Spectrum steps were.",display:"flex",flexDirection:"column",gap:"8px",padding:"8px",minWidth:"0",fontFamily:"var(--jx-font-sans)",color:"var(--fg)",'& [part="empty"]':{$description:"The teaching empty state, drawn here rather than borrowed from `panels/empty-state.ts`: that helper is a lit template and a document cannot call one. Its rules are what is kept — one sentence saying what the region is FOR, then where its content comes from, then the action that fills it — in the centred shape a whole empty region uses.",display:"flex",flexDirection:"column",alignItems:"center",gap:"8px",padding:"24px",textAlign:"center",fontSize:"13px",color:"var(--fg-dim)"},'& [part="empty"][data-compact="true"]':{$description:"The same state as a note INSIDE an otherwise populated panel — the grid's summary and its Rescan button are still above it, so a centred block with 24px of air around it would read as a second, emptier panel.",alignItems:"flex-start",gap:"4px",padding:"8px 12px",textAlign:"left",fontSize:"var(--jx-text-sm)"},'& [part="empty-message"], & [part="empty-detail"]':{margin:"0",maxWidth:"34ch",lineHeight:"1.5"},'& [part="empty-detail"]':{fontSize:"var(--jx-text-sm)",opacity:"0.8"},'& [part="empty-actions"]':{display:"flex",flexWrap:"wrap",justifyContent:"center",gap:"8px"},'& [part="actions"]':{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:"8px"},'& [part="summary"]':{margin:"0",minWidth:"0",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)"},'& [part="rescan"]':{flex:"none",padding:"2px 8px",border:"1px solid var(--border)",borderRadius:"var(--jx-radius-xs)",background:"transparent",color:"var(--fg-dim)",font:"inherit",fontSize:"var(--jx-text-sm)",cursor:"pointer"},'& [part="rescan"]:hover':{color:"var(--fg)",background:"var(--hover-bg)"},'& [part="incomplete"]':{$description:"A directory the scan could not read makes the whole grid a partial answer, so it says so ABOVE the table rather than letting an unreadable `content/` read as a project with no content.",margin:"0",padding:"4px 6px",borderLeft:"3px solid var(--warning)",borderRadius:"var(--radius)",background:"var(--bg-panel)",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)"},'& [part="parity"]':{$description:"The Navigator is narrow and a key is a path, so the table scrolls sideways rather than wrapping every path onto four lines.",display:"block",overflowX:"auto",borderCollapse:"collapse",fontSize:"var(--jx-text-md)"},'& [part="key-head"], & [part="locale-head"]':{padding:"2px 6px",borderBottom:"1px solid var(--border)",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)",fontWeight:"700",textAlign:"start",textTransform:"uppercase",letterSpacing:"0.04em",whiteSpace:"nowrap"},'& [part="default-mark"]':{marginInlineStart:"4px",color:"var(--accent)",fontWeight:"400",textTransform:"none",letterSpacing:"normal"},'& [part="row"]:hover':{background:"var(--hover-bg)"},'& [part="key"]':{maxWidth:"220px",overflow:"hidden",padding:"2px 6px",color:"var(--fg)",fontFamily:"var(--font-mono)",fontSize:"var(--jx-text-sm)",fontWeight:"400",textAlign:"start",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="cell"]':{padding:"2px 6px",textAlign:"center"},'& [part="cell-button"]':{$description:"The glyph carries the state and the colour repeats it, the way a problem row's severity does, because a column of squares is read by scanning rather than by reading. The state is an attribute rather than a class: a document styles through `part` and the data it already carries, never through a class name (ui.md §3.1).",inlineSize:"22px",blockSize:"18px",border:"1px solid var(--border)",borderRadius:"var(--jx-radius-xs)",background:"transparent",color:"var(--fg-dim)",font:"inherit",fontSize:"var(--jx-text-md)",lineHeight:"1",cursor:"pointer"},'& [part="cell-button"]:hover:not(:disabled)':{background:"var(--hover-bg)"},'& [part="cell-button"]:disabled':{cursor:"default",opacity:"0.45"},'& [part="cell-button"][data-state="present"]':{color:"var(--success)"},'& [part="cell-button"][data-state="stale"]':{color:"var(--warning)",borderColor:"var(--warning)"},'& [part="cell-button"][data-state="missing"]':{color:"var(--accent)",borderStyle:"dashed"},'& [part="truncated"]':{margin:"0",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)"}},children:[{tagName:"div",attributes:{part:"body-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/mode"},cases:{mono:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",attributes:{part:"empty-message"},textContent:"This project is written in one language."},{tagName:"p",attributes:{part:"empty-detail"},textContent:"Declare them under Locales in the project's settings, then a page's translations are sibling files under a directory named for each language."},{tagName:"div",attributes:{part:"empty-actions"},children:[{tagName:"jx-button",$props:{size:"sm",disabled:{$ref:"#/state/settingsDisabled"}},attributes:{part:"settings"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openSettings"}}]},children:[{tagName:"span",textContent:"Open project settings…"}]}]}]},scanning:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",attributes:{part:"empty-message"},textContent:"Looking for translations…"},{tagName:"p",attributes:{part:"empty-detail"},textContent:"Reading pages/ and content/ to find out which languages each page is written in."}]},grid:{tagName:"div",attributes:{part:"grid",role:"none"},style:{display:"contents"},children:[{tagName:"div",attributes:{part:"actions"},children:[{tagName:"p",attributes:{part:"summary"},textContent:"${state.summary}"},{tagName:"button",attributes:{part:"rescan",type:"button",title:"Read pages/ and content/ again"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/rescan"}}]},textContent:"Rescan"}]},{tagName:"div",attributes:{part:"incomplete-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasIncomplete"},cases:{true:{tagName:"p",attributes:{part:"incomplete"},children:[{tagName:"span",textContent:"This list is incomplete — "},{tagName:"span",textContent:"${state.incomplete}"}]}}},{tagName:"div",attributes:{part:"list-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasRows"},cases:{false:{tagName:"div",attributes:{part:"empty","data-compact":"true"},children:[{tagName:"p",attributes:{part:"empty-message"},textContent:"There is nothing to translate yet."},{tagName:"p",attributes:{part:"empty-detail"},textContent:"Add a page under pages/, or an entry to a content collection."}]},true:{tagName:"table",attributes:{part:"parity"},children:[{tagName:"thead",children:[{tagName:"tr",children:[{tagName:"th",attributes:{part:"key-head",scope:"col"},textContent:"Page"},{$prototype:"Array",items:{$ref:"#/state/heads"},key:{$ref:"$map/item/locale"},map:{tagName:"th",attributes:{part:"locale-head",scope:"col",title:"${$map.item.locale}"},children:[{tagName:"span",textContent:"${$map.item.label}"},{tagName:"span",attributes:{part:"default-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/isDefault"},cases:{true:{tagName:"span",attributes:{part:"default-mark"},textContent:"source"}}}]}}]}]},{tagName:"tbody",children:[{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/key"},map:{tagName:"tr",attributes:{part:"row"},children:[{tagName:"th",attributes:{part:"key",scope:"row",title:"${$map.item.key}"},textContent:"${$map.item.key}"},{$prototype:"Array",items:{$ref:"$map/item/cells"},key:{$ref:"$map/item/locale"},map:{tagName:"td",attributes:{part:"cell"},children:[{tagName:"button",attributes:{part:"cell-button",type:"button","data-state":"${$map.item.state}",disabled:{$ref:"$map/item/disabled"},title:"${$map.item.title}","aria-label":"${$map.item.title}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/runCell"},value:[{$ref:"$map/item/command"},{$ref:"$map/item/locale"},{$ref:"$map/item/rowPath"}]}]},children:[{tagName:"span",attributes:{"aria-hidden":"true"},textContent:"${$map.item.glyph}"}]}]}}]}}]}]}}},{tagName:"div",attributes:{part:"truncated-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasTruncated"},cases:{true:{tagName:"p",attributes:{part:"truncated"},textContent:"${state.truncated}"}}}]}}}]};E("panel-i18n",tC);function nC(e,t){if(t.mode!==void 0)e.mode=t.mode;if(t.settingsDisabled!==void 0)e.settingsDisabled=t.settingsDisabled;if(t.summary!==void 0)e.summary=t.summary;if(t.incomplete!==void 0)e.incomplete=t.incomplete,e.hasIncomplete=t.incomplete!=="";if(t.truncated!==void 0)e.truncated=t.truncated,e.hasTruncated=t.truncated!=="";if(t.heads!==void 0)e.heads=t.heads;if(t.rows!==void 0)e.rows=t.rows,e.hasRows=t.rows.length>0}function mC(e,t,r){let o=g({hasIncomplete:!1,hasRows:!1,hasTruncated:!1,heads:[],incomplete:"",mode:"scanning",openSettings:r.openSettings,rescan:r.rescan,rows:[],runCell:r.runCell,settingsDisabled:!1,summary:"",truncated:""});nC(o,t);let a=null,i=!1;return R("panel-i18n",o,e).then((s)=>{if(i){s.dispose();return}a=s}),{connected:()=>!i&&(a===null||a.root.parentNode===e),dispose(){i=!0,a?.dispose(),a=null},update:(s)=>nC(o,s)}}var hC=["pages","content"],gC=200,Dn=null,kc=null;function uB(){Dn=null,kc=null}async function mB(e,t){try{let r=await xm(hC,p());Dn={declared:await fB(r.files),failures:r.failures,files:r.files,root:e}}catch(r){Dn={declared:new Map,failures:[{dir:hC.join(", "),error:X(r)}],files:[],root:e}}kc=null,t()}async function fB(e){let t=p(),r=e.filter((i)=>!i.media&&i.path.startsWith("pages/")),o=await Promise.all(r.map(async(i)=>{try{return await t.readFile(i.path)}catch{return null}})),a=new Map;for(let[i,s]of r.entries()){let l=o[i];if(!l?.includes("$translationKey"))continue;let f=/"\$translationKey"\s*:\s*"((?:[^"\\]|\\.)*)"/.exec(l)?.[1];if(f!==void 0&&f!=="")a.set(s.path,f.replaceAll(/\$\{(\w+)\}/g,"[$1]").replaceAll(/^\/+|\/+$/g,""))}return a}function bC(e){if(!e)return null;let t=Date.parse(e);return Number.isNaN(t)?null:t}function hB(e,t,r=new Map){let o=new Map,a=new Set(e.flatMap((l)=>l.media?[]:[mv(l.path,t)])),i=(l)=>{let f=r.get(l.path);if(f===void 0)return mv(l.path,t);let c=/\.[^./]+$/.exec(l.path)?.[0]??"";for(let d of[`pages/${f}${c}`,`pages/${f}/index${c}`])if(a.has(d))return d;return`pages/${f}${c}`};for(let l of e){if(l.media)continue;let f=i(l),c=go(l.path,t)??t.defaultLocale,d=o.get(f)??new Map;if(!d.has(c)||l.path===Qc(f,c,t))d.set(c,l);o.set(f,d)}let s=[];for(let[l,f]of o){let c=f.get(t.defaultLocale),d=bC(c?.modified),b=new Map;for(let y of t.locales){let x=f.get(y);if(!x){b.set(y,{path:Qc(l,y,t),state:"missing"});continue}let S=bC(x.modified),P=c!==void 0&&c.path!==x.path&&d!==null&&S!==null&&d>S;b.set(y,P?{behind:c.path,path:x.path,state:"stale"}:{path:x.path,state:"present"})}s.push({cells:b,key:l})}return s.toSorted((l,f)=>l.key.localeCompare(f.key))}var TC="settings.open",gB={missing:"i18n.createTranslation",present:"i18n.openTranslation",stale:"i18n.openTranslation"},bB={missing:"+",present:"✓",stale:"!"};function yB(e,t){let r=e.cells.get(t.defaultLocale);if(r&&r.state!=="missing")return r.path;for(let o of e.cells.values())if(o.state!=="missing")return o.path;return e.key}function vB(e,t){if(e.state==="missing"&&e.path===null)return"a file that can hold a locale directory — this one is under no collection";let r=ae();if(!r?.get(t))return"the Languages commands, which this window has not registered";return r.disabledReason(t)}function wB(e,t,r){let o=Wt(t),a=e.state==="missing"?e.path===null?`No place for a ${o} copy of this file`:`Create ${e.path}`:e.state==="stale"?`Open ${e.path} — older than ${e.behind}`:`Open ${e.path}`;return r===void 0?a:`${a} — requires ${r}`}function SC(e,t={}){let r=ae();if(!r?.get(e))return;Tn(r,e,t,"Languages")}function xB(e,t){let r=yB(e,t);return{cells:t.locales.map((a)=>{let i=e.cells.get(a)??{path:null,state:"missing"},s=gB[i.state],l=vB(i,s);return{command:s,disabled:l!==void 0,glyph:bB[i.state],locale:a,rowPath:r,state:i.state,title:wB(i,a,l)}}),key:e.key}}function kB(e){let t=0,r=0;for(let o of e)for(let a of o.cells.values())if(a.state==="missing")t+=1;else if(a.state==="stale")r+=1;return{missing:t,stale:r}}function $B(e){let{missing:t,stale:r}=kB(e),o=`${e.length} page${e.length===1?"":"s"}`;if(t===0&&r===0)return`${o}, translated into every declared language.`;let a=[];if(t>0)a.push(`${t} not written`);if(r>0)a.push(`${r} older than their source`);return`${o} — ${a.join(", ")}.`}function Xf(e){return{heads:[],incomplete:"",mode:e,rows:[],settingsDisabled:ae()?.get(TC)===void 0,summary:"",truncated:""}}function SB(e){let t=Ts();if(t===null||t.locales.length<2)return Xf("mono");let r=C?.projectRoot??"";if(Dn===null||Dn.root!==r){if(kc!==r)kc=r,mB(r,e.rerender);return Xf("scanning")}let o=hB(Dn.files,t,Dn.declared),a=o.slice(0,gC),i=o.length-a.length;return{...Xf("grid"),heads:t.locales.map((s)=>({isDefault:s===t.defaultLocale,label:Wt(s),locale:s})),incomplete:Dn.failures.map((s)=>`${s.dir} (${s.error})`).join("; "),rows:a.map((s)=>xB(s,t)),summary:$B(o),truncated:i>0?`${i} more page${i===1?" is":"s are"} not shown — the grid stops at `+`${gC}.`:""}}var jC=()=>{},CB={openSettings:()=>{SC(TC,{section:"locales"})},rescan:()=>{uB(),jC()},runCell:(e,t,r)=>{SC(e,{locale:t,path:r})}},Mn=null;function TB(e,t){({rerender:jC}=e);let r=t.querySelector(".panel-content")??t;if(Mn&&(Mn.host!==r||!Mn.handle.connected()))Mn.handle.dispose(),Mn=null;let o=SB(e);if(Mn){Mn.handle.update(o);return}Mn={handle:mC(r,o,CB),host:r}}function OC(){ei({id:"i18n",title:"Languages",level:"project",dock:"navigator",icon:"globe",rail:!1,when:(e)=>e.project.isMultilingual,render:()=>ft,afterRender:(e,t)=>{TB(e,t)}})}var MC={$schema:"https://jxsuite.com/schema/v1",$id:"StudioPanelImports",$description:"The Navigator's Packages panel: what the thing in front of you is allowed to use. It has two moods and one shape. Over `project.json` it lists the project's imported modules and offers the two npm verbs a project has — install a package, uninstall one; over a page, layout or component it lists that document's `$ref` imports and the picker that adds one. Both moods then draw the same thing underneath — one section per npm package the registry knows, with a checkbox per element, which is the cherry-pick. The adapter (`surfaces/panel-imports.ts`) hands in rows that are already strings and booleans: nothing here asks what a specifier is, whether an element is already imported, or which of the two moods a document is in. A component row carries an `id` the flow minted, because the two arrays are NESTED and `$map/item` inside the inner one is the element rather than the package it came from — so the row cannot name its own package and does not have to.",tagName:"div",attributes:{part:"imports"},style:{$description:"The panel's own look, keyed on `part`. Thirteen `.import*` rules in `styles/panels.css` become the parts below — `.imports-panel`'s own scroll and padding are the root's declarations here — and exactly one does not come with them: `.import-add-form sp-textfield` reached INSIDE another component to widen it, which is a thing a part cannot do and no longer has to, because `[part=\"field\"]` is the field itself. Five names that never had a rule at all travel with them and stop being names: `imports-component-list`, `import-component-row`, `import-component-label`, `import-add-name` and `import-add-path` were handles rather than styling, and a `part` is the handle now. Two token repairs came too. `--spectrum-font-size-50` resolved only inside `<sp-theme>` and a document is mounted outside it, so every row that read it would silently have taken its 11px fallback; each is `--jx-text-sm` here. And `.imports-count` read `--text-hint`, a name NO stylesheet in this package defines — an unresolvable custom property makes the whole declaration invalid at computed-value time, so the count has been inheriting its colour all along rather than taking the one that was written for it. It says `--fg-dim`, which is what it was drawing anyway.",display:"block",overflowY:"auto",padding:"var(--jx-space-2)",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-sm)",color:"var(--fg)",'& [part="section"]':{marginBottom:"var(--jx-space-4)"},'& [part="section-header"]':{$description:'The uppercase band every section opens with. It is the only thing that ever styled a section title, which is why `[part="title"]` below carries one declaration and not six: the weight, the size, the colour and the letter-spacing are all inherited from here.',display:"flex",alignItems:"center",gap:"6px",padding:"6px 8px 2px",fontSize:"var(--jx-text-sm)",fontWeight:"600",color:"var(--fg-dim)",textTransform:"uppercase",letterSpacing:"0.5px"},'& [part="title"][data-mono]':{$description:"A package name is an identifier, so it is set in the monospace face and NOT uppercased. The uppercasing is the header's, and it applied to these titles too: `@acme/kit` was drawn as `@ACME/KIT`, which is a name npm does not have. Case is meaning here, so the band's transform stops at this one part.",fontFamily:"var(--font-mono)",textTransform:"none"},'& [part="count"]':{fontWeight:"400",color:"var(--fg-dim)"},'& [part="list"]':{padding:"0 var(--jx-space-2)"},'& [part="components"]':{padding:"0 var(--jx-space-2)"},'& [part="row"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",padding:"3px var(--jx-space-2)",borderRadius:"var(--radius)"},'& [part="row"]:hover':{background:"var(--hover-bg)"},'& [part="name"]':{fontWeight:"500",whiteSpace:"nowrap"},'& [part="path"]':{$description:"The specifier: a module path or a `$ref`. It takes the row's slack and ellipses rather than wrapping, because a row is a line and a wrapped path would push the remove button off the one the eye is on. The `title` attribute beside it is what makes the full text readable when it does.",flex:"1",minWidth:"0",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontFamily:"var(--font-mono)",fontSize:"var(--jx-text-xs)",color:"var(--fg-dim)"},'& [part="empty"]':{$description:"The compact teaching state, drawn here rather than by `panels/empty-state.ts`: that helper is a lit template, and a surface is a document or a lit template and never a mix. It keeps the compact variant's shape — left-aligned, above the add form that IS its action, so it offers no button of its own (empty-state rule 2's stated exception).",margin:"0",padding:"var(--jx-space-3) var(--jx-space-4)",maxWidth:"34ch",lineHeight:"1.5",color:"var(--fg-dim)"},'& [part="add"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",padding:"var(--jx-space-2)"},'& [part="field"]':{flex:"1",minWidth:"0"},'& [part="picker"]':{width:"100%"},'& [part="component-label"]':{fontFamily:"var(--font-mono)"}},children:[{tagName:"div",attributes:{part:"mood-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/mode"},cases:{site:{tagName:"div",attributes:{part:"section","data-section":"modules"},children:[{tagName:"div",attributes:{part:"section-header"},children:[{tagName:"span",attributes:{part:"title"},textContent:"Imported Modules"},{tagName:"span",attributes:{part:"count"},textContent:"${state.moduleCount}"}]},{tagName:"div",attributes:{part:"modules-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/moduleState"},cases:{empty:{tagName:"p",attributes:{part:"empty"},textContent:"Imported modules give this project extra kinds of data — a content collection, a CMS, an API client. Name one below."},listed:{tagName:"div",attributes:{part:"list"},children:[{$prototype:"Array",items:{$ref:"#/state/modules"},key:{$ref:"$map/item/name"},map:{tagName:"div",attributes:{part:"row","data-import":"${$map.item.name}"},children:[{tagName:"span",attributes:{part:"name",title:"${$map.item.path}"},textContent:"${$map.item.name}"},{tagName:"span",attributes:{part:"path"},textContent:"${$map.item.path}"},{tagName:"jx-action-button",attributes:{part:"remove"},$props:{icon:"x",size:"sm",quiet:!0,label:"Remove the ${$map.item.name} import",hint:"Remove"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/removeModule"},value:[{$ref:"$map/item/name"}]}]}}]}}]}}},{tagName:"div",attributes:{part:"add","data-add":"import"},children:[{tagName:"jx-textfield",attributes:{part:"field","data-field":"name"},$props:{label:"Import name",placeholder:"Name",size:"sm",value:{$ref:"#/state/addName"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editName"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"jx-textfield",attributes:{part:"field","data-field":"path"},$props:{label:"Import path",placeholder:"Path",size:"sm",mono:!0,value:{$ref:"#/state/addPath"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editPath"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"jx-action-button",attributes:{part:"add-button","data-add":"import"},$props:{icon:"plus",size:"sm",quiet:!0,label:"Add import",hint:"Add import"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/addModule"},value:[]}]}}]}]},document:{tagName:"div",attributes:{part:"section","data-section":"refs"},children:[{tagName:"div",attributes:{part:"section-header"},children:[{tagName:"span",attributes:{part:"title"},textContent:"Components"},{tagName:"span",attributes:{part:"count"},textContent:"${state.refCount}"}]},{tagName:"div",attributes:{part:"refs-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/refState"},cases:{empty:{tagName:"p",attributes:{part:"empty"},textContent:"${state.refEmptyMessage}"},listed:{tagName:"div",attributes:{part:"list"},children:[{$prototype:"Array",items:{$ref:"#/state/refs"},key:{$ref:"$map/item/ref"},map:{tagName:"div",attributes:{part:"row","data-ref":"${$map.item.ref}"},children:[{tagName:"span",attributes:{part:"path",title:"${$map.item.ref}"},textContent:"${$map.item.ref}"},{tagName:"jx-action-button",attributes:{part:"remove"},$props:{icon:"x",size:"sm",quiet:!0,label:"Remove the ${$map.item.ref} import",hint:"Remove"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/removeRef"},value:[{$ref:"$map/item/ref"}]}]}}]}}]}}},{tagName:"div",attributes:{part:"picker-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasOptions"},cases:{true:{tagName:"div",attributes:{part:"add","data-add":"component"},children:[{tagName:"jx-select",attributes:{part:"picker"},$props:{label:"Add component",size:"sm",options:{$ref:"#/state/pickerOptions"},value:{$ref:"#/state/pickerValue"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/pick"},value:[{$ref:"event#/target/value"}]}]}}]}}}]}}},{$prototype:"Array",items:{$ref:"#/state/packages"},key:{$ref:"$map/item/name"},map:{tagName:"div",attributes:{part:"section","data-package":"${$map.item.name}"},children:[{tagName:"div",attributes:{part:"section-header"},children:[{tagName:"span",attributes:{part:"title","data-mono":"true"},textContent:"${$map.item.name}"},{tagName:"div",attributes:{part:"remove-package-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/canRemove"},cases:{true:{tagName:"jx-action-button",attributes:{part:"remove-package"},$props:{icon:"x",size:"sm",quiet:!0,label:"Remove the ${$map.item.name} package",hint:"Remove package"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/removePackage"},value:[{$ref:"$map/item/name"}]}]}}}}]},{tagName:"div",attributes:{part:"components"},children:[{$prototype:"Array",items:{$ref:"$map/item/components"},key:{$ref:"$map/item/id"},map:{tagName:"div",attributes:{part:"row","data-component":"${$map.item.id}"},children:[{tagName:"jx-checkbox",attributes:{part:"component"},$props:{size:"sm",checked:{$ref:"$map/item/enabled"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/toggleComponent"},value:[{$ref:"$map/item/id"},{$ref:"event#/target/checked"}]}]},children:[{tagName:"span",attributes:{part:"component-label"},textContent:"${$map.item.label}"}]}]}}]}]}},{tagName:"div",attributes:{part:"dependency-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/mode"},cases:{site:{tagName:"div",attributes:{part:"section","data-section":"add-dependency"},children:[{tagName:"div",attributes:{part:"section-header"},children:[{tagName:"span",attributes:{part:"title"},textContent:"Add Dependency"}]},{tagName:"div",attributes:{part:"add","data-add":"package"},children:[{tagName:"jx-textfield",attributes:{part:"field","data-field":"package"},$props:{label:"Package name",placeholder:"Package name…",size:"sm",value:{$ref:"#/state/addPackageValue"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editPackage"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/addPackage"},value:[]}]}}]}},{tagName:"jx-action-button",attributes:{part:"add-button","data-add":"package"},$props:{icon:"plus",size:"sm",quiet:!0,label:"Add package",hint:"Add package"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/addPackage"},value:[]}]}}]}]}}}]};E("panel-imports",MC);var DC=new WeakMap,EB={label:"Add component…",value:""};function BC(e){return{...e,hasOptions:e.pickerOptions.length>0,moduleCount:e.modules.length,moduleState:e.modules.length===0?"empty":"listed",pickerOptions:[EB,...e.pickerOptions],refCount:e.refs.length,refState:e.refs.length===0?"empty":"listed"}}function qC(e,t,r){let o=DC.get(e);if(o&&(o.handle===null||o.handle.root.isConnected)){Object.assign(o.scope,BC(t));return}o?.handle?.dispose(),e.textContent="";let a=g({...BC(t),...r}),i={handle:null,scope:a};DC.set(e,i),R("panel-imports",a,e).then((s)=>{i.handle=s})}var $c=null,Sc=null,Xo="",Qo="",Zo="",Cc="",Qf=new Map;function NB(e,t){return`${e}::${t.tagName}`}function jB(){let e=new Map;for(let t of Ne){if(t.source!=="npm"||!t.package||!t.modulePath)continue;let r=e.get(t.package);if(!r)r=[],e.set(t.package,r);r.push(t)}return e}function Zf(){return C?.projectConfig?.$elements??[]}function UC(e,t,r){return Qf.clear(),[...jB().entries()].map(([o,a])=>({canRemove:r,components:a.map((i)=>{let s=NB(o,i);return Qf.set(s,i),{enabled:KL(e,i,t),id:s,label:`<${i.tagName}>`}}),name:o}))}function RB(){let e=C?.projectConfig?.imports??{};return{addName:Xo,addPackageValue:Zo,addPath:Qo,mode:"site",modules:Object.entries(e).map(([t,r])=>({name:t,path:String(r)})),packages:UC(Zf(),null,!0),pickerOptions:[],pickerValue:"",refEmptyMessage:"",refs:[]}}function AB(e){let{documentElements:t,documentPath:r}=e,o=t.flatMap((l)=>{let f=_(l)?l.$ref:void 0;return n(f)?[{ref:f}]:[]}),a=t.filter((l)=>n(l)),i=new Set(o.map((l)=>l.ref)),s=Ne.filter((l)=>l.source!=="npm"&&l.path!=null&&!i.has(`./${l.path}`)&&!i.has(l.path)).map((l)=>({label:`<${l.tagName}>`,value:l.tagName}));return{addName:Xo,addPackageValue:Zo,addPath:Qo,mode:"document",modules:[],packages:UC(a,r,!1),pickerOptions:s,pickerValue:Cc,refEmptyMessage:s.length>0?"Components you add here can be dropped onto this page. Pick one below.":"Components you add here can be dropped onto this page. "+"This project has none yet — create one from any selection on the canvas.",refs:o}}function IB(e){return e.documentPath?.endsWith("project.json")?RB():AB(e)}function zn(){if(!$c||!Sc)return;qC($c,IB(Sc),HB)}function Jr(){return Sc}async function LB(){let e=Xo.trim(),t=Qo.trim();if(!e||!t)return;let r=C?.projectConfig?.imports??{};Xo="",Qo="",zn(),await no({imports:{...r,[e]:t}}),Jr()?.renderLeftPanel()}async function OB(e){let t={...C?.projectConfig?.imports};delete t[e],await no({imports:t}),Jr()?.renderLeftPanel()}async function MB(){let e=Zo.trim();if(!e)return;Zo="",zn();try{await p().addPackage(e);let{loadComponentRegistry:t}=await (ce("w5zqwva1"),import("./chunks/components-w5zqwva1.js"));await t(),Jr()?.renderLeftPanel()}catch(t){console.error("Failed to add package:",t)}}async function DB(e){if(!await qo("Remove Package",`Remove ${e}?`,{confirmLabel:"Remove",destructive:!0}))return;try{await p().removePackage(e);let r=WA(Zf(),e),{loadComponentRegistry:o}=await (ce("w5zqwva1"),import("./chunks/components-w5zqwva1.js"));await o(),await no({$elements:r}),Jr()?.renderLeftPanel()}catch(r){console.error("Failed to remove package:",r)}}async function FB(e,t){let r=Jr(),o=Qf.get(e);if(!r||!o)return;if(r.documentPath?.endsWith("project.json")){let a=Zf(),i=t?Kb(a,o,null):JL(a,o,null);await no({$elements:i}),r.renderLeftPanel();return}r.applyMutation((a)=>{let i=a.$elements??[];a.$elements=t?Kb(i,o,r.documentPath):JL(i,o,r.documentPath)}),r.renderLeftPanel()}function _B(e){let t=Jr();if(Cc=e,zn(),Cc="",zn(),!t||!e)return;let r=Ne.find((o)=>o.tagName===e);if(!r?.path)return;t.applyMutation((o)=>{o.$elements=Kb(o.$elements??[],r,t.documentPath)}),t.renderLeftPanel()}function zB(e){let t=Jr();if(!t)return;t.applyMutation((r)=>{r.$elements=VA(r.$elements??[],e)}),t.renderLeftPanel()}var HB={addModule:()=>{LB()},addPackage:()=>{MB()},editName:(e)=>{Xo=e,zn()},editPackage:(e)=>{Zo=e,zn()},editPath:(e)=>{Qo=e,zn()},pick:_B,removeModule:(e)=>{OB(e)},removePackage:(e)=>{DB(e)},removeRef:zB,toggleComponent:(e,t)=>{FB(e,t)}};function BB(e,t){if(e!==$c)Xo="",Qo="",Zo="",Cc="";$c=e,Sc=t,zn()}function VB(e){return e.querySelector(".panel-content")??e}function JC(){ei({id:"packages",title:"Packages",level:"document",dock:"navigator",icon:"cube",rail:"developer",requiresDocument:"Open a page to choose which components it can use.",render:()=>ft,afterRender:(e,t)=>{BB(VB(t),{applyMutation:(r)=>{Yd(h.value,r)},documentElements:e.doc?.document.$elements??[],documentPath:e.doc?.documentPath??null,renderLeftPanel:e.rerender})}})}var GC={$schema:"https://jxsuite.com/schema/v1",$id:"StudioPanelProblems",$description:"The Bottom dock's Problems tab: everything that must be fixed, listed until it is. The adapter hands in one projection per row — its severity glyph, its message, the file it names, the captured log, and, where a recovery command exists, that command's own title and gate — grouped under the source that raised them in first-seen order. Nothing here reads the notification store or the command registry; a row asks the host to open, to run, or to dismiss, by the id it was given.",tagName:"div",attributes:{part:"panel"},style:{$description:"What `.problems-panel`, `.problems-clear`, `.problem-group`, `.problem-group-title`, `.problem-list`, `.problem-row`, `.problem-icon`, `.problem-body`, `.problem-message`, `.problem-path`, `.problem-detail`, `.problem-action` and `.problem-dismiss` said in `styles/panels.css`, keyed on `part` and re-pointed at the studio token layer. Six of those rules are SHARED SELECTORS — `.problems-clear, .activity-clear` and five `.problem-*, .activity-*` pairs — so this document carries its own copy rather than moving one: the `.problem-*` half of each pair is dead the moment this lands, and the stylesheet rule itself can only go when the Activity panel has moved too. Nothing is deleted from `styles/panels.css` here. Three token names could not come with the declarations: `var(--spectrum-font-size-50, 11px)` (the Clear button, the group heading, the path and the log), `var(--spectrum-font-size-75, 12px)` (the row) and `var(--spectrum-corner-radius-75, 2px)` (three rules). Every one of them resolves only inside `<sp-theme>`, and a document mounted in the dock body would have taken the hard-coded fallback every time, so they are the kit's `--jx-text-sm`, `--jx-text-md` and `--jx-radius-xs` instead.",display:"flex",flexDirection:"column",minHeight:"0",fontFamily:"var(--jx-font-sans)",color:"var(--fg)",'& [part="body"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-3)",padding:"var(--jx-space-3)"},'& [part="actions"]':{display:"flex",justifyContent:"flex-end"},'& [part="clear"] > [part="control"]':{$description:"Bordered but unfilled, and dimmed until it is wanted: emptying the list is the one destructive control on this surface and it sits above rows the reader has not finished reading yet.",padding:"0 var(--jx-space-3)",border:"1px solid var(--border)",borderRadius:"var(--jx-radius-xs)",background:"transparent",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)",":hover":{color:"var(--fg)",background:"var(--hover-bg)"}},'& [part="group"]':{$description:"One source's rows, under its heading. A section rather than a run of rows so the heading and the problems it names cannot be separated by a scroll position.",display:"flex",flexDirection:"column",gap:"var(--jx-space-2)"},'& [part="group-title"]':{margin:"0 0 var(--jx-space-1)",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)",fontWeight:"700",textTransform:"uppercase",letterSpacing:"0.04em"},'& [part="list"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-2)",margin:"0",padding:"0",listStyle:"none"},'& [part="row"]':{display:"flex",alignItems:"flex-start",gap:"var(--jx-space-3)",padding:"6px var(--jx-space-3)",border:"1px solid var(--border)",borderLeft:"3px solid var(--fg-dim)",borderRadius:"var(--radius)",background:"var(--bg-panel)",color:"var(--fg)",fontSize:"var(--jx-text-md)"},'& [part="row"][data-severity="success"]':{borderLeftColor:"var(--success)"},'& [part="row"][data-severity="info"]':{borderLeftColor:"var(--accent)"},'& [part="row"][data-severity="warn"]':{borderLeftColor:"var(--warning)"},'& [part="row"][data-severity="error"]':{borderLeftColor:"var(--danger)"},'& [part="row"] > [part="icon"]':{$description:"The severity, twice: as the glyph and as the row's left edge. Colour is never the only encoding here, which is what keeps the row readable in the forced-colours block below, where every author colour is replaced by the user's palette.",flex:"none",width:"14px",textAlign:"center",fontWeight:"700",lineHeight:"1.5"},'& [part="row"][data-severity="success"] > [part="icon"]':{color:"var(--success)"},'& [part="row"][data-severity="info"] > [part="icon"]':{color:"var(--accent)"},'& [part="row"][data-severity="warn"] > [part="icon"]':{color:"var(--warning)"},'& [part="row"][data-severity="error"] > [part="icon"]':{color:"var(--danger)"},'& [part="row-body"]':{flex:"1",minWidth:"0",display:"flex",flexDirection:"column",gap:"var(--jx-space-1)"},'& [part="message"]':{overflowWrap:"anywhere"},'& [part="file-path"]':{$description:'The path is a control, not a label: it opens the file the problem is about, which is the click-through §16.1 asks for. Underlined on hover only — a permanently underlined path in a dense list reads as a paragraph of links. A plain button rather than a `jx-button`, for the reason the status bar\'s items are: what it has to look like is a line of text, and every fill, border and control height the kit draws would have to be taken back off again. Named `file-path` and not `path` because `jx-icon` puts `part="path"` on the `<path>` of every glyph it draws, so `[part="path"]` inside a row selects this button and both SVG paths beside it — a styling rule that reaches into the kit\'s own drawing, and a test or a devtools query that cannot tell them apart.',alignSelf:"flex-start",maxWidth:"100%",overflow:"hidden",margin:"0",padding:"0",border:"none",borderRadius:"var(--jx-radius-xs)",background:"none",color:"var(--accent)",font:"inherit",fontFamily:"var(--font-mono)",fontSize:"var(--jx-text-sm)",textOverflow:"ellipsis",whiteSpace:"nowrap",textAlign:"left",cursor:"pointer",":hover":{textDecoration:"underline"},":focus-visible":{outline:"var(--jx-focus-ring)",outlineOffset:"2px"}},'& [part="detail"]':{$description:"The captured log the progress modal used to own. It scrolls inside the row rather than growing it, so one 400-line `bun install` failure does not become the whole panel. It is the one part of a problem row that is selectable against the root's `user-select: none`: the log is what a reader pastes into a bug report, and the row offers no copy action.",userSelect:"text",maxHeight:"180px",margin:"var(--jx-space-1) 0 0",padding:"6px",overflow:"auto",borderRadius:"var(--jx-radius-xs)",background:"var(--bg)",color:"var(--fg-dim)",fontFamily:"var(--font-mono)",fontSize:"var(--jx-text-sm)",whiteSpace:"pre-wrap"},'& [part="action"]':{flex:"none"},'& [part="action"] > [part="control"]':{$description:"The recovery button wears the command's own title, so it is read as a verb and not as a decoration: the accent says it acts, and a refused command is dimmed with the reason it names in its tooltip.",border:"1px solid var(--border)",borderRadius:"var(--jx-radius-xs)",background:"transparent",color:"var(--accent)",":hover:not(:disabled)":{background:"var(--hover-bg)"},":disabled":{color:"var(--fg-dim)"}},'& [part="dismiss"]':{flex:"none"},'& [part="empty"]':{$description:"The teaching empty state, drawn here rather than borrowed from `panels/empty-state.ts`: that helper is a lit template, and a document cannot call one. What is kept is the pattern's rules (studio-ui-guidelines.md §11) — one sentence saying what the region is FOR, then where its content comes from. It offers no action, because the action that fills this region is a failure and nothing here should invite one.",display:"flex",flexDirection:"column",alignItems:"center",gap:"var(--jx-space-3)",padding:"var(--jx-space-6)",textAlign:"center",color:"var(--fg-dim)",fontSize:"13px"},'& [part="empty-message"], & [part="empty-detail"]':{margin:"0",maxWidth:"34ch",lineHeight:"1.5"},'& [part="empty-detail"]':{fontSize:"var(--jx-text-sm)",opacity:"0.8"},"@(forced-colors: active)":{'& [part="row"]':{$description:"The severity bar, redrawn. In forced colours every author colour is replaced by one from the user's palette, so the four left-edge colours collapse into one and the row loses the marker `styles/forced-colors.css` restored for `.problem-row` while this surface was lit.",borderLeft:"2px solid Highlight"}}},children:[{tagName:"div",attributes:{part:"body-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasProblems"},cases:{false:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",attributes:{part:"empty-message"},textContent:"Nothing needs fixing."},{tagName:"p",attributes:{part:"empty-detail"},textContent:"Failed writes, validation errors and render failures are listed here until fixed."}]},true:{tagName:"div",attributes:{part:"body"},children:[{tagName:"div",attributes:{part:"actions"},children:[{tagName:"jx-button",$props:{size:"sm"},attributes:{part:"clear"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/clearAll"}}]},children:[{tagName:"span",textContent:"${state.clearLabel}"}]}]},{$prototype:"Array",items:{$ref:"#/state/groups"},key:{$ref:"$map/item/source"},map:{tagName:"section",attributes:{part:"group","data-source":"${$map.item.source}"},children:[{tagName:"h3",attributes:{part:"group-title"},textContent:"${$map.item.source}"},{tagName:"ul",attributes:{part:"list"},children:[{$prototype:"Array",items:{$ref:"$map/item/rows"},key:{$ref:"$map/item/id"},map:{tagName:"li",attributes:{part:"row","data-severity":"${$map.item.severity}"},children:[{tagName:"span",attributes:{part:"icon","aria-hidden":"true"},textContent:"${$map.item.icon}"},{tagName:"div",attributes:{part:"row-body"},children:[{tagName:"div",attributes:{part:"message"},textContent:"${$map.item.message}"},{tagName:"span",attributes:{part:"file-path-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasPath"},cases:{true:{tagName:"button",attributes:{part:"file-path",type:"button",title:"${$map.item.pathTitle}"},textContent:"${$map.item.path}",onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openPath"},value:[{$ref:"$map/item/path"}]}]}}}},{tagName:"span",attributes:{part:"detail-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasDetail"},cases:{true:{tagName:"pre",attributes:{part:"detail"},textContent:"${$map.item.detail}"}}}]},{tagName:"span",attributes:{part:"action-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasAction"},cases:{true:{tagName:"jx-button",$props:{size:"sm",disabled:{$ref:"$map/item/actionDisabled"}},attributes:{part:"action",title:"${$map.item.actionTitle}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/runAction"},value:[{$ref:"$map/item/id"}]}]},children:[{tagName:"span",textContent:"${$map.item.actionLabel}"}]}}},{tagName:"jx-action-button",$props:{size:"sm",icon:"x",hint:"Dismiss",label:{$ref:"$map/item/dismissLabel"}},attributes:{part:"dismiss"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/dismissRow"},value:[{$ref:"$map/item/id"}]}]}}]}}]}]}}]}}}]};E("panel-problems",GC);function KC(e,t){e.hasProblems=t.hasProblems,e.clearLabel=t.clearLabel,e.groups=t.groups}function YC(e,t,r){let o=g({clearAll:r.clearAll,clearLabel:"",dismissRow:r.dismissRow,groups:[],hasProblems:!1,openPath:r.openPath,runAction:r.runAction});KC(o,t);let a=null,i=!1;return R("panel-problems",o,e).then((s)=>{if(i){s.dispose();return}a=s}),{connected:()=>!i&&(a===null||a.root.parentNode===e),dispose(){i=!0,a?.dispose(),a=null},update:(s)=>{KC(o,s)}}}var qB={error:"✕",info:"ℹ",success:"✓",warn:"!"},UB="Elsewhere";function JB(e=ta){let t=[];for(let r of e){let o=r.source??UB,a=t.find((i)=>i.source===o);if(a)a.records.push(r);else t.push({records:[r],source:o})}return t}function GB(e){(ce("zrqtgt41"),import("./chunks/files-zrqtgt41.js")).then((t)=>t.openFileInTab(e))}function KB(e){let t=e.action,r=t===void 0?null:ae(),o=r&&t!==void 0?r.get(t):void 0,a=o&&t!==void 0&&r.isVisible(t)?o:null,i=a&&t!==void 0?r.disabledReason(t):void 0;return{actionDisabled:i!==void 0,actionLabel:a?.title??"",actionTitle:a===null?"":i===void 0?a.title:`${a.title} — requires ${i}`,detail:e.detail??"",dismissLabel:`Dismiss: ${e.message}`,hasAction:a!==null,hasDetail:Boolean(e.detail),hasPath:Boolean(e.path),icon:qB[e.severity],id:e.id,message:e.message,path:e.path??"",pathTitle:`Open ${e.path??""}`,severity:e.severity}}function QC(){let e=JB().map((t)=>({rows:t.records.map((r)=>KB(r)),source:t.source}));return{clearLabel:`Clear ${Iv()}`,groups:e,hasProblems:e.length>0}}var YB={clearAll:()=>{yl()},dismissRow:(e)=>{$h(e)},openPath:(e)=>{GB(e)},runAction:(e)=>{let t=ta.find((o)=>o.id===e),r=ae();if(t?.action===void 0||!r)return;Tn(r,t.action,t.actionArgs,"Problems")}},Yr=null,oh=!1;function eT(){if(!Yr)return;Yr.scope.stop(),Yr.handle.dispose(),Yr=null}function XB(e){let t=oh;if(oh=!1,!t){eT();return}if(Yr?.host===e&&Yr.handle.connected())return;eT();let r=YC(e,QC(),YB),o=me();o.run(()=>{te(()=>{ae(),r.update(QC())})}),Yr={handle:r,host:e,scope:o}}function tT(){ei({id:"problems",title:"Problems",level:"project",dock:"bottom",rail:!1,icon:"warning-circle",badge:()=>Iv()||null,render:()=>(oh=!0,ft),afterRender:(e,t)=>{XB(t)}})}var nT={$schema:"https://jxsuite.com/schema/v1",$id:"StudioBottomDock",$description:"The Bottom dock's chrome (studio.md §16.3) as a Jx document over the kit: a real `tablist` of the dock's tabs, the button that shuts it, and ONE `tabpanel` for whichever tab is showing. Every tab names that one panel — the dock draws the selected tab's body and no other, so there is exactly one panel element and its `aria-labelledby` follows the selection, which is the same shape `surfaces/publish-workspace.json` uses for its four sub-tabs. It draws no tab BODY: `panels/bottom-dock.ts` keeps the panel registry, the `when` filter, the badge in each tab's label, the Logic reveal and every tab's `afterRender`, and renders the active record into the one empty `[part=\"dock-body\"]` island this document leaves for it (studio-ui-guidelines.md §9.4).",tagName:"div",attributes:{part:"bottom-dock"},style:{$description:"`styles/shell.css`'s four `.bd-*` rules, keyed on `part` and carried here — plus the flex column `#bottom-dock` itself was, because the document root is now the box between the shell cell and the strip and a column that stopped one level up would leave the body unable to scroll. Two rules are DELETED rather than moved: the close button's own padding, radius, hover fill and pointer are `jx-action-button`, and the strip's selected-tab underline is `jx-tab`.",display:"flex",flexDirection:"column",height:"100%",minHeight:"0",fontFamily:"var(--jx-font-sans)",color:"var(--fg)",'& [part="strip"]':{display:"flex",flexShrink:"0",alignItems:"center",gap:"var(--jx-space-1)",padding:"0 var(--jx-space-1)",borderBottom:"1px solid var(--border)"},'& [part="tabs"]':{flex:"1",minWidth:"0",border:"0",overflowX:"auto",fontSize:"var(--jx-text-sm)"},'& [part="close"]':{flexShrink:"0"},'& [part="panel"]':{$description:"The one scrolling region. `min-height: 0` because a flex item's auto minimum is its content, which would push the dock past its own track instead of scrolling inside it.",flex:"1",minHeight:"0",padding:"0",overflowY:"auto"},'& [part="dock-body"]':{display:"block",minHeight:"0"}},children:[{tagName:"div",attributes:{part:"strip"},children:[{tagName:"jx-tabs",attributes:{part:"tabs",selected:"${state.tab}"},$props:{label:"Bottom dock"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/selectTab"},value:[{$ref:"event#/detail"}]}]},children:[{$prototype:"Array",items:{$ref:"#/state/tabs"},key:{$ref:"$map/item/key"},map:{tagName:"jx-tab",attributes:{part:"tab",id:"${$map.item.tabId}","data-tab":"${$map.item.key}",value:"${$map.item.key}",label:"${$map.item.label}",panel:"bottom-dock-panel"}}}]},{tagName:"jx-action-button",attributes:{part:"close","data-action":"close"},$props:{icon:"x",size:"sm",quiet:!0,label:"Close the Bottom dock",hint:"Close the Bottom dock"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closeDock"},value:[]}]}}]},{tagName:"jx-tab-panel",attributes:{part:"panel",id:"bottom-dock-panel"},$props:{active:!0,labelledby:{$ref:"#/state/tabId"}},children:[{$description:"The island, and it stays empty: every tab of this dock is a `PanelRecord` whose `render` returns a lit template, so `panels/bottom-dock.ts` paints here and runs each tab's `afterRender` against this element. It is a slotted child rather than the panel itself because `jx-tab-panel` distributes its own slot.",tagName:"div",attributes:{part:"dock-body","data-jx-region":"${state.bodyRegion || null}"}}]}]};E("bottom-dock",nT);function ZB(e,t){e.tab=t.tab,e.tabId=t.tabId,e.bodyRegion=t.bodyRegion,e.tabs=t.tabs}function eV(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function rT(e,t,r,o){let a=g({...t,...r});e.textContent="",delete e._$litPart$;let i=null,s=!1;return R("bottom-dock",a,e,{onNodeCreated:(l,f,c)=>{if(l instanceof HTMLElement&&eV(c)==="dock-body")o.onBody(l)}}).then((l)=>{if(s){l.dispose();return}i=l}),{dispose(){s=!0,i?.dispose(),i=null},update:(l)=>{ZB(a,l)}}}var tV="#bottom-dock";function ph(){if(rx("bottom").length>0)return;tT(),UD(),nA()}function sT(){ph();let e=[];for(let t of Tx){let r=Np(t);if(r)e.push(r)}return e}function cT(e=th()){return sT().filter((t)=>sx(t,e))}function mh(e=th()){let t=cT(e),r=j$(u.bottomTab)?u.bottomTab:F$;return t.find((o)=>o.id===r)??t[0]??null}function dT(){return{deps:{},doc:null,rerender:pT}}function nV(e,t){let r=e.badge?.(t)??null;return r===null||r===0||r===""?e.title:`${e.title} ${r}`}function aT(e=th()){let t=mh(e);return{bodyRegion:t?u0(t.id):"",tab:t?.id??"",tabId:t?`bottom-dock-tab-${t.id}`:"",tabs:cT(e).map((r)=>({key:r.id,label:nV(r,e),tabId:`bottom-dock-tab-${r.id}`}))}}var Ri=null,yt=null,Xr=null,Ai=null,ih=null;function rV(){let e=mw();return e?`${e.surface} ${JSON.stringify(e.editing)}`:null}function pT(){if(!yt)return;if(u.docks.bottom.collapsed){yt.removeAttribute(Ve),Xr?.dispose(),Xr=null,Ai=null,fh(yt);return}if(yt.setAttribute(Ve,"dock.bottom"),!Xr){Xr=rT(yt,aT(),{closeDock:()=>{ko("bottom",!0)},selectTab:(e)=>{if(e!==""&&e!==mh()?.id)uh(e)}},{onBody:(e)=>{Ai=e,queueMicrotask(()=>{if(Ai===e)iT()})}});return}Xr.update(aT()),iT()}function iT(){let e=Ai;if(!e)return;let t=mh();io(t?t.render(dT()):Pu(e,{message:"Nothing to show here yet."}),e),fh(e)}function fh(e){let t=dT();for(let r of sT())r.afterRender?.(t,e)}function oV(){if(Ri)return;if(yt=document.querySelector(tV),!yt)return;Ri=me(),Ri.run(()=>{te(()=>{let e=rV();if(e!==null&&e!==ih)HE();ih=e}),te(()=>{u.docks.bottom.collapsed,u.bottomTab,pT()})})}nv({mount:oV,unmount:aV});function aV(){if(Ri?.stop(),Ri=null,ih=null,Xr?.dispose(),Xr=null,Ai=null,yt)yt.removeAttribute(Ve),io(ft,yt),yt.textContent="",fh(yt),yt=null}var uT={$schema:"https://jxsuite.com/schema/v1",$id:"StudioCollectionsPanel",$description:"The Collections panel (specs/studio.md §22.5): the Content workspace's Navigator. With no entry being written it lists the built-in Pages and every collection the project declares, each with its entry count and its saved grid views beneath it, and **+ New collection** at the foot; choosing a collection shows it in the Content home. While an entry is being written it lists that collection's entries instead (thumbnail, title, status) under **‹ <Collection>** to go back, with **+ New <item>** at the foot. `panels/collections-panel.ts` keeps every decision; this document draws rows whose every field is already a string.",tagName:"div",attributes:{part:"collections"},style:{$description:"The Collections panel's own look, keyed on `part`. Rows are native buttons, because a row opens one thing and a button is the element that says so to every reader; the selected row is the one whose `data-selected` is true, which the flow sets from what the focused pane shows. A collection's saved views are indented under it, and the entries list leads with a back row, the Content-Entry board's list.",display:"flex",flexDirection:"column",height:"100%",minHeight:"0",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",'& [part="list"], & [part="entries"]':{display:"flex",flexDirection:"column",flex:"1",minHeight:"0",overflowY:"auto",padding:"var(--jx-space-2) 0 var(--jx-space-4)"},'& [part="rows"], & [part="views"]':{display:"flex",flexDirection:"column"},'& [part="views"][hidden]':{display:"none"},'& [part="collection-row"], & [part="view-row"], & [part="entry-row"], & [part="back"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",width:"100%",boxSizing:"border-box",minHeight:"28px",padding:"var(--jx-space-1) var(--jx-space-3)",border:"none",background:"transparent",color:"inherit",font:"inherit",textAlign:"start",cursor:"pointer",":hover":{background:"var(--hover-bg)"},":focus-visible":{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"}},'& [part="view-row"]':{paddingLeft:"calc(var(--jx-space-3) + var(--jx-space-4))",color:"var(--fg-dim)"},'& [part="back"]':{fontWeight:"600",borderBottom:"1px solid var(--border)",marginBottom:"var(--jx-space-1)"},'& [data-selected="true"]':{background:"var(--accent-15)",color:"var(--fg)"},'& [part="row-label"]':{flex:"1",minWidth:"0",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="row-count"]':{flexShrink:"0",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)",fontVariantNumeric:"tabular-nums"},'& [part="view-glyph"], & [part="back-glyph"]':{flexShrink:"0",color:"var(--fg-dim)"},'& [part="entry-row"]':{minHeight:"44px"},'& [part="entry-art"]':{display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0",width:"36px",height:"36px",overflow:"hidden",borderRadius:"var(--jx-radius-md)",background:"var(--bg-panel)",border:"1px solid var(--border)"},'& [part="entry-thumb"]':{width:"100%",height:"100%",objectFit:"cover"},'& [part="entry-glyph"]':{color:"var(--fg-dim)"},'& [part="entry-text"]':{display:"flex",flexDirection:"column",flex:"1",minWidth:"0"},'& [part="entry-title"]':{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="entry-status"]':{fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="entry-status"]:empty':{display:"none"},'& [part="entry-locale"]':{fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="entry-locale"]:empty':{display:"none"},'& [part="entry-status"][data-status="Draft"]':{color:"var(--warning)"},'& [part="note"], & [part="no-project"]':{margin:"0",padding:"var(--jx-space-2) var(--jx-space-3)",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="foot"]':{padding:"var(--jx-space-2) var(--jx-space-2) 0"}},children:[{tagName:"div",attributes:{part:"body-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/body"},cases:{none:{tagName:"p",attributes:{part:"no-project"},textContent:"Open a project to see its pages and collections."},list:{tagName:"div",attributes:{part:"list"},children:[{tagName:"div",attributes:{part:"rows",role:"list"},children:[{$prototype:"Array",items:{$ref:"#/state/collections"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"collection",role:"listitem","data-collection":"${$map.item.key}"},children:[{tagName:"button",attributes:{part:"collection-row",type:"button","data-selected":"${$map.item.selected}","aria-current":"${$map.item.selected === 'true' ? 'true' : null}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/showCollection"},value:[{$ref:"$map/item/key"}]}]},children:[{tagName:"span",attributes:{part:"row-label"},textContent:"${$map.item.title}"},{tagName:"span",attributes:{part:"row-count"},textContent:"${$map.item.count}"}]},{tagName:"div",$description:'Hidden while the collection has no saved views: an empty list is still a list to a screen reader, announced as "Saved views, list, 0 items" under every collection.',attributes:{part:"views",role:"list","aria-label":"Saved views",hidden:"${$map.item.views.length > 0 ? null : ''}"},children:[{$prototype:"Array",items:{$ref:"$map/item/views"},key:{$ref:"$map/item/key"},map:{$description:"The list item. A button keeps its own role, so the item is the wrapper around it, as a collection row's is.",tagName:"div",attributes:{part:"view-item",role:"listitem"},children:[{tagName:"button",attributes:{part:"view-row",type:"button",title:"Open the grid on this saved view"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/applyView"},value:[{$ref:"$map/item/key"},{$ref:"$map/item/name"}]}]},children:[{tagName:"jx-icon",attributes:{part:"view-glyph"},$props:{name:"rows"}},{tagName:"span",attributes:{part:"row-label"},textContent:"${$map.item.name}"}]}]}}]}]}}]},{tagName:"div",attributes:{part:"foot"},children:[{tagName:"jx-action-button",attributes:{part:"new-collection"},$props:{size:"sm",quiet:!0,icon:"plus",haspopup:"dialog"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/newCollection"},value:[]}],description:'Add new on its Collection kind (`file.new { kind: "collection" }`).'},children:[{tagName:"span",textContent:"New collection"}]}]}]},entries:{tagName:"div",attributes:{part:"entries"},children:[{tagName:"button",attributes:{part:"back",type:"button",title:"Back to the collection","aria-label":"Back to ${state.backTitle}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/back"},value:[]}],description:"Back to the collection in the Content home (`content.showCollection`)."},children:[{tagName:"jx-icon",attributes:{part:"back-glyph"},$props:{name:"caret-left"}},{tagName:"span",attributes:{part:"row-label"},textContent:"${state.backTitle}"},{tagName:"span",attributes:{part:"row-count"},textContent:"${state.backCount}"}]},{tagName:"div",attributes:{part:"entries-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/entriesState"},cases:{loading:{tagName:"p",attributes:{part:"note"},textContent:"Reading the entries…"},empty:{tagName:"p",attributes:{part:"note"},textContent:"No entries yet."},listed:{tagName:"div",attributes:{part:"rows",role:"list"},children:[{$prototype:"Array",items:{$ref:"#/state/entries"},key:{$ref:"$map/item/path"},map:{$description:"The list item. A button keeps its own role, so the item is the wrapper around it, as a collection row's is.",tagName:"div",attributes:{part:"entry-item",role:"listitem"},children:[{tagName:"button",attributes:{part:"entry-row",type:"button","data-path":"${$map.item.path}","data-selected":"${$map.item.selected}","aria-current":"${$map.item.selected === 'true' ? 'true' : null}",title:"${$map.item.path}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openEntry"},value:[{$ref:"$map/item/path"}]}]},children:[{tagName:"span",attributes:{part:"entry-art"},children:[{tagName:"span",attributes:{part:"art-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/art"},cases:{image:{tagName:"img",attributes:{part:"entry-thumb",src:"${$map.item.thumb}",alt:"",loading:"lazy"}},glyph:{tagName:"jx-icon",attributes:{part:"entry-glyph"},$props:{name:"file-text"}}}}]},{tagName:"span",attributes:{part:"entry-text"},children:[{tagName:"span",attributes:{part:"entry-title"},textContent:"${$map.item.title}"},{tagName:"span",attributes:{part:"entry-status","data-status":"${$map.item.status}"},textContent:"${$map.item.status}"},{$description:"The language an entry of a multilingual collection is written in, by its autonym; empty, and not drawn, in a collection of one language.",tagName:"span",attributes:{part:"entry-locale",lang:"${$map.item.lang}"},textContent:"${$map.item.locale}"}]}]}]}}]}}},{tagName:"div",attributes:{part:"foot"},children:[{tagName:"jx-action-button",attributes:{part:"new-entry"},$props:{size:"sm",quiet:!0,icon:"plus",haspopup:"dialog"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/newEntry"},value:[]}],description:'Add new on its Entry kind, in this collection (`file.new { kind: "entry", collection }`).'},children:[{tagName:"span",textContent:"${state.newLabel}"}]}]}]}}}]};E("collections-panel",uT);function hh(){return{backTitle:"",backCount:"",body:"none",collections:[],entries:[],entriesState:"loading",newLabel:""}}function mT(e,t){e.body=t.body,e.collections=t.collections,e.backTitle=t.backTitle,e.backCount=t.backCount,e.entriesState=t.entriesState,e.entries=t.entries,e.newLabel=t.newLabel}function fT(e,t,r){let o=g({...hh(),...r});mT(o,t);let a=null,i=!1,s=R("collections-panel",o,e).then((l)=>{if(i)return l.dispose(),l;return a=l,l});return{connected:()=>{if(i)return!1;let l=a?.root;return l===void 0?!0:e.contains(l)},dispose(){i=!0,a?.dispose(),a=null},ready:s,update:(l)=>mT(o,l)}}var Ii="Collections";function bT(e){return e===hi?ss({kind:"pages"}):ss({kind:"collection",name:e})}function gh(e){let t=ec(e?.documentPath);return t!==null&&t!==hi&&!Ql(t)?.fileBacked?t:null}function sV(e){let t=ec(e.documentPath);return t!==null&&Ql(t)?.fileBacked===!0?t:null}function lV(e){if(!e)return null;if(e.id===$a("content"))return Fu();let t=Yl(e.id);if(t?.kind==="pages")return hi;return t?.kind==="collection"?t.name:sV(e)}function cV(e){let t=LE(),r=lV(e);return Om().map((o)=>{let a=t?.get(o.key);return{count:t===null?"":String(a??0),key:o.key,selected:o.key===r?"true":"false",title:o.title,views:Uu(bT(o.key)).map((i)=>({key:`${o.key}
|
|
5
|
+
${i.name}`,name:i.name}))}})}function gT(){let e=hh();if(!C)return e;let t=h.value,r=gh(t);if(r===null)return{...e,body:"list",collections:cV(t)};let o=Ql(r),a=LE(),i=J_(r),s=a===null?null:Cw(r,i),l=il(r).locale,f=(s??[]).flatMap((c)=>{let d=zc(c.path)??"";if(l!==""&&d!==l)return[];return[{art:c.thumb===""?"glyph":"image",lang:d,locale:d===""?"":Wt(d),path:c.path,selected:c.path===t?.documentPath?"true":"false",status:c.status,thumb:c.thumb,title:c.title}]});return{...e,backTitle:o?.title??r,backCount:a===null?"":String(i.length),body:"entries",entries:f,entriesState:s===null?"loading":f.length===0?"empty":"listed",newLabel:`New ${o?.item??"entry"}`}}async function dV(e,t){let r=bT(e),o=h.value?.id===r;if(Rw(r,t),o){await nt("grid.applyView",{name:t},Ii);return}let{openCollectionGrid:a,openPagesGrid:i}=await (ce("t4fq6bbm"),import("./chunks/grid-open-t4fq6bbm.js"));if(e===hi)i();else a(e)}var pV={applyView:(e,t)=>{let[r=""]=e.split(`
|
|
6
|
+
`);dV(r,t)},back:()=>{let e=gh(h.value);if(e!==null)nt("content.showCollection",{collection:e},Ii)},newCollection:()=>{nt("file.new",{kind:"collection"},Ii)},newEntry:()=>{let e=gh(h.value);nt("file.new",e===null?{kind:"entry"}:{collection:e,kind:"entry",...uV(e)},Ii)},openEntry:(e)=>{Vl(e)},showCollection:(e)=>{nt("content.showCollection",{collection:e},Ii)}};function uV(e){let{i18n:t}=ln(C?.projectConfig??{}),r=h.value?.documentPath??null,a=(r===null?null:go(r,t))??il(e).locale;return a===""?{}:{locale:a}}var Xt=null,wh=null;function mV(){wn("leftPanel")}function fV(e){if(wh??=kw(mV),Xt&&(Xt.host!==e||!Xt.handle.connected()))Xt.handle.dispose(),Xt=null;if(Xt){Xt.handle.update(gT());return}Xt={handle:fT(e,gT(),pV),host:e}}function hV(e){return e.querySelector(".panel-content")??e}function yT(){ei({id:"collections",title:"Collections",level:"project",dock:"navigator",icon:"stack",rail:!1,render:()=>ft,afterRender:(e,t)=>{fV(hV(t))}})}function wT(){Xt?.handle.dispose(),Xt=null,wh?.(),wh=null}var xT={$schema:"https://jxsuite.com/schema/v1",$id:"StudioSettingsContexts",$description:"Project Settings › Contexts: the base width, and the three groups of `$media` entries — size breakpoints, colour schemes and feature queries — a project's pages may be rendered under. The adapter hands in `groups`, already classified and already carrying each row's refusal, plus the base width and the two whole-file messages; nothing here decides what a context IS. Every control is the kit's, so the `+` that used to be typed into an add button's text and the `×` that stood in for a remove icon are glyphs now rather than characters.",tagName:"div",attributes:{part:"contexts"},style:{$description:"What `.settings-media-list`, `.settings-media-row`, `.settings-media-name`, `.settings-media-name-fixed`, `.settings-media-value` and `.settings-section-notice` used to say in `styles/overlays.css`, keyed on `part` and re-pointed at the studio token layer. Those six were this section's alone and go with it. `.settings-section-title`, `.settings-field`, `.settings-field-label`, `.settings-field-desc` and `.settings-field-error` are NOT deleted with them: nine other settings sections are still lit and still name them, so those rules keep their stylesheet and this document carries its own copy of each until the last of those sections converts.",display:"block",'& [part="title"]':{margin:"0 0 16px",fontSize:"16px",fontWeight:"600",color:"var(--fg)"},'& [part="intro"], & [part="field-desc"], & [part="empty"]':{$description:"The 12px secondary line, three times: the section's own sentence, a group's sentence, and the sentence a group shows instead of rows. It read `var(--spectrum-font-size-75, 12px)`, which resolved only inside `<sp-theme>` — a document is mounted in the pane, where that name is not in scope and every one of them would have taken the hard-coded fallback.",margin:"0 0 6px",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"},'& [part="empty"]':{margin:"0"},'& [part="field"]':{marginBottom:"20px"},'& [part="field-label"]':{$description:"A heading, where the lit section had a `<label>` that named nothing: a group label sits over a LIST of controls, so `for` had nowhere to point and the element was a label in class name only. Each control carries its own name instead, and the reader gets a heading they can navigate by.",display:"block",margin:"0 0 2px",fontSize:"13px",fontWeight:"500",color:"var(--fg)"},'& [part="list"]':{display:"flex",flexDirection:"column",gap:"6px"},'& [part="row"]':{display:"flex",gap:"6px",alignItems:"center"},'& [part="name-fixed"]':{$description:"The base width's name column, which is a word rather than a field. It is the same 80px the editable name fields below it are, so the base row and the group rows line up down one edge.",width:"var(--jx-field-label-w)",fontSize:"var(--jx-text-md)",fontWeight:"500",color:"var(--fg-dim)",padding:"0 8px"},'& [part="name"]':{width:"var(--jx-field-label-w)",flex:"none"},'& [part="value"]':{flex:"1",minWidth:"0",width:"100%"},'& [part="value-slot"]':{$description:"The one cell a size row fills with a text field and a scheme row fills with a select. It is the `$switch` container, so it — not the control — is what the row's flex line measures.",display:"flex",flex:"1",minWidth:"0"},'& [part="row-error"]':{margin:"6px 0 0",fontSize:"var(--jx-text-md)",color:"var(--danger)"},'& [part="section-error"]':{margin:"6px 0 0",fontSize:"var(--jx-text-md)",color:"var(--danger)"},'& [part="notice"]':{$description:"A problem `project.json` already had, said once at section level. Deliberately not the danger colour: it refused nothing and it belongs to no control, so it is a warning about the file rather than a rejection of an edit.",margin:"6px 0 0",fontSize:"var(--jx-text-md)",color:"var(--warning)"}},children:[{tagName:"h3",attributes:{part:"title"},textContent:"Contexts"},{tagName:"p",attributes:{part:"intro"},textContent:"The conditions this project's pages are rendered under. Define them once here; choose between them on the pane's context control while you edit."},{tagName:"div",attributes:{part:"section-error-slot",role:"none"},$switch:{$ref:"#/state/hasSectionError"},cases:{true:{tagName:"p",attributes:{part:"section-error",role:"alert"},textContent:"${state.sectionError}"}}},{tagName:"div",attributes:{part:"notice-slot",role:"none"},$switch:{$ref:"#/state/hasNotice"},cases:{true:{tagName:"p",attributes:{part:"notice",role:"status"},textContent:"${state.notice}"}}},{tagName:"div",attributes:{part:"field"},children:[{tagName:"h4",attributes:{part:"field-label"},textContent:"Base width"},{tagName:"p",attributes:{part:"field-desc"},textContent:"How wide the canvas is when no other context applies. Styles written here apply everywhere."},{tagName:"div",attributes:{part:"row"},children:[{tagName:"span",attributes:{part:"name-fixed"},textContent:"Base"},{tagName:"jx-textfield",$props:{label:"Base width",value:{$ref:"#/state/base"},placeholder:"1280px",invalid:{$ref:"#/state/baseInvalid"},size:"sm"},attributes:{part:"value","data-context":"base"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setBase"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"div",attributes:{part:"base-error-slot",role:"none"},$switch:{$ref:"#/state/baseInvalid"},cases:{true:{tagName:"p",attributes:{part:"row-error",role:"alert"},textContent:"${state.baseError}"}}}]},{$prototype:"Array",items:{$ref:"#/state/groups"},key:{$ref:"$map/item/kind"},map:{tagName:"div",attributes:{part:"field","data-context-group":"${$map.item.kind}"},children:[{tagName:"h4",attributes:{part:"field-label"},textContent:"${$map.item.label}"},{tagName:"p",attributes:{part:"field-desc"},textContent:"${$map.item.desc}"},{tagName:"div",attributes:{part:"list-slot",role:"none"},$switch:{$ref:"$map/item/hasRows"},cases:{false:{tagName:"p",attributes:{part:"empty"},textContent:"${$map.item.empty}"},true:{tagName:"div",attributes:{part:"list"},children:[{$prototype:"Array",items:{$ref:"$map/item/rows"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"row-block","data-context":"${$map.item.key}"},children:[{tagName:"div",attributes:{part:"row"},children:[{tagName:"jx-textfield",$props:{label:{$ref:"$map/item/nameLabel"},value:{$ref:"$map/item/name"},placeholder:"name",invalid:{$ref:"$map/item/invalid"},size:"sm"},attributes:{part:"name"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/rename"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},{tagName:"div",attributes:{part:"value-slot",role:"none"},$switch:{$ref:"$map/item/control"},cases:{query:{tagName:"jx-textfield",$props:{label:{$ref:"$map/item/valueLabel"},value:{$ref:"$map/item/query"},placeholder:{$ref:"#/state/queryPlaceholder"},invalid:{$ref:"$map/item/invalid"},size:"sm"},attributes:{part:"value"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setQuery"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},scheme:{tagName:"jx-select",$props:{label:{$ref:"$map/item/valueLabel"},options:[{value:"light",label:"Light"},{value:"dark",label:"Dark"}],value:{$ref:"$map/item/scheme"},size:"sm"},attributes:{part:"value"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setScheme"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}}}},{tagName:"jx-action-button",$props:{label:{$ref:"$map/item/removeLabel"},hint:{$ref:"$map/item/removeLabel"},icon:"x",quiet:!0,size:"sm"},attributes:{part:"remove","data-remove":"${$map.item.key}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/remove"},value:[{$ref:"$map/item/key"}]}]}}]},{tagName:"div",attributes:{part:"row-error-slot",role:"none"},$switch:{$ref:"$map/item/invalid"},cases:{true:{tagName:"p",attributes:{part:"row-error",role:"alert"},textContent:"${$map.item.error}"}}}]}}]}}},{tagName:"jx-action-button",$props:{label:{$ref:"$map/item/addLabel"},icon:"plus",size:"sm"},attributes:{part:"add","data-add":"${$map.item.kind}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/add"},value:[{$ref:"$map/item/kind"}]}]},children:[{tagName:"span",textContent:"${$map.item.addLabel}"}]}]}}]};E("settings-contexts",xT);function bV(){return{base:"",baseError:"",baseInvalid:!1,groups:[],notice:"",queryPlaceholder:"",sectionError:""}}function TT(e,t){e.textContent="";let r=g({...bV(),add:t.add,hasNotice:!1,hasSectionError:!1,remove:t.remove,rename:t.rename,setBase:t.setBase,setQuery:t.setQuery,setScheme:t.setScheme}),o=null,a=!1,i=R("settings-contexts",r,e).then((s)=>{let l=s.root;if(a)return s.dispose(),l;return o=s,l});return{attached:()=>{if(a)return!1;let s=o?.root;return s===void 0?!0:s instanceof HTMLElement&&e.contains(s)},dispose(){a=!0,o?.dispose(),o=null},host:e,ready:i,update(s){r.base=s.base,r.baseError=s.baseError,r.baseInvalid=s.baseInvalid,r.groups=s.groups,r.notice=s.notice,r.queryPlaceholder=s.queryPlaceholder,r.sectionError=s.sectionError,r.hasNotice=s.notice!=="",r.hasSectionError=s.sectionError!==""}}}var Tc="--",ET="(max-width: 768px)",yV="(prefers-reduced-motion: reduce)";function vV(e){if(ux(e))return"scheme";return/(?:min|max)-width:/.test(e)?"size":"feature"}function wV(e){let t=e??{},r=[];for(let[o,a]of Object.entries(t)){if(o===Tc)continue;let i=String(a);r.push({key:o,kind:vV(i),query:i})}return{base:String(t[Tc]??""),entries:r}}function xV(e){let t=e.trim().replace(/^-+/,"").toLowerCase().replaceAll(/[^a-z0-9]+/g,"-").replaceAll(/^-+|-+$/g,"");return t?`--${t}`:""}var NT=[{addLabel:"Add breakpoint",desc:"Screen widths that get their own canvas and their own style values.",empty:"No breakpoints yet — every width uses the base styles.",kind:"size",label:"Size breakpoints",newQuery:ET,stem:"breakpoint"},{addLabel:"Add colour scheme",desc:"Light and dark renderings. Defining one turns on the Auto / Light / Dark control.",empty:"No colour schemes yet — the project renders one way.",kind:"scheme",label:"Colour schemes",newQuery:"(prefers-color-scheme: dark)",stem:"dark"},{addLabel:"Add feature query",desc:"Anything else a media query can ask: reduced motion, print, hover, orientation.",empty:"No feature queries yet.",kind:"feature",label:"Feature queries",newQuery:yV,stem:"feature"}],Pc=new WeakMap,jT=new WeakMap,PT=new WeakMap;function LT(){return C?.projectConfig??{}}function Qr(){return LT().$media??{}}function ra(e,t,r){Pc.set(e,{message:r,target:t}),Ec(e)}async function ea(e,t,r){let o=LT(),a={...o,$media:t},i=[],s=[];try{s=await Ku(o),i=(await Ku(a)).filter((f)=>!s.includes(f))}catch(l){ra(e,r,`Could not validate project.json — ${X(l)}`);return}if(i.length>0){ra(e,r,i.join("; "));return}jT.set(e,s);try{await no({$media:t}),Pc.delete(e)}catch(l){Pc.set(e,{message:`Could not save project.json — ${X(l)}`,target:r})}Ec(e)}function kV(e){return{add(t){let r=NT.find((s)=>s.kind===t);if(!r)return;let o=Qr(),a=`--${r.stem}`,i=2;while(a in o)a=`--${r.stem}-${i}`,i+=1;ea(e,{...o,[a]:r.newQuery},a)},remove(t){let r={...Qr()};delete r[t],ea(e,r,"section")},rename(t,r){let o=Qr(),a=xV(r);if(!a){ra(e,t,"A context needs a name.");return}if(a===t)return;if(a in o){ra(e,t,`"${ji(a)}" is already defined.`);return}let i={};for(let[s,l]of Object.entries(o))i[s===t?a:s]=l;ea(e,i,a)},setBase(t){let r=t.trim();if(r&&!/^\d+px$/.test(r)){ra(e,"base","Enter a width in pixels, like 1280px.");return}let o={...Qr()};if(r)o[Tc]=r;else delete o[Tc];ea(e,o,"base")},setQuery(t,r){let o=r.trim();if(!o){ra(e,t,"A context needs a media query, like (max-width: 768px).");return}ea(e,{...Qr(),[t]:o},t)},setScheme(t,r){ea(e,{...Qr(),[t]:`(prefers-color-scheme: ${r})`},t)}}}function $V(e,t){let r=ji(e.key),o=t?.target===e.key;return{control:e.kind==="scheme"?"scheme":"query",error:o?t.message:"",invalid:o,key:e.key,name:e.key.replace(/^--/,""),nameLabel:`Name for ${r}`,query:e.query,removeLabel:`Remove ${r}`,scheme:Mp(e.query)??"dark",valueLabel:e.kind==="scheme"?`Colour scheme for ${r}`:`Media query for ${r}`}}function SV(e){if(e.length===0)return"";let t=e.length===1?"problem":"problems";return`project.json has ${e.length} pre-existing schema ${t} that this section did not cause: ${e.join("; ")}`}function CV(e){let t=Pc.get(e),{base:r,entries:o}=wV(Qr()),a=NT.map((i)=>{let s=o.filter((l)=>l.kind===i.kind).map((l)=>$V(l,t));return{addLabel:i.addLabel,desc:i.desc,empty:i.empty,hasRows:s.length>0,kind:i.kind,label:i.label,rows:s}});return{base:r,baseError:t?.target==="base"?t.message:"",baseInvalid:t?.target==="base",groups:a,notice:SV(jT.get(e)??[]),queryPlaceholder:ET,sectionError:t?.target==="section"?t.message:""}}function Ec(e){let t=PT.get(e);if(!t?.attached())t?.dispose(),t=TT(e,kV(e)),PT.set(e,t);t.update(CV(e))}var FT={$schema:"https://jxsuite.com/schema/v1",$id:"StudioSettingsDefs",$description:"Project Settings › Data Shapes: the project-level `$defs` editor. The left column lists the shapes and the right one edits the selected shape's fields, each field a name, a type, an optional format and whether it is required — plus the target of a reference and the children of an object. The adapter (`surfaces/settings-defs.ts`) hands in the shapes, the fields already classified, and every draft the reader is part-way through typing; `settings/defs-editor.ts` decides what a name may be and what reaches `project.json`. Nothing here reads the configuration: a document that re-read the file while drawing would be a second opinion about what one module already owns.",tagName:"section",attributes:{part:"defs"},style:{$description:"What `.settings-two-col`, `.settings-list-panel`, `.settings-editor-panel`, `.settings-editor-header`, `.settings-empty-state`, `.settings-inline-form`, `.schema-field-list`, `.schema-field-card`, `.schema-field-row`, `.schema-field-nested`, `.schema-field-name-input`, `.schema-nested-add`, `.schema-add-field` and `.settings-section-title` said in `styles/overlays.css`, keyed on `part` and re-pointed at the studio token layer. NONE of those rules is deleted from the stylesheet: `settings/contributed-section.ts` draws the same two-column editor and `ui/form-controls.ts` draws the same field cards, both still lit, so this document carries its own copy of each until they convert. Two values could not come with them. `.settings-editor-header h3` read `var(--spectrum-font-size-100, 14px)` and `.schema-field-card--nested` read `var(--spectrum-gray-300, #444)`, and a document is mounted in the pane rather than inside `<sp-theme>`, so both would have taken their hard-coded fallback every time; they are the kit's `--jx-text-lg` and the studio layer's `--border`.",display:"block",'& [part="title"]':{margin:"0 0 16px",fontSize:"16px",fontWeight:"600",color:"var(--fg)"},'& [part="columns"]':{$description:"The 1px gap over the border colour is the divider between the two columns: two panels on `--bg-panel` with `--border` showing through the gap, so nothing draws a rule of its own.",display:"flex",height:"100%",gap:"1px",background:"var(--border)"},'& [part="list"]':{display:"flex",flexDirection:"column",gap:"4px",padding:"12px",width:"200px",minWidth:"200px",background:"var(--bg-panel)",overflowY:"auto"},'& [part="shape"], & [part="new-open"]':{width:"100%"},'& [part="shape"] > [part="control"], & [part="new-open"] > [part="control"]':{$description:"`.settings-list-panel sp-action-button` said `width: 100%; justify-content: flex-start`, and both halves belong to the button the row is made of rather than to the row: a kit action button centres its glyph and its label, which reads as a list of centred names.",width:"100%",justifyContent:"flex-start"},'& [part="new-form"]':{display:"flex",alignItems:"center",gap:"6px"},'& [part="new-field"]':{flex:"1",minWidth:"0"},'& [part="empty"]':{flex:"1",display:"flex",alignItems:"center",justifyContent:"center",background:"var(--bg-panel)",color:"var(--fg-dim)",fontSize:"13px"},'& [part="editor"]':{flex:"1",padding:"16px",background:"var(--bg-panel)",overflowY:"auto"},'& [part="editor-header"]':{display:"flex",alignItems:"center",gap:"12px",marginBottom:"16px"},'& [part="editor-name"]':{margin:"0",fontSize:"var(--jx-text-lg)",fontWeight:"600",color:"var(--fg)"},'& [part="fields"]':{display:"flex",flexDirection:"column",gap:"4px",marginBottom:"12px"},'& [part="card"], & [part="nested-card"]':{border:"1px solid var(--border)",borderRadius:"var(--radius)",padding:"6px 10px"},'& [part="field-row"]':{display:"flex",alignItems:"center",gap:"8px"},'& [part="field-label"]':{$description:"The field's name in words, which `.schema-field-label` named and no stylesheet ever styled: it was an `sp-field-label` beside the raw-key field, at whatever size Spectrum drew it. It is a caption on the row rather than a label for a control, so it says so in the type ramp and the dim colour instead of borrowing a control's typography.",flex:"none",minWidth:"84px",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)",overflowWrap:"anywhere"},'& [part="field-name"]':{flex:"1",maxWidth:"140px"},'& [part="nested"]':{marginLeft:"16px",marginTop:"6px",paddingLeft:"8px",borderLeft:"2px solid var(--border)",display:"flex",flexDirection:"column",gap:"4px"},'& [part="ref-target"]':{display:"flex",marginTop:"6px",maxWidth:"220px"},'& [part="nested-add"]':{display:"flex",alignItems:"center",gap:"6px",padding:"4px 0"},'& [part="nested-add-name"]':{flex:"1",maxWidth:"120px"},'& [part="add-form"]':{display:"flex",alignItems:"center",gap:"8px",padding:"8px 0"}},children:[{tagName:"h3",attributes:{part:"title"},textContent:"Data Shapes"},{tagName:"div",attributes:{part:"columns"},children:[{tagName:"div",attributes:{part:"list"},children:[{$prototype:"Array",items:{$ref:"#/state/defs"},key:{$ref:"$map/item/name"},map:{tagName:"jx-action-button",attributes:{part:"shape","data-shape":"${$map.item.name}"},$props:{label:"${$map.item.name}",selected:{$ref:"$map/item/selected"},quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/select"},value:[{$ref:"$map/item/name"}]}]},children:[{tagName:"span",textContent:"${$map.item.name}"}]}},{tagName:"div",attributes:{part:"new-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/newState"},cases:{closed:{tagName:"jx-action-button",attributes:{part:"new-open"},$props:{label:"New Data Shape",icon:"plus",quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openNew"},value:[]}]},children:[{tagName:"span",textContent:"New Data Shape"}]},open:{tagName:"div",attributes:{part:"new-form"},children:[{tagName:"jx-textfield",attributes:{part:"new-field"},$props:{label:"New data shape name",placeholder:"ProductReview",size:"sm",value:{$ref:"#/state/newName"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editNew"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/createNew"},value:[]}],Escape:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/cancelNew"},value:[]}]}}]}},{tagName:"jx-button",attributes:{part:"new-create"},$props:{size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/createNew"},value:[]}]},children:[{tagName:"span",textContent:"Create"}]}]}}}]},{tagName:"div",attributes:{part:"editor-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/editorState"},cases:{empty:{tagName:"div",attributes:{part:"empty"},textContent:"Pick a data shape on the left, or create one."},editing:{tagName:"div",attributes:{part:"editor"},children:[{tagName:"div",attributes:{part:"editor-header"},children:[{tagName:"h4",attributes:{part:"editor-name"},textContent:"${state.selected}"},{tagName:"jx-action-button",attributes:{part:"delete-shape"},$props:{label:"Delete data shape",hint:"Delete data shape",icon:"trash",quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/removeSelected"},value:[]}]}}]},{tagName:"div",attributes:{part:"fields"},children:[{$prototype:"Array",items:{$ref:"#/state/fields"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"card","data-field":"${$map.item.key}"},children:[{tagName:"div",attributes:{part:"field-row"},children:[{tagName:"span",attributes:{part:"field-label"},textContent:"${$map.item.label}"},{tagName:"jx-textfield",attributes:{part:"field-name"},$props:{label:"Name for ${$map.item.label}",size:"sm",value:{$ref:"$map/item/name"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/renameField"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},{tagName:"jx-select",attributes:{part:"field-type"},$props:{label:"Type for ${$map.item.label}",size:"sm",options:{$ref:"#/state/typeOptions"},value:{$ref:"$map/item/type"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setType"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},{tagName:"div",attributes:{part:"format-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasFormat"},cases:{true:{tagName:"jx-select",attributes:{part:"field-format"},$props:{label:"Format for ${$map.item.label}",size:"sm",options:{$ref:"#/state/formatOptions"},value:{$ref:"$map/item/format"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setFormat"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}}}},{tagName:"jx-switch",$description:"Whether the shape requires this field. The word on screen is the name: `Req` is slotted rather than passed as `label`, because the kit's switch wraps its control in the label the slot lands in, and a second name would be announced over the top of it. Which row it belongs to is the tooltip's job instead, which is what `hint` is.",attributes:{part:"field-required"},$props:{hint:"Require ${$map.item.label}",size:"sm",checked:{$ref:"$map/item/required"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setRequired"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/checked"}]}]},children:[{tagName:"span",textContent:"Req"}]},{tagName:"jx-action-button",attributes:{part:"field-delete"},$props:{label:"Delete ${$map.item.label}",hint:"Delete ${$map.item.label}",icon:"trash",quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/removeField"},value:[{$ref:"$map/item/key"}]}]}}]},{tagName:"div",attributes:{part:"extra-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/extra"},cases:{reference:{tagName:"div",attributes:{part:"ref-target"},children:[{tagName:"jx-select",attributes:{part:"ref-target-select"},$props:{label:"Target for ${$map.item.label}",size:"sm",options:{$ref:"#/state/targets"},value:{$ref:"$map/item/refTarget"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setTarget"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}}]},nested:{tagName:"div",attributes:{part:"nested"},children:[{$prototype:"Array",items:{$ref:"$map/item/children"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"nested-card","data-nested":"${$map.item.key}"},children:[{tagName:"div",attributes:{part:"field-row"},children:[{tagName:"jx-textfield",attributes:{part:"field-name"},$props:{label:"Name for ${$map.item.parent}.${$map.item.key}",size:"sm",value:{$ref:"$map/item/name"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/renameNested"},value:[{$ref:"$map/item/parent"},{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},{tagName:"jx-select",attributes:{part:"field-type"},$props:{label:"Type for ${$map.item.parent}.${$map.item.key}",size:"sm",options:{$ref:"#/state/typeOptions"},value:{$ref:"$map/item/type"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setNestedType"},value:[{$ref:"$map/item/parent"},{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},{tagName:"div",attributes:{part:"format-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasFormat"},cases:{true:{tagName:"jx-select",attributes:{part:"field-format"},$props:{label:"Format for ${$map.item.parent}.${$map.item.key}",size:"sm",options:{$ref:"#/state/formatOptions"},value:{$ref:"$map/item/format"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setNestedFormat"},value:[{$ref:"$map/item/parent"},{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}}}},{tagName:"jx-switch",attributes:{part:"field-required"},$props:{hint:"Require ${$map.item.parent}.${$map.item.key}",size:"sm",checked:{$ref:"$map/item/required"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setNestedRequired"},value:[{$ref:"$map/item/parent"},{$ref:"$map/item/key"},{$ref:"event#/target/checked"}]}]},children:[{tagName:"span",textContent:"Req"}]},{tagName:"jx-action-button",attributes:{part:"field-delete"},$props:{label:"Delete ${$map.item.parent}.${$map.item.key}",hint:"Delete ${$map.item.parent}.${$map.item.key}",icon:"trash",quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/removeNested"},value:[{$ref:"$map/item/parent"},{$ref:"$map/item/key"}]}]}}]}]}},{tagName:"div",attributes:{part:"nested-add"},children:[{tagName:"jx-textfield",attributes:{part:"nested-add-name"},$props:{label:"New field in ${$map.item.label}",placeholder:"field name",size:"sm",value:{$ref:"$map/item/draftName"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editDraftName"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/addNested"},value:[{$ref:"$map/item/key"}]}]}}]}},{tagName:"jx-select",attributes:{part:"nested-add-type"},$props:{label:"Type of the new field in ${$map.item.label}",size:"sm",options:{$ref:"#/state/typeOptions"},value:{$ref:"$map/item/draftType"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editDraftType"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},{tagName:"jx-action-button",attributes:{part:"nested-add-button"},$props:{label:"Add a field to ${$map.item.label}",hint:"Add a field to ${$map.item.label}",icon:"plus",quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/addNested"},value:[{$ref:"$map/item/key"}]}]}}]}]}}}]}}]},{tagName:"div",attributes:{part:"add-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/addState"},cases:{closed:{tagName:"jx-action-button",attributes:{part:"add-open"},$props:{label:"Add Field",icon:"plus",quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openAdd"},value:[]}]},children:[{tagName:"span",textContent:"Add Field"}]},open:{tagName:"div",attributes:{part:"add-form"},children:[{tagName:"jx-textfield",attributes:{part:"add-name"},$props:{label:"New field name",placeholder:"Field name",size:"sm",value:{$ref:"#/state/addName"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editAddName"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/confirmAdd"},value:[]}],Escape:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/cancelAdd"},value:[]}]}}]}},{tagName:"jx-select",attributes:{part:"add-type"},$props:{label:"Type of the new field",size:"sm",options:{$ref:"#/state/typeOptions"},value:{$ref:"#/state/addType"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editAddType"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"div",attributes:{part:"add-format-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/addHasFormat"},cases:{true:{tagName:"jx-select",attributes:{part:"add-format"},$props:{label:"Format of the new field",size:"sm",options:{$ref:"#/state/formatOptions"},value:{$ref:"#/state/addFormat"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editAddFormat"},value:[{$ref:"event#/target/value"}]}]}}}},{tagName:"jx-switch",attributes:{part:"add-required"},$props:{hint:"Require the new field",size:"sm",checked:{$ref:"#/state/addRequired"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editAddRequired"},value:[{$ref:"event#/target/checked"}]}]},children:[{tagName:"span",textContent:"Required"}]},{tagName:"jx-button",attributes:{part:"add-confirm"},$props:{size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/confirmAdd"},value:[]}]},children:[{tagName:"span",textContent:"Add"}]},{tagName:"jx-button",attributes:{part:"add-cancel"},$props:{size:"sm",quiet:!0},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/cancelAdd"},value:[]}]},children:[{tagName:"span",textContent:"Cancel"}]}]}}}]}}}]}]};E("settings-defs",FT);function PV(){return{addFormat:"",addHasFormat:!0,addName:"",addRequired:!1,addState:"closed",addType:"string",defs:[],editorState:"empty",fields:[],formatOptions:[],newName:"",newState:"closed",selected:"",targets:[],typeOptions:[]}}function _T(e,t){e.textContent="";let r=g({...PV(),...t}),o=null,a=!1,i=R("settings-defs",r,e).then((s)=>{let l=s.root;if(a)return s.dispose(),l;return o=s,l});return{attached:()=>{if(a)return!1;let s=o?.root;return s===void 0?!0:s instanceof HTMLElement&&e.contains(s)},dispose(){a=!0,o?.dispose(),o=null},host:e,ready:i,update(s){r.addFormat=s.addFormat,r.addHasFormat=s.addHasFormat,r.addName=s.addName,r.addRequired=s.addRequired,r.addState=s.addState,r.addType=s.addType,r.defs=s.defs,r.editorState=s.editorState,r.fields=s.fields,r.formatOptions=s.formatOptions,r.newName=s.newName,r.newState=s.newState,r.selected=s.selected,r.targets=s.targets,r.typeOptions=s.typeOptions}}}var EV=vS.map((e)=>({label:e,value:e})),NV=yS.map((e)=>({label:e||"(none)",value:e})),HT=new WeakMap,BT=new WeakMap;function Lc(e){let t=HT.get(e);if(!t)t={add:{...Dd},addOpen:!1,drafts:new Map,echo:null,newName:"",newOpen:!1,selected:null},HT.set(e,t);return t}function Rc(e){return`name:${e}`}function Ic(e){return`required:${e}`}function xh(e,t){return`${e} ${t}`}function jc(e,t,r){Lc(e).echo={id:t,value:r},Oc(e)}function VT(e){Lc(e).echo=null}function UT(e,t,r){return e.echo?.id===t&&n(e.echo.value)?e.echo.value:r}function QT(e,t,r){return e.echo?.id===t&&Ze(e.echo.value)?e.echo.value:r}function jV(){ic()}function Sh(){return C?.projectConfig?.$defs}function gn(e){return e.selected===null?void 0:Sh()?.[e.selected]}function RV(){let e=C?.projectConfig?.content;return v(e)?Object.keys(e):[]}var WT=[],qT=" ";function AV(){let e=RV(),t=e.join(" ");if(t!==qT)qT=t,WT=e.map((r)=>({label:r,value:r}));return WT}function Li(e){return e==="string"||e==="array"}function IV(e,t,r,o,a){let i=xh(t,r),s=Sb(o);return{format:Nd(o),hasFormat:Li(s),key:r,name:UT(e,Rc(i),r),parent:t,required:QT(e,Ic(i),a),type:s}}function LV(e,t,r,o,a){let i=Sb(r),s=i==="object",l=e.drafts.get(t),f=r.required??[];return{children:s?Object.entries(r.properties??{}).map(([c,d])=>IV(e,t,c,d,f.includes(c))):[],draftName:l?.name??"",draftType:l?.type??"string",extra:i==="reference"&&a?"reference":s?"nested":"none",format:Nd(r),hasFormat:Li(i),key:t,label:ed(t),name:UT(e,Rc(t),t),refTarget:r.$ref?r.$ref.replace(/^#\/[^/]+\//,""):"",required:QT(e,Ic(t),o),type:i}}function OV(e){let t=Lc(e),r=Sh()??{},o=gn(t),a=AV(),i=o?.properties??{},s=o?.required??[];return{addFormat:t.add.format,addHasFormat:Li(t.add.type),addName:t.add.name,addRequired:t.add.required,addState:t.addOpen&&o?"open":"closed",addType:t.add.type,defs:Object.keys(r).map((l)=>({name:l,selected:l===t.selected})),editorState:o?"editing":"empty",fields:Object.entries(i).map(([l,f])=>LV(t,l,f,s.includes(l),a.length>0)),formatOptions:NV,newName:t.newName,newState:t.newOpen?"open":"closed",selected:o&&t.selected!==null?t.selected:"",targets:a,typeOptions:EV}}function MV(e){let t=Lc(e),r=()=>Oc(e),o=(c)=>gn(t)?.properties?.[c],a=(c)=>{let d=t.drafts.get(c);if(!d)d={name:"",type:"string"},t.drafts.set(c,d);return d},i=(c,d,b)=>{let y={};for(let[x,S]of Object.entries(c))y[x===d?b:x]=S,delete c[x];Object.assign(c,y)},s=(c,d,b)=>{if(!c.required)c.required=[];let y=c.required.indexOf(d);if(b&&y===-1)c.required.push(d);if(!b&&y!==-1)c.required.splice(y,1)},l=()=>{VT(e),r()},f=()=>{VT(e),r(),jV()};return{addNested(c){let d=a(c),b=d.name.trim(),y=o(c);if(!b||!y)return;if(!y.properties)y.properties={};y.properties[b]=_a(d.type||"string"),d.name="",f()},cancelAdd(){t.addOpen=!1,t.add={...Dd},r()},cancelNew(){t.newOpen=!1,t.newName="",r()},confirmAdd(){let c=t.add.name.trim(),d=gn(t);if(!c||!d)return;if(!d.properties)d.properties={};if(d.properties[c]=_a(t.add.type,t.add.format||void 0),t.add.required)s(d,c,!0);t.addOpen=!1,t.add={...Dd},f()},createNew(){let c=t.newName.trim(),d=C?.projectConfig;if(!c||!d)return;if(!d.$defs)d.$defs={};if(d.$defs[c])return;d.$defs[c]={properties:{},required:[],type:"object"},t.selected=c,t.newOpen=!1,t.newName="",f()},editAddFormat(c){t.add.format=c,r()},editAddName(c){t.add.name=c,r()},editAddRequired(c){t.add.required=c,r()},editAddType(c){t.add.type=c,r()},editDraftName(c,d){a(c).name=d,r()},editDraftType(c,d){a(c).type=d,r()},editNew(c){t.newName=c,r()},openAdd(){t.addOpen=!0,t.add={...Dd},r()},openNew(){t.newOpen=!0,t.newName="",r()},removeField(c){let d=gn(t);if(!d?.properties)return;if(delete d.properties[c],d.required)d.required=d.required.filter((b)=>b!==c);f()},removeNested(c,d){let b=o(c);if(!b?.properties)return;if(delete b.properties[d],b.required)b.required=b.required.filter((y)=>y!==d);f()},removeSelected(){let c=Sh();if(t.selected===null||!c?.[t.selected])return;delete c[t.selected],t.selected=null,t.addOpen=!1,f()},renameField(c,d){jc(e,Rc(c),d);let b=gn(t),y=d.trim();if(!b?.properties||!y||y===c||b.properties[y]){l();return}if(i(b.properties,c,y),b.required)b.required=b.required.map((x)=>x===c?y:x);f()},renameNested(c,d,b){jc(e,Rc(xh(c,d)),b);let y=o(c),x=b.trim();if(!y?.properties||!x||x===d||y.properties[x]){l();return}if(i(y.properties,d,x),y.required)y.required=y.required.map((S)=>S===d?x:S);f()},select(c){t.selected=c,t.addOpen=!1,r()},setFormat(c,d){let b=gn(t),y=b?.properties?.[c];if(!b?.properties||!y)return;b.properties[c]=_a(y.type||"string",d||void 0),f()},setNestedFormat(c,d,b){let y=o(c),x=y?.properties?.[d];if(!y?.properties||!x)return;y.properties[d]=_a(x.type||"string",b||void 0),f()},setNestedRequired(c,d,b){jc(e,Ic(xh(c,d)),b);let y=o(c);if(!y){l();return}s(y,d,b),f()},setNestedType(c,d,b){let y=o(c),x=y?.properties?.[d];if(!y?.properties||!x)return;let S=Li(b)?Nd(x):void 0;y.properties[d]=_a(b,S||void 0),f()},setRequired(c,d){jc(e,Ic(c),d);let b=gn(t);if(!b){l();return}s(b,c,d),f()},setTarget(c,d){let b=gn(t);if(!b?.properties?.[c])return;b.properties[c]={$ref:`#/content/${d}`},f()},setType(c,d){let b=gn(t),y=b?.properties?.[c];if(!b?.properties||!y)return;let x=Li(d)?Nd(y):void 0;b.properties[c]=_a(d,x||void 0),f()}}}function Oc(e){let t=BT.get(e);if(!t?.attached())t?.dispose(),t=_T(e,MV(e)),BT.set(e,t);t.update(OV(e))}var ZT={$schema:"https://jxsuite.com/schema/v1",$id:"StudioSettingsPackages",$description:'Project Settings › Packages: the project\'s npm dependencies, each with the version it is pinned at and the newest one the registry has, and the four verbs that reach `bun` — add, update, remove, reinstall. The adapter (`surfaces/settings-packages.ts`) hands in one row per dependency, already told whether it can be updated and to what; nothing here asks the registry, compares two versions or decides what an update means. A row\'s Latest is a STRING the adapter chose, `—` included, because "the registry did not answer" and "the registry answered 0.0.0" are the same absence to a document and only one of them is true.',tagName:"section",attributes:{part:"packages"},style:{$description:"The section's own look. Three borrowings end here. `.settings-section` was an orphan class with no rule anywhere, so the section's rhythm was carried by the toolbar's inline `margin-bottom`; it is drawn below instead of implied. `.settings-section-title` and `.settings-field-desc` keep their stylesheet — nine settings sections are still lit and still name them — so this document carries its own copy of each, with `--spectrum-font-size-75` re-pointed at the kit's scale: a document is mounted outside `<sp-theme>`, where that name resolves to nothing and every one of these would silently have taken its 12px fallback. And the table is drawn here rather than by `sp-table`, which is the one thing on this surface the kit has no element for: four Spectrum tags went, and a `<table>` with three column headers replaced them, so the columns are announced as columns and a row is a row rather than a `role=\"row\"` a component asserts.",display:"block",fontFamily:"var(--jx-font-sans)",'& [part="title"]':{margin:"0 0 var(--jx-space-2)",fontSize:"16px",fontWeight:"600",color:"var(--fg)"},'& [part="intro"]':{margin:"0 0 var(--jx-space-4)",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"},'& [part="toolbar"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-3)",marginBottom:"var(--jx-space-4)"},'& [part="add-field"]':{$description:"The one control on this surface a reader types into. It takes the space the row's buttons do not, and stops there: a package name is short, and a field that eats a 900px pane says the section is mostly about typing when it is mostly about reading a table.",flex:"1",minWidth:"0",maxWidth:"280px"},'& [part="spacer"]':{$description:"What pushes Update all and Reinstall to the far end. The two groups act on different things — one package you are naming, every package you already have — and the gap between them is what says so.",flex:"1"},'& [part="status"]':{$description:'"Loading…" and "No dependencies.", the two lines drawn where the table would be. They are one part rather than two because they are one sentence in two moods, and the difference between them is already in the words.',margin:"0",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"},'& [part="table"]':{width:"100%",borderCollapse:"collapse",fontSize:"var(--jx-text-md)",color:"var(--fg)"},'& [part="column"]':{padding:"var(--jx-space-2) var(--jx-space-3)",textAlign:"start",fontWeight:"500",color:"var(--fg-dim)",borderBottom:"1px solid var(--border)"},'& [part="name-cell"], & [part="current"], & [part="latest"], & [part="row-actions"]':{padding:"var(--jx-space-2) var(--jx-space-3)",verticalAlign:"middle",borderBottom:"1px solid var(--border)"},'& [part="name-cell"]':{overflowWrap:"anywhere"},'& [part="dev"]':{$description:"Which of the two dependency blocks the row is in, said beside the name rather than in a column of its own: a column would be empty for most projects and this is a footnote on a name, not a fact worth four percent of the width.",marginInlineStart:"var(--jx-space-2)",fontSize:"var(--jx-text-xs)",color:"var(--fg-dim)"},'& [part="current"], & [part="latest"]':{$description:"Both version columns in the monospace face. A range and a release read as versions rather than as prose, and `^0.19.0` beside `0.22.0` only lines up digit under digit in a fixed pitch.",fontFamily:"var(--font-mono)",whiteSpace:"nowrap"},'& [part="actions"]':{$description:"The row's two buttons, held at the right edge and never wrapped: they are the same pair on every row, so the eye finds them by position and a row that wrapped one under the other would break that.",display:"flex",justifyContent:"flex-end",gap:"var(--jx-space-1)",whiteSpace:"nowrap"},'& [part="hidden-label"]':{$description:`The actions column's header, named for a screen reader and drawn for nobody: the column holds two icon buttons whose own names say which row they act on, and a visible "Actions" over them would be a word explaining a column that explains itself.`,position:"absolute",width:"1px",height:"1px",margin:"-1px",overflow:"hidden",clipPath:"inset(50%)",whiteSpace:"nowrap"}},children:[{tagName:"h3",attributes:{part:"title"},textContent:"Packages"},{tagName:"p",attributes:{part:"intro"},textContent:"This project's npm dependencies. Adding, updating, removing and reinstalling each run bun in the project root."},{tagName:"div",attributes:{part:"toolbar"},children:[{tagName:"jx-textfield",attributes:{part:"add-field"},$props:{label:"Package name",placeholder:"package-name",size:"sm",value:{$ref:"#/state/addName"},disabled:{$ref:"#/state/busy"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/edit"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/add"},value:[]}]}}]}},{tagName:"jx-button",attributes:{part:"add-button"},$props:{size:"sm",disabled:{$ref:"#/state/busy"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/add"},value:[]}]},children:[{tagName:"span",textContent:"Add"}]},{tagName:"span",attributes:{part:"spacer","aria-hidden":"true"}},{tagName:"span",attributes:{part:"update-all-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasUpdates"},cases:{true:{tagName:"jx-button",attributes:{part:"update-all"},$props:{size:"sm",disabled:{$ref:"#/state/busy"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/updateAll"},value:[]}]},children:[{tagName:"span",textContent:"Update all"}]}}},{tagName:"jx-button",attributes:{part:"reinstall"},$props:{size:"sm",quiet:!0,disabled:{$ref:"#/state/busy"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/reinstall"},value:[]}]},children:[{tagName:"span",textContent:"Reinstall"}]}]},{tagName:"div",attributes:{part:"body",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/listState"},cases:{loading:{tagName:"p",attributes:{part:"status"},textContent:"Loading…"},empty:{tagName:"p",attributes:{part:"status"},textContent:"No dependencies."},listed:{tagName:"table",attributes:{part:"table"},children:[{tagName:"thead",children:[{tagName:"tr",children:[{tagName:"th",attributes:{part:"column",scope:"col"},textContent:"Package"},{tagName:"th",attributes:{part:"column",scope:"col"},textContent:"Current"},{tagName:"th",attributes:{part:"column",scope:"col"},textContent:"Latest"},{tagName:"th",attributes:{part:"column",scope:"col"},children:[{tagName:"span",attributes:{part:"hidden-label"},textContent:"Actions"}]}]}]},{tagName:"tbody",attributes:{part:"rows"},children:[{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/name"},map:{tagName:"tr",attributes:{part:"row","data-package":"${$map.item.name}"},children:[{tagName:"td",attributes:{part:"name-cell"},children:[{tagName:"span",attributes:{part:"package-name"},textContent:"${$map.item.name}"},{tagName:"span",attributes:{part:"dev-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/dev"},cases:{true:{tagName:"span",attributes:{part:"dev"},textContent:"· dev"}}}]},{tagName:"td",attributes:{part:"current"},textContent:"${$map.item.version}"},{tagName:"td",attributes:{part:"latest"},textContent:"${$map.item.latest}"},{tagName:"td",attributes:{part:"row-actions"},children:[{tagName:"div",attributes:{part:"actions"},children:[{tagName:"span",attributes:{part:"update-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/canUpdate"},cases:{true:{tagName:"jx-action-button",attributes:{part:"update"},$props:{icon:"arrows-clockwise",size:"sm",quiet:!0,label:"Update ${$map.item.name} to ${$map.item.upgrade}",hint:"Update ${$map.item.name} to ${$map.item.upgrade}",disabled:{$ref:"#/state/busy"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/update"},value:[{$ref:"$map/item/name"}]}]}}}},{tagName:"jx-action-button",attributes:{part:"remove"},$props:{icon:"trash",size:"sm",quiet:!0,label:"Remove ${$map.item.name}",hint:"Remove ${$map.item.name}",disabled:{$ref:"#/state/busy"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/remove"},value:[{$ref:"$map/item/name"}]}]}}]}]}]}}]}]}}}]};E("settings-packages",ZT);var eP=new WeakMap;function tP(e){let t=e.rows.map((r)=>({...r,canUpdate:r.upgrade!==""}));return{addName:e.addName,busy:e.busy,hasUpdates:t.some((r)=>r.canUpdate),listState:e.loading?"loading":t.length===0?"empty":"listed",loading:e.loading,rows:t}}function nP(e,t,r){let o=eP.get(e);if(o&&(o.handle===null||o.handle.root.isConnected)){Object.assign(o.scope,tP(t));return}o?.handle?.dispose(),e.textContent="";let a=g({...tP(t),...r}),i={handle:null,scope:a};eP.set(e,i),R("settings-packages",a,e).then((s)=>{i.handle=s})}var Ph=null,Zr=null,Eh=new Map,Fc=!1,Oi="";function rP(e){return Eh.get(e.name)??null}function Nh(e){let t=rP(e);return t&&GS(e.version,t)?t:null}function FV(e){return(Zr??[]).find((t)=>t.name===e)}async function oP(){let e=p();try{Zr=await e.listPackages()}catch{Zr=[]}if(Eh=new Map,e.packageVersions)try{for(let t of await e.packageVersions())Eh.set(t.name,t.latest)}catch{}_c()}async function Mi(e){if(Fc)return;Fc=!0,_c();let t=sl({status:"Running bun…",title:"Updating dependencies"});try{await e(),t.done()}catch(r){t.fail(r instanceof Error?r.message:String(r))}finally{Fc=!1,await oP()}}async function _V(){let e=Oi.trim();if(!e)return;await Mi(async()=>{await p().addPackage(e),Oi="",w.success(`Added ${e}.`)})}async function zV(e){await Mi(async()=>{await p().removePackage(e),w.success(`Removed ${e}.`)})}async function HV(e){let t=p(),r=FV(e),o=r?Nh(r):null;if(!t.setPackageVersions||!r||!o)return;await Mi(async()=>{let a=Jw(o),i=await t.setPackageVersions([{dev:Boolean(r.dev),name:r.name,version:`^${a}`}]);if(!i.ok)throw Error(i.log??"Update failed");w.success(`Updated ${r.name} to ${a}.`)})}async function BV(){let e=p();if(!e.setPackageVersions)return;let t=(Zr??[]).map((r)=>{let o=Nh(r);return o?{dev:Boolean(r.dev),name:r.name,version:`^${Jw(o)}`}:null}).filter((r)=>r!==null);if(t.length===0)return;await Mi(async()=>{let r=await e.setPackageVersions(t);if(!r.ok)throw Error(r.log??"Update failed");w.success(`Updated ${t.length} package(s).`)})}async function VV(){let e=p();if(!e.installDependencies)return;await Mi(async()=>{let t=await e.installDependencies();if(!t.ok)throw Error(t.log??"Install failed");w.success("Dependencies reinstalled.")})}function WV(e){return{dev:Boolean(e.dev),latest:rP(e)??"—",name:e.name,upgrade:Nh(e)??"",version:e.version}}function qV(){return{addName:Oi,busy:Fc,loading:Zr===null,rows:(Zr??[]).map((e)=>WV(e))}}var UV={add:()=>{_V()},edit:(e)=>{Oi=e,_c()},reinstall:()=>{VV()},remove:(e)=>{zV(e)},update:(e)=>{HV(e)},updateAll:()=>{BV()}};function _c(){if(!Ph)return;nP(Ph,qV(),UV)}function aP(e){Ph=e,Zr=null,Oi="",_c(),oP()}function JV(){return C?.projectConfig??{}}function oa(){return JV().extensions??[]}function Bn(e=null){let t=new Set(oa()),r=new Set((e??[]).map((i)=>i.name)),o=new Map(Dv().map((i)=>[i.name,i])),a=[];for(let i of l0()){let s=i.specifier??i.name,l=i.installed??r.has(i.name),f=o.get(i.name),c={broken:t.has(s)&&!l,enabled:t.has(s),installed:l,name:i.name,origin:i.source==="first-party"?"catalog":"installed",sections:f?f.contributions.map((d)=>d.project.key):i.sections.map((d)=>d.key),specifier:s,title:i.title??i.name};if(i.description!==void 0)c.description=i.description;if(i.problem!==void 0)c.unavailable=i.problem;a.push(c)}for(let i of t){if(a.some((f)=>f.specifier===i))continue;let s=o.get(i),l={broken:!r.has(i)&&s===void 0,enabled:!0,installed:r.has(i),name:i,origin:"configured",sections:s?s.contributions.map((f)=>f.project.key):[],specifier:i,title:s?.title??i};if(s?.description!==void 0)l.description=s.description;a.push(l)}return a}var wt=null,Di=[];function jh(){return wt}function sP(){return Bn().filter((e)=>e.unavailable===void 0).map((e)=>e.name)}async function Ah(e){if(wt!==null)throw Error(`Another extension operation is running (${wt}).`);let t=Bn().find((o)=>o.specifier===e||o.name===e);if(t===void 0)throw RangeError(`command "project.enableExtension" argument "package": "${e}" is not an extension `+`this backend offers and is not installed — offered: ${sP().join(", ")||"none"}`);if(t.unavailable!==void 0)throw RangeError(`command "project.enableExtension" argument "package": "${e}" cannot be enabled on `+`this backend — ${t.unavailable}`);if(Di=[],t.enabled)return;wt=t.name;let r=!1;Ad();try{if(!t.installed){let o=qs({source:"Extensions",status:"Running bun…",title:`Install ${t.name}`});try{await p().addPackage(t.name),r=!0}catch(a){throw o.fail(`Could not install ${t.name} — ${a instanceof Error?a.message:String(a)}`),a}o.done()}await no({extensions:[...oa(),t.specifier]}),Di=r?["project.json","package.json"]:["project.json"]}finally{wt=null,Ad()}}async function Oh(e){if(wt!==null)throw Error(`Another extension operation is running (${wt}).`);let t=oa();if(!t.includes(e))return;wt=e,Ad();try{await no({extensions:t.filter((r)=>r!==e)})}finally{wt=null,Ad()}}async function Mh(e){if(oa().includes(e))throw RangeError(`command "packages.remove" argument "package": "${e}" is still enabled in project.json `+'"extensions" — disable it first, or the next build will fail on a missing package.');if(wt!==null)throw Error(`Another extension operation is running (${wt}).`);wt=e,Ad();try{await p().removePackage(e),w.success(`Removed ${e}.`)}finally{wt=null,Ad()}}function GV(e){return Bn().find((t)=>t.name===e||t.specifier===e)?.sections??[]}function iP(){return Bn().filter((e)=>e.enabled).map((e)=>e.specifier).join(", ")||"none"}function KV(){return[{args:Se({package:gl(sP,'The extension package to turn on, e.g. "@jxsuite/parser". A package that is not installed is installed first.')}),category:"Project",group:"7_settings_extensions",id:"project.enableExtension",level:"project",menus:["palette"],requires:"an open project",enablement:(e)=>e.project.open,undo:"none",aiTool:{description:'Turn on a Jx extension for this project: install its npm package if it is missing and add it to project.json "extensions". Enable an extension BEFORE writing the project.json section it owns, because a section belonging to a disabled extension is a schema error.',name:"enable_extension",report:({args:e})=>{let t=St("project.enableExtension",e,"package"),r=GV(t),o=r.length>0?` Its project.json sections are ${Di.length>0?"now ":""}valid: ${r.join(", ")}.`:"";return{summary:`${Di.length>0?`Enabled ${t}.`:`${t} was already enabled.`}${o} Enabled extensions: ${iP()}.`,wrote:Di}}},run:async(e,t)=>Ah(St("project.enableExtension",t,"package")),title:"Enable Extension"},{args:Se({package:gl(oa,"The extension to turn off. Its npm package stays installed.")}),category:"Project",group:"7_settings_extensions",id:"project.disableExtension",level:"project",menus:["palette"],requires:"an open project",enablement:(e)=>e.project.open,undo:"project",aiTool:{description:'Remove an extension from project.json "extensions". Its npm package stays installed, and the settings sections it contributed disappear. Remove any project.json sections it owns first, or the configuration will not validate.',name:"disable_extension",report:({args:e})=>`Disabled ${St("project.disableExtension",e,"package")}; its npm package is still installed. Ask before uninstalling it. Enabled extensions: ${iP()}.`},run:async(e,t)=>Oh(St("project.disableExtension",t,"package")),title:"Disable Extension"},{args:Se({package:Fe("The npm package to uninstall from this project.")}),category:"Project",destructive:!0,group:"9_danger",id:"packages.remove",level:"project",menus:["palette"],requires:"an open project",enablement:(e)=>e.project.open,undo:"none",run:async(e,t)=>Mh(St("packages.remove",t,"package")),title:"Remove Package"}]}function lP(e){e.registerAll(KV())}var cP={$schema:"https://jxsuite.com/schema/v1",$id:"StudioSettingsExtensions",$description:"Project Settings › Extensions: what this backend offers, what the project already has, and what `project.json` names that nothing could describe. The adapter (`surfaces/settings-extensions.ts`) hands in the groups already composed — each row carrying its own title, its package name, the sections it owns, the sentence its state deserves and why its switch cannot be used — plus whatever the last operation failed with. The document draws them and hands every flip straight back with what the switch now holds. Nothing here reads `project.json` or the catalogue: which extensions exist is the backend's answer, and a second definition of it in the markup would be wrong for a fork.",tagName:"div",attributes:{part:"extensions"},style:{$description:"The Extensions section's own look — what `.settings-extension-group`, `.settings-extension-group-title`, `.settings-toggle-row`, `.settings-toggle-row--broken`, `.settings-toggle-body`, `.settings-toggle-title`, `.settings-toggle-package`, `.settings-toggle-desc`, `.settings-toggle-sections`, `.settings-toggle-section`, `.settings-toggle-note`, `.settings-toggle-note--warn`, `.settings-toggle-actions`, `.settings-extension-toggle` and `.settings-extension-remove` used to say in `styles/panels.css`, keyed on `part` and re-pointed at the studio token layer. Those fifteen were this section's alone and go with it. Every one of them sized text with `var(--spectrum-font-size-75, 12px)` or a bare `10px`, and the first of those resolved only inside `<sp-theme>` — a document is mounted in the settings pane, where that name is not in scope and every rule would have taken its hard-coded fallback — so the sizes here are the kit's scale. `.settings-section-title`, `.settings-field-desc` and `.settings-field-error` are NOT deleted with them: seven other settings sections are still lit and still name them, so those rules keep their stylesheet and this document carries its own copy of each until the last of those converts.",display:"block",'& [part="title"]':{margin:"0 0 16px",fontSize:"16px",fontWeight:"600",color:"var(--fg)"},'& [part="intro"], & [part="group-desc"]':{$description:"The secondary line, twice: the section's own sentence and the sentence over each group. Both were `.settings-field-desc`.",margin:"0 0 6px",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"},'& [part="section-error"]':{$description:'The last operation that failed, said under the section title. Not a second announcement: `updateSiteConfig` already files a Problem for a rejected write and `activity.fail` files one for a rejected install. studio-ui-guidelines.md §13.1 makes INLINE the tier for "the value is on screen, and nothing else is the right place" — the Problem is about the file, and this line is about the switch the reader is looking at. It is `section-error` rather than `error`, the name every settings section uses, because every kit field draws a permanent `[part="error"]` of its own and the kit is light DOM: a rule on that name here would reach any field the section ever holds.',margin:"6px 0 0",fontSize:"var(--jx-text-md)",color:"var(--danger)"},'& [part="group"]':{display:"flex",flexDirection:"column",marginBottom:"16px"},'& [part="group-title"]':{margin:"0 0 2px",fontSize:"var(--jx-text-md)",fontWeight:"600",color:"var(--fg)"},'& [part="row"]':{$description:"A wrapping row, never an overflowing one (studio-ui-guidelines.md §4.6): the package name is author-supplied and unbounded, and Project Settings renders at two very different widths.",display:"flex",flexWrap:"wrap",alignItems:"flex-start",gap:"8px",padding:"8px",border:"1px solid var(--border)",borderRadius:"var(--radius)",marginTop:"4px"},'& [part="row"][data-broken]':{$description:"Enabled in `project.json` and not installed — the one state that fails the next build, so the row says so at its edge as well as in its note.",borderColor:"var(--warning)"},'& [part="body"]':{$description:"`min-width: 0` is the declaration that makes the wrap work: without it the package name below refuses to shrink past its min-content and sets the row's width.",flex:"1 1 220px",minWidth:"0",display:"flex",flexDirection:"column",gap:"2px"},'& [part="row-title"]':{fontSize:"var(--jx-text-md)",fontWeight:"600",color:"var(--fg)"},'& [part="package"]':{fontFamily:"var(--font-mono)",fontSize:"var(--jx-text-xs)",color:"var(--fg-dim)",overflowWrap:"anywhere"},'& [part="desc"]':{margin:"2px 0 0",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"},'& [part="sections"]':{display:"flex",flexWrap:"wrap",gap:"4px",marginTop:"4px"},'& [part="section"]':{$description:"One `project.json` key this extension owns, drawn as a chip so the reader can see what enabling it adds to the file.",padding:"1px 6px",borderRadius:"var(--radius)",background:"var(--accent-15)",fontFamily:"var(--font-mono)",fontSize:"var(--jx-text-xs)",color:"var(--fg)"},'& [part="note"], & [part="note-warn"]':{margin:"4px 0 0",fontSize:"var(--jx-text-xs)",color:"var(--fg-dim)"},'& [part="note-warn"]':{color:"var(--warning)"},'& [part="actions"]':{display:"flex",alignItems:"center",gap:"4px",flexShrink:"0"},'& [part="toggle"]':{$description:"The switch and the Remove button sit at the row's edges and do not take part in its wrap.",flexShrink:"0",marginTop:"2px"},'& [part="remove"]':{flexShrink:"0"},'& [part="empty"]':{$description:'The teaching empty state, drawn here rather than borrowed from `panels/empty-state.ts`: that helper is a lit template, and a document cannot call one. What is kept is the pattern\'s rules (studio-ui-guidelines.md §11) — one sentence saying what the region is FOR, never "no extensions", then where its content comes from — in the compact shape, which reads as a note inside an otherwise populated pane rather than as a whole empty region. It offers no action because there is nothing here to act on: a backend that lists no catalogue is not a project waiting to be filled in.',display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"4px",padding:"8px 12px",textAlign:"left",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="empty-message"], & [part="empty-detail"]':{margin:"0",maxWidth:"34ch",lineHeight:"1.5"},'& [part="empty-detail"]':{opacity:"0.8"}},children:[{tagName:"h3",attributes:{part:"title"},textContent:"Extensions"},{tagName:"p",attributes:{part:"intro"},textContent:"Extensions add what the core does not do on its own: content collections, search, feeds, sign-ins and databases. Turning one on installs its package and enables it; turning it off leaves the package installed."},{tagName:"div",attributes:{part:"section-error-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasError"},cases:{true:{tagName:"p",attributes:{part:"section-error",role:"alert"},textContent:"${state.error}"}}},{tagName:"div",attributes:{part:"list-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/listState"},cases:{empty:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",attributes:{part:"empty-message"},textContent:"Extensions add what the core does not do on its own: content collections, search, feeds, sign-ins and databases."},{tagName:"p",attributes:{part:"empty-detail"},textContent:"This backend lists no catalogue, so nothing can be offered here yet."}]},groups:{tagName:"div",attributes:{part:"groups",role:"none"},style:{display:"contents"},children:[{$prototype:"Array",items:{$ref:"#/state/groups"},key:{$ref:"$map/item/origin"},map:{tagName:"div",attributes:{part:"group","data-origin":"${$map.item.origin}"},children:[{tagName:"h4",attributes:{part:"group-title"},textContent:"${$map.item.label}"},{tagName:"p",attributes:{part:"group-desc"},textContent:"${$map.item.blurb}"},{$prototype:"Array",items:{$ref:"$map/item/rows"},key:{$ref:"$map/item/name"},map:{tagName:"div",attributes:{part:"row","data-package":"${$map.item.name}","data-broken":"${$map.item.broken ? '' : null}"},children:[{tagName:"jx-switch",attributes:{part:"toggle"},$props:{size:"sm",label:{$ref:"$map/item/title"},checked:{$ref:"$map/item/enabled"},disabled:{$ref:"$map/item/blocked"},hint:{$ref:"$map/item/blockedReason"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/toggle"},value:[{$ref:"$map/item/specifier"},{$ref:"event#/target/checked"}]}]}},{tagName:"div",attributes:{part:"body"},children:[{tagName:"span",attributes:{part:"row-title"},textContent:"${$map.item.title}"},{tagName:"code",attributes:{part:"package"},textContent:"${$map.item.name}"},{tagName:"div",attributes:{part:"desc-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasDescription"},cases:{true:{tagName:"p",attributes:{part:"desc"},textContent:"${$map.item.description}"}}},{tagName:"div",attributes:{part:"sections-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasSections"},cases:{true:{tagName:"div",attributes:{part:"sections"},children:[{$prototype:"Array",items:{$ref:"$map/item/sections"},key:{$ref:"$map/item/key"},map:{tagName:"span",attributes:{part:"section"},textContent:"${$map.item.key}"}}]}}},{tagName:"div",attributes:{part:"note-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/noteTone"},cases:{note:{tagName:"p",attributes:{part:"note"},textContent:"${$map.item.note}"},warn:{tagName:"p",attributes:{part:"note-warn"},textContent:"${$map.item.note}"}}}]},{tagName:"div",attributes:{part:"actions"},children:[{tagName:"div",attributes:{part:"remove-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/canRemove"},cases:{true:{tagName:"jx-action-button",attributes:{part:"remove"},$props:{icon:"trash",size:"sm",label:{$ref:"$map/item/removeLabel"},hint:{$ref:"$map/item/removeHint"},disabled:{$ref:"$map/item/removeDisabled"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/remove"},value:[{$ref:"$map/item/name"}]}]}}}}]}]}}]}}]}}}]};E("settings-extensions",cP);function dP(e,t){e.groups=t.groups,e.listState=t.groups.length===0?"empty":"groups",e.error=t.error,e.hasError=t.error!==""}function pP(e,t,r){let o=g({error:"",groups:[],hasError:!1,listState:"empty",remove:r.remove,toggle:r.toggle});dP(o,t),e.replaceChildren();let a=null,i=!1;return R("settings-extensions",o,e).then((s)=>{if(i){s.dispose();return}a=s}),{connected:()=>!i&&(a===null?e.childNodes.length===0:a.root.parentNode===e),dispose(){i=!0,a?.dispose(),a=null},echo(s,l){for(let f of o.groups)for(let c of f.rows)if(c.specifier===s)c.enabled=l},update:(s)=>dP(o,s)}}var XV=[{blurb:"Extensions this project can turn on. Enabling one installs its package first if it is missing.",label:"Available",origin:"catalog"},{blurb:"Extension packages already in this project's dependencies.",label:"Installed",origin:"installed"},{blurb:"Named in project.json, but this backend does not describe them. You can still turn them off.",label:"Named in project.json",origin:"configured"}],Hc=null,Fh=new WeakMap,Bi=new WeakMap;function QV(e){if(e.unavailable!==void 0)return{note:e.unavailable,noteTone:"warn"};if(e.broken)return{note:`${e.name} is named in project.json but is not installed, so the next build will fail. Turn it off, or turn it off and on again to install it.`,noteTone:"warn"};if(!e.installed)return{note:"Not installed. Turning this on installs it first.",noteTone:"note"};return{note:"",noteTone:"none"}}function ZV(e){if(e.unavailable!==void 0&&!e.enabled)return e.unavailable;let t=jh();return t===null?"":`Waiting for ${t} to finish.`}function eW(e){let t=e.enabled?`Turn ${e.title} off first. Removing the package while project.json still names it would fail the next build.`:"";return{canRemove:e.installed,removeDisabled:t!==""||jh()!==null,removeHint:t===""?`Remove ${e.name}`:t,removeLabel:`Remove ${e.name}`}}function tW(e){let t=ZV(e);return{blocked:t!=="",blockedReason:t,broken:e.broken,description:e.description??"",enabled:e.enabled,hasDescription:(e.description??"")!=="",hasSections:e.sections.length>0,name:e.name,sections:e.sections.map((r)=>({key:r})),specifier:e.specifier,title:e.title,...QV(e),...eW(e)}}function uP(e){let t=Bn(Hc),r=[];for(let o of XV){let a=t.filter((i)=>i.origin===o.origin);if(a.length>0)r.push({blurb:o.blurb,label:o.label,origin:o.origin,rows:a.map((i)=>tW(i))})}return{error:Bi.get(e)??"",groups:r}}function Vi(e){let t=Fh.get(e);if(t?.connected()){t.update(uP(e));return}t?.dispose(),Fh.set(e,pP(e,uP(e),oW(e)))}async function _h(e){try{Hc=await p().listPackages()}catch{Hc=[]}Vi(e)}async function nW(e,t,r){Fh.get(e)?.echo(t,r),Bi.delete(e);let o=Bn(Hc).find((i)=>i.specifier===t);if(o===void 0){Vi(e);return}let a=o.enabled?Oh(o.specifier):Ah(o.specifier);Vi(e);try{await a}catch(i){Bi.set(e,X(i))}await _h(e)}async function rW(e,t){Bi.delete(e);let r=Mh(t);Vi(e);try{await r}catch(o){Bi.set(e,X(o))}await _h(e)}var mP=new WeakMap;function oW(e){let t=mP.get(e);if(!t)t={remove:(r)=>{rW(e,r)},toggle:(r,o)=>{nW(e,r,o)}},mP.set(e,t);return t}function fP(e){Vi(e),_h(e)}var hP={$schema:"https://jxsuite.com/schema/v1",$id:"StudioSettingsOverview",$description:"Project Settings › Overview: the project's identity. Its name, the description meta a search result reads, the production URL a sitemap is built from, its favicon, and the way through to Project Styles. Every row is a `jx-field` and every text control a `jx-textfield`, so the label, the sentence under it, the naming of the control and the announced refusal are all the kit's — this document draws the section's own rhythm and the favicon row, and nothing else. The adapter decides what is written and what is refused; nothing here reads `project.json`.",tagName:"div",attributes:{part:"overview"},style:{$description:"What is NOT in this block is the conversion. Four stylesheet rules had no counterpart to write: `.settings-field-label` and `.settings-field-desc` drew a row's label and the sentence under it, and `jx-field` draws both — with the label actually NAMING the control, which the bare `<label>` they styled never did; `.settings-field-error` drew a refused value's sentence, and `jx-textfield` draws that into a permanent live region under the field, so the first refusal is announced rather than only a later one; and `.settings-site-description`'s `min-height` sized a textarea the kit already gives three rows. What is left is what this section decides for itself.",display:"flex",flexDirection:"column",gap:"20px",fontFamily:"var(--jx-font-sans)",color:"var(--fg)",'& [part="heading"]':{margin:"0",fontSize:"16px",fontWeight:"600",color:"var(--fg)"},"& jx-textfield":{$description:"How wide a text control may grow. A name field spanning a 900px pane is a line the eye has to travel to read six characters; 420px is the measure `.settings-site-name`, `.settings-site-url` and `.settings-site-description` shared, and it is the one thing those three rules said that the kit does not.",width:"100%",maxWidth:"420px"},'& [part="favicon-row"], & [part="styles-row"]':{$description:'The two rows whose control is not a single field, and the reason each opens with a plain `div`: `jx-field` names the first thing slotted into it, and a button named by its row would be announced as "Favicon" or "Global Styles" instead of the verb it carries. A `div` observes no naming, so the row leaves it alone and the buttons keep the names they say on screen.',display:"flex",alignItems:"center",gap:"var(--jx-space-4)"},'& [part="favicon"], & [part="favicon-empty"]':{$description:"One box, whether or not there is an icon in it, so the row does not resize the moment an upload lands.",width:"32px",height:"32px",boxSizing:"border-box",borderRadius:"var(--radius)"},'& [part="favicon"]':{objectFit:"contain",border:"1px solid var(--border)",padding:"2px"},'& [part="favicon-empty"]':{display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed var(--border)",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)"},'& [part="favicon-path"]':{$description:"Where the icon came from. It read `--spectrum-font-size-50` with an 11px fallback, which resolved only inside `<sp-theme>` — this document is mounted in the settings pane, where that name is not in scope and every one of these would have taken the fallback — so the size is the kit's scale and the colour is the studio layer's.",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)",wordBreak:"break-all"},'& [part="section-error"], & [part="favicon-error"]':{$description:'A failed write with no control of its own to sit under. Settings save on change, so a rejection nobody shows reads as "my edit just vanished"; the sentence stands, in the danger colour, until a later write succeeds.',margin:"0",fontSize:"var(--jx-text-sm)",color:"var(--danger)"}},children:[{tagName:"h3",attributes:{part:"title"},textContent:"Overview"},{tagName:"div",attributes:{part:"section-error-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasSectionError"},cases:{true:{tagName:"p",attributes:{part:"section-error",role:"alert"},textContent:"${state.sectionError}"}}},{tagName:"jx-field",$props:{span:!0,label:"Site Name",description:"What this site is called — used in page titles and the project list.",invalid:{$ref:"#/state/nameInvalid"}},attributes:{part:"row","data-field":"name"},children:[{tagName:"jx-textfield",$props:{size:"sm",placeholder:"My Site",value:{$ref:"#/state/nameValue"},invalid:{$ref:"#/state/nameInvalid"},error:{$ref:"#/state/nameError"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setName"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{span:!0,label:"Description",description:"One or two sentences about the site. Search engines and link previews show this.",invalid:{$ref:"#/state/descriptionInvalid"}},attributes:{part:"row","data-field":"description"},children:[{tagName:"jx-textfield",$props:{size:"sm",multiline:!0,placeholder:"A short description of the site",value:{$ref:"#/state/descriptionValue"},invalid:{$ref:"#/state/descriptionInvalid"},error:{$ref:"#/state/descriptionError"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setDescription"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{span:!0,label:"Production URL",description:"Where the published site lives. Sitemaps and absolute links are built from it.",invalid:{$ref:"#/state/urlInvalid"}},attributes:{part:"row","data-field":"url"},children:[{tagName:"jx-textfield",$props:{size:"sm",type:"url",placeholder:"https://example.com",value:{$ref:"#/state/urlValue"},invalid:{$ref:"#/state/urlInvalid"},error:{$ref:"#/state/urlError"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setUrl"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{span:!0,label:"Favicon",description:"Upload an image to use as the site favicon."},attributes:{part:"row","data-field":"favicon"},children:[{tagName:"div",attributes:{part:"favicon-row"},children:[{tagName:"div",attributes:{part:"favicon-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasFavicon"},cases:{true:{tagName:"img",attributes:{part:"favicon",src:"${state.faviconSrc}",alt:"Current favicon"}},false:{tagName:"div",attributes:{part:"favicon-empty","aria-hidden":"true"},textContent:"—"}}},{tagName:"jx-button",$props:{size:"sm"},attributes:{part:"favicon-upload"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/uploadFavicon"}}]},children:[{tagName:"span",textContent:"Upload Favicon"}]},{tagName:"span",attributes:{part:"favicon-path-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasFavicon"},cases:{true:{tagName:"span",attributes:{part:"favicon-path"},textContent:"${state.favicon}"}}}]},{tagName:"div",attributes:{part:"favicon-error-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasFaviconError"},cases:{true:{tagName:"p",attributes:{part:"favicon-error",role:"alert"},textContent:"${state.faviconError}"}}}]},{tagName:"jx-field",$props:{span:!0,label:"Global Styles",description:"The CSS variables and the default element styles that apply across every page live in the Styles workspace, which edits this same file."},attributes:{part:"row","data-field":"styles"},children:[{tagName:"div",attributes:{part:"styles-row"},children:[{tagName:"jx-button",$props:{size:"sm",disabled:{$ref:"#/state/stylesDisabled"}},attributes:{part:"styles-open",title:"${state.stylesTitle}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openStyles"}}]},children:[{tagName:"span",textContent:"Go to Styles"}]}]}]}]};E("settings-overview",hP);function qi(e,t){return e?.field===t?e.message:""}function gP(e,t){if(t.name!==void 0)e.nameValue=t.name;if(t.description!==void 0)e.descriptionValue=t.description;if(t.url!==void 0)e.urlValue=t.url;if(t.favicon!==void 0)e.favicon=t.favicon,e.hasFavicon=t.favicon!=="";if(t.faviconSrc!==void 0)e.faviconSrc=t.faviconSrc;if(t.stylesTitle!==void 0)e.stylesTitle=t.stylesTitle;if(t.stylesDisabled!==void 0)e.stylesDisabled=t.stylesDisabled;if(t.error!==void 0){let{error:r}=t;e.nameError=qi(r,"name"),e.nameInvalid=e.nameError!=="",e.descriptionError=qi(r,"description"),e.descriptionInvalid=e.descriptionError!=="",e.urlError=qi(r,"url"),e.urlInvalid=e.urlError!=="",e.faviconError=qi(r,"favicon"),e.hasFaviconError=e.faviconError!=="",e.sectionError=qi(r,"section"),e.hasSectionError=e.sectionError!==""}}function bP(e,t,r){let o=g({descriptionError:"",descriptionInvalid:!1,descriptionValue:"",favicon:"",faviconError:"",faviconSrc:"",hasFavicon:!1,hasFaviconError:!1,hasSectionError:!1,nameError:"",nameInvalid:!1,nameValue:"",openStyles:r.openStyles,sectionError:"",setDescription:r.setDescription,setName:r.setName,setUrl:r.setUrl,stylesDisabled:!1,stylesTitle:"",uploadFavicon:r.uploadFavicon,urlError:"",urlInvalid:!1,urlValue:""});gP(o,t),e.replaceChildren();let a=null,i=!1;return R("settings-overview",o,e).then((s)=>{if(i){s.dispose();return}a=s}),{connected:()=>!i&&(a===null?e.childNodes.length===0:a.root.parentNode===e),dispose(){i=!0,a?.dispose(),a=null},update:(s)=>gP(o,s)}}var Wc=new WeakMap,zh=new WeakMap;function Hh(){return C?.projectConfig||{}}function qc(e){return e.tagName==="meta"&&e.attributes?.name==="description"}function iW(e){let r=(e.$head??[]).find((o)=>qc(o))?.attributes?.content;return n(r)?r:""}function sW(e,t){let r=t.trim();if(!e.some((o)=>qc(o)))return r?[...e,{attributes:{content:r,name:"description"},tagName:"meta"}]:[...e];if(!r)return e.filter((o)=>!qc(o));return e.map((o)=>qc(o)?{...o,attributes:{...o.attributes,content:r}}:o)}function Bh(e){let t=e.attributes?.rel;return e.tagName==="link"&&n(t)&&t.toLowerCase().split(/\s+/u).some((r)=>r==="icon")}function yP(e){let t=(e.$head??[]).find((r)=>Bh(r))?.attributes?.href;return n(t)?t:""}function lW(e,t){if(!e.some((r)=>Bh(r)))return[...e,{attributes:{href:t,rel:"icon"},tagName:"link"}];return e.map((r)=>{if(!Bh(r))return r;let{type:o,...a}=r.attributes??{};return{...r,attributes:{...a,href:t}}})}function cW(e){let t=e.name.lastIndexOf("."),r=t>0?e.name.slice(t+1).toLowerCase():"";return/^[a-z0-9]+$/u.test(r)?`favicon.${r}`:"favicon.ico"}var dW={url:void 0},pW="workspace.focus.styles";function vP(e){let t=Hh(),r=ae()?.get(pW);return{description:iW(t),error:Wc.get(e)??null,favicon:yP(t),faviconSrc:hv(yP(t),an),name:t.name??"",stylesDisabled:r===void 0,stylesTitle:r?.title??"",url:t.url??""}}function uW(e){let t=(i)=>{zh.get(e)?.update(i)},r=async(i,s="section")=>{try{await no(i),Wc.delete(e)}catch(l){Wc.set(e,{field:s,message:`Could not save project.json — ${X(l)}`})}Jc(e)},o=(i,s)=>{Wc.set(e,{field:i,message:s}),Jc(e)};return{openStyles:()=>{nt("view.setWorkspace",{workspace:"styles"},"Settings")},setDescription:(i)=>{t({description:i}),r({$head:sW(Hh().$head??[],i)},"description")},setName:(i)=>{t({name:i});let s=i.trim();if(!s){o("name","A project name is required.");return}r({name:s},"name")},setUrl:(i)=>{t({url:i});let s=i.trim();if(s&&!/^https?:\/\/\S+$/.test(s)){o("url","Enter a full address starting with http:// or https://");return}r(s?{url:s}:dW,"url")},uploadFavicon:()=>{let i=document.createElement("input");i.type="file",i.accept="image/*,.ico,.svg",i.addEventListener("change",async()=>{let s=i.files?.[0];if(!s)return;let l=cW(s);try{await p().uploadFile(`public/${l}`,s)}catch(f){o("favicon",`Could not upload the favicon — ${X(f)}`);return}await r({$head:lW(Hh().$head??[],`/${l}`)},"favicon")}),i.click()}}}function Jc(e){let t=zh.get(e);if(t?.connected()){t.update(vP(e));return}t?.dispose(),zh.set(e,bP(e,vP(e),uW(e)))}var wP={$schema:"https://jxsuite.com/schema/v1",$id:"StudioSettingsHead",$description:"Project Settings › Site head: the project-level Google Fonts the site imports, and the raw `$head` tags it emits on every page. The adapter hands in one projection row per `$head` entry — which field set to draw, and the strings each field holds — so this document decides nothing about what an entry means, only what it looks like.",tagName:"div",attributes:{part:"head-settings"},style:{$description:"The section's own look. `.head-code-editor` is gone rather than moved: it drew a mono face, a padded box on `--bg-input`, a border, a radius and a vertical resize handle around a bare `<textarea>`, and a `jx-textfield` with `multiline`, `mono` and `rows` is all six — so the code boxes lost a rule and gained nothing. `.head-entry-fields`, `.head-entry-body`, `.head-entries` and `.head-add-actions` had no stylesheet rule at all; their layout was carried by inline `style=` attributes, which is what the parts below replace.",display:"block",'& [part="section"] + [part="section"]':{$description:"The gap between Google Fonts and Head. `.settings-section` was an orphan class with no rule anywhere, so the two sections ran together and only the add-row's inline `margin-top` kept them apart — the separation is drawn here instead of implied.",marginTop:"var(--jx-space-6)"},'& [part="section-title"]':{margin:"0 0 var(--jx-space-5)",fontSize:"16px",fontWeight:"600",color:"var(--fg)"},'& [part="section-desc"]':{margin:"0 0 6px",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"},'& [part="entry"], & [part="font-row"]':{border:"1px solid var(--border)",borderRadius:"var(--radius)",padding:"var(--jx-space-4)",marginBottom:"var(--jx-space-3)"},'& [part="font-row"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-3)"},'& [part="font-name"]':{flex:"1",minWidth:"0",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--fg)"},'& [part="fonts"]':{marginBottom:"var(--jx-space-4)"},'& [part="font-add"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-3)"},'& [part="font-input"]':{flex:"1",minWidth:"0"},'& [part="empty"]':{margin:"0",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"},'& [part="entry-header"]':{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"var(--jx-space-3)"},'& [part="entry-tag"]':{fontSize:"var(--jx-text-md)",fontWeight:"600",color:"var(--fg)"},'& [part="entry-fields"]':{$description:"One column, gapped. The rows used to space themselves with `margin-bottom` on each `.settings-field-row`, which left a trailing margin under the last one inside the entry's own padding.",display:"flex",flexDirection:"column",gap:"var(--jx-space-3)",minWidth:"0"},'& [part="field-row"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-3)",minWidth:"0"},'& [part="field-wide"]':{flex:"1",minWidth:"0"},'& [part="body-field"]':{width:"100%"},'& [part="add-actions"]':{display:"flex",gap:"var(--jx-space-3)",marginTop:"var(--jx-space-4)"}},children:[{tagName:"section",attributes:{part:"section","data-section":"fonts"},children:[{tagName:"h3",attributes:{part:"section-title"},textContent:"Google Fonts"},{tagName:"p",attributes:{part:"section-desc"},textContent:"Manage Google Fonts imported across all pages in this project."},{tagName:"div",attributes:{part:"fonts",role:"none"},$switch:{$ref:"#/state/fontsState"},cases:{empty:{tagName:"p",attributes:{part:"empty"},textContent:"No fonts imported."},listed:{tagName:"div",attributes:{part:"font-list",role:"none"},children:[{$prototype:"Array",items:{$ref:"#/state/fonts"},key:{$ref:"$map/item/id"},map:{tagName:"div",attributes:{part:"font-row"},children:[{tagName:"span",attributes:{part:"font-name"},textContent:"${$map.item.family}"},{tagName:"jx-action-button",$props:{icon:"trash",size:"sm",label:"Remove ${$map.item.family}",hint:"Remove ${$map.item.family}"},attributes:{part:"remove-font"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/removeFont"},value:[{$ref:"$map/item/id"}]}]}}]}}]}}},{tagName:"div",attributes:{part:"font-add"},children:[{tagName:"jx-textfield",$props:{size:"sm",label:"Font family name",placeholder:"Font family name…",value:{$ref:"#/state/fontDraft"}},attributes:{part:"font-input"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/draftFont"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/addFont"},value:[]}]}}]}},{tagName:"jx-button",$props:{size:"sm"},attributes:{part:"add-font"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/addFont"},value:[]}]},children:[{tagName:"span",textContent:"+ Add"}]}]}]},{tagName:"section",attributes:{part:"section","data-section":"head"},children:[{tagName:"h3",attributes:{part:"section-title"},textContent:"Head"},{tagName:"p",attributes:{part:"section-desc"},textContent:"Manage global <head> tags — stylesheets, meta tags, scripts, and inline styles."},{tagName:"div",attributes:{part:"entries",role:"none"},children:[{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/id"},map:{tagName:"div",attributes:{part:"entry"},children:[{tagName:"div",attributes:{part:"entry-header"},children:[{tagName:"span",attributes:{part:"entry-tag"},textContent:"<${$map.item.tag}>"},{tagName:"jx-action-button",$props:{icon:"trash",size:"sm",label:"Remove the <${$map.item.tag}> tag",hint:"Remove the <${$map.item.tag}> tag"},attributes:{part:"remove-entry"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/remove"},value:[{$ref:"$map/item/id"}]}]}}]},{tagName:"div",attributes:{part:"entry-fields",role:"none"},$switch:{$ref:"$map/item/kind"},cases:{link:{tagName:"div",attributes:{part:"field-row"},children:[{tagName:"jx-textfield",$props:{size:"sm",label:"rel",value:"${$map.item.rel}"},attributes:{part:"field","data-key":"rel"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/edit"},value:[{$ref:"$map/item/id"},"rel",{$ref:"event#/target/value"}]}]}},{tagName:"jx-textfield",$props:{size:"sm",label:"href",value:"${$map.item.href}"},attributes:{part:"field-wide","data-key":"href"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/edit"},value:[{$ref:"$map/item/id"},"href",{$ref:"event#/target/value"}]}]}}]},meta:{tagName:"div",attributes:{part:"field-row"},children:[{tagName:"jx-textfield",$props:{size:"sm",label:"name",value:"${$map.item.name}"},attributes:{part:"field","data-key":"name"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/edit"},value:[{$ref:"$map/item/id"},"name",{$ref:"event#/target/value"}]}]}},{tagName:"jx-textfield",$props:{size:"sm",label:"content",value:"${$map.item.content}"},attributes:{part:"field-wide","data-key":"content"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/edit"},value:[{$ref:"$map/item/id"},"content",{$ref:"event#/target/value"}]}]}}]},script:{tagName:"div",attributes:{part:"field-row"},children:[{tagName:"jx-textfield",$props:{size:"sm",label:"src",placeholder:"URL or leave empty for inline",value:"${$map.item.src}"},attributes:{part:"field-wide","data-key":"src"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/edit"},value:[{$ref:"$map/item/id"},"src",{$ref:"event#/target/value"}]}]}}]},"script-inline":{tagName:"div",attributes:{part:"field-group",role:"none"},style:{display:"contents"},children:[{tagName:"div",attributes:{part:"field-row"},children:[{tagName:"jx-textfield",$props:{size:"sm",label:"src",placeholder:"URL or leave empty for inline",value:"${$map.item.src}"},attributes:{part:"field-wide","data-key":"src"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/edit"},value:[{$ref:"$map/item/id"},"src",{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{label:"Script body",span:!0},attributes:{part:"body-row"},children:[{tagName:"jx-textfield",$props:{size:"sm",multiline:!0,mono:!0,rows:"6",value:"${$map.item.body}"},attributes:{part:"body-field","data-key":"content",spellcheck:"false"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/edit"},value:[{$ref:"$map/item/id"},"content",{$ref:"event#/target/value"}]}]}}]}]},style:{tagName:"jx-field",$props:{label:"Style body",span:!0},attributes:{part:"body-row"},children:[{tagName:"jx-textfield",$props:{size:"sm",multiline:!0,mono:!0,rows:"8",value:"${$map.item.body}"},attributes:{part:"body-field","data-key":"content",spellcheck:"false"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/edit"},value:[{$ref:"$map/item/id"},"content",{$ref:"event#/target/value"}]}]}}]}}}]}}]},{tagName:"div",attributes:{part:"add-actions"},children:[{$prototype:"Array",items:{$ref:"#/state/tags"},key:{$ref:"$map/item/tag"},map:{tagName:"jx-button",$props:{size:"sm"},attributes:{part:"add-entry","data-tag":"${$map.item.tag}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/add"},value:[{$ref:"$map/item/tag"}]}]},children:[{tagName:"span",textContent:"${$map.item.label}"}]}}]}]}]};E("settings-head",wP);var fW=[{label:"+ Link",tag:"link"},{label:"+ Meta",tag:"meta"},{label:"+ Script",tag:"script"},{label:"+ Style",tag:"style"}],Xi=new WeakMap,xP=0;function $P(e){let t=Xi.get(e);if(t===void 0)xP+=1,t=`head-${xP}`,Xi.set(e,t);return t}var kP=null,Vh=[];function ro(){let e=C?.projectConfig??null;if(e!==kP){if(kP=e,Vh=[],td)td.fontDraft=""}let t=e?.$head;if(Array.isArray(t))Vh=t;return Vh}function hW(e){return ro().find((t)=>Xi.get(t)===e)}function Vn(e){return n(e)?e:""}function gW(e){let t=e.attributes??{},r=Vn(t.src),o=Vn(e.tagName),a=new Map([["link","link"],["meta","meta"],["script",r===""?"script-inline":"script"],["style","style"]]);return{body:Vn(e.textContent),content:Vn(t.content),href:Vn(t.href),id:$P(e),kind:a.get(o)??"none",name:Vn(t.name),rel:Vn(t.rel),src:r,tag:o}}function bW(){let e=ro(),t=e.filter((r)=>ew(r));return{fonts:t.map((r)=>({family:vD(Vn(r.attributes?.href)),id:$P(r)})),fontsState:t.length===0?"empty":"listed",rows:e.map((r)=>gW(r))}}function Ui(){no({$head:ro()})}var Gi=new Map;function Yc(){for(let e of Gi.values())clearTimeout(e.timer),e.commit();Gi.clear()}function yW(e,t,r){let o=hW(e);if(!o)return;if(t==="content"&&(o.tagName==="script"||o.tagName==="style"))o.textContent=r;else o.attributes??={},o.attributes[t]=r;Ui()}var td=null;function Ji(){Object.assign(Ki(),bW())}function Ki(){return td??=g({add(e){Yc();let t={},r={attributes:t,tagName:e};if(e==="link")t.rel="stylesheet",t.href="";else if(e==="meta")t.name="",t.content="";else if(e==="script")t.src="";else if(e==="style")r.textContent="";ro().push(r),Ui(),Ji()},addFont(){Yc();let e=Ki().fontDraft.trim();if(e==="")return;let t=ro();wD(t),t.push({attributes:{href:yD(e),rel:"stylesheet"},tagName:"link"}),Ki().fontDraft="",Ui(),Ji()},draftFont(e){Ki().fontDraft=e},edit(e,t,r){let o=`${e}:${t}`;clearTimeout(Gi.get(o)?.timer);let a=()=>{Gi.delete(o),yW(e,t,r)};Gi.set(o,{commit:a,timer:setTimeout(a,d1)})},fonts:[],fontDraft:"",fontsState:"empty",remove(e){Yc();let t=ro(),r=t.findIndex((o)=>Xi.get(o)===e);if(r===-1)return;t.splice(r,1),Ui(),Ji()},removeFont(e){Yc();let t=ro(),r=t.findIndex((a)=>Xi.get(a)===e);if(r===-1)return;t.splice(r,1);let o=xD(t);if(o!==t)t.length=0,t.push(...o);Ui(),Ji()},rows:[],tags:fW}),td}var Zc=null,Yi=null,aa=null;function vW(){let e=Yi;if(Yi=null,aa)aa.dispose(),aa=null;else if(e)e.then((t)=>{t.dispose()});Zc=null}function Wh(e){if(Ji(),Zc===e&&aa?.root.parentNode===e)return;if(Yi!==null&&Zc===e&&aa===null)return;vW(),Zc=e,e.textContent="";let t=R("settings-head",Ki(),e);Yi=t,t.then((r)=>{if(Yi===t)aa=r;else r.dispose()})}var SP={$schema:"https://jxsuite.com/schema/v1",$id:"StudioSettingsLocales",$description:"Project Settings → Locales: the languages this site is written in, which of them a page is written in when its file carries no locale directory, and how a locale is spelled in a URL. The adapter (`surfaces/settings-locales.ts`) hands in the declared list AS THE AUTHOR WROTE IT, the two option lists, what the pending tag refuses to be and whatever the last write left to say; the document draws them and hands every edit straight back. Nothing here reads `project.json` — a section that re-read the config while drawing would be a second opinion about a file one module already owns.",tagName:"section",attributes:{part:"locales"},style:{$description:"The Locales section's own look. Three of the rules it used to borrow are gone rather than moved: `.settings-field-label` and `.settings-field-desc` are what `jx-field` draws for a labelled row (and it also names the control the label belongs to, which a bare `<label class=…>` never did), and the refusal under the tag field is `jx-textfield`'s own `error` sentence, whose region is permanent so the FIRST refusal is announced rather than only a later one.",display:"block",'& [part="title"]':{margin:"0 0 16px",fontSize:"16px",fontWeight:"600",color:"var(--fg)"},'& [part="intro"]':{margin:"0 0 16px",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"},'& [part="section-error"]':{$description:"A write that failed, said under the section title rather than pinned to a control: settings save on change, so a silent rejection would read as \"my edit just vanished\", and the whole file failed rather than one field. It is `section-error` rather than `error` because the tag field's refusal IS the kit's own `[part=\"error\"]` sentence, in this same light-DOM tree: a rule on that name gave the tag field's refusal this margin and size, and reached the two pickers' empty regions as well.",margin:"6px 0 0",fontSize:"var(--jx-text-md)",color:"var(--danger)"},'& [part="field"]':{marginBottom:"20px"},'& [part="panel"]':{$description:"The language list. It used to borrow `.settings-list-panel`, whose `width: 200px` is the LEFT NAV of the two-column editors that class was written for — a fixed 200px column is not what a list of languages under a 320px picker wants, so the width it takes here is the one that lines up with the two controls below it. Its `overflow-y: auto` went the same way: nothing constrains this panel's height, so the declaration could never do anything.",display:"flex",flexDirection:"column",gap:"4px",padding:"12px",maxWidth:"320px",background:"var(--bg-panel)",borderRadius:"var(--radius)"},'& [part="row"]':{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px",padding:"4px 8px"},'& [part="name"]':{fontSize:"var(--jx-text-md)",color:"var(--fg)",overflowWrap:"anywhere"},'& [part="tag"]':{$description:`The raw BCP 47 tag beside the language's own name. Both are shown because they answer different questions — "which language is this" is the autonym, "what do I type in a path" is the tag — and a row showing only one of them sends the author to the docs to find the other.`,marginInlineStart:"auto",fontFamily:"var(--font-mono)",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"},'& [part="empty"]':{$description:"Drawn as a row rather than as a centred panel: `.settings-empty-state` centres itself because in a two-column editor it fills the whole right pane, and this one is a line where the first language will be.",padding:"4px 8px",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"},'& [part="add"]':{display:"flex",alignItems:"center",gap:"6px"},'& [part="add-field"]':{flex:"1",minWidth:"0"},'& [part="default"], & [part="routing"]':{maxWidth:"320px"}},children:[{tagName:"h3",attributes:{part:"title"},textContent:"Locales"},{tagName:"p",attributes:{part:"intro"},textContent:"The languages this site is written in. A translation is a file under the locale's directory — pages/fr/about.json beside pages/about.json — so declaring a language here is what makes that directory mean something to the build and to Studio."},{tagName:"div",attributes:{part:"section-error-slot",role:"none"},$switch:{$ref:"#/state/hasError"},cases:{true:{tagName:"p",attributes:{part:"section-error",role:"alert"},textContent:"${state.error}"}}},{tagName:"jx-field",attributes:{part:"field"},$props:{label:"Languages",span:!0},children:[{tagName:"div",attributes:{part:"panel"},children:[{tagName:"div",attributes:{part:"list",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/listState"},cases:{empty:{tagName:"div",attributes:{part:"empty"},textContent:"No languages declared."},listed:{tagName:"div",attributes:{part:"rows",role:"none"},style:{display:"contents"},children:[{$prototype:"Array",items:{$ref:"#/state/locales"},key:{$ref:"$map/item/tag"},map:{tagName:"div",attributes:{part:"row"},children:[{tagName:"span",attributes:{part:"name"},textContent:"${$map.item.label}"},{tagName:"span",attributes:{part:"tag"},textContent:"${$map.item.tag}"},{tagName:"jx-action-button",attributes:{part:"remove"},$props:{icon:"trash",size:"sm",label:"Remove ${$map.item.tag}",hint:"Remove ${$map.item.tag}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/remove"},value:[{$ref:"$map/item/tag"}]}]}}]}}]}}},{tagName:"div",attributes:{part:"add"},children:[{tagName:"jx-textfield",attributes:{part:"add-field"},$props:{label:"Language tag",placeholder:"fr-CA",size:"sm",value:{$ref:"#/state/pending"},invalid:{$ref:"#/state/invalid"},error:{$ref:"#/state/refusal"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/edit"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/add"},value:[]}]}}]}},{tagName:"jx-button",attributes:{part:"add-button"},$props:{size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/add"},value:[]}]},children:[{tagName:"span",textContent:"Add"}]}]}]}]},{tagName:"jx-field",attributes:{part:"field"},$props:{label:"Default Language",description:"The language a page is written in when its file carries no locale directory.",span:!0},children:[{tagName:"jx-select",attributes:{part:"default"},$props:{label:"Default Language",size:"sm",options:{$ref:"#/state/localeOptions"},value:{$ref:"#/state/defaultLocale"},disabled:{$ref:"#/state/noLocales"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/chooseDefault"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",attributes:{part:"field"},$props:{label:"URL Routing",description:"Whether the default language owns the unprefixed URLs, or every language is named in its own.",span:!0},children:[{tagName:"jx-select",attributes:{part:"routing"},$props:{label:"URL Routing",size:"sm",options:{$ref:"#/state/routings"},value:{$ref:"#/state/routing"},disabled:{$ref:"#/state/noLocales"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/chooseRouting"},value:[{$ref:"event#/target/value"}]}]}}]}]};E("settings-locales",SP);var CP=new WeakMap;function TP(e){return{...e,hasError:e.error!=="",invalid:e.refusal!=="",listState:e.locales.length===0?"empty":"listed",noLocales:e.locales.length===0}}function PP(e,t,r){let o=CP.get(e);if(o&&(o.handle===null||o.handle.root.isConnected)){Object.assign(o.scope,TP(t));return}o?.handle?.dispose(),e.textContent="";let a=g({...TP(t),...r}),i={handle:null,scope:a};CP.set(e,i),R("settings-locales",a,e).then((s)=>{i.handle=s})}var EP=new WeakMap;function oo(e){let t=EP.get(e);if(!t)t={error:"",pending:""},EP.set(e,t);return t}async function Qi(e,t){try{await no(t),oo(e).error=""}catch(r){oo(e).error=`Could not save project.json — ${X(r)}`}qh(e)}function ao(){return C?.projectConfig??{}}var xW={i18n:void 0},jP=[{label:"Prefix every locale but the default",value:"prefix-except-default"},{label:"Prefix every locale",value:"prefix-always"}];function Zi(){let e=ao().i18n?.locales;return Array.isArray(e)?e.filter((t)=>typeof t==="string"):[]}function RP(e){let t=jn(e);return Zi().some((r)=>jn(r)===t)}async function AP(e){let t=jn(e);if(t===null)return w.error(`"${e}" is not a well-formed language tag.`,{detail:"Languages are BCP 47 tags — a language, optionally a script and a region: `fr`, "+"`pt-BR`, `zh-Hant`. Underscores and spaces are not part of the grammar.",source:"Languages"}),!1;if(RP(t))return w.info(`${Wt(t)} is already one of this project's languages.`,{source:"Languages"}),!1;return await no({i18n:{...ao().i18n,locales:[...Zi(),t]}}),!0}function IP(e){let t=oo(e).pending.trim();if(t==="")return"";if(!Fx(t))return`"${t}" is not a well-formed language tag. Try \`fr\`, \`pt-BR\` or \`zh-Hant\`.`;return RP(t)?`${Wt(t)} is already declared.`:""}function kW(e){let t=Zi(),{i18n:r}=ao(),{error:o,pending:a}=oo(e);return{defaultLocale:r?.defaultLocale??t[0]??"",error:o,localeOptions:t.map((i)=>({label:Wt(i),value:i})),locales:t.map((i)=>({label:Wt(i),tag:i})),pending:a,refusal:IP(e),routing:r?.routing??"prefix-except-default",routings:jP.map((i)=>({label:i.label,value:i.value}))}}function qh(e){PP(e,kW(e),CW(e))}function $W(e){let t=oo(e).pending.trim();if(t===""||IP(e)!=="")return;oo(e).pending="",Qi(e,{i18n:{...ao().i18n,locales:[...Zi(),jn(t)]}})}function SW(e,t){let r=Zi().filter((s)=>s!==t);if(r.length===0){Qi(e,xW);return}let o=ao().i18n,a=o?.defaultLocale!==void 0&&jn(o.defaultLocale)===jn(t),i={...o};if(a)i.defaultLocale=r[0];i.locales=r,Qi(e,{i18n:i})}var NP=new WeakMap;function CW(e){let t=NP.get(e);if(!t)t={add:()=>{$W(e)},chooseDefault:(r)=>{Qi(e,{i18n:{...ao().i18n,defaultLocale:r}})},chooseRouting:(r)=>{let o=jP.find((a)=>a.value===r)?.value;if(o===void 0)return;Qi(e,{i18n:{...ao().i18n,routing:o}})},edit:(r)=>{oo(e).pending=r,qh(e)},remove:(r)=>{SW(e,r)}},NP.set(e,t);return t}function LP(e){qh(e)}var TW=ib.code,OP=hD;ql({group:"general",icon:"sliders-horizontal",key:"overview",label:"Overview",order:10,render:Jc});ql({group:"general",icon:"globe",key:"locales",label:"Locales",order:25,render:LP});ql({group:"integrations",icon:"share-network",key:"extensions",label:"Extensions",order:5,render:fP});ql({group:"advanced",icon:"browser",key:"contexts",label:"Contexts",order:15,render:Ec});ql({group:"advanced",icon:"file-code",key:"head",label:"Site head",order:20,render:Wh});ql({group:"advanced",icon:"brackets-curly",key:"definitions",label:"Data Shapes",order:40,render:Oc});ql({group:"advanced",icon:"cube",key:"dependencies",label:"Packages",order:60,render:aP});ql({group:"advanced",icon:"code",key:"rawJson",label:"Raw JSON",order:900,render:(e)=>{MD(e,{editAsCode:()=>{bn(TW)}})}});function Uh(e){if(e===ib.variables||e===ib.elements)u.stylebook.view=e}function bn(e=u.stylebook.view){let t=C;if(!t)return null;Uh(e);let r=m.tabs.get(an);if(r){for(let a of OP.toReversed())if(!r.capabilities.modes.includes(a))r.capabilities.modes.unshift(a);return r.session.ui.canvasMode=e,r.session.ui.preview=!1,PW(r)}let o=Si({capabilities:{modes:[...OP]},document:t.projectConfig??{},documentPath:an,id:an});return o.session.ui.canvasMode=e,o.session.ui.preview=!1,A$(o),o}function PW(e){for(let t of m.panes)if(t.tabOrder.includes(e.id)){t.activeTabId=e.id,Sr(t.id);break}return e}async function EW(e){if(e!==void 0)SS(e);let t=ae();if(!t)throw Error(`command "settings.open" needs the window's command registry`);await t.run("view.setWorkspace",{workspace:"settings"});let r=Da($a("settings"))?.id;if(r!==void 0)kN(r);try{let{syncExtensionSettingsSections:o}=await (ce("vjzw46xb"),import("./chunks/extension-sections-vjzw46xb.js"));await o()}catch(o){w.warn(`Could not load extension settings sections — ${X(o)}`,{key:"settings:sections",path:an,source:"Settings",tier:"problem"})}Ad()}function NW(){return[{args:{additionalProperties:!1,properties:{entry:Fe("An entry key inside the named section (map-layout sections only), e.g. a content type or a data connection."),section:Fe("The settings section key to show. Defaults to the section shown last, or Overview.")},required:[],type:"object"},category:"Project",id:"settings.open",level:"project",keybinding:"mod+shift+,",menus:["commandbar/overflow","settings/menu","palette"],group:"7_settings",requires:"an open project",enablement:(e)=>e.project.open,run:async(e,t)=>{let r=ti("settings.open",t,"section"),o=ti("settings.open",t,"entry");if(await EW(r),r===void 0){if(o!==void 0)throw RangeError('command "settings.open" argument "entry" needs a "section" to name an entry of');return}let a=vT();if(!a.includes(r))throw RangeError(`command "settings.open" argument "section": "${r}" is not a registered `+`settings section — registered: ${a.join(", ")}`);if(o===void 0)return;let i=xN(r,o);if(i!==null)throw RangeError(`command "settings.open" argument "entry": "${o}" is not an entry of settings section "${r}" — entries: ${i.join(", ")||"none"}`);Ad()},title:"Open Project Settings"},{args:Se({view:pi(O_,"Which view of the project's styles to show: elements (element defaults by tag name), variables (the CSS custom properties) or code (project.json as text). Defaults to the view the Styles workspace was left in.")},[]),category:"Project",id:"styles.open",level:"project",menus:["never"],group:"7_settings_styles",requires:"an open project",enablement:(e)=>e.project.open,run:async(e,t)=>{let r=t.view===void 0?null:qn("styles.open",t,"view",O_),o=ae();if(!o)throw Error(`command "styles.open" needs the window's command registry`);if(await o.run("view.setWorkspace",{workspace:"styles"}),r!==null)bn(ib[r])},title:`Open ${Ky}`}]}function MP(e){e.registerAll(NW())}var DP={$schema:"https://jxsuite.com/schema/v1",$id:"StudioStylesPanel",$description:"The Styles panel (specs/studio.md §7.1): the Styles workspace's Navigator, and the way into everything the workspace edits. Three sections, in the order a visit usually needs them. VARIABLES lists every CSS custom property in project.json's root style block, by its real name, grouped as the Variables view groups them (Colors, Fonts, Sizes & Spacing, and Other when anything lands there), each group with its count and each colour with a swatch of what it resolves to; a group heading or a variable shows it in the Variables view, and Add variable focuses the view's own add row. ELEMENTS lists the element defaults by tag name, the specimen catalogue's tags and the project's components, with a dot on every tag project.json already styles; a row selects that tag on the Elements view's canvas, with the Inspector on its style. COLOR SCHEMES lists the schemes the project declares, with Manage color schemes leading to Project Settings › Contexts, where they are defined. `panels/styles-panel.ts` keeps every decision; this document draws rows whose every field is already a string.",tagName:"div",attributes:{part:"styles"},style:{$description:"The Styles panel's own look, keyed on `part`. Rows are native buttons, because a row opens one thing and a button is the element that says so to every reader, and they are the Outline's 24px row so the Navigator reads as one family. A group heading is a row too, at the section's weight, carrying its count. The swatch is the one value this document takes from data: its colour is the variable's resolved value, written as the swatch's background by the binding, never by a style attribute. THE INDENT IS A VARIABLE for the reason `panel-data.json` gives: one shared rule reads `--row-indent`.",display:"flex",flexDirection:"column",minHeight:"0",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",'& [part="sections"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-3)",padding:"var(--jx-space-2) 0 var(--jx-space-4)"},'& [part="section"]':{display:"flex",flexDirection:"column"},'& [part="section-head"]':{display:"flex",alignItems:"baseline",gap:"var(--jx-space-2)",padding:"var(--jx-space-2) var(--jx-space-3) var(--jx-space-1)"},'& [part="section-title"]':{flex:"1",margin:"0",fontSize:"var(--jx-text-sm)",fontWeight:"600",letterSpacing:"0.04em",textTransform:"uppercase",color:"var(--fg-dim)"},'& [part="section-count"], & [part="row-count"]':{flexShrink:"0",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)",fontVariantNumeric:"tabular-nums"},'& [part="rows"]':{display:"flex",flexDirection:"column",margin:"0",padding:"0",listStyle:"none"},'& [part="group-row"], & [part="variable-row"], & [part="element-row"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",width:"100%",blockSize:"24px",boxSizing:"border-box",margin:"0",padding:"0 var(--jx-space-3)",paddingInlineStart:"var(--row-indent, var(--jx-space-3))",border:"none",borderInlineStart:"2px solid transparent",background:"none",color:"inherit",font:"inherit",textAlign:"start",whiteSpace:"nowrap",cursor:"pointer",":hover":{background:"var(--hover-bg)"},":focus-visible":{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"}},'& [part="group-row"]':{fontWeight:"600"},'& [part="variable-row"]':{paddingInlineStart:"calc(var(--jx-space-3) + var(--jx-space-4))"},'& [aria-current="true"]':{background:"var(--accent-20)",borderInlineStartColor:"var(--accent)"},'& [part="row-label"]':{flex:"1",minWidth:"0",overflow:"hidden",textOverflow:"ellipsis"},'& [part="var-name"], & [part="tag"]':{flex:"1",minWidth:"0",overflow:"hidden",textOverflow:"ellipsis",fontFamily:"var(--font-mono)",fontSize:"var(--jx-text-sm)"},'& [part="var-value"]':{flexShrink:"1",maxWidth:"90px",overflow:"hidden",textOverflow:"ellipsis",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)"},'& [part="swatch"]':{$description:"What the colour resolves to, drawn as a 12px chip with a hairline so a white or transparent value still reads as a chip.",flexShrink:"0",width:"12px",height:"12px",borderRadius:"var(--jx-radius-xs)",border:"1px solid var(--border)",boxSizing:"border-box"},'& [part="element-group-label"]':{padding:"var(--jx-space-1) var(--jx-space-3) 0",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="dot"]':{$description:"project.json already styles this tag. The kit's neutral disc in the accent.",background:"var(--accent)"},'& [part="scheme-row"]':{display:"flex",alignItems:"baseline",gap:"var(--jx-space-2)",padding:"var(--jx-space-1) var(--jx-space-3)"},'& [part="scheme-query"]':{flex:"1",minWidth:"0",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontFamily:"var(--font-mono)",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="note"], & [part="no-project"]':{margin:"0",padding:"var(--jx-space-1) var(--jx-space-3)",fontSize:"var(--jx-text-sm)",lineHeight:"1.5",color:"var(--fg-dim)"},'& [part="foot"]':{padding:"var(--jx-space-1) var(--jx-space-2) 0"},"@(forced-colors: active)":{'& [aria-current="true"]':{$description:"The current row, redrawn: in forced colours the accent wash collapses into the page and the leading edge is the marker left.",borderInlineStartColor:"Highlight"},'& [part="swatch"]':{forcedColorAdjust:"none"}}},children:[{tagName:"div",attributes:{part:"body-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/body"},cases:{none:{tagName:"p",attributes:{part:"no-project"},textContent:"Open a project to edit its styles."},styles:{tagName:"div",attributes:{part:"sections"},children:[{tagName:"section",attributes:{part:"section","data-section":"variables","aria-labelledby":"styles-panel-variables"},children:[{tagName:"div",attributes:{part:"section-head"},children:[{tagName:"h3",attributes:{part:"section-title",id:"styles-panel-variables"},textContent:"Variables"},{tagName:"span",attributes:{part:"section-count"},textContent:"${state.variableCount}"}]},{tagName:"div",attributes:{part:"variables-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/variablesState"},cases:{empty:{tagName:"p",attributes:{part:"note"},textContent:"Every CSS custom property in project.json's root style block is listed here, by its name. Add the first one with Add variable."},listed:{tagName:"div",attributes:{part:"groups",role:"none"},children:[{$prototype:"Array",items:{$ref:"#/state/groups"},key:{$ref:"$map/item/id"},map:{tagName:"div",attributes:{part:"group","data-group":"${$map.item.id}"},children:[{tagName:"button",attributes:{part:"group-row",type:"button",title:"Show ${$map.item.title} in the Variables view"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/showGroup"},value:[{$ref:"$map/item/id"}]}],description:"Switches the pane to the Variables view and scrolls this group's heading into view."},children:[{tagName:"span",attributes:{part:"row-label"},textContent:"${$map.item.title}"},{tagName:"span",attributes:{part:"row-count","aria-label":"${$map.item.countLabel}"},textContent:"${$map.item.count}"}]},{tagName:"ul",attributes:{part:"rows","aria-label":"${$map.item.title}"},children:[{$prototype:"Array",items:{$ref:"$map/item/variables"},key:{$ref:"$map/item/name"},map:{tagName:"li",attributes:{part:"item"},children:[{tagName:"button",attributes:{part:"variable-row",type:"button","data-token":"${$map.item.name}","aria-current":"${$map.item.selected ? 'true' : null}",title:"Edit ${$map.item.name} in the Variables view"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/selectVariable"},value:[{$ref:"$map/item/name"}]}],description:"Switches the pane to the Variables view, scrolls this custom property's row into view and puts the keyboard on its value."},children:[{tagName:"span",attributes:{part:"swatch-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/swatchState"},cases:{swatch:{tagName:"span",attributes:{part:"swatch","aria-hidden":"true"},style:{background:{$ref:"$map/item/swatch"}}}}},{tagName:"span",attributes:{part:"var-name"},textContent:"${$map.item.name}"},{tagName:"span",attributes:{part:"var-value"},textContent:"${$map.item.value}"}]}]}}]}]}}]}}},{tagName:"div",attributes:{part:"foot"},children:[{tagName:"jx-action-button",attributes:{part:"add-variable"},$props:{size:"sm",quiet:!0,icon:"plus",hint:"Add a CSS custom property in the Variables view"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/addVariable"},value:[]}],description:"Switches the pane to the Variables view and puts the keyboard on the add row of the current group (Colors when none is current)."},children:[{tagName:"span",textContent:"Add variable"}]}]}]},{tagName:"section",attributes:{part:"section","data-section":"elements","aria-labelledby":"styles-panel-elements"},children:[{tagName:"div",attributes:{part:"section-head"},children:[{tagName:"h3",attributes:{part:"section-title",id:"styles-panel-elements"},textContent:"Elements"},{tagName:"span",attributes:{part:"section-count","aria-label":"${state.customizedLabel}"},textContent:"${state.customizedCount}"}]},{$prototype:"Array",items:{$ref:"#/state/elementGroups"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"element-group","data-group":"${$map.item.key}"},children:[{tagName:"div",attributes:{part:"element-group-label"},textContent:"${$map.item.label}"},{tagName:"ul",attributes:{part:"rows","aria-label":"${$map.item.label}"},children:[{$prototype:"Array",items:{$ref:"$map/item/rows"},key:{$ref:"$map/item/key"},map:{tagName:"li",attributes:{part:"item"},children:[{tagName:"button",attributes:{part:"element-row",type:"button","data-path":"${$map.item.key}","aria-current":"${$map.item.selected ? 'true' : null}",title:"Style every ${$map.item.tag} on the site"},style:{"--row-indent":{$ref:"$map/item/indent"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/selectElement"},value:[{$ref:"$map/item/key"}]}],description:"Switches the pane to the Elements view, selects this tag on its canvas and shows its style in the Inspector."},children:[{tagName:"span",attributes:{part:"tag"},textContent:"${$map.item.tag}"},{tagName:"span",attributes:{part:"dot-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/customized"},cases:{true:{tagName:"jx-dot",attributes:{part:"dot",role:"img","aria-label":"Styled in project.json"}}}}]}]}}]}]}}]},{tagName:"section",attributes:{part:"section","data-section":"schemes","aria-labelledby":"styles-panel-schemes"},children:[{tagName:"div",attributes:{part:"section-head"},children:[{tagName:"h3",attributes:{part:"section-title",id:"styles-panel-schemes"},textContent:"Color schemes"}]},{tagName:"div",attributes:{part:"schemes-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/schemesState"},cases:{empty:{tagName:"p",attributes:{part:"note"},textContent:"The light and dark schemes declared in Contexts are listed here, and each lets a color variable take a value of its own in it."},listed:{tagName:"ul",attributes:{part:"rows","aria-label":"Color schemes"},children:[{$prototype:"Array",items:{$ref:"#/state/schemes"},key:{$ref:"$map/item/key"},map:{tagName:"li",attributes:{part:"scheme-row","data-scheme":"${$map.item.key}"},children:[{tagName:"span",attributes:{part:"row-label"},textContent:"${$map.item.label}"},{tagName:"span",attributes:{part:"scheme-query"},textContent:"${$map.item.query}"}]}}]}}},{tagName:"div",attributes:{part:"foot"},children:[{tagName:"jx-action-button",attributes:{part:"manage-schemes"},$props:{size:"sm",quiet:!0,haspopup:"dialog",hint:"Open Project Settings on Contexts, where color schemes are declared"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/manageSchemes"},value:[]}],description:'Project Settings on Contexts (`settings.open { section: "contexts" }`).'},children:[{tagName:"span",textContent:"Manage color schemes…"}]}]}]}]}}}]};E("styles-panel",DP);function RW(){return{body:"none",customizedCount:"0",customizedLabel:"",elementGroups:[],groups:[],schemes:[],schemesState:"empty",variableCount:"0",variablesState:"empty"}}function FP(e,t){e.body=t.body,e.variableCount=t.variableCount,e.variablesState=t.variablesState,e.groups=t.groups,e.elementGroups=t.elementGroups,e.customizedCount=t.customizedCount,e.customizedLabel=t.customizedLabel,e.schemesState=t.schemesState,e.schemes=t.schemes}function _P(e,t,r){let o=g({...RW(),...r});FP(o,t);let a=null,i=!1,s=R("styles-panel",o,e).then((l)=>{if(i)return l.dispose(),l;return a=l,l});return{connected:()=>{if(i)return!1;let l=a?.root;return l===void 0?!0:e.contains(l)},dispose(){i=!0,a?.dispose(),a=null},ready:s,update:(l)=>{FP(o,l)}}}var AW="Styles";function IW(){let e=m.tabs.get(an);return(e?e.doc.document:C?.projectConfig)??null}function LW(){return{catalogue:vp,components:Ne,config:C?IW():null,selection:u.stylebook.selection,variable:u.stylebook.variable}}function zP(e,t){return`${e} ${t}${e===1?"":"s"}`}function OW(e,t){return F_(e).filter(({group:r,tokens:o})=>r.id!=="other"||o.length>0).map(({group:r,tokens:o})=>({count:String(o.length),countLabel:zP(o.length,"variable"),id:r.id,title:r.title,variables:o.map((a)=>{let i=r.id==="color"?Ac(e,a.value):void 0;return{name:a.name,selected:a.name===t,swatch:i===void 0?"":String(i),swatchState:r.id==="color"?"swatch":"none",value:String(a.value)}})}))}function MW(e,t){let r=e.catalogue.$sections.map((o)=>({key:o.label,label:o.label,rows:Xy(o.elements,e.selection).map((a)=>({customized:Zy(t,a.path),indent:`${bp+a.depth*Gy}px`,key:a.path,selected:a.selected,tag:a.tag}))}));if(e.components.length>0)r.push({key:"components",label:"Components",rows:e.components.map((o)=>({customized:Zy(t,o.tagName),indent:`${bp}px`,key:o.tagName,selected:o.tagName===e.selection,tag:o.tagName}))});return r}function DW(e){return j_(e).filter((t)=>t.kind==="scheme").map((t)=>{let r=e?.[t.name];return{key:t.name,label:t.label,query:n(r)?r:""}})}function Jh(e=LW()){if(!e.config)return{body:"none",customizedCount:"0",customizedLabel:"",elementGroups:[],groups:[],schemes:[],schemesState:"empty",variableCount:"0",variablesState:"empty"};let t=_(e.config.style)?e.config.style:{},r=OW(t,e.variable),o=r.reduce((l,f)=>l+f.variables.length,0),a=MW(e,t),i=a.reduce((l,f)=>l+f.rows.filter((c)=>c.customized).length,0),s=DW(e.config.$media);return{body:"styles",customizedCount:`${i} styled`,customizedLabel:`${zP(i,"tag")} styled`,elementGroups:a,groups:r,schemes:s,schemesState:s.length>0?"listed":"empty",variableCount:String(o),variablesState:o>0?"listed":"empty"}}function FW(e){return e==="color"||e==="font"||e==="size"||e==="other"}function _W(e=u.stylebook.variable){return e===null?"color":P_(e)}var zW={addVariable:()=>{bn("tokens"),cc({add:!0,group:_W(),kind:"group"})},manageSchemes:()=>{nt("settings.open",{section:"contexts"},AW)},selectElement:(e)=>{bn("stylebook"),Ld(e,void 0,{panCanvas:!0}),ko("right",!1)},selectVariable:(e)=>{bn("tokens"),cc({kind:"variable",name:e})},showGroup:(e)=>{if(!FW(e))return;bn("tokens"),cc({add:!1,group:e,kind:"group"})}},yn=null;function HW(e){if(yn&&(yn.host!==e||!yn.handle.connected()))Gh();if(yn){yn.handle.update(Jh());return}let t=_P(e,Jh(),zW),r=me();r.run(()=>{te(()=>{t.update(Jh())})}),yn={handle:t,host:e,scope:r}}function BW(e){return e.querySelector(".panel-content")??e}function HP(){ei({id:"styles",title:"Styles",level:"project",dock:"navigator",icon:"paint-brush",rail:!1,render:()=>ft,afterRender:(e,t)=>{HW(BW(t))}})}function Gh(){yn?.scope.stop(),yn?.handle.dispose(),yn=null}var VW=()=>!1;function es(){if(Np("site"))return;gD(),yT(),HP(),MT(),ei({id:"search",title:"Search",level:"project",dock:"navigator",icon:"magnifying-glass",rail:!1,when:VW,render:()=>WW()}),OC(),aE(),VD(),JC(),eC(),ph()}function WW(){throw Error("This Navigator panel is declared but not built — its `when` predicate should have hidden it.")}function BP(){return es(),[...RA(),...rx("navigator").filter((e)=>e.rail===!1)]}var so=(e)=>e.document.open&&zx(e);function VP(e){let t=h.value;if(!t)return;let r=Oe(t.session.selection);if(!r){t.session.selection=[[]];return}let o=Vt(r);if(!o)return;let a=oe(t.doc.document,o),i=zi(r)+e;if(i>=0&&i<rr(a).length)t.session.selection=[[...o,"children",i]]}function qW(){let e=h.value;if(!e)return;let t=Oe(e.session.selection),r=(t?Vt(t):null)??[],o=oe(e.doc.document,r),a=rr(o).flatMap((i,s)=>_(i)?[[...r,"children",s]]:[]);if(a.length>0)e.session.selection=a}function UW(){let e=h.value,t=Oe(e?.session.selection);if(!e||!t)return;let r=oe(e.doc.document,t);if(rr(r).length>0)e.session.selection=[[...t,"children",0]]}function JW(){let e=h.value,t=Oe(e?.session.selection);if(!e||!t)return;let r=Vt(t);e.session.selection=t.length>=2&&r?[r]:[]}function GW(){let e=h.value,t=Oe(e?.session.selection);if(!e||!t)return;let r=Vt(t);if(!r)return;let o=zi(t),a=[...r,"children",o+1];Z(e,(i)=>{or(i,r,o+1,{tagName:"p",textContent:""}),i.session.selection=[a]})}function KW(){let e=h.value,t=e?.session.selection??[];if(e&&t.length>0)Z(e,(r)=>n0(r,t))}function YW(){let e=h.value,t=(e?.session.selection??[]).filter((r)=>r.length>=2);if(e&&t.length>0)Z(e,(r)=>Ym(r,t))}function XW(){let e=m.activeTabId;if(e)ab(e)}function QW(){let e=h.value;if(e)t1(e)}function ZW(){let e=h.value;if(e)mM(e)}var WP=1.2,e2=34,t2=300;function UP(e){return e.canvas.view==="edit"}function n2(e,t){if(UP(e)){Fp(1);return}let r=h.value;if(!r)return;r.session.ui.zoom=1,t()}function qP(e,t,r){let o=h.value;if(!o)return;if(UP(e)){Fp(o.session.ui.editZoom*t);return}jm(Fm()*t),r()}var r2={inspector:"right",navigator:"left"};function o2(e,t){if(t==="bottom"){let o=!u.docks.right.collapsed&&Hl()==="assistant";Yh(e,"view.setAssistant",{open:!o});return}let r=r2[t];ko(r,!u.docks[r].collapsed)}function Yh(e,t,r){if(e.get(t)&&e.isEnabled(t))Tn(e,t,r,"Keyboard")}var od=null;function a2(){if(od){let t=od;od=null;for(let r of $x)ko(r,t[r]??!1);return}let e={};for(let t of $x)e[t]=u.docks[t].collapsed,ko(t,!0);od=e}var Kh=["rail","navigator","pane","inspector","dock","status"];function i2(e,t,r){let o=Kh.indexOf(e),a=Kh.length;for(let i=1;i<=a;i++){let s=Kh[(o+t*i+a*a)%a];if(r(s))return s}return null}var s2='a[href], button, input, textarea, select, [tabindex]:not([tabindex="-1"])';function ad(e){let t=hf(jI[e]);if(!t)return!1;u.focusRegion=e;let r=t.querySelector(s2);if(r)return r.focus(),!0;return t.tabIndex=-1,t.focus(),!0}function l2(e){let t=i2(u.focusRegion,e,(r)=>Boolean(hf(jI[r])));if(t)ad(t)}function c2(e){let t=HC(e,"panel.focus");if(u.leftTab===t&&!u.docks.left.collapsed&&u.focusRegion==="navigator"){ko("left",!0),ad("pane");return}Kc(t),ad("navigator")}function d2(e,t){if(ko("right",!1),t==="assistant")Yh(e,"view.setAssistant",{open:!0});else Yh(e,"view.setRightTab",{tab:t});ad("inspector")}var p2={focused:"That project was already open — bringing its window to the front.",newWindow:"Opened the project in a new window.",opened:"Opened the project in this window."};function u2(e){return new Promise((t)=>{let r=!1,o=(i)=>{if(r)return;r=!0,a.close(),t(i)},a=Zs({cancelLabel:"Cancel",confirmLabel:"New Window",headline:"Open Project",layer:dt("dialog"),message:`${e} is open in this window. Where should the project you pick open?`,onCancel:()=>o("cancel"),onClosed:()=>o("cancel"),onConfirm:()=>o("newWindow"),onSecondary:()=>o("thisWindow"),region:"project/open-target",secondaryLabel:"This Window",size:"sm"})})}async function m2(e){let t=ye()?p():null,r=t!==null&&Q(t.openProjectInNewWindow)&&Q(t.pickProject);if(!C||!r){await e.openProject("thisWindow");return}let o=C.name,a=await u2(o);if(a==="cancel")return;let i=await e.openProject(a);if(i==="cancelled")return;w.info(p2[i],{key:"project.open",source:"Project"})}function f2(e){let t=()=>{e().setPan(16,16),e().applyTransform()},r=()=>e().applyTransform();return[...lE(),{category:"Edit",group:"1_clipboard",id:"edit.paste",keybinding:"mod+v",keyScope:"canvas",level:"document",requires:"an open document",run:()=>{cD()},title:"Paste",undo:"document",when:so},{category:"Selection",group:"3_structure",id:"selection.insertSibling",keybinding:"enter",keyScope:"canvas",level:"selection",requires:"an element selection that is not the document root",run:()=>GW(),title:"Insert Paragraph After",undo:"document",when:Wx},{category:"Selection",group:"2_navigate",id:"selection.selectPrevious",keybinding:"arrowup",keyScope:"canvas",level:"selection",requires:"an open document",run:()=>VP(-1),title:"Select Previous Sibling",undo:"none",when:so},{category:"Selection",group:"2_navigate",id:"selection.selectNext",keybinding:"arrowdown",keyScope:"canvas",level:"selection",requires:"an open document",run:()=>VP(1),title:"Select Next Sibling",undo:"none",when:so},{category:"Selection",group:"2_navigate",id:"selection.selectAll",keybinding:"mod+a",keyScope:"canvas",level:"selection",requires:"an open document",run:()=>qW(),title:"Select All",undo:"none",when:so},{category:"Selection",group:"2_navigate",id:"selection.selectFirstChild",keybinding:"arrowright",keyScope:"canvas",level:"selection",requires:"an element selection with children",run:()=>UW(),title:"Select First Child",undo:"none",when:vh},{category:"View",group:"6_zoom",id:"canvas.zoomReset",keyScope:"canvas",level:"document",requires:"an open document",run:(o)=>n2(o,t),title:"Reset Zoom",undo:"none",when:so},{category:"View",group:"6_zoom",id:"canvas.zoomIn",keybinding:["mod+=","mod++","mod+shift++"],keyScope:"canvas",level:"document",requires:"an open document",run:(o)=>qP(o,WP,r),title:"Zoom In",undo:"none",when:so},{category:"View",group:"6_zoom",id:"canvas.zoomOut",keybinding:"mod+-",keyScope:"canvas",level:"document",requires:"an open document",run:(o)=>qP(o,1/WP,r),title:"Zoom Out",undo:"none",when:so}]}function JP(e,t,r){let o=()=>r(bo(m.activePaneId));e.registerAll(lm({closeDocument:XW,cycleRegion:l2,deleteSelection:YW,duplicateSelection:KW,focusInspectorTab:(a)=>d2(e,a),focusPanel:c2,buildSite:()=>t.buildSite(),openInBrowser:()=>t.openInBrowser(),openPalette:(a)=>{mb(a)},newWindow:()=>{(ye()?p():null)?.newWindow?.()},panelRoster:BP(),openProject:()=>m2(t),redo:ZW,saveDocument:()=>t.saveDocument(),selectParent:JW,toggleDock:(a)=>{o2(e,a)},toggleZen:a2,undo:QW})),e.registerAll(f2(o))}function h2(e,t){let r=e.handleKeyEvent(t,qO(e.context()));if(r)t.preventDefault();return r}function GP(e,t){jO(e),KP=t,window.addEventListener("resize",()=>{for(let r of Zp())if(Vo(r.paneId)==="edit")lh(r)}),document.addEventListener("keydown",(r)=>{h2(e,r)}),document.addEventListener("wheel",(r)=>{let{target:o}=r;if((r.ctrlKey||r.metaKey)&&!(o instanceof Element&&o.closest(Ex)))r.preventDefault()},{passive:!1})}var g2=new Set(["content-home","entry","grid","media","image","media-home","preview","publish-home","settings-home","tokens"]);function b2(e,t,r){let{target:o}=e,a=o instanceof Element?o:o instanceof Node?o.parentElement:null;while(a&&a!==t){if(a instanceof HTMLElement&&a!==r&&x2(a,e.deltaX,e.deltaY))return!0;a=a.parentElement}return!1}function x2(e,t,r){let o=r>0&&e.scrollTop<e.scrollHeight-e.clientHeight-1,a=r<0&&e.scrollTop>0,i=t>0&&e.scrollLeft<e.scrollWidth-e.clientWidth-1||t<0&&e.scrollLeft>0;if(!o&&!a&&!i)return!1;let s=getComputedStyle(e),l=(f)=>f==="auto"||f==="scroll"||f==="overlay";return(o||a?l(s.overflowY):!1)||(i?l(s.overflowX):!1)}var KP=null;function YP(e){let t=e.wrap,r=null,o,a=!1,i=()=>{let c=r;if(!c||a)return;a=!0,c.settle().then((d)=>{a=!1;let b=t.querySelector('[part="edit-canvas"]');if(d!==null&&b)b.scrollTop+=d-c.top})},s=()=>KP?.(e)??$2(),l=new AbortController,{signal:f}=l;return t.addEventListener("wheel",(c)=>{let{canvasMode:d,panX:b,panY:y,setPan:x,applyTransform:S}=s(),P=bt(e.paneId);if(d==="edit"){if(c.ctrlKey||c.metaKey){c.preventDefault();let k=P?.session.ui.editZoom??1,T=e.panels[0]?.canvas;r??=T?c$(T):null,iO(k*(1+-c.deltaY*0.005),e,c.clientY),setTimeout(i,e2),clearTimeout(o),o=setTimeout(()=>{i(),r=null},t2);return}let j=t.querySelector('[part="edit-canvas"]');if(j&&!b2(c,t,j))c.preventDefault(),j.scrollTop+=c.deltaY,j.scrollLeft+=c.deltaX;return}if(g2.has(d)){if(c.ctrlKey||c.metaKey)c.preventDefault();return}if(c.preventDefault(),c.ctrlKey||c.metaKey){jm(Fm(e)*(1+-c.deltaY*0.005),e,{clientX:c.clientX,clientY:c.clientY});return}else if(c.shiftKey)x(b-c.deltaY,y);else x(b-c.deltaX,y-c.deltaY);S()},{passive:!1,signal:f}),t.addEventListener("pointerdown",(c)=>{let d=s();if(d.canvasMode==="edit"||d.canvasMode==="preview")return;if(c.button!==1)return;c.preventDefault(),t.setPointerCapture(c.pointerId);let{clientX:b,clientY:y}=c,x=(P)=>{let{panX:j,panY:k,setPan:T,applyTransform:N}=s();T(j+(P.clientX-b),k+(P.clientY-y)),b=P.clientX,y=P.clientY,N()},S=()=>{t.releasePointerCapture(c.pointerId),t.removeEventListener("pointermove",x),t.removeEventListener("pointerup",S)};t.addEventListener("pointermove",x),t.addEventListener("pointerup",S)},{signal:f}),t.addEventListener("click",(c)=>{if(!k2(c.target,t,e.panzoomWrap))return;let d=bt(e.paneId);if(!d?.session.selection.length)return;d.session.selection=[]},{signal:f}),()=>{clearTimeout(o),l.abort()}}function k2(e,t,r){if(e===t||r!==null&&e===r)return!0;return e instanceof HTMLElement&&e.dataset.slot==="frame"&&t.contains(e)}function $2(){return{applyTransform:()=>{},canvasMode:"design",panX:0,panY:0,setPan:()=>{}}}var XP={$schema:"https://jxsuite.com/schema/v1",$id:"StudioPaneContext",$description:"The pane's own chrome — the pane context bar and the floating zoom pod, one mount per pane. It replaces `#tab-bar`, a 28px band styled identically to the tab strip above it that held five unrelated axes with no labels on any of them; the three axes here each say what they are, and the label is what stops the band re-accreting into an anonymous strip of chips. `panels/pane-context.ts` keeps every decision — which editor kinds a document declares, which canvas views it has, whether preview is a flag over them, what a lens may not write, which pane's stage a zoom verb lands on, and what a route param's candidate values are — and hands this document one projection of words, booleans and keyed rows. The bar and the banner share `[part=\"band\"]` so the adapter can MEASURE what the stage must clear: a banner's height is its wrapped text, and only layout knows how many lines that is.",tagName:"div",attributes:{part:"chrome"},style:{$description:"The `.pc-*` rules of `styles/canvas.css`, keyed on `part` and carried here, plus `.jx-collab-banner` from `styles/shell.css` — the banner rides in this band and the rule rides with it. Three token repairs travel with them, all of one shape: `--spectrum-font-size-75` and `--spectrum-font-size-50` resolved only inside `<sp-theme>` and a document mounts outside it, so every rule reading one would silently have taken its px fallback; they are `--jx-text-md` (12px) and `--jx-text-sm` (11px) here, at the same values. Four rules are DELETED rather than moved because the kit already draws them: `.pc-derive-trigger`'s hand-built 22×20 box and its hover are `jx-action-button` quiet, `.pc-preview-toggle[selected]`'s four Spectrum custom-property overrides are the `emphasized` prop, and `.pc-ctx-manage:hover`'s underline is the only half of that rule worth keeping. The one rule ADDED is `pointer-events: auto` on the band, the pod and the popovers: `.pane-chrome` is `pointer-events: none` and gave it to its direct children through `.pane-chrome > *`, which a document root with `display: contents` is not — so the three surfaces that take the pointer say so themselves, which is also the honest place for it.",display:"contents",'& [part="band"]':{$description:"The pane's top band: the bar plus the standing statements that must be readable before the first keystroke. One element so the adapter can MEASURE what the stage has to clear — a banner's height is its wrapped text, which only layout knows.",minWidth:"0",pointerEvents:"auto"},'& [part="bar"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-4)",height:"28px",padding:"0 var(--jx-space-3)",borderBottom:"1px solid var(--border)",background:"var(--bg-panel)",minWidth:"0",overflow:"hidden"},'& [part="spacer"]':{$description:"What pushes the other axes right, and where Back, the Editor axis and §18.4's preset trigger go. It stays in a lens, which draws no trigger: dropping it would move the one control a lens does draw. It grows but never shrinks below what it holds: at `min-width: 0` a narrow pane squeezed it under its own Editor segments, which then painted over the View and Context axes; now the bar's `overflow: hidden` clips at the trailing end instead.",display:"flex",flex:"1 0 auto",alignItems:"center",gap:"var(--jx-space-2)"},'& [part="back"]':{flexShrink:"0"},'& [part="axis"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",minWidth:"0"},'& [part="axis-label"]':{$description:"The label is the point: five unlabelled controls on a 28px band is what this replaces, and the name is what stops the band re-accreting into an anonymous strip of chips.",fontSize:"var(--jx-text-sm)",textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--fg-dim)",whiteSpace:"nowrap"},'& [part="static"]':{fontSize:"var(--jx-text-md)",color:"var(--fg)",whiteSpace:"nowrap"},'& [part="editor-kind"]':{$description:"A segmented strip that holds its width: the spacer it sits in is what gives way.",flexShrink:"0"},'& [part="views"]':{flexShrink:"0"},'& [part="preview-toggle"]':{$description:"Not a third radio, and it must not read as one: it says the canvas is inert. The margin separates the two axes the eye is being asked to read as separate; the accent fill is the kit's `emphasized`, which is what deleted the four Spectrum custom properties this rule used to carry. The toggle is `quiet: false`, so it rests as a framed button of its own beside the framed View switch, as the Spectrum button did; quiet, it read as a fourth loose word once the switch beside it drew its frame.",flexShrink:"0",marginInlineStart:"6px"},'& jx-action-button[part="preview-toggle"] > [part="control"]':{$description:"The text padding the View switch's segments get from their group, which this toggle stands outside: the small size's 2px is for a glyph, and 6px is what the group gives a text segment. (0,3,1) outranks the kit's small padding at (0,3,0).",paddingInline:"6px"},'& [part="context-trigger"]':{fontVariantNumeric:"tabular-nums"},'& [part="resolving-trigger"]':{fontVariantNumeric:"tabular-nums",flexShrink:"0"},'& [part="resolving-trigger-caret"]':{"--jx-icon-size":"12px"},'& [part="export"]':{flexShrink:"0"},'& [part="banner"]':{$description:"A standing statement, not an after-the-fact refusal: a guest without write access used to watch their edits apply locally and vanish at the publish gate. Inside the band the stage is offset by, so it pushes the document down instead of covering the one it is warning about.",padding:"6px 10px",borderBottom:"1px solid var(--border)",background:"var(--hover-bg)",color:"var(--fg-dim)",fontSize:"var(--jx-text-md)"},'& [part="pod"]':{$description:"Bottom-right of the pane, over the stage — a viewport control, which is not a document axis and so never belonged in a band beside one. It is a ROW of two controls and draws no box of its own: a 1px border and a 6px radius round 2px/4px of padding framed the zoom group's own frame and the Fit select's own frame, a frame inside a frame and busier than any other group in the chrome. Each control draws itself and takes `--pod-lift` to stand off the document under it, which is what the pod's fill and border used to do for both at once, and the gap between them says they are two controls rather than one strip with a seam. The right inset ADDS `--stage-scrollbar-w` because the chrome layer spans the whole cell, scrollbar gutter included: a fixed 12px put the pod 3px into Edit's 15px track, painting over it and swallowing its clicks. CSS cannot measure a scrollbar and this document cannot see the scroller, so `canvas/stage-scrollbar.ts` measures the stage's own and writes the width on the cell, where this reads it by cascade. It is 0 wherever the stage does not scroll or the scrollbar is an overlay. Physical right on purpose: Studio's chrome is never mirrored.","--pod-lift":"0 2px 8px rgb(0 0 0 / 25%)",alignSelf:"flex-end",display:"flex",alignItems:"center",gap:"var(--jx-space-2)",pointerEvents:"auto",margin:"0 calc(var(--jx-space-4) + var(--stage-scrollbar-w, 0px)) var(--jx-space-4) 0"},'& [part="zoom-group"]':{$description:"The segmented frame floats on its own now that the pod draws no box around it. The radius is the one the first and last segments already draw, so the shadow follows the shape of the strip instead of a rectangle around it — the host's box IS that strip, since the group has no padding and each member's -1px pulls its own host in by a pixel.",borderRadius:"var(--jx-radius-sm)",boxShadow:"var(--pod-lift)"},'& [part="pod"] > [part="zoom-group"][data-compact] > jx-action-button > [part="control"]':{$description:"One resting ink across the pod. A compact group rests its unselected members on `--jx-fg-dim` and brightens the chosen one, which is how a segmented control says which segment is on — and nothing in this pod is ever chosen: the three are a viewport verb, a readout and a verb. So the dim ink said nothing here and made `100%` read as disabled beside the Fit select's value, which is the same kind of readout at `--jx-fg`. (0,5,1) over the group's own resting rule at (0,4,1); the group's hover is (0,6,1) and still wins, which now leaves it only the wash.",color:"var(--fg)"},'& [part="zoom-label"]':{$description:"A floor under the percentage, so the pod does not shift as the value changes length. The width is the host's and the face is the control's, below: the control sets its own font and sits inside the host at its content width, so this rule used to carry a mono face nothing inherited and to open a 6px hole in the segmented frame before the `+` segment (measured: a 48px host round a 41.8px control, drawn in Inter).",minWidth:"48px"},'& [part="zoom-label"] > [part="control"]':{$description:"The control fills its 48px host, closing the frame, and draws the percentage in the mono face with tabular digits so a changing value does not jitter. (0,3,0) outranks the kit control's own face at (0,2,0).",flex:"1",fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums"},'& [part="fit"]':{maxWidth:"120px"},'& [part="fit"] > [part="control"]':{$description:"The pod's second control lifts off the document the way the first does, on the frame the kit's select already draws. On the control rather than the host, because the host is a column whose error region and help slot are the select's neighbours: the shadow has to follow the box that is painted.",boxShadow:"var(--pod-lift)"},'& [part="popover"]':{$description:"Both panels take the pointer that `.pane-chrome` withholds. A popover is in the top layer while it shows, which changes where it PAINTS and not where it is in the tree, so it inherits `pointer-events: none` from the chrome layer exactly as the band does.",pointerEvents:"auto"},'& [part="ctx"]':{$description:"One column of labelled groups over a footer that leaves for the definition site. This control only SELECTS; the definitions live in Project Settings › Contexts (§6.2), and nothing in it defines a breakpoint, a scheme or a feature query.",display:"flex",flexDirection:"column",gap:"10px",padding:"var(--jx-space-2) var(--jx-space-3)",minWidth:"240px",maxWidth:"340px"},'& [part="ctx-group"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-2)"},'& [part="ctx-group-label"]':{fontSize:"var(--jx-text-sm)",textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--fg-dim)"},'& [part="features"]':{$description:"The group that WRAPS, and the reason it is not a segmented control. A feature list is as long as the project makes it and this popover is a 240–340px column, so it folds onto a second line in any project with more than a few; a compact group cannot draw that — its seam is written in tree order, no selector can find the ends of a flex line, and it therefore refuses to wrap and would overflow the column instead (ui.md §5.4). Chips instead: each member draws its own rounded frame (`quiet: false`, since the group no longer frames it) and the chosen one takes the accent edge below. The gap is --jx-space-2 rather than the group's own 2px, which puts every small chip's hit area at the 24px floor on both axes instead of the 22px two overlapping extensions leave (§4.3). The size list used to wrap here beside it; it is a segmented group on the bar now, which clips at its trailing end rather than wrapping.",flexWrap:"wrap",gap:"var(--jx-space-2)"},'& [part="features-item"][data-selected] > [part="control"]':{$description:"A chosen chip reads the way a chosen segment does: the accent tint with an accent EDGE. A member's own selected state is a 15% tint over its neutral border, which among framed neighbours reads as a faint wash rather than as the one that is on — the measurement that gave the compact group its selected rule, restated here at the one place the group does not draw it. (0,4,0) over the member's own (0,3,0).",borderColor:"var(--jx-accent)",background:"var(--jx-accent-20)"},'& [part="fields"]':{$description:"The fields, stacked. They were a row on the bar capped at 140px; in the popover each takes the full column so a route value or a JSON test prop is readable while you type it.",display:"flex",flexDirection:"column",gap:"var(--jx-space-2)"},'& [part="param"]':{display:"block",width:"100%",maxWidth:"100%"},'& [part="prop"]':{display:"block",width:"100%",maxWidth:"100%"},'& [part="layout-switch"]':{margin:"0"},'& [part="manage"]':{alignSelf:"flex-start",padding:"var(--jx-space-1) 0",border:"none",background:"none",color:"var(--accent)",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",cursor:"pointer"},'& [part="manage"]:hover':{textDecoration:"underline"},'& [part="sizes"], & [part="schemes"]':{$description:"Segmented strips that hold their width; the bar clips at its trailing end rather than squeezing a segment.",flexShrink:"0"}},children:[{tagName:"div",attributes:{part:"band"},children:[{tagName:"div",attributes:{part:"bar","data-jx-region":"${state.contextRegion}"},children:[{tagName:"div",attributes:{part:"spacer"},children:[{$description:"Back to the workspace home, in a workspace that draws no tab strip (Media, Styles, Publish): the way out of a view opened beside the home — a media file, a comparison, `project.json` as Code — with the destination named, because there is no chip to click and no close button to press. It leads the bar so it sits where the strip's chips would have been. Escape runs the same command (`pane.backToHome`) wherever no text field or code editor owns the key.",tagName:"div",attributes:{part:"back-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/backState"},cases:{shown:{tagName:"jx-action-button",attributes:{part:"back"},$props:{size:"sm",quiet:!0,icon:"arrow-left",hint:{$ref:"#/state/backHint"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/goBack"},value:[]}]},children:[{tagName:"span",textContent:"${state.backLabel}"}]}}},{tagName:"div",attributes:{part:"editor-axis-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/editorState"},cases:{shown:{tagName:"div",attributes:{part:"axis","data-axis":"editor"},children:[{tagName:"span",attributes:{part:"axis-label"},textContent:"Editor"},{tagName:"div",attributes:{part:"editor-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/editorMode"},cases:{static:{tagName:"span",attributes:{part:"static","data-static":"editor"},textContent:"${state.editorLabel}"},picker:{tagName:"jx-action-group",attributes:{part:"editor-kind"},$props:{selects:"single",compact:!0,label:"Editor"},children:[{$prototype:"Array",items:{$ref:"#/state/editors"},key:{$ref:"$map/item/key"},map:{tagName:"jx-action-button",attributes:{part:"editor-kind-item","data-value":"${$map.item.value}"},$props:{size:"sm",checked:{$ref:"$map/item/checked"},hint:{$ref:"$map/item/hint"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/chooseEditor"},value:[{$ref:"$map/item/value"}]}]},children:[{tagName:"span",textContent:"${$map.item.label}"}]}}]}},$description:"The Editor axis leads the bar, beside Back: which editor the document is open in is the first thing the pane says about it, and the axes to its right describe that editor. Drawn only in the full bar (`hidden` in a lens, whose tab is the pane beside it). Several declared kinds are a segmented `jx-action-group`, like the View axis: they are few, and every one of them stays on screen rather than behind a dropdown."}]}}},{tagName:"div",attributes:{part:"preset-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/presetState"},cases:{shown:{tagName:"jx-action-button",attributes:{part:"preset"},$props:{size:"sm",quiet:!0,icon:"arrows-clockwise",label:"Show code, diff or layout beside",hint:"Show this document's code, diff, layout or another breakpoint beside it",haspopup:"menu"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openPresetMenu"},value:[{$ref:"event#/currentTarget"}]}]}}}}]},{tagName:"div",attributes:{part:"bar-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/barMode"},cases:{lens:{tagName:"div",attributes:{part:"axis","data-axis":"context"},children:[{tagName:"span",attributes:{part:"axis-label"},textContent:"Context"},{tagName:"span",attributes:{part:"static","data-static":"summary"},textContent:"${state.summary}"}]},full:{tagName:"div",attributes:{part:"axes",role:"none"},style:{display:"contents"},children:[{tagName:"div",attributes:{part:"view-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/viewState"},cases:{shown:{tagName:"div",attributes:{part:"axis","data-axis":"view"},children:[{tagName:"span",attributes:{part:"axis-label"},textContent:"View"},{tagName:"jx-action-group",attributes:{part:"views"},$props:{selects:"single",compact:!0,label:"Canvas view"},children:[{$prototype:"Array",items:{$ref:"#/state/views"},key:{$ref:"$map/item/key"},map:{tagName:"jx-action-button",attributes:{part:"views-item","data-value":"${$map.item.value}"},$props:{size:"sm",checked:{$ref:"$map/item/checked"},hint:{$ref:"$map/item/hint"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/chooseView"},value:[{$ref:"$map/item/value"}]}]},children:[{tagName:"span",textContent:"${$map.item.label}"}]}}]},{tagName:"div",attributes:{part:"preview-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/previewState"},cases:{shown:{tagName:"jx-action-button",attributes:{part:"preview-toggle","data-on":"${state.previewOn ? '' : null}"},$props:{size:"sm",quiet:!1,toggles:!0,emphasized:!0,selected:{$ref:"#/state/previewOn"},hint:{$ref:"#/state/previewHint"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/togglePreview"},value:[]}]},children:[{tagName:"span",textContent:"Preview"}]}}}]}}},{tagName:"div",attributes:{part:"context-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/contextState"},cases:{shown:{tagName:"div",attributes:{part:"axis","data-axis":"context"},children:[{tagName:"span",attributes:{part:"axis-label"},textContent:"Context"},{tagName:"div",attributes:{part:"sizes-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/sizesState"},cases:{shown:{tagName:"jx-action-group",attributes:{part:"sizes"},$props:{selects:"single",compact:!0,label:"Size"},children:[{$prototype:"Array",items:{$ref:"#/state/sizes"},key:{$ref:"$map/item/key"},map:{tagName:"jx-action-button",attributes:{part:"sizes-item","data-value":"${$map.item.value}"},$props:{size:"sm",checked:{$ref:"$map/item/checked"},hint:{$ref:"$map/item/hint"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setBreakpoint"},value:[{$ref:"$map/item/value"}]}]},children:[{tagName:"span",textContent:"${$map.item.label}"}]}}]}}},{tagName:"div",attributes:{part:"scheme-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/schemeState"},cases:{shown:{tagName:"jx-action-group",attributes:{part:"schemes"},$props:{selects:"single",compact:!0,label:"Color scheme"},children:[{$prototype:"Array",items:{$ref:"#/state/schemes"},key:{$ref:"$map/item/key"},map:{tagName:"jx-action-button",attributes:{part:"schemes-item","data-value":"${$map.item.value}"},$props:{size:"sm",checked:{$ref:"$map/item/checked"},hint:{$ref:"$map/item/hint"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setScheme"},value:[{$ref:"$map/item/value"}]}]},children:[{tagName:"span",textContent:"${$map.item.label}"}]}}]}}},{tagName:"div",attributes:{part:"resolving-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/resolvingState"},cases:{shown:{tagName:"jx-action-button",attributes:{part:"resolving-trigger"},$props:{size:"sm",quiet:!0,haspopup:"dialog",expanded:{$ref:"#/state/resolvingOpen"},hint:"The values this document is being rendered with"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openResolving"},value:[{$ref:"event#/currentTarget"}]}]},children:[{tagName:"span",textContent:"${state.resolvingLabel}"},{tagName:"jx-icon",attributes:{part:"resolving-trigger-caret"},$props:{name:"caret-down"}}]}}},{tagName:"jx-action-button",attributes:{part:"context-trigger"},$props:{size:"sm",quiet:!0,icon:"sliders-horizontal",label:"More rendering context",haspopup:"dialog",expanded:{$ref:"#/state/contextOpen"},hint:"Language, feature queries, layout, and Manage contexts"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openContext"},value:[{$ref:"event#/currentTarget"}]}]},children:[{tagName:"span",textContent:"${state.contextSummary}"}]}],$description:"The rendering context, on the bar: the size and the color scheme are segmented groups the reader picks from directly, because they are what a canvas is switched between all day; the resolving-with values and the rarer choices (language, feature queries, layout, Manage contexts) stay behind their popovers."}}},{tagName:"div",attributes:{part:"export-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/exportState"},cases:{shown:{tagName:"jx-action-button",attributes:{part:"export"},$props:{size:"sm",icon:"export"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/exportFile"},value:[]}]},children:[{tagName:"span",textContent:"Export"}]}}}]}}}]},{tagName:"div",attributes:{part:"banner-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/bannerState"},cases:{shown:{tagName:"div",attributes:{part:"banner",role:"status","data-kind":"read-only"},textContent:"You have read access to this session. You can explore and edit locally, but your changes are not published to the other people in it."}}}]},{tagName:"div",attributes:{part:"pod-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/podState"},cases:{shown:{tagName:"div",attributes:{part:"pod","data-jx-region":"${state.zoomRegion}"},children:[{tagName:"jx-action-group",attributes:{part:"zoom-group"},$props:{compact:!0,label:"Zoom"},children:[{tagName:"jx-action-button",attributes:{part:"zoom-out"},$props:{size:"sm",icon:"minus",label:"Zoom out",hint:"Zoom out (Ctrl+-)"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/zoomOut"},value:[]}]}},{tagName:"jx-action-button",attributes:{part:"zoom-label"},$props:{size:"sm",hint:"Reset to 100% (Ctrl+0)",label:"Reset zoom"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/zoomReset"},value:[]}]},children:[{tagName:"span",textContent:"${state.zoomLabel}"}]},{tagName:"jx-action-button",attributes:{part:"zoom-in"},$props:{size:"sm",icon:"plus",label:"Zoom in",hint:"Zoom in (Ctrl+=)"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/zoomIn"},value:[]}]}}]},{tagName:"div",attributes:{part:"fit-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/fitState"},cases:{shown:{tagName:"jx-select",attributes:{part:"fit"},$props:{label:"Fit",size:"sm",options:{$ref:"#/state/fitOptions"},value:{$ref:"#/state/fitValue"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/chooseFit"},value:[{$ref:"event#/target/value"}]}]}}}}]}}},{tagName:"jx-popover",attributes:{part:"popover","data-popover":"context",id:"${state.contextPopoverId}"},$props:{label:"More rendering context",placement:"block-end span-inline-start",x:{$ref:"#/state/contextX"},y:{$ref:"#/state/contextY"}},children:[{tagName:"div",attributes:{part:"ctx"},children:[{tagName:"div",attributes:{part:"locale-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/localeState"},cases:{shown:{tagName:"div",attributes:{part:"ctx-group","data-group":"language"},children:[{tagName:"span",attributes:{part:"ctx-group-label"},textContent:"Language"},{tagName:"jx-action-group",attributes:{part:"locales",title:"${state.localeHint}"},$props:{selects:"single",compact:!0,label:"Language"},children:[{$prototype:"Array",items:{$ref:"#/state/locales"},key:{$ref:"$map/item/key"},map:{tagName:"jx-action-button",attributes:{part:"locales-item","data-value":"${$map.item.value}"},$props:{size:"sm",checked:{$ref:"$map/item/checked"},hint:{$ref:"$map/item/hint"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setLocale"},value:[{$ref:"$map/item/value"}]}]},children:[{tagName:"span",textContent:"${$map.item.label}"}]}}]}]}}},{tagName:"div",attributes:{part:"feature-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/featureState"},cases:{shown:{tagName:"div",attributes:{part:"ctx-group","data-group":"features"},children:[{tagName:"span",attributes:{part:"ctx-group-label"},textContent:"Features"},{tagName:"jx-action-group",attributes:{part:"features"},$props:{selects:"multiple",compact:!1,label:"Features"},children:[{$prototype:"Array",items:{$ref:"#/state/features"},key:{$ref:"$map/item/key"},map:{tagName:"jx-action-button",attributes:{part:"features-item","data-value":"${$map.item.value}"},$props:{size:"sm",quiet:!1,toggles:!0,selected:{$ref:"$map/item/selected"},hint:{$ref:"$map/item/hint"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/toggleFeature"},value:[{$ref:"$map/item/value"}]}]},children:[{tagName:"span",textContent:"${$map.item.label}"}]}}]}]}}},{tagName:"div",attributes:{part:"layout-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/layoutState"},cases:{shown:{tagName:"div",attributes:{part:"ctx-group","data-group":"layout"},children:[{tagName:"span",attributes:{part:"ctx-group-label"},textContent:"Layout"},{tagName:"jx-switch",attributes:{part:"layout-switch"},$props:{size:"sm",checked:{$ref:"#/state/layoutOn"},label:"Show layout elements"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/toggleLayout"},value:[]}]},children:[{tagName:"span",textContent:"Show layout elements"}]}]}}},{tagName:"button",attributes:{part:"manage",type:"button",title:"Breakpoints, schemes and feature queries are defined in Project Settings › Contexts"},onclick:{$ref:"#/state/manageContexts"},textContent:"Manage contexts…"}]}],$description:"What is left of the rendering context once Size and Color scheme moved onto the bar: the language, the feature queries, the layout switch, and Manage contexts. They are chosen rarely, and Manage contexts is always here, so the trigger always is too."},{tagName:"jx-popover",attributes:{part:"popover","data-popover":"resolving",id:"${state.resolvingPopoverId}"},$props:{label:"Resolving with",placement:"block-end span-inline-start",x:{$ref:"#/state/resolvingX"},y:{$ref:"#/state/resolvingY"}},children:[{tagName:"div",attributes:{part:"resolving-body",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/resolvingState"},cases:{shown:{tagName:"div",attributes:{part:"ctx"},children:[{tagName:"div",attributes:{part:"ctx-group","data-group":"resolving"},children:[{tagName:"span",attributes:{part:"ctx-group-label"},textContent:"resolving with"},{tagName:"div",attributes:{part:"fields-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/resolvingKind"},cases:{params:{tagName:"div",attributes:{part:"fields","data-fields":"params"},children:[{$prototype:"Array",items:{$ref:"#/state/params"},key:{$ref:"$map/item/key"},map:{tagName:"jx-select",attributes:{part:"param","data-param":"${$map.item.name}"},$props:{size:"sm",label:{$ref:"$map/item/label"},options:{$ref:"$map/item/options"},value:{$ref:"$map/item/value"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setParam"},value:[{$ref:"$map/item/name"},{$ref:"event#/target/value"}]}]}}}]},props:{tagName:"div",attributes:{part:"fields","data-fields":"props"},children:[{$prototype:"Array",items:{$ref:"#/state/props"},key:{$ref:"$map/item/key"},map:{tagName:"jx-textfield",attributes:{part:"prop","data-prop-name":"${$map.item.name}","data-jx-region":"${$map.item.region}"},$props:{size:"sm",label:{$ref:"$map/item/label"},placeholder:{$ref:"$map/item/name"},value:{$ref:"$map/item/value"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setProp"},value:[{$ref:"$map/item/name"},{$ref:"event#/target/value"}]}]}}}]}}}]}]}}}]}]};E("pane-context",XP);function QP(e,t){e.contextRegion=t.contextRegion,e.zoomRegion=t.zoomRegion,e.barMode=t.barMode,e.presetState=t.presetState,e.backState=t.backState,e.backLabel=t.backLabel,e.backHint=t.backHint,e.bannerState=t.bannerState,e.summary=t.summary,e.editorState=t.editorState,e.editorMode=t.editorMode,e.editorLabel=t.editorLabel,e.editors=t.editors,e.viewState=t.viewState,e.contextState=t.contextState,e.views=t.views,e.previewState=t.previewState,e.previewOn=t.previewOn,e.previewHint=t.previewHint,e.contextSummary=t.contextSummary,e.resolvingState=t.resolvingState,e.resolvingLabel=t.resolvingLabel,e.resolvingKind=t.resolvingKind,e.params=t.params,e.props=t.props,e.sizes=t.sizes,e.sizesState=t.sizesState,e.schemeState=t.schemeState,e.schemes=t.schemes,e.localeState=t.localeState,e.localeHint=t.localeHint,e.locales=t.locales,e.featureState=t.featureState,e.features=t.features,e.layoutState=t.layoutState,e.layoutOn=t.layoutOn,e.exportState=t.exportState,e.podState=t.podState,e.zoomLabel=t.zoomLabel,e.fitState=t.fitState,e.fitValue=t.fitValue,e.fitOptions=t.fitOptions}function Xh(){return{backHint:"",backLabel:"",backState:"hidden",bannerState:"hidden",barMode:"full",contextRegion:"",contextState:"shown",contextSummary:"",editorLabel:"",editorMode:"static",editorState:"hidden",editors:[],exportState:"hidden",featureState:"hidden",features:[],fitOptions:[],fitState:"hidden",fitValue:"",layoutOn:!0,layoutState:"hidden",localeHint:"",locales:[],localeState:"hidden",params:[],podState:"hidden",presetState:"hidden",previewHint:"",previewOn:!1,previewState:"hidden",props:[],resolvingKind:"params",resolvingLabel:"Defaults",resolvingState:"hidden",schemes:[],schemeState:"hidden",sizesState:"hidden",sizes:[],summary:"Base",views:[],viewState:"hidden",zoomLabel:"100%",zoomRegion:""}}function ZP(e,t){let r=n(e)?void 0:e.attributes?.[t];return n(r)?r:""}function dE(e,t){let r=Me(e),o=t?Me(t).width:0,a=Math.max(0,r.right-o);return{x:Math.round(a),y:Math.round(r.bottom)}}function bE(e,t,r,o){let a=`pane-context-${e}`,i=g({...Xh(),...o,contextOpen:!1,contextPopoverId:`${a}-context`,contextX:0,contextY:0,openContext:(S)=>{y("context",S)},openResolving:(S)=>{y("resolving",S)},resolvingOpen:!1,resolvingPopoverId:`${a}-resolving`,resolvingX:0,resolvingY:0});QP(i,r);let s=new Map,l=null,f=!1,c=(S)=>s.get(`popover:${S}`)??null,d=(S,P)=>{let j=c(S);if(!j)return;let k=(T)=>{if(S==="context")i.contextX=T.x,i.contextY=T.y;else i.resolvingX=T.x,i.resolvingY=T.y};if(k(dE(P,j)),S==="context")i.contextOpen=!0;else i.resolvingOpen=!0;rd(j,P),k(dE(P,j))},b=(S)=>{if(S==="context")i.contextOpen=!1;else i.resolvingOpen=!1;let P=c(S);if(P)Dh(P)};function y(S,P){if(S==="context"?i.contextOpen:i.resolvingOpen){b(S);return}d(S,P)}let x=R("pane-context",i,t,{onNodeCreated:(S,P,j)=>{let k=ZP(j,"part");if(k===""||!(S instanceof HTMLElement))return;if(k==="popover"){let T=ZP(j,"data-popover");if(T)s.set(`popover:${T}`,S),S.addEventListener("toggle",(N)=>{let O=N.newState==="open";if(T==="context")i.contextOpen=O;else i.resolvingOpen=O});return}if(k==="band"||k==="resolving-trigger"||k==="context-trigger")s.set(k,S)}}).then((S)=>{if(f){S.dispose();return}l=S});return{band:()=>{let S=s.get("band");return S?.isConnected===!0?S:null},connected:()=>!f&&(l===null||l.root.parentNode===t),dispose(){f=!0,b("context"),b("resolving"),l?.dispose(),l=null,s.clear()},isResolvingOpen:()=>i.resolvingOpen,ready:x,setResolvingOpen:(S)=>{if(i.resolvingOpen===S)return;if(!S){b("resolving");return}let P=s.get("resolving-trigger");if(P?.isConnected===!0)d("resolving",P)},update:(S)=>{QP(i,S)}}}var C2="source";function ld(e,t=u.workspace){if(!e||tv(t)||sb(e)!==t)return null;if(t==="styles"){if(e.documentPath!==an||e.session.ui.canvasMode!==C2)return null;let o=u.stylebook.view,a=Gp[Qs(o)];return{hint:`Leave the Code view for the ${a} view of your styles`,kind:"view",label:`Back to ${a}`,mode:o}}if(!qp(t)||ml(e.id)===t)return null;let r=bh(t).title;return{hint:`Close this view and return to ${r}`,kind:"close",label:`Back to ${r}`}}function T2(e){return ld(bt(e))}async function Qh(e,t){let r=bt(e),o=ld(r);if(!r||!o)return!1;if(o.kind==="view")return r.session.ui.preview=!1,t.setCanvasMode(r,o.mode),!0;let a=u.workspace;if(await t.closeTab(r.id),!m.tabs.has(r.id))t.focusHome?.(e,a);return!0}function kE(e){return[{args:Se({pane:Fe("Which pane to go back in. Defaults to the focused one.")},[]),id:"pane.backToHome",title:"Back to Workspace Home",category:"View",level:"document",keybinding:"escape",menus:["palette"],group:"5_pane",when:(t)=>!t.caret.active&&t.editor.kind!=="code"&&!X$()&&T2(m.activePaneId)!==null,requires:"a view opened beside a workspace home",undo:"none",run:async(t,r)=>{let o=ti("pane.backToHome",r,"pane")??m.activePaneId;if(!await Qh(o,e))throw RangeError(`command "pane.backToHome": pane "${o}" shows no view opened beside a workspace home, so there is nothing to go back from`)}}]}var P2="--pane-context-h",AE=28,cd=new Map,Wn=new Map,dd=null,SE=null,Zh={design:"Design",edit:"Edit",preview:"Preview"},E2=[["auto","Auto","Follow the OS color scheme"],["light","Light","Force the light scheme"],["dark","Dark","Force the dark scheme"]];function md(e,t){let r=cd.get(e);if(r===t)return;if(r)eg(e),ns(0,r);if(t)cd.set(e,t),OE(e,t);else cd.delete(e)}function eg(e){ts.get(e)?.observer.disconnect(),ts.delete(e),Wn.get(e)?.dispose(),Wn.delete(e)}var ts=new Map;function CE(e,t,r){let o=r.band(),a=ts.get(e);if(a&&a.band===o)return;if(a?.observer.disconnect(),ts.delete(e),ns(EE(r),t),!o||typeof ResizeObserver>"u")return;let i=new ResizeObserver(()=>{if(Wn.get(e)===r)ns(EE(r),t)});i.observe(o),ts.set(e,{band:o,observer:i})}function IE(e,t){dd=t,md(fi,e),SE=me(),SE.run(()=>{te(()=>{for(let r of m.panes){let o=bt(r.id);if(!o)continue;o.doc.document,o.doc.document.$layout,o.doc.mode,o.documentPath,o.capabilities.modes,o.session.ui.activeMedia,o.session.ui.canvasMode,o.session.ui.editZoom,o.session.ui.featureToggles,o.session.ui.preview,o.session.ui.previewColorScheme,o.session.ui.previewLocale,o.session.ui.previewParams,o.session.ui.previewProps,o.session.ui.showLayout,o.session.ui.zoom,xn(o).active,xn(o).readOnly}fd()})})}function ns(e,t){(t?.closest(Gl)??document.documentElement).style.setProperty(P2,`${e}px`)}function EE(e){return Math.max(e.band()?.offsetHeight??0,AE)}function fd(){for(let[e,t]of cd)OE(e,t)}function OE(e,t){if(!dd)return;try{let r=bt(e);if(r===null){eg(e),ns(0,t);return}let o=L2(r,e,dd),a=Wn.get(e);if(!a||!a.connected()){eg(e),a=bE(e,t,o,U2(e,dd)),Wn.set(e,a),ns(AE,t),a.ready.then(()=>{let i=Wn.get(e);if(i)CE(e,t,i)});return}a.update(o),CE(e,t,a)}catch(r){console.error("pane-context render error:",r)}}var ud=null;function N2(){ud?.close(),ud=null}function j2(e,t){if(N2(),!ae())return;let o=I2(e);ud=zt({label:"Show beside this pane",opener:t,onClosed:()=>{ud=null},place:(a)=>{let i=Me(t);return{x:Math.round(Math.min(i.left,window.innerWidth-a.width-4)),y:Math.round(i.bottom)}},region:"derive-presets",rows:o.map((a)=>R2(a))})}function R2(e){let t={destructive:!1,disabled:e.disabled!==null,dividerAbove:!1,id:A2(e),run:()=>{Sr(e.pane),ae()?.run(e.command,e.args)},title:e.label};if(e.disabled!==null)t.requires=e.disabled;return t}function A2(e){let t=[e.command];for(let r of["preset","media","locale"]){let o=e.args[r];if(n(o))t.push(o)}return t.join(":")}function I2(e){let t=ae(),r=bt(e),o=jr(e),a=yb(e),i=[];for(let l of sS){if(l==="breakpoint"||l==="locale")continue;i.push({args:{preset:l},command:"pane.derive",disabled:a??bw(l,e,null),label:ju[l],pane:e})}for(let l of r&&!o?aS(r):[])i.push({args:l===null?{preset:"breakpoint"}:{media:l,preset:"breakpoint"},command:"pane.derive",disabled:a??bw("breakpoint",e,l),label:`${ju.breakpoint} ${l?ji(l):"Base"}`,pane:e});for(let l of r&&!o?Ts()?.locales??[]:[])i.push({args:{locale:l,preset:"locale"},command:"pane.derive",disabled:a??bw("locale",e,null,l),label:`${ju.locale} ${Wt(l)}`,pane:e});let s=[["pane.pin",KE(e)],["pane.unsplit",m.panes.length>1?null:t?.get("pane.unsplit")?.requires??null]];for(let[l,f]of s){let c=t?.get(l);if(c)i.push({args:{},command:l,disabled:f,label:c.title,pane:e})}return i}function L2(e,t,r){let o=jr(t)?.kind==="lens",a=xn(e).active&&xn(e).readOnly,i={...O2(t),presetState:o?"hidden":"shown",bannerState:!o&&a?"shown":"hidden",barMode:o?"lens":"full",...q2(e,t)};if(o)return i.summary=M2(t),i;let s=ld(e);if(s)i.backState="shown",i.backLabel=s.label,i.backHint=s.hint;if(Object.assign(i,D2(e)),XC(e)==="canvas")Object.assign(i,F2(e));if(XC(e)==="home")return i.contextState="hidden",i.presetState="hidden",i;return Object.assign(i,_2(e,t,r)),i.exportState=ka(e)==="source"?"shown":"hidden",i}function O2(e){return{...Xh(),contextRegion:Ln(e,"context"),zoomRegion:Ln(e,"zoom")}}function M2(e){let t=dl(e),r=ME(bt(e));return`${t?ji(t):"Base"}${r?.overridden?` · ${Wt(r.effective)}`:""}`}var tg=new Set(["diff"]);function D2(e){let t=XC(e),r=tg.has(t)?[t]:dI(e).filter((o)=>!tg.has(o)&&(o!=="image"||o===t||!xn(e).readOnly));if(r.length<2)return{editorLabel:Gp[t],editorMode:"static",editorState:"shown"};return{editorMode:"picker",editorState:"shown",editors:r.map((o)=>({checked:o===t?"true":"false",hint:`Open this document in ${Gp[o]}`,key:o,label:Gp[o],value:o}))}}function F2(e){let t=sO(e);if(t.length===0)return{};let r=e$(e),o=t$(e);return{previewHint:o.on?`Stop previewing — back to ${Zh[r??"edit"]}`:"Preview: the page as it ships, with editing off",previewOn:o.on,previewState:o.available?"shown":"hidden",views:t.map((a)=>({checked:a===r?"true":"false",hint:`Show this document in ${Zh[a]}`,key:a,label:Zh[a],value:a})),viewState:"shown"}}function RE(e){let t=e.documentPath;return Boolean(t&&C?.isSiteProject&&(t.startsWith("pages/")||t.startsWith("./pages/")))}function ME(e){let t=Ts();if(!e||t===null||t.locales.length<2)return null;let r=go(e.documentPath??"",t),o=Hp(null,e.documentPath)??t.defaultLocale,a=Hp(e.session.ui.previewLocale,e.documentPath)??o;return{effective:a,i18n:t,overridden:a!==o,pathLocale:r}}function _2(e,t,r){let{ui:o}=e.session,{featureQueries:a,sizeBreakpoints:i}=r.parseMediaEntries(to(e.doc.document.$media)),s=a.filter(({query:N})=>ux(N)),l=a.filter(({query:N})=>!ux(N)),f=o.previewColorScheme,{activeMedia:c}=o,d=ME(e),b=RE(e)&&Boolean(hl(e.doc.document.$layout))||Boolean(C?.isSiteProject)&&rh(e.documentPath),y=l.filter(({name:N})=>o.featureToggles[N]).length,x=[d?.overridden?Wt(d.effective):null,y>0?`${y} ${y===1?"query":"queries"}`:null,b&&o.showLayout===!1?"No layout":null].filter((N)=>N!==null).join(" · "),S=RE(e),P=S?Y2(e):[],j=S?[]:Q2(e,t),k=S?Object.values(o.previewParams).filter((N)=>N!=="").length:Object.keys(o.previewProps??{}).length,T=S?P.length>0:j.length>0;return{contextSummary:x,featureState:l.length>0?"shown":"hidden",features:l.map(({name:N,query:O})=>({hint:O,key:N,label:ji(N),selected:Boolean(o.featureToggles[N]),value:N})),layoutOn:o.showLayout!==!1,layoutState:b?"shown":"hidden",...H2(d),params:P,props:j,resolvingKind:S?"params":"props",resolvingLabel:k>0?`${k} set`:"Defaults",resolvingState:T?"shown":"hidden",schemes:E2.map(([N,O,D])=>({checked:f===N?"true":"false",hint:D,key:N,label:O,value:N})),schemeState:s.length>0?"shown":"hidden",sizes:z2(i,c),sizesState:i.length>0?"shown":"hidden"}}function z2(e,t){return[{checked:t===null?"true":"false",hint:"The base rendering, with no breakpoint applied",key:"--base",label:"Base",value:""},...e.map(({name:r,width:o})=>({checked:t===r?"true":"false",hint:`${ji(r)} — ${o}px`,key:r,label:ji(r),value:r}))]}function H2(e){if(!e)return{localeState:"hidden"};return{localeHint:"The language this pane renders as — its lang and direction only. The text is whatever file is open.",locales:e.i18n.locales.map((t)=>({checked:e.effective===t?"true":"false",hint:t===e.pathLocale?`${Wt(t)} — the language of the file this pane has open`:`Render as ${Wt(t)} (${t})`,key:t,label:Wt(t),value:t})),localeState:"shown"}}var FE=[{fit:"page",label:"Fit page",value:"page"},{fit:"width",label:"Fit width",value:"width"},{fit:1,label:"Actual size",value:"actual"},{fit:"none",label:"No fit",value:"none"}];function B2(e){if(Y(e))return e===1?"actual":"";return e}var V2=new Set(["design","stylebook","git-diff"]);function W2(e){let t=jr(e);return(t?.kind==="lens"&&t.preset==="diff"?t.diff:u.git.diffState)?.filePath??""}function q2(e,t){let r=Vo(t),o=bo(t);if(r==="edit"){let{editZoom:i}=e.session.ui;return{podState:"shown",zoomLabel:`${Math.round(i*100)}%`}}if(!V2.has(r))return{podState:"hidden"};if(r==="git-diff"&&Xa(t,Mb(W2(t))))return{podState:"hidden"};let a=Fm(o);return{fitOptions:FE.map(({label:i,value:s})=>({label:i,value:s})),fitState:"shown",fitValue:B2(LC(o)),podState:"shown",zoomLabel:`${Math.round(a*100)}%`}}function lo(e,t,r){ae()?.run(t,{...r,pane:e})}function U2(e,t){let r=()=>bt(e);return{chooseEditor:(o)=>{let a=r();if(!a)return;let i=dI(a).find((l)=>l===o&&!tg.has(l)),s=i&&JO(a,i);if(!s)return;a.session.ui.preview=!1,t.setCanvasMode(a,s)},chooseFit:(o)=>{let a=FE.find((s)=>s.value===o);if(!a)return;let i=bo(e);if(a.fit==="page"){oO({surface:i});return}XL(a.fit,i)},chooseView:(o)=>{let a=r(),i=QL.find((s)=>s===o);if(a&&i)n$(a,i,t.setCanvasMode)},exportFile:t.exportFile,goBack:()=>{Sr(e);let{closeTab:o}=t;if(!o){lo(e,"pane.backToHome",{});return}Qh(e,{closeTab:o,setCanvasMode:t.setCanvasMode,...t.focusHome&&{focusHome:t.focusHome}})},manageContexts:()=>{ae()?.run("settings.open",{section:"contexts"})},openPresetMenu:(o)=>{j2(e,o)},setBreakpoint:(o)=>{lo(e,"canvas.setBreakpoint",{media:o===""?null:o})},setLocale:(o)=>{lo(e,"i18n.switchLocale",{locale:o})},setParam:(o,a)=>{lo(e,"canvas.setRouteParam",{name:o,value:a})},setProp:(o,a)=>{lo(e,"canvas.setTestProp",{name:o,value:a===""?null:X2(a)})},setScheme:(o)=>{lo(e,"canvas.setColorScheme",{scheme:o})},toggleFeature:(o)=>{let a=r();if(a)Na(a,"featureToggles",{...a.session.ui.featureToggles,[o]:!a.session.ui.featureToggles[o]})},toggleLayout:()=>{lo(e,"canvas.setLayoutVisible",{visible:r()?.session.ui.showLayout===!1})},togglePreview:()=>{let o=r();if(!o)return;let a=t$(o),i=e$(o);n$(o,a.on?i??"edit":"preview",t.setCanvasMode)},zoomIn:()=>{let o=r(),a=bo(e);if(Vo(e)==="edit"){Fp((o?.session.ui.editZoom??1)*1.2,a);return}jm(Fm(a)*1.2,a)},zoomOut:()=>{let o=r(),a=bo(e);if(Vo(e)==="edit"){Fp((o?.session.ui.editZoom??1)/1.2,a);return}jm(Fm(a)/1.2,a)},zoomReset:()=>{let o=bo(e);if(Vo(e)==="edit"){Fp(1,o);return}rO(o)}}}function J2(e){return Wn.get(e)?.isResolvingOpen()??!1}function zE(e,t){if(J2(e)===t)return;Wn.get(e)?.setResolvingOpen(t)}var ng=new Map,pd=new Set;function BE(){ng.clear(),pd.clear()}function G2(e){let t=pC({document:e.doc.document,frontmatter:e.doc.content.frontmatter});if(!t&&Bc(e.documentPath).length===0)return null;let r=`${e.documentPath??""}::${JSON.stringify(t)}`,o=ng.get(r);if(o)return o;if(pd.has(r))return null;return pd.add(r),OA(e.documentPath,t).then((a)=>{if(pd.delete(r),!m.panes.some((i)=>i.activeTabId===e.id))return;ng.set(r,a),K2(e,a),fd()}),null}function K2(e,t){let r=e.session.ui.previewParams,o={};for(let[a,i]of Object.entries(t))if(!r[a]&&i.length>0)o[a]=i[0];if(Object.keys(o).length>0)Na(e,"previewParams",{...r,...o})}function Y2(e){let t=G2(e),r=new Set(Bc(e.documentPath));for(let a of Object.keys(t??{}))r.add(a);let{previewParams:o}=e.session.ui;return[...r].map((a)=>({key:a,label:`Preview value for [${a}]`,name:a,options:(t?.[a]??[]).map((i)=>({label:i,value:i})),value:o[a]??""}))}function X2(e){try{return JSON.parse(e)}catch{return e}}function Q2(e,t){let r=e.doc.document;if(!fC(r))return[];let{previewProps:o}=e.session.ui,a=(i)=>i===void 0?"":n(i)?i:JSON.stringify(i);return MA(r).map(({name:i})=>({key:i,label:`Test value for ${i}`,name:i,region:Ln(t,`prop:${i}`),value:a(o?.[i])}))}var co=new Map,rs=null,vn=null,sg=null,os=[],as=null,ag=null;function eq(e){return e.root!==null&&e.strip!==null&&e.chrome!==null&&e.stage!==null&&e.dropZone!==null&&e.surface!==null}function VE(e){let t=co.get(e);return t!==void 0&&eq(t)?t:null}function WE(){return sg??Promise.resolve()}function tq(e){let t=co.get(e);if(t)return t;let r={chrome:null,dropZone:null,paneId:e,releaseDropZone:null,releaseGestures:null,root:null,stage:null,strip:null,surface:null};return co.set(e,r),r}function nq(e,t){t.addEventListener("pointerdown",()=>{Sr(e)},{capture:!0})}function rq(e,t){e.stage=t;let r=AM(e.paneId);e.surface=r,NM(e.paneId,t),e.releaseGestures=YP(r),Br(e.paneId)}function oq(e,t,r){if(m.panes.length>=yI||m.panes.at(-1)?.id!==e)return{type:"pane-edge-refused"};let o=Me(r),a=Math.min(120,o.width/2);if(t.clientX<o.right-a)return{type:"pane-edge-refused"};return{paneId:e,type:"pane-edge"}}function aq(e,t){return Ks({canDrop({source:r}){return Mu(r.data)},element:t,getData({input:r}){return oq(e,r,t)}})}function iq(e,t,r){let o=tq(e);if(t==="pane"){o.root=r,nq(e,r);return}if(t==="strip"){o.strip=r;return}if(t==="chrome"){o.chrome=r,md(e,r);return}if(t==="dropZone"){o.dropZone=r,o.releaseDropZone=aq(e,r);return}rq(o,r)}function qE(e){if(e.releaseDropZone?.(),e.releaseDropZone=null,md(e.paneId,null),e.releaseGestures?.(),e.releaseGestures=null,e.stage)Qb(e.stage);EI(e.paneId),co.delete(e.paneId)}function JE(){return m.panes.map((e,t)=>({id:e.id,region:Ln(e.id),split:t>0?"shown":"hidden",stripRegion:VM(e.id)}))}function sq(e,t){return e.length===t.length&&e.every((r,o)=>r===t[o])}var lq=320;function cq(){let e=rs;if(!e||!vn)return;let t=JE(),r=t.map((o)=>o.id);if(!sq(r,os)){for(let o of os)if(!r.includes(o)){let a=co.get(o);if(a)qE(a)}os=r,vn.update(t,u.paneSplit)}dq(e)}function dq(e){if(m.panes.length<2){e.style.gridTemplateColumns="minmax(0, 1fr)";return}let t=u.paneSplit;e.style.gridTemplateColumns=`minmax(0, ${t}fr) 5px minmax(0, ${1-t}fr)`}function pq(){if(as)return;if(rs=document.querySelector("#pane-grid"),!rs)return;let e=JE();os=e.map((t)=>t.id),vn=Nx(rs,e,{collapse:B$,gap:lq,max:WC,min:zC,value:u.paneSplit},{cellPart:iq,move:bO,settle:Bd}),sg=vn.ready,ag=Js({canMonitor({source:t}){return Mu(t.data)},onDrag({location:t}){let[r]=t.current.dropTargets,o=r?.data.paneId,a=r?.data.type==="pane-edge"&&n(o)?o:"";vn?.drag({armed:!0,edgePane:a})},onDragStart(){vn?.drag({armed:!0,edgePane:""})},onDrop(){vn?.drag({armed:!1,edgePane:""})}}),as=me(),as.run(()=>{te(()=>{for(let t of m.panes)t.id;u.paneSplit,cq()})})}function uq(){as?.stop(),as=null,ag?.(),ag=null;let e=[...co.values()];for(let t of e)qE(t);vn?.dispose(),vn=null,sg=null,os=[],co.clear(),rs=null}nv({mount:pq,unmount:uq});var mq=/\/packages\/studio\/src\/surfaces\/([\w-]+)\.json$/,fq=/\/packages\/ui\/components\/(jx-[\w-]+)\.json$/;function hq(e,t){let r=e.replaceAll("\\","/").replace(/\/+$/,""),o=t.replaceAll("\\","/").replace(/^\.?\//,"");return`${r}/${o}`}function gq(e,t){if(!e||!t)return null;let r=hq(e,t),o=mq.exec(r);if(o)return{kind:"surface",name:o[1]};let a=fq.exec(r);if(a)return{kind:"element",tag:a[1]};return null}function bq(e,t){return new URL(t.replaceAll("\\","/").replace(/^\.?\//,""),Gd(e)).href}async function yq(e,t){if(e.kind==="surface"){if(!JM(e.name))return{refused:`no surface is registered as "${e.name}"`,remounted:0,target:e};E(e.name,t);let o=WM(e.name);return await Promise.all(o.map((a)=>a.remount())),{remounted:o.length,target:e}}if(t.tagName!==e.tag)return{refused:`the document names <${String(t.tagName)}>, but the file is ${e.tag}.json`,remounted:0,target:e};await QM(t,g1);let r=zM(e.tag);return await Promise.all(r.map((o)=>o.remount())),{remounted:r.length,target:e}}function vq(e){let t=e.target.kind==="surface"?`surface ${e.target.name}`:e.target.tag,r=`live-chrome:${t}`;if(e.refused)return{key:r,level:"warn",message:`Not applied to the running shell: ${e.refused}.`};let o=e.canvases===void 0||e.canvases===0?"":e.canvases===1?" and on the canvas":` and on ${e.canvases} canvases`;if(e.remounted===0)return{key:r,level:"info",message:`${t} saved; nothing in the shell is drawn from it${o?`, redefined${o}`:""}.`};let a=e.remounted===1?"1 place":`${e.remounted} places`;return{key:r,level:"info",message:`${t} saved and re-mounted in ${a}${o}.`}}function GE(e){return async(t,r)=>{let o=e.workspace.projectRoot,a=gq(o,t);if(!a||!r||!o||!t)return null;let i=await yq(a,r);if(a.kind==="element"&&!i.refused)i={...i,canvases:e.redefineOnCanvases(r,bq(o,t))};let s=vq(i);if(s.level==="warn")e.notify.warn(s.message,{key:s.key,source:"Studio",tier:"problem"});else e.notify.info(s.message,{key:s.key,source:"Studio"});return i}}var XE=0;function hd(){return XE+=1,`msg_${Date.now()}_${XE}`}function Qt(e){return typeof e==="string"}function is(e){return typeof e==="object"&&e!==null}function wq(e){try{let t=JSON.parse(e);return is(t)&&"success"in t&&t.success===!1}catch{return!1}}function dg(e){if(e.role==="tool"){let r=Qt(e.content)?e.content:"";return[{type:"tool_result",callId:Qt(e.toolCallId)?e.toolCallId:"",isError:wq(r),content:r}]}let t=[];if(e.role==="assistant"&&Qt(e.reasoningContent))t.push({type:"reasoning",text:e.reasoningContent});if(Qt(e.content)&&e.content)t.push({type:"text",text:e.content});if(e.role==="assistant"&&Array.isArray(e.toolCalls)){let r=e.toolCalls;for(let o of r){if(!is(o))continue;let{id:a,name:i,arguments:s}=o;t.push({type:"tool_call",id:Qt(a)?a:"",name:Qt(i)?i:"",argumentsText:Qt(s)?s:""})}}return t}function QE(e){return typeof e==="object"&&e!==null}function eN(e){if(e.type!=="reasoning")return{...e};let{provenance:t,...r}=e;return t===void 0?r:{...r,provenance:{...t}}}function lg(e,t){if(Object.is(e,t))return!0;if(!QE(e)||!QE(t))return!1;if(Array.isArray(e)||Array.isArray(t))return Array.isArray(e)&&Array.isArray(t)&&e.length===t.length&&e.every((a,i)=>lg(a,t[i]));let r=Object.entries(e).filter(([,a])=>a!==void 0),o=Object.entries(t).filter(([,a])=>a!==void 0);return r.length===o.length&&r.every(([a,i])=>lg(i,t[a]))}function tN(e,t){let r="";for(let o of e)if(o.type===t)r+=o.text;return r}function ds(e){if(e.role!=="assistant")return!1;return!(e.blocks??dg(e)).some((r)=>r.type==="tool_call"||r.type==="text"&&r.text!=="")}function Un(e){return e.map((t)=>{let{id:r,role:o,timestamp:a,meta:i}=t,s=t.blocks?[...t.blocks]:dg(t),l={id:r,role:o,blocks:s,timestamp:a};return i?{...l,meta:i}:l})}function pg(e){return e.map((t)=>{let r={id:t.id,role:t.role,content:tN(t.blocks,"text"),timestamp:t.timestamp};if(t.role==="tool"){let a=t.blocks.find((i)=>i.type==="tool_result");if(a)r.content=a.content,r.toolCallId=a.callId}else if(t.role==="assistant"){if(t.blocks.some((i)=>i.type==="reasoning"))r.reasoningContent=tN(t.blocks,"reasoning");let a=t.blocks.filter((i)=>i.type==="tool_call");if(a.length>0)r.toolCalls=a.map((i)=>({id:i.id,name:i.name,arguments:i.argumentsText}))}let o=dg(r).map((a)=>eN(a));if(!lg(o,t.blocks.map((a)=>eN(a))))r.blocks=[...t.blocks];if(t.meta)r.meta=t.meta;return r})}function xq(e,t){return(e.provenance?.family??t.meta?.family??"openai-compat")==="openai-compat"&&e.redacted===void 0}function ps(e){let t=[];for(let r of e)if(r.role==="assistant"){if(ds(r))continue;let o="",a="",i=[];for(let l of r.blocks)if(l.type==="text")o+=l.text;else if(l.type==="reasoning"&&xq(l,r))a+=l.text;else if(l.type==="tool_call")i.push({id:l.id,type:"function",function:{name:l.name,arguments:l.argumentsText}});let s={role:"assistant",content:i.length>0?o||null:o};if(a)s.reasoning_content=a;if(i.length>0)s.tool_calls=i;t.push(s)}else if(r.role==="tool"){for(let o of r.blocks)if(o.type==="tool_result")t.push({role:"tool",tool_call_id:o.callId,content:o.content})}else{let o="";for(let a of r.blocks)if(a.type==="text")o+=a.text;t.push({role:r.role,content:o})}return t}function gd(e){return e.map((t)=>{let r={name:t.name,description:t.description,parameters:t.inputSchema};if(t.strict===!0)r.strict=!0;return{type:"function",function:r}})}function ug(e){return e.map((t,r)=>{let o=t,a=is(o.function)?o.function:void 0;if(o.type!=="function"||a===void 0||!Qt(a.name)||!Qt(a.description)||!is(a.parameters))throw TypeError(`tools[${r}] is not an OpenAI function tool with a name, a description and parameters`);let i=a.parameters;if(a.strict===!0)return{name:a.name,description:a.description,inputSchema:i,strict:!0};return{name:a.name,description:a.description,inputSchema:i}})}var mg=hd;function fg(e){return typeof e==="number"&&Number.isFinite(e)&&e>=0}function hg(e={}){let t=e.model||"gpt-4o",r=g({messages:[],status:"idle",streamingContent:"",pendingToolCalls:[],error:null,model:t,tokenCount:0,contextWarning:!1,usage:null}),o=null;function a(F){if(r.status==="streaming")return;let B={id:mg(),role:"user",content:F,timestamp:Date.now()};r.messages.push(B),i()}function i(){if(r.status==="streaming")return;r.error=null,r.streamingContent="",r.pendingToolCalls=[],r.status="streaming",o={id:mg(),role:"assistant",content:"",timestamp:Date.now()},r.messages.push(o),o=r.messages.at(-1)??null}function s(F,B){r.messages.push({id:mg(),role:"tool",toolCallId:F,content:B,timestamp:Date.now()})}function l(F){if(r.status!=="streaming"||!o)return;r.streamingContent+=F,o.content=r.streamingContent}function f(F){if(r.status!=="streaming"||!o)return;o.reasoningContent=(o.reasoningContent??"")+F}function c(F,B){if(r.status!=="streaming")return;let L={id:F,name:B,arguments:"",result:null};if(r.pendingToolCalls.push(L),o){if(!o.toolCalls)o.toolCalls=[];o.toolCalls.push(L)}}function d(F,B){let L=r.pendingToolCalls.find((U)=>U.id===F);if(L)L.arguments+=B}function b(F){}function y(F,B){let L=r.messages.length-1;while(L>=0&&r.messages[L].role==="tool")L-=1;let U=r.messages[L],W=U?.role==="assistant"?U.toolCalls?.find((z)=>z.id===F):null;if(W)W.result=B}function x(F){r.status="idle",r.streamingContent="",r.pendingToolCalls=[],o=null}function S(F){if(r.status="error",r.error=F,r.streamingContent="",r.pendingToolCalls=[],o){let B=r.messages.lastIndexOf(o);if(B!==-1)r.messages.splice(B,1)}o=null}function P(){if(o){let F=r.messages.lastIndexOf(o);if(F!==-1)r.messages.splice(F,1)}r.status="idle",r.streamingContent="",r.pendingToolCalls=[],o=null,r.error=null}function j(){r.messages.length=0,r.status="idle",r.streamingContent="",r.pendingToolCalls=[],r.error=null,r.contextWarning=!1,r.usage=null,o=null}function k(){while(r.messages.length>0&&r.messages.at(-1).role!=="user")r.messages.pop();if(r.messages.length>0&&r.messages.at(-1).role==="user")r.messages.pop();r.status="idle",r.error=null}function T(F){r.model=F}function N(F){r.tokenCount=F}function O(F,B={}){if(!fg(F.inputTokens)||!fg(F.outputTokens))return;let{type:L,...U}=F,W=o??r.messages.at(-1),[z]=W?ps(Un([W])):[],K=z?.role==="assistant"&&Boolean(z.reasoning_content)||!fg(F.reasoningTokens)?0:F.reasoningTokens,ie=Math.max(0,F.inputTokens+F.outputTokens-K),se={...U,contextTokens:ie,lastMessageId:r.messages.at(-1)?.id??"",messageCount:r.messages.length};if(B.systemTokens!==void 0)se.systemTokens=B.systemTokens;r.usage=se,r.tokenCount=ie}function D(){r.usage=null}function M(F){r.contextWarning=F}function V(){return ps(Un(r.messages))}return Object.assign(r,{sendMessage:a,beginAssistantTurn:i,appendDelta:l,appendReasoning:f,appendToolCallStart:c,appendToolCallDelta:d,appendToolCallEnd:b,appendToolResult:y,pushToolResultMessage:s,finishStream:x,setError:S,cancelStream:P,clearChat:j,retryLast:k,setModel:T,setTokenCount:N,recordUsage:O,clearUsage:D,setContextWarning:M,toMessagesArray:V})}class bd extends Error{constructor(e){super(`A turn is already running (${e}).`);this.name="LaneBusyError"}}function gg(){let e=null,t=0;return{acquire(r){if(e!==null)return null;e=r,t+=1;let o=t;return()=>{if(t===o)e=null}},get active(){return e}}}function bg(e){return e.map((t)=>t.text).join("")}var yd=4,us={maxWorkRounds:5,maxRounds:25,estimateTokens:(e)=>Math.ceil(e.length/yd),capText:({maxWorkRounds:e,applied:t,errors:r})=>{let o=[...new Set(r)],a=t.length>0?`
|
|
7
7
|
|
|
8
8
|
Changes applied so far:
|
|
9
9
|
${t.map((s)=>`- ${s}`).join(`
|
|
@@ -498,12 +498,12 @@ ${r}`}function YI(e){let t=e.indexOf(`
|
|
|
498
498
|
---- attached context ----
|
|
499
499
|
`);if(t===-1)return{body:e,contextLines:[]};let r=e.slice(0,t),o=e.slice(t+26+3);return{body:r,contextLines:o.split(`
|
|
500
500
|
`).map((a)=>a.trim()).filter((a)=>a.length>0)}}function q6(e){try{let t=JSON.parse(e);if(v(t)&&Ze(t.success))return t}catch{}return null}function XI(e){let t="";try{let r=e.arguments?JSON.parse(e.arguments):{};if(v(r)&&Array.isArray(r.path))t=`: ${JSON.stringify(r.path)}`;else if(v(r)&&Array.isArray(r.parentPath))t=`: ${JSON.stringify(r.parentPath)}`}catch{}return`${e.name}${t}`}function QI(e){let t=e.toLowerCase();if(t.includes("no api key")||t.includes("401"))return"Use the settings button below the message box to add an OpenAI-compatible API key.";if(t.includes("network error")||t.includes("fetch"))return"Check that the dev server is running and reachable.";if(t.includes("429")||t.includes("rate limit"))return"The API rate limit was hit. Wait a moment and try again.";if(t.includes("500")||t.includes("internal"))return"The upstream API returned a server error. Try again in a moment.";if(t.includes("empty reply"))return"Try again, or pick another model: some send back nothing for a request they cannot handle.";return""}function hu(e,t={},r=ae()){let o=r?.get(e);if(!r||!o||!r.isVisible(e))return null;let a=r.disabledReason(e),i=r.keymap.formatBinding(e),s=a?`${o.title} — requires ${a}`:i?`${o.title} (${i})`:o.title;return{disabled:a!==void 0,hint:s,icon:t.icon??"",id:e,key:e,label:o.title,text:t.text??""}}function ol(e){return e.filter((t)=>t!==null)}function ZI(e){return e>=1000?`${(e/1000).toFixed(1)}k`:String(e)}function e1(e,t){return t?`About ${e.toLocaleString()} tokens — past half the model's context. `+"The oldest turns are dropped as this grows; start a new chat to keep them.":`About ${e.toLocaleString()} tokens of the model's context in use`}var o1="import_site";function U6(e){let t;try{t=e.arguments?JSON.parse(e.arguments):{}}catch{return null}if(!v(t))return null;let{context:r,options:o,question:a}=t;if(!n(a)||!a.trim())return null;return{context:n(r)?r:"",options:Array.isArray(o)?o.filter((i)=>n(i)&&i.trim().length>0):[],question:a}}function J6(e,t=!0){if(!e.result)return e.name===Md&&!t?"unanswered":"pending";return e.result.success?"ok":"failed"}function G6(e){let{result:t}=e;if(!t)return"";let r=(t.success?t.summary:t.error)??"";if(e.name===o1&&t.success){let o=/\.(?:\s|$)/.exec(r);return o?r.slice(0,o.index+1):r}return r}function K6(){return{hasPhase:!1,importCount:"",importLog:[],importMessage:"",importOpen:!1,importPhase:"",importProgress:"",importSpinner:"none",importState:"none"}}function Y6(e){let t=e.status==="running",r=e.total!==null&&e.current!==null,o=e.status==="done"?`Imported ${e.url}`:e.status==="failed"?`Import failed — ${e.error||"the run did not say why"}`:e.status==="stopped"?"Import stopped":e.message;return{hasPhase:t&&e.phase!=="",importCount:String(e.log.length),importLog:e.log.map((a,i)=>({key:`${i}:${a.phase}`,message:a.message,phase:a.phase})),importMessage:o,importOpen:t,importPhase:e.phase,importProgress:r?String(Math.round(e.current/Math.max(e.total,1)*100)):"",importSpinner:t?r?"progress":"busy":"none",importState:"run"}}function X6(e,t={}){let r=J6(e,e.id===t.pendingId||Boolean(e.result)),o=G6(e),a=e.name===o1?t.importRun?.(e.id)??null:null,i=e.name===Md?U6(e):null,s=e.result?.success?e.result.data??null:null,l={answer:s?s.skipped?"You decide":s.answer??"":"",askState:"none",context:i?.context??"",hasContext:Boolean(i?.context),hint:o||XI(e),key:e.id,kind:i?"ask":"chip",label:XI(e),mark:r==="ok"?"✓":"✗",options:(i?.options??[]).map((f)=>({key:f,label:f})),outcome:r,outcomeState:r==="pending"||r==="unanswered"?"hidden":"shown",outcomeText:o,question:i?.question??"",tool:e.name,...a?Y6(a):K6()};if(i)l.askState=r==="pending"?"pending":r==="unanswered"?"unanswered":s?"answered":r==="failed"?"failed":"none";return l}function Q6(e){let t=LM(e),r=t.length>0?IM(t):"";if(!r)return{canRestore:!1,changes:[],changesState:"none",changesSummary:""};return{canRestore:t.every((o)=>!o.disk),changes:t.map((o,a)=>({disk:o.disk,key:`${a}:${o.path}`,note:o.ok?o.tool:`failed — ${o.error??o.tool}`,ok:o.ok,path:o.path})),changesState:"list",changesSummary:r}}function fu(e,t){return{body:"",canRestore:!1,changes:[],changesState:"none",changesSummary:"",chips:[],contextChips:[],hasChips:!1,hasContextChips:!1,key:e,kind:t,markdown:""}}function Z6(e){return e.map((t,r)=>({key:`${r}:${t}`,label:t}))}function i1(e){let t=e.ask??{},r=e.messages.length-1,o=[];for(let[a,i]of e.messages.entries()){if(i.role==="user"){let{body:f,contextLines:c}=YI(i.content);o.push({...fu(i.id,"user"),body:f,contextChips:Z6(c),hasContextChips:c.length>0});continue}if(i.role==="tool"){let f=q6(i.content);if(f&&!f.success)o.push({...fu(i.id,"tool-error"),body:`⚠️ ${f.error||"Tool call failed"}`});continue}if(i.role!=="assistant")continue;let s=i.toolCalls??[],l=s.map((f)=>X6(f,t));if(e.status==="streaming"&&a===r){o.push({...fu(i.id,i.content?"streaming":"typing"),body:i.content,chips:l,hasChips:l.length>0});continue}if(!i.content&&s.length===0)continue;o.push({...fu(i.id,"assistant"),chips:l,hasChips:l.length>0,markdown:i.content?KI(i.id,i.content):"",...Q6(i.id)})}return o}var c1={$schema:"https://jxsuite.com/schema/v1",$id:"StudioAiModelPicker",$description:"The provider's model catalogue as one control, for every surface that chooses a model — the assistant's composer and the New Project Import source. Everything here is a projection: `ui/ai-model-picker.ts` decides which credentials the catalogue was listed under, which rows it holds, which of them is selected and what a failed listing said. This document never fetches anything and never learns what a credential is.",tagName:"div",attributes:{part:"model-picker","data-width":"${state.width}"},style:{$description:"`.ai-model-picker` (shell.css) and `.new-project-import-model` (overlays.css) were the same control at two widths, so the two rules become one attribute the host sets. The wrapper is the flex item now rather than the control, which is what lets the retry button sit beside the picker without the host laying it out.",display:"flex",alignItems:"center",gap:"var(--jx-space-2)",minWidth:"0",'&[data-width="compact"]':{$description:"The composer's row: the picker may not push the send button off the end, so it is capped and allowed to shrink.",maxWidth:"140px"},'&[data-width="fill"]':{$description:"A field in a form column, where the control takes the column's width.",width:"100%"},'& [part="select"]':{minWidth:"0",flex:"1 1 auto"}},children:[{tagName:"jx-select",attributes:{part:"select",title:"${state.hint}"},$props:{label:"Model",size:{$ref:"#/state/size"},options:{$ref:"#/state/options"},value:{$ref:"#/state/value"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/choose"},value:[{$ref:"event#/target/value"}]}],description:"The change bubbles out of the inner control, so the picked id is read off the event rather than off the element."}},{tagName:"div",attributes:{part:"retry-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasFailure"},cases:{true:{$description:"Retry is a BUTTON beside the picker, not a row inside it. As a row it was a value the select could hold and did not mean — one press left the control reporting `__retry_models__` as the chosen model, and the write that would have corrected it is exactly the write a document's bindings skip when the scope never moved. A button says the same thing and holds no value at all.",tagName:"jx-button",attributes:{part:"retry"},$props:{size:{$ref:"#/state/size"},quiet:!0,label:"Retry loading models"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/retry"},value:[]}]},children:[{tagName:"span",textContent:"Retry"}]}}}]};E("ai-model-picker",c1);function p1(e){return{...e,hasFailure:e.failure!==""}}function f1(e,t){let r=document.createElement("div");r.style.display="contents";let o=g({...p1(e),...t}),a=null,i=!1;function s(){i=!0,R("ai-model-picker",o,r).then((l)=>{i=!1,a=l})}return s(),{host:r,update(l){if(Object.assign(o,p1(l)),i||a!==null&&r.contains(a.root))return;a?.dispose(),a=null,r.textContent="",s()}}}var h1="__loading__",t5=" — no tools";function n5(e){return BL(e.id)===!1?`${e.name}${t5}`:e.name}function gu(e){let t=e.getModel??Xl,r=e.onChange??bA,o=!1,a="",i=null,s=null;function l(S,P){return S!==null&&S.apiKey===P.apiKey&&S.baseUrl===P.baseUrl}function f(S=!1){let P=rC(),j=HL(P)!==null||l(i,P);if(o||j&&!S)return;o=!0,a="",i=P,eh({credentials:P,force:S}).catch((k)=>{a=k instanceof Error&&k.message||"Failed to fetch models"}).finally(()=>{o=!1,e.requestRender()})}function c(){i=null,f(!0),e.requestRender()}function d(S){if(S&&S!==h1)r(S)}function b(){let S=t(),P=HL(rC())??[],k=(P.some((T)=>T.id===S)?P:[{id:S,name:S},...P]).map((T)=>({label:n5(T),value:T.id}));if(o)k.push({disabled:!0,label:"Loading models…",value:h1});return k}function y(){return{failure:a,hint:a?`Couldn't load models: ${a}`:"Model",options:b(),size:e.size??"sm",value:t(),width:e.width??"compact"}}function x(){if(f(),s)s.update(y());else s=f1(y(),{choose:d,retry:c});return s.host}return{error:()=>a,isLoading:()=>o,render:x,selectedLacksTools:()=>BL(t())===!1}}function b1(e){let t="",r=[],o=null,a=null,i=gu({requestRender:e.requestRender});function s(){let j=h.value,k=j?.documentPath||null,T=Oe(j?.session.selection),N=null;if(j&&T){let D=oe(j.doc.document,T),M=Jn(D)?D:void 0,V=it(M?.tagName)||"element",F=M?.textContent,B=n(F)?F.slice(0,40):"";N={detail:`Selected element at ${JSON.stringify(T)}: <${V}>${B?` "${B}"`:""}`,kind:"selection",label:`<${V}>`}}return{pageChip:k?{detail:`Page: ${k}`,kind:"page",label:k}:null,selectionChip:N}}function l(j){r=[...r.filter((k)=>k.kind!==j.kind),j],e.requestRender()}function f(j){r=r.filter((k)=>k.kind!==j),e.requestRender()}function c(){let{selectionChip:j}=s();if(!j)return!1;return l(j),!0}function d(j){if(o){o.close(),o=null;return}let k=j instanceof HTMLElement?j:null,{pageChip:T,selectionChip:N}=s(),O={label:"Attach context",onClosed:(D)=>{if(o===D)o=null},region:"assistant-attach",rows:[{destructive:!1,disabled:T===null,dividerAbove:!1,id:"attach.page",requires:"a page open in this pane",run:()=>{if(T)l(T)},title:T?`Current page — ${T.label}`:"Current page"},{destructive:!1,disabled:N===null,dividerAbove:!1,id:"attach.selection",requires:"an element selected on the canvas",run:()=>{if(N)l(N)},title:N?`Selected element — ${N.label}`:"Selected element"}]};if(k)O.opener=k,O.place=()=>{let D=Me(k);return{x:D.left,y:D.top-4}};else O.origin={x:0,y:0};o=zt(O)}function b(j){let k=t.trim().length>0;if(t=j,k!==t.trim().length>0)e.requestRender()}function y(){if(!t.trim()||e.isStreaming()&&!(e.isAwaiting?.()??!1))return;let j=mu(t,r);x(),e.onSend(j),e.requestRender()}function x(){t="",r=[]}function S(){let j=i.render();if(a&&j.parentNode!==a)a.append(j)}function P(){S();let j=e.isStreaming(),k=e.isAwaiting?.()??!1,T=i.selectedLacksTools()?"This model can't use editing tools — the assistant will answer but not edit.":"";return{awaiting:k,composerChips:r.map((N)=>({hint:N.detail,key:N.kind,label:N.label})),draft:t,hasComposerChips:r.length>0,note:T,noteState:T?"shown":"hidden",placeholder:k?"Answer the assistant… (Enter to reply)":"Ask the assistant… (Enter to send)",sendDisabled:t.trim().length===0,sendLabel:k?"Answer":"Send",sendState:!k&&j?"stop":"send"}}return{attachSelection:c,clear:x,dropChip:f,edit:b,openAttachMenu:d,pickerSlot:(j)=>{a=j,S()},send:y,view:P}}var lv=60*rf,bu=24*lv;function r5(e,t=ar()){let r=Math.max(0,t-e);if(r<rf)return"just now";if(r<lv)return`${Math.floor(r/rf)}m ago`;if(r<bu)return`${Math.floor(r/lv)}h ago`;if(r<2*bu)return"yesterday";if(r<7*bu)return`${Math.floor(r/bu)}d ago`;return new Date(e).toLocaleDateString()}function o5(e){let t=e.messageCount;return{key:e.id,meta:`${r5(e.updatedAt)} · ${t} ${t===1?"message":"messages"}`,title:e.title}}function y1(e){return e.map((t)=>o5(t))}var a5=[{pattern:/<\s*script\b/i,what:"a <script> element"},{pattern:/<\s*iframe\b/i,what:"an <iframe> element"},{pattern:/<\s*object\b/i,what:"an <object> element"},{pattern:/<\s*embed\b/i,what:"an <embed> element"},{pattern:/\son[a-z]+\s*=/i,what:"an inline event handler attribute"},{pattern:/javascript:/i,what:"a javascript: URL"},{pattern:/data:text\/html/i,what:"a data: URL carrying HTML"}];function v1(e){for(let{pattern:t,what:r}of a5)if(t.test(e))throw Error(`Refusing to inject markup containing ${r}. This value should have come from `+"markdownToHtml, which removes it — a value that reaches here with it still present "+"means the sanitizer was bypassed, not that this check is too strict.");return e}var yu=null;function i5(){if(yu)return yu;let e=globalThis.trustedTypes;if(!e)return null;return yu=e.createPolicy("jx-studio",{createHTML:v1,createScript:()=>{throw Error("The Studio shell does not build scripts from strings.")},createScriptURL:()=>{throw Error("The Studio shell does not build script URLs from strings.")}}),yu}function w1(e){let t=i5();return t?t.createHTML(e):v1(e)}var x1={$schema:"https://jxsuite.com/schema/v1",$id:"StudioAiChat",$description:'The assistant — the Inspector dock\'s fourth tab — as a Jx document over the kit. The adapter (`panels/ai-panel.ts`) keeps every decision: which pane is showing, what the chat state holds, how a tool call turned out, what a turn changed, which `Assistant:` records the registry offers and what a send does. This document is handed one flat projection — rows already keyed by message id, chips already told their outcome, commands already resolved to a glyph, a label, a tooltip and whether they are refused — and it draws it. Nothing here parses a tool\'s arguments, reads the write ledger or asks the registry a question. Two islands: `[part="md"]` is filled with sanitized model output by `ai-chat/chat-markdown.ts`, and `[part="composer-picker"]` receives the model picker\'s own mounted surface — both through `onNodeCreated` (specs/studio-ui-guidelines.md §9.4). The transcript is a keyed `$map` on the message id and nothing below a row is keyed by position, so a token appended to the tail reconciles one text node instead of rebuilding the list under the reader\'s caret.',tagName:"div",attributes:{part:"assistant"},style:{$description:"Fifty-odd `.ai-*` rules in `styles/shell.css`, keyed on `part` and carried here rather than moved: the stylesheet is outside this change's blast radius, so those rules are left behind as dead text for a central sweep. Three Spectrum names could not come with the declarations and are the kit's instead, at the same values — `--spectrum-font-size-50` (11px) is `--jx-text-sm`, `--spectrum-font-size-75` (12px) is `--jx-text-md`, and the 10px literals are `--jx-text-xs`. Four things changed on purpose. A SESSION ROW IS A BUTTON: it was a `<div>` with a click handler and no role, so the chat history could not be reached from the keyboard at all. THE TRANSCRIPT AND THE IMPORT LOG ARE FOCUSABLE, because a scroll region a pointer can reach and a keyboard cannot is one a keyboard reader cannot read. THE TYPING INDICATOR ANNOUNCES ITSELF as a status rather than being three decorative spans. And THE COMPOSER GROWS WITHOUT MEASURING: `field-sizing: content` over a one-row box replaces the per-keystroke `scrollHeight` write the lit composer ran, with `rows` as the height an engine without it keeps.",display:"flex",flexDirection:"column",flex:"1",minHeight:"0",overflow:"hidden",fontFamily:"var(--jx-font-sans)",color:"var(--fg)",'& [part="chat"], & [part="sessions"]':{display:"flex",flexDirection:"column",flex:"1",minHeight:"0",overflow:"hidden"},'& [part="header"]':{flexShrink:"0",display:"flex",alignItems:"center",gap:"var(--jx-space-2)",padding:"var(--jx-space-2) 6px",minWidth:"0",borderBottom:"1px solid var(--border)",fontSize:"var(--jx-text-md)"},'& [part="title"]':{minWidth:"0",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontWeight:"600"},'& [part="spacer"]':{flex:"1"},'& [part="tokens"]':{$description:"The conversation's share of the model's context. Quiet until it matters: past half the window the assistant starts dropping the oldest turns, and this is the only thing that says so.",fontSize:"var(--jx-text-xs)",fontVariantNumeric:"tabular-nums",color:"var(--fg-dim)",padding:"0 var(--jx-space-2)",borderRadius:"var(--jx-radius-sm)"},'& [part="tokens"][data-tone="warn"]':{color:"var(--warning)",background:"color-mix(in srgb, var(--warning) 14%, transparent)"},'& [part="messages"]':{$description:'THE chat scroller — bounded by `min-height: 0` at every flex level above it. It carries `tabindex="0"` because a scrollable region a pointer can reach and a keyboard cannot is one a keyboard reader cannot read at all, and the ring below is what that costs.',flex:"1 1 0",minHeight:"0",overflowY:"auto",overscrollBehavior:"contain",display:"flex",flexDirection:"column",gap:"var(--jx-space-3)",padding:"var(--jx-space-3)",fontSize:"var(--jx-text-md)",lineHeight:"1.5",":focus-visible":{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"}},'& [part="empty"]':{margin:"0",color:"var(--fg-dim)",textAlign:"center",padding:"var(--jx-space-6) var(--jx-space-4)"},'& [part="row"]':{alignSelf:"stretch",minWidth:"0"},'& [part="row"][data-kind="user"]':{alignSelf:"flex-end",maxWidth:"85%",background:"var(--accent-15)",borderRadius:"8px 8px var(--jx-radius-xs) 8px",padding:"6px 10px"},'& [part="row"][data-kind="tool-error"]':{background:"var(--hover-bg)",borderLeft:"2px solid var(--danger)",borderRadius:"var(--jx-radius-sm)",padding:"var(--jx-space-2) var(--jx-space-3)",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="user-body"]':{$description:"The transcript is content, not interface, and the panel offers no copy action, so each message body opts back in to selection against the root's `user-select: none`: this bubble, the model's `md`, the `streaming` text and the `import-log`. The header, the chips and the composer's buttons around them stay unselectable.",whiteSpace:"pre-wrap",overflowWrap:"anywhere",userSelect:"text"},'& [part="md"]':{$description:"The island `panels/ai-chat/chat-markdown.ts` fills — the app's ONE injection sink, and the markup reaching it has been through `markdownToHtml` and the Trusted Types policy that asserts it did. The document renders the host node and nothing inside it (specs/studio-ui-guidelines.md §9.4). A reply is the text a reader most often copies out of this panel, code blocks included, so it is selectable.",overflowWrap:"anywhere",userSelect:"text"},'& [part="md"] > *:first-child':{marginTop:"0"},'& [part="md"] > *:last-child':{marginBottom:"0"},'& [part="md"] code':{background:"rgba(0, 0, 0, 0.3)",padding:"1px var(--jx-space-2)",borderRadius:"var(--jx-radius-sm)",fontSize:"var(--jx-text-sm)",fontFamily:"var(--font-mono)"},'& [part="md"] pre':{background:"rgba(0, 0, 0, 0.3)",padding:"var(--jx-space-3)",borderRadius:"var(--jx-radius-sm)",overflowX:"auto",margin:"6px 0"},'& [part="md"] pre code':{background:"none",padding:"0"},'& [part="md"] table':{borderCollapse:"collapse",margin:"6px 0"},'& [part="md"] th, & [part="md"] td':{border:"1px solid var(--border)",padding:"var(--jx-space-1) 6px"},'& [part="streaming"]':{$description:'The reply while it arrives, selectable for the reason `[part="md"]` is. The cursor is generated content, which no selection ever includes.',whiteSpace:"pre-wrap",overflowWrap:"anywhere",userSelect:"text","::after":{content:'"▋"',color:"var(--accent)",animation:"jx-ai-cursor 1s steps(2) infinite"}},"@keyframes jx-ai-cursor":{"50%":{opacity:"0"}},'& [part="typing"]':{display:"flex",gap:"var(--jx-space-2)",padding:"var(--jx-space-2) var(--jx-space-1)"},'& [part="typing-dot"]':{width:"6px",height:"6px",borderRadius:"50%",background:"var(--fg-dim)",animation:"jx-ai-typing 1.2s infinite"},'& [part="typing-dot"]:nth-child(2)':{animationDelay:"0.2s"},'& [part="typing-dot"]:nth-child(3)':{animationDelay:"0.4s"},"@keyframes jx-ai-typing":{"0%, 60%, 100%":{opacity:"0.3"},"30%":{opacity:"1"}},'& [part="tools"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-2)",marginTop:"6px"},'& [part="tool-chip"]':{display:"inline-flex",alignItems:"center",gap:"6px",alignSelf:"flex-start",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",background:"var(--hover-bg)",borderLeft:"2px solid var(--accent)",borderRadius:"var(--jx-radius-sm)",padding:"3px var(--jx-space-3)",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)",fontFamily:"var(--font-mono)"},'& [part="tool-glyph"]':{"--jx-icon-size":"12px"},'& [part="tool-chip-name"]':{flex:"0 0 auto"},'& [part="tool-chip-outcome"]':{minWidth:"0",overflow:"hidden",textOverflow:"ellipsis",fontFamily:"var(--jx-font-sans)"},'& [part="tool-chip"][data-outcome="ok"]':{borderLeftColor:"var(--success)"},'& [part="tool-chip"][data-outcome="failed"]':{borderLeftColor:"var(--danger)",color:"var(--danger)"},'& [part="ask"]':{$description:"A question the assistant is waiting on. Deliberately louder than a tool chip and quieter than an error: it is the one thing in the transcript that will not proceed without the reader.",display:"flex",flexDirection:"column",gap:"6px",alignSelf:"stretch",background:"var(--hover-bg)",borderLeft:"2px solid var(--accent)",borderRadius:"var(--jx-radius-sm)",padding:"var(--jx-space-3) 10px"},'& [part="ask"]:not([data-outcome="pending"])':{borderLeftColor:"var(--border)"},'& [part="ask-question"]':{margin:"0",fontSize:"var(--jx-text-md)",color:"var(--fg)",lineHeight:"1.5"},'& [part="ask-context"]':{margin:"0",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)",lineHeight:"1.5"},'& [part="ask-options"]':{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"6px"},'& [part="ask-skip"]':{marginInlineStart:"auto"},'& [part="ask-answer"]':{margin:"0",alignSelf:"flex-start",maxWidth:"100%",background:"var(--accent)",color:"var(--accent-fg)",borderRadius:"var(--jx-radius-sm)",padding:"3px var(--jx-space-3)",fontSize:"var(--jx-text-sm)",overflowWrap:"anywhere"},'& [part="ask-outcome"]':{margin:"0",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)",lineHeight:"1.5"},'& [part="import"]':{$description:"An import, under the chip that started it. It reports for minutes and then stays: the summary line is the run's outcome once it has one, and the log below is a scroller the reader owns — it follows the newest line until they scroll away from it, and stops following while they read.",alignSelf:"stretch",background:"var(--bg-input)",border:"1px solid var(--border)",borderRadius:"var(--jx-radius-sm)",padding:"6px var(--jx-space-3)"},'& [part="import-head"]':{display:"flex",alignItems:"center",gap:"6px",fontSize:"var(--jx-text-sm)",color:"var(--fg)",cursor:"pointer",listStyle:"none","::-webkit-details-marker":{display:"none"}},'& [part="import-spinner"]':{flex:"0 0 auto"},'& [part="import-message"]':{flex:"1",minWidth:"0",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="import-count"]':{$description:"How many lines are folded away, so a collapsed run still says how much it has to show.",flex:"0 0 auto",fontFamily:"var(--font-mono)",fontSize:"var(--jx-text-xs)",color:"var(--fg-dim)"},'& [part="import-phase"]':{color:"var(--fg-dim)",fontFamily:"var(--font-mono)",flex:"0 0 auto",marginRight:"var(--jx-space-2)"},'& [part="import-log"]':{$description:"A captured log, kept selectable against the root's `user-select: none`: its lines are what a reader pastes into a bug report, and nothing here offers to copy them.",userSelect:"text",marginTop:"var(--jx-space-2)",maxHeight:"40vh",overflowY:"auto",overscrollBehavior:"contain",fontFamily:"var(--font-mono)",fontSize:"var(--jx-text-xs)",lineHeight:"1.6",color:"var(--fg-dim)",":focus-visible":{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"}},'& [part="import-log-line"]':{$description:"Wraps rather than ellipses: a phase line names a page, a count or a file, and the end of it is usually the part worth reading.",overflowWrap:"anywhere",whiteSpace:"pre-wrap"},'& [part="changes"]':{$description:"The turn's changed-files summary. Collapsed by default because the headline is the part that must never be missed; the list is for when it is.",marginTop:"6px",borderLeft:"2px solid var(--border)",borderRadius:"var(--jx-radius-sm)",background:"var(--hover-bg)",padding:"var(--jx-space-2) var(--jx-space-3)",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="changes-summary"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-3)",cursor:"pointer"},'& [part="changes-list"]':{margin:"6px 0 var(--jx-space-1)",paddingLeft:"14px",display:"flex",flexDirection:"column",gap:"3px"},'& [part="change"]':{display:"flex",flexWrap:"wrap",gap:"6px",alignItems:"baseline"},'& [part="change"][data-ok="false"]':{color:"var(--danger)"},'& [part="change-caveat"]':{$description:"The undo caveat, rendered to the person holding the undo chord rather than appended to the model-facing tool summary.",color:"var(--warning)",fontStyle:"normal"},'& [part="error-card"]':{$description:"The failed turn's card. It is `error-card` rather than `error` because the model picker mounted into the composer is a `jx-select`, and every kit field draws a permanent, empty `[part=\"error\"]` of its own in this same light-DOM tree: under that name this rule, padding and wash drew an 18×12 red bar over the picker's top-left corner that took the click. Its children keep the `error-` prefix, which the kit does not use.",borderLeft:"2px solid var(--danger)",borderRadius:"var(--jx-radius-sm)",background:"var(--hover-bg)",padding:"6px var(--jx-space-3)",color:"var(--danger)"},'& [part="error-message"], & [part="error-advice"]':{margin:"0"},'& [part="error-advice"]':{marginTop:"var(--jx-space-2)",color:"var(--fg-dim)"},'& [part="error-actions"]':{marginTop:"6px"},'& [part="context-chips"]':{display:"flex",flexWrap:"wrap",gap:"var(--jx-space-2)",marginTop:"6px"},'& [part="context-chip"], & [part="composer-chip"]':{display:"inline-flex",alignItems:"center",gap:"var(--jx-space-1)",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",background:"var(--bg-input)",border:"1px solid var(--border)",borderRadius:"var(--jx-radius-sm)",padding:"1px 6px",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="composer"]':{flexShrink:"0",display:"flex",flexDirection:"column",gap:"6px",padding:"var(--jx-space-3)",borderTop:"1px solid var(--border)"},'& [part="composer-chips"]':{display:"flex",flexWrap:"wrap",gap:"var(--jx-space-2)"},'& [part="composer-input"]':{$description:'A textarea the surface owns outright rather than a `jx-textfield`, for the reason `palette.json` gives about its own combobox: the field needs a ceiling (120px, then it scrolls) and the kit field exposes no token for one, so binding it would mean styling another component\'s `[part="input"]` from outside. `field-sizing: content` is what grows it — no measurement and no handler per keystroke, where the lit composer wrote `scrollHeight` back on every input.',width:"100%",boxSizing:"border-box",resize:"none",fieldSizing:"content",minHeight:"30px",maxHeight:"120px",overflowY:"auto",background:"var(--bg-input)",color:"var(--fg)",border:"1px solid var(--border)",borderRadius:"var(--jx-radius-sm)",padding:"6px var(--jx-space-3)",fontSize:"var(--jx-text-md)",fontFamily:"inherit",lineHeight:"1.4","::placeholder":{color:"var(--fg-dim)"},":focus":{borderColor:"var(--accent)"},":focus-visible":{outline:"var(--jx-focus-ring)",outlineOffset:"1px"}},'& [part="composer-row"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",minWidth:"0"},'& [part="composer-note"]':{$description:"The chat-only-model note, under the picker that caused it. Advisory weight on purpose: the assistant still answers, it just cannot edit.",margin:"0",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)",lineHeight:"1.3"},'& [part="setup"]':{$description:"The in-panel residue of the retired credentials gate: one sentence and the action that fixes it, between the transcript and the composer.",flexShrink:"0",display:"flex",alignItems:"center",justifyContent:"space-between",gap:"var(--jx-space-3)",padding:"6px var(--jx-space-3)",borderTop:"1px solid var(--border)",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)"},'& [part="session-list"]':{flex:"1 1 0",minHeight:"0",overflowY:"auto",margin:"0",padding:"0",listStyle:"none",fontSize:"var(--jx-text-md)"},'& [part="sessions-empty"]':{margin:"0",color:"var(--fg-dim)",textAlign:"center",padding:"var(--jx-space-6) var(--jx-space-4)"},'& [part="session-row"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",minWidth:"0",borderBottom:"1px solid var(--border)",padding:"0 var(--jx-space-3) 0 0",":hover":{background:"var(--hover-bg)"},':hover [part="session-delete"]':{visibility:"visible"}},'& [part="session-open"]':{$description:"A BUTTON, where the lit row was a `<div>` with a click handler and no role: the chat history could not be reached from the keyboard at all.",flex:"1",minWidth:"0",display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"1px",margin:"0",padding:"6px var(--jx-space-3)",border:"none",background:"none",color:"inherit",font:"inherit",textAlign:"left",cursor:"pointer",":focus-visible":{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"}},'& [part="session-title"]':{maxWidth:"100%",fontWeight:"600",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="session-meta"]':{color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)"},'& [part="session-delete"]':{flex:"0 0 auto",visibility:"hidden",":focus-within":{visibility:"visible"}},"@(forced-colors: active)":{$description:"Every author colour is replaced by one from the user's palette in forced colours, so the washes behind a user bubble, a question card and an error collapse into the page. A border is what is left, and each is given a palette colour of its own so the three still read apart.",'& [part="row"][data-kind="user"]':{border:"1px solid CanvasText"},'& [part="ask"]':{borderLeftColor:"Highlight"},'& [part="tool-chip"][data-outcome="failed"]':{borderLeftColor:"LinkText"},'& [part="error-card"]':{borderLeftColor:"LinkText"}},"@(prefers-reduced-motion: reduce)":{'& [part="streaming"]::after':{animation:"none"},'& [part="typing-dot"]':{animation:"none",opacity:"0.6"}}},children:[{tagName:"div",attributes:{part:"view-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/view"},cases:{chat:{tagName:"div",attributes:{part:"chat"},children:[{tagName:"header",attributes:{part:"header"},children:[{$prototype:"Array",items:{$ref:"#/state/headLead"},key:{$ref:"$map/item/key"},map:{tagName:"jx-action-button",attributes:{part:"head-button","data-command":"${$map.item.id}"},$props:{size:"sm",quiet:!0,icon:{$ref:"$map/item/icon"},label:{$ref:"$map/item/label"},hint:{$ref:"$map/item/hint"},disabled:{$ref:"$map/item/disabled"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/run"},value:[{$ref:"$map/item/id"}]}]}}},{tagName:"span",attributes:{part:"title"},textContent:"${state.title}"},{tagName:"span",attributes:{part:"spacer",role:"none"}},{tagName:"div",attributes:{part:"tokens-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/tokensState"},cases:{shown:{tagName:"span",attributes:{part:"tokens","data-tone":"${state.tokensTone}",title:"${state.tokensHint}"},textContent:"${state.tokens}"}}},{tagName:"div",attributes:{part:"streaming-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/streaming"},cases:{true:{tagName:"jx-spinner",attributes:{part:"busy"},$props:{size:"sm",label:"The assistant is replying"}}}},{$prototype:"Array",items:{$ref:"#/state/headTrail"},key:{$ref:"$map/item/key"},map:{tagName:"jx-action-button",attributes:{part:"head-button","data-command":"${$map.item.id}"},$props:{size:"sm",quiet:!0,icon:{$ref:"$map/item/icon"},label:{$ref:"$map/item/label"},hint:{$ref:"$map/item/hint"},disabled:{$ref:"$map/item/disabled"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/run"},value:[{$ref:"$map/item/id"}]}]}}}]},{tagName:"div",attributes:{part:"messages",role:"log","aria-label":"Conversation",tabindex:"0"},onscroll:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/scrolled"}}],description:"The reader moved the transcript. The adapter records whether they are still at the newest message; a reader who has scrolled up is reading something, and pinning them back on every token is what makes a live transcript unreadable."},children:[{tagName:"div",attributes:{part:"empty-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/emptyState"},cases:{shown:{tagName:"p",attributes:{part:"empty"},textContent:"Ask the assistant to build or edit this page — it can add sections, restyle elements, and wire up components."}}},{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"row","data-kind":"${$map.item.kind}","data-message":"${$map.item.key}"},children:[{tagName:"div",attributes:{part:"body-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/kind"},cases:{user:{tagName:"div",attributes:{part:"user-body"},textContent:"${$map.item.body}"},assistant:{tagName:"div",attributes:{part:"md"}},streaming:{tagName:"span",attributes:{part:"streaming"},textContent:"${$map.item.body}"},typing:{tagName:"div",attributes:{part:"typing",role:"status","aria-label":"The assistant is replying"},children:[{tagName:"span",attributes:{part:"typing-dot"}},{tagName:"span",attributes:{part:"typing-dot"}},{tagName:"span",attributes:{part:"typing-dot"}}]},"tool-error":{tagName:"div",attributes:{part:"tool-error"},textContent:"${$map.item.body}"}}},{tagName:"div",attributes:{part:"context-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasContextChips"},cases:{true:{tagName:"div",attributes:{part:"context-chips"},children:[{$prototype:"Array",items:{$ref:"$map/item/contextChips"},key:{$ref:"$map/item/key"},map:{tagName:"span",attributes:{part:"context-chip"},textContent:"${$map.item.label}"}}]}}},{tagName:"div",attributes:{part:"tools-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasChips"},cases:{true:{tagName:"div",attributes:{part:"tools"},children:[{$prototype:"Array",items:{$ref:"$map/item/chips"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"chip","data-tool":"${$map.item.tool}"},style:{display:"contents"},children:[{tagName:"div",attributes:{part:"chip-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/kind"},cases:{chip:{tagName:"span",attributes:{part:"tool-chip","data-outcome":"${$map.item.outcome}",title:"${$map.item.hint}"},children:[{tagName:"jx-icon",attributes:{part:"tool-glyph"},$props:{name:"gear-six",label:"Tool call"}},{tagName:"span",attributes:{part:"tool-chip-name"},textContent:"${$map.item.label}"},{tagName:"div",attributes:{part:"tool-outcome-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/outcomeState"},cases:{shown:{tagName:"span",attributes:{part:"tool-chip-outcome"},textContent:"${$map.item.mark} ${$map.item.outcomeText}"}}}]},ask:{tagName:"div",attributes:{part:"ask","data-outcome":"${$map.item.outcome}"},children:[{tagName:"p",attributes:{part:"ask-question"},textContent:"${$map.item.question}"},{tagName:"div",attributes:{part:"ask-context-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasContext"},cases:{true:{tagName:"p",attributes:{part:"ask-context"},textContent:"${$map.item.context}"}}},{tagName:"div",attributes:{part:"ask-state-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/askState"},cases:{pending:{tagName:"div",attributes:{part:"ask-options",role:"group","aria-label":"Answers the assistant offered"},children:[{$prototype:"Array",items:{$ref:"$map/item/options"},key:{$ref:"$map/item/key"},map:{tagName:"jx-button",attributes:{part:"ask-option"},$props:{size:"sm",variant:"secondary"},children:[{tagName:"span",textContent:"${$map.item.label}"}],onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/answer"},value:[{$ref:"$map/item/label"}]}]}}},{tagName:"jx-action-button",attributes:{part:"ask-skip"},$props:{size:"sm",quiet:!0,label:"You decide",hint:"Let the assistant decide"},children:[{tagName:"span",textContent:"You decide"}],onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/skip"},value:[]}]}}]},unanswered:{tagName:"p",attributes:{part:"ask-outcome"},textContent:"This question was still open when the session was reloaded — reply below to carry on."},answered:{tagName:"p",attributes:{part:"ask-answer"},textContent:"${$map.item.answer}"},failed:{tagName:"p",attributes:{part:"ask-outcome"},textContent:"${$map.item.outcomeText}"}}}]}}},{tagName:"div",attributes:{part:"import-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/importState"},cases:{run:{tagName:"details",attributes:{part:"import"},open:{$ref:"$map/item/importOpen"},children:[{tagName:"summary",attributes:{part:"import-head"},children:[{tagName:"div",attributes:{part:"import-spinner-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/importSpinner"},cases:{busy:{tagName:"jx-spinner",attributes:{part:"import-spinner"},$props:{size:"sm",label:"Importing"}},progress:{tagName:"jx-spinner",attributes:{part:"import-spinner"},$props:{size:"sm",label:"Importing",value:{$ref:"$map/item/importProgress"}}}}},{tagName:"div",attributes:{part:"import-phase-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasPhase"},cases:{true:{tagName:"span",attributes:{part:"import-phase"},textContent:"${$map.item.importPhase}"}}},{tagName:"span",attributes:{part:"import-message"},textContent:"${$map.item.importMessage}"},{tagName:"span",attributes:{part:"import-count",title:"Lines this run has reported"},textContent:"${$map.item.importCount}"}]},{tagName:"div",attributes:{part:"import-log","data-log":"${$map.item.key}",tabindex:"0",role:"log","aria-label":"Import log"},children:[{$prototype:"Array",items:{$ref:"$map/item/importLog"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"import-log-line"},children:[{tagName:"span",attributes:{part:"import-phase"},textContent:"${$map.item.phase}"},{tagName:"span",attributes:{part:"import-text"},textContent:"${$map.item.message}"}]}}]}]}}}]}}]}}},{tagName:"div",attributes:{part:"changes-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/changesState"},cases:{list:{tagName:"details",attributes:{part:"changes"},children:[{tagName:"summary",attributes:{part:"changes-summary"},children:[{tagName:"span",attributes:{part:"changes-text"},textContent:"${$map.item.changesSummary}"},{tagName:"div",attributes:{part:"restore-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/canRestore"},cases:{true:{tagName:"jx-action-button",attributes:{part:"changes-restore"},$props:{size:"sm",quiet:!0,label:"Restore to here",hint:"Undo everything this turn changed"},children:[{tagName:"span",textContent:"Restore to here"}],onclick:{$prototype:"Function",body:[{preventDefault:!0},{stopPropagation:!0},{operator:"call",target:{$ref:"#/state/restore"},value:[{$ref:"$map/item/key"}]}]}}}}]},{tagName:"ul",attributes:{part:"changes-list"},children:[{$prototype:"Array",items:{$ref:"$map/item/changes"},key:{$ref:"$map/item/key"},map:{tagName:"li",attributes:{part:"change","data-disk":"${$map.item.disk}","data-ok":"${$map.item.ok}"},children:[{tagName:"code",attributes:{part:"change-path"},textContent:"${$map.item.path}"},{tagName:"span",attributes:{part:"change-note"},textContent:"${$map.item.note}"},{tagName:"div",attributes:{part:"caveat-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/disk"},cases:{true:{tagName:"em",attributes:{part:"change-caveat"},textContent:"written to disk — undo cannot reach it"}}}]}}]}]}}}]}},{tagName:"div",attributes:{part:"error-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/errorState"},cases:{shown:{tagName:"div",attributes:{part:"error-card",role:"alert"},children:[{tagName:"p",attributes:{part:"error-message"},textContent:"${state.error}"},{tagName:"div",attributes:{part:"advice-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasAdvice"},cases:{true:{tagName:"p",attributes:{part:"error-advice"},textContent:"${state.errorAdvice}"}}},{tagName:"div",attributes:{part:"error-actions"},children:[{$prototype:"Array",items:{$ref:"#/state/retry"},key:{$ref:"$map/item/key"},map:{tagName:"jx-button",attributes:{part:"error-retry","data-command":"${$map.item.id}",title:"${$map.item.hint}"},$props:{size:"sm",variant:"secondary",disabled:{$ref:"$map/item/disabled"}},children:[{tagName:"span",textContent:"${$map.item.text}"}],onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/run"},value:[{$ref:"$map/item/id"}]}]}}}]}]}}}]},{tagName:"div",attributes:{part:"setup-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/setupState"},cases:{shown:{tagName:"div",attributes:{part:"setup"},children:[{tagName:"span",attributes:{part:"setup-message"},textContent:"No AI provider is connected yet."},{tagName:"jx-button",attributes:{part:"setup-action"},$props:{size:"sm",variant:"secondary"},children:[{tagName:"span",textContent:"Open Preferences…"}],onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openSettings"},value:[]}]}}]}}},{tagName:"div",attributes:{part:"composer","data-awaiting":"${state.awaiting ? 'true' : null}"},children:[{tagName:"div",attributes:{part:"composer-chips-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasComposerChips"},cases:{true:{tagName:"div",attributes:{part:"composer-chips"},children:[{$prototype:"Array",items:{$ref:"#/state/composerChips"},key:{$ref:"$map/item/key"},map:{tagName:"span",attributes:{part:"composer-chip",title:"${$map.item.hint}"},children:[{tagName:"span",attributes:{part:"composer-chip-label"},textContent:"${$map.item.label}"},{tagName:"jx-action-button",attributes:{part:"composer-chip-remove"},$props:{size:"sm",quiet:!0,icon:"x",label:"Remove ${$map.item.label}",hint:"Remove ${$map.item.label}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/dropChip"},value:[{$ref:"$map/item/key"}]}]}}]}}]}}},{tagName:"textarea",attributes:{part:"composer-input",rows:"1","aria-label":"${state.placeholder}",placeholder:"${state.placeholder}"},value:{$ref:"#/state/draft"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/edit"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{Enter:[{if:{operator:"&&",target:{operator:"!",target:{$ref:"event#/shiftKey"}},value:{operator:"!",target:{$ref:"event#/isComposing"}}},then:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/send"},value:[]}]}]}}],description:"Enter sends and Shift+Enter opens a line, unless an IME is mid-composition — the one key a chat composer owns."}},{tagName:"div",attributes:{part:"composer-row"},children:[{tagName:"jx-action-button",attributes:{part:"composer-attach"},$props:{size:"sm",quiet:!0,icon:"paperclip",label:"Attach context",hint:"Attach context",haspopup:"menu"},onclick:{$ref:"#/state/attach"}},{tagName:"div",attributes:{part:"composer-picker",role:"none"},style:{display:"contents"}},{tagName:"span",attributes:{part:"spacer",role:"none"}},{tagName:"jx-action-button",attributes:{part:"composer-settings"},$props:{size:"sm",quiet:!0,icon:"gear",label:"API key & endpoint",hint:"API key & endpoint"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openSettings"},value:[]}]}},{tagName:"div",attributes:{part:"send-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/sendState"},cases:{stop:{tagName:"jx-action-button",attributes:{part:"composer-stop"},$props:{size:"sm",quiet:!1,icon:"stop",label:"Stop",hint:"Stop"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/stop"},value:[]}]}},send:{tagName:"jx-action-button",attributes:{part:"composer-send"},$props:{size:"sm",quiet:!1,icon:"paper-plane-tilt",label:"${state.sendLabel}",hint:"${state.sendLabel}",disabled:{$ref:"#/state/sendDisabled"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/send"},value:[]}]}}}}]},{tagName:"div",attributes:{part:"note-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/noteState"},cases:{shown:{tagName:"p",attributes:{part:"composer-note"},textContent:"${state.note}"}}}]}]},sessions:{tagName:"div",attributes:{part:"sessions"},children:[{tagName:"header",attributes:{part:"header"},children:[{tagName:"span",attributes:{part:"title"},textContent:"Chats"},{tagName:"span",attributes:{part:"spacer",role:"none"}},{$prototype:"Array",items:{$ref:"#/state/sessionCommands"},key:{$ref:"$map/item/key"},map:{tagName:"jx-action-button",attributes:{part:"head-button","data-command":"${$map.item.id}"},$props:{size:"sm",quiet:!0,icon:{$ref:"$map/item/icon"},label:{$ref:"$map/item/label"},hint:{$ref:"$map/item/hint"},disabled:{$ref:"$map/item/disabled"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/run"},value:[{$ref:"$map/item/id"}]}]},children:[{tagName:"span",textContent:"${$map.item.text}"}]}}]},{tagName:"div",attributes:{part:"session-list-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasSessions"},cases:{true:{tagName:"ul",attributes:{part:"session-list"},children:[{$prototype:"Array",items:{$ref:"#/state/sessions"},key:{$ref:"$map/item/key"},map:{tagName:"li",attributes:{part:"session-row"},children:[{tagName:"button",attributes:{part:"session-open",type:"button","data-session":"${$map.item.key}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openSession"},value:[{$ref:"$map/item/key"}]}]},children:[{tagName:"span",attributes:{part:"session-title"},textContent:"${$map.item.title}"},{tagName:"span",attributes:{part:"session-meta"},textContent:"${$map.item.meta}"}]},{tagName:"jx-action-button",attributes:{part:"session-delete"},$props:{size:"sm",quiet:!0,icon:"trash",label:"Delete ${$map.item.title}",hint:"Delete chat"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/deleteSession"},value:[{$ref:"$map/item/key"}]}]}}]}}]},false:{tagName:"p",attributes:{part:"sessions-empty"},textContent:"No previous chats"}}}]}}}]};E("ai-chat",x1);var l5=48,c5=24;function k1(e,t){e.view=t.view,e.title=t.title,e.tokens=t.tokens,e.tokensHint=t.tokensHint,e.tokensTone=t.tokensTone,e.tokensState=t.tokensState,e.streaming=t.streaming,e.headLead=t.headLead,e.headTrail=t.headTrail,e.rows=t.rows,e.emptyState=t.emptyState,e.error=t.error,e.errorAdvice=t.errorAdvice,e.hasAdvice=t.hasAdvice,e.errorState=t.errorState,e.retry=t.retry,e.setupState=t.setupState,e.sessions=t.sessions,e.hasSessions=t.hasSessions,e.sessionCommands=t.sessionCommands,e.draft=t.draft,e.placeholder=t.placeholder,e.composerChips=t.composerChips,e.hasComposerChips=t.hasComposerChips,e.sendState=t.sendState,e.sendLabel=t.sendLabel,e.sendDisabled=t.sendDisabled,e.note=t.note,e.noteState=t.noteState,e.awaiting=t.awaiting}function uv(){return{awaiting:!1,composerChips:[],draft:"",emptyState:"shown",error:"",errorAdvice:"",errorState:"hidden",hasAdvice:!1,hasComposerChips:!1,hasSessions:!1,headLead:[],headTrail:[],note:"",noteState:"hidden",placeholder:"Ask the assistant… (Enter to send)",retry:[],rows:[],sendDisabled:!0,sendLabel:"Send",sendState:"send",sessionCommands:[],sessions:[],setupState:"hidden",streaming:!1,title:"New chat",tokens:"",tokensHint:"",tokensState:"hidden",tokensTone:"normal",view:"chat"}}function d5(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function cv(e){let t=e?.$map,r=v(t)?t.item:void 0;return v(r)?r:null}function pv(e,t){let r=e?.[t];return n(r)?r:""}function p5(e,t){if(e.scrollHeight-e.scrollTop-e.clientHeight<=t||e.scrollTop===0)e.scrollTop=e.scrollHeight}function $1(e,t,r){let o=null,a=null,i=!0,s=new Map,l=new Map,f=g({...uv(),...r,scrolled:()=>{if(o)i=o.scrollHeight-o.scrollTop-o.clientHeight<l5}});k1(f,t);function c(){let S=new Set(f.rows.map((P)=>P.key));for(let[P,j]of s)if(!S.has(P)||!j.node.isConnected)s.delete(P);for(let P of f.rows){let j=s.get(P.key);if(j&&j.html!==P.markdown)d(j.node,P.markdown),j.html=P.markdown}}function d(S,P){S.innerHTML=w1(P)}let b=null,y=!1;e.replaceChildren(),R("ai-chat",f,e,{onNodeCreated:(S,P,j,k)=>{let T=d5(j);if(T===""||!(S instanceof HTMLElement))return;if(T==="messages"){o=S;return}if(T==="composer-input"){a=S;return}if(T==="composer-picker"){r.pickerSlot(S);return}if(T==="md"){let N=pv(cv(k),"key"),O=pv(cv(k),"markdown");if(N)d(S,O),s.set(N,{html:O,node:S});return}if(T==="import-log"){let N=pv(cv(k),"key");if(N)l.set(N,S)}}}).then((S)=>{if(y){S.dispose();return}b=S,c(),x()});function x(){if(o&&i)o.scrollTop=o.scrollHeight;for(let[S,P]of l){if(!P.isConnected){l.delete(S);continue}p5(P,c5)}}return{dispose(){y=!0,b?.dispose(),b=null,s.clear(),l.clear()},focusComposer:()=>a?.focus(),pin(){i=!0},update(S){k1(f,S),queueMicrotask(()=>{if(!y)c(),x()})}}}var S1=!1,gr="chat",Ee=Pj();globalThis.assistant=Ee;var pl=null,_t=null;function P1(e){if(pl?.stop(),pl=null,_t?.dispose(),_t=null,!e)return;_t=$1(e,I1(),{answer:(t)=>{vu(t)},attach:(t,r)=>{Ro.openAttachMenu(r.currentTarget)},deleteSession:w5,dropChip:(t)=>Ro.dropChip(t),edit:(t)=>Ro.edit(t),openSession:v5,openSettings:()=>{Gg("assistant")},pickerSlot:(t)=>Ro.pickerSlot(t),restore:g5,run:u5,send:()=>Ro.send(),skip:()=>{Ee.interactions.skip(),We()},stop:R1}),m5()}var fv=!1;function We(){if(fv||!_t)return;fv=!0,queueMicrotask(()=>{fv=!1,_t?.update(I1())})}function u5(e){let t=ae();if(t?.isEnabled(e))Tn(t,e,void 0,"Assistant")}function m5(){pl?.stop(),pl=me(),pl.run(()=>{te(()=>{let e=Ee.chatState;e.messages.length;let t=e.messages.at(-1);t?.content,t?.toolCalls?.length;for(let o of f5(e.messages)?.toolCalls??[])o.result;e.status,e.error,Ee.isTurnActive(),e.tokenCount,ae(),Ee.interactions.pending;let r=QN();r?.message,r?.log.length,r?.status,We()})})}function f5(e){for(let t=e.length-1;t>=0;t--)if(e[t].role!=="tool")return e[t];return}function E1(){if(S1)return;S1=!0,OD(We)}async function vu(e){if(!e.trim())return;if(Ee.interactions.answer(e.trim())){_t?.pin(),We();return}if(wu())return;gr="chat",_t?.pin(),We();try{await Ee.sendMessage(e)}catch{}finally{We()}}async function h5(){let e=Ee.chatState,t=e.messages.toReversed().find((o)=>o.role==="user");if(!t)return;let{content:r}=t;e.retryLast(),We(),await vu(r)}function g5(e){let t=$M(e);if(n(t)){w.warn(t,{source:"Assistant"});return}let[r,...o]=t,a=o.length===0&&r===h.value,i={source:"Assistant"};if(a)i.action="edit.redo";w.success("Restored to before that turn.",i),We()}async function yv(e){if(Ee.isTurnActive())await Ee.whenTurnEnds();await vu(e)}async function N1(e){Ao(),A1(),await yv(y5(e))}function b5(e){if(e.mode==="all")return"keep every one the site declares";if(e.mode==="explicit")return`${(e.widths??[]).join(", ")} (rounding ${e.rounding??"nearest"})`;return`keep ${e.count??3}, evenly spaced (rounding ${e.rounding??"nearest"})`}function y5(e){let t=e.prompt.trim()||`Import ${e.url} and get it ready for me to work on.`;return mu(t,[{detail:`Import request from the New Project form — url: ${e.url}, destination: ${e.directory}, depth: ${e.depth}, max pages: ${e.maxPages}, AI component naming: ${e.aiComponents}, breakpoints: ${b5(e.breakpoints)}. Call import_site with the url; the destination and options above are already settled.`,kind:"import",label:`Import ${e.url}`}])}var C1=0;function j1(e){mA("sk-demo"),gr="chat",_t?.pin();for(let t of e){C1+=1;let r=C1,o={content:t.content,id:`seeded_${r}`,role:t.role,timestamp:r};if(t.toolCalls)o.toolCalls=t.toolCalls.map((a,i)=>({arguments:a.arguments,id:`seeded_${r}_tc${i}`,name:a.name}));Ee.chatState.messages.push(o)}We()}function Ao(){ko("right",!1),Iu("assistant")}function wv(){return Ee.interactions.pending!==null}function wu(){return Ee.isTurnActive()}function R1(){Ee.stop()}function A1(){Ee.newChat(),iv(),gr="chat",_t?.pin(),We()}function v5(e){Ee.openSession(e),iv(),gr="chat",_t?.pin(),We()}function w5(e){Ee.deleteSession(e),We()}function x5(){gr="sessions",We()}function k5(){let e=Ee.activeSessionId();if(!e)return null;return Ee.listSessions().find((t)=>t.id===e)?.title??null}var Ro=b1({isAwaiting:wv,isStreaming:wu,onSend:(e)=>{vu(e)},requestRender:We});function T1(){if(Ao(),gr!=="chat")gr="chat",We();requestAnimationFrame(()=>{_t?.focusComposer()})}function I1(){let e=Ee.chatState,t=e.status==="streaming",r=!t&&e.error?e.error:"",o=r?QI(r):"",a=hu("assistant.newChat",{icon:"plus"}),i=i1({ask:{importRun:vs,pendingId:Ee.interactions.pending?.callId??null},messages:e.messages,status:e.status});return{...uv(),...Ro.view(),emptyState:i.length===0&&!t?"shown":"hidden",error:r,errorAdvice:o,errorState:r?"shown":"hidden",hasAdvice:o!=="",hasSessions:Ee.listSessions().length>0,headLead:ol([hu("assistant.history",{icon:"clock-counter-clockwise"})]),headTrail:ol([a]),retry:ol([hu("assistant.retry",{text:"Retry"})]),rows:i,sessionCommands:ol([a?{...a,text:"New Chat"}:null]),sessions:y1(Ee.listSessions()),setupState:zb()?"hidden":"shown",streaming:t,title:k5()??"New chat",tokens:ZI(e.tokenCount),tokensHint:e1(e.tokenCount,e.contextWarning),tokensState:e.tokenCount>0?"shown":"hidden",tokensTone:e.contextWarning?"warn":"normal",view:gr}}function L1(){return[{category:"Assistant",id:"assistant.focus",level:"application",title:"Focus Composer",keybinding:"mod+shift+a",menus:["palette"],group:"1_chat",run:T1},{category:"Assistant",id:"assistant.newChat",level:"application",title:"New Chat",menus:["palette"],group:"1_chat",run:()=>{Ao(),A1()}},{category:"Assistant",id:"assistant.history",level:"application",title:"Chat History",menus:["palette"],group:"1_chat",run:()=>{Ao(),x5()}},{category:"Assistant",id:"assistant.attachSelection",level:"application",title:"Attach Selection",menus:["palette"],group:"2_turn",requires:"an element selected on the canvas",when:(e)=>vh(e),run:()=>{if(!Ro.attachSelection()){w.warn("Nothing is selected to attach.",{source:"Assistant"});return}T1()}},{category:"Assistant",id:"assistant.retry",level:"application",title:"Retry Last Message",menus:["palette"],group:"2_turn",requires:"a connected AI provider, and no turn already in flight",enablement:(e)=>e.ai.configured&&!e.ai.streaming,run:()=>{Ao(),h5()}},{category:"Assistant",id:"assistant.stop",level:"application",title:"Stop Responding",menus:["palette"],group:"2_turn",requires:"a turn in flight",enablement:(e)=>e.ai.streaming||e.ai.waiting,run:R1}]}var xv={name:"jx-boot",content:"launcher"};var $5="warning";async function xu(e,t,r,o,a){let i={"Content-Type":"application/json"};if(t.apiKey)i["X-Api-Key"]=t.apiKey;if(t.baseUrl)i["X-Api-Base-URL"]=t.baseUrl;let s={url:t.url,directory:t.directory,depth:t.depth,maxPages:t.maxPages,aiComponents:t.aiComponents};if(t.breakpoints!==void 0)s.breakpoints=t.breakpoints;if(t.model!==void 0)s.aiModel=t.model;if(t.verify!==void 0)s.verify=t.verify;if(t.verifyThreshold!==void 0)s.verifyThreshold=t.verifyThreshold;if(t.verifyMinFidelity!==void 0)s.verifyMinFidelity=t.verifyMinFidelity;let l={body:JSON.stringify(s),headers:{...i},method:"POST"};if(o!==void 0)l.signal=o;let f=await fetch(e,l);if(!f.ok){let P=`Import failed (${f.status})`;try{let j=await f.json();if(v(j)&&j.error)P=String(j.error)}catch{}throw Error(P)}if(!f.body)throw Error("Import stream had no response body");let c=f.body.getReader(),d=new TextDecoder,b="",y=null,x=0,S=(P)=>{let j=P.trim();if(!j)return;let k;try{k=JSON.parse(j)}catch{x+=1;return}if(k.type==="progress"){let T={phase:k.phase??"",message:k.message??""};if(k.current!==void 0)T.current=k.current;if(k.total!==void 0)T.total=k.total;r(T)}else if(k.type==="ready"&&k.root!==void 0)a?.({root:k.root});else if(k.type==="done"&&k.root!==void 0&&k.config){let T={root:k.root,config:k.config};if(k.result!==void 0)T.result=k.result;return T}else if(k.type==="error")throw Error(k.error||"Import failed");return};try{for(;;){let{done:P,value:j}=await c.read();if(P)break;b+=d.decode(j,{stream:!0});let k=b.split(`
|
|
501
|
-
`);b=k.pop()??"";for(let T of k)y=S(T)??y}y=S(b)??y}finally{try{await c.cancel()}catch{}}if(x>0)r({message:`${x} progress line${x===1?"":"s"} could not be read and ${x===1?"was":"were"} skipped — the import may be missing steps.`,phase:$5});if(!y)throw Error("Import stream ended without a result");return y}function O1(e){let t=Math.max(1,e.maxPaths??OL),r=Math.max(1,e.maxInFlight??4),o=e.schedule??queueMicrotask,a=new Map,i=!1,s=!0,l=[],f=0;function c(j,k){let T=a.get(j);if(T)T.push(...k);else a.set(j,k);if(!i)i=!0,o(b)}function d(j,k){e.fetchOne(j).then((T)=>{for(let N of k)N.resolve(T)},(T)=>{for(let N of k)N.reject(T)})}function b(){i=!1;let j=a;if(a=new Map,!s||j.size===1){for(let[T,N]of j)d(T,N);return}let k=new Map;for(let[T,N]of j)if(k.set(T,N),k.size===t)l.push(k),k=new Map;if(k.size>0)l.push(k);y()}function y(){while(f<r&&l.length>0)x(l.shift())}function x(j){f+=1,S(j).finally(()=>{f-=1,y()})}async function S(j){if(!s){for(let[T,N]of j)d(T,N);return}let k;try{k=await e.fetchBatch([...j.keys()])}catch(T){for(let N of j.values())for(let O of N)O.reject(T);return}if(k==="retry-singly"||k==="unsupported"||!_(k)){if(k==="unsupported")s=!1;for(let[T,N]of j)d(T,N);return}try{P(j,k)}catch{for(let[T,N]of j)d(T,N)}}function P(j,k){let T=0;for(let O of Array.isArray(k.files)?k.files:[]){let[D,M]=Array.isArray(O)?O:[],V=D===void 0?void 0:j.get(D);if(D===void 0||!V)continue;j.delete(D),T+=1;let F=M,B=F?.content;if(n(B))for(let L of V)L.resolve(B);else{let L=F?.error?.message,U=Error(L||`Failed to read file: ${D}`);for(let W of V)W.reject(U)}}let N=(Array.isArray(k.omitted)?k.omitted:[]).filter((O)=>j.has(O));if(T===0&&N.length>0){let O=N.shift();d(O,j.get(O)),j.delete(O)}for(let O of N)c(O,j.get(O)),j.delete(O);for(let[O,D]of j)d(O,D)}return{read(j){return new Promise((k,T)=>{c(j,[{reject:T,resolve:k}])})}}}function S5(e){return v(e)&&Array.isArray(e.files)}function ku(e,t){return e[t]??{}}async function ke(e){return await e.json()}function M1(e){return JSON.parse(e)}async function on(e,t){try{return tr(await ke(e))??t}catch{return t}}async function C5(e){let t;try{t=await ke(e)}catch{return!1}let r=Bb(t?.type)??t?.code;return r==="read_only"||r==="read-only"}function F1(e){let t=e?.heading;return n(t)&&t?t:void 0}async function Tu(e,t){let r;try{r=await ke(e)}catch{r=null}let o=Bb(r?.type)??r?.code,a=Dp(r?.actions),i=F1(r),s=FL(r?.retry),l=r?.installUrl,f={status:e.status};if(o)f.code=o;if(n(l))f.installUrl=l;if(a.length>0)f.actions=a;if(i!==void 0)f.heading=i;if(s!==void 0)f.retry=s;let c=r?.conflicts;if(Array.isArray(c))f.conflicts=c.filter((d)=>n(d));return Object.assign(Error(tr(r)??t),f)}async function xe(e,t){if(!e.ok)throw await Tu(e,t);return ke(e)}function _1(e){let t=Bb(e?.type)??e?.code;return t==="action-required"||t==="action_required"}async function T5(e){let t;try{t=await ke(e)}catch{return}if(!_1(t))return;let r=Dp(t?.actions);if(r.length===0)return;let o=tr(t),a=F1(t),i=FL(t?.retry),s={actions:r};if(o!==null)s.detail=o;if(a!==void 0)s.heading=a;if(i!==void 0)s.retry=i;kA(s)}function z1(e){return e.dir?`${e.branch}:${e.dir}`:e.branch}function P5(e){let t=e.indexOf(":"),r=t===-1?e:e.slice(0,t),o=t===-1?"":Bl(e.slice(t+1));if(!r||o===null)return null;return o?{branch:r,dir:o}:{branch:r}}function kv(e){let t=e.dir?`:${e.dir.split("/").map((r)=>encodeURIComponent(r)).join("/")}`:"";return`/edit/${e.owner}/${e.repo}@${encodeURIComponent(e.branch)}${t}`}function E5(e){let{owner:t,repo:r}=e;return`/api/v1/p/${encodeURIComponent(t)}/${encodeURIComponent(r)}/${encodeURIComponent(z1(e))}/studio`}function $u(e){return`${e.owner}/${e.repo}@${z1(e)}`}function H1(e,t){return _(e.data)&&"source"in e.data&&e.data.source===t}async function ul(){let e=await fetch("/api/v1/cf/connection",{credentials:"include"});if(!e.ok)return null;let t=await ke(e);if(!t.connected)return null;let r={connected:!0};if(t.accountId)r.accountId=t.accountId;if(t.accountName)r.accountName=t.accountName;if(t.needsReconnect)r.needsReconnect=!0;if(t.needsAccount)r.needsAccount=!0;if(t.code)r.code=t.code;if(t.reason)r.reason=t.reason;if(t.hasRefreshToken!==void 0)r.hasRefreshToken=t.hasRefreshToken;if(t.expiresAt!==void 0)r.expiresAt=t.expiresAt;return r}var Su=null;async function N5(e,t){let r=await ul().catch(()=>null),o=Boolean(r?.connected&&!r.needsReconnect),a=window.open(t,"cf-connect","width=980,height=780");if(!a)return location.assign(t),{status:"redirect"};e.popup=a;let i=Date.now()+180000;return new Promise((s,l)=>{let f=0,c=()=>{if(window.removeEventListener("message",x),window.clearTimeout(f),!a.closed)a.close()},d=(P)=>{c(),s(P)},b=(P)=>{c(),l(Error(P))},y=(P)=>Boolean(P?.connected&&!P.needsReconnect),x=(P)=>{if(P.origin!==location.origin)return;if(!H1(P,"jx-cf"))return;let{data:j}=P;if(j.status==="error"){b(j.reason??"Cloudflare authorization failed");return}ul().then((k)=>{d(y(k)?{connection:k,status:"connected"}:{status:"timeout"})},()=>{b("Cloudflare connected, but the connection could not be confirmed")})};window.addEventListener("message",x);let S=async()=>{if(Date.now()>i){d({status:"timeout"});return}let P=null,j=!0;try{P=await ul()}catch{j=!1}if(j&&y(P)&&!o){d({connection:P,status:"connected"});return}if(a.closed){let k=await ul().catch(()=>null);d(y(k)?{connection:k,status:"connected"}:{status:"canceled"});return}f=window.setTimeout(()=>{S()},1500)};f=window.setTimeout(()=>{S()},1500)})}function wa(e){return n(e)&&e?e:void 0}function j5(e){if(!Array.isArray(e))return[];return e.flatMap((t)=>{if(!v(t))return[];let r=wa(t.id),o=wa(t.label),a=wa(t.detail);if(!r||!o||!a)return[];let i=Dp(t.actions),{connected:s}=t,l={detail:a,id:r,label:o};if(Ze(s))l.connected=s;if(i.length>0)l.actions=i;return[l]})}function R5(e){if(!Array.isArray(e))return[];return e.flatMap((t)=>{if(!v(t))return[];let r=wa(t.id),o=wa(t.title),a=wa(t.message);if(!r||!o||!a)return[];let i=Dp(t.actions),{display:s,level:l}=t,f={id:r,message:a,title:o};if(l==="info"||l==="warning")f.level=l;if(s==="banner"||s==="toast")f.display=s;if(i.length>0)f.actions=i;return[f]})}var Cu=null,A5=900000,I5=300;function L5(e){let t=Date.now()+A5;return new Promise((r,o)=>{let a=0,i=()=>{if(window.removeEventListener("message",l),window.clearTimeout(a),!e.closed)e.close()},s=(c)=>{i(),r(c)},l=(c)=>{if(c.origin!==location.origin)return;if(!H1(c,"jx-action"))return;let{data:d}=c;if(d.status==="done"||d.status==="canceled")s({status:d.status});else if(d.status==="error")i(),o(Error(d.reason??"The action could not be completed"))};window.addEventListener("message",l);let f=()=>{if(Date.now()>t){s({status:"unknown"});return}if(e.closed){a=window.setTimeout(()=>{s({status:"unknown"})},I5);return}a=window.setTimeout(f,1000)};a=window.setTimeout(f,1000)})}function O5(e){let t=/^([^/@]+)\/([^/@]+)@(.+)$/.exec(e);if(!t)return null;let[,r,o,a]=t,i=a?P5(a):null;if(!r||!o||!i)return null;return{owner:r,repo:o,...i}}async function B1(){let e=await fetch("/api/v1/projects",{credentials:"include"});return e.ok?ke(e):[]}async function D1(e){let t=O5(e);if(t)return t;let r=/^([^/@]+)\/([^/@]+)$/.exec(e);if(!r)return null;let[,o,a]=r,s=(await B1().catch(()=>[])).find((l)=>l.owner===o&&l.name===a);return s?{owner:s.owner,repo:s.name,branch:s.defaultBranch}:null}function V1(e){let t=e?E5(e):"",r=e?$u(e):"",o=null,a=null;async function i(k,T){if(!e)throw Error("No project is open in this session");let N=await fetch(`${t}${k}`,{credentials:"include",...T});if(N.status===403)await T5(N.clone());return N}let s=e?`${e.owner}/${e.repo}`:null;function l(k,T){return i(k,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(T)})}async function f(){return xe(await i("/project-info"),"Failed to load project")}let c=null;function d(){return c??=f().then((k)=>k.defaultBranch||"",()=>(c=null,"")),c}async function b(k){return(await xe(await i(`/file?path=${encodeURIComponent(k)}`),`Failed to read file: ${k}`)).content}let y=O1({async fetchBatch(k){let T=await l("/files/read",{paths:k});if(T.status===404||T.status===405)return"unsupported";if(T.status===403&&await C5(T))return"unsupported";if(!T.ok)return"retry-singly";let N;try{N=await ke(T)}catch{return"unsupported"}if(!S5(N))return"unsupported";return N},fetchOne:b}),x=null;async function S(){let k;try{x??=y.read("package.json").finally(()=>{x=null}),k=await x}catch{return{}}try{let T=M1(k);return v(T)?T:{}}catch{return{}}}let P={};if(t)P.assetSpace="repo",P.documentBaseUrl=`${t}/raw/`;let j={id:"cloud",projectRoot:r,gitHosted:!0,canvasUrl:"/canvas.html",...P,openProjectPicker:"repo-list",createDestination:"repo",async activate(){if(!e)return;let k=await l("/activate",{});if(!k.ok)throw await Tu(k,"Failed to open the project session")},async openProject(){if(!e)return null;let k=await f(),T=k.projectConfig??{};return{config:T,handle:{root:r,name:T.name||k.name,projectConfig:T}}},async probeRootProject(){if(!e)return null;try{let k=await f();return{meta:{root:r,name:k.name},info:{isSiteProject:k.projectConfig!==null,projectConfig:k.projectConfig??null}}}catch{return null}},async listDirectory(k){return xe(await i(`/files?dir=${encodeURIComponent(k)}`),`Failed to list directory: ${k}`)},async readFile(k){return y.read(k)},async readFileBytes(k){let T=await i(`/file/bytes?path=${encodeURIComponent(k)}`);if(!T.ok)throw Error(await on(T,`Failed to read file bytes: ${k}`));return T.arrayBuffer()},async writeFile(k,T){let N=await i("/file",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:k,content:T})});if(!N.ok)throw Error(await on(N,`Failed to write file: ${k}`))},async uploadFile(k,T){let N=await i(`/file/upload?path=${encodeURIComponent(k)}`,{method:"POST",body:T}),O=await xe(N,`Upload failed: ${k}`),D={path:O.path??k};if(O.size!==void 0)D.size=O.size;return D},async deleteFile(k){let T=await i(`/file?path=${encodeURIComponent(k)}`,{method:"DELETE"});if(!T.ok&&T.status!==404)throw Error(await on(T,`Failed to delete file: ${k}`))},async renameFile(k,T){return xe(await l("/file/rename",{from:k,to:T}),`Failed to rename: ${k} → ${T}`)},async findReferences(k){let T=new URLSearchParams;if(k.path)T.set("path",k.path);if(k.tagName)T.set("tag",k.tagName);return xe(await i(`/references?${T.toString()}`),`Failed to find references: ${k.path??k.tagName??""}`)},async createDirectory(k){},async collab(k){if(!e||typeof WebSocket>"u"||typeof location>"u")return null;a??=i("/collab").then(async(D)=>D.ok?LS(await ke(D)):{offer:[],refused:null}).catch(()=>({offer:[],refused:null}));let T=await a;if(T.refused!==null)return console.warn(`Collaboration unavailable: ${T.refused}`),null;let{offer:N}=T;return o??=(async()=>{let{createWsCollabConnection:D}=await (ce("arz2qsy9"),import("./chunks/ws-client-arz2qsy9.js")),M=location.protocol==="https:"?"wss":"ws";return D({hydratePath:async(V)=>y.read(V).then(()=>{},()=>{}),protocols:N,url:`${M}://${location.host}${t}/collab`})})(),(await o).openDoc(k)},subscribeFileEvents(k,T){if(!e||typeof WebSocket>"u"||typeof location>"u")return()=>{};let N=null,O=!1,D=!1,M=()=>{let F=location.protocol==="https:"?"wss":"ws",B=new WebSocket(`${F}://${location.host}${t}/events`);N=B,B.addEventListener("message",(L)=>{let U;try{U=JSON.parse(L.data)}catch{return}if(U.kind==="fs"&&U.events?.length)k(U.events);else if(U.kind==="git"&&U.event==="committed")T?.onResync?.("commit")}),B.addEventListener("open",()=>{V.opened(),T?.onResync?.(D?"reconnect":"open"),D=!0}),B.addEventListener("close",()=>{if(!O)V.scheduleRetry()})},V=Qy(M);return M(),()=>{O=!0,V.dispose(),N?.close()}},async listFormats(){try{let k=await i("/formats");if(!k.ok)return[];return(await ke(k)).formats??[]}catch{return[]}},async listExtensions(){try{let k=await i("/formats");if(!k.ok)return[];return(await ke(k)).extensions??[]}catch{return[]}},async listExtensionCatalog(){try{let k=await i("/catalog");if(!k.ok)return[];let T=await ke(k),N=await S(),O=new Set([...Object.keys(ku(N,"dependencies")),...Object.keys(ku(N,"devDependencies"))]);for(let D of T)D.installed=O.has(D.name);return T}catch{return[]}},async fetchProjectSchemas(){try{let k=await i("/project-schemas");if(!k.ok)return{};return await ke(k)}catch{return{}}},async formatAction(k){let T=await l("/format",k);if(!T.ok)throw Error(await on(T,"This cloud session cannot run format actions yet (the backend serves no format route)"));return(await ke(T)).result},async discoverComponents(){let k=new Set(["node_modules","dist",".git",".claude",".obsidian","build"]),T=400,N=6,O=[],D=async(V,F)=>{if(F>6||O.length>=400)return;let B;try{B=await j.listDirectory(V)}catch{return}let L=[];for(let U of B)if(U.type==="directory"){if(!k.has(U.name)&&!U.name.startsWith("."))L.push(U.path)}else if(U.name.endsWith(".json")&&O.length<400)O.push(U.path);await Promise.all(L.map(async(U)=>D(U,F+1)))};return await D("",0),(await Promise.all(O.map(async(V)=>{try{return PC(M1(await j.readFile(V)),V)}catch{return null}}))).filter((V)=>V!==null)},async codeService(){return null},async fetchPluginSchema(){return null},async addPackage(k){let T=await i("/packages/add",{body:JSON.stringify({name:k}),headers:{"Content-Type":"application/json"},method:"POST"});if(!T.ok)throw Error(await on(T,`Failed to add ${k}`))},async removePackage(k){let T=await i("/packages/remove",{body:JSON.stringify({name:k}),headers:{"Content-Type":"application/json"},method:"POST"});if(!T.ok)throw Error(await on(T,`Failed to remove ${k}`))},async setPackageVersions(k){let T=await i("/packages/set-versions",{body:JSON.stringify({updates:k}),headers:{"Content-Type":"application/json"},method:"POST"});if(!T.ok)return{log:await on(T,"Failed to update versions"),ok:!1};return ke(T)},async packageVersions(){let k=await i("/packages/versions");return k.ok?ke(k):[]},async listPackages(){let k=await S(),T=[],N=ku(k,"dependencies");for(let[D,M]of Object.entries(N))T.push({name:D,version:M});let O=ku(k,"devDependencies");for(let[D,M]of Object.entries(O))T.push({name:D,version:M,dev:!0});return T},async resolveSiteContext(k){try{let N=(await f()).projectConfig??void 0,O={sitePath:r};if(N!==void 0)O.projectConfig=N;if(k!==r)O.fileRelPath=k;return O}catch{return{sitePath:null}}},async locateFile(k){try{let T=await i(`/locate?name=${encodeURIComponent(k)}`);if(T.ok)return(await ke(T)).path??null}catch{}return null},async searchFiles(k,T=[]){let N=["json",...T.map((D)=>D.replace(/^\./,""))],O=await i(`/search?query=${encodeURIComponent(k)}&extensions=${encodeURIComponent(N.join(","))}`);if(!O.ok)return[];return await ke(O)},async gitStatus(){return xe(await i("/git/status"),"Failed to read git status")},async gitBranches(){let k=await xe(await i("/git/branches"),"Failed to list branches");if(k.defaultBranch)return k;let T=await d();return T?{...k,defaultBranch:T}:k},async gitLog(k){let T=k?`?limit=${k}`:"";return xe(await i(`/git/log${T}`),"Failed to read git log")},async gitStage(k){await xe(await l("/git/stage",{files:k}),"Failed to stage files")},async gitUnstage(k){await xe(await l("/git/unstage",{files:k}),"Failed to unstage files")},async gitCommit(k){await xe(await l("/git/commit",{message:k}),"Commit failed")},async gitPush(){await xe(await l("/git/push",{}),"Push failed")},async gitPull(){await xe(await l("/git/pull",{}),"Pull failed")},async gitFetch(){await xe(await l("/git/fetch",{}),"Fetch failed")},async gitCheckout(k){if(e&&typeof location<"u")location.assign(kv({...e,branch:k}))},async gitCreateBranch(k){await xe(await l("/git/create-branch",{name:k}),"Failed to create branch")},async gitCommitBranch(k){return xe(await l("/git/commit-branch",{branch:k.branch,message:k.message}),`Could not publish to ${k.branch}`)},async gitDiff(k){return(await xe(await i(`/git/diff?path=${encodeURIComponent(k??"")}`),"Failed to compute diff")).diff},async gitShow(k){let T=new URLSearchParams({path:k.path});if(k.ref)T.set("ref",k.ref);return(await xe(await i(`/git/show?${T}`),`Failed to read ${k.path} at ref`)).content},async gitDiscard(k){await xe(await l("/git/discard",{files:k}),"Failed to discard changes")},async gitInit(){},async gitAddRemote(){},async buildSite(){return xe(await i("/build",{method:"POST"}),"The site could not be previewed.")},async listProjects(){return(await B1()).map((T)=>({name:T.fullName,root:$u({owner:T.owner,repo:T.name,branch:T.defaultBranch}),description:`${T.defaultBranch} · ${T.permission}`}))},async listStarters(){let k=await fetch("/api/v1/starters",{credentials:"include"});if(!k.ok)return[];return await ke(k)},async setWindowProject(k){let T=await D1(k);if(!T)throw Error(`No project to open at ${k}`);if(typeof location<"u")location.assign(kv(T));return{deduped:!0,config:null}},async openProjectInNewWindow(k){let T=await D1(k);if(!T)throw Error(`No project to open at ${k}`);if(typeof window<"u")window.open(kv(T),"_blank","noopener");return{focused:!1}},async createProject(k){let{destination:T}=k;if(T.kind!=="repo"||!T.owner||!T.repo)throw Error("A destination repository is required.");let N=await fetch("/api/v1/projects",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:k.name,description:k.description,starter:k.starter,owner:T.owner,repo:T.repo,private:T.private})});if(!N.ok)throw await Tu(N,"Failed to create project");let O=await ke(N);return{root:$u({owner:O.owner,repo:O.name,branch:O.defaultBranch}),config:{name:k.name}}},async importSite(k,T,N,O){return await xu("/api/v1/import/site",k,T,N,O)},async getUser(){let k=await fetch("/api/v1/me",{credentials:"include"});if(!k.ok)return null;let T=await ke(k);if(!T.user)return null;let N={login:T.user.login};if(T.user.name)N.name=T.user.name;if(T.user.avatar_url)N.avatarUrl=T.user.avatar_url;return N},async listRepos(){let k=await fetch("/api/v1/repos",{credentials:"include"});if(!k.ok)throw Error(await on(k,"Failed to list repositories"));return(await ke(k)).map((N)=>({owner:N.owner,name:N.name,fullName:N.fullName,private:N.private,defaultBranch:N.defaultBranch,permission:N.permission,isJxProject:N.isJxProject}))},async listRepoProjects(k){let T=await fetch(`/api/v1/repos/${encodeURIComponent(k.owner)}/${encodeURIComponent(k.name)}/projects`,{credentials:"include"}),N=await xe(T,"Failed to look for projects"),O=[];for(let D of N.locations){let M=Bl(D.dir);if(M!==null)O.push(D.name?{dir:M,name:D.name}:{dir:M})}return{branch:N.branch,locations:O,truncated:N.truncated===!0}},async importProject(k){let T=Bl(k.dir??"");if(T===null)throw Error("The project folder must stay inside the repository.");let N={owner:k.owner,name:k.name};if(T)N.dir=T;let O=await fetch("/api/v1/projects/import",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify(N)}),D=await xe(O,"Failed to import repository"),M={owner:D.owner,repo:D.name,branch:D.defaultBranch};if(T)M.dir=T;return{root:$u(M)}},async getAccountStatus(){let k=await fetch("/api/v1/me",{credentials:"include"});if(!k.ok)return null;let T=await ke(k),N=j5(T.entries),O=R5(T.notices),D={installations:(T.installations??[]).map((M)=>{let V={id:M.id,account:M.account};if(M.manageUrl)V.manageUrl=M.manageUrl;return V})};if(T.appInstallUrl)D.appInstallUrl=T.appInstallUrl;if(N.length>0)D.entries=N;if(O.length>0)D.notices=O;return D},performAction(k){if(typeof window>"u"||typeof location>"u"||!k.href)return Promise.resolve(null);let T=Cu;if(T){try{T.popup?.focus()}catch{}return T.promise}let N=window.open(k.href,"jx-action","width=980,height=820");if(!N)return location.assign(k.href),Promise.resolve({status:"redirect"});let O={popup:N,promise:Promise.resolve(null)};return Cu=O,O.promise=L5(N).finally(()=>{if(Cu===O)Cu=null}),O.promise},async createPullRequest(k){return xe(await l("/git/pr",k),"Failed to open pull request")},async cfConnection(){return ul()},cfConnect(){if(typeof window>"u"||typeof location>"u")return Promise.resolve(null);let k=Su;if(k){try{k.popup?.focus()}catch{}return k.promise}let T={popup:null,promise:Promise.resolve(null)};Su=T;let N=s?`/api/v1/cf/connect?project=${encodeURIComponent(s)}`:"/api/v1/cf/connect";return T.promise=N5(T,N).finally(()=>{if(Su===T)Su=null}),T.promise},async cfAccounts(){let k=await fetch("/api/v1/cf/accounts",{credentials:"include"});return xe(k,"Failed to list Cloudflare accounts")},async cfSelectAccount(k){let T=await fetch("/api/v1/cf/select-account",{body:JSON.stringify({accountId:k.id,accountName:k.name}),credentials:"include",headers:{"Content-Type":"application/json"},method:"POST"});if(!T.ok)throw Error(await on(T,"Failed to select a Cloudflare account"))},async cfDisconnect(){let k=await fetch("/api/v1/cf/connection",{credentials:"include",method:"DELETE"});if(!k.ok)throw Error(await on(k,"Failed to disconnect Cloudflare"))},async cfApi(k,T){let N={};if(s)N["X-Jx-Project"]=s;if(T?.body!==void 0)N["Content-Type"]="application/json";let O={method:T?.method??"GET",credentials:"include"};if(Object.keys(N).length>0)O.headers=N;if(T?.body!==void 0)O.body=JSON.stringify(T.body);let D=await fetch(`/api/v1/cf/proxy${k}`,O);if(D.status===403){let V=await ke(D.clone()).catch(()=>null);if(_1(V))throw await Tu(D,"Publishing was refused")}let M=await ke(D);if(!D.ok||M.success===!1){let V=M.errors?.map((F)=>F.message).join("; ")??M.error??D.statusText;throw Error(`Cloudflare API: ${V}`)}return M.result??M},aiChatUrl(){return s?`/api/v1/ai/chat?project=${encodeURIComponent(s)}`:"/api/v1/ai/chat"}};return j}async function re(e){return await e.json()}function W1(){let e="",t=null,r=null,o=null;async function a(c){if(!c)return;let d=await fetch("/__studio/activate",{body:JSON.stringify({root:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!d.ok){let b=await re(d).catch(()=>({}));throw Error(`Could not open ${c}: ${tr(b)??`activation failed (${d.status})`}`)}}function i(){if(!e)return;t=a(e).catch((c)=>{console.error("Project re-activation failed:",c)})}if(typeof window<"u")window.addEventListener("focus",i);function s(c){let d=c.replaceAll("\\","/");if(!e)return d;if(d===".")return e;return`${e}/${d}`}function l(c,d={}){let b=new URLSearchParams(d);if(e)b.set("dir",s("."));let y=b.toString();return`/__studio/git/${c}${y?`?${y}`:""}`}function f(c){let d=c.replaceAll("\\","/");if(!e)return d;return d.startsWith(`${e}/`)?d.slice(e.length+1):d}return{id:"devserver",createDestination:"path",get projectRoot(){return e},set projectRoot(c){if(e=c||"",e)t=this.activate(e).catch((d)=>{console.error("Project activation failed:",d)})},async activate(c){await a(c??e)},async probeRootProject(){try{let[c,d]=await Promise.all([fetch("/__studio/project"),fetch("/__studio/project-info?dir=.")]),b=c.ok?await re(c):{name:"project",root:"."};return{info:d.ok?await re(d):{isSiteProject:!1},meta:b}}catch{return null}},async createProject(c){let d=await fetch("/__studio/create-project",{body:JSON.stringify(c),headers:{"Content-Type":"application/json"},method:"POST"});if(!d.ok){let b=await re(d);throw Error(tr(b)??"Failed to create project")}return await d.json()},async listStarters(){let c=await fetch("/__studio/starters");if(!c.ok)throw Error("Failed to load starters");return await re(c)},async importSite(c,d,b,y){return await xu("/__studio/import-site",c,d,b,y)},async listDirectory(c){let d=await fetch(`/__studio/files?dir=${encodeURIComponent(s(c))}`);if(!d.ok)throw Error(`Failed to list directory: ${c}`);let b=await re(d);for(let y of b)y.path=f(y.path);return b},async readFile(c){let d=await fetch(`/__studio/file?path=${encodeURIComponent(s(c))}&optional=1`);if(!d.ok)throw Error(`Failed to read file: ${c}`);let b=await re(d);if(b.content===null)throw Error(`Failed to read file: ${c} (not found)`);return b.content},async readFileBytes(c){let d=await fetch(`/__studio/file/bytes?path=${encodeURIComponent(s(c))}`);if(!d.ok)throw Error(`Failed to read file bytes: ${c}`);return d.arrayBuffer()},async writeFile(c,d){if(!(await fetch(`/__studio/file?path=${encodeURIComponent(s(c))}`,{body:d,method:"PUT"})).ok)throw Error(`Failed to write file: ${c}`)},async uploadFile(c,d){let b=await fetch(`/__studio/file/upload?path=${encodeURIComponent(s(c))}`,{body:d,method:"POST"});if(!b.ok)throw Error(`Upload failed: ${c}`);let y=await re(b),x={path:y.path??c};if(y.size!==void 0)x.size=y.size;return x},async deleteFile(c){let d=await fetch(`/__studio/file?path=${encodeURIComponent(s(c))}`,{method:"DELETE"});if(!d.ok&&d.status!==404)throw Error(`Failed to delete file: ${c}`)},async renameFile(c,d){let b=await fetch("/__studio/file/rename",{body:JSON.stringify({from:s(c),to:s(d)}),headers:{"Content-Type":"application/json"},method:"POST"});if(!b.ok)throw Error(`Failed to rename: ${c} → ${d}`);return re(b)},async findReferences(c){await t;let d=new URLSearchParams;if(c.path)d.set("path",s(c.path));if(c.tagName)d.set("tag",c.tagName);let b=await fetch(`/__studio/references?${d.toString()}`);if(!b.ok)throw Error(`Failed to find references: ${c.path??c.tagName??""}`);return re(b)},subscribeFileEvents(c,d){if(typeof EventSource>"u")return()=>{};let b=new EventSource("/__reload"),y=0;return b.addEventListener("open",()=>{if(y+=1,y>1)i(),d?.onResync?.("reconnect")}),b.addEventListener("fs",(x)=>{let S;try{S=JSON.parse(x.data)}catch{return}let P=[];for(let j of S.events??[]){let k=j.path.replaceAll("\\","/");if(e&&k!==e&&!k.startsWith(`${e}/`))continue;let T=f(k);if(T&&!T.startsWith(".."))P.push({isDir:j.isDir,path:T,type:j.type})}if(P.length>0)c(P)}),()=>{b.close()}},async collab(c){if(typeof WebSocket>"u"||typeof location>"u")return null;if(r===null)r=fetch("/__studio/collab").then(async(x)=>x.ok?LS(await re(x)):null).catch(()=>null);let d=await r;if(d===null)return null;if(d.refused!==null)return console.warn(`Collaboration unavailable: ${d.refused}`),null;let{offer:b}=d;return o??=(async()=>{let{createWsCollabConnection:x}=await (ce("arz2qsy9"),import("./chunks/ws-client-arz2qsy9.js")),S=location.protocol==="https:"?"wss":"ws";return x({protocols:b,url:`${S}://${location.host}/__studio/collab`})})(),(await o).openDoc(s(c))},async createDirectory(c){},async discoverComponents(c){let d=c||e;if(!d)return[];let b=`/__studio/components?dir=${encodeURIComponent(d)}`,y=await fetch(b);if(!y.ok)return[];return await y.json()},async addPackage(c){let d=await fetch("/__studio/packages/add",{body:JSON.stringify({name:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!d.ok)throw Error(await d.text());return await d.json()},async removePackage(c){let d=await fetch("/__studio/packages/remove",{body:JSON.stringify({name:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!d.ok)throw Error(await d.text());return await d.json()},async listPackages(){let c=await fetch("/__studio/packages");if(!c.ok)return[];return await c.json()},async installDependencies(){let c=await fetch("/__studio/packages/install",{method:"POST"});if(!c.ok)return{log:await c.text(),ok:!1};return await c.json()},async dependenciesNeedInstall(){let c=await fetch("/__studio/packages/needs-install");if(!c.ok)return!1;let d=await re(c);return Boolean(d.needsInstall)},async packageVersions(){let c=await fetch("/__studio/packages/versions");if(!c.ok)return[];return await c.json()},async setPackageVersions(c){let d=await fetch("/__studio/packages/set-versions",{body:JSON.stringify({updates:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!d.ok)return{log:await d.text(),ok:!1};return await d.json()},async codeService(c,d){try{let b=await fetch(`/__studio/code/${c}`,{body:JSON.stringify(d),headers:{"Content-Type":"application/json"},method:"POST"});if(!b.ok)return null;return await b.json()}catch{return null}},async resolveSiteContext(c){let d=await fetch(`/__studio/resolve-site?path=${encodeURIComponent(c)}`);if(!d.ok)return{sitePath:null};return await d.json()},async locateFile(c){try{let d=await fetch("/__studio/locate",{body:JSON.stringify({name:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(d.ok)return(await re(d)).path||null}catch{}return null},async searchFiles(c,d=[]){let b=["json",...d.map((P)=>P.replace(/^\./,""))],y=`**/*${c}*.{${b.join(",")}}`,x=await fetch(`/__studio/files?dir=${encodeURIComponent(s("."))}&glob=${encodeURIComponent(y)}`);if(!x.ok)return[];let S=await re(x);for(let P of S)P.path=f(P.path);return S},async listFormats(){let c=await fetch(`/__studio/formats?dir=${encodeURIComponent(s("."))}`);if(!c.ok)return[];return(await re(c)).formats??[]},async listExtensions(){let c=await fetch(`/__studio/formats?dir=${encodeURIComponent(s("."))}`);if(!c.ok)return[];return(await re(c)).extensions??[]},async listExtensionCatalog(){let c=await fetch(`/__studio/catalog?dir=${encodeURIComponent(s("."))}`);return c.ok?await re(c):[]},async fetchProjectSchemas(){let c=await fetch(`/__studio/project-schemas?dir=${encodeURIComponent(s("."))}`);if(!c.ok)return{};return await re(c)},async dataConnections(){let c=await fetch(`/__studio/data/connections?dir=${encodeURIComponent(s("."))}`);if(!c.ok){let d=await re(c);throw Error(tr(d)??"Failed to list connections")}return await re(c)},async dataConnectionTest(c){let d=await fetch(`/__studio/data/connections/test?dir=${encodeURIComponent(s("."))}`,{body:JSON.stringify({connection:c}),headers:{"Content-Type":"application/json"},method:"POST"}),b=await re(d);if(!d.ok)throw Error(tr(b)??"Connection test failed");return b},async dataPush(c){let d=await fetch(`/__studio/data/push?dir=${encodeURIComponent(s("."))}`,{body:JSON.stringify(c??{}),headers:{"Content-Type":"application/json"},method:"POST"}),b=await re(d);if(!d.ok)throw Error(tr(b)??"Schema push failed");return b},async dataRows(c){let d=new URLSearchParams({dir:s("."),table:c.table});if(c.connection)d.set("connection",c.connection);if(c.limit!==void 0)d.set("limit",String(c.limit));if(c.offset!==void 0)d.set("offset",String(c.offset));if(c.orderBy!==void 0)d.set("orderBy",c.orderBy);if(c.dir!==void 0)d.set("dir",c.dir);let b=await fetch(`/__studio/data/rows?${d}`),y=await re(b);if(!b.ok)throw Error(tr(y)??"Failed to load rows");return y},async dataInsertRow(c){let d=await fetch(`/__studio/data/rows?dir=${encodeURIComponent(s("."))}`,{body:JSON.stringify(c),headers:{"Content-Type":"application/json"},method:"POST"}),b=await re(d);if(!d.ok)throw Error(tr(b)??"Insert failed");return b},async dataUpdateRow(c){let d=await fetch(`/__studio/data/rows?dir=${encodeURIComponent(s("."))}`,{body:JSON.stringify(c),headers:{"Content-Type":"application/json"},method:"PUT"}),b=await re(d);if(!d.ok)throw Error(tr(b)??"Update failed");return b},async dataDeleteRow(c){let d=new URLSearchParams({dir:s("."),pk:String(c.pk),table:c.table});if(c.connection)d.set("connection",c.connection);let b=await fetch(`/__studio/data/rows?${d}`,{method:"DELETE"}),y=await re(b);if(!b.ok)throw Error(tr(y)??"Delete failed");return y},async listSecrets(){let c=await fetch(`/__studio/secrets?dir=${encodeURIComponent(s("."))}`);if(!c.ok){let b=await re(c);throw Error(tr(b)??"Failed to list secrets")}return(await re(c)).names},async setSecrets(c){let d=await fetch(`/__studio/secrets?dir=${encodeURIComponent(s("."))}`,{body:JSON.stringify(c),headers:{"Content-Type":"application/json"},method:"PUT"}),b=await re(d);if(!d.ok)throw Error(tr(b)??"Failed to write secrets");return b},async formatAction(c){let d=await fetch("/__studio/format",{body:JSON.stringify({...c,dir:s(".")}),headers:{"Content-Type":"application/json"},method:"POST"}),b=await re(d);if(!d.ok)throw Error(tr(b)??"Format action failed");return b.result},async fetchPluginSchema(c,d,b){let y=new URLSearchParams({src:c});if(d)y.set("prototype",d);if(b)y.set("base",b);let x=await fetch(`/__studio/plugin-schema?${y}`);if(!x.ok)return null;let{schema:S}=await re(x);return S},async resolveClass(c){let d=await fetch("/__jx_resolve__",{body:JSON.stringify(c),headers:{"content-type":"application/json"},method:"POST"});if(!d.ok)throw Error(`Class resolution failed: ${d.status}`);return await re(d)},async gitStatus(){let c=await fetch(l("status"));if(!c.ok)throw Error(await c.text());return await c.json()},async gitBranches(){let c=await fetch(l("branches"));if(!c.ok)throw Error(await c.text());return await c.json()},async gitLog(c){let d=await fetch(l("log",c?{limit:String(c)}:{}));if(!d.ok)throw Error(await d.text());return await d.json()},async gitStage(c){let d=await fetch(l("stage"),{body:JSON.stringify({files:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!d.ok){let b=await re(d);throw Error(ll(b))}return await d.json()},async gitUnstage(c){let d=await fetch(l("unstage"),{body:JSON.stringify({files:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!d.ok){let b=await re(d);throw Error(ll(b))}return await d.json()},async gitCommit(c){let d=await fetch(l("commit"),{body:JSON.stringify({message:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!d.ok){let b=await re(d);throw Error(ll(b))}return await d.json()},async gitPush(c){let d=await fetch(l("push"),{body:JSON.stringify(c||{}),headers:{"Content-Type":"application/json"},method:"POST"});if(!d.ok){let b=await re(d);throw Error(ll(b))}return await d.json()},async gitPull(){let c=await fetch(l("pull"),{method:"POST"});if(!c.ok){let d=await re(c);throw Error(ll(d))}return await c.json()},async gitFetch(){let c=await fetch(l("fetch"),{method:"POST"});if(!c.ok){let d=await re(c);throw Error(ll(d))}return await c.json()},async gitCheckout(c){let d=await fetch(l("checkout"),{body:JSON.stringify({branch:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!d.ok){let b=await re(d);throw Error(ll(b))}return await d.json()},async gitCreateBranch(c){let d=await fetch(l("create-branch"),{body:JSON.stringify({name:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!d.ok){let b=await re(d);throw Error(ll(b))}return await d.json()},async gitDiff(c){let d=await fetch(l("diff",{path:c??""}));if(!d.ok)throw Error(await d.text());return await d.json()},async gitShow(c){let d=await fetch(l("show",c.ref?{path:c.path,ref:c.ref}:{path:c.path}));if(!d.ok)throw Error(await d.text());return(await re(d)).content},async gitDiscard(c){let d=await fetch(l("discard"),{body:JSON.stringify({files:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!d.ok){let b=await re(d);throw Error(ll(b))}return await d.json()},async gitClone(c){let d=await fetch(l("clone"),{body:JSON.stringify({url:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!d.ok){let b=await re(d);throw Error(ll(b))}return await d.json()},async gitInit(){let c=await fetch(l("init"),{method:"POST"});if(!c.ok){let d=await re(c);throw Error(ll(d))}},async buildSite(){let c=await fetch("/__studio/build",{method:"POST"});if(!c.ok){let d=await re(c);throw Error(tr(d)??"The site could not be built.")}return await re(c)},async previewSite(c){let d=await fetch("/__studio/preview",{body:JSON.stringify(c),headers:{"Content-Type":"application/json"},method:"POST"});if(!d.ok){let b=await re(d);throw Error(tr(b)??"The site could not be previewed.")}return await re(d)},async setPreviewOverlay(c,d){await fetch("/__studio/preview/overlay",{body:JSON.stringify({contents:d,path:c}),headers:{"Content-Type":"application/json"},method:"POST"})},async clearPreviewOverlay(c){await fetch("/__studio/preview/overlay",{body:JSON.stringify(c===void 0?{}:{path:c}),headers:{"Content-Type":"application/json"},method:"DELETE"})},async gitAddRemote(c,d){let b=await fetch(l("add-remote"),{body:JSON.stringify({name:c,url:d}),headers:{"Content-Type":"application/json"},method:"POST"});if(!b.ok){let y=await re(b);throw Error(ll(y))}},async cfApi(c,d){let{getCfToken:b}=await (ce("mkbcz4z2"),import("./chunks/cf-settings-mkbcz4z2.js")),y=b();if(!y)throw Error("No Cloudflare API token configured");let x=await fetch("/__studio/cf/proxy",{method:"POST",headers:{"Content-Type":"application/json","X-CF-Token":y},body:JSON.stringify({path:c,method:d?.method??"GET",body:d?.body})}),S=await re(x);if(!x.ok||S.success===!1){let P=S.errors?.map((j)=>j.message).join("; ")??S.error??x.statusText;throw Error(`Cloudflare API: ${P}`)}return S.result??S},async cfConnection(){let{getCfAccountId:c,getCfToken:d,setCfAccountId:b}=await (ce("mkbcz4z2"),import("./chunks/cf-settings-mkbcz4z2.js"));if(!d())return null;try{let y=await this.cfApi("/accounts");if(!Array.isArray(y)||y.length===0)return{connected:!1};let x=y,S=x.find((P)=>P.id===c())??x[0];return b(S.id),{connected:!0,accountId:S.id,accountName:S.name}}catch{return{connected:!1}}},async listProjects(){let c=await fetch("/__studio/sites");if(!c.ok)return[];return(await re(c)).map((b)=>({name:b.config?.name||b.path.split("/").at(-1)||b.path,root:b.path,description:b.path}))},aiChatUrl(){return"/__studio/ai/chat"}}}var M5=new Set(["views:","file:"]);function D5(){let e=typeof document>"u"?void 0:document,t=`meta[name="${xv.name}"][content="${xv.content}"]`;return{cloud:globalThis.__jxCloud!=null,declared:e?.querySelector(t)!=null,launcher:Av(),protocol:typeof location>"u"?"":location.protocol}}function F5(e=D5()){if(e.launcher)return{kind:"launcher",launcher:e.launcher.launcher};if(e.cloud)return null;if(e.declared)return{kind:"declared"};if(M5.has(e.protocol))return{kind:"scheme",protocol:e.protocol};return null}function _5(e){switch(e.kind){case"launcher":return`Jx Studio's launcher (${e.launcher??"unnamed"}) announced itself but registered no platform adapter.`;case"declared":return"Jx Studio's page declares a boot module, but nothing registered a platform adapter.";default:return`Jx Studio was opened from a ${e.protocol} URL, which has no backend for the dev-server adapter.`}}class Eu extends Error{refusal;constructor(e){super(_5(e));this.name="PlatformUnavailableError",this.refusal=e}}function q1(){let e=F5();if(e)throw new Eu(e);let t=globalThis.__jxCloud;return t?V1(t.project):W1()}function z5(e){return _(e)&&"getFrame"in e&&Q(e.getFrame)}function H5(){let e=globalThis.__jxPlatform;if(e==null||!("windowControls"in e))return;let t=e.windowControls;return z5(t)?t:void 0}var B5=["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],U1=400,J1=300,G1=!1;function K1(){let e=H5();if(!e||G1)return;G1=!0;let t=document.createElement("div");t.id="resize-edges";for(let r of B5){let o=document.createElement("div");o.className=`resize-edge ${r}`,o.addEventListener("mousedown",(a)=>V5(a,r,e)),t.append(o)}document.body.append(t)}async function V5(e,t,r){e.preventDefault(),e.stopPropagation();let{screenX:o,screenY:a}=e,s={...await r.getFrame()};function l(c){let d=c.screenX-o,b=c.screenY-a,{x:y,y:x,width:S,height:P}=s;if(t.includes("right"))S=Math.max(U1,S+d);if(t.includes("left")){let j=Math.max(U1,S-d);y+=S-j,S=j}if(t.includes("bottom"))P=Math.max(J1,P+b);if(t.includes("top")){let j=Math.max(J1,P-b);x+=P-j,P=j}r.setFrame(y,x,S,P)}function f(){document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",f)}document.addEventListener("mousemove",l),document.addEventListener("mouseup",f)}var $v={allTags:["a","abbr","address","animate","animateMotion","animateTransform","annotation","annotation-xml","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","circle","cite","clipPath","code","col","colgroup","data","datalist","dd","defs","del","desc","details","dfn","dialog","div","dl","dt","ellipse","em","embed","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","fencedframe","fieldset","figcaption","figure","filter","footer","foreignObject","form","g","geolocation","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","image","img","input","ins","kbd","label","legend","li","line","linearGradient","link","maction","main","map","mark","marker","mask","math","menu","merror","meta","metadata","meter","mfrac","mi","mmultiscripts","mn","mo","model","mover","mpadded","mpath","mphantom","mprescripts","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msubsup","msup","mtable","mtd","mtext","mtr","munder","munderover","nav","noscript","object","ol","optgroup","option","output","p","path","pattern","picture","polygon","polyline","portal","pre","progress","q","radialGradient","rb","rect","rp","rt","rtc","ruby","s","samp","script","search","section","select","selectedcontent","semantics","set","slot","small","source","span","stop","strong","style","sub","summary","sup","svg","switch","symbol","table","tbody","td","template","text","textPath","textarea","tfoot","th","thead","time","title","tr","track","tspan","u","ul","use","var","video","view","wbr"],cssProps:[["accentColor","auto"],["alignContent","normal"],["alignItems","normal"],["alignmentBaseline","baseline"],["alignSelf","auto"],["all","see individual properties"],["anchorName","none"],["anchorScope","none"],["animation","see individual properties"],["animationComposition","replace"],["animationDelay","0s"],["animationDirection","normal"],["animationDuration","auto"],["animationFillMode","none"],["animationIterationCount","1"],["animationName","none"],["animationPlayState","running"],["animationRange","see individual properties"],["animationRangeCenter","normal"],["animationRangeEnd","normal"],["animationRangeStart","normal"],["animationTimeline","auto"],["animationTimingFunction","ease"],["animationTrigger","none"],["appearance","none"],["aspectRatio","auto"],["backdropFilter","none"],["backfaceVisibility","visible"],["background","see individual properties"],["backgroundAttachment","scroll"],["backgroundBlendMode","normal"],["backgroundClip","border-box"],["backgroundColor","transparent"],["backgroundImage","none"],["backgroundOrigin","padding-box"],["backgroundPosition","0% 0%"],["backgroundPositionBlock","0%"],["backgroundPositionInline","0%"],["backgroundPositionX","0%"],["backgroundPositionY","0%"],["backgroundRepeat","repeat"],["backgroundRepeatBlock","repeat"],["backgroundRepeatInline","repeat"],["backgroundRepeatX","repeat"],["backgroundRepeatY","repeat"],["backgroundSize","auto"],["backgroundTbd","see individual properties"],["baselineShift","0"],["baselineSource","auto"],["blockEllipsis","no-ellipsis"],["blockSize","auto"],["blockStep","see individual properties"],["blockStepAlign","auto"],["blockStepInsert","margin-box"],["blockStepRound","up"],["blockStepSize","none"],["bookmarkLabel","content(text)"],["bookmarkLevel","none"],["bookmarkState","open"],["border","see individual properties"],["borderBlock","see individual properties"],["borderBlockClip","see individual properties"],["borderBlockColor","see individual properties"],["borderBlockEnd","See individual properties"],["borderBlockEndClip","none"],["borderBlockEndColor","currentcolor"],["borderBlockEndRadius","0"],["borderBlockEndStyle","none"],["borderBlockEndWidth","medium"],["borderBlockStart","See individual properties"],["borderBlockStartClip","none"],["borderBlockStartColor","currentcolor"],["borderBlockStartRadius","0"],["borderBlockStartStyle","none"],["borderBlockStartWidth","medium"],["borderBlockStyle","see individual properties"],["borderBlockWidth","see individual properties"],["borderBottom","See individual properties"],["borderBottomClip","none"],["borderBottomColor","currentcolor"],["borderBottomLeftRadius","0"],["borderBottomRadius","0"],["borderBottomRightRadius","0"],["borderBottomStyle","none"],["borderBottomWidth","medium"],["borderBoundary","none"],["borderClip","see individual properties"],["borderCollapse","separate"],["borderColor","see individual properties"],["borderEndEndRadius","0"],["borderEndStartRadius","0"],["borderImage","See individual properties"],["borderImageOutset","0"],["borderImageRepeat","stretch"],["borderImageSlice","100%"],["borderImageSource","none"],["borderImageWidth","1"],["borderInline","see individual properties"],["borderInlineClip","see individual properties"],["borderInlineColor","see individual properties"],["borderInlineEnd","See individual properties"],["borderInlineEndClip","none"],["borderInlineEndColor","currentcolor"],["borderInlineEndRadius","0"],["borderInlineEndStyle","none"],["borderInlineEndWidth","medium"],["borderInlineStart","See individual properties"],["borderInlineStartClip","none"],["borderInlineStartColor","currentcolor"],["borderInlineStartRadius","0"],["borderInlineStartStyle","none"],["borderInlineStartWidth","medium"],["borderInlineStyle","see individual properties"],["borderInlineWidth","see individual properties"],["borderLeft","See individual properties"],["borderLeftClip","none"],["borderLeftColor","currentcolor"],["borderLeftRadius","0"],["borderLeftStyle","none"],["borderLeftWidth","medium"],["borderLimit","all"],["borderRadius","see individual properties"],["borderRight","See individual properties"],["borderRightClip","none"],["borderRightColor","currentcolor"],["borderRightRadius","0"],["borderRightStyle","none"],["borderRightWidth","medium"],["borderShape","none"],["borderSpacing","0px 0px"],["borderStartEndRadius","0"],["borderStartStartRadius","0"],["borderStyle","see individual properties"],["borderTop","See individual properties"],["borderTopClip","none"],["borderTopColor","currentcolor"],["borderTopLeftRadius","0"],["borderTopRadius","0"],["borderTopRightRadius","0"],["borderTopStyle","none"],["borderTopWidth","medium"],["borderWidth","see individual properties"],["bottom","auto"],["boxDecorationBreak","slice"],["boxShadow","none"],["boxShadowBlur","0"],["boxShadowColor","currentcolor"],["boxShadowOffset","none"],["boxShadowPosition","outset"],["boxShadowSpread","0"],["boxSizing","content-box"],["boxSnap","none"],["breakAfter","auto"],["breakBefore","auto"],["breakInside","auto"],["captionSide","top"],["caret","auto"],["caretAnimation","auto"],["caretColor","auto"],["caretShape","auto"],["clear","none"],["clip","auto"],["clipPath","none"],["clipRule","nonzero"],["color","CanvasText"],["colorAdjust","see individual properties"],["colorInterpolation","sRGB"],["colorInterpolationFilters","linearRGB"],["colorScheme","normal"],["columnCount","auto"],["columnFill","balance"],["columnGap","normal"],["columnHeight","auto"],["columnRule","see individual properties"],["columnRuleBreak","normal"],["columnRuleColor","currentcolor"],["columnRuleInset","see individual properties"],["columnRuleInsetCap","see individual properties"],["columnRuleInsetCapEnd","0"],["columnRuleInsetCapStart","0"],["columnRuleInsetEnd","see individual properties"],["columnRuleInsetJunction","see individual properties"],["columnRuleInsetJunctionEnd","0"],["columnRuleInsetJunctionStart","0"],["columnRuleInsetStart","see individual properties"],["columnRuleStyle","none"],["columnRuleVisibilityItems","normal"],["columnRuleWidth","medium"],["columns","see individual properties"],["columnSpan","none"],["columnWidth","auto"],["columnWrap","auto"],["contain","none"],["container","see individual properties"],["containerName","none"],["containerType","normal"],["containIntrinsicBlockSize","none"],["containIntrinsicHeight","none"],["containIntrinsicInlineSize","none"],["containIntrinsicSize","see individual properties"],["containIntrinsicWidth","none"],["content","normal"],["contentVisibility","visible"],["continue","auto"],["copyInto","none"],["corner","0"],["cornerBlockEnd","0"],["cornerBlockEndShape","see individual properties"],["cornerBlockStart","0"],["cornerBlockStartShape","see individual properties"],["cornerBottom","0"],["cornerBottomLeft","0"],["cornerBottomLeftShape","round"],["cornerBottomRight","0"],["cornerBottomRightShape","round"],["cornerBottomShape","see individual properties"],["cornerEndEnd","0"],["cornerEndEndShape","round"],["cornerEndStart","0"],["cornerEndStartShape","round"],["cornerInlineEnd","0"],["cornerInlineEndShape","see individual properties"],["cornerInlineStart","0"],["cornerInlineStartShape","see individual properties"],["cornerLeft","0"],["cornerLeftShape","see individual properties"],["cornerRight","0"],["cornerRightShape","see individual properties"],["cornerShape","round"],["cornerStartEnd","0"],["cornerStartEndShape","round"],["cornerStartStart","0"],["cornerStartStartShape","round"],["cornerTop","0"],["cornerTopLeft","0"],["cornerTopLeftShape","round"],["cornerTopRight","0"],["cornerTopRightShape","round"],["cornerTopShape","see individual properties"],["counterIncrement","none"],["counterReset","none"],["counterSet","none"],["cue","see individual properties"],["cueAfter","none"],["cueBefore","none"],["cursor","auto"],["cx","0"],["cy","0"],["d","none"],["direction","ltr"],["display","inline"],["dominantBaseline","auto"],["dynamicRangeLimit","no-limit"],["emptyCells","show"],["eventTrigger","none"],["eventTriggerName","none"],["eventTriggerSource","none"],["fieldSizing","fixed"],["fill","black"],["fillBreak","bounding-box"],["fillColor","currentcolor"],["fillImage","none"],["fillOpacity","1"],["fillOrigin","match-parent"],["fillPosition","0% 0%"],["fillRepeat","repeat"],["fillRule","nonzero"],["fillSize","auto"],["filter","none"],["flex","0 1 auto"],["flexBasis","auto"],["flexDirection","row"],["flexFlow","see individual properties"],["flexGrow","0"],["flexLineCount","1"],["flexShrink","1"],["flexWrap","nowrap"],["float","none"],["floatDefer","none"],["floatOffset","0"],["floatReference","inline"],["floodColor","black"],["floodOpacity","1"],["flowFrom","none"],["flowInto","none"],["flowTolerance","normal"],["font","see individual properties"],["fontFamily","depends on user agent"],["fontFeatureSettings","normal"],["fontKerning","auto"],["fontLanguageOverride","normal"],["fontOpticalSizing","auto"],["fontPalette","normal"],["fontSize","medium"],["fontSizeAdjust","none"],["fontStyle","normal"],["fontSynthesis","weight style small-caps position"],["fontSynthesisPosition","auto"],["fontSynthesisSmallCaps","auto"],["fontSynthesisStyle","auto"],["fontSynthesisWeight","auto"],["fontVariant","normal"],["fontVariantAlternates","normal"],["fontVariantCaps","normal"],["fontVariantEastAsian","normal"],["fontVariantEmoji","normal"],["fontVariantLigatures","normal"],["fontVariantNumeric","normal"],["fontVariantPosition","normal"],["fontVariationSettings","normal"],["fontWeight","normal"],["fontWidth","normal"],["footnoteDisplay","block"],["footnotePolicy","auto"],["forcedColorAdjust","auto"],["frameSizing","auto"],["gap","see individual properties"],["glyphOrientationVertical","n/a"],["grid","none"],["gridArea","auto"],["gridAutoColumns","auto"],["gridAutoFlow","row"],["gridAutoRows","auto"],["gridColumn","auto"],["gridColumnEnd","auto"],["gridColumnStart","auto"],["gridRow","auto"],["gridRowEnd","auto"],["gridRowStart","auto"],["gridTemplate","none"],["gridTemplateAreas","none"],["gridTemplateColumns","none"],["gridTemplateRows","none"],["hangingPunctuation","none"],["height","auto"],["hyphenateCharacter","auto"],["hyphenateLimitChars","auto"],["hyphenateLimitLast","none"],["hyphenateLimitLines","no-limit"],["hyphenateLimitZone","0"],["hyphens","manual"],["imageAnimation","normal"],["imageOrientation","from-image"],["imageRendering","auto"],["imageResolution","1dppx"],["initialLetter","normal"],["initialLetterAlign","alphabetic"],["initialLetterWrap","none"],["inlineSize","auto"],["inlineSizing","normal"],["inputSecurity","auto"],["inset","auto"],["insetBlock","auto"],["insetBlockEnd","auto"],["insetBlockStart","auto"],["insetInline","auto"],["insetInlineEnd","auto"],["insetInlineStart","auto"],["interactivity","auto"],["interestDelay","see individual properties"],["interestDelayEnd","normal"],["interestDelayStart","normal"],["interpolateSize","numeric-only"],["isolation","auto"],["justifyContent","normal"],["justifyItems","legacy"],["justifySelf","auto"],["left","auto"],["letterSpacing","normal"],["lightingColor","white"],["lineBreak","auto"],["lineClamp","none"],["lineFitEdge","leading"],["lineGrid","match-parent"],["lineHeight","normal"],["lineHeightStep","0"],["linePadding","0"],["lineSnap","none"],["linkParameters","none"],["listStyle","see individual properties"],["listStyleImage","none"],["listStylePosition","outside"],["listStyleType","disc"],["margin","0"],["marginBlock","see individual properties"],["marginBlockEnd","0"],["marginBlockStart","0"],["marginBottom","0"],["marginBreak","auto"],["marginInline","see individual properties"],["marginInlineEnd","0"],["marginInlineStart","0"],["marginLeft","0"],["marginRight","0"],["marginTop","0"],["marginTrim","none"],["marker","not defined for shorthand properties"],["markerEnd","none"],["markerMid","none"],["markerSide","match-self"],["markerStart","none"],["mask","see individual properties"],["maskBorder","See individual properties"],["maskBorderMode","alpha"],["maskBorderOutset","0"],["maskBorderRepeat","stretch"],["maskBorderSlice","0"],["maskBorderSource","none"],["maskBorderWidth","auto"],["maskClip","border-box"],["maskComposite","add"],["maskImage","none"],["maskMode","match-source"],["maskOrigin","border-box"],["maskPosition","0% 0%"],["maskRepeat","repeat"],["maskSize","auto"],["maskType","luminance"],["mathDepth","0"],["mathShift","normal"],["mathStyle","normal"],["maxBlockSize","none"],["maxHeight","none"],["maxInlineSize","none"],["maxLines","none"],["maxWidth","none"],["minBlockSize","0"],["minHeight","auto"],["minInlineSize","0"],["minIntrinsicSizing","legacy"],["minWidth","auto"],["mixBlendMode","normal"],["navDown","auto"],["navLeft","auto"],["navRight","auto"],["navUp","auto"],["objectFit","fill"],["objectPosition","50% 50%"],["objectViewBox","none"],["offset","see individual properties"],["offsetAnchor","auto"],["offsetDistance","0"],["offsetPath","none"],["offsetPosition","normal"],["offsetRotate","auto"],["opacity","1"],["order","0"],["orphans","2"],["outline","see individual properties"],["outlineColor","auto"],["outlineOffset","0"],["outlineStyle","none"],["outlineWidth","medium"],["overflow","visible"],["overflowAnchor","auto"],["overflowBlock","visible"],["overflowClipMargin","0px"],["overflowClipMarginBlock","0px"],["overflowClipMarginBlockEnd","0px"],["overflowClipMarginBlockStart","0px"],["overflowClipMarginBottom","0px"],["overflowClipMarginInline","0px"],["overflowClipMarginInlineEnd","0px"],["overflowClipMarginInlineStart","0px"],["overflowClipMarginLeft","0px"],["overflowClipMarginRight","0px"],["overflowClipMarginTop","0px"],["overflowInline","visible"],["overflowWrap","normal"],["overflowX","visible"],["overflowY","visible"],["overlay","none"],["overscrollBehavior","auto auto"],["overscrollBehaviorBlock","auto"],["overscrollBehaviorInline","auto"],["overscrollBehaviorX","auto"],["overscrollBehaviorY","auto"],["padding","0"],["paddingBlock","see individual properties"],["paddingBlockEnd","0"],["paddingBlockStart","0"],["paddingBottom","0"],["paddingInline","see individual properties"],["paddingInlineEnd","0"],["paddingInlineStart","0"],["paddingLeft","0"],["paddingRight","0"],["paddingTop","0"],["page","auto"],["pageBreakAfter","auto"],["pageBreakBefore","auto"],["pageBreakInside","auto"],["paintOrder","normal"],["pathLength","none"],["pause","see individual properties"],["pauseAfter","none"],["pauseBefore","none"],["perspective","none"],["perspectiveOrigin","50% 50%"],["placeContent","normal"],["placeItems","see individual properties"],["placeSelf","auto"],["pointerEvents","auto"],["pointerTimeline","see individual properties"],["pointerTimelineAxis","block"],["pointerTimelineName","none"],["position","static"],["positionAnchor","normal"],["positionArea","none"],["positionTry","see individual properties"],["positionTryFallbacks","none"],["positionTryOrder","normal"],["positionVisibility","anchor-visible"],["printColorAdjust","economy"],["quotes","auto"],["r","0"],["readingFlow","normal"],["readingOrder","0"],["regionFragment","auto"],["resize","none"],["rest","see individual properties"],["restAfter","none"],["restBefore","none"],["right","auto"],["rotate","none"],["rowGap","normal"],["rowRule","see individual properties"],["rowRuleBreak","normal"],["rowRuleColor","currentcolor"],["rowRuleInset","see individual properties"],["rowRuleInsetCap","see individual properties"],["rowRuleInsetCapEnd","0"],["rowRuleInsetCapStart","0"],["rowRuleInsetEnd","see individual properties"],["rowRuleInsetJunction","see individual properties"],["rowRuleInsetJunctionEnd","0"],["rowRuleInsetJunctionStart","0"],["rowRuleInsetStart","see individual properties"],["rowRuleStyle","none"],["rowRuleVisibilityItems","normal"],["rowRuleWidth","medium"],["rubyAlign","space-around"],["rubyMerge","separate"],["rubyOverhang","auto"],["rubyPosition","alternate"],["rule","see individual properties"],["ruleBreak","see individual properties"],["ruleColor","see individual properties"],["ruleInset","see individual properties"],["ruleInsetCap","see individual properties"],["ruleInsetEnd","see individual properties"],["ruleInsetJunction","see individual properties"],["ruleInsetStart","see individual properties"],["ruleOverlap","row-over-column"],["ruleStyle","see individual properties"],["ruleVisibilityItems","see individual properties"],["ruleWidth","see individual properties"],["rx","auto"],["ry","auto"],["scale","none"],["scrollbarColor","auto"],["scrollbarGutter","auto"],["scrollbarWidth","auto"],["scrollBehavior","auto"],["scrollInitialTarget","none"],["scrollMargin","0"],["scrollMarginBlock","0"],["scrollMarginBlockEnd","0"],["scrollMarginBlockStart","0"],["scrollMarginBottom","0"],["scrollMarginInline","0"],["scrollMarginInlineEnd","0"],["scrollMarginInlineStart","0"],["scrollMarginLeft","0"],["scrollMarginRight","0"],["scrollMarginTop","0"],["scrollMarkerGroup","none"],["scrollPadding","auto"],["scrollPaddingBlock","auto"],["scrollPaddingBlockEnd","auto"],["scrollPaddingBlockStart","auto"],["scrollPaddingBottom","auto"],["scrollPaddingInline","auto"],["scrollPaddingInlineEnd","auto"],["scrollPaddingInlineStart","auto"],["scrollPaddingLeft","auto"],["scrollPaddingRight","auto"],["scrollPaddingTop","auto"],["scrollSnapAlign","none"],["scrollSnapStop","normal"],["scrollSnapType","none"],["scrollTargetGroup","none"],["scrollTimeline","see individual properties"],["scrollTimelineAxis","block"],["scrollTimelineName","none"],["shapeImageThreshold","0"],["shapeInside","auto"],["shapeMargin","0"],["shapeOutside","none"],["shapePadding","0"],["shapeRendering","auto"],["sliderOrientation","auto"],["spatialNavigationAction","auto"],["spatialNavigationContain","auto"],["spatialNavigationFunction","normal"],["speak","auto"],["speakAs","normal"],["stopColor",""],["stopOpacity",""],["stringSet","none"],["stroke","none"],["strokeAlign","center"],["strokeAlignment","center"],["strokeBreak","bounding-box"],["strokeColor","transparent"],["strokeDashadjust","none"],["strokeDasharray","none"],["strokeDashcorner","none"],["strokeDashCorner","none"],["strokeDashJustify","none"],["strokeDashoffset","0"],["strokeImage","none"],["strokeLinecap","butt"],["strokeLinejoin","miter"],["strokeMiterlimit","4"],["strokeOpacity","1"],["strokeOrigin","match-parent"],["strokePosition","0% 0%"],["strokeRepeat","repeat"],["strokeSize","auto"],["strokeWidth","1px"],["tableLayout","auto"],["tabSize","8"],["textAlign","start"],["textAlignAll","start"],["textAlignLast","auto"],["textAnchor","start"],["textAutospace","normal"],["textBox","normal"],["textBoxEdge","auto"],["textBoxTrim","none"],["textCombineUpright","none"],["textDecoration","see individual properties"],["textDecorationColor","currentcolor"],["textDecorationInset","0"],["textDecorationLine","none"],["textDecorationSkip","See individual properties"],["textDecorationSkipBox","none"],["textDecorationSkipInk","auto"],["textDecorationSkipSelf","auto"],["textDecorationSkipSpaces","start end"],["textDecorationStyle","solid"],["textDecorationThickness","auto"],["textEmphasis","see individual properties"],["textEmphasisColor","currentcolor"],["textEmphasisPosition","over right"],["textEmphasisSkip","spaces punctuation"],["textEmphasisStyle","none"],["textFit","none"],["textGroupAlign","none"],["textIndent","0"],["textJustify","auto"],["textOrientation","mixed"],["textOverflow","clip"],["textRendering","auto"],["textShadow","none"],["textSizeAdjust","auto"],["textSpacing","see individual properties"],["textSpacingTrim","normal"],["textTransform","none"],["textUnderlineOffset","auto"],["textUnderlinePosition","auto"],["textWrap","wrap"],["textWrapMode","wrap"],["textWrapStyle","auto"],["timelineScope","none"],["timelineTrigger","see individual properties"],["timelineTriggerActivationRange","see individual properties"],["timelineTriggerActivationRangeEnd","normal"],["timelineTriggerActivationRangeStart","normal"],["timelineTriggerActiveRange","see individual properties"],["timelineTriggerActiveRangeEnd","auto"],["timelineTriggerActiveRangeStart","auto"],["timelineTriggerName","none"],["timelineTriggerSource","auto"],["top","auto"],["touchAction","auto"],["transform","none"],["transformBox","view-box"],["transformOrigin","50% 50%"],["transformStyle","flat"],["transition","see individual properties"],["transitionBehavior","normal"],["transitionDelay","0s"],["transitionDuration","0s"],["transitionProperty","all"],["transitionTimingFunction","ease"],["translate","none"],["triggerScope","none"],["unicodeBidi","normal"],["userSelect","auto"],["vectorEffect","none"],["verticalAlign","baseline"],["viewTimeline","see individual properties"],["viewTimelineAxis","block"],["viewTimelineInset","auto"],["viewTimelineName","none"],["viewTransitionClass","none"],["viewTransitionGroup","normal"],["viewTransitionName","none"],["viewTransitionScope","none"],["visibility","visible"],["voiceBalance","center"],["voiceDuration","auto"],["voiceFamily","implementation-dependent"],["voicePitch","medium"],["voiceRange","medium"],["voiceRate","normal"],["voiceStress","normal"],["voiceVolume","medium"],["webkitBoxAlign",""],["webkitBoxFlex",""],["webkitBoxOrdinalGroup",""],["webkitBoxOrient",""],["webkitBoxPack",""],["webkitLineClamp","none"],["webkitTextFillColor","currentcolor"],["webkitTextStroke","See individual properties"],["webkitTextStrokeColor","currentcolor"],["webkitTextStrokeWidth","0"],["webkitUserSelect",""],["whiteSpace","normal"],["whiteSpaceCollapse","collapse"],["whiteSpaceTrim","none"],["widows","2"],["width","auto"],["willChange","auto"],["windowDrag","none"],["wordBreak","normal"],["wordSpaceTransform","none"],["wordSpacing","normal"],["wordWrap","normal"],["wrapAfter","auto"],["wrapBefore","auto"],["wrapFlow","auto"],["wrapInside","auto"],["wrapThrough","wrap"],["writingMode","horizontal-tb"],["x","0"],["y","0"],["zIndex","auto"],["zoom","1"]],elements:{Form:[{tag:"form"},{tag:"input"},{tag:"textarea"},{tag:"select"},{tag:"option"},{tag:"optgroup"},{tag:"button"},{tag:"label"},{tag:"fieldset"},{tag:"legend"},{tag:"output"},{tag:"progress"},{tag:"meter"},{tag:"datalist"}],Interactive:[{tag:"details"},{tag:"summary"},{tag:"dialog"},{tag:"menu"}],"List & Table":[{tag:"ul"},{tag:"ol"},{tag:"li"},{tag:"dl"},{tag:"dt"},{tag:"dd"},{tag:"table"},{tag:"thead"},{tag:"tbody"},{tag:"tfoot"},{tag:"tr"},{tag:"th"},{tag:"td"},{tag:"caption"},{tag:"colgroup"},{tag:"col"}],Media:[{tag:"img"},{tag:"picture"},{tag:"source"},{tag:"video"},{tag:"audio"},{tag:"track"},{tag:"canvas"},{tag:"iframe"},{tag:"embed"},{tag:"object"}],Structure:[{tag:"div"},{tag:"section"},{tag:"article"},{tag:"aside"},{tag:"main"},{tag:"header"},{tag:"footer"},{tag:"nav"},{tag:"search"},{tag:"hgroup"},{tag:"slot"}],Text:[{tag:"h1"},{tag:"h2"},{tag:"h3"},{tag:"h4"},{tag:"h5"},{tag:"h6"},{tag:"p"},{tag:"span"},{tag:"a"},{tag:"strong"},{tag:"em"},{tag:"small"},{tag:"mark"},{tag:"code"},{tag:"pre"},{tag:"blockquote"},{tag:"q"},{tag:"abbr"},{tag:"time"},{tag:"sub"},{tag:"sup"},{tag:"br"},{tag:"hr"},{tag:"wbr"}],Other:[{tag:"address"},{tag:"area"},{tag:"b"},{tag:"base"},{tag:"bdi"},{tag:"bdo"},{tag:"body"},{tag:"cite"},{tag:"data"},{tag:"del"},{tag:"dfn"},{tag:"figcaption"},{tag:"figure"},{tag:"head"},{tag:"html"},{tag:"i"},{tag:"ins"},{tag:"kbd"},{tag:"link"},{tag:"map"},{tag:"meta"},{tag:"noscript"},{tag:"rp"},{tag:"rt"},{tag:"ruby"},{tag:"s"},{tag:"samp"},{tag:"script"},{tag:"selectedcontent"},{tag:"style"},{tag:"template"},{tag:"title"},{tag:"u"},{tag:"var"}]},eventHandlers:["onabort","onactivate","onaddsourcebuffer","onaddtrack","onadvertisementreceived","onafterprint","onanimationcancel","onanimationend","onanimationiteration","onanimationstart","onappinstalled","onaudioend","onaudioprocess","onaudiostart","onauxclick","onavailabilitychanged","onbackgroundfetchabort","onbackgroundfetchclick","onbackgroundfetchfail","onbackgroundfetchsuccess","onbeforeinput","onbeforeinstallprompt","onbeforematch","onbeforeprint","onbeforetoggle","onbeforexrselect","onbegin","onblocked","onblur","onboundary","onbufferedamountlow","onbufferedchange","oncancel","oncanmakepayment","oncanplay","oncanplaythrough","oncaptureaction","oncapturedmousechange","oncapturehandlechange","onchange","oncharacterboundsupdate","oncharacteristicvaluechanged","onchargingchange","onchargingtimechange","onclick","onclose","onclosing","oncommand","oncomplete","oncompositionend","oncompositionstart","onconnect","onconnecting","onconnectionavailable","onconnectionstatechange","oncontentdelete","oncontextlost","oncontextmenu","oncontextoverflow","oncontextrestored","oncontrollerchange","oncookiechange","oncopy","oncuechange","oncurrententrychange","oncurrentscreenchange","oncut","ondataavailable","ondatachannel","ondblclick","ondequeue","ondevicechange","ondevicemotion","ondeviceorientation","ondeviceorientationabsolute","ondischargingtimechange","ondisconnect","ondispose","ondownloadprogress","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onencrypted","onend","onended","onendstreaming","onenter","onenterpictureinpicture","onerror","onexit","onfencedtreeclick","onfetch","onfinish","onfocus","onformdata","onframeratechange","onfreeze","onfullscreenchange","onfullscreenerror","ongamepadconnected","ongamepaddisconnected","ongatheringstatechange","ongattserverdisconnected","ongeometrychange","ongotpointercapture","onhashchange","onicecandidate","onicecandidateerror","oniceconnectionstatechange","onicegatheringstatechange","oninput","oninputreport","oninputsourceschange","oninstall","oninvalid","onisolationchange","onkeydown","onkeyframerequest","onkeypress","onkeystatuseschange","onkeyup","onlanguagechange","onlayoutchange","onleavepictureinpicture","onlevelchange","onload","onloadeddata","onloadedmetadata","onloadend","onloading","onloadingdone","onloadingerror","onloadstart","onlocation","onlostpointercapture","onmanagedconfigurationchange","onmark","onmessage","onmessageerror","onmidimessage","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onmute","onnavigate","onnavigateerror","onnavigatesuccess","onnegotiationneeded","onnomatch","onnotificationclick","onnotificationclose","onoffline","ononline","onopen","onorientationchange","onpagehide","onpagereveal","onpageshow","onpageswap","onpaste","onpause","onpayerdetailchange","onpaymentmethodchange","onpaymentrequest","onperiodicsync","onplay","onplaying","onpointercancel","onpointerdown","onpointerenter","onpointerleave","onpointerlockchange","onpointerlockerror","onpointermove","onpointerout","onpointerover","onpointerrawupdate","onpointerup","onpopstate","onportalactivate","onprerenderingchange","onprioritychange","onprocessorerror","onprogress","onpromptaction","onpromptdismiss","onpush","onpushsubscriptionchange","onquotaoverflow","onratechange","onreading","onreadingerror","onreadystatechange","onredraw","onreflectionchange","onrejectionhandled","onrelease","onremove","onremovesourcebuffer","onremovetrack","onrepeat","onreset","onresize","onresourcetimingbufferfull","onresult","onresume","onrtctransform","onscreenschange","onscroll","onscrollend","onsecuritypolicyviolation","onseeked","onseeking","onselect","onselectedcandidatepairchange","onselectend","onselectionchange","onselectstart","onserviceadded","onservicechanged","onserviceremoved","onshippingaddresschange","onshippingoptionchange","onshow","onsignalingstatechange","onsinkchange","onslotchange","onsnapchanged","onsnapchanging","onsoundend","onsoundstart","onsourceclose","onsourceended","onsourceopen","onspeechend","onspeechstart","onsqueeze","onsqueezeend","onsqueezestart","onstalled","onstart","onstartstreaming","onstatechange","onstop","onstorage","onsubmit","onsuccess","onsuspend","onsync","onterminate","ontextformatupdate","ontextupdate","ontimeout","ontimeupdate","ontoggle","ontonechange","ontoolchange","ontouchcancel","ontouchend","ontouchmove","ontouchstart","ontrack","ontransitioncancel","ontransitionend","ontransitionrun","ontransitionstart","onuncapturederror","onunhandledrejection","onunload","onunmute","onupdate","onupdateend","onupdatefound","onupdatestart","onupgradeneeded","onvalidationstatuschange","onversionchange","onvisibilitychange","onvoiceschanged","onvolumechange","onwaiting","onwaitingforkey","onwebkitanimationend","onwebkitanimationiteration","onwebkitanimationstart","onwebkittransitionend","onwheel","onzoomlevelchange"]};var Y1=["caret","canvas","global"],X1=new Set(["pane.backToHome"]);var q5="input, textarea, select, [contenteditable=true]";function U5(e=document){let t=e.activeElement;return t instanceof HTMLElement&&t.matches(q5)}function J5(e){let t=(r)=>Q(e?.[r]);return{dataRows:t("dataRows"),findReferences:t("findReferences"),gitClone:t("gitClone"),importSite:t("importSite"),openProject:cf(e),openProjectInNewWindow:t("openProjectInNewWindow"),readFileBytes:t("readFileBytes"),publish:t("cfApi"),windowControls:t("newWindow")}}function Q1(e){return()=>{let t=bv(),r=h.value??null,o=C,a=e.canvasMode();t.project.open=o!==null,t.project.isSite=o?.isSiteProject===!0,t.project.isRepo=u.git.status?.isRepo===!0,t.project.isMultilingual=(ln(o?.projectConfig??{}).i18n?.locales.length??0)>1,t.git.ahead=u.git.status?.ahead??0,t.git.behind=u.git.status?.behind??0,t.git.dirtyCount=u.git.status?.files.length??0,t.workspace.id=u.workspace,t.document.open=r!==null,t.document.dirty=r?r.doc.dirty===!0||ZC(r.id)||Cv(r):!1,t.document.mode=r?.doc.mode??"",t.document.canUndo=r?pM(r):!1,t.document.canRedo=r?fM(r):!1,t.editor.kind=r?Qs(a):"none",t.canvas.view=UO(a),t.pane.count=m.panes.length,t.pane.derived=m.panes.some((l)=>l.derived!==null);let i=r?.session.selection??[],s=Oe(i);if(s){let l=oe(r.doc.document,s),f=l?.tagName;t.selection.count=i.length,t.selection.paths=i.map((c)=>[...c]),t.selection.kind=n(f)?f:"",t.selection.isRoot=i.some((c)=>c.length<2),t.selection.isComponentInstance=Ne.some((c)=>c.tagName===f),t.selection.isRepeater=l?.$prototype==="Array"}if(t.selection.isLayoutNode=u.layoutSelection!==null,t.caret.active=e.isCaretActive()||U5(),t.caret.inCanvas=e.isCaretActive(),t.focus.region=u.focusRegion,t.modal.open=e.isModalOpen(),r){let l=xn(r);t.collab.attached=l.active,t.collab.readOnly=l.readOnly,t.collab.sourceCanonical=l.sourceCanonical}return t.ai.configured=e.aiConfigured(),t.ai.streaming=e.aiStreaming?.()??!1,t.ai.waiting=e.aiWaiting?.()??!1,t.capability=J5(e.platform()),t}}var Z1={$schema:"https://jxsuite.com/schema/v1",$id:"StudioRail",$description:"The Navigator rail: a rendering of the panel registry. The adapter hands in `groups`, every rail-able panel grouped by level with its selected state and badge. Nothing here is a list of panels. Each button prints its record's short `railLabel` under the glyph, falling back to `title`, and carries the full `title` as its accessible name and tooltip: the visible words lead the name a reader hears (WCAG 2.5.3), and the tooltip restores what a short label leaves out. The rail has no foot: the gear lives in the top bar, because the rail is drawn only in the Design workspace, and the Library button left with the Content workspace that replaces it.",tagName:"div",attributes:{part:"rail"},style:{display:"flex",flexDirection:"column",height:"100%",'& > [part="groups"]':{display:"flex",flexDirection:"column",padding:"var(--jx-space-2) 0"},'& [role="group"]':{display:"flex",flexDirection:"column"},"& jx-divider":{$description:"The element draws the hairline and announces it; what the rail owns is where it sits. The rule outranks `jx-divider`'s own margin by one element in the selector, which is the sanctioned way a host retunes a kit element (ui.md §3.2) and the reason the divider's spacing is on its HOST rather than on the rule inside it.",margin:"var(--jx-space-3) var(--jx-space-4)"},"& jx-action-button":{width:"100%"},'& jx-action-button > [part="control"]':{borderLeft:"2px solid transparent",opacity:"0.75",":hover":{opacity:"1"}},'& jx-action-button[data-selected] > [part="control"]':{borderLeftColor:"var(--jx-accent)",background:"transparent",color:"var(--jx-fg)",opacity:"1"}},children:[{tagName:"nav",attributes:{part:"groups","aria-label":"Navigator panels"},children:[{$prototype:"Array",items:{$ref:"#/state/groups"},key:{$ref:"$map/item/level"},map:{tagName:"div",attributes:{role:"none"},children:[{tagName:"div",attributes:{role:"none"},$switch:{$ref:"$map/item/dividerAbove"},cases:{true:{tagName:"jx-divider"}}},{tagName:"div",attributes:{role:"group","aria-label":"${$map.item.label}"},children:[{$prototype:"Array",items:{$ref:"$map/item/panels"},key:{$ref:"$map/item/id"},map:{tagName:"jx-action-button",$props:{label:{$ref:"$map/item/title"},hint:{$ref:"$map/item/title"},icon:{$ref:"$map/item/icon"},stacked:!0,toggles:!0,selected:{$ref:"$map/item/selected"},badge:{$ref:"$map/item/badge"}},attributes:{"data-panel":"${$map.item.id}"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/toggle"},value:[{$ref:"$map/item/id"}]}]},children:[{tagName:"span",textContent:"${$map.item.railLabel}"}]}}]}]}}]}]};E("rail",Z1);var eL=null,rL=null,Pv=null,K5=null;function Y5(e){return!u.docks.left.collapsed&&u.leftTab===e.id}function X5(e){SO(HC(e.id,"the Navigator rail"))}function Q5(){let e=th();return VL(e).map((t,r)=>({dividerAbove:r>0,label:t.label,level:t.level,panels:t.panels.map((o)=>({badge:String(o.badge?.(e)??""),icon:o.icon,id:o.id,railLabel:o.railLabel??o.title,selected:Y5(o),title:o.title}))}))}function oL(){return rL??=g({groups:[],toggle:(e)=>{let t=VL(th()).flatMap((r)=>r.panels).find((r)=>r.id===e);if(t)X5(t)}}),rL}function Z5(){oL().groups=Q5(),eK()}function eK(){if(Pv||!u1)return;Pv=R("rail",oL(),u1),Pv.then((e)=>{K5=e})}function aL(){es(),eL=me(),eL.run(()=>{te(()=>{let{error:e,loading:t,status:r}=u.git;if(!r&&!t&&!e)ks();Z5()})})}function tK(e){return((e.state.user.name??e.state.user.login)[0]??"?").toUpperCase()}function nK(e,t){let{user:r}=e.state,o=r.name?`${r.name} (${r.login})`:r.login;return e.state.focusedPath&&e.state.focusedPath===t?o:`${o} — ${e.state.focusedPath??"browsing"}`}var Nv={connecting:"Connecting…",detached:"Solo",failed:"Not connected",offline:"Offline — changes sync on reconnect",synced:"Live",unavailable:""};function rK(e,t){if(e==="failed")return`Live collaboration could not start${t?` — ${t}`:""}. Your edits are saved to this machine as usual.`;if(e==="synced"||e==="offline")return`${Nv[e]}. Undo only takes back your own edits, never a collaborator's.`;return Nv[e]}function iL(e){if(!e)return null;let t=xn(e);if(t.status==="unavailable")return null;return{frozen:t.sourceCanonical,label:Nv[t.status]||t.status,peers:t.peers.map((r)=>({avatarUrl:r.state.user.avatarUrl??"",color:r.state.user.color,hasAvatar:Boolean(r.state.user.avatarUrl),initial:tK(r),key:r.clientId,title:nK(r,e.documentPath)})),readOnly:t.readOnly,status:t.status,title:rK(t.status,t.attachError)}}var Lv="settings/menu",Io=null,jv=null,Lu=null,oK=new Map([["app.preferences",()=>kn.map((e)=>({dividerAbove:!1,key:e.id,label:e.title}))],["settings.open",()=>Lw().flatMap((e,t)=>e.sections.map((r,o)=>({dividerAbove:t>0&&o===0,key:r.key,label:r.label})))]]);function aK(e){return oK.get(e)?.()??[]}function sL(e,t){let r=ae();if(!r)return;Tn(r,e,t,"Settings")}function lL(e){let t=[...e.forPlacement(Lv)].toSorted((o,a)=>Wb.indexOf(o.level)-Wb.indexOf(a.level)),r;return t.map((o,a)=>{let i=a>0&&o.level!==r;({level:r}=o);let s=e.isEnabled(o.id),l=e.keymap.formatBinding(o.id),f=l&&l.toLowerCase()!==o.title.toLowerCase()?l:void 0,c=s?void 0:e.disabledReason(o.id),{id:d}=o,b={children:s?aK(d).map((y)=>({destructive:!1,disabled:!1,dividerAbove:y.dividerAbove,id:`${d}:${y.key}`,run:()=>sL(d,{section:y.key}),title:y.label})):[],destructive:o.destructive===!0,disabled:!s,dividerAbove:i,id:d,run:()=>sL(d),submenuLabel:`Sections of ${o.title}`,title:o.title};if(f)b.chord=f;if(c)b.requires=c;return b})}function Ov(){return Io!==null}function Mv(){Io?.close()}function cL(e,t={}){if(Io){Mv();return}let r=ae();if(!r)return;let o=lL(r);if(o.length===0)return;Lu=t.rerender??null;let a=zt({label:"Settings",onClosed:(i)=>{if(Io!==i)return;Io=null,jv?.(),jv=null;let s=Lu;Lu=null,s?.()},opener:e,place:(i)=>{let s=Me(e);return{x:Math.max(4,s.right-i.width),y:s.bottom+4}},placement:"block-end span-inline-start",region:"settings",rows:o});Io=a,jv=_S(()=>{let i=ae();if(!i||Io!==a)return;a.setRows(lL(i))}),Lu?.()}var dL={$schema:"https://jxsuite.com/schema/v1",$id:"StudioCommandBar",$description:"The Command Bar: a rendering of the command registry. The adapter hands in `primary` (what declared commandbar/primary), `docks` (the three dock toggles), `workspaces` (the five workspaces, with `workspace` selected), `settingsVisible`/`settingsOpen` for the gear that renders the settings/menu placement, the Command Center's `segments`, the collaboration `presence` and `csd` (which window-control layout, if any). Nothing here decides what an action is called.",tagName:"div",attributes:{part:"bar"},style:{display:"flex",alignItems:"center",flex:"1",minWidth:"0",height:"100%",gap:"var(--jx-space-2)","& > *":{minWidth:"0",flexShrink:"1"},'& > [part="spacer"]':{flex:"1",flexShrink:"999"},'& [part="csd-lead"], & [part="csd-trail"], & [part="menu-slot"], & [part="workspaces-slot"], & [part="presence-slot"], & [part="settings-slot"]':{display:"contents"},'& [part="window-controls"]':{display:"flex",alignItems:"center",flexShrink:"0",marginLeft:"var(--jx-space-2)"},'& [part="window-controls"] [data-control="close"]:hover > [part="control"]':{background:"var(--jx-danger)",color:"var(--jx-accent-fg)"},'& [part="window-controls"][data-mac]':{marginLeft:"0",marginRight:"var(--jx-space-3)",gap:"var(--jx-space-3)"},'& [part="window-controls"][data-mac] jx-action-button > [part="control"]':{width:"12px",minWidth:"12px",height:"12px",minHeight:"12px",padding:"0",border:"none",borderRadius:"50%",overflow:"hidden",":hover":{filter:"brightness(0.85)"}},'& [part="window-controls"][data-mac] [data-control="close"] > [part="control"]':{background:"#ff5f57"},'& [part="window-controls"][data-mac] [data-control="minimize"] > [part="control"]':{background:"#febc2e"},'& [part="window-controls"][data-mac] [data-control="maximize"] > [part="control"]':{background:"#28c840"},'& [part="window-controls"][data-mac] [part="icon"]':{display:"none"},'& [part="window-controls"][data-mac]:hover [part="icon"]':{display:"inline-flex",color:"rgba(0, 0, 0, 0.5)","--jx-icon-size":"8px"},'& [part="workspaces"]':{$description:"The kit's tablist, retuned for a 36px band: no rule under the strip (the band's own border is the floor), and the tabs sit on the band's centre line rather than on a strip edge.",flexShrink:"0",borderBottom:"none",gap:"2px",fontSize:"var(--jx-text-sm)"},'& [part="workspace"]':{padding:"2px var(--jx-space-3)",borderRadius:"var(--jx-radius-sm)",color:"var(--jx-fg-dim)",whiteSpace:"nowrap","--jx-icon-size":"14px",":hover":{background:"var(--jx-hover-bg)",color:"var(--jx-fg)"}},'& [part="workspace"][aria-selected="true"]':{color:"var(--jx-fg)",background:"var(--jx-hover-bg)"},'& [part="workspace-badge"]':{$description:"The count of unpublished changes on the Publish tab. Decorative: the tab's tooltip says what it counts, and the badge is not drawn at zero.",minWidth:"16px",padding:"0 4px",borderRadius:"8px",background:"var(--jx-accent)",color:"var(--jx-accent-fg)",fontSize:"var(--jx-text-xs)",lineHeight:"16px",textAlign:"center"},'& [part="center"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",flex:"0 1 520px",minWidth:"0",padding:"0 var(--jx-space-3)",height:"var(--jx-control-h)",boxSizing:"border-box",cursor:"pointer",border:"1px solid var(--jx-border-strong)",borderRadius:"var(--jx-radius-sm)",background:"var(--jx-bg-input)",fontSize:"var(--jx-text-sm)",":hover":{borderColor:"var(--jx-fg-muted)"}},'& [part="mark"]':{color:"var(--jx-accent)",flexShrink:"0"},'& [part="sep-slot"], & [part="chord-slot"]':{display:"contents"},'& [part="sep"]':{color:"var(--jx-fg-muted)",flexShrink:"0"},'& [part="segment"]':{appearance:"none",border:"none",background:"none",padding:"2px var(--jx-space-2)",borderRadius:"var(--jx-radius-sm)",color:"var(--jx-fg-dim)",font:"inherit",cursor:"pointer",maxWidth:"220px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",":hover":{background:"var(--jx-hover-bg)",color:"var(--jx-fg)"},":focus-visible":{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"}},'& [part="chord"]':{marginLeft:"auto",paddingLeft:"var(--jx-space-3)",font:"inherit",fontSize:"var(--jx-text-xs)",color:"var(--jx-fg-muted)",flexShrink:"0"},'& [part="primary"]':{display:"flex",alignItems:"center",gap:"2px",flexShrink:"0"},'& [part="primary"] [part="icon-slot"]':{display:"contents"},'& [part="presence"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",minWidth:"0"},'& [part="status"]':{fontSize:"var(--jx-text-xs)",color:"var(--jx-fg-dim)",whiteSpace:"nowrap"},'& [part="status"][data-status="synced"]':{color:"var(--jx-success)"},'& [part="status"][data-status="offline"]':{color:"var(--jx-warning)"},'& [part="status"][data-status="failed"]':{color:"var(--jx-danger)"},'& [part="flag-slot"]':{display:"contents"},'& [part="flag"]':{borderRadius:"var(--jx-radius-sm)",padding:"1px var(--jx-space-2)",fontSize:"var(--jx-text-xs)",whiteSpace:"nowrap",border:"1px solid currentcolor",color:"var(--jx-fg-dim)"},'& [part="flag"][data-flag="frozen"]':{color:"var(--jx-warning)"},'& [part="chip"]':{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"20px",height:"20px",borderRadius:"50%",overflow:"hidden",color:"var(--jx-accent-fg)",fontSize:"var(--jx-text-xs)",fontWeight:"600",flexShrink:"0"},'& [part="chip"] img':{width:"100%",height:"100%",objectFit:"cover"},'& [part="docks"]':{display:"flex",alignItems:"center",flexShrink:"0"},"@container toolbar (max-width: 1140px)":{'& [part="primary"] [part="text"], & [part="primary"] jx-button > [part="control"] > [part="label"]':{display:"none"},'& [part="primary"] jx-button > [part="control"]':{gap:"0"},'& [part="workspace"] > [part="label"]':{display:"none"}},'& [part="workspaces-group"]':{$description:"The tablist and the quick-publish chevron, as one item of the band, so the chevron never wraps away from the Publish tab it belongs to.",display:"flex",alignItems:"center",flexShrink:"0",gap:"2px"},'& [part="quick-publish"]':{"--jx-icon-size":"12px",marginLeft:"-2px"}},children:[{tagName:"div",attributes:{part:"csd-lead",role:"none"},$switch:{$ref:"#/state/csd"},cases:{mac:{tagName:"div",attributes:{part:"window-controls",role:"group","aria-label":"Window","data-mac":""},children:[{tagName:"jx-action-button",$props:{label:"Close",hint:"Close",icon:"x",size:"sm"},attributes:{"data-control":"close",class:"app-region-no-drag"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/windowControl"},value:["close"]}]}},{tagName:"jx-action-button",$props:{label:"Minimize",hint:"Minimize",icon:"minus",size:"sm"},attributes:{"data-control":"minimize",class:"app-region-no-drag"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/windowControl"},value:["minimize"]}]}},{tagName:"jx-action-button",$props:{label:"Maximize",hint:"Maximize",icon:"square",size:"sm"},attributes:{"data-control":"maximize",class:"app-region-no-drag"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/windowControl"},value:["maximize"]}]}}]}}},{tagName:"div",attributes:{part:"menu-slot",role:"none"},$switch:{$ref:"#/state/menuVisible"},cases:{true:{tagName:"jx-action-button",$props:{label:"Studio menu",hint:"Studio menu",icon:"list",size:"sm",haspopup:"menu",expanded:{$ref:"#/state/menuOpen"}},attributes:{"data-menu":"studio",class:"app-region-no-drag"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openStudioMenu"},value:[{$ref:"event#/currentTarget"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{ArrowDown:[{operator:"call",target:{$ref:"#/state/openStudioMenu"},value:[{$ref:"event#/currentTarget"}]},{preventDefault:!0}]}}]}}}},{tagName:"div",attributes:{part:"workspaces-slot",role:"none"},$switch:{$ref:"#/state/workspacesVisible"},cases:{true:{tagName:"div",attributes:{part:"workspaces-group",role:"none"},children:[{tagName:"jx-tabs",attributes:{part:"workspaces",selected:"${state.workspace}",class:"app-region-no-drag"},$props:{label:"Workspaces",activation:"manual"},children:[{$prototype:"Array",items:{$ref:"#/state/workspaces"},key:{$ref:"$map/item/id"},map:{tagName:"jx-tab",attributes:{part:"workspace",value:"${$map.item.id}",label:"${$map.item.title}",title:"${$map.item.tooltip}","aria-description":"${$map.item.description || null}","data-workspace":"${$map.item.id}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setWorkspace"},value:[{$ref:"$map/item/id"}]}]},children:[{tagName:"jx-icon",attributes:{slot:"icon"},$props:{name:{$ref:"$map/item/icon"}}},{tagName:"span",attributes:{slot:"status",part:"workspace-badge-slot"},style:{display:"contents"},$switch:{$ref:"$map/item/hasBadge"},cases:{true:{tagName:"span",attributes:{part:"workspace-badge","aria-hidden":"true"},textContent:"${$map.item.badge}"}}}]}}]},{tagName:"div",attributes:{part:"quick-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/quickVisible"},cases:{true:{tagName:"jx-action-button",$description:"`publish.quick`, drawn beside the Publish tab rather than inside it (studio.md §22.2): a tab that sometimes opened a dialog would be a tab whose activation means two things. It sits after the tablist, which ends on Publish, so it is the control beside that tab.",attributes:{part:"quick-publish",class:"app-region-no-drag","data-command":"publish.quick"},$props:{icon:"caret-down",size:"sm",quiet:!0,label:"Quick publish",hint:{$ref:"#/state/quickTooltip"},haspopup:"dialog",disabled:{$ref:"#/state/quickDisabled"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/run"},value:["publish.quick"]}]}}}}]}}},{tagName:"div",attributes:{part:"spacer"}},{tagName:"div",attributes:{part:"center",role:"group","aria-label":"Command Center",class:"app-region-no-drag"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openPicker"},value:[]}]},children:[{tagName:"span",attributes:{part:"mark","aria-hidden":"true"},textContent:"◈"},{$prototype:"Array",items:{$ref:"#/state/segments"},key:{$ref:"$map/item/key"},map:{tagName:"span",attributes:{part:"segment-slot",role:"none"},style:{display:"contents"},children:[{tagName:"span",attributes:{part:"sep-slot",role:"none"},$switch:{$ref:"$map/item/sepBefore"},cases:{true:{tagName:"span",attributes:{part:"sep","aria-hidden":"true"},textContent:"›"}}},{tagName:"button",attributes:{part:"segment",type:"button","data-segment":"${$map.item.key}",title:"${$map.item.title}",class:"app-region-no-drag"},textContent:"${$map.item.label}",onclick:{$prototype:"Function",body:[{stopPropagation:!0},{operator:"call",target:{$ref:"#/state/openSegment"},value:[{$ref:"$map/item/key"}]}]}}]}},{tagName:"span",attributes:{part:"chord-slot",role:"none"},$switch:{$ref:"#/state/hasChord"},cases:{true:{tagName:"kbd",attributes:{part:"chord"},textContent:"${state.chord}"}}}]},{tagName:"div",attributes:{part:"spacer"}},{tagName:"div",attributes:{part:"primary",role:"group","aria-label":"Actions"},children:[{$prototype:"Array",items:{$ref:"#/state/primary"},key:{$ref:"$map/item/id"},map:{tagName:"jx-button",$props:{label:{$ref:"$map/item/title"},hint:{$ref:"$map/item/tooltip"},disabled:{$ref:"$map/item/disabled"},size:"sm",quiet:!0},attributes:{"data-command-id":"${$map.item.id}",class:"app-region-no-drag"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/run"},value:[{$ref:"$map/item/id"}]}]},children:[{tagName:"span",attributes:{part:"icon-slot",slot:"icon"},$switch:{$ref:"$map/item/hasIcon"},cases:{true:{tagName:"jx-icon",$props:{name:{$ref:"$map/item/icon"}}}}},{tagName:"span",attributes:{part:"text"},textContent:"${$map.item.title}"}]}}]},{tagName:"div",attributes:{part:"presence-slot",role:"none"},$switch:{$ref:"#/state/presenceVisible"},cases:{true:{tagName:"div",attributes:{part:"presence",title:"${state.presence.title}"},children:[{tagName:"span",attributes:{part:"status","data-status":"${state.presence.status}"},textContent:"${state.presence.label}"},{tagName:"span",attributes:{part:"flag-slot",role:"none"},$switch:{$ref:"#/state/presence/readOnly"},cases:{true:{tagName:"span",attributes:{part:"flag","data-flag":"read-only",title:"You have read access to this session. Your edits show here but are not published to the others."},textContent:"Read-only"}}},{tagName:"span",attributes:{part:"flag-slot",role:"none"},$switch:{$ref:"#/state/presence/frozen"},cases:{true:{tagName:"span",attributes:{part:"flag","data-flag":"frozen",title:"Someone is editing the code view. Structural edits are paused until they stop. This is not an error."},textContent:"Code view held"}}},{$prototype:"Array",items:{$ref:"#/state/presence/peers"},key:{$ref:"$map/item/key"},map:{tagName:"span",attributes:{part:"chip",style:"background: ${$map.item.color}",title:"${$map.item.title}"},$switch:{$ref:"$map/item/hasAvatar"},cases:{true:{tagName:"img",attributes:{src:"${$map.item.avatarUrl}",alt:"${$map.item.initial}"}},false:{tagName:"span",attributes:{part:"initial"},textContent:"${$map.item.initial}"}}}}]}}},{tagName:"div",attributes:{part:"settings-slot",role:"none"},$switch:{$ref:"#/state/settingsVisible"},cases:{true:{tagName:"jx-action-button",$props:{label:"Settings",hint:"Settings",icon:"gear",size:"sm",haspopup:"menu",expanded:{$ref:"#/state/settingsOpen"}},attributes:{"data-menu":"settings",class:"app-region-no-drag"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openSettings"},value:[{$ref:"event#/currentTarget"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{ArrowDown:[{operator:"call",target:{$ref:"#/state/openSettings"},value:[{$ref:"event#/currentTarget"}]},{preventDefault:!0}]}}]}}}},{tagName:"div",attributes:{part:"docks",role:"group","aria-label":"Docks"},children:[{$prototype:"Array",items:{$ref:"#/state/docks"},key:{$ref:"$map/item/id"},map:{tagName:"jx-action-button",$props:{label:{$ref:"$map/item/title"},hint:{$ref:"$map/item/tooltip"},icon:{$ref:"$map/item/icon"},mirror:{$ref:"$map/item/mirror"},toggles:!0,selected:{$ref:"$map/item/selected"},disabled:{$ref:"$map/item/disabled"},size:"sm"},attributes:{"data-command-id":"${$map.item.id}",class:"app-region-no-drag"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/run"},value:[{$ref:"$map/item/id"}]}]}}}]},{tagName:"div",attributes:{part:"csd-trail",role:"none"},$switch:{$ref:"#/state/csd"},cases:{other:{tagName:"div",attributes:{part:"window-controls",role:"group","aria-label":"Window"},children:[{tagName:"jx-action-button",$props:{label:"Minimize",hint:"Minimize",icon:"minus",size:"sm"},attributes:{"data-control":"minimize",class:"app-region-no-drag"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/windowControl"},value:["minimize"]}]}},{tagName:"jx-action-button",$props:{label:"Maximize",hint:"Maximize",icon:"square",size:"sm"},attributes:{"data-control":"maximize",class:"app-region-no-drag"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/windowControl"},value:["maximize"]}]}},{tagName:"jx-action-button",$props:{label:"Close",hint:"Close",icon:"x",size:"sm"},attributes:{"data-control":"close",class:"app-region-no-drag"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/windowControl"},value:["close"]}]}}]}}}]};E("commandbar",dL);var sK=null;function lK(){return sK??navigator.platform.startsWith("Mac")}var pL={frozen:!1,label:"",peers:[],readOnly:!1,status:"unavailable",title:""},cK=[{dock:"left",icon:"sidebar-simple",id:"view.toggleNavigator",mirror:!1},{dock:"right",icon:"sidebar-simple",id:"view.toggleInspector",mirror:!0},{dock:"bottom",icon:"rows",id:"view.toggleBottomDock",mirror:!1}],dK="publish.quick",pK={document:"files",project:"projects",selection:"nodes"},_v=null,zu=null,wl=null,Hu=null,_u=null,br=null;function zv(e,t){let r=e.get(t);if(!r)return"";let o=e.disabledReason(t);if(o)return`${r.title} — requires ${o}`;let a=e.keymap.formatBinding(t);return a?`${r.title} (${a})`:r.title}function uK(e){let t=e?.documentPath?.replace(/^\.\//,"");if(!t)return{reason:"Open a page to view it in a browser."};if(!C?.isSiteProject)return{reason:"This project does not build a site."};if(!t.startsWith("pages/"))return{reason:`Only pages have a route — ${t} is not under pages/.`};let r=nh(t);if(r.includes("*"))return{reason:"Catch-all routes match many pages — open a generated one instead."};let o=Bc(t);if(o.length>0){let i=e?.session.ui.previewParams??{},s=o.filter((l)=>!i[l]);if(s.length>0)return{reason:`Pick a value for ${s.map((f)=>`:${f}`).join(", ")} to open one of this route's pages.`};r=r.replaceAll(/:(\w+)/g,(l,f)=>encodeURIComponent(i[f]))}let a=C.projectConfig?.build?.trailingSlash??"always";return{path:r==="/"?"/":a==="always"?`${r}/`:r}}async function uL(){let e=uK(h.value??null);if(!("path"in e)){w.warn(e.reason,{key:ct,source:"Preview"});return}let t=ye()?p():null;if(!t?.previewSite&&!t?.buildSite){w.warn("This backend cannot preview the site.",{key:ct,source:"Preview"});return}if(t.previewSite){await mK(t.previewSite,e.path);return}await fK(t.buildSite,e.path)}async function mK(e,t){UN(),await US(),w.info("Opening a live preview…",{key:ct,source:"Preview"});let r;try{r=await e({route:t})}catch(o){w.error(`The site could not be previewed: ${Hv(o)}`,{key:ct,source:"Preview"});return}if(!r.url){w.warn("This backend serves no preview of the site.",{key:ct,source:"Preview"});return}if(r.reused){w.info(`Updated your preview tab — switch to your browser to see ${t}`,{key:ct,source:"Preview"});return}if(r.errors.length>0)w.warn(`Previewed with ${r.errors.length} problem(s): ${r.errors[0]}`,{key:ct,source:"Preview"});else w.success(`Opened a live preview of ${r.routes} page(s) — rendered from your working tree, not a build.`,{key:ct,source:"Preview"});Vb(`${r.url}${t}`)}async function fK(e,t){w.info("Building the site…",{key:ct,source:"Preview"});let r;try{r=await e()}catch(a){w.error(`The site could not be built: ${Hv(a)}`,{key:ct,source:"Preview"});return}if(!r.url){w.warn("The site was built, but this backend serves no preview of it.",{key:ct,source:"Preview"});return}let o=r.mode==="live";if(r.errors.length>0){let a=o?"previewed":"built";w.warn(`The site ${a} with ${r.errors.length} error(s): ${r.errors[0]}`,{key:ct,source:"Preview"})}else if(o)w.success(`Opened a live preview of ${r.routes} page(s) — rendered from your working tree, not a build.`,{key:ct,source:"Preview"});else w.success(`Built ${r.routes} page(s).`,{key:ct,source:"Preview"});Vb(`${r.url}${t}`)}async function mL(){let e=ye()?p():null;if(!e?.buildSite){w.warn("This backend cannot build the site.",{key:fl,source:"Build"});return}w.info("Building the site…",{key:fl,source:"Build"});let t;try{t=await e.buildSite()}catch(r){w.error(`The site could not be built: ${Hv(r)}`,{key:fl,source:"Build"});return}if(t.errors.length>0){w.warn(`Built with ${t.errors.length} error(s): ${t.errors[0]}`,{key:fl,source:"Build"});return}w.success(`Built ${t.routes} page(s), ${t.files} file(s).`,{key:fl,source:"Build"})}var fl="project.buildSite",ct="view.openInBrowser";function Hv(e){return e instanceof Error?e.message:String(e)}function hK(e){let t=e?.documentPath;if(!t)return"No document";let r=C?.projectRoot,o=t.replace(/^\.\//,"");return r&&o.startsWith(`${r}/`)?o.slice(r.length+1):o}function gK(e){if(u.layoutSelection)return"layout";let t=om(e);if(t)return t.replaceAll(" "," › ");let r=e?.session.selection??[],o=Oe(r);if(!e||!o)return"";if(r.length>1)return`${r.length} elements`;return kr(oe(e.doc.document,o))}function Bv(){let e=globalThis.__jxPlatform;if(e==null||!("windowControls"in e))return;return e.windowControls}function bK(e){let t=[{key:"project",label:C?.name??"No project",sepBefore:!1,title:"Switch project — opens Project: Open Recent…"},{key:"document",label:hK(e),sepBefore:!0,title:"Go to a file"}],r=gK(e);if(r)t.push({key:"selection",label:r,sepBefore:!0,title:"Go to an element in this document"});return t}function yK(e){if(!e?.get("view.setWorkspace")||!e.isEnabled("view.setWorkspace"))return[];let t=u.git.status?.files.length??0;return Hx.map((r)=>{let o=r.id==="publish"&&t>0?String(t):"",a=e.keymap.formatBinding(`workspace.focus.${r.id}`),i=a?`${r.title} (${a})`:r.title,s=o?`${o} unpublished ${t===1?"change":"changes"}`:"";return{badge:o,description:s,hasBadge:o!=="",icon:r.icon,id:r.id,title:r.title,tooltip:s?`${i}, ${s}`:i}})}function vK(e){if(!e)return[];return e.forPlacement("commandbar/primary").filter((t)=>e.isVisible(t.id)).map((t)=>({disabled:!e.isEnabled(t.id),hasIcon:Boolean(t.icon),icon:t.icon??"",id:t.id,title:t.title,tooltip:zv(e,t.id)}))}function wK(e){if(!e)return[];return cK.flatMap((t)=>{let r=e.get(t.id);if(!r||!e.isVisible(t.id))return[];return[{disabled:!e.isEnabled(t.id),icon:t.icon,id:t.id,mirror:t.mirror,selected:!u.docks[t.dock].collapsed,title:r.title,tooltip:zv(e,t.id)}]})}function fL(e){let t;return e.forPlacement("commandbar/overflow").map((r,o)=>{let a=o>0&&r.group!==t;({group:t}=r);let i=e.isEnabled(r.id),s=e.keymap.formatBinding(r.id),l=i?void 0:e.disabledReason(r.id),f={destructive:r.destructive===!0,disabled:!i,dividerAbove:a,id:r.id,title:r.title};if(s)f.chord=s;if(l)f.requires=l;return f})}function xK(e){if(br){br.close();return}let t=ae();if(!t)return;let r=Vv();br=zt({label:"Studio menu",onClosed:(a)=>{if(br!==a)return;br=null,r.menuOpen=!1},opener:e,place:()=>{let a=Me(e);return{x:a.left,y:a.bottom+4}},region:"studio",rows:fL(t),run:(a)=>{if(t.isEnabled(a))Tn(t,a,void 0,"Command Bar")}}),r.menuOpen=!0}function Vv(){return wl??=g({chord:"",csd:"none",docks:[],hasChord:!1,menuOpen:!1,menuVisible:!1,openPicker:()=>{mb("picker")},openSegment:(e)=>{mb(pK[e])},openSettings:(e)=>{if(!(e instanceof HTMLElement))return;cL(e,{rerender:()=>{if(wl)wl.settingsOpen=Ov()}})},openStudioMenu:xK,presence:pL,presenceVisible:!1,primary:[],run:(e)=>{let t=ae();if(t?.isEnabled(e))Tn(t,e,void 0,"Command Bar")},segments:[],setWorkspace:(e)=>{nt("view.setWorkspace",{workspace:e},"Command Bar")},settingsOpen:!1,settingsVisible:!1,windowControl:(e)=>{Bv()?.[e]()},quickDisabled:!0,quickTooltip:"",quickVisible:!1,workspace:"",workspaces:[],workspacesVisible:!1}),wl}function hL(){let e=Vv(),t=ae(),r=h.value??null,o=Bv();e.csd=o?lK()?"mac":"other":"none",e.menuVisible=t!==null,e.workspaces=yK(t),e.workspacesVisible=e.workspaces.length>0,e.workspace=u.workspace;let a=dK;e.quickVisible=e.workspacesVisible&&t?.get(a)!==void 0&&t.isVisible(a),e.quickDisabled=!e.quickVisible||!t?.isEnabled(a),e.quickTooltip=t&&e.quickVisible?zv(t,a):"",e.settingsVisible=t!==null&&t.forPlacement(Lv).length>0,e.settingsOpen=Ov(),e.segments=bK(r),e.chord=t?.keymap.formatBinding("palette.open")??"",e.hasChord=e.chord!=="",e.primary=vK(t);let i=iL(r);if(e.presence=i??pL,e.presenceVisible=i!==null,e.docks=wK(t),br&&t)br.setRows(fL(t))}function gL(e,t={}){if(kK(),_v=e,Bv())e.classList.add("app-region-drag");zu=me(),zu.run(()=>{te(()=>{u.docks.left.collapsed,u.docks.right.collapsed,u.docks.bottom.collapsed,u.git.status,u.layoutSelection,u.stylebook.selection,u.workspace,m.projectRoot,ae();let r=h.value;if(r)r.doc.document,r.doc.dirty,r.doc.mode,r.session.selection.map((o)=>o.join("/")).join("|"),r.session.ui.canvasMode,r.session.ui.previewParams,r.history.index,r.history.snapshots.length;try{hL()}catch(o){console.error("command bar projection error:",o)}})}),Hu=R("commandbar",Vv(),e),Hu.then((r)=>{_u=r})}function kK(){br?.close(),Mv(),zu?.stop(),zu=null;let e=Hu;if(Hu=null,_u)_u.dispose(),_u=null;else if(e)e.then((t)=>t.dispose());wl=null,_v=null}function Wv(){if(_v)hL()}var SK="jx.ai.pendingAgentPrompt",CK=900000;function Bu(){return typeof localStorage>"u"?void 0:localStorage}function Vu(e){return`${SK}:${e}`}function yL(e){try{let t=Bu()?.getItem(Vu(e));if(!t)return null;let r=JSON.parse(t);if(r===null)return null;let o=v(r)?r.prompt:void 0,a=v(r)?r.ts:void 0;if(!n(o)||!Y(a)||!(Date.now()-a<=CK))return Bu()?.removeItem(Vu(e)),null;return{prompt:o,ts:a}}catch{return null}}function vL(e,t){try{Bu()?.setItem(Vu(e),JSON.stringify({prompt:t,ts:Date.now()}))}catch{}}function wL(e){return yL(e)!==null}function kL(e){let t=yL(e);if(!t)return null;try{Bu()?.removeItem(Vu(e))}catch{}return t.prompt}var TK="inspector.assistant",$L=null,yr=null,qv=null,Uv=!1;function PK(){if(Uv||!yr)return;Uv=!0,P1(yr)}function SL(e){if(!e||$L===e&&yr)return;$L=e,yr=document.createElement("div"),yr.className="ai-panel-host",yr.setAttribute(Ve,TK),e.textContent="",e.append(yr),E1(),Uv=!1,qv?.stop(),qv=me(),qv.run(()=>{te(()=>{if(Hl()==="assistant")PK()}),te(()=>{let t=m.projectRoot;if(!t||!wL(t))return;Ao();let r=kL(t);if(r)requestAnimationFrame(()=>{yv(r)})})})}function CL(){if(yr)We()}var NK="platform:connection",vr=null;function TL(){let e=p().subscribeConnection;if(!e)return null;let t=e(({online:r,reason:o})=>{if(r){if(vr)$h(vr.id),vr=null,w.success("Reconnected to the Jx backend.",{source:"Backend"});return}if(vr)return;vr=w.error(o??"Lost connection to the Jx backend.",{detail:"Editing continues, but anything that reads or writes files will fail until it comes back. Studio is retrying.",key:NK,source:"Backend"})});return()=>{if(t(),vr)$h(vr.id),vr=null}}var EL={$schema:"https://jxsuite.com/schema/v1",$id:"StudioNavigatorDock",$description:"The Navigator dock's one panel host, as a Jx document over the kit. It is deliberately thin — a header naming the panel and its containment level, and one empty `[part=\"content\"]` island — because a Navigator panel is a `PanelRecord` whose `render` returns a lit template, so the BODY cannot be a document and this draws the box around it instead (studio-ui-guidelines.md §9.4). `panels/left-panel.ts` keeps every decision: which record `shell.leftTab` names, whether a context admits it, whether the panel needs a document it does not have, and what `afterRender` is handed. The body is a keyed `$map` of exactly one row, and the KEY IS THE PANEL: four Navigator panels append a mounted document of their own past lit's range inside the content box, and a host that survived a panel switch would leave the Outline standing underneath the file tree. Keying the row on the panel id is what makes switching panels destroy the box those documents are in — the same thing the old lit template bought by rebuilding its own markup, said once instead of relied upon. The region is stamped from the panel's own id, which is what makes `navigator/panel:<id>` DERIVED: renaming a panel renames its region in the same edit instead of leaving a stale selector that photographs the wrong box.",tagName:"div",attributes:{part:"navigator-dock"},style:{$description:"`styles/panels.css`'s `.panel-header*`, `.panel-content` and `.panel-body` rules, keyed on `part` and carried here. `--spectrum-font-size-50` resolved only inside `<sp-theme>` and a document mounts outside it, so both 11px values are `--jx-text-sm`. The root is `display: contents` so the panel body is still `#left-panel`'s own child for layout — the shell cell is the scroller and a box between them would be a second one. And one rule is repaired on the way: the `·` between the title and the level was a `::before` on the level span, and it is drawn only when there IS a header now — the unknown-panel state has none, and a lone separator over an error message reads as a missing word.",display:"contents",'& [part="panel-body"]':{display:"flex",flexDirection:"column",minHeight:"0",padding:"0",fontFamily:"var(--jx-font-sans)",color:"var(--fg)"},'& [part="header"]':{display:"flex",flex:"0 0 auto",alignItems:"baseline",gap:"var(--jx-space-2)",padding:"6px var(--jx-space-3)",borderBottom:"1px solid var(--border)"},'& [part="header-title"]':{fontSize:"var(--jx-text-sm)",fontWeight:"700",letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--fg)"},'& [part="header-level"]':{fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)","::before":{content:'"·"',marginRight:"var(--jx-space-2)"}},'& [part="content"]':{minHeight:"0"}},children:[{$prototype:"Array",items:{$ref:"#/state/panels"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"panel-body","data-panel":"${$map.item.key}","data-jx-region":"${$map.item.region || null}"},children:[{tagName:"div",attributes:{part:"header-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasHeader"},cases:{true:{$description:'The fix for "which panel am I in?". Six of eight panels had no header at all, and the Imports panel silently changed meaning based on whether the focused document was `project.json`. Every panel now renders under its title AND its level ("FILES · project"), so the containment model is legible from the screen rather than only from the matrix: a badge on a `project` panel does not go away when the last tab closes, and a `document` panel says out loud that it is about the file in front of you.',tagName:"header",attributes:{part:"header"},children:[{tagName:"span",attributes:{part:"header-title"},textContent:"${$map.item.title}"},{tagName:"span",attributes:{part:"header-level"},textContent:"${$map.item.level}"}]}}},{$description:"The island, and it is empty for as long as this panel is the one showing: `panels/left-panel.ts` renders the record's own template here, and the four panels that are themselves mounted documents append past lit's range — the same seam they used when this box was a `.panel-content` lit rendered `nothing` into.",tagName:"div",attributes:{part:"content"}}]}}]};E("navigator-dock",EL);function RK(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function AK(e){let t=e?.$map,r=v(t)?t.item:void 0;return v(r)?r:null}function NL(e,t,r){let o=g({panels:t.panels});e.textContent="",delete e._$litPart$;let a=null,i=!1;return R("navigator-dock",o,e,{onNodeCreated:(s,l,f,c)=>{if(!(s instanceof HTMLElement)||RK(f)!=="content")return;let d=AK(c)?.key;if(n(d))r.onContent(d,s)}}).then((s)=>{if(i){s.dispose();return}a=s}),{dispose(){i=!0,a?.dispose(),a=null},update:(s)=>{o.panels=s.panels}}}var DL=null,RL=null,Jv=null,xa=null;function _L(e){DL=e,es(),Jv=NL(of(Th,"left-panel"),{panels:[YL()]},{onContent:(t,r)=>{let o=xa!==null&&xa.panelId!==t;if(xa={host:r,panelId:t},o)requestAnimationFrame(()=>{if(xa?.host===r)of(Th,"left-panel").scrollTop=0});queueMicrotask(()=>{if(xa?.host===r)ZL()})}}),RL=me(),RL.run(()=>{te(()=>{u.leftTab;let t=h.value;if(t)t.doc.document,t.doc.mode,t.session.ui.canvasMode,t.session.selection.map((r)=>r.join("/")).join("|");xl()})})}function xl(){if(!Jv)return;Jv.update({panels:[YL()]}),ZL()}function qL(){let e=Np(u.leftTab);return e&&sx(e,th())?e:null}function YL(){let e=qL();if(!e)return{hasHeader:!1,key:u.leftTab,level:"",region:"",title:""};return{hasHeader:!0,key:e.id,level:e.level,region:UM(e.id),title:e.title}}function IK(){let e=h.value;if(!e)return null;return{canvas:e.session.canvas,content:e.doc.content,document:e.doc.document,documentPath:e.documentPath,mode:e.doc.mode,selection:e.session.selection,ui:e.session.ui}}function ZL(){let e=DL,t=xa;if(!e||!t)return;let r=qL();if((r?.id??u.leftTab)!==t.panelId)return;try{IL(e,r,t.host)}catch(o){console.error("left-panel render error:",o);try{t.host.textContent="",delete t.host._$litPart$,IL(e,r,t.host)}catch(a){console.error("left-panel retry failed:",a)}}}function IL(e,t,r){if(!t){io(Pu(r,{message:`No Navigator panel is registered as "${u.leftTab}".`}),r);return}let o=IK(),a={deps:e,doc:o,rerender:xl},i=o===null?t.requiresDocument:void 0;if(io(i===void 0?t.render(a):Pu(r,{actions:[Mc()],message:i}),r),i===void 0)t.afterRender?.(a,r)}function Xv(e,t,r,o){let a=qA(e,o,r);return{drop:{cursor:a,dragSeq:t,kind:"drop"},move:{cursor:a,dragSeq:t,kind:"dragMove"}}}function Gv(e){return{x:e.current.input.clientX,y:e.current.input.clientY}}function Kv(e){if(e.type==="block"){let t=e.fragment?.tagName;return n(t)?{tag:t,type:"block"}:{type:"block"}}if(e.type==="tree-node"&&Array.isArray(e.path))return{path:e.path,type:"tree-node"};return null}function mO(e,t,r){if(t.type==="block"){let i=r.fragment;return it(i?.tagName)||"block"}let o=e?.doc.document,a=o?oe(o,t.path):void 0;return it(a?.tagName)||"node"}var fO=250;function Yv(e,t,r){let o=Zb(e,t,r);return{host:e,label:mO(C$(e),t,r),seq:o,src:t,srcData:r}}function pO(e,t){RC(t.x,t.y);let r=Yb(t);if(r===e.host){if(r){let{rect:i,scale:s}=tc(r);Vc(r,Xv(t,e.seq,s,i).move)}return}if(e.host)Vc(e.host,{dragSeq:e.seq,kind:"dragEnd"});if(!r){e.host=null;return}e.host=r,e.seq=Zb(r,e.src,e.srcData);let{rect:o,scale:a}=tc(r);Vc(r,Xv(t,e.seq,a,o).move)}function OK(e,t){let r=Yb(t);if(r&&r!==e.host){if(e.host)Vc(e.host,{dragSeq:e.seq,kind:"dragEnd"});e.host=r,e.seq=Zb(r,e.src,e.srcData)}if(!r){if(e.host)Vc(e.host,{dragSeq:e.seq,kind:"dragEnd"});gx(e.seq),ch();return}let{rect:o,scale:a}=tc(r);Vc(r,Xv(t,e.seq,a,o).drop);let{seq:i}=e;setTimeout(()=>{if(NC()===i)ch(),bx(r)},fO)}function MK(e){if(e.host)Vc(e.host,{dragSeq:e.seq,kind:"dragEnd"}),bx(e.host);gx(e.seq),ch()}function DK(e){let{initial:t}=e;if(!t)return!1;return t.input.clientX===e.current.input.clientX&&t.input.clientY===e.current.input.clientY}function hO(){let e=null,t=null;return h$((r)=>{if(!t||e?.host===r)return;if(e){if(e.host)Vc(e.host,{dragSeq:e.seq,kind:"dragEnd"});e.host=r,e.seq=Zb(r,e.src,e.srcData);return}e=Yv(r,t.src,t.srcData)}),Js({onDrag({source:r,location:o}){let a=Kv(r.data);if(!a)return;let i=Gv(o);if(e){pO(e,i);return}let s=Yb(i);if(s)e=Yv(s,a,r.data),i$(e.label,i.x,i.y),pO(e,i)},onDragStart({source:r,location:o}){let a=Kv(r.data);if(!a)return;t={src:a,srcData:r.data};let i=Gv(o),s=Yb(i);e=s?Yv(s,a,r.data):null,i$(e?e.label:mO(h.value,a,r.data),i.x,i.y)},onDrop({source:r,location:o}){if(!Kv(r.data))return;t=null;let i=Gv(o);if(!e){ch();return}if(o$(e.seq)){let{host:s,seq:l}=e;e=null,setTimeout(()=>{if(NC()!==l)return;if(s)Vc(s,{dragSeq:l,kind:"dragEnd"}),bx(s);gx(l),ch()},fO);return}if(DK(o))MK(e);else OK(e,i);e=null}})}var yO={$schema:"https://jxsuite.com/schema/v1",$id:"StudioNewProject",$description:"The New Project wizard: two steps in one dialog. Step 1 asks where the site comes from — a starter gallery that ends with one Start from scratch card, an Import of a site that already exists, or an Agent brief — and step 2 asks what it is called and where it is written. A `jx-dialog`, so the platform owns modality, Escape, focus restoration and the backdrop, which is what retired the fixed `.new-project-modal` card, the `<sp-underlay>` beside it, the `z-index: 1000` that card needed to climb back out from under its own scrim, and the hand-drawn header with its own close button. The footer is the dialog's too: Cancel, Back and the primary are `cancelLabel`, `secondaryLabel` and `confirmLabel`, so the wizard says which answers exist by naming them rather than by drawing three buttons per step. Nothing here knows what a starter is, which platform writes to a repository rather than a folder, what makes an AI gate open, or how a breakpoint policy is spelled — `new-project/new-project-modal.ts` keeps the flow, `new-project/import-tab.ts` the brief and `new-project/location-fields.ts` the destination, and all three hand over strings, flags and one discriminant per branch. The three AI controllers are islands: their own mounted documents, placed by the adapter into boxes this document renders empty (studio-ui-guidelines.md §9.4).",tagName:"jx-dialog",$props:{headline:{$ref:"#/state/headline"},confirmLabel:{$ref:"#/state/confirmLabel"},secondaryLabel:{$ref:"#/state/secondaryLabel"},cancelLabel:"Cancel",dismissible:!0,size:"lg"},attributes:{part:"new-project"},oncancel:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},onclose:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},onconfirm:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/confirm"},value:[]}]},onsecondary:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/secondary"},value:[]}]},style:{$description:"Forty-three `.new-project-*` rules in `styles/overlays.css` become the parts below, and eight of them do not travel. `.new-project-modal` was a fixed, centred, bordered, shadowed card with its own width and `z-index: 1000`, and a modal `<dialog>` is every one of those; `.new-project-modal-header`, `.new-project-modal-title`, `.new-project-modal-body` and `.new-project-modal-footer` are the header, headline, scroll body and button row `jx-dialog` already draws; `.new-project-tabs` drew a rule under the strip that `jx-tabs` draws itself; `.new-project-error--global` pinned the backend error outside the scroll body, which a dialog that scrolls as one has nowhere to put; and `.new-project-field` / `.new-project-label` drew a label above a control, which is `jx-field` with `span` — with the label actually NAMING the control, which a bare `<span>` beside a textfield never did. Three repairs travel with the rest. Every `--spectrum-font-size-*` reference is gone: those names resolve only inside `<sp-theme>` and a document mounted in the dialog layer is outside it, so all eleven would silently have taken their hard-coded fallback. `var(--accent, #3b82f6)` on the selected card loses the hex, which was the same bug written the other way round. And the two thumbnail wells read `var(--bg-elevated, #1a1a1a)` for a token no stylesheet in this package defines, so the fallback was not a fallback — it was the value; they take `--bg-input`, which is the recessed surface the rest of the chrome uses.",'& [part="wizard"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-4)",fontFamily:"var(--jx-font-sans)",color:"var(--fg)"},'& [part="blurb"]':{$description:'The sentence at the top of a source tab: what this path does, before any field asks for anything. `blurb` rather than `intro`, and the footnote below is `footnote` rather than `note`, because the three AI controllers mount their own documents INSIDE this one: `surfaces/ai-managed-connect.json` draws a `[part="intro"]` and `surfaces/ai-credentials-form.json` a `[part="note"]`, and a scoped rule on either name would restyle a surface this document does not own.',margin:"0",fontSize:"var(--jx-text-md)",lineHeight:"var(--jx-leading-lg)",color:"var(--fg-dim)"},'& [part="gallery"]':{display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gap:"var(--jx-space-3)"},'& [part="card"]':{$description:"A whole card is the button, because the answer is the starter rather than a control inside it. `font: inherit` because a `<button>` does not inherit type, and what it inherits here is the dialog's own body size rather than a number this surface picked.",display:"flex",flexDirection:"column",overflow:"hidden",padding:"0",border:"1px solid var(--border)",borderRadius:"var(--jx-radius-md)",background:"var(--bg-panel)",font:"inherit",color:"var(--fg)",textAlign:"left",cursor:"pointer","&:hover":{borderColor:"var(--fg-dim)"},"&[data-selected]":{borderColor:"var(--accent)",boxShadow:"0 0 0 1px var(--accent)"},'&[data-art="blank"]':{$description:"The one non-starter card, last in the gallery and spanning it, so the sites lead.",gridColumn:"1 / -1",flexDirection:"row",alignItems:"center",'& [part="blank"]':{width:"96px",flexShrink:"0"}}},'& [part="thumb"]':{display:"block",width:"100%",aspectRatio:"16 / 10",objectFit:"cover",background:"var(--bg-input)"},'& [part="blank"]':{display:"flex",alignItems:"center",justifyContent:"center",aspectRatio:"16 / 10",background:"var(--bg-input)",fontSize:"28px",color:"var(--fg-dim)"},'& [part="card-body"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-1)",padding:"var(--jx-space-2) var(--jx-space-3) var(--jx-space-3)"},'& [part="card-name"]':{fontSize:"var(--jx-text-md)",fontWeight:"600"},'& [part="card-tag"]':{fontSize:"var(--jx-text-sm)",lineHeight:"var(--jx-leading-sm)",color:"var(--fg-dim)"},'& [part="creds"]':{$description:"The gate's column: the keyless offer above the key form, both of them mounted documents of their own. `max-width` so three text fields do not stretch to the width of a large dialog.",display:"flex",flexDirection:"column",maxWidth:"480px"},'& [part="managed-island"], & [part="creds-island"], & [part="model-island"]':{$description:"An island's box lays nothing out: each controller's own host is `display: contents`, so what the column above sees is the mounted document's own root and not a wrapper that would become the flex item in its place.",display:"contents"},'& [part="grid"]':{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"var(--jx-space-4)"},'& [part="breakpoints"]':{$description:"A mode picker, whichever value control that mode takes, and the rounding rule. It wraps rather than scrolls — the widths field is the one that needs room, and it should get it.",display:"flex",flexWrap:"wrap",alignItems:"center",gap:"var(--jx-space-3)"},'& [part="bp-mode"], & [part="bp-rounding"]':{minWidth:"132px"},'& [part="bp-count"], & [part="min-fidelity"]':{width:"96px"},'& [part="bp-widths"]':{flex:"1",minWidth:"160px"},'& [part="location-row-controls"]':{$description:"The Location field takes the slack; Browse… stays its natural width.",display:"flex",alignItems:"center",gap:"var(--jx-space-3)"},'& [part="url"], & [part="prompt"], & [part="import-prompt"], & [part="name"], & [part="slug"], & [part="location"], & [part="owner"], & [part="visibility"]':{$description:"The kit's fields are `inline-flex`, which is right in a row of controls and wrong for the one control of a `span` row. Named one by one rather than as `& jx-textfield`, because the credentials island below is three more text fields in the same tree and none of them is this document's to size.",display:"flex",width:"100%"},'& [part="context"]':{$description:"WHICH source this project is being made from, said on the step that no longer shows the tab strip.",margin:"0",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"},'& [part="destination-preview"]':{$description:"Live preview of where the project will land — the answer to “where did that go?”.",margin:"0",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)",overflowWrap:"anywhere"},'& [part="destination-target"]':{fontFamily:"var(--font-mono)",color:"var(--fg)"},'& [part="footnote"]':{margin:"0",fontSize:"var(--jx-text-md)",lineHeight:"var(--jx-leading-lg)",color:"var(--fg-dim)"},'& [part="name-failure"], & [part="destination-failure"], & [part="import-failure"], & [part="failure"]':{$description:'Four refusals, one look, and none of them called `error`: `jx-textfield` and `jx-field` both draw a `[part="error"]` of their own inside this same tree, and the kit is light DOM, so a scoped rule on that name would restyle every field\'s own error line.',margin:"0",fontSize:"var(--jx-text-md)",color:"var(--danger)"},'& [part="failure"]':{$description:"The backend's refusal, said at the end of the body so it sits directly above the footer the reader is about to press again. It used to be pinned outside the scroll box; a dialog scrolls as one, so what replaces the pin is being last.",display:"flex",flexWrap:"wrap",gap:"var(--jx-space-2)",paddingTop:"var(--jx-space-3)",borderTop:"1px solid var(--border)"},'& [part="install"]':{color:"var(--accent)",textDecoration:"underline"}},children:[{tagName:"div",attributes:{part:"wizard"},children:[{tagName:"div",attributes:{part:"tabs-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/showTabs"},cases:{true:{tagName:"jx-tabs",attributes:{part:"tabs"},$props:{label:"Where the project comes from",selected:{$ref:"#/state/tab"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/pickTab"},value:[{$ref:"event#/detail"}]}]},children:[{$prototype:"Array",items:{$ref:"#/state/tabs"},key:{$ref:"$map/item/value"},map:{tagName:"jx-tab",attributes:{part:"tab",value:"${$map.item.value}",label:"${$map.item.label}"}}}]}}},{tagName:"div",attributes:{part:"body-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/body"},cases:{starter:{tagName:"div",attributes:{part:"starter",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"blurb"},textContent:"Every starter is a complete site copied in as plain files you own — open it, look at it, then make it yours."},{tagName:"div",attributes:{part:"gallery"},children:[{$prototype:"Array",items:{$ref:"#/state/cards"},key:{$ref:"$map/item/id"},map:{tagName:"button",attributes:{part:"card",type:"button","data-starter":"${$map.item.id}","data-art":"${$map.item.art}","data-selected":"${$map.item.selected ? '' : null}","aria-pressed":"${$map.item.selected ? 'true' : 'false'}",title:"${$map.item.title || null}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/pickCard"},value:[{$ref:"$map/item/id"}]}]},children:[{tagName:"div",attributes:{part:"art-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/art"},cases:{thumb:{tagName:"img",attributes:{part:"thumb",src:"${$map.item.thumbnail}",alt:""}},blank:{tagName:"span",attributes:{part:"blank","aria-hidden":"true"},textContent:"+"}}},{tagName:"span",attributes:{part:"card-body"},children:[{tagName:"span",attributes:{part:"card-name"},textContent:"${$map.item.name}"},{tagName:"span",attributes:{part:"card-tag"},textContent:"${$map.item.tagline}"}]}]}}]}]},gate:{tagName:"div",attributes:{part:"gate",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"blurb"},textContent:"${state.gateIntro}"},{tagName:"div",attributes:{part:"creds"},children:[{tagName:"div",$description:"Where `ui/ai-managed-connect.ts`'s own mounted document goes. The node is rendered EMPTY and the adapter puts the controller's host inside it — the one seam a foreign mount may arrive through (specs/studio-ui-guidelines.md §9.4). It is drawn even when the platform brokers nothing, because the controller answers that question itself and hands back nothing to place.",attributes:{part:"managed-island",role:"none"}},{tagName:"div",$description:"Where `ui/ai-credentials-form.ts`'s own mounted document goes. Three fields a reader is typing into, so it must survive every repaint of the wizard around it: the document renders this box and never its contents, and the adapter places the same host node back into it rather than rebuilding one.",attributes:{part:"creds-island",role:"none"}}]}]},agent:{tagName:"div",attributes:{part:"agent",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"blurb"},textContent:"Describe the site you want; the assistant builds it in the editor while you watch."},{tagName:"jx-field",attributes:{part:"agent-row"},$props:{span:!0,label:"Prompt",required:!0},children:[{tagName:"jx-textfield",attributes:{part:"prompt"},$props:{size:"sm",value:{$ref:"#/state/agentPrompt"},placeholder:"A landing page for a small coffee roastery with a menu and contact form…",multiline:!0,rows:"6"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setAgentPrompt"},value:[{$ref:"event#/target/value"}]}]}}]}]},import:{tagName:"div",attributes:{part:"import",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"blurb"},textContent:"Clone an existing site into an editable Jx project: pages, styles, assets, and components."},{tagName:"jx-field",attributes:{part:"url-row"},$props:{span:!0,label:"Site URL",required:!0},children:[{tagName:"jx-textfield",attributes:{part:"url"},$props:{size:"sm",value:{$ref:"#/state/url"},placeholder:"https://example.com",type:"url"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setUrl"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"div",attributes:{part:"grid"},children:[{tagName:"jx-field",attributes:{part:"depth-row"},$props:{span:!0,label:"Crawl Depth"},children:[{tagName:"jx-number-field",attributes:{part:"depth"},$props:{size:"sm",label:"Crawl Depth",min:"0",max:{$ref:"#/state/maxDepth"},value:{$ref:"#/state/depth"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setDepth"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",attributes:{part:"pages-row"},$props:{span:!0,label:"Max Pages"},children:[{tagName:"jx-number-field",attributes:{part:"max-pages"},$props:{size:"sm",label:"Max Pages",min:"1",max:"100",value:{$ref:"#/state/maxPages"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setMaxPages"},value:[{$ref:"event#/target/value"}]}]}}]}]},{tagName:"jx-field",attributes:{part:"breakpoints-row"},$props:{span:!0,label:"Breakpoints",description:"${state.breakpointHint}"},children:[{tagName:"div",attributes:{part:"breakpoints"},children:[{tagName:"jx-select",attributes:{part:"bp-mode"},$props:{size:"sm",label:"Breakpoints",value:{$ref:"#/state/breakpointMode"},options:{$ref:"#/state/breakpointModes"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setBreakpointMode"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"div",attributes:{part:"bp-value-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/breakpointValue"},cases:{count:{tagName:"jx-number-field",attributes:{part:"bp-count"},$props:{size:"sm",label:"How many breakpoints to keep",min:"1",max:{$ref:"#/state/maxBreakpoints"},value:{$ref:"#/state/breakpointCount"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setBreakpointCount"},value:[{$ref:"event#/target/value"}]}]}},widths:{tagName:"jx-textfield",attributes:{part:"bp-widths"},$props:{size:"sm",value:{$ref:"#/state/breakpointWidths"},label:"Breakpoint widths",placeholder:"640, 1024, 1440"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setBreakpointWidths"},value:[{$ref:"event#/target/value"}]}]}}}},{tagName:"div",attributes:{part:"bp-rounding-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/showRounding"},cases:{true:{tagName:"jx-select",attributes:{part:"bp-rounding"},$props:{size:"sm",label:"Rounding",value:{$ref:"#/state/breakpointRounding"},options:{$ref:"#/state/roundings"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setBreakpointRounding"},value:[{$ref:"event#/target/value"}]}]}}}}]}]},{tagName:"jx-switch",attributes:{part:"ai-naming"},$props:{size:"sm",checked:{$ref:"#/state/aiNaming"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setAiNaming"},value:[{$ref:"event#/target/checked"}]}]},children:[{tagName:"span",textContent:"AI component naming"}]},{tagName:"div",attributes:{part:"verify-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/canVerify"},cases:{true:{tagName:"jx-switch",attributes:{part:"verify"},$props:{size:"sm",checked:{$ref:"#/state/verify"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setVerify"},value:[{$ref:"event#/target/checked"}]}]},children:[{tagName:"span",textContent:"Check fidelity against the original (slower)"}]}}},{tagName:"div",attributes:{part:"fidelity-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/showFidelity"},cases:{true:{tagName:"jx-field",attributes:{part:"fidelity-row"},$props:{span:!0,label:"Minimum fidelity",description:"Below this average, the assistant reports that the clone did not match the original. A floor rather than a target: a faithful import of a complicated site still lands well under 100. Set 0 to report the score without judging it."},children:[{tagName:"jx-number-field",attributes:{part:"min-fidelity"},$props:{size:"sm",label:"Minimum fidelity",min:"0",max:"100",value:{$ref:"#/state/minFidelity"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setMinFidelity"},value:[{$ref:"event#/target/value"}]}]}}]}}},{tagName:"jx-field",attributes:{part:"model-row"},$props:{span:!0,label:"Model"},children:[{tagName:"div",$description:"Where `ui/ai-model-picker.ts`'s own mounted document goes. The picker holds the in-flight catalogue fetch and the credentials the last failure belonged to, so it is one controller for the life of the wizard and this box is only ever where its host is put.",attributes:{part:"model-island",role:"none"}}]},{tagName:"jx-field",attributes:{part:"brief-row"},$props:{span:!0,label:"What should the assistant do with it?"},children:[{tagName:"jx-textfield",attributes:{part:"import-prompt"},$props:{size:"sm",value:{$ref:"#/state/importPrompt"},placeholder:"Keep the layout but modernise the typography, and turn the news list into a content collection…",multiline:!0,rows:"4"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setImportPrompt"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"div",attributes:{part:"import-failure-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasImportError"},cases:{true:{tagName:"p",attributes:{part:"import-failure",role:"alert"},textContent:"${state.importError}"}}}]},params:{tagName:"div",attributes:{part:"params",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"context"},textContent:"${state.contextLabel}"},{tagName:"jx-field",attributes:{part:"name-row","data-invalid":"${state.hasNameError ? '' : null}"},$props:{span:!0,label:"Project Name",required:!0},children:[{tagName:"jx-textfield",attributes:{part:"name"},$props:{size:"sm",value:{$ref:"#/state/name"},label:"Project Name",placeholder:"My Site",invalid:{$ref:"#/state/hasNameError"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setName"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"div",attributes:{part:"name-failure-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasNameError"},cases:{true:{tagName:"p",attributes:{part:"name-failure",role:"alert"},textContent:"${state.nameError}"}}},{tagName:"div",attributes:{part:"destination-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/destination"},cases:{path:{tagName:"div",attributes:{part:"path-fields",role:"none"},style:{display:"contents"},children:[{tagName:"jx-field",attributes:{part:"location-row"},$props:{span:!0,label:"Location",required:!0},children:[{tagName:"div",attributes:{part:"location-row-controls"},children:[{tagName:"jx-textfield",attributes:{part:"location"},$props:{size:"sm",value:{$ref:"#/state/parent"},label:"Location",placeholder:"${state.parentPlaceholder}"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setParent"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"div",attributes:{part:"browse-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/canBrowse"},cases:{true:{tagName:"jx-button",attributes:{part:"browse"},$props:{size:"sm",disabled:{$ref:"#/state/browsing"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/browse"},value:[]}]},children:[{tagName:"span",textContent:"${state.browseLabel}"}]}}}]}]}]},repo:{tagName:"div",attributes:{part:"repo-fields",role:"none"},style:{display:"contents"},children:[{tagName:"jx-field",attributes:{part:"owner-row"},$props:{span:!0,label:"Owner",required:!0},children:[{tagName:"div",attributes:{part:"owner-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasOwners"},cases:{true:{tagName:"jx-select",attributes:{part:"owner"},$props:{size:"sm",label:"Owner",value:{$ref:"#/state/owner"},options:{$ref:"#/state/owners"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setOwner"},value:[{$ref:"event#/target/value"}]}]}},false:{tagName:"jx-textfield",attributes:{part:"owner"},$props:{size:"sm",value:{$ref:"#/state/owner"},label:"Owner",placeholder:"your-account-or-org"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setOwner"},value:[{$ref:"event#/target/value"}]}]}}}}]}]}}},{tagName:"jx-field",attributes:{part:"slug-row"},$props:{span:!0,label:"${state.slugLabel}"},children:[{tagName:"jx-textfield",attributes:{part:"slug"},$props:{size:"sm",value:{$ref:"#/state/slug"},label:"${state.slugLabel}",placeholder:"my-site"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setSlug"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"div",attributes:{part:"taken-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasRepoTaken"},cases:{true:{tagName:"p",attributes:{part:"destination-failure"},textContent:"${state.repoTaken}"}}},{tagName:"div",attributes:{part:"visibility-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/destination"},cases:{repo:{tagName:"jx-field",attributes:{part:"visibility-row"},$props:{span:!0,label:"Visibility"},children:[{tagName:"jx-select",attributes:{part:"visibility"},$props:{size:"sm",label:"Visibility",value:{$ref:"#/state/visibility"},options:{$ref:"#/state/visibilities"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setVisibility"},value:[{$ref:"event#/target/value"}]}]}}]}}},{tagName:"p",attributes:{part:"destination-preview"},children:[{tagName:"span",textContent:"${state.previewLabel}: "},{tagName:"code",attributes:{part:"destination-target"},textContent:"${state.preview}"}]},{tagName:"div",attributes:{part:"destination-failure-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasDestinationError"},cases:{true:{tagName:"p",attributes:{part:"destination-failure",role:"alert"},textContent:"${state.destinationError}"}}},{tagName:"p",attributes:{part:"footnote"},textContent:"${state.note}"}]}}},{tagName:"div",attributes:{part:"failure-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasError"},cases:{true:{tagName:"p",attributes:{part:"failure",role:"alert"},children:[{tagName:"span",textContent:"${state.error}"},{tagName:"span",attributes:{part:"install-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasInstallUrl"},cases:{true:{tagName:"a",attributes:{part:"install",href:"${state.errorInstallUrl}",target:"_blank",rel:"noreferrer"},textContent:"Install the Jx Suite GitHub App →"}}}]}}}]}]};E("new-project",yO);function vO(e){return{...e,breakpointValue:e.breakpointMode==="limit"?"count":e.breakpointMode==="explicit"?"widths":"none",hasDestinationError:e.destinationError!=="",hasError:e.error!=="",hasImportError:e.importError!=="",hasInstallUrl:e.errorInstallUrl!=="",hasNameError:e.nameError!=="",hasOwners:e.owners.length>0,hasRepoTaken:e.repoTaken!=="",showFidelity:e.canVerify&&e.verify,showRounding:e.breakpointMode!=="all"}}function _K(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function kO(e){let t=document.createElement("div");t.style.pointerEvents="auto",e.layer.append(t);let r=!1,o=()=>{if(r)return;r=!0,e.actions.closed()},a=()=>r,i=new Map,s=()=>{for(let[d,b]of i){let x=(d==="creds-island"?e.islands.creds:d==="managed-island"?e.islands.managed:e.islands.model)();if(x&&x.parentNode!==b)b.append(x)}},l=g({...vO(e.view),...e.actions,browse:()=>{e.actions.browse()},closed:o}),f=null,c=R("new-project",l,t,{onNodeCreated:(d,b,y)=>{let x=_K(y);if(d instanceof HTMLElement&&x.endsWith("-island"))i.set(x,d),s()}}).then(async(d)=>{f=d;let b=d.root;if(a())return d.dispose(),b;if(await sn(b),a())return b;return(b.querySelector('dialog[part="dialog"]')??b).setAttribute(Ve,vt("dialog","new-project")),Jt(b),s(),b});return{close(){let d=f?.root;if(d instanceof HTMLElement)Ut(d);f?.dispose(),f=null,i.clear(),t.remove(),o()},focusName(){let d=f?.root;if(!(d instanceof HTMLElement))return;requestAnimationFrame(()=>{d.querySelector('[part="dialog"]')?.scrollTo(0,0),d.querySelector('[part="name"] [part="input"]')?.focus()})},host:t,ready:c,update(d){Object.assign(l,vO(d)),s()}}}var zK=/^(?:[a-zA-Z]:[/\\]|\/)/,Ta="",Cn="",Gu=!0,Wu=[],Qv=null,Et="",Sa=!1;function TO(){Ta="",Cn="",Gu=!0,Wu=[],Qv=null,Et="",Sa=!1}function PO(e){let t=p();if(t.createDestination!=="repo")return;let r=new Set;Promise.allSettled([t.getAccountStatus?.().then((o)=>{for(let a of o?.installations??[])if(a.account)r.add(a.account)}),t.listRepos?.().then((o)=>{Qv=o;for(let a of o)r.add(a.owner)})]).then(()=>{Wu=[...r].toSorted((o,a)=>o.localeCompare(a)),Cn||=Wu[0]??"",e()})}function HK(){return p().createDestination==="repo"?"Repository":"Directory"}function NO(e){if(Et="",p().createDestination==="repo"){if(!Cn.trim())return Et="Choose an owner for the repository",null;if(!e.trim())return Et="Repository name is required",null;return{kind:"repo",owner:Cn.trim(),private:Gu,repo:e.trim()}}let t=Ta.trim();if(!t)return Et="Choose a location for the project folder",null;if(!zK.test(t))return Et="Location must be an absolute path",null;if(!e.trim())return Et="Directory name is required",null;return{kind:"path",parent:RO(t)}}function RO(e){return e.replace(/[/\\]+$/,"")||e}function AO(e,t){let r=e.includes("\\")&&!e.includes("/")?"\\":"/";return e.endsWith("/")||e.endsWith("\\")?`${e}${t}`:`${e}${r}${t}`}function IO(e,t){if(e.kind==="repo")return`${e.owner}/${e.repo||t.trim()}`;return AO(e.parent,t.trim())}function BK(e){let t=e.trim()||"…";if(p().createDestination==="repo")return`${Cn.trim()||"…"}/${t}`;let r=RO(Ta.trim());return r?AO(r,t):`…/${t}`}function VK(e){let t=`${Cn.trim()}/${e.trim()}`.toLowerCase();return(Qv??[]).some((r)=>r.fullName.toLowerCase()===t)}function OO(e){let t=p(),r=t.createDestination==="repo";return{browseLabel:Sa?"Choosing…":"Browse…",browsing:Sa,canBrowse:Q(t.pickDirectory),destination:r?"repo":"path",error:Et,owner:Cn,owners:Wu.map((o)=>({label:o,value:o})),parent:Ta,parentPlaceholder:t.pickDirectory?"Choose a folder to create the project in":"/absolute/path/to/your/projects",preview:BK(e),previewLabel:r?"Repository":"Creates",repoTaken:r&&VK(e)?`${Cn}/${e.trim()} already exists — choose another name.`:"",slugLabel:HK(),visibility:Gu?"private":"public"}}function MO(e){Ta=e,Et=""}function FO(e){Cn=e,Et=""}function zO(e){Gu=e!=="public"}async function HO(e){let t=p();if(!t.pickDirectory||Sa)return;Sa=!0,e();try{let r=await t.pickDirectory();if(r)Ta=r,Et=""}catch(r){Et=X(r)||"The folder could not be chosen. Type its path into Location instead."}finally{Sa=!1,e()}}var Ra="",Xu=1,Zu=20,Pn="limit",em=3,tm="",kl="nearest",nm=!0,Yu="",im="",pm=!1,mm=25,Aa="",VO=!1;function WO(){Ra="",Xu=1,Zu=20,Pn="limit",em=3,tm="",kl="nearest",nm=!0,Yu="",im="",pm=!1,mm=25,Aa="",VO=!1}var KO=null,BO=null;function WK(){return BO??=gu({getModel:()=>Yu||Xl(),onChange:(e)=>{Yu=e},requestRender:()=>KO?.(),width:"fill"}),BO}function YO(){return WK().render()}function qK(){if(Pn==="all")return{mode:"all"};if(Pn==="explicit"){let e=tm.split(",").map((t)=>Math.trunc(Number(t.trim()))).filter((t)=>Number.isFinite(t)&&t>0);if(e.length>0)return{mode:"explicit",rounding:kl,widths:e}}return{count:em,mode:"limit",rounding:kl}}function ZO(){return p().createDestination!=="repo"}function UK(e){return e.toLowerCase().replaceAll(/[^a-z0-9]+/g,"-").replaceAll(/^-|-$/g,"")}function iM(e){let t=null;try{t=new URL(Ra.trim())}catch{t=null}if(!t||t.protocol!=="http:"&&t.protocol!=="https:")return Aa="Enter a valid URL (e.g. https://example.com)",e.rerender(),!1;return Aa="",!0}function JK(e){let t;try{t=new URL(Ra.trim())}catch{return Aa="Enter a valid URL (e.g. https://example.com)",e.rerender(),null}if(t.protocol!=="http:"&&t.protocol!=="https:")return Aa="The URL must start with http:// or https://",e.rerender(),null;let r=e.resolveDestination();if(!r)return null;return{aiComponents:nm,breakpoints:qK(),depth:Xu,directory:IO(r,e.form.directory),maxPages:Zu,model:Yu,name:e.form.name.trim(),prompt:im.trim(),minFidelity:mm,url:t.href,verify:ZO()&&pm}}function sM(e){if(!p().importSite)return;let t=JK(e);if(!t)return;zN(t),e.onHandoff(t)}function lM(){return"Import Site"}function GK(){if(Pn==="all")return"Every breakpoint the site declares becomes a canvas size. Real sites often declare nine.";if(Pn==="explicit")return"The project gets these widths, each backed by the declared width nearest it.";return"Evenly spaced across the widths the site declares — the narrowest, the widest, and the ones between."}function cM(e){return KO=e.rerender,{aiNaming:nm,breakpointCount:String(em),breakpointHint:GK(),breakpointMode:Pn,breakpointModes:[{label:"Limit to",value:"limit"},{label:"Custom widths",value:"explicit"},{label:"Keep all",value:"all"}],breakpointRounding:kl,breakpointValue:Pn==="limit"?"count":Pn==="explicit"?"widths":"none",breakpointWidths:tm,canVerify:ZO(),depth:String(Xu),error:Aa,maxBreakpoints:String(PL),maxDepth:String(jd),maxPages:String(Zu),minFidelity:String(mm),prompt:im,roundings:[{label:"nearest",value:"nearest"},{label:"round down",value:"down"},{label:"round up",value:"up"}],url:Ra,verify:pm}}function gM(e,t){if(Ra=t,e.form.name.trim())return;try{let r=new URL(Ra).hostname.replace(/^www\./,"");if(r){if(e.form.name=r,!VO)e.form.directory=UK(r)}}catch{}}function bM(e){Xu=Math.trunc(Number(e))||0}function yM(e){Zu=Math.trunc(Number(e))||1}function vM(e){Pn=e}function wM(e){em=Math.trunc(Number(e))||3}function xM(e){tm=e}function kM(e){kl=e}function SM(e){nm=e}function CM(e){pm=e}function jM(e){let t=Math.trunc(Number(e));mm=Number.isNaN(t)?0:Math.min(100,Math.max(0,t))}function MM(e){im=e}var $r=null,Ge={directory:"",name:""},pt="starter",En="source",cn="",Zv=!1,$l="",Nn="",Oo="",lw="";function KK(e){Nn=X(e),lw=pA(e)??""}var Tr=!1,hm=[],aw=null,gm=!0,FM=null;function Ia(){if($r)_e()}function YK(){return FM??=_d({onSaved:Ia,requestRender:Ia}),FM}var _M=null;function cw(){return _M??=Vd({requestRender:Ia}),_M}function BM(){if(zb())return!0;return cw().ensureProbe(),!1}function dw(e){if($r)return Promise.resolve(null);Ge={directory:"",name:""},pt=e?.tab??"starter",En="source",cn="",Zv=!1,$l="",Nn="",Oo="",lw="",Tr=!1,hm=[],gm=!0,WO(),TO();let t=p();if(PO(Ia),t.listStarters)t.listStarters().then((r)=>{if(hm=r,!Zv)cn=r[0]?.id??"";Ia()}).catch(()=>{});return new Promise((r)=>{aw=r,$r=kO({actions:{browse:()=>{HO(Ia)},closed:()=>{KM(null)},confirm:t8,pickCard:e8,pickTab:(o)=>{if(Tr)return;pt=o,Nn="",_e()},secondary:r8,setAgentPrompt:(o)=>{$l=o},setAiNaming:SM,setBreakpointCount:wM,setBreakpointMode:(o)=>{vM(o),_e()},setBreakpointRounding:kM,setBreakpointWidths:xM,setDepth:bM,setImportPrompt:MM,setMaxPages:yM,setMinFidelity:jM,setName:QK,setOwner:(o)=>{FO(o),_e()},setParent:(o)=>{MO(o),_e()},setSlug:ZK,setUrl:(o)=>{gM(ym(),o),_e()},setVerify:(o)=>{CM(o),_e()},setVisibility:(o)=>{zO(o),_e()}},islands:{creds:()=>YK().render(),managed:()=>cw().render(),model:()=>YO()},layer:dt("dialog"),view:TD()})})}function _e(){$r?.update(TD())}function KM(e){let t=$r,r=aw;$r=null,aw=null,Tr=!1,r?.(e),t?.close()}function YM(e){KM(e)}async function qM(e){let{adopted:t,error:r,openedElsewhere:o}=await mo(e.root);if(!t&&!o)w.warn("Created the project, but could not open it here.",r===null?{source:"New Project"}:{detail:r,source:"New Project"});YM(e)}function XM(e){return e.toLowerCase().replaceAll(/[^a-z0-9]+/g,"-").replaceAll(/^-|-$/g,"")}function XK(){switch(pt){case"import":return"Import";case"agent":return"Agent";default:return cn?`Starter site · ${hm.find((e)=>e.id===cn)?.name??cn}`:"Start from scratch"}}function ym(){return{form:Ge,onHandoff:(e)=>{YM(null),JN(e)},rerender:_e,resolveDestination:()=>ZM()}}function ZM(){if(!Ge.name.trim())return Oo="Project name is required",_e(),$r?.focusName(),null;if(!Ge.directory.trim())Ge.directory=XM(Ge.name);let e=NO(Ge.directory);if(!e)return Oo="",_e(),$r?.focusName(),null;return e}function QK(e){if(Ge.name=e,Oo="",!Ge.directory)gm=!0;if(gm)Ge.directory=XM(Ge.name);_e()}function ZK(e){Ge.directory=e,gm=!1,_e()}function e8(e){cn=e,Zv=!0,Nn="",_e()}function t8(){if(En==="source"){n8();return}if(pt==="import"){sM(ym());return}if(Tr)return;if(pt==="agent"){sw({template:"blank"},async(e)=>{vL(e.root,$l.trim()),await qM(e)});return}sw(cn?{starter:cn}:{template:"blank"},qM)}function n8(){if(pt==="import"&&!iM(ym()))return;if(pt==="agent"&&!$l.trim()){Nn="Describe the site you want the agent to build",_e();return}En="params",Nn="",_e()}function r8(){if(Tr)return;En="source",Nn="",Oo="",_e()}async function sw(e,t,r=!1){let o=ZM();if(!o)return;Tr=!0,Nn="",Oo="",_e();try{let a=await p().createProject({...Ge,destination:o,...e});await t(a)}catch(a){if(Tr=!1,KK(a),_e(),!r&&await Am(a))await sw(e,t,!0)}}function kD(){if(En==="params")return"params";if(pt==="import")return BM()?"import":"gate";if(pt==="agent")return BM()?"agent":"gate";return"starter"}function o8(){let e=cw().canOffer()?"Connect Cloudflare, or add an OpenAI-compatible API key, to continue.":"Add an OpenAI-compatible API key to continue.";return pt==="import"?`Importing uses an AI-guided pipeline to clone an existing site. ${e}`:`The agent uses your AI provider to build the site. ${e}`}function a8(){if(En==="source")return kD()==="gate"?"":"Next";if(pt==="import")return lM();if(Tr)return"Creating…";return pt==="agent"?"Create & Start Agent":"Create Project"}function i8(){let e=hm.map((t)=>({art:"thumb",id:t.id,name:t.name,selected:cn===t.id,tagline:t.tagline,thumbnail:t.thumbnail,title:t.description}));return e.push({art:"blank",id:"",name:"Start from scratch",selected:cn==="",tagline:"An empty site with one page",thumbnail:"",title:""}),e}function TD(){let e=p(),t=OO(Ge.directory),r=cM(ym());return{agentPrompt:$l,aiNaming:r.aiNaming,body:kD(),breakpointCount:r.breakpointCount,breakpointHint:r.breakpointHint,breakpointMode:r.breakpointMode,breakpointModes:r.breakpointModes,breakpointRounding:r.breakpointRounding,breakpointWidths:r.breakpointWidths,browseLabel:t.browseLabel,browsing:t.browsing,canBrowse:t.canBrowse,canVerify:r.canVerify,cards:i8(),confirmLabel:a8(),contextLabel:XK(),depth:r.depth,destination:t.destination,destinationError:t.error,error:Nn,errorInstallUrl:lw,gateIntro:o8(),headline:En==="source"?"Choose a starting point":"Name your project",importError:r.error,importPrompt:r.prompt,maxBreakpoints:r.maxBreakpoints,maxDepth:r.maxDepth,maxPages:r.maxPages,minFidelity:r.minFidelity,name:Ge.name,nameError:Oo,note:pt==="import"?"The assistant runs the import and reports as it goes — this dialog closes as soon as it starts.":"The site's address, deployment target and design tokens are project settings — set them from Settings once the project is open.",owner:t.owner,owners:t.owners,parent:t.parent,parentPlaceholder:t.parentPlaceholder,preview:t.preview,previewLabel:t.previewLabel,repoTaken:t.repoTaken,roundings:r.roundings,secondaryLabel:En==="params"?"Back":"",showTabs:En==="source",slug:Ge.directory,slugLabel:t.slugLabel,tab:pt,tabs:[{label:"Starters",value:"starter"},...e.importSite?[{label:"Import",value:"import"}]:[],{label:"Agent",value:"agent"}],url:r.url,verify:r.verify,visibilities:[{label:"Private",value:"private"},{label:"Public",value:"public"}],visibility:t.visibility}}var GM=["starter","import","agent"];function s8(){return[{args:{additionalProperties:!1,properties:{tab:pi(GM,"Which source tab to open on. Defaults to Starters.")},required:[],type:"object"},category:"Project",id:"project.new",level:"application",menus:["commandbar/overflow","palette"],group:"1_file",run:(e,t)=>{let r=t.tab===void 0?void 0:qn("project.new",t,"tab",GM);dw(r===void 0?{}:{tab:r})},title:"New Project…"}]}function PD(e){e.registerAll(s8())}var ED={$schema:"https://jxsuite.com/schema/v1",$id:"StudioSeo",$description:"Search appearance: two rendered previews of the merged site → layout → page `$head`, the resolved fields with their counters and provenance chips, the named warnings, and the page and Open Graph meta rows that change them. A `jx-dialog`, so the platform owns modality, Escape, focus restoration and the backdrop — which is what retired the fixed card, its `z-index: 1000` and the hand-drawn close button the old `.seo-modal` needed to be a modal at all. There is deliberately no score anywhere in this document: a number out of a hundred aggregates unrelated facts into a verdict, and a verdict is what gets optimised (studio-ui-guidelines.md §9.2, §14). Nothing here knows what a donor is, which head layer supplied a value or when a field is over budget — `panels/seo-modal.ts` resolves all of that and hands over strings, flags and one discriminant per branch.",tagName:"jx-dialog",$props:{headline:"Search appearance",confirmLabel:"",cancelLabel:"Close",dismissible:!0,size:"lg"},attributes:{part:"seo"},oncancel:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},onclose:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},style:{$description:'Thirty-one rules become the parts below — the seven `.seo-modal*` in `styles/overlays.css` and the twenty-four `.seo-*` in `styles/panels.css` — and three of them do not travel. `.seo-modal` was a fixed card with its own width, backdrop shadow, radius, border and `z-index: 1000`, and a modal `<dialog>` is every one of those; `.seo-modal-body` was a scroll box `jx-dialog` already provides; and `.seo-modal-body .seo-previews` existed only to cancel the padding that box added. The header the surface drew by hand goes with them, but its two rules stay in the stylesheet rather than moving here: `.settings-modal-header` and `.settings-modal-title` have another writer in `panels/data-grid.ts`, and what draws the heading now is the kit\'s `[part="headline"]`. Every `--spectrum-font-size-*` reference is gone, and that is a repair rather than a rename: those names resolve only inside `<sp-theme>`, and a document mounted in the dialog layer is outside it, so all fourteen would silently have taken their hard-coded fallback. The one size left in pixels is the search-result title, which is above the chrome scale on purpose — it is a picture of what a search engine prints, not a label in this application.','& [part="doc"]':{$description:"WHICH document this is about. A modal covers the tab strip, so it has to say so itself, and every field below resolves through this document's layout and site head. `direction: rtl` truncates a long path from the LEFT, because the file name is the half that identifies it.",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",direction:"rtl",textAlign:"left",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"},'& [part="previews"]':{display:"flex",flexWrap:"wrap",gap:"var(--jx-space-3)",padding:"var(--jx-space-3) 0"},'& [part="card"]':{$description:"The two cards want different floors before they wrap: the result row is text and reads badly narrow, the social card is a fixed-height image with two lines under it. Below ~700px they wrap and the dialog is a tall column.",flex:"1 1 220px",minWidth:"0",margin:"0",padding:"var(--jx-space-3)",border:"1px solid var(--border)",borderRadius:"var(--radius)",background:"var(--bg)"},'& [part="card"][data-card="serp"]':{flexBasis:"260px"},'& [part="card"][data-card="social"]':{flexBasis:"200px"},'& [part="card-label"]':{display:"block",paddingBottom:"var(--jx-space-3)",fontSize:"var(--jx-text-sm)",fontWeight:"700",letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--fg-dim)"},'& [part="serp-url"]':{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="serp-title"]':{$description:"The largest thing in the card, and the one size here that is not on the chrome's scale: a search result's headline is drawn at the proportions a search engine draws it, because the card is a picture rather than a form. Clamped to two lines rather than truncated at a character count — where a given engine cuts is its business, and the counter beside the field is what states the budget.",overflow:"hidden",display:"-webkit-box","-webkit-box-orient":"vertical","-webkit-line-clamp":"2",lineClamp:"2",padding:"var(--jx-space-1) 0",fontSize:"16px",color:"var(--accent)"},'& [part="serp-desc"]':{overflow:"hidden",display:"-webkit-box","-webkit-box-orient":"vertical","-webkit-line-clamp":"2",lineClamp:"2",fontSize:"var(--jx-text-md)",color:"var(--fg)"},'& [part="social-media"]':{display:"flex",alignItems:"center",justifyContent:"center",height:"96px",overflow:"hidden",border:"1px solid var(--border)",borderRadius:"var(--radius)",background:"var(--bg-panel)"},'& [part="social-image"]':{width:"100%",height:"100%",objectFit:"cover"},'& [part="social-text"]':{display:"flex",flexDirection:"column",gap:"1px",paddingTop:"var(--jx-space-3)"},'& [part="social-domain"]':{fontSize:"var(--jx-text-sm)",textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--fg-dim)"},'& [part="social-title"]':{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"var(--jx-text-md)",fontWeight:"700",color:"var(--fg)"},'& [part="social-desc"]':{overflow:"hidden",display:"-webkit-box","-webkit-box-orient":"vertical","-webkit-line-clamp":"2",lineClamp:"2",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="unset"]':{$description:"Absence, said once and in one colour, wherever a preview has nothing to draw.",fontStyle:"italic",color:"var(--fg-dim)"},'& [part="fields"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-1)",margin:"0",padding:"0 0 var(--jx-space-3)",listStyle:"none"},'& [part="field"]':{display:"flex",alignItems:"baseline",gap:"var(--jx-space-3)",minWidth:"0",fontSize:"var(--jx-text-sm)"},'& [part="field-label"]':{flex:"0 0 96px",color:"var(--fg-dim)"},'& [part="field-value"]':{flex:"1",minWidth:"0",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--fg)"},'& [part="count"]':{$description:"The counter is a reference line, not a verdict — over budget is stated, never scored, and `data-over` is the whole of what the `.seo-field-count--over` modifier used to say.",flex:"0 0 auto",fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums",color:"var(--fg-dim)","&[data-over]":{color:"var(--warning)"}},'& [part="chip"]':{$description:"The provenance vocabulary of `panels/provenance.ts` (§6.7), drawn by this document rather than borrowed as a class: `set` keeps the accent dot it has always been, `inherited` is an amber pill naming its donor, and a field nothing supplies gets no chip at all — because a ghost dot on every unset row says less than silence. The two chips that can go somewhere are `<button>`s; the ones with nowhere to go are not, which is §6.7's rule that a control which looks pressable and does nothing is a defect.",flexShrink:"0"},'& jx-dot[part="chip"][data-state="set"]':{background:"var(--accent)"},'& [part="chip"][data-state="inherited"]':{display:"inline-flex",alignItems:"center",maxWidth:"14ch",overflow:"hidden",padding:"0 5px",border:"1px solid currentcolor",borderRadius:"var(--radius)",background:"transparent",font:"inherit",fontSize:"var(--jx-text-xs)",lineHeight:"14px",whiteSpace:"nowrap",textOverflow:"ellipsis",cursor:"default",color:"var(--warning)"},'& button[part="chip"]':{cursor:"pointer","&:hover, &:focus-visible":{background:"var(--hover-bg)"}},'& [part="warnings"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-2)",margin:"0",padding:"0 0 var(--jx-space-3)",listStyle:"none"},'& [part="warning"]':{display:"flex",gap:"var(--jx-space-3)",minWidth:"0",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="warning-field"]':{flex:"0 0 auto",fontFamily:"var(--font-mono)",color:"var(--warning)"},'& [part="empty"]':{$description:"A fully-described page says so rather than printing an empty list.",margin:"0",padding:"0 0 var(--jx-space-3)",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"},'& [part="group"]':{$description:'GROUPED, because the two sets collide by name: Open Graph has its own Title, Description and Image, and eight unlabelled rows in one column made "Description" mean two things. Each group is headed by the preview card it feeds, so a row and the picture it changes are nameable together.',marginTop:"var(--jx-space-4)",paddingTop:"var(--jx-space-3)",borderTop:"1px solid var(--border)"},'& [part="group-title"]':{margin:"0 0 var(--jx-space-1)",fontSize:"var(--jx-text-sm)",fontWeight:"600",textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--fg-dim)"},'& [part="group-note"]':{margin:"0 0 var(--jx-space-3)",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="row"]':{padding:"var(--jx-space-2) 0"},'& [part="row-body"]':{$description:"Every row wraps its control in one box, media row or not, so the thumbnail and the two media buttons have somewhere to sit and a text row is laid out by the same rule. It is also what keeps `jx-field` from naming the control: the row names a `div`, which observes no naming, and each `jx-textfield` carries the label as its own accessible name instead.",display:"flex",alignItems:"center",gap:"var(--jx-space-2)",minWidth:"0"},'& [part="entry"]':{flex:"1",minWidth:"0"},'& [part="thumb"]':{flex:"none",width:"24px",height:"24px",objectFit:"cover",borderRadius:"var(--jx-radius-xs)",border:"1px solid var(--border)"}},children:[{tagName:"div",attributes:{part:"doc",title:"${state.documentLabel}"},textContent:"${state.documentLabel}"},{tagName:"div",attributes:{part:"previews"},children:[{tagName:"figure",attributes:{part:"card","data-card":"serp","aria-label":"Search result preview"},children:[{tagName:"figcaption",attributes:{part:"card-label"},textContent:"Search result"},{tagName:"div",attributes:{part:"serp-url"},textContent:"${state.serpCrumb}"},{tagName:"div",attributes:{part:"serp-title"},textContent:"${state.serpTitle}"},{tagName:"div",attributes:{part:"serp-desc"},$switch:{$ref:"#/state/serpDescState"},cases:{text:{tagName:"span",textContent:"${state.serpDesc}"},unset:{tagName:"span",attributes:{part:"unset"},textContent:"${state.serpDescUnset}"}}}]},{tagName:"figure",attributes:{part:"card","data-card":"social","aria-label":"Social card preview"},children:[{tagName:"figcaption",attributes:{part:"card-label"},textContent:"Social card"},{tagName:"div",attributes:{part:"social-media"},$switch:{$ref:"#/state/socialImageState"},cases:{image:{tagName:"img",attributes:{part:"social-image",src:"${state.socialImage}",alt:""}},unset:{tagName:"span",attributes:{part:"unset"},textContent:"No image"}}},{tagName:"div",attributes:{part:"social-text"},children:[{tagName:"span",attributes:{part:"social-domain"},$switch:{$ref:"#/state/socialDomainState"},cases:{text:{tagName:"span",textContent:"${state.socialDomain}"},unset:{tagName:"span",attributes:{part:"unset"},textContent:"No site URL"}}},{tagName:"span",attributes:{part:"social-title"},$switch:{$ref:"#/state/socialTitleState"},cases:{text:{tagName:"span",textContent:"${state.socialTitle}"},unset:{tagName:"span",attributes:{part:"unset"},textContent:"${state.socialTitleUnset}"}}},{tagName:"span",attributes:{part:"social-desc"},$switch:{$ref:"#/state/socialDescState"},cases:{text:{tagName:"span",textContent:"${state.socialDesc}"},unset:{tagName:"span",attributes:{part:"unset"},textContent:"${state.socialDescUnset}"}}}]}]}]},{tagName:"ul",attributes:{part:"fields","aria-label":"Resolved head fields"},children:[{$prototype:"Array",items:{$ref:"#/state/fields"},key:{$ref:"$map/item/key"},map:{tagName:"li",attributes:{part:"field","data-seo-field":"${$map.item.key}"},children:[{tagName:"span",attributes:{part:"field-label"},textContent:"${$map.item.label}"},{tagName:"span",attributes:{part:"field-value",title:"${$map.item.value}"},$switch:{$ref:"$map/item/valueState"},cases:{text:{tagName:"span",textContent:"${$map.item.value}"},unset:{tagName:"span",attributes:{part:"unset"},textContent:"${$map.item.unsetLabel}"}}},{tagName:"span",attributes:{part:"count-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/counted"},cases:{true:{tagName:"span",attributes:{part:"count","data-over":"${$map.item.over ? '' : null}"},textContent:"${$map.item.count}"}}},{tagName:"span",attributes:{part:"chip-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/chipKind"},cases:{dot:{tagName:"jx-dot",attributes:{part:"chip","data-state":"set",title:"${$map.item.chipTitle}"}},static:{tagName:"span",attributes:{part:"chip","data-state":"inherited",title:"${$map.item.chipTitle}"},textContent:"${$map.item.chipText}"},link:{tagName:"button",attributes:{part:"chip","data-state":"inherited",type:"button",title:"${$map.item.chipTitle}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openDonor"},value:[{$ref:"$map/item/key"}]}]},textContent:"${$map.item.chipText}"}}}]}}]},{tagName:"div",attributes:{part:"warnings-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/warningsState"},cases:{none:{tagName:"p",attributes:{part:"empty"},textContent:"Nothing to flag — every previewed field resolves to a value."},list:{tagName:"ul",attributes:{part:"warnings","aria-label":"Search appearance warnings"},children:[{$prototype:"Array",items:{$ref:"#/state/warnings"},key:{$ref:"$map/item/id"},map:{tagName:"li",attributes:{part:"warning","data-seo-warning":"${$map.item.id}"},children:[{tagName:"code",attributes:{part:"warning-field"},textContent:"${$map.item.field}"},{tagName:"span",textContent:"${$map.item.message}"}]}}]}}},{$prototype:"Array",$description:'The form, split by the preview card each half feeds. GROUPED, because the two sets collide by name: Open Graph has its own Title, Description and Image, and eight unlabelled rows in one column made "Description" mean two things. The groups are a projection like everything else here, so the two headings and the one note are data rather than a second copy of the row template — the row below is written once and both groups render it.',items:{$ref:"#/state/groups"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"group","data-group":"${$map.item.key}"},children:[{tagName:"h3",attributes:{part:"group-title"},textContent:"${$map.item.title}"},{tagName:"div",attributes:{part:"note-slot",role:"none"},style:{display:"contents"},$description:`No fallback is promised in the Social card's note, because the build emits none: the warning list above says an unset og:title means "a shared link carries no headline of its own", and a note claiming otherwise would contradict the app two inches higher.`,$switch:{$ref:"$map/item/hasNote"},cases:{true:{tagName:"p",attributes:{part:"group-note"},textContent:"${$map.item.note}"}}},{$prototype:"Array",items:{$ref:"$map/item/rows"},key:{$ref:"$map/item/key"},map:{$description:"One editable head field, whatever kind it is. The label, the naming of the control and the announced refusal are the kit's; the clear affordance is `jx-textfield`'s own `clearable`, which is what the row's set dot used to be — a control that empties the field, drawn only while there is something to empty. Committing an empty value is what removes the `$head` entry, so clearing and typing nothing are one path rather than two.",tagName:"jx-field",attributes:{part:"row","data-prop":"${$map.item.key}"},$props:{label:{$ref:"$map/item/label"},span:!0},children:[{tagName:"div",attributes:{part:"row-body"},children:[{tagName:"span",attributes:{part:"thumb-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasThumb"},cases:{true:{tagName:"img",attributes:{part:"thumb",src:"${$map.item.thumb}",alt:""}}}},{tagName:"jx-textfield",attributes:{part:"entry"},$props:{label:{$ref:"$map/item/label"},value:{$ref:"$map/item/value"},placeholder:{$ref:"$map/item/placeholder"},multiline:{$ref:"$map/item/multiline"},clearable:!0,size:"sm"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/edit"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/commit"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},{tagName:"span",attributes:{part:"media-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/isMedia"},cases:{true:{tagName:"span",attributes:{part:"media-actions",role:"none"},style:{display:"contents"},children:[{tagName:"jx-action-button",attributes:{part:"upload"},$props:{icon:"upload-simple",label:"Upload media",size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/upload"},value:[{$ref:"$map/item/key"}]}]}},{tagName:"jx-action-button",attributes:{part:"browse"},$description:"Browse opens a kit menu of the project's media, and it has to be a kit one: a modal `<dialog>` is in the top layer, so an overlay drawn into a layer div — which is what `ui/media-picker.ts`'s Spectrum popover is — paints underneath the dialog that opened it and is inert besides. `specs/ui.md` §7 is the rule this follows.",$props:{icon:"image",label:"Browse media",size:"sm",haspopup:"menu"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/browse"},value:[{$ref:"$map/item/key"},{$ref:"event#/currentTarget"}]}]}}]}}}]}]}}]}}]};E("seo",ED);function Sl(e){return e.trim()===""?"unset":"text"}function jD(e){return{documentLabel:e.documentLabel,fields:e.fields.map((t)=>({...t,valueState:Sl(t.value)})),groups:e.groups.map((t)=>({hasNote:t.note!=="",key:t.key,note:t.note,rows:t.rows.map((r)=>({...r,hasThumb:r.thumb!==""})),title:t.title})),serpCrumb:e.crumb,serpDesc:e.description,serpDescState:Sl(e.description),serpDescUnset:e.descriptionUnset,serpTitle:e.title,socialDesc:e.socialDescription,socialDescState:Sl(e.socialDescription),socialDescUnset:e.socialDescriptionUnset,socialDomain:e.domain,socialDomainState:Sl(e.domain),socialImage:e.image,socialImageState:e.image===""?"unset":"image",socialTitle:e.socialTitle,socialTitleState:Sl(e.socialTitle),socialTitleUnset:e.socialTitleUnset,warnings:e.warnings,warningsState:e.warnings.length>0?"list":"none"}}function ID(e){let t=document.createElement("div");t.style.pointerEvents="auto",e.layer.append(t);let r=!1,o=()=>{if(r)return;r=!0,e.onClosed()},a=g({...jD(e.view),browse:(f,c)=>{if(c instanceof HTMLElement)e.onBrowse(f,c)},closed:o,commit:(f,c)=>{e.onCommit(f,c)},edit:(f,c)=>{e.onEdit(f,c)},openDonor:(f)=>{e.onOpenDonor(f)},upload:(f)=>{e.onUpload(f)}}),i=()=>r,s=null,l=R("seo",a,t).then(async(f)=>{s=f;let c=f.root;if(i())return f.dispose(),c;if(await sn(c),i())return c;return(c.querySelector('dialog[part="dialog"]')??c).setAttribute(Ve,vt("dialog","seo")),Jt(c),c});return{close(){let f=s?.root;if(f instanceof HTMLElement)Ut(f);s?.dispose(),s=null,t.remove(),o()},host:t,ready:l,update(f){Object.assign(a,jD(f))}}}function zD(e){let t=(r)=>()=>{ae()?.run("settings.open",{section:r})};switch(e.source){case"page":return{state:"set",title:`${e.label} is set on this page`};case"layout":{let r=e.donor??"the layout";return{donor:r,state:"inherited",title:`${e.label} comes from the ${r} layout — this page does not set it`}}case"site":{let r=e.donor==="Site name";return{donor:e.donor??"the site",onClick:t(r?"overview":"head"),state:"inherited",title:`${e.label} comes from ${r?"the project's name":"the site-level $head"} — click to open it`}}case"build":return{donor:"the build",state:"inherited",title:`Nothing declares ${e.label}, so the build supplies “${e.value}”`};default:return{state:"default"}}}function vm(e){return`No ${e.label.toLowerCase()}`}function c8(e){let t=wE(e.value),r=zD(e),o=r.state==="inherited";return{chipKind:r.state==="default"?"none":r.state==="set"?"dot":r.onClick?"link":"static",chipText:o?`from ${r.donor??"the cascade"}`:"",chipTitle:fm(e.key,r),count:e.limit===null?"":`${t}/${e.limit}`,counted:e.limit!==null,key:e.key,label:e.label,over:e.limit!==null&&t>e.limit,unsetLabel:vm(e),value:e.value}}var HD=new Map([...nw,...iw].map((e)=>[e.key,e])),BD="icon";function d8(e,t,r){if(e==="viewport")return"width=device-width, initial-scale=1";return r?"/image.jpg":`${t}…`}function pw(e,t,r,o={}){let a=Boolean(o.media);return{isMedia:a,key:e,label:t,multiline:Boolean(o.multiline),placeholder:d8(e,t,a),thumb:a&&r?Xc(r):"",value:r}}function LD(e,t){let r=HD.get(t);if(!r)return"";return String(ow(e,r.attr,r.key)?.attributes?.content??"")}function p8(e,t,r){let o=t.trim();if(e===BD){r((i)=>U_(i,"icon",o));return}if(e==="description"){r((i)=>V_(i,o));return}let a=HD.get(e);if(!a)return;r((i)=>rw(i,a.attr,a.key,o))}var La=new Map;function hw(e){if(e===void 0){for(let r of La.values())clearTimeout(r);La.clear();return}let t=La.get(e);if(t!==void 0)clearTimeout(t),La.delete(e)}var Oa=null,Mo=null,wm=new Map;function gw(e){let t=e.doc.mode==="content",r=t?q_(e.doc.document,e.doc.content.frontmatter):e.doc.document;return{applyMutation:t?(o)=>_E(e,Cl,o):(o)=>{Yd(e,o)},head:r.$head??[],headDoc:r}}function GD(e,t,r){let o=xE(e,t),a=lb(o,"description"),i=lb(o,"og:title"),s=lb(o,"og:description"),l=lb(o,"og:image").value.trim(),f=String(yE(r,"icon")?.attributes?.href??"");wm=new Map;for(let c of o.fields){let{onClick:d}=zD(c);if(d)wm.set(c.key,d)}return{crumb:o.url.crumb,description:a.value,descriptionUnset:vm(a),documentLabel:e.documentPath??$d(e),domain:o.url.host,fields:o.fields.map(c8),groups:[{key:"page",note:"",rows:[...nw.map((c)=>pw(c.key,c.label,c.key==="description"?vE(t):LD(r,c.key),{multiline:c.multiline})),pw(BD,"Icon",f,{media:!0})],title:"Search result"},{key:"og",note:"Open Graph — what a shared link shows.",rows:iw.map((c)=>pw(c.key,c.label,LD(r,c.key),{media:c.media,multiline:c.multiline})),title:"Social card"}],image:l?Xc(l):"",socialDescription:s.value,socialDescriptionUnset:vm(s),socialTitle:i.value,socialTitleUnset:vm(i),title:lb(o,"title").value,warnings:o.warnings}}function Cl(){if(!Oa||!Mo)return;let{head:e,headDoc:t}=gw(Mo);Oa.update(GD(Mo,t,e))}function Cm(e,t){if(hw(e),!Mo)return;p8(e,t,gw(Mo).applyMutation),Cl()}function u8(e){TS((t)=>Cm(e,t))}function m8(e,t){ES(t,(r)=>Cm(e,r),{images:!0})}function f8(e){if(Mo=e,!Oa){let{head:t,headDoc:r}=gw(e);Oa=ID({layer:dt("dialog"),onBrowse:m8,onClosed:h8,onCommit:Cm,onEdit:(o,a)=>{hw(o),La.set(o,setTimeout(()=>{La.delete(o),Cm(o,a)},d1))},onOpenDonor:(o)=>{wm.get(o)?.()},onUpload:u8,view:GD(e,r,t)})}Cl(),CD(xE(e,e.doc.document),e.documentPath??void 0)}function h8(){hw();let e=Oa;Oa=null,Mo=null,wm=new Map,e?.close()}function g8(){return[{category:"Document",id:"document.openSeo",level:"document",menus:["palette"],group:"2_document",requires:"an open document",when:(e)=>e.document.open,run:()=>{let e=h.value;if(!e)throw RangeError('command "document.openSeo" needs an open document');f8(e)},title:"Search Appearance"}]}function eF(e){e.registerAll(g8())}var b8="See docs/framework/concepts/accessibility.";function Ha(e,t){let r=sd(e),o=t in r?r[t]:e[t];if(o===void 0||o===null)return{kind:"absent"};if(Pe(o)||v(o))return{kind:"bound"};if(n(o))return o.includes("${")?{kind:"bound"}:{kind:"text",text:o};return{isTrue:o===!0,kind:"other"}}function Fa(e,t){let r=Ha(e,t);return r.kind==="text"&&r.text.trim()!==""?r.text:null}function Ke(e,t){return Ha(e,t).kind!=="absent"}var za="bound";function Pr(e){let t=Ha(e,"role");if(t.kind==="bound")return za;return t.kind==="text"?t.text.trim().toLowerCase().split(/\s+/)[0]:null}function Tm(e){let t=Ha(e,"id");if(t.kind==="bound")return za;return t.kind==="text"&&t.text!==""?t.text:null}function Nt(e,t){let r=Ha(e,t);return r.kind==="bound"||r.kind==="text"&&r.text.trim()!==""}function Mm(e){let t=e.textContent;if(n(t)){if(t.trim()!=="")return!0}else if(t!==void 0&&t!==null)return!0;if(Nt(e,"aria-label")||Ke(e,"aria-labelledby"))return!0;if(Lo(e)==="img"&&(Nt(e,"alt")||Nt(e,"title")))return!0;if(Lo(e)==="slot")return!0;let{children:r}=e;if(Array.isArray(r)){for(let a of r)if(n(a)){if(a.trim()!=="")return!0}else if(_(a)&&Mm(a))return!0}else if(r!=null)return!0;if(v(e.map))return!0;return(v(e.cases)?Object.values(e.cases):[]).some((a)=>Jn(a)&&Mm(a))}var y8=new Set(["button","checkbox","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","switch","tab","treeitem"]),v8=new Set(["combobox","listbox","searchbox","slider","spinbutton","textbox"]),w8=new Set(["button","reset","submit"]),nF=new Map([["menuitem",["menu","menubar"]],["menuitemcheckbox",["menu","menubar"]],["menuitemradio",["menu","menubar"]],["option",["listbox"]],["tab",["tablist"]]]),x8=new Set([...nF.values()].flat());function*Ma(e,t=[],r=[],o=[]){yield{node:e,path:t,roles:r,tags:o};let a=[...r,Pr(e)],i=[...o,Lo(e)],{children:s}=e;if(Array.isArray(s)){for(let[l,f]of s.entries())if(_(f))yield*Ma(f,[...t,"children",l],a,i)}else if(v(s)&&Jn(s.map))yield*Ma(s.map,[...t,"children","map"],a,i);if(Jn(e.map))yield*Ma(e.map,[...t,"map"],a,i);if(v(e.cases)){for(let[l,f]of Object.entries(e.cases))if(_(f))yield*Ma(f,[...t,"cases",l],a,i)}}function k8(e){return e.some((t)=>t.includes("-"))}function dn(e,t,r,o,a,i="error"){return{criterion:a,detail:`${o} ${b8}`,message:r,path:t,rule:e,severity:i}}function tF(e,t,r){if(r.includes("label"))return!0;if(e===za||t.bound)return!0;return e!==null&&t.ids.has(e)}function $8(e,t){let{node:r,path:o,tags:a}=e,i=Lo(r),s=Pr(r);if(s==="bound")return null;if(Nt(r,"aria-label")||Ke(r,"aria-labelledby")||Nt(r,"title"))return null;let f=Rs(r,"the control"),c=(b)=>dn("interactive-unnamed",o,`${f} has no accessible name.`,`A control with no name is announced as its role alone, so a reader hears "button" and nothing else. ${b}`,"4.1.2"),d=S8(r,i,t,a);if(d==="named"||d==="exempt")return null;if(s!==null&&y8.has(s))return Mm(r)?null:c("Give it text content, or an aria-label.");if(s!==null&&v8.has(s))return c("Give it an aria-label, or aria-labelledby naming its visible label.");if(s!==null)return null;if(i==="button"||i==="summary"||i==="a"&&Ke(r,"href"))return Mm(r)?null:c("Give it text content, or an aria-label.");if(d==="unnamed")return c("Give it a <label for> naming its id, or an aria-label.");if(d==="unnamed-value")return c("Give it a value, or an aria-label.");if(d==="unnamed-alt")return c("Give it an alt, or an aria-label.");return null}function S8(e,t,r,o){if(t==="area"){if(!Ke(e,"href"))return"none";return Nt(e,"alt")?"named":"unnamed-alt"}if(t==="select"||t==="textarea")return tF(Tm(e),r,o)||Nt(e,"placeholder")?"named":"unnamed";if(t!=="input")return"none";let a=(Fa(e,"type")??"text").toLowerCase();if(a==="hidden"||Ke(e,"type")&&Fa(e,"type")===null)return"exempt";if(w8.has(a))return Nt(e,"value")?"named":"unnamed-value";if(a==="image")return Nt(e,"alt")?"named":"unnamed-alt";return tF(Tm(e),r,o)||Nt(e,"placeholder")?"named":"unnamed"}var C8=new Set(["select","jx-select"]);function T8(e){let{node:t,path:r,tags:o}=e,a=Lo(t);if(!a.includes("-")||!o.some((i)=>C8.has(i)))return null;return dn("custom-element-in-select",r,`<${a}> is a custom element inside a <select>.`,'A <select> builds its own rows: an element it does not know is not in select.options, so it cannot be picked, cannot be reached with the arrow keys, and fires no change event — while role="option" on it still makes the accessibility tree read as though it could. Every row of a <select> is a native <option>; a listbox whose rows are jx-option elements is a jx-listbox.',"4.1.2")}function P8(e){let{node:t,path:r}=e;if(Lo(t)!=="img")return null;let o=Pr(t);if(o==="bound"||o==="presentation"||o==="none")return null;if(Ke(t,"alt")||Nt(t,"aria-label")||Ke(t,"aria-labelledby"))return null;return dn("img-alt-missing",r,`${Rs(t,"the image")} has no alt text.`,'An image with no alt is announced by its file name. Describe it in alt, or write alt="" for a decorative one.',"1.1.1")}var E8=["aria-activedescendant","aria-controls","aria-describedby","aria-details","aria-errormessage","aria-flowto","aria-labelledby","aria-owns"];function N8(e,t){let{node:r,path:o}=e,a=[];for(let i of E8){let s=Fa(r,i);if(s===null)continue;for(let l of s.split(/\s+/))if(l!==""&&!t.has(l))a.push(dn("aria-target-missing",o,`${Rs(r,"the element")} points ${i} at #${l}, which nothing in this document has as its id.`,"A reference to an id that is not in the document is silently dropped, so the relationship it declares does not exist. Name an element that is here, or give that element the id.","1.3.1"))}return a}function j8(e,t,r){for(let o of nF.get(t)??[]){let a=r.get(o);if(a===void 0)continue;if(a.bound)return!0;if(e===za&&a.ids.size>0)return!0;if(e!==null&&e!==za&&a.ids.has(e))return!0}return!1}function R8(e,t){let{node:r,path:o,roles:a,tags:i}=e,s=Pr(r);if(s===null||s==="bound"||o.length===0||k8(i))return null;if(a.includes("bound")||j8(Tm(r),s,t))return null;let l=Rs(r,"the element");if(s==="tab"&&!a.includes("tablist"))return dn("tab-outside-tablist",o,`${l} is a tab outside any tablist.`,'A tab is announced with its position in a tablist, so one with no tablist ancestor has no place to be counted in. Put the tabs in a container with role="tablist".',"1.3.1");if((s==="menuitem"||s==="menuitemcheckbox"||s==="menuitemradio")&&!a.includes("menu")&&!a.includes("menubar"))return dn("menuitem-outside-menu",o,`${l} is a ${s} outside any menu.`,'A menu item is owned by a menu, and is announced as one of its items. Put it in a container with role="menu" or role="menubar".',"1.3.1");if(s==="option"&&!a.includes("listbox")&&!i.includes("select")&&!i.includes("datalist"))return dn("option-outside-listbox",o,`${l} is an option outside any listbox.`,'An option is owned by a listbox, and is announced as one of its choices. Put it in a container with role="listbox", or in a <select>.',"1.3.1");return null}function A8(e){let t=[];for(let{node:r}of Ma(e)){if(Pr(r)!=="tab")continue;let o=Ha(r,"aria-selected");if(o.kind==="bound")return null;t.push(o.kind==="other"&&o.isTrue||o.kind==="text"&&o.text==="true")}return t}function I8(e){let{node:t,path:r}=e;if(Pr(t)!=="tablist")return null;let o=A8(t);if(o===null||o.length===0||o.includes(!0))return null;return dn("tablist-none-selected",r,`${Rs(t,"the tablist")} has ${o.length} tab(s) and none is selected.`,'A tablist always has a current tab, and aria-selected="true" is how it is announced. Mark the tab whose panel is showing.',"4.1.2","warn")}function L8(e){let{node:t,path:r}=e,o=Pr(t);if(!(Lo(t)==="dialog"||o==="dialog"||o==="alertdialog")||o==="bound")return null;if(Nt(t,"aria-label")||Ke(t,"aria-labelledby"))return null;return dn("dialog-unnamed",r,`${Rs(t,"the dialog")} has no accessible name.`,"A dialog is announced by its name when it opens, and its content does not name it. Give it aria-labelledby naming its heading, or an aria-label.","4.1.2")}var O8=new Set(["button","input","select","textarea"]);function M8(e){let{node:t,path:r}=e;if(!Ke(t,"aria-activedescendant"))return null;let o=Lo(t);if(O8.has(o)||o==="a"&&Ke(t,"href")||Ke(t,"tabIndex")||Ke(t,"tabindex")||Ke(t,"contenteditable"))return null;return dn("activedescendant-not-focusable",r,`${Rs(t,"the element")} manages focus with aria-activedescendant but cannot itself take focus.`,"aria-activedescendant names the active child of a FOCUSED container; on one that cannot be focused, the keyboard never reaches it. Give the container a tabindex.","2.1.1")}function rF(e){let t=[...Ma(e)],r=new Set,o={bound:!1,ids:new Set},a=new Map,i=!1;for(let{node:l}of t){let f=Pr(l);if(f!==null&&x8.has(f)){let d=a.get(f)??{bound:!1,ids:new Set},b=Fa(l,"aria-owns");if(b===null)d.bound||=Ke(l,"aria-owns");else for(let y of b.split(/\s+/))if(y!=="")d.ids.add(y);a.set(f,d)}let c=Tm(l);if(c===za)i=!0;else if(c!==null)r.add(c);if(Lo(l)==="label"){let d=Fa(l,"for")??Fa(l,"htmlFor");if(d===null)o.bound||=Ke(l,"for")||Ke(l,"htmlFor");else o.ids.add(d)}}let s=[];for(let l of t){let f=[$8(l,o),P8(l),R8(l,a),T8(l),I8(l),L8(l),M8(l)];for(let c of f)if(c)s.push(c);if(!i)s.push(...N8(l,r))}return s}function D8(e,t){if(t==="img"||t==="area")return!0;return t==="input"&&Er(e,"type")?.toLowerCase()==="image"}var F8=new Set(["input","select","textarea","button"]),_8=new Set(["button","hidden","image","reset","submit"]),z8=new Set(["click here","here","read more","more","learn more","this","link","download","continue"]);function oF(e){return e.attributes??{}}function Er(e,t){let r=oF(e)[t];return n(r)?r:null}function Tl(e,t){return t in oF(e)}function Pl(e){let t=[];if(n(e.textContent))t.push(e.textContent);let{children:r}=e;if(Array.isArray(r)){for(let o of r)if(n(o))t.push(o);else if(_(o))t.push(Pl(o))}return t.join(" ").trim()}function*yw(e){yield e;let{children:t}=e;if(Array.isArray(t)){for(let r of t)if(_(r))yield*yw(r)}for(let r of Object.values(e.cases??{}))if(_(r))yield*yw(r)}function H8(e){return Er(e,"aria-label")!==null||Er(e,"aria-labelledby")!==null||Tl(e,"aria-label")||Tl(e,"aria-labelledby")||n(e.title)&&e.title!==""||Pl(e)!==""}function B8(e){let t=[],r=new Map,o=0,a=0,i=0;for(let s of yw(e)){i+=1;let l=n(s.tagName)?s.tagName.toLowerCase():"",f=l===""?`element ${i}`:`<${l}>`;if(D8(s,l)){let d=Er(s,"alt");if(d!==null&&/^(image|photo|picture|graphic|icon)\b/i.test(d.trim()))t.push({criterion:"1.1.1",detail:'A screen reader already announces that it is an image, so "image of a cat" is heard as "image, image of a cat". Describe what it shows.',id:`img-alt-redundant:${i}`,message:`${f}'s alt text starts by saying it is an image.`,severity:"warn"})}let c=/^h([1-6])$/.exec(l)?.[1];if(c!==void 0){let d=Number(c);if(d===1){if(o+=1,o===2)t.push({criterion:"1.3.1",detail:"A page has one title, and readers who navigate by heading use the h1 to find it. "+"Two make the outline ambiguous — demote the second to an h2.",id:"multiple-h1",message:"This page has more than one top-level heading.",severity:"warn"})}if(a!==0&&d>a+1)t.push({criterion:"1.3.1",detail:`An h${a} is followed by an h${d}, so the outline has a hole in it. `+"Readers who navigate by heading use the levels as structure, not as sizes — style "+"the heading rather than skipping a level to get a smaller one.",id:`heading-skip:${i}`,message:`A heading level is skipped: h${a} to h${d}.`,severity:"warn"});a=d}if(F8.has(l)){let d=Er(s,"type")?.toLowerCase()??"",b=l==="button"||_8.has(d);if(l==="input"&&!b&&!Tl(s,"autocomplete")){let y=`${Er(s,"name")??""} ${Er(s,"id")??""}`.toLowerCase();if(/\b(email|name|tel|phone|address|postal|zip|country)\b/.test(y))t.push({criterion:"1.3.5",detail:"An autocomplete token lets a browser fill the field from the person's own stored details, which matters most for people who find typing costly.",id:`input-no-autocomplete:${i}`,message:`${f} asks for personal data but names no autocomplete purpose.`,severity:"warn"})}}if(l==="a"){let d=Pl(s).toLowerCase().replaceAll(/[^a-z ]/g,"").trim();if(H8(s)&&z8.has(d))t.push({criterion:"2.4.4",detail:"Readers who navigate by pulling up a list of a page's links see the text alone, with "+`no surrounding sentence — so a page of "${d}" is a list of identical entries.`,id:`link-vague:${i}`,message:`A link reads "${Pl(s)}", which names no destination.`,severity:"warn"});if(Er(s,"target")==="_blank"&&!/new (tab|window)/i.test(Pl(s)))t.push({criterion:"2.4.6",detail:"A link that replaces the page without warning is disorienting for anyone not watching the whole viewport. Say so in the text, or in the aria-label.",id:`link-new-window:${i}`,message:"A link opens in a new tab without saying so.",severity:"warn"})}if(Y(s.tabIndex)&&s.tabIndex>0)t.push({criterion:"1.3.1",detail:"A positive tabindex pulls the element out of document order and in front of every "+"element with tabindex 0 — on the whole page, not just this component. Reorder the "+"markup instead; 0 and -1 are the only values that compose.",id:`positive-tabindex:${i}`,message:`${f} has tabindex="${s.tabIndex}".`,severity:"error"});if(n(s.id)&&s.id!=="")if(r.get(s.id)!==void 0)t.push({criterion:"4.1.2",detail:"aria-labelledby, aria-controls and <label for> all resolve an id to the FIRST match, so a duplicate silently points half the references at the wrong element.",id:`duplicate-id:${s.id}`,message:`The id "${s.id}" is used more than once.`,severity:"error"});else r.set(s.id,i);if((l==="video"||l==="audio")&&Tl(s,"autoplay")&&!Tl(s,"controls"))t.push({criterion:"1.3.1",detail:"Media that starts by itself and cannot be stopped talks over a screen reader, which leaves a reader no way to hear the page at all.",id:`autoplay-no-controls:${i}`,message:`${f} plays automatically with no controls.`,severity:"error"})}if(!n(e.lang)||e.lang==="")t.push({criterion:"3.1.1",detail:"A screen reader picks its pronunciation rules from the page's language. Without one it "+"uses the reader's own, so French text is read with English phonetics — intelligible to "+"nobody.",id:"no-lang",message:"This document declares no language.",severity:"warn"});for(let s of rF(e))t.push({criterion:s.criterion,detail:s.detail,id:`${s.rule}:${s.path.join("/")}`,message:s.message,severity:s.severity});return V8(t)}function V8(e){let t=new Map;return e.map((r)=>{let o=t.get(r.id)??0;return t.set(r.id,o+1),o===0?r:{...r,id:`${r.id}#${o}`}})}function El(){return[{detail:"Contrast is between the colours that actually paint, which depends on the cascade, on "+"inherited values and on images behind text — none of which exist until the page is "+"built and rendered. Checking the declared values alone would pass a black-on-black page whose colours came from a class.",id:"contrast",message:"Colour contrast was not checked."},{detail:"Target size, focus order and reading order are all properties of the rendered layout. A document tree does not have a layout, so this run cannot see them.",id:"layout",message:"Target size and focus order were not checked."}]}var Nl="Accessibility";function W8(e,t){yl((o)=>o.source===Nl);let r=B8(e);for(let o of r){let a={detail:`WCAG ${o.criterion} — ${o.detail}`,key:`a11y.${o.id}`,source:Nl,tier:"problem"};if(o.action!==void 0)a.action=o.action;if(t!==void 0)a.path=t;w(o.severity,o.message,a)}for(let o of El())w.info(o.message,{action:"document.checkAccessibility",detail:o.detail,key:`a11y.unavailable.${o.id}`,source:Nl,tier:"problem"});return r.length+El().length}function q8(){return[{aiTool:{description:"Check the open document for accessibility problems an author can fix — missing alt "+"text, unlabelled controls, skipped heading levels, vague link text, duplicate ids — "+"and file each as a Problem naming its WCAG criterion. The findings come back as data.",name:"check_accessibility",report:()=>{let e=El().length,t=sf(Nl).filter((a)=>!a.key?.startsWith("a11y.unavailable.")),r=t.length,o=e===0?"":` ${e} check${e===1?"":"s"} could not run and ${e===1?"is":"are"} listed in Problems as such.`;return{data:t,summary:r===0?`No accessibility problems found in this document.${o}`:`Filed ${r} accessibility problem${r===1?"":"s"} in Problems.${o}`}}},category:"Document",group:"2_document",id:"document.checkAccessibility",level:"document",menus:["palette"],requires:"an open document",run:()=>{let e=h.value;if(!e)throw RangeError('command "document.checkAccessibility" needs an open document');let t=W8(e.doc.document,e.documentPath??void 0);w.success(t===El().length?"No accessibility problems found in this document.":`${t-El().length} accessibility problem(s) filed.`,{key:"a11y.run",source:Nl})},title:"Check Accessibility",when:(e)=>e.document.open}]}function iF(e){e.registerAll(q8())}function lF(e,t){return qp(e)&&!Gc[e].tabStrip&&ml(t)!==e}function U8(e,t,r=u.workspace){let o=pn(e);if(!o||!lF(r,t))return[];return o.tabOrder.filter((a)=>{let i=m.tabs.get(a);return a!==t&&i!==void 0&&ml(a)!==r&&sb(i)===r&&!i.pinned&&!i.doc.dirty&&!Cv(i)})}function J8(e,t=u.workspace){if(!qp(t)||Gc[t].tabStrip)return null;let r=$a(t);return pn(e)?.tabOrder.includes(r)===!0?r:null}function cF(e,t){for(let r of m.panes){if(r.id===t||r.derived)continue;let o=mE(r,e);if(o===r.activeTabId)continue;if(o)Ft(o,{focus:!1});else l1(r.id)}}function G8(){let e=u.workspace,t=m.activePaneId;for(let r of m.panes){let o=r.activeTabId;if(r.id===t||r.derived||!o||Nc(o,e))continue;Gr();try{let a=mE(r,e);if(a)Ft(a,{focus:!1});else l1(r.id)}finally{Kr()}}}function dF(e,t){let o=pn(e)?.tabOrder.find((a)=>m.tabs.get(a)?.documentPath===t);if(o&&!Nc(o))Ft(o)}function K8(){let e=h.value;return e?fE(e):!1}function pF(e){return{...e,writingOnCanvas:K8}}function Y8(e,t){if(e==="styles")return t.openStyles(),!0;if(qp(e))return t.openHome(e),!0;return!1}function uF(e,t){let r=_D(e);if(r)Ft(r);else Y8(e,t);VC(e,pF(t));let o=h.value,a=o&&Nc(o.id,e)?Da(o.id)?.id??null:null;cF(e,a)}var jl=null;function mF(e){if(jl)return sF;r1((a)=>Nc(a)),s1((a)=>X8(a,e)),a1((a)=>J8(a));let t=me();jl=t;let r=pF(e),o=null;return t.run(()=>{te(()=>{let s=h.value;if(!s)return;let l=sb(s),f=fE(s);Gr();try{let c=Da(s.id)?.id??null;if(c!==null)for(let d of U8(c,s.id,l))eu(d);if(VC(l,r)){if(cF(l,c),c!==null&&lF(l,s.id))e.placeHome?.(l,c)}else if(o!==null&&f!==o&&Gc[l].inspector.whileWriting===!0)ko("right",!W$(l,f))}finally{Kr()}o=f});let a=!1,i=te(G8,{scheduler:()=>{if(a)return;a=!0,queueMicrotask(()=>{if(a=!1,jl===t)i()})}})}),sF}function X8(e,t){let r=u.workspace,o=pn(e);if(!o||o.derived||Gc[r].tabStrip)return;if(r==="styles"){t.openStyles?.();return}if(!t.placeHome||!qp(r))return;t.placeHome(r,e),Ft($a(r))}function sF(){jl?.stop(),jl=null,r1(null),s1(null),a1(null)}var fF={$schema:"https://jxsuite.com/schema/v1",$id:"StudioAbout",$description:"The About dialog: the app's version and build metadata, its external links, and the resolved `@jxsuite/*` package versions. A `jx-dialog`, so the platform owns modality, Escape, focus restoration and the backdrop — which is what retired the `sp-underlay` this surface used to render itself, and with it the fixed-position box and scrolling body it drew by hand.",tagName:"jx-dialog",$props:{headline:{$ref:"#/state/headline"},confirmLabel:"",cancelLabel:"Close",size:"sm"},attributes:{part:"about"},oncancel:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/close"},value:[]}]},onclose:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},style:{$description:"The About dialog's own look. `.about-modal` and `.about-modal-body` are gone rather than moved: they positioned a fixed box, drew its panel and scrolled its body, and `jx-dialog` is all three — so converting this surface deleted two rules instead of transcribing them.",'& [part="meta"]':{margin:"0 0 16px",display:"flex",flexDirection:"column",gap:"6px"},'& [part="meta-row"]':{display:"flex",gap:"12px",fontSize:"13px"},'& [part="meta-label"]':{$description:"A fixed label column, so the values line up down the list rather than with each row's own text.",width:"96px",minWidth:"96px",margin:"0",color:"var(--fg-dim)"},'& [part="meta-value"]':{$description:"One of the two places in the chrome that opt back in to selection (`STYLING.md` §Text selection). The root sets `user-select: none` and `styles/tokens.json` restates it on every modal `dialog`, but this dialog's body IS its message: the version, the build date, the commit and the channel exist to be pasted into a bug report, and Studio offers no copy action for them.",margin:"0",color:"var(--fg)",wordBreak:"break-word",userSelect:"text"},'& [part="links"]':{display:"flex",gap:"16px",padding:"12px 0",marginBottom:"12px",borderTop:"1px solid var(--border)",borderBottom:"1px solid var(--border)"},'& [part="links"] a':{$description:"The accent, from the studio token layer. It read `--spectrum-accent-color-1000` with a hex fallback, which resolved only inside `<sp-theme>`; a document is mounted in the dialog layer, where that name is not in scope and every link would have fallen to the hex.",color:"var(--accent)",textDecoration:"none",":hover":{textDecoration:"underline"}},'& [part="section-title"]':{margin:"0 0 8px",fontSize:"13px",fontWeight:"600",color:"var(--fg)"},'& [part="muted"]':{margin:"0",fontSize:"13px",color:"var(--fg-dim)"},'& [part="packages"]':{listStyle:"none",margin:"0",padding:"0",display:"flex",flexDirection:"column",gap:"4px"},'& [part="package-row"]':{$description:"Selectable for the same reason `meta-value` is, and on the ROW rather than on the version alone: what a reader pastes is the pair, `@jxsuite/ai 0.37.0`, so a drag has to be able to cross from the name to the number and on down the list.",display:"flex",justifyContent:"space-between",gap:"12px",fontSize:"var(--jx-text-md)",userSelect:"text"},'& [part="package-name"]':{color:"var(--fg-dim)"},'& [part="package-version"]':{$description:"Tabular figures, so a column of versions does not jitter as it loads.",color:"var(--fg)",fontVariantNumeric:"tabular-nums"}},children:[{tagName:"dl",attributes:{part:"meta"},children:[{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/label"},map:{tagName:"div",attributes:{part:"meta-row"},children:[{tagName:"dt",attributes:{part:"meta-label"},textContent:"${$map.item.label}"},{tagName:"dd",attributes:{part:"meta-value"},textContent:"${$map.item.value}"}]}}]},{tagName:"div",attributes:{part:"links"},children:[{$prototype:"Array",items:{$ref:"#/state/links"},key:{$ref:"$map/item/href"},map:{tagName:"a",attributes:{href:"${$map.item.href}",target:"_blank",rel:"noreferrer noopener"},textContent:"${$map.item.label}"}}]},{tagName:"section",attributes:{part:"section"},children:[{tagName:"h3",attributes:{part:"section-title"},textContent:"Packages"},{tagName:"div",attributes:{part:"packages-slot",role:"none"},$switch:{$ref:"#/state/packagesState"},cases:{loading:{tagName:"p",attributes:{part:"muted"},textContent:"Loading packages…"},empty:{tagName:"p",attributes:{part:"muted"},textContent:"No packages reported."},listed:{tagName:"ul",attributes:{part:"packages"},children:[{$prototype:"Array",items:{$ref:"#/state/packages"},key:{$ref:"$map/item/name"},map:{tagName:"li",attributes:{part:"package-row"},children:[{tagName:"span",attributes:{part:"package-name"},textContent:"${$map.item.name}"},{tagName:"span",attributes:{part:"package-version"},textContent:"${$map.item.version}"}]}}]}}}]}]};E("about",fF);function hF(e){let t=document.createElement("div");t.style.pointerEvents="auto",t.setAttribute(Ve,vt("dialog","about")),e.layer.append(t);let r=!1,o=()=>{if(r)return;r=!0,e.onClosed()},a=()=>r,i=g({close:()=>f.close(),closed:o,headline:e.headline,links:e.links,packages:[],packagesState:"loading",rows:e.rows}),s=null,l=R("about",i,t).then(async(c)=>{s=c;let d=c.root;if(a())return c.dispose(),d;if(await sn(d),a())return d;return Jt(d),d}),f={close(){if(r)return;let c=s?.root;if(c instanceof HTMLElement)Ut(c);s?.dispose(),s=null,t.remove(),o()},host:t,ready:l,update(c){if(c.rows!==void 0)i.rows=c.rows;if(c.packages!==void 0)i.packages=c.packages,i.packagesState=c.packages.length===0?"empty":"listed"}};return f}var Rl="Jx Studio",Hm="10.3.0",gF="2026-11-04T21:11:34.585Z",Bm="16af4d7",Vm={github:"https://github.com/jxsuite/jx",docs:"https://github.com/jxsuite/jx#readme",license:"https://github.com/jxsuite/jx/blob/main/LICENSE"};var Al=null;function Z8(e){if(!e)return"—";let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function bF(e){let t=[{label:"Version",value:Hm},{label:"Build date",value:Z8(gF)},{label:"Commit",value:Bm}];if(e){if(t.push({label:"Channel",value:e.channel}),e.updateStatus)t.push({label:"Updates",value:e.updateStatus})}return t}async function e9(e){let t=p(),r=[];try{r=await t.listPackages()}catch{r=[]}let o=null;if(t.getAppInfo)try{o=await t.getAppInfo()}catch{o=null}if(Al===e)e.update({packages:r,rows:bF(o)})}function t9(){if(Al)return;let e=hF({headline:`About ${Rl}`,layer:dt("dialog"),links:[{href:Vm.github,label:"GitHub"},{href:Vm.docs,label:"Documentation"},{href:Vm.license,label:"License"}],onClosed:()=>{if(Al===e)Al=null},rows:bF(null)});Al=e,e9(e)}function n9(){return[{id:"help.about",title:`About ${Rl}`,category:"Help",level:"application",menus:["commandbar/overflow","palette"],group:"9_help",run:()=>{t9()}}]}function yF(e){e.registerAll(n9())}function Rt(){return h.value}function vF(){let e=Rt();return Boolean(e&&xn(e).active)}function r9(e){return`jx://collab/${(e.documentPath??"").replace(/^\.?\//,"")}`}function o9(){return[{id:"collab.setEnabled",title:"Collaborate: Share this document",category:"Collaborate",level:"document",menus:["palette"],group:"1_session",requires:"an open document",when:()=>Boolean(Rt()?.documentPath),args:{additionalProperties:!1,properties:{enabled:To("True to attach a live session, false to leave it.")},required:["enabled"],type:"object"},run:(e,t)=>{let r=Hi("collab.setEnabled",t,"enabled"),o=Rt();if(!o)return;if(pI(o)===r)return;hI(o,r),w.info(r?"Connecting this document to its collaboration session…":"Left the collaboration session for this document.",{source:"Collaboration"})}},{id:"collab.stop",title:"Collaborate: Stop sharing",category:"Collaborate",level:"document",menus:["palette"],group:"1_session",requires:"a live collaboration session",when:()=>Boolean(Rt()?.documentPath),enablement:vF,run:()=>{let e=Rt();if(!e||!pI(e))return;hI(e,!1),w.info("Left the collaboration session for this document.",{source:"Collaboration"})}},{id:"collab.copyLink",title:"Collaborate: Copy session link",category:"Collaborate",level:"document",menus:["palette"],group:"2_invite",requires:"a live collaboration session",when:()=>Boolean(Rt()?.documentPath),enablement:vF,run:async()=>{let e=Rt();if(!e)return;let t=r9(e);try{await navigator.clipboard.writeText(t)}catch(r){w.error(`Could not copy the session link — ${r instanceof Error?r.message:String(r)}`,{detail:t,source:"Collaboration"});return}w.success("Session link copied. It names the room; it does not grant access to it.",{source:"Collaboration"})}},{id:"collab.follow",title:"Collaborate: Follow a collaborator",category:"Collaborate",level:"document",menus:["palette"],group:"3_presence",requires:"another person in this session",when:()=>Boolean(Rt()?.documentPath),enablement:()=>{let e=Rt();return Boolean(e&&xn(e).peers.length>0)},args:{additionalProperties:!1,properties:{login:Fe("The collaborator's login, as shown on their presence chip.")},required:[],type:"object"},run:(e,t)=>{let r=Rt();if(!r)return;let o=ti("collab.follow",t,"login"),{peers:a}=xn(r),i=o?a.find((l)=>l.state.user.login===o):a[0];if(!i){w.warn(o?`${o} is not in this session.`:"Nobody else is in this session.",{source:"Collaboration"});return}let s=i.state.focusedPath;if(!s){w.info(`${i.state.user.login} is not in a document right now.`,{source:"Collaboration"});return}w.info(`${i.state.user.login} is in ${s}.`,{action:"file.open",actionArgs:{path:s},source:"Collaboration"})}},{id:"collab.showStatus",title:"Collaborate: What is happening in this document?",category:"Collaborate",level:"document",menus:["palette"],group:"3_presence",requires:"an open document",when:()=>Boolean(Rt()?.documentPath),run:()=>{let e=Rt();if(!e)return;let t=xn(e),r=[`Status: ${t.status}${t.attachError?` — ${t.attachError}`:""}`,`People here: ${t.peers.length===0?"just you":t.peers.map((o)=>o.state.user.login).join(", ")}`,t.readOnly?"You have read access: your edits stay on this machine.":"You can publish edits to this session.",t.sourceCanonical?"Someone holds the code view, so structural edits are paused. This is not an error.":"Structural editing is available.","Undo only takes back your own edits, never a collaborator's."];w.info(r[0],{detail:r.join(`
|
|
502
|
-
`),source:"Collaboration"})}}]}function wF(e){e.registerAll(o9())}function xF(){return["all",...Eb()]}async function a9(e){$D(e);let{openWorkspaceHome:t}=await (ce("
|
|
501
|
+
`);b=k.pop()??"";for(let T of k)y=S(T)??y}y=S(b)??y}finally{try{await c.cancel()}catch{}}if(x>0)r({message:`${x} progress line${x===1?"":"s"} could not be read and ${x===1?"was":"were"} skipped — the import may be missing steps.`,phase:$5});if(!y)throw Error("Import stream ended without a result");return y}function O1(e){let t=Math.max(1,e.maxPaths??OL),r=Math.max(1,e.maxInFlight??4),o=e.schedule??queueMicrotask,a=new Map,i=!1,s=!0,l=[],f=0;function c(j,k){let T=a.get(j);if(T)T.push(...k);else a.set(j,k);if(!i)i=!0,o(b)}function d(j,k){e.fetchOne(j).then((T)=>{for(let N of k)N.resolve(T)},(T)=>{for(let N of k)N.reject(T)})}function b(){i=!1;let j=a;if(a=new Map,!s||j.size===1){for(let[T,N]of j)d(T,N);return}let k=new Map;for(let[T,N]of j)if(k.set(T,N),k.size===t)l.push(k),k=new Map;if(k.size>0)l.push(k);y()}function y(){while(f<r&&l.length>0)x(l.shift())}function x(j){f+=1,S(j).finally(()=>{f-=1,y()})}async function S(j){if(!s){for(let[T,N]of j)d(T,N);return}let k;try{k=await e.fetchBatch([...j.keys()])}catch(T){for(let N of j.values())for(let O of N)O.reject(T);return}if(k==="retry-singly"||k==="unsupported"||!_(k)){if(k==="unsupported")s=!1;for(let[T,N]of j)d(T,N);return}try{P(j,k)}catch{for(let[T,N]of j)d(T,N)}}function P(j,k){let T=0;for(let O of Array.isArray(k.files)?k.files:[]){let[D,M]=Array.isArray(O)?O:[],V=D===void 0?void 0:j.get(D);if(D===void 0||!V)continue;j.delete(D),T+=1;let F=M,B=F?.content;if(n(B))for(let L of V)L.resolve(B);else{let L=F?.error?.message,U=Error(L||`Failed to read file: ${D}`);for(let W of V)W.reject(U)}}let N=(Array.isArray(k.omitted)?k.omitted:[]).filter((O)=>j.has(O));if(T===0&&N.length>0){let O=N.shift();d(O,j.get(O)),j.delete(O)}for(let O of N)c(O,j.get(O)),j.delete(O);for(let[O,D]of j)d(O,D)}return{read(j){return new Promise((k,T)=>{c(j,[{reject:T,resolve:k}])})}}}function S5(e){return v(e)&&Array.isArray(e.files)}function ku(e,t){return e[t]??{}}async function ke(e){return await e.json()}function M1(e){return JSON.parse(e)}async function on(e,t){try{return tr(await ke(e))??t}catch{return t}}async function C5(e){let t;try{t=await ke(e)}catch{return!1}let r=Bb(t?.type)??t?.code;return r==="read_only"||r==="read-only"}function F1(e){let t=e?.heading;return n(t)&&t?t:void 0}async function Tu(e,t){let r;try{r=await ke(e)}catch{r=null}let o=Bb(r?.type)??r?.code,a=Dp(r?.actions),i=F1(r),s=FL(r?.retry),l=r?.installUrl,f={status:e.status};if(o)f.code=o;if(n(l))f.installUrl=l;if(a.length>0)f.actions=a;if(i!==void 0)f.heading=i;if(s!==void 0)f.retry=s;let c=r?.conflicts;if(Array.isArray(c))f.conflicts=c.filter((d)=>n(d));return Object.assign(Error(tr(r)??t),f)}async function xe(e,t){if(!e.ok)throw await Tu(e,t);return ke(e)}function _1(e){let t=Bb(e?.type)??e?.code;return t==="action-required"||t==="action_required"}async function T5(e){let t;try{t=await ke(e)}catch{return}if(!_1(t))return;let r=Dp(t?.actions);if(r.length===0)return;let o=tr(t),a=F1(t),i=FL(t?.retry),s={actions:r};if(o!==null)s.detail=o;if(a!==void 0)s.heading=a;if(i!==void 0)s.retry=i;kA(s)}function z1(e){return e.dir?`${e.branch}:${e.dir}`:e.branch}function P5(e){let t=e.indexOf(":"),r=t===-1?e:e.slice(0,t),o=t===-1?"":Bl(e.slice(t+1));if(!r||o===null)return null;return o?{branch:r,dir:o}:{branch:r}}function kv(e){let t=e.dir?`:${e.dir.split("/").map((r)=>encodeURIComponent(r)).join("/")}`:"";return`/edit/${e.owner}/${e.repo}@${encodeURIComponent(e.branch)}${t}`}function E5(e){let{owner:t,repo:r}=e;return`/api/v1/p/${encodeURIComponent(t)}/${encodeURIComponent(r)}/${encodeURIComponent(z1(e))}/studio`}function $u(e){return`${e.owner}/${e.repo}@${z1(e)}`}function H1(e,t){return _(e.data)&&"source"in e.data&&e.data.source===t}async function ul(){let e=await fetch("/api/v1/cf/connection",{credentials:"include"});if(!e.ok)return null;let t=await ke(e);if(!t.connected)return null;let r={connected:!0};if(t.accountId)r.accountId=t.accountId;if(t.accountName)r.accountName=t.accountName;if(t.needsReconnect)r.needsReconnect=!0;if(t.needsAccount)r.needsAccount=!0;if(t.code)r.code=t.code;if(t.reason)r.reason=t.reason;if(t.hasRefreshToken!==void 0)r.hasRefreshToken=t.hasRefreshToken;if(t.expiresAt!==void 0)r.expiresAt=t.expiresAt;return r}var Su=null;async function N5(e,t){let r=await ul().catch(()=>null),o=Boolean(r?.connected&&!r.needsReconnect),a=window.open(t,"cf-connect","width=980,height=780");if(!a)return location.assign(t),{status:"redirect"};e.popup=a;let i=Date.now()+180000;return new Promise((s,l)=>{let f=0,c=()=>{if(window.removeEventListener("message",x),window.clearTimeout(f),!a.closed)a.close()},d=(P)=>{c(),s(P)},b=(P)=>{c(),l(Error(P))},y=(P)=>Boolean(P?.connected&&!P.needsReconnect),x=(P)=>{if(P.origin!==location.origin)return;if(!H1(P,"jx-cf"))return;let{data:j}=P;if(j.status==="error"){b(j.reason??"Cloudflare authorization failed");return}ul().then((k)=>{d(y(k)?{connection:k,status:"connected"}:{status:"timeout"})},()=>{b("Cloudflare connected, but the connection could not be confirmed")})};window.addEventListener("message",x);let S=async()=>{if(Date.now()>i){d({status:"timeout"});return}let P=null,j=!0;try{P=await ul()}catch{j=!1}if(j&&y(P)&&!o){d({connection:P,status:"connected"});return}if(a.closed){let k=await ul().catch(()=>null);d(y(k)?{connection:k,status:"connected"}:{status:"canceled"});return}f=window.setTimeout(()=>{S()},1500)};f=window.setTimeout(()=>{S()},1500)})}function wa(e){return n(e)&&e?e:void 0}function j5(e){if(!Array.isArray(e))return[];return e.flatMap((t)=>{if(!v(t))return[];let r=wa(t.id),o=wa(t.label),a=wa(t.detail);if(!r||!o||!a)return[];let i=Dp(t.actions),{connected:s}=t,l={detail:a,id:r,label:o};if(Ze(s))l.connected=s;if(i.length>0)l.actions=i;return[l]})}function R5(e){if(!Array.isArray(e))return[];return e.flatMap((t)=>{if(!v(t))return[];let r=wa(t.id),o=wa(t.title),a=wa(t.message);if(!r||!o||!a)return[];let i=Dp(t.actions),{display:s,level:l}=t,f={id:r,message:a,title:o};if(l==="info"||l==="warning")f.level=l;if(s==="banner"||s==="toast")f.display=s;if(i.length>0)f.actions=i;return[f]})}var Cu=null,A5=900000,I5=300;function L5(e){let t=Date.now()+A5;return new Promise((r,o)=>{let a=0,i=()=>{if(window.removeEventListener("message",l),window.clearTimeout(a),!e.closed)e.close()},s=(c)=>{i(),r(c)},l=(c)=>{if(c.origin!==location.origin)return;if(!H1(c,"jx-action"))return;let{data:d}=c;if(d.status==="done"||d.status==="canceled")s({status:d.status});else if(d.status==="error")i(),o(Error(d.reason??"The action could not be completed"))};window.addEventListener("message",l);let f=()=>{if(Date.now()>t){s({status:"unknown"});return}if(e.closed){a=window.setTimeout(()=>{s({status:"unknown"})},I5);return}a=window.setTimeout(f,1000)};a=window.setTimeout(f,1000)})}function O5(e){let t=/^([^/@]+)\/([^/@]+)@(.+)$/.exec(e);if(!t)return null;let[,r,o,a]=t,i=a?P5(a):null;if(!r||!o||!i)return null;return{owner:r,repo:o,...i}}async function B1(){let e=await fetch("/api/v1/projects",{credentials:"include"});return e.ok?ke(e):[]}async function D1(e){let t=O5(e);if(t)return t;let r=/^([^/@]+)\/([^/@]+)$/.exec(e);if(!r)return null;let[,o,a]=r,s=(await B1().catch(()=>[])).find((l)=>l.owner===o&&l.name===a);return s?{owner:s.owner,repo:s.name,branch:s.defaultBranch}:null}function V1(e){let t=e?E5(e):"",r=e?$u(e):"",o=null,a=null;async function i(k,T){if(!e)throw Error("No project is open in this session");let N=await fetch(`${t}${k}`,{credentials:"include",...T});if(N.status===403)await T5(N.clone());return N}let s=e?`${e.owner}/${e.repo}`:null;function l(k,T){return i(k,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(T)})}async function f(){return xe(await i("/project-info"),"Failed to load project")}let c=null;function d(){return c??=f().then((k)=>k.defaultBranch||"",()=>(c=null,"")),c}async function b(k){return(await xe(await i(`/file?path=${encodeURIComponent(k)}`),`Failed to read file: ${k}`)).content}let y=O1({async fetchBatch(k){let T=await l("/files/read",{paths:k});if(T.status===404||T.status===405)return"unsupported";if(T.status===403&&await C5(T))return"unsupported";if(!T.ok)return"retry-singly";let N;try{N=await ke(T)}catch{return"unsupported"}if(!S5(N))return"unsupported";return N},fetchOne:b}),x=null;async function S(){let k;try{x??=y.read("package.json").finally(()=>{x=null}),k=await x}catch{return{}}try{let T=M1(k);return v(T)?T:{}}catch{return{}}}let P={};if(t)P.assetSpace="repo",P.documentBaseUrl=`${t}/raw/`;let j={id:"cloud",projectRoot:r,gitHosted:!0,canvasUrl:"/canvas.html",...P,openProjectPicker:"repo-list",createDestination:"repo",async activate(){if(!e)return;let k=await l("/activate",{});if(!k.ok)throw await Tu(k,"Failed to open the project session")},async openProject(){if(!e)return null;let k=await f(),T=k.projectConfig??{};return{config:T,handle:{root:r,name:T.name||k.name,projectConfig:T}}},async probeRootProject(){if(!e)return null;try{let k=await f();return{meta:{root:r,name:k.name},info:{isSiteProject:k.projectConfig!==null,projectConfig:k.projectConfig??null}}}catch{return null}},async listDirectory(k){return xe(await i(`/files?dir=${encodeURIComponent(k)}`),`Failed to list directory: ${k}`)},async readFile(k){return y.read(k)},async readFileBytes(k){let T=await i(`/file/bytes?path=${encodeURIComponent(k)}`);if(!T.ok)throw Error(await on(T,`Failed to read file bytes: ${k}`));return T.arrayBuffer()},async writeFile(k,T){let N=await i("/file",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:k,content:T})});if(!N.ok)throw Error(await on(N,`Failed to write file: ${k}`))},async uploadFile(k,T){let N=await i(`/file/upload?path=${encodeURIComponent(k)}`,{method:"POST",body:T}),O=await xe(N,`Upload failed: ${k}`),D={path:O.path??k};if(O.size!==void 0)D.size=O.size;return D},async deleteFile(k){let T=await i(`/file?path=${encodeURIComponent(k)}`,{method:"DELETE"});if(!T.ok&&T.status!==404)throw Error(await on(T,`Failed to delete file: ${k}`))},async renameFile(k,T){return xe(await l("/file/rename",{from:k,to:T}),`Failed to rename: ${k} → ${T}`)},async findReferences(k){let T=new URLSearchParams;if(k.path)T.set("path",k.path);if(k.tagName)T.set("tag",k.tagName);return xe(await i(`/references?${T.toString()}`),`Failed to find references: ${k.path??k.tagName??""}`)},async createDirectory(k){},async collab(k){if(!e||typeof WebSocket>"u"||typeof location>"u")return null;a??=i("/collab").then(async(D)=>D.ok?LS(await ke(D)):{offer:[],refused:null}).catch(()=>({offer:[],refused:null}));let T=await a;if(T.refused!==null)return console.warn(`Collaboration unavailable: ${T.refused}`),null;let{offer:N}=T;return o??=(async()=>{let{createWsCollabConnection:D}=await (ce("arz2qsy9"),import("./chunks/ws-client-arz2qsy9.js")),M=location.protocol==="https:"?"wss":"ws";return D({hydratePath:async(V)=>y.read(V).then(()=>{},()=>{}),protocols:N,url:`${M}://${location.host}${t}/collab`})})(),(await o).openDoc(k)},subscribeFileEvents(k,T){if(!e||typeof WebSocket>"u"||typeof location>"u")return()=>{};let N=null,O=!1,D=!1,M=()=>{let F=location.protocol==="https:"?"wss":"ws",B=new WebSocket(`${F}://${location.host}${t}/events`);N=B,B.addEventListener("message",(L)=>{let U;try{U=JSON.parse(L.data)}catch{return}if(U.kind==="fs"&&U.events?.length)k(U.events);else if(U.kind==="git"&&U.event==="committed")T?.onResync?.("commit")}),B.addEventListener("open",()=>{V.opened(),T?.onResync?.(D?"reconnect":"open"),D=!0}),B.addEventListener("close",()=>{if(!O)V.scheduleRetry()})},V=Qy(M);return M(),()=>{O=!0,V.dispose(),N?.close()}},async listFormats(){try{let k=await i("/formats");if(!k.ok)return[];return(await ke(k)).formats??[]}catch{return[]}},async listExtensions(){try{let k=await i("/formats");if(!k.ok)return[];return(await ke(k)).extensions??[]}catch{return[]}},async listExtensionCatalog(){try{let k=await i("/catalog");if(!k.ok)return[];let T=await ke(k),N=await S(),O=new Set([...Object.keys(ku(N,"dependencies")),...Object.keys(ku(N,"devDependencies"))]);for(let D of T)D.installed=O.has(D.name);return T}catch{return[]}},async fetchProjectSchemas(){try{let k=await i("/project-schemas");if(!k.ok)return{};return await ke(k)}catch{return{}}},async formatAction(k){let T=await l("/format",k);if(!T.ok)throw Error(await on(T,"This cloud session cannot run format actions yet (the backend serves no format route)"));return(await ke(T)).result},async discoverComponents(){let k=new Set(["node_modules","dist",".git",".claude",".obsidian","build"]),T=400,N=6,O=[],D=async(V,F)=>{if(F>6||O.length>=400)return;let B;try{B=await j.listDirectory(V)}catch{return}let L=[];for(let U of B)if(U.type==="directory"){if(!k.has(U.name)&&!U.name.startsWith("."))L.push(U.path)}else if(U.name.endsWith(".json")&&O.length<400)O.push(U.path);await Promise.all(L.map(async(U)=>D(U,F+1)))};return await D("",0),(await Promise.all(O.map(async(V)=>{try{return PC(M1(await j.readFile(V)),V)}catch{return null}}))).filter((V)=>V!==null)},async codeService(){return null},async fetchPluginSchema(){return null},async addPackage(k){let T=await i("/packages/add",{body:JSON.stringify({name:k}),headers:{"Content-Type":"application/json"},method:"POST"});if(!T.ok)throw Error(await on(T,`Failed to add ${k}`))},async removePackage(k){let T=await i("/packages/remove",{body:JSON.stringify({name:k}),headers:{"Content-Type":"application/json"},method:"POST"});if(!T.ok)throw Error(await on(T,`Failed to remove ${k}`))},async setPackageVersions(k){let T=await i("/packages/set-versions",{body:JSON.stringify({updates:k}),headers:{"Content-Type":"application/json"},method:"POST"});if(!T.ok)return{log:await on(T,"Failed to update versions"),ok:!1};return ke(T)},async packageVersions(){let k=await i("/packages/versions");return k.ok?ke(k):[]},async listPackages(){let k=await S(),T=[],N=ku(k,"dependencies");for(let[D,M]of Object.entries(N))T.push({name:D,version:M});let O=ku(k,"devDependencies");for(let[D,M]of Object.entries(O))T.push({name:D,version:M,dev:!0});return T},async resolveSiteContext(k){try{let N=(await f()).projectConfig??void 0,O={sitePath:r};if(N!==void 0)O.projectConfig=N;if(k!==r)O.fileRelPath=k;return O}catch{return{sitePath:null}}},async locateFile(k){try{let T=await i(`/locate?name=${encodeURIComponent(k)}`);if(T.ok)return(await ke(T)).path??null}catch{}return null},async searchFiles(k,T=[]){let N=["json",...T.map((D)=>D.replace(/^\./,""))],O=await i(`/search?query=${encodeURIComponent(k)}&extensions=${encodeURIComponent(N.join(","))}`);if(!O.ok)return[];return await ke(O)},async gitStatus(){return xe(await i("/git/status"),"Failed to read git status")},async gitBranches(){let k=await xe(await i("/git/branches"),"Failed to list branches");if(k.defaultBranch)return k;let T=await d();return T?{...k,defaultBranch:T}:k},async gitLog(k){let T=k?`?limit=${k}`:"";return xe(await i(`/git/log${T}`),"Failed to read git log")},async gitStage(k){await xe(await l("/git/stage",{files:k}),"Failed to stage files")},async gitUnstage(k){await xe(await l("/git/unstage",{files:k}),"Failed to unstage files")},async gitCommit(k){await xe(await l("/git/commit",{message:k}),"Commit failed")},async gitPush(){await xe(await l("/git/push",{}),"Push failed")},async gitPull(){await xe(await l("/git/pull",{}),"Pull failed")},async gitFetch(){await xe(await l("/git/fetch",{}),"Fetch failed")},async gitCheckout(k){if(e&&typeof location<"u")location.assign(kv({...e,branch:k}))},async gitCreateBranch(k){await xe(await l("/git/create-branch",{name:k}),"Failed to create branch")},async gitCommitBranch(k){return xe(await l("/git/commit-branch",{branch:k.branch,message:k.message}),`Could not publish to ${k.branch}`)},async gitDiff(k){return(await xe(await i(`/git/diff?path=${encodeURIComponent(k??"")}`),"Failed to compute diff")).diff},async gitShow(k){let T=new URLSearchParams({path:k.path});if(k.ref)T.set("ref",k.ref);return(await xe(await i(`/git/show?${T}`),`Failed to read ${k.path} at ref`)).content},async gitDiscard(k){await xe(await l("/git/discard",{files:k}),"Failed to discard changes")},async gitInit(){},async gitAddRemote(){},async buildSite(){return xe(await i("/build",{method:"POST"}),"The site could not be previewed.")},async listProjects(){return(await B1()).map((T)=>({name:T.fullName,root:$u({owner:T.owner,repo:T.name,branch:T.defaultBranch}),description:`${T.defaultBranch} · ${T.permission}`}))},async listStarters(){let k=await fetch("/api/v1/starters",{credentials:"include"});if(!k.ok)return[];return await ke(k)},async setWindowProject(k){let T=await D1(k);if(!T)throw Error(`No project to open at ${k}`);if(typeof location<"u")location.assign(kv(T));return{deduped:!0,config:null}},async openProjectInNewWindow(k){let T=await D1(k);if(!T)throw Error(`No project to open at ${k}`);if(typeof window<"u")window.open(kv(T),"_blank","noopener");return{focused:!1}},async createProject(k){let{destination:T}=k;if(T.kind!=="repo"||!T.owner||!T.repo)throw Error("A destination repository is required.");let N=await fetch("/api/v1/projects",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:k.name,description:k.description,starter:k.starter,owner:T.owner,repo:T.repo,private:T.private})});if(!N.ok)throw await Tu(N,"Failed to create project");let O=await ke(N);return{root:$u({owner:O.owner,repo:O.name,branch:O.defaultBranch}),config:{name:k.name}}},async importSite(k,T,N,O){return await xu("/api/v1/import/site",k,T,N,O)},async getUser(){let k=await fetch("/api/v1/me",{credentials:"include"});if(!k.ok)return null;let T=await ke(k);if(!T.user)return null;let N={login:T.user.login};if(T.user.name)N.name=T.user.name;if(T.user.avatar_url)N.avatarUrl=T.user.avatar_url;return N},async listRepos(){let k=await fetch("/api/v1/repos",{credentials:"include"});if(!k.ok)throw Error(await on(k,"Failed to list repositories"));return(await ke(k)).map((N)=>({owner:N.owner,name:N.name,fullName:N.fullName,private:N.private,defaultBranch:N.defaultBranch,permission:N.permission,isJxProject:N.isJxProject}))},async listRepoProjects(k){let T=await fetch(`/api/v1/repos/${encodeURIComponent(k.owner)}/${encodeURIComponent(k.name)}/projects`,{credentials:"include"}),N=await xe(T,"Failed to look for projects"),O=[];for(let D of N.locations){let M=Bl(D.dir);if(M!==null)O.push(D.name?{dir:M,name:D.name}:{dir:M})}return{branch:N.branch,locations:O,truncated:N.truncated===!0}},async importProject(k){let T=Bl(k.dir??"");if(T===null)throw Error("The project folder must stay inside the repository.");let N={owner:k.owner,name:k.name};if(T)N.dir=T;let O=await fetch("/api/v1/projects/import",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify(N)}),D=await xe(O,"Failed to import repository"),M={owner:D.owner,repo:D.name,branch:D.defaultBranch};if(T)M.dir=T;return{root:$u(M)}},async getAccountStatus(){let k=await fetch("/api/v1/me",{credentials:"include"});if(!k.ok)return null;let T=await ke(k),N=j5(T.entries),O=R5(T.notices),D={installations:(T.installations??[]).map((M)=>{let V={id:M.id,account:M.account};if(M.manageUrl)V.manageUrl=M.manageUrl;return V})};if(T.appInstallUrl)D.appInstallUrl=T.appInstallUrl;if(N.length>0)D.entries=N;if(O.length>0)D.notices=O;return D},performAction(k){if(typeof window>"u"||typeof location>"u"||!k.href)return Promise.resolve(null);let T=Cu;if(T){try{T.popup?.focus()}catch{}return T.promise}let N=window.open(k.href,"jx-action","width=980,height=820");if(!N)return location.assign(k.href),Promise.resolve({status:"redirect"});let O={popup:N,promise:Promise.resolve(null)};return Cu=O,O.promise=L5(N).finally(()=>{if(Cu===O)Cu=null}),O.promise},async createPullRequest(k){return xe(await l("/git/pr",k),"Failed to open pull request")},async cfConnection(){return ul()},cfConnect(){if(typeof window>"u"||typeof location>"u")return Promise.resolve(null);let k=Su;if(k){try{k.popup?.focus()}catch{}return k.promise}let T={popup:null,promise:Promise.resolve(null)};Su=T;let N=s?`/api/v1/cf/connect?project=${encodeURIComponent(s)}`:"/api/v1/cf/connect";return T.promise=N5(T,N).finally(()=>{if(Su===T)Su=null}),T.promise},async cfAccounts(){let k=await fetch("/api/v1/cf/accounts",{credentials:"include"});return xe(k,"Failed to list Cloudflare accounts")},async cfSelectAccount(k){let T=await fetch("/api/v1/cf/select-account",{body:JSON.stringify({accountId:k.id,accountName:k.name}),credentials:"include",headers:{"Content-Type":"application/json"},method:"POST"});if(!T.ok)throw Error(await on(T,"Failed to select a Cloudflare account"))},async cfDisconnect(){let k=await fetch("/api/v1/cf/connection",{credentials:"include",method:"DELETE"});if(!k.ok)throw Error(await on(k,"Failed to disconnect Cloudflare"))},async cfApi(k,T){let N={};if(s)N["X-Jx-Project"]=s;if(T?.body!==void 0)N["Content-Type"]="application/json";let O={method:T?.method??"GET",credentials:"include"};if(Object.keys(N).length>0)O.headers=N;if(T?.body!==void 0)O.body=JSON.stringify(T.body);let D=await fetch(`/api/v1/cf/proxy${k}`,O);if(D.status===403){let V=await ke(D.clone()).catch(()=>null);if(_1(V))throw await Tu(D,"Publishing was refused")}let M=await ke(D);if(!D.ok||M.success===!1){let V=M.errors?.map((F)=>F.message).join("; ")??M.error??D.statusText;throw Error(`Cloudflare API: ${V}`)}return M.result??M},aiChatUrl(){return s?`/api/v1/ai/chat?project=${encodeURIComponent(s)}`:"/api/v1/ai/chat"}};return j}async function re(e){return await e.json()}function W1(){let e="",t=null,r=null,o=null;async function a(c){if(!c)return;let d=await fetch("/__studio/activate",{body:JSON.stringify({root:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!d.ok){let b=await re(d).catch(()=>({}));throw Error(`Could not open ${c}: ${tr(b)??`activation failed (${d.status})`}`)}}function i(){if(!e)return;t=a(e).catch((c)=>{console.error("Project re-activation failed:",c)})}if(typeof window<"u")window.addEventListener("focus",i);function s(c){let d=c.replaceAll("\\","/");if(!e)return d;if(d===".")return e;return`${e}/${d}`}function l(c,d={}){let b=new URLSearchParams(d);if(e)b.set("dir",s("."));let y=b.toString();return`/__studio/git/${c}${y?`?${y}`:""}`}function f(c){let d=c.replaceAll("\\","/");if(!e)return d;return d.startsWith(`${e}/`)?d.slice(e.length+1):d}return{id:"devserver",createDestination:"path",get projectRoot(){return e},set projectRoot(c){if(e=c||"",e)t=this.activate(e).catch((d)=>{console.error("Project activation failed:",d)})},async activate(c){await a(c??e)},async probeRootProject(){try{let[c,d]=await Promise.all([fetch("/__studio/project"),fetch("/__studio/project-info?dir=.")]),b=c.ok?await re(c):{name:"project",root:"."};return{info:d.ok?await re(d):{isSiteProject:!1},meta:b}}catch{return null}},async createProject(c){let d=await fetch("/__studio/create-project",{body:JSON.stringify(c),headers:{"Content-Type":"application/json"},method:"POST"});if(!d.ok){let b=await re(d);throw Error(tr(b)??"Failed to create project")}return await d.json()},async listStarters(){let c=await fetch("/__studio/starters");if(!c.ok)throw Error("Failed to load starters");return await re(c)},async importSite(c,d,b,y){return await xu("/__studio/import-site",c,d,b,y)},async listDirectory(c){let d=await fetch(`/__studio/files?dir=${encodeURIComponent(s(c))}`);if(!d.ok)throw Error(`Failed to list directory: ${c}`);let b=await re(d);for(let y of b)y.path=f(y.path);return b},async readFile(c){let d=await fetch(`/__studio/file?path=${encodeURIComponent(s(c))}&optional=1`);if(!d.ok)throw Error(`Failed to read file: ${c}`);let b=await re(d);if(b.content===null)throw Error(`Failed to read file: ${c} (not found)`);return b.content},async readFileBytes(c){let d=await fetch(`/__studio/file/bytes?path=${encodeURIComponent(s(c))}`);if(!d.ok)throw Error(`Failed to read file bytes: ${c}`);return d.arrayBuffer()},async writeFile(c,d){if(!(await fetch(`/__studio/file?path=${encodeURIComponent(s(c))}`,{body:d,method:"PUT"})).ok)throw Error(`Failed to write file: ${c}`)},async uploadFile(c,d){let b=await fetch(`/__studio/file/upload?path=${encodeURIComponent(s(c))}`,{body:d,method:"POST"});if(!b.ok)throw Error(`Upload failed: ${c}`);let y=await re(b),x={path:y.path??c};if(y.size!==void 0)x.size=y.size;return x},async deleteFile(c){let d=await fetch(`/__studio/file?path=${encodeURIComponent(s(c))}`,{method:"DELETE"});if(!d.ok&&d.status!==404)throw Error(`Failed to delete file: ${c}`)},async renameFile(c,d){let b=await fetch("/__studio/file/rename",{body:JSON.stringify({from:s(c),to:s(d)}),headers:{"Content-Type":"application/json"},method:"POST"});if(!b.ok)throw Error(`Failed to rename: ${c} → ${d}`);return re(b)},async findReferences(c){await t;let d=new URLSearchParams;if(c.path)d.set("path",s(c.path));if(c.tagName)d.set("tag",c.tagName);let b=await fetch(`/__studio/references?${d.toString()}`);if(!b.ok)throw Error(`Failed to find references: ${c.path??c.tagName??""}`);return re(b)},subscribeFileEvents(c,d){if(typeof EventSource>"u")return()=>{};let b=new EventSource("/__reload"),y=0;return b.addEventListener("open",()=>{if(y+=1,y>1)i(),d?.onResync?.("reconnect")}),b.addEventListener("fs",(x)=>{let S;try{S=JSON.parse(x.data)}catch{return}let P=[];for(let j of S.events??[]){let k=j.path.replaceAll("\\","/");if(e&&k!==e&&!k.startsWith(`${e}/`))continue;let T=f(k);if(T&&!T.startsWith(".."))P.push({isDir:j.isDir,path:T,type:j.type})}if(P.length>0)c(P)}),()=>{b.close()}},async collab(c){if(typeof WebSocket>"u"||typeof location>"u")return null;if(r===null)r=fetch("/__studio/collab").then(async(x)=>x.ok?LS(await re(x)):null).catch(()=>null);let d=await r;if(d===null)return null;if(d.refused!==null)return console.warn(`Collaboration unavailable: ${d.refused}`),null;let{offer:b}=d;return o??=(async()=>{let{createWsCollabConnection:x}=await (ce("arz2qsy9"),import("./chunks/ws-client-arz2qsy9.js")),S=location.protocol==="https:"?"wss":"ws";return x({protocols:b,url:`${S}://${location.host}/__studio/collab`})})(),(await o).openDoc(s(c))},async createDirectory(c){},async discoverComponents(c){let d=c||e;if(!d)return[];let b=`/__studio/components?dir=${encodeURIComponent(d)}`,y=await fetch(b);if(!y.ok)return[];return await y.json()},async addPackage(c){let d=await fetch("/__studio/packages/add",{body:JSON.stringify({name:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!d.ok)throw Error(await d.text());return await d.json()},async removePackage(c){let d=await fetch("/__studio/packages/remove",{body:JSON.stringify({name:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!d.ok)throw Error(await d.text());return await d.json()},async listPackages(){let c=await fetch("/__studio/packages");if(!c.ok)return[];return await c.json()},async installDependencies(){let c=await fetch("/__studio/packages/install",{method:"POST"});if(!c.ok)return{log:await c.text(),ok:!1};return await c.json()},async dependenciesNeedInstall(){let c=await fetch("/__studio/packages/needs-install");if(!c.ok)return!1;let d=await re(c);return Boolean(d.needsInstall)},async packageVersions(){let c=await fetch("/__studio/packages/versions");if(!c.ok)return[];return await c.json()},async setPackageVersions(c){let d=await fetch("/__studio/packages/set-versions",{body:JSON.stringify({updates:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!d.ok)return{log:await d.text(),ok:!1};return await d.json()},async codeService(c,d){try{let b=await fetch(`/__studio/code/${c}`,{body:JSON.stringify(d),headers:{"Content-Type":"application/json"},method:"POST"});if(!b.ok)return null;return await b.json()}catch{return null}},async resolveSiteContext(c){let d=await fetch(`/__studio/resolve-site?path=${encodeURIComponent(c)}`);if(!d.ok)return{sitePath:null};return await d.json()},async locateFile(c){try{let d=await fetch("/__studio/locate",{body:JSON.stringify({name:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(d.ok)return(await re(d)).path||null}catch{}return null},async searchFiles(c,d=[]){let b=["json",...d.map((P)=>P.replace(/^\./,""))],y=`**/*${c}*.{${b.join(",")}}`,x=await fetch(`/__studio/files?dir=${encodeURIComponent(s("."))}&glob=${encodeURIComponent(y)}`);if(!x.ok)return[];let S=await re(x);for(let P of S)P.path=f(P.path);return S},async listFormats(){let c=await fetch(`/__studio/formats?dir=${encodeURIComponent(s("."))}`);if(!c.ok)return[];return(await re(c)).formats??[]},async listExtensions(){let c=await fetch(`/__studio/formats?dir=${encodeURIComponent(s("."))}`);if(!c.ok)return[];return(await re(c)).extensions??[]},async listExtensionCatalog(){let c=await fetch(`/__studio/catalog?dir=${encodeURIComponent(s("."))}`);return c.ok?await re(c):[]},async fetchProjectSchemas(){let c=await fetch(`/__studio/project-schemas?dir=${encodeURIComponent(s("."))}`);if(!c.ok)return{};return await re(c)},async dataConnections(){let c=await fetch(`/__studio/data/connections?dir=${encodeURIComponent(s("."))}`);if(!c.ok){let d=await re(c);throw Error(tr(d)??"Failed to list connections")}return await re(c)},async dataConnectionTest(c){let d=await fetch(`/__studio/data/connections/test?dir=${encodeURIComponent(s("."))}`,{body:JSON.stringify({connection:c}),headers:{"Content-Type":"application/json"},method:"POST"}),b=await re(d);if(!d.ok)throw Error(tr(b)??"Connection test failed");return b},async dataPush(c){let d=await fetch(`/__studio/data/push?dir=${encodeURIComponent(s("."))}`,{body:JSON.stringify(c??{}),headers:{"Content-Type":"application/json"},method:"POST"}),b=await re(d);if(!d.ok)throw Error(tr(b)??"Schema push failed");return b},async dataRows(c){let d=new URLSearchParams({dir:s("."),table:c.table});if(c.connection)d.set("connection",c.connection);if(c.limit!==void 0)d.set("limit",String(c.limit));if(c.offset!==void 0)d.set("offset",String(c.offset));if(c.orderBy!==void 0)d.set("orderBy",c.orderBy);if(c.dir!==void 0)d.set("dir",c.dir);let b=await fetch(`/__studio/data/rows?${d}`),y=await re(b);if(!b.ok)throw Error(tr(y)??"Failed to load rows");return y},async dataInsertRow(c){let d=await fetch(`/__studio/data/rows?dir=${encodeURIComponent(s("."))}`,{body:JSON.stringify(c),headers:{"Content-Type":"application/json"},method:"POST"}),b=await re(d);if(!d.ok)throw Error(tr(b)??"Insert failed");return b},async dataUpdateRow(c){let d=await fetch(`/__studio/data/rows?dir=${encodeURIComponent(s("."))}`,{body:JSON.stringify(c),headers:{"Content-Type":"application/json"},method:"PUT"}),b=await re(d);if(!d.ok)throw Error(tr(b)??"Update failed");return b},async dataDeleteRow(c){let d=new URLSearchParams({dir:s("."),pk:String(c.pk),table:c.table});if(c.connection)d.set("connection",c.connection);let b=await fetch(`/__studio/data/rows?${d}`,{method:"DELETE"}),y=await re(b);if(!b.ok)throw Error(tr(y)??"Delete failed");return y},async listSecrets(){let c=await fetch(`/__studio/secrets?dir=${encodeURIComponent(s("."))}`);if(!c.ok){let b=await re(c);throw Error(tr(b)??"Failed to list secrets")}return(await re(c)).names},async setSecrets(c){let d=await fetch(`/__studio/secrets?dir=${encodeURIComponent(s("."))}`,{body:JSON.stringify(c),headers:{"Content-Type":"application/json"},method:"PUT"}),b=await re(d);if(!d.ok)throw Error(tr(b)??"Failed to write secrets");return b},async formatAction(c){let d=await fetch("/__studio/format",{body:JSON.stringify({...c,dir:s(".")}),headers:{"Content-Type":"application/json"},method:"POST"}),b=await re(d);if(!d.ok)throw Error(tr(b)??"Format action failed");return b.result},async fetchPluginSchema(c,d,b){let y=new URLSearchParams({src:c});if(d)y.set("prototype",d);if(b)y.set("base",b);let x=await fetch(`/__studio/plugin-schema?${y}`);if(!x.ok)return null;let{schema:S}=await re(x);return S},async resolveClass(c){let d=await fetch("/__jx_resolve__",{body:JSON.stringify(c),headers:{"content-type":"application/json"},method:"POST"});if(!d.ok)throw Error(`Class resolution failed: ${d.status}`);return await re(d)},async gitStatus(){let c=await fetch(l("status"));if(!c.ok)throw Error(await c.text());return await c.json()},async gitBranches(){let c=await fetch(l("branches"));if(!c.ok)throw Error(await c.text());return await c.json()},async gitLog(c){let d=await fetch(l("log",c?{limit:String(c)}:{}));if(!d.ok)throw Error(await d.text());return await d.json()},async gitStage(c){let d=await fetch(l("stage"),{body:JSON.stringify({files:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!d.ok){let b=await re(d);throw Error(ll(b))}return await d.json()},async gitUnstage(c){let d=await fetch(l("unstage"),{body:JSON.stringify({files:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!d.ok){let b=await re(d);throw Error(ll(b))}return await d.json()},async gitCommit(c){let d=await fetch(l("commit"),{body:JSON.stringify({message:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!d.ok){let b=await re(d);throw Error(ll(b))}return await d.json()},async gitPush(c){let d=await fetch(l("push"),{body:JSON.stringify(c||{}),headers:{"Content-Type":"application/json"},method:"POST"});if(!d.ok){let b=await re(d);throw Error(ll(b))}return await d.json()},async gitPull(){let c=await fetch(l("pull"),{method:"POST"});if(!c.ok){let d=await re(c);throw Error(ll(d))}return await c.json()},async gitFetch(){let c=await fetch(l("fetch"),{method:"POST"});if(!c.ok){let d=await re(c);throw Error(ll(d))}return await c.json()},async gitCheckout(c){let d=await fetch(l("checkout"),{body:JSON.stringify({branch:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!d.ok){let b=await re(d);throw Error(ll(b))}return await d.json()},async gitCreateBranch(c){let d=await fetch(l("create-branch"),{body:JSON.stringify({name:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!d.ok){let b=await re(d);throw Error(ll(b))}return await d.json()},async gitDiff(c){let d=await fetch(l("diff",{path:c??""}));if(!d.ok)throw Error(await d.text());return await d.json()},async gitShow(c){let d=await fetch(l("show",c.ref?{path:c.path,ref:c.ref}:{path:c.path}));if(!d.ok)throw Error(await d.text());return(await re(d)).content},async gitDiscard(c){let d=await fetch(l("discard"),{body:JSON.stringify({files:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!d.ok){let b=await re(d);throw Error(ll(b))}return await d.json()},async gitClone(c){let d=await fetch(l("clone"),{body:JSON.stringify({url:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!d.ok){let b=await re(d);throw Error(ll(b))}return await d.json()},async gitInit(){let c=await fetch(l("init"),{method:"POST"});if(!c.ok){let d=await re(c);throw Error(ll(d))}},async buildSite(){let c=await fetch("/__studio/build",{method:"POST"});if(!c.ok){let d=await re(c);throw Error(tr(d)??"The site could not be built.")}return await re(c)},async previewSite(c){let d=await fetch("/__studio/preview",{body:JSON.stringify(c),headers:{"Content-Type":"application/json"},method:"POST"});if(!d.ok){let b=await re(d);throw Error(tr(b)??"The site could not be previewed.")}return await re(d)},async setPreviewOverlay(c,d){await fetch("/__studio/preview/overlay",{body:JSON.stringify({contents:d,path:c}),headers:{"Content-Type":"application/json"},method:"POST"})},async clearPreviewOverlay(c){await fetch("/__studio/preview/overlay",{body:JSON.stringify(c===void 0?{}:{path:c}),headers:{"Content-Type":"application/json"},method:"DELETE"})},async gitAddRemote(c,d){let b=await fetch(l("add-remote"),{body:JSON.stringify({name:c,url:d}),headers:{"Content-Type":"application/json"},method:"POST"});if(!b.ok){let y=await re(b);throw Error(ll(y))}},async cfApi(c,d){let{getCfToken:b}=await (ce("mkbcz4z2"),import("./chunks/cf-settings-mkbcz4z2.js")),y=b();if(!y)throw Error("No Cloudflare API token configured");let x=await fetch("/__studio/cf/proxy",{method:"POST",headers:{"Content-Type":"application/json","X-CF-Token":y},body:JSON.stringify({path:c,method:d?.method??"GET",body:d?.body})}),S=await re(x);if(!x.ok||S.success===!1){let P=S.errors?.map((j)=>j.message).join("; ")??S.error??x.statusText;throw Error(`Cloudflare API: ${P}`)}return S.result??S},async cfConnection(){let{getCfAccountId:c,getCfToken:d,setCfAccountId:b}=await (ce("mkbcz4z2"),import("./chunks/cf-settings-mkbcz4z2.js"));if(!d())return null;try{let y=await this.cfApi("/accounts");if(!Array.isArray(y)||y.length===0)return{connected:!1};let x=y,S=x.find((P)=>P.id===c())??x[0];return b(S.id),{connected:!0,accountId:S.id,accountName:S.name}}catch{return{connected:!1}}},async listProjects(){let c=await fetch("/__studio/sites");if(!c.ok)return[];return(await re(c)).map((b)=>({name:b.config?.name||b.path.split("/").at(-1)||b.path,root:b.path,description:b.path}))},aiChatUrl(){return"/__studio/ai/chat"}}}var M5=new Set(["views:","file:"]);function D5(){let e=typeof document>"u"?void 0:document,t=`meta[name="${xv.name}"][content="${xv.content}"]`;return{cloud:globalThis.__jxCloud!=null,declared:e?.querySelector(t)!=null,launcher:Av(),protocol:typeof location>"u"?"":location.protocol}}function F5(e=D5()){if(e.launcher)return{kind:"launcher",launcher:e.launcher.launcher};if(e.cloud)return null;if(e.declared)return{kind:"declared"};if(M5.has(e.protocol))return{kind:"scheme",protocol:e.protocol};return null}function _5(e){switch(e.kind){case"launcher":return`Jx Studio's launcher (${e.launcher??"unnamed"}) announced itself but registered no platform adapter.`;case"declared":return"Jx Studio's page declares a boot module, but nothing registered a platform adapter.";default:return`Jx Studio was opened from a ${e.protocol} URL, which has no backend for the dev-server adapter.`}}class Eu extends Error{refusal;constructor(e){super(_5(e));this.name="PlatformUnavailableError",this.refusal=e}}function q1(){let e=F5();if(e)throw new Eu(e);let t=globalThis.__jxCloud;return t?V1(t.project):W1()}function z5(e){return _(e)&&"getFrame"in e&&Q(e.getFrame)}function H5(){let e=globalThis.__jxPlatform;if(e==null||!("windowControls"in e))return;let t=e.windowControls;return z5(t)?t:void 0}var B5=["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],U1=400,J1=300,G1=!1;function K1(){let e=H5();if(!e||G1)return;G1=!0;let t=document.createElement("div");t.id="resize-edges";for(let r of B5){let o=document.createElement("div");o.className=`resize-edge ${r}`,o.addEventListener("mousedown",(a)=>V5(a,r,e)),t.append(o)}document.body.append(t)}async function V5(e,t,r){e.preventDefault(),e.stopPropagation();let{screenX:o,screenY:a}=e,s={...await r.getFrame()};function l(c){let d=c.screenX-o,b=c.screenY-a,{x:y,y:x,width:S,height:P}=s;if(t.includes("right"))S=Math.max(U1,S+d);if(t.includes("left")){let j=Math.max(U1,S-d);y+=S-j,S=j}if(t.includes("bottom"))P=Math.max(J1,P+b);if(t.includes("top")){let j=Math.max(J1,P-b);x+=P-j,P=j}r.setFrame(y,x,S,P)}function f(){document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",f)}document.addEventListener("mousemove",l),document.addEventListener("mouseup",f)}var $v={allTags:["a","abbr","address","animate","animateMotion","animateTransform","annotation","annotation-xml","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","circle","cite","clipPath","code","col","colgroup","data","datalist","dd","defs","del","desc","details","dfn","dialog","div","dl","dt","ellipse","em","embed","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","fencedframe","fieldset","figcaption","figure","filter","footer","foreignObject","form","g","geolocation","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","image","img","input","ins","kbd","label","legend","li","line","linearGradient","link","maction","main","map","mark","marker","mask","math","menu","merror","meta","metadata","meter","mfrac","mi","mmultiscripts","mn","mo","model","mover","mpadded","mpath","mphantom","mprescripts","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msubsup","msup","mtable","mtd","mtext","mtr","munder","munderover","nav","noscript","object","ol","optgroup","option","output","p","path","pattern","picture","polygon","polyline","portal","pre","progress","q","radialGradient","rb","rect","rp","rt","rtc","ruby","s","samp","script","search","section","select","selectedcontent","semantics","set","slot","small","source","span","stop","strong","style","sub","summary","sup","svg","switch","symbol","table","tbody","td","template","text","textPath","textarea","tfoot","th","thead","time","title","tr","track","tspan","u","ul","use","var","video","view","wbr"],cssProps:[["accentColor","auto"],["alignContent","normal"],["alignItems","normal"],["alignmentBaseline","baseline"],["alignSelf","auto"],["all","see individual properties"],["anchorName","none"],["anchorScope","none"],["animation","see individual properties"],["animationComposition","replace"],["animationDelay","0s"],["animationDirection","normal"],["animationDuration","auto"],["animationFillMode","none"],["animationIterationCount","1"],["animationName","none"],["animationPlayState","running"],["animationRange","see individual properties"],["animationRangeCenter","normal"],["animationRangeEnd","normal"],["animationRangeStart","normal"],["animationTimeline","auto"],["animationTimingFunction","ease"],["animationTrigger","none"],["appearance","none"],["aspectRatio","auto"],["backdropFilter","none"],["backfaceVisibility","visible"],["background","see individual properties"],["backgroundAttachment","scroll"],["backgroundBlendMode","normal"],["backgroundClip","border-box"],["backgroundColor","transparent"],["backgroundImage","none"],["backgroundOrigin","padding-box"],["backgroundPosition","0% 0%"],["backgroundPositionBlock","0%"],["backgroundPositionInline","0%"],["backgroundPositionX","0%"],["backgroundPositionY","0%"],["backgroundRepeat","repeat"],["backgroundRepeatBlock","repeat"],["backgroundRepeatInline","repeat"],["backgroundRepeatX","repeat"],["backgroundRepeatY","repeat"],["backgroundSize","auto"],["backgroundTbd","see individual properties"],["baselineShift","0"],["baselineSource","auto"],["blockEllipsis","no-ellipsis"],["blockSize","auto"],["blockStep","see individual properties"],["blockStepAlign","auto"],["blockStepInsert","margin-box"],["blockStepRound","up"],["blockStepSize","none"],["bookmarkLabel","content(text)"],["bookmarkLevel","none"],["bookmarkState","open"],["border","see individual properties"],["borderBlock","see individual properties"],["borderBlockClip","see individual properties"],["borderBlockColor","see individual properties"],["borderBlockEnd","See individual properties"],["borderBlockEndClip","none"],["borderBlockEndColor","currentcolor"],["borderBlockEndRadius","0"],["borderBlockEndStyle","none"],["borderBlockEndWidth","medium"],["borderBlockStart","See individual properties"],["borderBlockStartClip","none"],["borderBlockStartColor","currentcolor"],["borderBlockStartRadius","0"],["borderBlockStartStyle","none"],["borderBlockStartWidth","medium"],["borderBlockStyle","see individual properties"],["borderBlockWidth","see individual properties"],["borderBottom","See individual properties"],["borderBottomClip","none"],["borderBottomColor","currentcolor"],["borderBottomLeftRadius","0"],["borderBottomRadius","0"],["borderBottomRightRadius","0"],["borderBottomStyle","none"],["borderBottomWidth","medium"],["borderBoundary","none"],["borderClip","see individual properties"],["borderCollapse","separate"],["borderColor","see individual properties"],["borderEndEndRadius","0"],["borderEndStartRadius","0"],["borderImage","See individual properties"],["borderImageOutset","0"],["borderImageRepeat","stretch"],["borderImageSlice","100%"],["borderImageSource","none"],["borderImageWidth","1"],["borderInline","see individual properties"],["borderInlineClip","see individual properties"],["borderInlineColor","see individual properties"],["borderInlineEnd","See individual properties"],["borderInlineEndClip","none"],["borderInlineEndColor","currentcolor"],["borderInlineEndRadius","0"],["borderInlineEndStyle","none"],["borderInlineEndWidth","medium"],["borderInlineStart","See individual properties"],["borderInlineStartClip","none"],["borderInlineStartColor","currentcolor"],["borderInlineStartRadius","0"],["borderInlineStartStyle","none"],["borderInlineStartWidth","medium"],["borderInlineStyle","see individual properties"],["borderInlineWidth","see individual properties"],["borderLeft","See individual properties"],["borderLeftClip","none"],["borderLeftColor","currentcolor"],["borderLeftRadius","0"],["borderLeftStyle","none"],["borderLeftWidth","medium"],["borderLimit","all"],["borderRadius","see individual properties"],["borderRight","See individual properties"],["borderRightClip","none"],["borderRightColor","currentcolor"],["borderRightRadius","0"],["borderRightStyle","none"],["borderRightWidth","medium"],["borderShape","none"],["borderSpacing","0px 0px"],["borderStartEndRadius","0"],["borderStartStartRadius","0"],["borderStyle","see individual properties"],["borderTop","See individual properties"],["borderTopClip","none"],["borderTopColor","currentcolor"],["borderTopLeftRadius","0"],["borderTopRadius","0"],["borderTopRightRadius","0"],["borderTopStyle","none"],["borderTopWidth","medium"],["borderWidth","see individual properties"],["bottom","auto"],["boxDecorationBreak","slice"],["boxShadow","none"],["boxShadowBlur","0"],["boxShadowColor","currentcolor"],["boxShadowOffset","none"],["boxShadowPosition","outset"],["boxShadowSpread","0"],["boxSizing","content-box"],["boxSnap","none"],["breakAfter","auto"],["breakBefore","auto"],["breakInside","auto"],["captionSide","top"],["caret","auto"],["caretAnimation","auto"],["caretColor","auto"],["caretShape","auto"],["clear","none"],["clip","auto"],["clipPath","none"],["clipRule","nonzero"],["color","CanvasText"],["colorAdjust","see individual properties"],["colorInterpolation","sRGB"],["colorInterpolationFilters","linearRGB"],["colorScheme","normal"],["columnCount","auto"],["columnFill","balance"],["columnGap","normal"],["columnHeight","auto"],["columnRule","see individual properties"],["columnRuleBreak","normal"],["columnRuleColor","currentcolor"],["columnRuleInset","see individual properties"],["columnRuleInsetCap","see individual properties"],["columnRuleInsetCapEnd","0"],["columnRuleInsetCapStart","0"],["columnRuleInsetEnd","see individual properties"],["columnRuleInsetJunction","see individual properties"],["columnRuleInsetJunctionEnd","0"],["columnRuleInsetJunctionStart","0"],["columnRuleInsetStart","see individual properties"],["columnRuleStyle","none"],["columnRuleVisibilityItems","normal"],["columnRuleWidth","medium"],["columns","see individual properties"],["columnSpan","none"],["columnWidth","auto"],["columnWrap","auto"],["contain","none"],["container","see individual properties"],["containerName","none"],["containerType","normal"],["containIntrinsicBlockSize","none"],["containIntrinsicHeight","none"],["containIntrinsicInlineSize","none"],["containIntrinsicSize","see individual properties"],["containIntrinsicWidth","none"],["content","normal"],["contentVisibility","visible"],["continue","auto"],["copyInto","none"],["corner","0"],["cornerBlockEnd","0"],["cornerBlockEndShape","see individual properties"],["cornerBlockStart","0"],["cornerBlockStartShape","see individual properties"],["cornerBottom","0"],["cornerBottomLeft","0"],["cornerBottomLeftShape","round"],["cornerBottomRight","0"],["cornerBottomRightShape","round"],["cornerBottomShape","see individual properties"],["cornerEndEnd","0"],["cornerEndEndShape","round"],["cornerEndStart","0"],["cornerEndStartShape","round"],["cornerInlineEnd","0"],["cornerInlineEndShape","see individual properties"],["cornerInlineStart","0"],["cornerInlineStartShape","see individual properties"],["cornerLeft","0"],["cornerLeftShape","see individual properties"],["cornerRight","0"],["cornerRightShape","see individual properties"],["cornerShape","round"],["cornerStartEnd","0"],["cornerStartEndShape","round"],["cornerStartStart","0"],["cornerStartStartShape","round"],["cornerTop","0"],["cornerTopLeft","0"],["cornerTopLeftShape","round"],["cornerTopRight","0"],["cornerTopRightShape","round"],["cornerTopShape","see individual properties"],["counterIncrement","none"],["counterReset","none"],["counterSet","none"],["cue","see individual properties"],["cueAfter","none"],["cueBefore","none"],["cursor","auto"],["cx","0"],["cy","0"],["d","none"],["direction","ltr"],["display","inline"],["dominantBaseline","auto"],["dynamicRangeLimit","no-limit"],["emptyCells","show"],["eventTrigger","none"],["eventTriggerName","none"],["eventTriggerSource","none"],["fieldSizing","fixed"],["fill","black"],["fillBreak","bounding-box"],["fillColor","currentcolor"],["fillImage","none"],["fillOpacity","1"],["fillOrigin","match-parent"],["fillPosition","0% 0%"],["fillRepeat","repeat"],["fillRule","nonzero"],["fillSize","auto"],["filter","none"],["flex","0 1 auto"],["flexBasis","auto"],["flexDirection","row"],["flexFlow","see individual properties"],["flexGrow","0"],["flexLineCount","1"],["flexShrink","1"],["flexWrap","nowrap"],["float","none"],["floatDefer","none"],["floatOffset","0"],["floatReference","inline"],["floodColor","black"],["floodOpacity","1"],["flowFrom","none"],["flowInto","none"],["flowTolerance","normal"],["font","see individual properties"],["fontFamily","depends on user agent"],["fontFeatureSettings","normal"],["fontKerning","auto"],["fontLanguageOverride","normal"],["fontOpticalSizing","auto"],["fontPalette","normal"],["fontSize","medium"],["fontSizeAdjust","none"],["fontStyle","normal"],["fontSynthesis","weight style small-caps position"],["fontSynthesisPosition","auto"],["fontSynthesisSmallCaps","auto"],["fontSynthesisStyle","auto"],["fontSynthesisWeight","auto"],["fontVariant","normal"],["fontVariantAlternates","normal"],["fontVariantCaps","normal"],["fontVariantEastAsian","normal"],["fontVariantEmoji","normal"],["fontVariantLigatures","normal"],["fontVariantNumeric","normal"],["fontVariantPosition","normal"],["fontVariationSettings","normal"],["fontWeight","normal"],["fontWidth","normal"],["footnoteDisplay","block"],["footnotePolicy","auto"],["forcedColorAdjust","auto"],["frameSizing","auto"],["gap","see individual properties"],["glyphOrientationVertical","n/a"],["grid","none"],["gridArea","auto"],["gridAutoColumns","auto"],["gridAutoFlow","row"],["gridAutoRows","auto"],["gridColumn","auto"],["gridColumnEnd","auto"],["gridColumnStart","auto"],["gridRow","auto"],["gridRowEnd","auto"],["gridRowStart","auto"],["gridTemplate","none"],["gridTemplateAreas","none"],["gridTemplateColumns","none"],["gridTemplateRows","none"],["hangingPunctuation","none"],["height","auto"],["hyphenateCharacter","auto"],["hyphenateLimitChars","auto"],["hyphenateLimitLast","none"],["hyphenateLimitLines","no-limit"],["hyphenateLimitZone","0"],["hyphens","manual"],["imageAnimation","normal"],["imageOrientation","from-image"],["imageRendering","auto"],["imageResolution","1dppx"],["initialLetter","normal"],["initialLetterAlign","alphabetic"],["initialLetterWrap","none"],["inlineSize","auto"],["inlineSizing","normal"],["inputSecurity","auto"],["inset","auto"],["insetBlock","auto"],["insetBlockEnd","auto"],["insetBlockStart","auto"],["insetInline","auto"],["insetInlineEnd","auto"],["insetInlineStart","auto"],["interactivity","auto"],["interestDelay","see individual properties"],["interestDelayEnd","normal"],["interestDelayStart","normal"],["interpolateSize","numeric-only"],["isolation","auto"],["justifyContent","normal"],["justifyItems","legacy"],["justifySelf","auto"],["left","auto"],["letterSpacing","normal"],["lightingColor","white"],["lineBreak","auto"],["lineClamp","none"],["lineFitEdge","leading"],["lineGrid","match-parent"],["lineHeight","normal"],["lineHeightStep","0"],["linePadding","0"],["lineSnap","none"],["linkParameters","none"],["listStyle","see individual properties"],["listStyleImage","none"],["listStylePosition","outside"],["listStyleType","disc"],["margin","0"],["marginBlock","see individual properties"],["marginBlockEnd","0"],["marginBlockStart","0"],["marginBottom","0"],["marginBreak","auto"],["marginInline","see individual properties"],["marginInlineEnd","0"],["marginInlineStart","0"],["marginLeft","0"],["marginRight","0"],["marginTop","0"],["marginTrim","none"],["marker","not defined for shorthand properties"],["markerEnd","none"],["markerMid","none"],["markerSide","match-self"],["markerStart","none"],["mask","see individual properties"],["maskBorder","See individual properties"],["maskBorderMode","alpha"],["maskBorderOutset","0"],["maskBorderRepeat","stretch"],["maskBorderSlice","0"],["maskBorderSource","none"],["maskBorderWidth","auto"],["maskClip","border-box"],["maskComposite","add"],["maskImage","none"],["maskMode","match-source"],["maskOrigin","border-box"],["maskPosition","0% 0%"],["maskRepeat","repeat"],["maskSize","auto"],["maskType","luminance"],["mathDepth","0"],["mathShift","normal"],["mathStyle","normal"],["maxBlockSize","none"],["maxHeight","none"],["maxInlineSize","none"],["maxLines","none"],["maxWidth","none"],["minBlockSize","0"],["minHeight","auto"],["minInlineSize","0"],["minIntrinsicSizing","legacy"],["minWidth","auto"],["mixBlendMode","normal"],["navDown","auto"],["navLeft","auto"],["navRight","auto"],["navUp","auto"],["objectFit","fill"],["objectPosition","50% 50%"],["objectViewBox","none"],["offset","see individual properties"],["offsetAnchor","auto"],["offsetDistance","0"],["offsetPath","none"],["offsetPosition","normal"],["offsetRotate","auto"],["opacity","1"],["order","0"],["orphans","2"],["outline","see individual properties"],["outlineColor","auto"],["outlineOffset","0"],["outlineStyle","none"],["outlineWidth","medium"],["overflow","visible"],["overflowAnchor","auto"],["overflowBlock","visible"],["overflowClipMargin","0px"],["overflowClipMarginBlock","0px"],["overflowClipMarginBlockEnd","0px"],["overflowClipMarginBlockStart","0px"],["overflowClipMarginBottom","0px"],["overflowClipMarginInline","0px"],["overflowClipMarginInlineEnd","0px"],["overflowClipMarginInlineStart","0px"],["overflowClipMarginLeft","0px"],["overflowClipMarginRight","0px"],["overflowClipMarginTop","0px"],["overflowInline","visible"],["overflowWrap","normal"],["overflowX","visible"],["overflowY","visible"],["overlay","none"],["overscrollBehavior","auto auto"],["overscrollBehaviorBlock","auto"],["overscrollBehaviorInline","auto"],["overscrollBehaviorX","auto"],["overscrollBehaviorY","auto"],["padding","0"],["paddingBlock","see individual properties"],["paddingBlockEnd","0"],["paddingBlockStart","0"],["paddingBottom","0"],["paddingInline","see individual properties"],["paddingInlineEnd","0"],["paddingInlineStart","0"],["paddingLeft","0"],["paddingRight","0"],["paddingTop","0"],["page","auto"],["pageBreakAfter","auto"],["pageBreakBefore","auto"],["pageBreakInside","auto"],["paintOrder","normal"],["pathLength","none"],["pause","see individual properties"],["pauseAfter","none"],["pauseBefore","none"],["perspective","none"],["perspectiveOrigin","50% 50%"],["placeContent","normal"],["placeItems","see individual properties"],["placeSelf","auto"],["pointerEvents","auto"],["pointerTimeline","see individual properties"],["pointerTimelineAxis","block"],["pointerTimelineName","none"],["position","static"],["positionAnchor","normal"],["positionArea","none"],["positionTry","see individual properties"],["positionTryFallbacks","none"],["positionTryOrder","normal"],["positionVisibility","anchor-visible"],["printColorAdjust","economy"],["quotes","auto"],["r","0"],["readingFlow","normal"],["readingOrder","0"],["regionFragment","auto"],["resize","none"],["rest","see individual properties"],["restAfter","none"],["restBefore","none"],["right","auto"],["rotate","none"],["rowGap","normal"],["rowRule","see individual properties"],["rowRuleBreak","normal"],["rowRuleColor","currentcolor"],["rowRuleInset","see individual properties"],["rowRuleInsetCap","see individual properties"],["rowRuleInsetCapEnd","0"],["rowRuleInsetCapStart","0"],["rowRuleInsetEnd","see individual properties"],["rowRuleInsetJunction","see individual properties"],["rowRuleInsetJunctionEnd","0"],["rowRuleInsetJunctionStart","0"],["rowRuleInsetStart","see individual properties"],["rowRuleStyle","none"],["rowRuleVisibilityItems","normal"],["rowRuleWidth","medium"],["rubyAlign","space-around"],["rubyMerge","separate"],["rubyOverhang","auto"],["rubyPosition","alternate"],["rule","see individual properties"],["ruleBreak","see individual properties"],["ruleColor","see individual properties"],["ruleInset","see individual properties"],["ruleInsetCap","see individual properties"],["ruleInsetEnd","see individual properties"],["ruleInsetJunction","see individual properties"],["ruleInsetStart","see individual properties"],["ruleOverlap","row-over-column"],["ruleStyle","see individual properties"],["ruleVisibilityItems","see individual properties"],["ruleWidth","see individual properties"],["rx","auto"],["ry","auto"],["scale","none"],["scrollbarColor","auto"],["scrollbarGutter","auto"],["scrollbarWidth","auto"],["scrollBehavior","auto"],["scrollInitialTarget","none"],["scrollMargin","0"],["scrollMarginBlock","0"],["scrollMarginBlockEnd","0"],["scrollMarginBlockStart","0"],["scrollMarginBottom","0"],["scrollMarginInline","0"],["scrollMarginInlineEnd","0"],["scrollMarginInlineStart","0"],["scrollMarginLeft","0"],["scrollMarginRight","0"],["scrollMarginTop","0"],["scrollMarkerGroup","none"],["scrollPadding","auto"],["scrollPaddingBlock","auto"],["scrollPaddingBlockEnd","auto"],["scrollPaddingBlockStart","auto"],["scrollPaddingBottom","auto"],["scrollPaddingInline","auto"],["scrollPaddingInlineEnd","auto"],["scrollPaddingInlineStart","auto"],["scrollPaddingLeft","auto"],["scrollPaddingRight","auto"],["scrollPaddingTop","auto"],["scrollSnapAlign","none"],["scrollSnapStop","normal"],["scrollSnapType","none"],["scrollTargetGroup","none"],["scrollTimeline","see individual properties"],["scrollTimelineAxis","block"],["scrollTimelineName","none"],["shapeImageThreshold","0"],["shapeInside","auto"],["shapeMargin","0"],["shapeOutside","none"],["shapePadding","0"],["shapeRendering","auto"],["sliderOrientation","auto"],["spatialNavigationAction","auto"],["spatialNavigationContain","auto"],["spatialNavigationFunction","normal"],["speak","auto"],["speakAs","normal"],["stopColor",""],["stopOpacity",""],["stringSet","none"],["stroke","none"],["strokeAlign","center"],["strokeAlignment","center"],["strokeBreak","bounding-box"],["strokeColor","transparent"],["strokeDashadjust","none"],["strokeDasharray","none"],["strokeDashcorner","none"],["strokeDashCorner","none"],["strokeDashJustify","none"],["strokeDashoffset","0"],["strokeImage","none"],["strokeLinecap","butt"],["strokeLinejoin","miter"],["strokeMiterlimit","4"],["strokeOpacity","1"],["strokeOrigin","match-parent"],["strokePosition","0% 0%"],["strokeRepeat","repeat"],["strokeSize","auto"],["strokeWidth","1px"],["tableLayout","auto"],["tabSize","8"],["textAlign","start"],["textAlignAll","start"],["textAlignLast","auto"],["textAnchor","start"],["textAutospace","normal"],["textBox","normal"],["textBoxEdge","auto"],["textBoxTrim","none"],["textCombineUpright","none"],["textDecoration","see individual properties"],["textDecorationColor","currentcolor"],["textDecorationInset","0"],["textDecorationLine","none"],["textDecorationSkip","See individual properties"],["textDecorationSkipBox","none"],["textDecorationSkipInk","auto"],["textDecorationSkipSelf","auto"],["textDecorationSkipSpaces","start end"],["textDecorationStyle","solid"],["textDecorationThickness","auto"],["textEmphasis","see individual properties"],["textEmphasisColor","currentcolor"],["textEmphasisPosition","over right"],["textEmphasisSkip","spaces punctuation"],["textEmphasisStyle","none"],["textFit","none"],["textGroupAlign","none"],["textIndent","0"],["textJustify","auto"],["textOrientation","mixed"],["textOverflow","clip"],["textRendering","auto"],["textShadow","none"],["textSizeAdjust","auto"],["textSpacing","see individual properties"],["textSpacingTrim","normal"],["textTransform","none"],["textUnderlineOffset","auto"],["textUnderlinePosition","auto"],["textWrap","wrap"],["textWrapMode","wrap"],["textWrapStyle","auto"],["timelineScope","none"],["timelineTrigger","see individual properties"],["timelineTriggerActivationRange","see individual properties"],["timelineTriggerActivationRangeEnd","normal"],["timelineTriggerActivationRangeStart","normal"],["timelineTriggerActiveRange","see individual properties"],["timelineTriggerActiveRangeEnd","auto"],["timelineTriggerActiveRangeStart","auto"],["timelineTriggerName","none"],["timelineTriggerSource","auto"],["top","auto"],["touchAction","auto"],["transform","none"],["transformBox","view-box"],["transformOrigin","50% 50%"],["transformStyle","flat"],["transition","see individual properties"],["transitionBehavior","normal"],["transitionDelay","0s"],["transitionDuration","0s"],["transitionProperty","all"],["transitionTimingFunction","ease"],["translate","none"],["triggerScope","none"],["unicodeBidi","normal"],["userSelect","auto"],["vectorEffect","none"],["verticalAlign","baseline"],["viewTimeline","see individual properties"],["viewTimelineAxis","block"],["viewTimelineInset","auto"],["viewTimelineName","none"],["viewTransitionClass","none"],["viewTransitionGroup","normal"],["viewTransitionName","none"],["viewTransitionScope","none"],["visibility","visible"],["voiceBalance","center"],["voiceDuration","auto"],["voiceFamily","implementation-dependent"],["voicePitch","medium"],["voiceRange","medium"],["voiceRate","normal"],["voiceStress","normal"],["voiceVolume","medium"],["webkitBoxAlign",""],["webkitBoxFlex",""],["webkitBoxOrdinalGroup",""],["webkitBoxOrient",""],["webkitBoxPack",""],["webkitLineClamp","none"],["webkitTextFillColor","currentcolor"],["webkitTextStroke","See individual properties"],["webkitTextStrokeColor","currentcolor"],["webkitTextStrokeWidth","0"],["webkitUserSelect",""],["whiteSpace","normal"],["whiteSpaceCollapse","collapse"],["whiteSpaceTrim","none"],["widows","2"],["width","auto"],["willChange","auto"],["windowDrag","none"],["wordBreak","normal"],["wordSpaceTransform","none"],["wordSpacing","normal"],["wordWrap","normal"],["wrapAfter","auto"],["wrapBefore","auto"],["wrapFlow","auto"],["wrapInside","auto"],["wrapThrough","wrap"],["writingMode","horizontal-tb"],["x","0"],["y","0"],["zIndex","auto"],["zoom","1"]],elements:{Form:[{tag:"form"},{tag:"input"},{tag:"textarea"},{tag:"select"},{tag:"option"},{tag:"optgroup"},{tag:"button"},{tag:"label"},{tag:"fieldset"},{tag:"legend"},{tag:"output"},{tag:"progress"},{tag:"meter"},{tag:"datalist"}],Interactive:[{tag:"details"},{tag:"summary"},{tag:"dialog"},{tag:"menu"}],"List & Table":[{tag:"ul"},{tag:"ol"},{tag:"li"},{tag:"dl"},{tag:"dt"},{tag:"dd"},{tag:"table"},{tag:"thead"},{tag:"tbody"},{tag:"tfoot"},{tag:"tr"},{tag:"th"},{tag:"td"},{tag:"caption"},{tag:"colgroup"},{tag:"col"}],Media:[{tag:"img"},{tag:"picture"},{tag:"source"},{tag:"video"},{tag:"audio"},{tag:"track"},{tag:"canvas"},{tag:"iframe"},{tag:"embed"},{tag:"object"}],Structure:[{tag:"div"},{tag:"section"},{tag:"article"},{tag:"aside"},{tag:"main"},{tag:"header"},{tag:"footer"},{tag:"nav"},{tag:"search"},{tag:"hgroup"},{tag:"slot"}],Text:[{tag:"h1"},{tag:"h2"},{tag:"h3"},{tag:"h4"},{tag:"h5"},{tag:"h6"},{tag:"p"},{tag:"span"},{tag:"a"},{tag:"strong"},{tag:"em"},{tag:"small"},{tag:"mark"},{tag:"code"},{tag:"pre"},{tag:"blockquote"},{tag:"q"},{tag:"abbr"},{tag:"time"},{tag:"sub"},{tag:"sup"},{tag:"br"},{tag:"hr"},{tag:"wbr"}],Other:[{tag:"address"},{tag:"area"},{tag:"b"},{tag:"base"},{tag:"bdi"},{tag:"bdo"},{tag:"body"},{tag:"cite"},{tag:"data"},{tag:"del"},{tag:"dfn"},{tag:"figcaption"},{tag:"figure"},{tag:"head"},{tag:"html"},{tag:"i"},{tag:"ins"},{tag:"kbd"},{tag:"link"},{tag:"map"},{tag:"meta"},{tag:"noscript"},{tag:"rp"},{tag:"rt"},{tag:"ruby"},{tag:"s"},{tag:"samp"},{tag:"script"},{tag:"selectedcontent"},{tag:"style"},{tag:"template"},{tag:"title"},{tag:"u"},{tag:"var"}]},eventHandlers:["onabort","onactivate","onaddsourcebuffer","onaddtrack","onadvertisementreceived","onafterprint","onanimationcancel","onanimationend","onanimationiteration","onanimationstart","onappinstalled","onaudioend","onaudioprocess","onaudiostart","onauxclick","onavailabilitychanged","onbackgroundfetchabort","onbackgroundfetchclick","onbackgroundfetchfail","onbackgroundfetchsuccess","onbeforeinput","onbeforeinstallprompt","onbeforematch","onbeforeprint","onbeforetoggle","onbeforexrselect","onbegin","onblocked","onblur","onboundary","onbufferedamountlow","onbufferedchange","oncancel","oncanmakepayment","oncanplay","oncanplaythrough","oncaptureaction","oncapturedmousechange","oncapturehandlechange","onchange","oncharacterboundsupdate","oncharacteristicvaluechanged","onchargingchange","onchargingtimechange","onclick","onclose","onclosing","oncommand","oncomplete","oncompositionend","oncompositionstart","onconnect","onconnecting","onconnectionavailable","onconnectionstatechange","oncontentdelete","oncontextlost","oncontextmenu","oncontextoverflow","oncontextrestored","oncontrollerchange","oncookiechange","oncopy","oncuechange","oncurrententrychange","oncurrentscreenchange","oncut","ondataavailable","ondatachannel","ondblclick","ondequeue","ondevicechange","ondevicemotion","ondeviceorientation","ondeviceorientationabsolute","ondischargingtimechange","ondisconnect","ondispose","ondownloadprogress","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onencrypted","onend","onended","onendstreaming","onenter","onenterpictureinpicture","onerror","onexit","onfencedtreeclick","onfetch","onfinish","onfocus","onformdata","onframeratechange","onfreeze","onfullscreenchange","onfullscreenerror","ongamepadconnected","ongamepaddisconnected","ongatheringstatechange","ongattserverdisconnected","ongeometrychange","ongotpointercapture","onhashchange","onicecandidate","onicecandidateerror","oniceconnectionstatechange","onicegatheringstatechange","oninput","oninputreport","oninputsourceschange","oninstall","oninvalid","onisolationchange","onkeydown","onkeyframerequest","onkeypress","onkeystatuseschange","onkeyup","onlanguagechange","onlayoutchange","onleavepictureinpicture","onlevelchange","onload","onloadeddata","onloadedmetadata","onloadend","onloading","onloadingdone","onloadingerror","onloadstart","onlocation","onlostpointercapture","onmanagedconfigurationchange","onmark","onmessage","onmessageerror","onmidimessage","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onmute","onnavigate","onnavigateerror","onnavigatesuccess","onnegotiationneeded","onnomatch","onnotificationclick","onnotificationclose","onoffline","ononline","onopen","onorientationchange","onpagehide","onpagereveal","onpageshow","onpageswap","onpaste","onpause","onpayerdetailchange","onpaymentmethodchange","onpaymentrequest","onperiodicsync","onplay","onplaying","onpointercancel","onpointerdown","onpointerenter","onpointerleave","onpointerlockchange","onpointerlockerror","onpointermove","onpointerout","onpointerover","onpointerrawupdate","onpointerup","onpopstate","onportalactivate","onprerenderingchange","onprioritychange","onprocessorerror","onprogress","onpromptaction","onpromptdismiss","onpush","onpushsubscriptionchange","onquotaoverflow","onratechange","onreading","onreadingerror","onreadystatechange","onredraw","onreflectionchange","onrejectionhandled","onrelease","onremove","onremovesourcebuffer","onremovetrack","onrepeat","onreset","onresize","onresourcetimingbufferfull","onresult","onresume","onrtctransform","onscreenschange","onscroll","onscrollend","onsecuritypolicyviolation","onseeked","onseeking","onselect","onselectedcandidatepairchange","onselectend","onselectionchange","onselectstart","onserviceadded","onservicechanged","onserviceremoved","onshippingaddresschange","onshippingoptionchange","onshow","onsignalingstatechange","onsinkchange","onslotchange","onsnapchanged","onsnapchanging","onsoundend","onsoundstart","onsourceclose","onsourceended","onsourceopen","onspeechend","onspeechstart","onsqueeze","onsqueezeend","onsqueezestart","onstalled","onstart","onstartstreaming","onstatechange","onstop","onstorage","onsubmit","onsuccess","onsuspend","onsync","onterminate","ontextformatupdate","ontextupdate","ontimeout","ontimeupdate","ontoggle","ontonechange","ontoolchange","ontouchcancel","ontouchend","ontouchmove","ontouchstart","ontrack","ontransitioncancel","ontransitionend","ontransitionrun","ontransitionstart","onuncapturederror","onunhandledrejection","onunload","onunmute","onupdate","onupdateend","onupdatefound","onupdatestart","onupgradeneeded","onvalidationstatuschange","onversionchange","onvisibilitychange","onvoiceschanged","onvolumechange","onwaiting","onwaitingforkey","onwebkitanimationend","onwebkitanimationiteration","onwebkitanimationstart","onwebkittransitionend","onwheel","onzoomlevelchange"]};var Y1=["caret","canvas","global"],X1=new Set(["pane.backToHome"]);var q5="input, textarea, select, [contenteditable=true]";function U5(e=document){let t=e.activeElement;return t instanceof HTMLElement&&t.matches(q5)}function J5(e){let t=(r)=>Q(e?.[r]);return{dataRows:t("dataRows"),findReferences:t("findReferences"),gitClone:t("gitClone"),importSite:t("importSite"),openProject:cf(e),openProjectInNewWindow:t("openProjectInNewWindow"),readFileBytes:t("readFileBytes"),publish:t("cfApi"),windowControls:t("newWindow")}}function Q1(e){return()=>{let t=bv(),r=h.value??null,o=C,a=e.canvasMode();t.project.open=o!==null,t.project.isSite=o?.isSiteProject===!0,t.project.isRepo=u.git.status?.isRepo===!0,t.project.isMultilingual=(ln(o?.projectConfig??{}).i18n?.locales.length??0)>1,t.git.ahead=u.git.status?.ahead??0,t.git.behind=u.git.status?.behind??0,t.git.dirtyCount=u.git.status?.files.length??0,t.workspace.id=u.workspace,t.document.open=r!==null,t.document.dirty=r?r.doc.dirty===!0||ZC(r.id)||Cv(r):!1,t.document.mode=r?.doc.mode??"",t.document.canUndo=r?pM(r):!1,t.document.canRedo=r?fM(r):!1,t.editor.kind=r?Qs(a):"none",t.canvas.view=UO(a),t.pane.count=m.panes.length,t.pane.derived=m.panes.some((l)=>l.derived!==null);let i=r?.session.selection??[],s=Oe(i);if(s){let l=oe(r.doc.document,s),f=l?.tagName;t.selection.count=i.length,t.selection.paths=i.map((c)=>[...c]),t.selection.kind=n(f)?f:"",t.selection.isRoot=i.some((c)=>c.length<2),t.selection.isComponentInstance=Ne.some((c)=>c.tagName===f),t.selection.isRepeater=l?.$prototype==="Array"}if(t.selection.isLayoutNode=u.layoutSelection!==null,t.caret.active=e.isCaretActive()||U5(),t.caret.inCanvas=e.isCaretActive(),t.focus.region=u.focusRegion,t.modal.open=e.isModalOpen(),r){let l=xn(r);t.collab.attached=l.active,t.collab.readOnly=l.readOnly,t.collab.sourceCanonical=l.sourceCanonical}return t.ai.configured=e.aiConfigured(),t.ai.streaming=e.aiStreaming?.()??!1,t.ai.waiting=e.aiWaiting?.()??!1,t.capability=J5(e.platform()),t}}var Z1={$schema:"https://jxsuite.com/schema/v1",$id:"StudioRail",$description:"The Navigator rail: a rendering of the panel registry. The adapter hands in `groups`, every rail-able panel grouped by level with its selected state and badge. Nothing here is a list of panels. Each button prints its record's short `railLabel` under the glyph, falling back to `title`, and carries the full `title` as its accessible name and tooltip: the visible words lead the name a reader hears (WCAG 2.5.3), and the tooltip restores what a short label leaves out. The rail has no foot: the gear lives in the top bar, because the rail is drawn only in the Design workspace, and the Library button left with the Content workspace that replaces it.",tagName:"div",attributes:{part:"rail"},style:{display:"flex",flexDirection:"column",height:"100%",'& > [part="groups"]':{display:"flex",flexDirection:"column",padding:"var(--jx-space-2) 0"},'& [role="group"]':{display:"flex",flexDirection:"column"},"& jx-divider":{$description:"The element draws the hairline and announces it; what the rail owns is where it sits. The rule outranks `jx-divider`'s own margin by one element in the selector, which is the sanctioned way a host retunes a kit element (ui.md §3.2) and the reason the divider's spacing is on its HOST rather than on the rule inside it.",margin:"var(--jx-space-3) var(--jx-space-4)"},"& jx-action-button":{width:"100%"},'& jx-action-button > [part="control"]':{borderLeft:"2px solid transparent",opacity:"0.75",":hover":{opacity:"1"}},'& jx-action-button[data-selected] > [part="control"]':{borderLeftColor:"var(--jx-accent)",background:"transparent",color:"var(--jx-fg)",opacity:"1"}},children:[{tagName:"nav",attributes:{part:"groups","aria-label":"Navigator panels"},children:[{$prototype:"Array",items:{$ref:"#/state/groups"},key:{$ref:"$map/item/level"},map:{tagName:"div",attributes:{role:"none"},children:[{tagName:"div",attributes:{role:"none"},$switch:{$ref:"$map/item/dividerAbove"},cases:{true:{tagName:"jx-divider"}}},{tagName:"div",attributes:{role:"group","aria-label":"${$map.item.label}"},children:[{$prototype:"Array",items:{$ref:"$map/item/panels"},key:{$ref:"$map/item/id"},map:{tagName:"jx-action-button",$props:{label:{$ref:"$map/item/title"},hint:{$ref:"$map/item/title"},icon:{$ref:"$map/item/icon"},stacked:!0,toggles:!0,selected:{$ref:"$map/item/selected"},badge:{$ref:"$map/item/badge"}},attributes:{"data-panel":"${$map.item.id}"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/toggle"},value:[{$ref:"$map/item/id"}]}]},children:[{tagName:"span",textContent:"${$map.item.railLabel}"}]}}]}]}}]}]};E("rail",Z1);var eL=null,rL=null,Pv=null,K5=null;function Y5(e){return!u.docks.left.collapsed&&u.leftTab===e.id}function X5(e){SO(HC(e.id,"the Navigator rail"))}function Q5(){let e=th();return VL(e).map((t,r)=>({dividerAbove:r>0,label:t.label,level:t.level,panels:t.panels.map((o)=>({badge:String(o.badge?.(e)??""),icon:o.icon,id:o.id,railLabel:o.railLabel??o.title,selected:Y5(o),title:o.title}))}))}function oL(){return rL??=g({groups:[],toggle:(e)=>{let t=VL(th()).flatMap((r)=>r.panels).find((r)=>r.id===e);if(t)X5(t)}}),rL}function Z5(){oL().groups=Q5(),eK()}function eK(){if(Pv||!u1)return;Pv=R("rail",oL(),u1),Pv.then((e)=>{K5=e})}function aL(){es(),eL=me(),eL.run(()=>{te(()=>{let{error:e,loading:t,status:r}=u.git;if(!r&&!t&&!e)ks();Z5()})})}function tK(e){return((e.state.user.name??e.state.user.login)[0]??"?").toUpperCase()}function nK(e,t){let{user:r}=e.state,o=r.name?`${r.name} (${r.login})`:r.login;return e.state.focusedPath&&e.state.focusedPath===t?o:`${o} — ${e.state.focusedPath??"browsing"}`}var Nv={connecting:"Connecting…",detached:"Solo",failed:"Not connected",offline:"Offline — changes sync on reconnect",synced:"Live",unavailable:""};function rK(e,t){if(e==="failed")return`Live collaboration could not start${t?` — ${t}`:""}. Your edits are saved to this machine as usual.`;if(e==="synced"||e==="offline")return`${Nv[e]}. Undo only takes back your own edits, never a collaborator's.`;return Nv[e]}function iL(e){if(!e)return null;let t=xn(e);if(t.status==="unavailable")return null;return{frozen:t.sourceCanonical,label:Nv[t.status]||t.status,peers:t.peers.map((r)=>({avatarUrl:r.state.user.avatarUrl??"",color:r.state.user.color,hasAvatar:Boolean(r.state.user.avatarUrl),initial:tK(r),key:r.clientId,title:nK(r,e.documentPath)})),readOnly:t.readOnly,status:t.status,title:rK(t.status,t.attachError)}}var Lv="settings/menu",Io=null,jv=null,Lu=null,oK=new Map([["app.preferences",()=>kn.map((e)=>({dividerAbove:!1,key:e.id,label:e.title}))],["settings.open",()=>Lw().flatMap((e,t)=>e.sections.map((r,o)=>({dividerAbove:t>0&&o===0,key:r.key,label:r.label})))]]);function aK(e){return oK.get(e)?.()??[]}function sL(e,t){let r=ae();if(!r)return;Tn(r,e,t,"Settings")}function lL(e){let t=[...e.forPlacement(Lv)].toSorted((o,a)=>Wb.indexOf(o.level)-Wb.indexOf(a.level)),r;return t.map((o,a)=>{let i=a>0&&o.level!==r;({level:r}=o);let s=e.isEnabled(o.id),l=e.keymap.formatBinding(o.id),f=l&&l.toLowerCase()!==o.title.toLowerCase()?l:void 0,c=s?void 0:e.disabledReason(o.id),{id:d}=o,b={children:s?aK(d).map((y)=>({destructive:!1,disabled:!1,dividerAbove:y.dividerAbove,id:`${d}:${y.key}`,run:()=>sL(d,{section:y.key}),title:y.label})):[],destructive:o.destructive===!0,disabled:!s,dividerAbove:i,id:d,run:()=>sL(d),submenuLabel:`Sections of ${o.title}`,title:o.title};if(f)b.chord=f;if(c)b.requires=c;return b})}function Ov(){return Io!==null}function Mv(){Io?.close()}function cL(e,t={}){if(Io){Mv();return}let r=ae();if(!r)return;let o=lL(r);if(o.length===0)return;Lu=t.rerender??null;let a=zt({label:"Settings",onClosed:(i)=>{if(Io!==i)return;Io=null,jv?.(),jv=null;let s=Lu;Lu=null,s?.()},opener:e,place:(i)=>{let s=Me(e);return{x:Math.max(4,s.right-i.width),y:s.bottom+4}},placement:"block-end span-inline-start",region:"settings",rows:o});Io=a,jv=_S(()=>{let i=ae();if(!i||Io!==a)return;a.setRows(lL(i))}),Lu?.()}var dL={$schema:"https://jxsuite.com/schema/v1",$id:"StudioCommandBar",$description:"The Command Bar: a rendering of the command registry. The adapter hands in `primary` (what declared commandbar/primary), `docks` (the three dock toggles), `workspaces` (the five workspaces, with `workspace` selected), `settingsVisible`/`settingsOpen` for the gear that renders the settings/menu placement, the Command Center's `segments`, the collaboration `presence` and `csd` (which window-control layout, if any). Nothing here decides what an action is called.",tagName:"div",attributes:{part:"bar"},style:{display:"flex",alignItems:"center",flex:"1",minWidth:"0",height:"100%",gap:"var(--jx-space-2)","& > *":{minWidth:"0",flexShrink:"1"},'& > [part="spacer"]':{flex:"1",flexShrink:"999"},'& [part="csd-lead"], & [part="csd-trail"], & [part="menu-slot"], & [part="workspaces-slot"], & [part="presence-slot"], & [part="settings-slot"]':{display:"contents"},'& [part="window-controls"]':{display:"flex",alignItems:"center",flexShrink:"0",marginLeft:"var(--jx-space-2)"},'& [part="window-controls"] [data-control="close"]:hover > [part="control"]':{background:"var(--jx-danger)",color:"var(--jx-accent-fg)"},'& [part="window-controls"][data-mac]':{marginLeft:"0",marginRight:"var(--jx-space-3)",gap:"var(--jx-space-3)"},'& [part="window-controls"][data-mac] jx-action-button > [part="control"]':{width:"12px",minWidth:"12px",height:"12px",minHeight:"12px",padding:"0",border:"none",borderRadius:"50%",overflow:"hidden",":hover":{filter:"brightness(0.85)"}},'& [part="window-controls"][data-mac] [data-control="close"] > [part="control"]':{background:"#ff5f57"},'& [part="window-controls"][data-mac] [data-control="minimize"] > [part="control"]':{background:"#febc2e"},'& [part="window-controls"][data-mac] [data-control="maximize"] > [part="control"]':{background:"#28c840"},'& [part="window-controls"][data-mac] [part="icon"]':{display:"none"},'& [part="window-controls"][data-mac]:hover [part="icon"]':{display:"inline-flex",color:"rgba(0, 0, 0, 0.5)","--jx-icon-size":"8px"},'& [part="workspaces"]':{$description:"The kit's tablist, retuned for a 36px band: no rule under the strip (the band's own border is the floor), and the tabs sit on the band's centre line rather than on a strip edge.",flexShrink:"0",borderBottom:"none",gap:"2px",fontSize:"var(--jx-text-sm)"},'& [part="workspace"]':{padding:"2px var(--jx-space-3)",borderRadius:"var(--jx-radius-sm)",color:"var(--jx-fg-dim)",whiteSpace:"nowrap","--jx-icon-size":"14px",":hover":{background:"var(--jx-hover-bg)",color:"var(--jx-fg)"}},'& [part="workspace"][aria-selected="true"]':{color:"var(--jx-fg)",background:"var(--jx-hover-bg)"},'& [part="workspace-badge"]':{$description:"The count of unpublished changes on the Publish tab. Decorative: the tab's tooltip says what it counts, and the badge is not drawn at zero.",minWidth:"16px",padding:"0 4px",borderRadius:"8px",background:"var(--jx-accent)",color:"var(--jx-accent-fg)",fontSize:"var(--jx-text-xs)",lineHeight:"16px",textAlign:"center"},'& [part="center"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",flex:"0 1 520px",minWidth:"0",padding:"0 var(--jx-space-3)",height:"var(--jx-control-h)",boxSizing:"border-box",cursor:"pointer",border:"1px solid var(--jx-border-strong)",borderRadius:"var(--jx-radius-sm)",background:"var(--jx-bg-input)",fontSize:"var(--jx-text-sm)",":hover":{borderColor:"var(--jx-fg-muted)"}},'& [part="mark"]':{color:"var(--jx-accent)",flexShrink:"0"},'& [part="sep-slot"], & [part="chord-slot"]':{display:"contents"},'& [part="sep"]':{color:"var(--jx-fg-muted)",flexShrink:"0"},'& [part="segment"]':{appearance:"none",border:"none",background:"none",padding:"2px var(--jx-space-2)",borderRadius:"var(--jx-radius-sm)",color:"var(--jx-fg-dim)",font:"inherit",cursor:"pointer",maxWidth:"220px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",":hover":{background:"var(--jx-hover-bg)",color:"var(--jx-fg)"},":focus-visible":{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"}},'& [part="chord"]':{marginLeft:"auto",paddingLeft:"var(--jx-space-3)",font:"inherit",fontSize:"var(--jx-text-xs)",color:"var(--jx-fg-muted)",flexShrink:"0"},'& [part="primary"]':{display:"flex",alignItems:"center",gap:"2px",flexShrink:"0"},'& [part="primary"] [part="icon-slot"]':{display:"contents"},'& [part="presence"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",minWidth:"0"},'& [part="status"]':{fontSize:"var(--jx-text-xs)",color:"var(--jx-fg-dim)",whiteSpace:"nowrap"},'& [part="status"][data-status="synced"]':{color:"var(--jx-success)"},'& [part="status"][data-status="offline"]':{color:"var(--jx-warning)"},'& [part="status"][data-status="failed"]':{color:"var(--jx-danger)"},'& [part="flag-slot"]':{display:"contents"},'& [part="flag"]':{borderRadius:"var(--jx-radius-sm)",padding:"1px var(--jx-space-2)",fontSize:"var(--jx-text-xs)",whiteSpace:"nowrap",border:"1px solid currentcolor",color:"var(--jx-fg-dim)"},'& [part="flag"][data-flag="frozen"]':{color:"var(--jx-warning)"},'& [part="chip"]':{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"20px",height:"20px",borderRadius:"50%",overflow:"hidden",color:"var(--jx-accent-fg)",fontSize:"var(--jx-text-xs)",fontWeight:"600",flexShrink:"0"},'& [part="chip"] img':{width:"100%",height:"100%",objectFit:"cover"},'& [part="docks"]':{display:"flex",alignItems:"center",flexShrink:"0"},"@container toolbar (max-width: 1140px)":{'& [part="primary"] [part="text"], & [part="primary"] jx-button > [part="control"] > [part="label"]':{display:"none"},'& [part="primary"] jx-button > [part="control"]':{gap:"0"},'& [part="workspace"] > [part="label"]':{display:"none"}},'& [part="workspaces-group"]':{$description:"The tablist and the quick-publish chevron, as one item of the band, so the chevron never wraps away from the Publish tab it belongs to.",display:"flex",alignItems:"center",flexShrink:"0",gap:"2px"},'& [part="quick-publish"]':{"--jx-icon-size":"12px",marginLeft:"-2px"}},children:[{tagName:"div",attributes:{part:"csd-lead",role:"none"},$switch:{$ref:"#/state/csd"},cases:{mac:{tagName:"div",attributes:{part:"window-controls",role:"group","aria-label":"Window","data-mac":""},children:[{tagName:"jx-action-button",$props:{label:"Close",hint:"Close",icon:"x",size:"sm"},attributes:{"data-control":"close",class:"app-region-no-drag"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/windowControl"},value:["close"]}]}},{tagName:"jx-action-button",$props:{label:"Minimize",hint:"Minimize",icon:"minus",size:"sm"},attributes:{"data-control":"minimize",class:"app-region-no-drag"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/windowControl"},value:["minimize"]}]}},{tagName:"jx-action-button",$props:{label:"Maximize",hint:"Maximize",icon:"square",size:"sm"},attributes:{"data-control":"maximize",class:"app-region-no-drag"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/windowControl"},value:["maximize"]}]}}]}}},{tagName:"div",attributes:{part:"menu-slot",role:"none"},$switch:{$ref:"#/state/menuVisible"},cases:{true:{tagName:"jx-action-button",$props:{label:"Studio menu",hint:"Studio menu",icon:"list",size:"sm",haspopup:"menu",expanded:{$ref:"#/state/menuOpen"}},attributes:{"data-menu":"studio",class:"app-region-no-drag"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openStudioMenu"},value:[{$ref:"event#/currentTarget"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{ArrowDown:[{operator:"call",target:{$ref:"#/state/openStudioMenu"},value:[{$ref:"event#/currentTarget"}]},{preventDefault:!0}]}}]}}}},{tagName:"div",attributes:{part:"workspaces-slot",role:"none"},$switch:{$ref:"#/state/workspacesVisible"},cases:{true:{tagName:"div",attributes:{part:"workspaces-group",role:"none"},children:[{tagName:"jx-tabs",attributes:{part:"workspaces",selected:"${state.workspace}",class:"app-region-no-drag"},$props:{label:"Workspaces",activation:"manual"},children:[{$prototype:"Array",items:{$ref:"#/state/workspaces"},key:{$ref:"$map/item/id"},map:{tagName:"jx-tab",attributes:{part:"workspace",value:"${$map.item.id}",label:"${$map.item.title}",title:"${$map.item.tooltip}","aria-description":"${$map.item.description || null}","data-workspace":"${$map.item.id}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setWorkspace"},value:[{$ref:"$map/item/id"}]}]},children:[{tagName:"jx-icon",attributes:{slot:"icon"},$props:{name:{$ref:"$map/item/icon"}}},{tagName:"span",attributes:{slot:"status",part:"workspace-badge-slot"},style:{display:"contents"},$switch:{$ref:"$map/item/hasBadge"},cases:{true:{tagName:"span",attributes:{part:"workspace-badge","aria-hidden":"true"},textContent:"${$map.item.badge}"}}}]}}]},{tagName:"div",attributes:{part:"quick-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/quickVisible"},cases:{true:{tagName:"jx-action-button",$description:"`publish.quick`, drawn beside the Publish tab rather than inside it (studio.md §22.2): a tab that sometimes opened a dialog would be a tab whose activation means two things. It sits after the tablist, which ends on Publish, so it is the control beside that tab.",attributes:{part:"quick-publish",class:"app-region-no-drag","data-command":"publish.quick"},$props:{icon:"caret-down",size:"sm",quiet:!0,label:"Quick publish",hint:{$ref:"#/state/quickTooltip"},haspopup:"dialog",disabled:{$ref:"#/state/quickDisabled"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/run"},value:["publish.quick"]}]}}}}]}}},{tagName:"div",attributes:{part:"spacer"}},{tagName:"div",attributes:{part:"center",role:"group","aria-label":"Command Center",class:"app-region-no-drag"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openPicker"},value:[]}]},children:[{tagName:"span",attributes:{part:"mark","aria-hidden":"true"},textContent:"◈"},{$prototype:"Array",items:{$ref:"#/state/segments"},key:{$ref:"$map/item/key"},map:{tagName:"span",attributes:{part:"segment-slot",role:"none"},style:{display:"contents"},children:[{tagName:"span",attributes:{part:"sep-slot",role:"none"},$switch:{$ref:"$map/item/sepBefore"},cases:{true:{tagName:"span",attributes:{part:"sep","aria-hidden":"true"},textContent:"›"}}},{tagName:"button",attributes:{part:"segment",type:"button","data-segment":"${$map.item.key}",title:"${$map.item.title}",class:"app-region-no-drag"},textContent:"${$map.item.label}",onclick:{$prototype:"Function",body:[{stopPropagation:!0},{operator:"call",target:{$ref:"#/state/openSegment"},value:[{$ref:"$map/item/key"}]}]}}]}},{tagName:"span",attributes:{part:"chord-slot",role:"none"},$switch:{$ref:"#/state/hasChord"},cases:{true:{tagName:"kbd",attributes:{part:"chord"},textContent:"${state.chord}"}}}]},{tagName:"div",attributes:{part:"spacer"}},{tagName:"div",attributes:{part:"primary",role:"group","aria-label":"Actions"},children:[{$prototype:"Array",items:{$ref:"#/state/primary"},key:{$ref:"$map/item/id"},map:{tagName:"jx-button",$props:{label:{$ref:"$map/item/title"},hint:{$ref:"$map/item/tooltip"},disabled:{$ref:"$map/item/disabled"},size:"sm",quiet:!0},attributes:{"data-command-id":"${$map.item.id}",class:"app-region-no-drag"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/run"},value:[{$ref:"$map/item/id"}]}]},children:[{tagName:"span",attributes:{part:"icon-slot",slot:"icon"},$switch:{$ref:"$map/item/hasIcon"},cases:{true:{tagName:"jx-icon",$props:{name:{$ref:"$map/item/icon"}}}}},{tagName:"span",attributes:{part:"text"},textContent:"${$map.item.title}"}]}}]},{tagName:"div",attributes:{part:"presence-slot",role:"none"},$switch:{$ref:"#/state/presenceVisible"},cases:{true:{tagName:"div",attributes:{part:"presence",title:"${state.presence.title}"},children:[{tagName:"span",attributes:{part:"status","data-status":"${state.presence.status}"},textContent:"${state.presence.label}"},{tagName:"span",attributes:{part:"flag-slot",role:"none"},$switch:{$ref:"#/state/presence/readOnly"},cases:{true:{tagName:"span",attributes:{part:"flag","data-flag":"read-only",title:"You have read access to this session. Your edits show here but are not published to the others."},textContent:"Read-only"}}},{tagName:"span",attributes:{part:"flag-slot",role:"none"},$switch:{$ref:"#/state/presence/frozen"},cases:{true:{tagName:"span",attributes:{part:"flag","data-flag":"frozen",title:"Someone is editing the code view. Structural edits are paused until they stop. This is not an error."},textContent:"Code view held"}}},{$prototype:"Array",items:{$ref:"#/state/presence/peers"},key:{$ref:"$map/item/key"},map:{tagName:"span",attributes:{part:"chip",style:"background: ${$map.item.color}",title:"${$map.item.title}"},$switch:{$ref:"$map/item/hasAvatar"},cases:{true:{tagName:"img",attributes:{src:"${$map.item.avatarUrl}",alt:"${$map.item.initial}"}},false:{tagName:"span",attributes:{part:"initial"},textContent:"${$map.item.initial}"}}}}]}}},{tagName:"div",attributes:{part:"settings-slot",role:"none"},$switch:{$ref:"#/state/settingsVisible"},cases:{true:{tagName:"jx-action-button",$props:{label:"Settings",hint:"Settings",icon:"gear",size:"sm",haspopup:"menu",expanded:{$ref:"#/state/settingsOpen"}},attributes:{"data-menu":"settings",class:"app-region-no-drag"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openSettings"},value:[{$ref:"event#/currentTarget"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{ArrowDown:[{operator:"call",target:{$ref:"#/state/openSettings"},value:[{$ref:"event#/currentTarget"}]},{preventDefault:!0}]}}]}}}},{tagName:"div",attributes:{part:"docks",role:"group","aria-label":"Docks"},children:[{$prototype:"Array",items:{$ref:"#/state/docks"},key:{$ref:"$map/item/id"},map:{tagName:"jx-action-button",$props:{label:{$ref:"$map/item/title"},hint:{$ref:"$map/item/tooltip"},icon:{$ref:"$map/item/icon"},mirror:{$ref:"$map/item/mirror"},toggles:!0,selected:{$ref:"$map/item/selected"},disabled:{$ref:"$map/item/disabled"},size:"sm"},attributes:{"data-command-id":"${$map.item.id}",class:"app-region-no-drag"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/run"},value:[{$ref:"$map/item/id"}]}]}}}]},{tagName:"div",attributes:{part:"csd-trail",role:"none"},$switch:{$ref:"#/state/csd"},cases:{other:{tagName:"div",attributes:{part:"window-controls",role:"group","aria-label":"Window"},children:[{tagName:"jx-action-button",$props:{label:"Minimize",hint:"Minimize",icon:"minus",size:"sm"},attributes:{"data-control":"minimize",class:"app-region-no-drag"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/windowControl"},value:["minimize"]}]}},{tagName:"jx-action-button",$props:{label:"Maximize",hint:"Maximize",icon:"square",size:"sm"},attributes:{"data-control":"maximize",class:"app-region-no-drag"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/windowControl"},value:["maximize"]}]}},{tagName:"jx-action-button",$props:{label:"Close",hint:"Close",icon:"x",size:"sm"},attributes:{"data-control":"close",class:"app-region-no-drag"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/windowControl"},value:["close"]}]}}]}}}]};E("commandbar",dL);var sK=null;function lK(){return sK??navigator.platform.startsWith("Mac")}var pL={frozen:!1,label:"",peers:[],readOnly:!1,status:"unavailable",title:""},cK=[{dock:"left",icon:"sidebar-simple",id:"view.toggleNavigator",mirror:!1},{dock:"right",icon:"sidebar-simple",id:"view.toggleInspector",mirror:!0},{dock:"bottom",icon:"rows",id:"view.toggleBottomDock",mirror:!1}],dK="publish.quick",pK={document:"files",project:"projects",selection:"nodes"},_v=null,zu=null,wl=null,Hu=null,_u=null,br=null;function zv(e,t){let r=e.get(t);if(!r)return"";let o=e.disabledReason(t);if(o)return`${r.title} — requires ${o}`;let a=e.keymap.formatBinding(t);return a?`${r.title} (${a})`:r.title}function uK(e){let t=e?.documentPath?.replace(/^\.\//,"");if(!t)return{reason:"Open a page to view it in a browser."};if(!C?.isSiteProject)return{reason:"This project does not build a site."};if(!t.startsWith("pages/"))return{reason:`Only pages have a route — ${t} is not under pages/.`};let r=nh(t);if(r.includes("*"))return{reason:"Catch-all routes match many pages — open a generated one instead."};let o=Bc(t);if(o.length>0){let i=e?.session.ui.previewParams??{},s=o.filter((l)=>!i[l]);if(s.length>0)return{reason:`Pick a value for ${s.map((f)=>`:${f}`).join(", ")} to open one of this route's pages.`};r=r.replaceAll(/:(\w+)/g,(l,f)=>encodeURIComponent(i[f]))}let a=C.projectConfig?.build?.trailingSlash??"always";return{path:r==="/"?"/":a==="always"?`${r}/`:r}}async function uL(){let e=uK(h.value??null);if(!("path"in e)){w.warn(e.reason,{key:ct,source:"Preview"});return}let t=ye()?p():null;if(!t?.previewSite&&!t?.buildSite){w.warn("This backend cannot preview the site.",{key:ct,source:"Preview"});return}if(t.previewSite){await mK(t.previewSite,e.path);return}await fK(t.buildSite,e.path)}async function mK(e,t){UN(),await US(),w.info("Opening a live preview…",{key:ct,source:"Preview"});let r;try{r=await e({route:t})}catch(o){w.error(`The site could not be previewed: ${Hv(o)}`,{key:ct,source:"Preview"});return}if(!r.url){w.warn("This backend serves no preview of the site.",{key:ct,source:"Preview"});return}if(r.reused){w.info(`Updated your preview tab — switch to your browser to see ${t}`,{key:ct,source:"Preview"});return}if(r.errors.length>0)w.warn(`Previewed with ${r.errors.length} problem(s): ${r.errors[0]}`,{key:ct,source:"Preview"});else w.success(`Opened a live preview of ${r.routes} page(s) — rendered from your working tree, not a build.`,{key:ct,source:"Preview"});Vb(`${r.url}${t}`)}async function fK(e,t){w.info("Building the site…",{key:ct,source:"Preview"});let r;try{r=await e()}catch(a){w.error(`The site could not be built: ${Hv(a)}`,{key:ct,source:"Preview"});return}if(!r.url){w.warn("The site was built, but this backend serves no preview of it.",{key:ct,source:"Preview"});return}let o=r.mode==="live";if(r.errors.length>0){let a=o?"previewed":"built";w.warn(`The site ${a} with ${r.errors.length} error(s): ${r.errors[0]}`,{key:ct,source:"Preview"})}else if(o)w.success(`Opened a live preview of ${r.routes} page(s) — rendered from your working tree, not a build.`,{key:ct,source:"Preview"});else w.success(`Built ${r.routes} page(s).`,{key:ct,source:"Preview"});Vb(`${r.url}${t}`)}async function mL(){let e=ye()?p():null;if(!e?.buildSite){w.warn("This backend cannot build the site.",{key:fl,source:"Build"});return}w.info("Building the site…",{key:fl,source:"Build"});let t;try{t=await e.buildSite()}catch(r){w.error(`The site could not be built: ${Hv(r)}`,{key:fl,source:"Build"});return}if(t.errors.length>0){w.warn(`Built with ${t.errors.length} error(s): ${t.errors[0]}`,{key:fl,source:"Build"});return}w.success(`Built ${t.routes} page(s), ${t.files} file(s).`,{key:fl,source:"Build"})}var fl="project.buildSite",ct="view.openInBrowser";function Hv(e){return e instanceof Error?e.message:String(e)}function hK(e){let t=e?.documentPath;if(!t)return"No document";let r=C?.projectRoot,o=t.replace(/^\.\//,"");return r&&o.startsWith(`${r}/`)?o.slice(r.length+1):o}function gK(e){if(u.layoutSelection)return"layout";let t=om(e);if(t)return t.replaceAll(" "," › ");let r=e?.session.selection??[],o=Oe(r);if(!e||!o)return"";if(r.length>1)return`${r.length} elements`;return kr(oe(e.doc.document,o))}function Bv(){let e=globalThis.__jxPlatform;if(e==null||!("windowControls"in e))return;return e.windowControls}function bK(e){let t=[{key:"project",label:C?.name??"No project",sepBefore:!1,title:"Switch project — opens Project: Open Recent…"},{key:"document",label:hK(e),sepBefore:!0,title:"Go to a file"}],r=gK(e);if(r)t.push({key:"selection",label:r,sepBefore:!0,title:"Go to an element in this document"});return t}function yK(e){if(!e?.get("view.setWorkspace")||!e.isEnabled("view.setWorkspace"))return[];let t=u.git.status?.files.length??0;return Hx.map((r)=>{let o=r.id==="publish"&&t>0?String(t):"",a=e.keymap.formatBinding(`workspace.focus.${r.id}`),i=a?`${r.title} (${a})`:r.title,s=o?`${o} unpublished ${t===1?"change":"changes"}`:"";return{badge:o,description:s,hasBadge:o!=="",icon:r.icon,id:r.id,title:r.title,tooltip:s?`${i}, ${s}`:i}})}function vK(e){if(!e)return[];return e.forPlacement("commandbar/primary").filter((t)=>e.isVisible(t.id)).map((t)=>({disabled:!e.isEnabled(t.id),hasIcon:Boolean(t.icon),icon:t.icon??"",id:t.id,title:t.title,tooltip:zv(e,t.id)}))}function wK(e){if(!e)return[];return cK.flatMap((t)=>{let r=e.get(t.id);if(!r||!e.isVisible(t.id))return[];return[{disabled:!e.isEnabled(t.id),icon:t.icon,id:t.id,mirror:t.mirror,selected:!u.docks[t.dock].collapsed,title:r.title,tooltip:zv(e,t.id)}]})}function fL(e){let t;return e.forPlacement("commandbar/overflow").map((r,o)=>{let a=o>0&&r.group!==t;({group:t}=r);let i=e.isEnabled(r.id),s=e.keymap.formatBinding(r.id),l=i?void 0:e.disabledReason(r.id),f={destructive:r.destructive===!0,disabled:!i,dividerAbove:a,id:r.id,title:r.title};if(s)f.chord=s;if(l)f.requires=l;return f})}function xK(e){if(br){br.close();return}let t=ae();if(!t)return;let r=Vv();br=zt({label:"Studio menu",onClosed:(a)=>{if(br!==a)return;br=null,r.menuOpen=!1},opener:e,place:()=>{let a=Me(e);return{x:a.left,y:a.bottom+4}},region:"studio",rows:fL(t),run:(a)=>{if(t.isEnabled(a))Tn(t,a,void 0,"Command Bar")}}),r.menuOpen=!0}function Vv(){return wl??=g({chord:"",csd:"none",docks:[],hasChord:!1,menuOpen:!1,menuVisible:!1,openPicker:()=>{mb("picker")},openSegment:(e)=>{mb(pK[e])},openSettings:(e)=>{if(!(e instanceof HTMLElement))return;cL(e,{rerender:()=>{if(wl)wl.settingsOpen=Ov()}})},openStudioMenu:xK,presence:pL,presenceVisible:!1,primary:[],run:(e)=>{let t=ae();if(t?.isEnabled(e))Tn(t,e,void 0,"Command Bar")},segments:[],setWorkspace:(e)=>{nt("view.setWorkspace",{workspace:e},"Command Bar")},settingsOpen:!1,settingsVisible:!1,windowControl:(e)=>{Bv()?.[e]()},quickDisabled:!0,quickTooltip:"",quickVisible:!1,workspace:"",workspaces:[],workspacesVisible:!1}),wl}function hL(){let e=Vv(),t=ae(),r=h.value??null,o=Bv();e.csd=o?lK()?"mac":"other":"none",e.menuVisible=t!==null,e.workspaces=yK(t),e.workspacesVisible=e.workspaces.length>0,e.workspace=u.workspace;let a=dK;e.quickVisible=e.workspacesVisible&&t?.get(a)!==void 0&&t.isVisible(a),e.quickDisabled=!e.quickVisible||!t?.isEnabled(a),e.quickTooltip=t&&e.quickVisible?zv(t,a):"",e.settingsVisible=t!==null&&t.forPlacement(Lv).length>0,e.settingsOpen=Ov(),e.segments=bK(r),e.chord=t?.keymap.formatBinding("palette.open")??"",e.hasChord=e.chord!=="",e.primary=vK(t);let i=iL(r);if(e.presence=i??pL,e.presenceVisible=i!==null,e.docks=wK(t),br&&t)br.setRows(fL(t))}function gL(e,t={}){if(kK(),_v=e,Bv())e.classList.add("app-region-drag");zu=me(),zu.run(()=>{te(()=>{u.docks.left.collapsed,u.docks.right.collapsed,u.docks.bottom.collapsed,u.git.status,u.layoutSelection,u.stylebook.selection,u.workspace,m.projectRoot,ae();let r=h.value;if(r)r.doc.document,r.doc.dirty,r.doc.mode,r.session.selection.map((o)=>o.join("/")).join("|"),r.session.ui.canvasMode,r.session.ui.previewParams,r.history.index,r.history.snapshots.length;try{hL()}catch(o){console.error("command bar projection error:",o)}})}),Hu=R("commandbar",Vv(),e),Hu.then((r)=>{_u=r})}function kK(){br?.close(),Mv(),zu?.stop(),zu=null;let e=Hu;if(Hu=null,_u)_u.dispose(),_u=null;else if(e)e.then((t)=>t.dispose());wl=null,_v=null}function Wv(){if(_v)hL()}var SK="jx.ai.pendingAgentPrompt",CK=900000;function Bu(){return typeof localStorage>"u"?void 0:localStorage}function Vu(e){return`${SK}:${e}`}function yL(e){try{let t=Bu()?.getItem(Vu(e));if(!t)return null;let r=JSON.parse(t);if(r===null)return null;let o=v(r)?r.prompt:void 0,a=v(r)?r.ts:void 0;if(!n(o)||!Y(a)||!(Date.now()-a<=CK))return Bu()?.removeItem(Vu(e)),null;return{prompt:o,ts:a}}catch{return null}}function vL(e,t){try{Bu()?.setItem(Vu(e),JSON.stringify({prompt:t,ts:Date.now()}))}catch{}}function wL(e){return yL(e)!==null}function kL(e){let t=yL(e);if(!t)return null;try{Bu()?.removeItem(Vu(e))}catch{}return t.prompt}var TK="inspector.assistant",$L=null,yr=null,qv=null,Uv=!1;function PK(){if(Uv||!yr)return;Uv=!0,P1(yr)}function SL(e){if(!e||$L===e&&yr)return;$L=e,yr=document.createElement("div"),yr.className="ai-panel-host",yr.setAttribute(Ve,TK),e.textContent="",e.append(yr),E1(),Uv=!1,qv?.stop(),qv=me(),qv.run(()=>{te(()=>{if(Hl()==="assistant")PK()}),te(()=>{let t=m.projectRoot;if(!t||!wL(t))return;Ao();let r=kL(t);if(r)requestAnimationFrame(()=>{yv(r)})})})}function CL(){if(yr)We()}var NK="platform:connection",vr=null;function TL(){let e=p().subscribeConnection;if(!e)return null;let t=e(({online:r,reason:o})=>{if(r){if(vr)$h(vr.id),vr=null,w.success("Reconnected to the Jx backend.",{source:"Backend"});return}if(vr)return;vr=w.error(o??"Lost connection to the Jx backend.",{detail:"Editing continues, but anything that reads or writes files will fail until it comes back. Studio is retrying.",key:NK,source:"Backend"})});return()=>{if(t(),vr)$h(vr.id),vr=null}}var EL={$schema:"https://jxsuite.com/schema/v1",$id:"StudioNavigatorDock",$description:"The Navigator dock's one panel host, as a Jx document over the kit. It is deliberately thin — a header naming the panel and its containment level, and one empty `[part=\"content\"]` island — because a Navigator panel is a `PanelRecord` whose `render` returns a lit template, so the BODY cannot be a document and this draws the box around it instead (studio-ui-guidelines.md §9.4). `panels/left-panel.ts` keeps every decision: which record `shell.leftTab` names, whether a context admits it, whether the panel needs a document it does not have, and what `afterRender` is handed. The body is a keyed `$map` of exactly one row, and the KEY IS THE PANEL: four Navigator panels append a mounted document of their own past lit's range inside the content box, and a host that survived a panel switch would leave the Outline standing underneath the file tree. Keying the row on the panel id is what makes switching panels destroy the box those documents are in — the same thing the old lit template bought by rebuilding its own markup, said once instead of relied upon. The region is stamped from the panel's own id, which is what makes `navigator/panel:<id>` DERIVED: renaming a panel renames its region in the same edit instead of leaving a stale selector that photographs the wrong box.",tagName:"div",attributes:{part:"navigator-dock"},style:{$description:"`styles/panels.css`'s `.panel-header*`, `.panel-content` and `.panel-body` rules, keyed on `part` and carried here. `--spectrum-font-size-50` resolved only inside `<sp-theme>` and a document mounts outside it, so both 11px values are `--jx-text-sm`. The root is `display: contents` so the panel body is still `#left-panel`'s own child for layout — the shell cell is the scroller and a box between them would be a second one. And one rule is repaired on the way: the `·` between the title and the level was a `::before` on the level span, and it is drawn only when there IS a header now — the unknown-panel state has none, and a lone separator over an error message reads as a missing word.",display:"contents",'& [part="panel-body"]':{display:"flex",flexDirection:"column",minHeight:"0",padding:"0",fontFamily:"var(--jx-font-sans)",color:"var(--fg)"},'& [part="header"]':{display:"flex",flex:"0 0 auto",alignItems:"baseline",gap:"var(--jx-space-2)",padding:"6px var(--jx-space-3)",borderBottom:"1px solid var(--border)"},'& [part="header-title"]':{fontSize:"var(--jx-text-sm)",fontWeight:"700",letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--fg)"},'& [part="header-level"]':{fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)","::before":{content:'"·"',marginRight:"var(--jx-space-2)"}},'& [part="content"]':{minHeight:"0"}},children:[{$prototype:"Array",items:{$ref:"#/state/panels"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"panel-body","data-panel":"${$map.item.key}","data-jx-region":"${$map.item.region || null}"},children:[{tagName:"div",attributes:{part:"header-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasHeader"},cases:{true:{$description:'The fix for "which panel am I in?". Six of eight panels had no header at all, and the Imports panel silently changed meaning based on whether the focused document was `project.json`. Every panel now renders under its title AND its level ("FILES · project"), so the containment model is legible from the screen rather than only from the matrix: a badge on a `project` panel does not go away when the last tab closes, and a `document` panel says out loud that it is about the file in front of you.',tagName:"header",attributes:{part:"header"},children:[{tagName:"span",attributes:{part:"header-title"},textContent:"${$map.item.title}"},{tagName:"span",attributes:{part:"header-level"},textContent:"${$map.item.level}"}]}}},{$description:"The island, and it is empty for as long as this panel is the one showing: `panels/left-panel.ts` renders the record's own template here, and the four panels that are themselves mounted documents append past lit's range — the same seam they used when this box was a `.panel-content` lit rendered `nothing` into.",tagName:"div",attributes:{part:"content"}}]}}]};E("navigator-dock",EL);function RK(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function AK(e){let t=e?.$map,r=v(t)?t.item:void 0;return v(r)?r:null}function NL(e,t,r){let o=g({panels:t.panels});e.textContent="",delete e._$litPart$;let a=null,i=!1;return R("navigator-dock",o,e,{onNodeCreated:(s,l,f,c)=>{if(!(s instanceof HTMLElement)||RK(f)!=="content")return;let d=AK(c)?.key;if(n(d))r.onContent(d,s)}}).then((s)=>{if(i){s.dispose();return}a=s}),{dispose(){i=!0,a?.dispose(),a=null},update:(s)=>{o.panels=s.panels}}}var DL=null,RL=null,Jv=null,xa=null;function _L(e){DL=e,es(),Jv=NL(of(Th,"left-panel"),{panels:[YL()]},{onContent:(t,r)=>{let o=xa!==null&&xa.panelId!==t;if(xa={host:r,panelId:t},o)requestAnimationFrame(()=>{if(xa?.host===r)of(Th,"left-panel").scrollTop=0});queueMicrotask(()=>{if(xa?.host===r)ZL()})}}),RL=me(),RL.run(()=>{te(()=>{u.leftTab;let t=h.value;if(t)t.doc.document,t.doc.mode,t.session.ui.canvasMode,t.session.selection.map((r)=>r.join("/")).join("|");xl()})})}function xl(){if(!Jv)return;Jv.update({panels:[YL()]}),ZL()}function qL(){let e=Np(u.leftTab);return e&&sx(e,th())?e:null}function YL(){let e=qL();if(!e)return{hasHeader:!1,key:u.leftTab,level:"",region:"",title:""};return{hasHeader:!0,key:e.id,level:e.level,region:UM(e.id),title:e.title}}function IK(){let e=h.value;if(!e)return null;return{canvas:e.session.canvas,content:e.doc.content,document:e.doc.document,documentPath:e.documentPath,mode:e.doc.mode,selection:e.session.selection,ui:e.session.ui}}function ZL(){let e=DL,t=xa;if(!e||!t)return;let r=qL();if((r?.id??u.leftTab)!==t.panelId)return;try{IL(e,r,t.host)}catch(o){console.error("left-panel render error:",o);try{t.host.textContent="",delete t.host._$litPart$,IL(e,r,t.host)}catch(a){console.error("left-panel retry failed:",a)}}}function IL(e,t,r){if(!t){io(Pu(r,{message:`No Navigator panel is registered as "${u.leftTab}".`}),r);return}let o=IK(),a={deps:e,doc:o,rerender:xl},i=o===null?t.requiresDocument:void 0;if(io(i===void 0?t.render(a):Pu(r,{actions:[Mc()],message:i}),r),i===void 0)t.afterRender?.(a,r)}function Xv(e,t,r,o){let a=qA(e,o,r);return{drop:{cursor:a,dragSeq:t,kind:"drop"},move:{cursor:a,dragSeq:t,kind:"dragMove"}}}function Gv(e){return{x:e.current.input.clientX,y:e.current.input.clientY}}function Kv(e){if(e.type==="block"){let t=e.fragment?.tagName;return n(t)?{tag:t,type:"block"}:{type:"block"}}if(e.type==="tree-node"&&Array.isArray(e.path))return{path:e.path,type:"tree-node"};return null}function mO(e,t,r){if(t.type==="block"){let i=r.fragment;return it(i?.tagName)||"block"}let o=e?.doc.document,a=o?oe(o,t.path):void 0;return it(a?.tagName)||"node"}var fO=250;function Yv(e,t,r){let o=Zb(e,t,r);return{host:e,label:mO(C$(e),t,r),seq:o,src:t,srcData:r}}function pO(e,t){RC(t.x,t.y);let r=Yb(t);if(r===e.host){if(r){let{rect:i,scale:s}=tc(r);Vc(r,Xv(t,e.seq,s,i).move)}return}if(e.host)Vc(e.host,{dragSeq:e.seq,kind:"dragEnd"});if(!r){e.host=null;return}e.host=r,e.seq=Zb(r,e.src,e.srcData);let{rect:o,scale:a}=tc(r);Vc(r,Xv(t,e.seq,a,o).move)}function OK(e,t){let r=Yb(t);if(r&&r!==e.host){if(e.host)Vc(e.host,{dragSeq:e.seq,kind:"dragEnd"});e.host=r,e.seq=Zb(r,e.src,e.srcData)}if(!r){if(e.host)Vc(e.host,{dragSeq:e.seq,kind:"dragEnd"});gx(e.seq),ch();return}let{rect:o,scale:a}=tc(r);Vc(r,Xv(t,e.seq,a,o).drop);let{seq:i}=e;setTimeout(()=>{if(NC()===i)ch(),bx(r)},fO)}function MK(e){if(e.host)Vc(e.host,{dragSeq:e.seq,kind:"dragEnd"}),bx(e.host);gx(e.seq),ch()}function DK(e){let{initial:t}=e;if(!t)return!1;return t.input.clientX===e.current.input.clientX&&t.input.clientY===e.current.input.clientY}function hO(){let e=null,t=null;return h$((r)=>{if(!t||e?.host===r)return;if(e){if(e.host)Vc(e.host,{dragSeq:e.seq,kind:"dragEnd"});e.host=r,e.seq=Zb(r,e.src,e.srcData);return}e=Yv(r,t.src,t.srcData)}),Js({onDrag({source:r,location:o}){let a=Kv(r.data);if(!a)return;let i=Gv(o);if(e){pO(e,i);return}let s=Yb(i);if(s)e=Yv(s,a,r.data),i$(e.label,i.x,i.y),pO(e,i)},onDragStart({source:r,location:o}){let a=Kv(r.data);if(!a)return;t={src:a,srcData:r.data};let i=Gv(o),s=Yb(i);e=s?Yv(s,a,r.data):null,i$(e?e.label:mO(h.value,a,r.data),i.x,i.y)},onDrop({source:r,location:o}){if(!Kv(r.data))return;t=null;let i=Gv(o);if(!e){ch();return}if(o$(e.seq)){let{host:s,seq:l}=e;e=null,setTimeout(()=>{if(NC()!==l)return;if(s)Vc(s,{dragSeq:l,kind:"dragEnd"}),bx(s);gx(l),ch()},fO);return}if(DK(o))MK(e);else OK(e,i);e=null}})}var yO={$schema:"https://jxsuite.com/schema/v1",$id:"StudioNewProject",$description:"The New Project wizard: two steps in one dialog. Step 1 asks where the site comes from — a starter gallery that ends with one Start from scratch card, an Import of a site that already exists, or an Agent brief — and step 2 asks what it is called and where it is written. A `jx-dialog`, so the platform owns modality, Escape, focus restoration and the backdrop, which is what retired the fixed `.new-project-modal` card, the `<sp-underlay>` beside it, the `z-index: 1000` that card needed to climb back out from under its own scrim, and the hand-drawn header with its own close button. The footer is the dialog's too: Cancel, Back and the primary are `cancelLabel`, `secondaryLabel` and `confirmLabel`, so the wizard says which answers exist by naming them rather than by drawing three buttons per step. Nothing here knows what a starter is, which platform writes to a repository rather than a folder, what makes an AI gate open, or how a breakpoint policy is spelled — `new-project/new-project-modal.ts` keeps the flow, `new-project/import-tab.ts` the brief and `new-project/location-fields.ts` the destination, and all three hand over strings, flags and one discriminant per branch. The three AI controllers are islands: their own mounted documents, placed by the adapter into boxes this document renders empty (studio-ui-guidelines.md §9.4).",tagName:"jx-dialog",$props:{headline:{$ref:"#/state/headline"},confirmLabel:{$ref:"#/state/confirmLabel"},secondaryLabel:{$ref:"#/state/secondaryLabel"},cancelLabel:"Cancel",dismissible:!0,size:"lg"},attributes:{part:"new-project"},oncancel:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},onclose:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},onconfirm:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/confirm"},value:[]}]},onsecondary:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/secondary"},value:[]}]},style:{$description:"Forty-three `.new-project-*` rules in `styles/overlays.css` become the parts below, and eight of them do not travel. `.new-project-modal` was a fixed, centred, bordered, shadowed card with its own width and `z-index: 1000`, and a modal `<dialog>` is every one of those; `.new-project-modal-header`, `.new-project-modal-title`, `.new-project-modal-body` and `.new-project-modal-footer` are the header, headline, scroll body and button row `jx-dialog` already draws; `.new-project-tabs` drew a rule under the strip that `jx-tabs` draws itself; `.new-project-error--global` pinned the backend error outside the scroll body, which a dialog that scrolls as one has nowhere to put; and `.new-project-field` / `.new-project-label` drew a label above a control, which is `jx-field` with `span` — with the label actually NAMING the control, which a bare `<span>` beside a textfield never did. Three repairs travel with the rest. Every `--spectrum-font-size-*` reference is gone: those names resolve only inside `<sp-theme>` and a document mounted in the dialog layer is outside it, so all eleven would silently have taken their hard-coded fallback. `var(--accent, #3b82f6)` on the selected card loses the hex, which was the same bug written the other way round. And the two thumbnail wells read `var(--bg-elevated, #1a1a1a)` for a token no stylesheet in this package defines, so the fallback was not a fallback — it was the value; they take `--bg-input`, which is the recessed surface the rest of the chrome uses.",'& [part="wizard"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-4)",fontFamily:"var(--jx-font-sans)",color:"var(--fg)"},'& [part="blurb"]':{$description:'The sentence at the top of a source tab: what this path does, before any field asks for anything. `blurb` rather than `intro`, and the footnote below is `footnote` rather than `note`, because the three AI controllers mount their own documents INSIDE this one: `surfaces/ai-managed-connect.json` draws a `[part="intro"]` and `surfaces/ai-credentials-form.json` a `[part="note"]`, and a scoped rule on either name would restyle a surface this document does not own.',margin:"0",fontSize:"var(--jx-text-md)",lineHeight:"var(--jx-leading-lg)",color:"var(--fg-dim)"},'& [part="gallery"]':{display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gap:"var(--jx-space-3)"},'& [part="card"]':{$description:"A whole card is the button, because the answer is the starter rather than a control inside it. `font: inherit` because a `<button>` does not inherit type, and what it inherits here is the dialog's own body size rather than a number this surface picked.",display:"flex",flexDirection:"column",overflow:"hidden",padding:"0",border:"1px solid var(--border)",borderRadius:"var(--jx-radius-md)",background:"var(--bg-panel)",font:"inherit",color:"var(--fg)",textAlign:"left",cursor:"pointer","&:hover":{borderColor:"var(--fg-dim)"},"&[data-selected]":{borderColor:"var(--accent)",boxShadow:"0 0 0 1px var(--accent)"},'&[data-art="blank"]':{$description:"The one non-starter card, last in the gallery and spanning it, so the sites lead.",gridColumn:"1 / -1",flexDirection:"row",alignItems:"center",'& [part="blank"]':{width:"96px",flexShrink:"0"}}},'& [part="thumb"]':{display:"block",width:"100%",aspectRatio:"16 / 10",objectFit:"cover",background:"var(--bg-input)"},'& [part="blank"]':{display:"flex",alignItems:"center",justifyContent:"center",aspectRatio:"16 / 10",background:"var(--bg-input)",fontSize:"28px",color:"var(--fg-dim)"},'& [part="card-body"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-1)",padding:"var(--jx-space-2) var(--jx-space-3) var(--jx-space-3)"},'& [part="card-name"]':{fontSize:"var(--jx-text-md)",fontWeight:"600"},'& [part="card-tag"]':{fontSize:"var(--jx-text-sm)",lineHeight:"var(--jx-leading-sm)",color:"var(--fg-dim)"},'& [part="creds"]':{$description:"The gate's column: the keyless offer above the key form, both of them mounted documents of their own. `max-width` so three text fields do not stretch to the width of a large dialog.",display:"flex",flexDirection:"column",maxWidth:"480px"},'& [part="managed-island"], & [part="creds-island"], & [part="model-island"]':{$description:"An island's box lays nothing out: each controller's own host is `display: contents`, so what the column above sees is the mounted document's own root and not a wrapper that would become the flex item in its place.",display:"contents"},'& [part="grid"]':{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"var(--jx-space-4)"},'& [part="breakpoints"]':{$description:"A mode picker, whichever value control that mode takes, and the rounding rule. It wraps rather than scrolls — the widths field is the one that needs room, and it should get it.",display:"flex",flexWrap:"wrap",alignItems:"center",gap:"var(--jx-space-3)"},'& [part="bp-mode"], & [part="bp-rounding"]':{minWidth:"132px"},'& [part="bp-count"], & [part="min-fidelity"]':{width:"96px"},'& [part="bp-widths"]':{flex:"1",minWidth:"160px"},'& [part="location-row-controls"]':{$description:"The Location field takes the slack; Browse… stays its natural width.",display:"flex",alignItems:"center",gap:"var(--jx-space-3)"},'& [part="url"], & [part="prompt"], & [part="import-prompt"], & [part="name"], & [part="slug"], & [part="location"], & [part="owner"], & [part="visibility"]':{$description:"The kit's fields are `inline-flex`, which is right in a row of controls and wrong for the one control of a `span` row. Named one by one rather than as `& jx-textfield`, because the credentials island below is three more text fields in the same tree and none of them is this document's to size.",display:"flex",width:"100%"},'& [part="context"]':{$description:"WHICH source this project is being made from, said on the step that no longer shows the tab strip.",margin:"0",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"},'& [part="destination-preview"]':{$description:"Live preview of where the project will land — the answer to “where did that go?”.",margin:"0",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)",overflowWrap:"anywhere"},'& [part="destination-target"]':{fontFamily:"var(--font-mono)",color:"var(--fg)"},'& [part="footnote"]':{margin:"0",fontSize:"var(--jx-text-md)",lineHeight:"var(--jx-leading-lg)",color:"var(--fg-dim)"},'& [part="name-failure"], & [part="destination-failure"], & [part="import-failure"], & [part="failure"]':{$description:'Four refusals, one look, and none of them called `error`: `jx-textfield` and `jx-field` both draw a `[part="error"]` of their own inside this same tree, and the kit is light DOM, so a scoped rule on that name would restyle every field\'s own error line.',margin:"0",fontSize:"var(--jx-text-md)",color:"var(--danger)"},'& [part="failure"]':{$description:"The backend's refusal, said at the end of the body so it sits directly above the footer the reader is about to press again. It used to be pinned outside the scroll box; a dialog scrolls as one, so what replaces the pin is being last.",display:"flex",flexWrap:"wrap",gap:"var(--jx-space-2)",paddingTop:"var(--jx-space-3)",borderTop:"1px solid var(--border)"},'& [part="install"]':{color:"var(--accent)",textDecoration:"underline"}},children:[{tagName:"div",attributes:{part:"wizard"},children:[{tagName:"div",attributes:{part:"tabs-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/showTabs"},cases:{true:{tagName:"jx-tabs",attributes:{part:"tabs"},$props:{label:"Where the project comes from",selected:{$ref:"#/state/tab"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/pickTab"},value:[{$ref:"event#/detail"}]}]},children:[{$prototype:"Array",items:{$ref:"#/state/tabs"},key:{$ref:"$map/item/value"},map:{tagName:"jx-tab",attributes:{part:"tab",value:"${$map.item.value}",label:"${$map.item.label}"}}}]}}},{tagName:"div",attributes:{part:"body-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/body"},cases:{starter:{tagName:"div",attributes:{part:"starter",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"blurb"},textContent:"Every starter is a complete site copied in as plain files you own — open it, look at it, then make it yours."},{tagName:"div",attributes:{part:"gallery"},children:[{$prototype:"Array",items:{$ref:"#/state/cards"},key:{$ref:"$map/item/id"},map:{tagName:"button",attributes:{part:"card",type:"button","data-starter":"${$map.item.id}","data-art":"${$map.item.art}","data-selected":"${$map.item.selected ? '' : null}","aria-pressed":"${$map.item.selected ? 'true' : 'false'}",title:"${$map.item.title || null}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/pickCard"},value:[{$ref:"$map/item/id"}]}]},children:[{tagName:"div",attributes:{part:"art-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/art"},cases:{thumb:{tagName:"img",attributes:{part:"thumb",src:"${$map.item.thumbnail}",alt:""}},blank:{tagName:"span",attributes:{part:"blank","aria-hidden":"true"},textContent:"+"}}},{tagName:"span",attributes:{part:"card-body"},children:[{tagName:"span",attributes:{part:"card-name"},textContent:"${$map.item.name}"},{tagName:"span",attributes:{part:"card-tag"},textContent:"${$map.item.tagline}"}]}]}}]}]},gate:{tagName:"div",attributes:{part:"gate",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"blurb"},textContent:"${state.gateIntro}"},{tagName:"div",attributes:{part:"creds"},children:[{tagName:"div",$description:"Where `ui/ai-managed-connect.ts`'s own mounted document goes. The node is rendered EMPTY and the adapter puts the controller's host inside it — the one seam a foreign mount may arrive through (specs/studio-ui-guidelines.md §9.4). It is drawn even when the platform brokers nothing, because the controller answers that question itself and hands back nothing to place.",attributes:{part:"managed-island",role:"none"}},{tagName:"div",$description:"Where `ui/ai-credentials-form.ts`'s own mounted document goes. Three fields a reader is typing into, so it must survive every repaint of the wizard around it: the document renders this box and never its contents, and the adapter places the same host node back into it rather than rebuilding one.",attributes:{part:"creds-island",role:"none"}}]}]},agent:{tagName:"div",attributes:{part:"agent",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"blurb"},textContent:"Describe the site you want; the assistant builds it in the editor while you watch."},{tagName:"jx-field",attributes:{part:"agent-row"},$props:{span:!0,label:"Prompt",required:!0},children:[{tagName:"jx-textfield",attributes:{part:"prompt"},$props:{size:"sm",value:{$ref:"#/state/agentPrompt"},placeholder:"A landing page for a small coffee roastery with a menu and contact form…",multiline:!0,rows:"6"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setAgentPrompt"},value:[{$ref:"event#/target/value"}]}]}}]}]},import:{tagName:"div",attributes:{part:"import",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"blurb"},textContent:"Clone an existing site into an editable Jx project: pages, styles, assets, and components."},{tagName:"jx-field",attributes:{part:"url-row"},$props:{span:!0,label:"Site URL",required:!0},children:[{tagName:"jx-textfield",attributes:{part:"url"},$props:{size:"sm",value:{$ref:"#/state/url"},placeholder:"https://example.com",type:"url"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setUrl"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"div",attributes:{part:"grid"},children:[{tagName:"jx-field",attributes:{part:"depth-row"},$props:{span:!0,label:"Crawl Depth"},children:[{tagName:"jx-number-field",attributes:{part:"depth"},$props:{size:"sm",label:"Crawl Depth",min:"0",max:{$ref:"#/state/maxDepth"},value:{$ref:"#/state/depth"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setDepth"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",attributes:{part:"pages-row"},$props:{span:!0,label:"Max Pages"},children:[{tagName:"jx-number-field",attributes:{part:"max-pages"},$props:{size:"sm",label:"Max Pages",min:"1",max:"100",value:{$ref:"#/state/maxPages"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setMaxPages"},value:[{$ref:"event#/target/value"}]}]}}]}]},{tagName:"jx-field",attributes:{part:"breakpoints-row"},$props:{span:!0,label:"Breakpoints",description:"${state.breakpointHint}"},children:[{tagName:"div",attributes:{part:"breakpoints"},children:[{tagName:"jx-select",attributes:{part:"bp-mode"},$props:{size:"sm",label:"Breakpoints",value:{$ref:"#/state/breakpointMode"},options:{$ref:"#/state/breakpointModes"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setBreakpointMode"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"div",attributes:{part:"bp-value-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/breakpointValue"},cases:{count:{tagName:"jx-number-field",attributes:{part:"bp-count"},$props:{size:"sm",label:"How many breakpoints to keep",min:"1",max:{$ref:"#/state/maxBreakpoints"},value:{$ref:"#/state/breakpointCount"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setBreakpointCount"},value:[{$ref:"event#/target/value"}]}]}},widths:{tagName:"jx-textfield",attributes:{part:"bp-widths"},$props:{size:"sm",value:{$ref:"#/state/breakpointWidths"},label:"Breakpoint widths",placeholder:"640, 1024, 1440"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setBreakpointWidths"},value:[{$ref:"event#/target/value"}]}]}}}},{tagName:"div",attributes:{part:"bp-rounding-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/showRounding"},cases:{true:{tagName:"jx-select",attributes:{part:"bp-rounding"},$props:{size:"sm",label:"Rounding",value:{$ref:"#/state/breakpointRounding"},options:{$ref:"#/state/roundings"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setBreakpointRounding"},value:[{$ref:"event#/target/value"}]}]}}}}]}]},{tagName:"jx-switch",attributes:{part:"ai-naming"},$props:{size:"sm",checked:{$ref:"#/state/aiNaming"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setAiNaming"},value:[{$ref:"event#/target/checked"}]}]},children:[{tagName:"span",textContent:"AI component naming"}]},{tagName:"div",attributes:{part:"verify-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/canVerify"},cases:{true:{tagName:"jx-switch",attributes:{part:"verify"},$props:{size:"sm",checked:{$ref:"#/state/verify"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setVerify"},value:[{$ref:"event#/target/checked"}]}]},children:[{tagName:"span",textContent:"Check fidelity against the original (slower)"}]}}},{tagName:"div",attributes:{part:"fidelity-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/showFidelity"},cases:{true:{tagName:"jx-field",attributes:{part:"fidelity-row"},$props:{span:!0,label:"Minimum fidelity",description:"Below this average, the assistant reports that the clone did not match the original. A floor rather than a target: a faithful import of a complicated site still lands well under 100. Set 0 to report the score without judging it."},children:[{tagName:"jx-number-field",attributes:{part:"min-fidelity"},$props:{size:"sm",label:"Minimum fidelity",min:"0",max:"100",value:{$ref:"#/state/minFidelity"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setMinFidelity"},value:[{$ref:"event#/target/value"}]}]}}]}}},{tagName:"jx-field",attributes:{part:"model-row"},$props:{span:!0,label:"Model"},children:[{tagName:"div",$description:"Where `ui/ai-model-picker.ts`'s own mounted document goes. The picker holds the in-flight catalogue fetch and the credentials the last failure belonged to, so it is one controller for the life of the wizard and this box is only ever where its host is put.",attributes:{part:"model-island",role:"none"}}]},{tagName:"jx-field",attributes:{part:"brief-row"},$props:{span:!0,label:"What should the assistant do with it?"},children:[{tagName:"jx-textfield",attributes:{part:"import-prompt"},$props:{size:"sm",value:{$ref:"#/state/importPrompt"},placeholder:"Keep the layout but modernise the typography, and turn the news list into a content collection…",multiline:!0,rows:"4"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setImportPrompt"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"div",attributes:{part:"import-failure-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasImportError"},cases:{true:{tagName:"p",attributes:{part:"import-failure",role:"alert"},textContent:"${state.importError}"}}}]},params:{tagName:"div",attributes:{part:"params",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"context"},textContent:"${state.contextLabel}"},{tagName:"jx-field",attributes:{part:"name-row","data-invalid":"${state.hasNameError ? '' : null}"},$props:{span:!0,label:"Project Name",required:!0},children:[{tagName:"jx-textfield",attributes:{part:"name"},$props:{size:"sm",value:{$ref:"#/state/name"},label:"Project Name",placeholder:"My Site",invalid:{$ref:"#/state/hasNameError"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setName"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"div",attributes:{part:"name-failure-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasNameError"},cases:{true:{tagName:"p",attributes:{part:"name-failure",role:"alert"},textContent:"${state.nameError}"}}},{tagName:"div",attributes:{part:"destination-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/destination"},cases:{path:{tagName:"div",attributes:{part:"path-fields",role:"none"},style:{display:"contents"},children:[{tagName:"jx-field",attributes:{part:"location-row"},$props:{span:!0,label:"Location",required:!0},children:[{tagName:"div",attributes:{part:"location-row-controls"},children:[{tagName:"jx-textfield",attributes:{part:"location"},$props:{size:"sm",value:{$ref:"#/state/parent"},label:"Location",placeholder:"${state.parentPlaceholder}"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setParent"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"div",attributes:{part:"browse-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/canBrowse"},cases:{true:{tagName:"jx-button",attributes:{part:"browse"},$props:{size:"sm",disabled:{$ref:"#/state/browsing"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/browse"},value:[]}]},children:[{tagName:"span",textContent:"${state.browseLabel}"}]}}}]}]}]},repo:{tagName:"div",attributes:{part:"repo-fields",role:"none"},style:{display:"contents"},children:[{tagName:"jx-field",attributes:{part:"owner-row"},$props:{span:!0,label:"Owner",required:!0},children:[{tagName:"div",attributes:{part:"owner-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasOwners"},cases:{true:{tagName:"jx-select",attributes:{part:"owner"},$props:{size:"sm",label:"Owner",value:{$ref:"#/state/owner"},options:{$ref:"#/state/owners"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setOwner"},value:[{$ref:"event#/target/value"}]}]}},false:{tagName:"jx-textfield",attributes:{part:"owner"},$props:{size:"sm",value:{$ref:"#/state/owner"},label:"Owner",placeholder:"your-account-or-org"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setOwner"},value:[{$ref:"event#/target/value"}]}]}}}}]}]}}},{tagName:"jx-field",attributes:{part:"slug-row"},$props:{span:!0,label:"${state.slugLabel}"},children:[{tagName:"jx-textfield",attributes:{part:"slug"},$props:{size:"sm",value:{$ref:"#/state/slug"},label:"${state.slugLabel}",placeholder:"my-site"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setSlug"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"div",attributes:{part:"taken-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasRepoTaken"},cases:{true:{tagName:"p",attributes:{part:"destination-failure"},textContent:"${state.repoTaken}"}}},{tagName:"div",attributes:{part:"visibility-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/destination"},cases:{repo:{tagName:"jx-field",attributes:{part:"visibility-row"},$props:{span:!0,label:"Visibility"},children:[{tagName:"jx-select",attributes:{part:"visibility"},$props:{size:"sm",label:"Visibility",value:{$ref:"#/state/visibility"},options:{$ref:"#/state/visibilities"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setVisibility"},value:[{$ref:"event#/target/value"}]}]}}]}}},{tagName:"p",attributes:{part:"destination-preview"},children:[{tagName:"span",textContent:"${state.previewLabel}: "},{tagName:"code",attributes:{part:"destination-target"},textContent:"${state.preview}"}]},{tagName:"div",attributes:{part:"destination-failure-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasDestinationError"},cases:{true:{tagName:"p",attributes:{part:"destination-failure",role:"alert"},textContent:"${state.destinationError}"}}},{tagName:"p",attributes:{part:"footnote"},textContent:"${state.note}"}]}}},{tagName:"div",attributes:{part:"failure-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasError"},cases:{true:{tagName:"p",attributes:{part:"failure",role:"alert"},children:[{tagName:"span",textContent:"${state.error}"},{tagName:"span",attributes:{part:"install-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasInstallUrl"},cases:{true:{tagName:"a",attributes:{part:"install",href:"${state.errorInstallUrl}",target:"_blank",rel:"noreferrer"},textContent:"Install the Jx Suite GitHub App →"}}}]}}}]}]};E("new-project",yO);function vO(e){return{...e,breakpointValue:e.breakpointMode==="limit"?"count":e.breakpointMode==="explicit"?"widths":"none",hasDestinationError:e.destinationError!=="",hasError:e.error!=="",hasImportError:e.importError!=="",hasInstallUrl:e.errorInstallUrl!=="",hasNameError:e.nameError!=="",hasOwners:e.owners.length>0,hasRepoTaken:e.repoTaken!=="",showFidelity:e.canVerify&&e.verify,showRounding:e.breakpointMode!=="all"}}function _K(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function kO(e){let t=document.createElement("div");t.style.pointerEvents="auto",e.layer.append(t);let r=!1,o=()=>{if(r)return;r=!0,e.actions.closed()},a=()=>r,i=new Map,s=()=>{for(let[d,b]of i){let x=(d==="creds-island"?e.islands.creds:d==="managed-island"?e.islands.managed:e.islands.model)();if(x&&x.parentNode!==b)b.append(x)}},l=g({...vO(e.view),...e.actions,browse:()=>{e.actions.browse()},closed:o}),f=null,c=R("new-project",l,t,{onNodeCreated:(d,b,y)=>{let x=_K(y);if(d instanceof HTMLElement&&x.endsWith("-island"))i.set(x,d),s()}}).then(async(d)=>{f=d;let b=d.root;if(a())return d.dispose(),b;if(await sn(b),a())return b;return(b.querySelector('dialog[part="dialog"]')??b).setAttribute(Ve,vt("dialog","new-project")),Jt(b),s(),b});return{close(){let d=f?.root;if(d instanceof HTMLElement)Ut(d);f?.dispose(),f=null,i.clear(),t.remove(),o()},focusName(){let d=f?.root;if(!(d instanceof HTMLElement))return;requestAnimationFrame(()=>{d.querySelector('[part="dialog"]')?.scrollTo(0,0),d.querySelector('[part="name"] [part="input"]')?.focus()})},host:t,ready:c,update(d){Object.assign(l,vO(d)),s()}}}var zK=/^(?:[a-zA-Z]:[/\\]|\/)/,Ta="",Cn="",Gu=!0,Wu=[],Qv=null,Et="",Sa=!1;function TO(){Ta="",Cn="",Gu=!0,Wu=[],Qv=null,Et="",Sa=!1}function PO(e){let t=p();if(t.createDestination!=="repo")return;let r=new Set;Promise.allSettled([t.getAccountStatus?.().then((o)=>{for(let a of o?.installations??[])if(a.account)r.add(a.account)}),t.listRepos?.().then((o)=>{Qv=o;for(let a of o)r.add(a.owner)})]).then(()=>{Wu=[...r].toSorted((o,a)=>o.localeCompare(a)),Cn||=Wu[0]??"",e()})}function HK(){return p().createDestination==="repo"?"Repository":"Directory"}function NO(e){if(Et="",p().createDestination==="repo"){if(!Cn.trim())return Et="Choose an owner for the repository",null;if(!e.trim())return Et="Repository name is required",null;return{kind:"repo",owner:Cn.trim(),private:Gu,repo:e.trim()}}let t=Ta.trim();if(!t)return Et="Choose a location for the project folder",null;if(!zK.test(t))return Et="Location must be an absolute path",null;if(!e.trim())return Et="Directory name is required",null;return{kind:"path",parent:RO(t)}}function RO(e){return e.replace(/[/\\]+$/,"")||e}function AO(e,t){let r=e.includes("\\")&&!e.includes("/")?"\\":"/";return e.endsWith("/")||e.endsWith("\\")?`${e}${t}`:`${e}${r}${t}`}function IO(e,t){if(e.kind==="repo")return`${e.owner}/${e.repo||t.trim()}`;return AO(e.parent,t.trim())}function BK(e){let t=e.trim()||"…";if(p().createDestination==="repo")return`${Cn.trim()||"…"}/${t}`;let r=RO(Ta.trim());return r?AO(r,t):`…/${t}`}function VK(e){let t=`${Cn.trim()}/${e.trim()}`.toLowerCase();return(Qv??[]).some((r)=>r.fullName.toLowerCase()===t)}function OO(e){let t=p(),r=t.createDestination==="repo";return{browseLabel:Sa?"Choosing…":"Browse…",browsing:Sa,canBrowse:Q(t.pickDirectory),destination:r?"repo":"path",error:Et,owner:Cn,owners:Wu.map((o)=>({label:o,value:o})),parent:Ta,parentPlaceholder:t.pickDirectory?"Choose a folder to create the project in":"/absolute/path/to/your/projects",preview:BK(e),previewLabel:r?"Repository":"Creates",repoTaken:r&&VK(e)?`${Cn}/${e.trim()} already exists — choose another name.`:"",slugLabel:HK(),visibility:Gu?"private":"public"}}function MO(e){Ta=e,Et=""}function FO(e){Cn=e,Et=""}function zO(e){Gu=e!=="public"}async function HO(e){let t=p();if(!t.pickDirectory||Sa)return;Sa=!0,e();try{let r=await t.pickDirectory();if(r)Ta=r,Et=""}catch(r){Et=X(r)||"The folder could not be chosen. Type its path into Location instead."}finally{Sa=!1,e()}}var Ra="",Xu=1,Zu=20,Pn="limit",em=3,tm="",kl="nearest",nm=!0,Yu="",im="",pm=!1,mm=25,Aa="",VO=!1;function WO(){Ra="",Xu=1,Zu=20,Pn="limit",em=3,tm="",kl="nearest",nm=!0,Yu="",im="",pm=!1,mm=25,Aa="",VO=!1}var KO=null,BO=null;function WK(){return BO??=gu({getModel:()=>Yu||Xl(),onChange:(e)=>{Yu=e},requestRender:()=>KO?.(),width:"fill"}),BO}function YO(){return WK().render()}function qK(){if(Pn==="all")return{mode:"all"};if(Pn==="explicit"){let e=tm.split(",").map((t)=>Math.trunc(Number(t.trim()))).filter((t)=>Number.isFinite(t)&&t>0);if(e.length>0)return{mode:"explicit",rounding:kl,widths:e}}return{count:em,mode:"limit",rounding:kl}}function ZO(){return p().createDestination!=="repo"}function UK(e){return e.toLowerCase().replaceAll(/[^a-z0-9]+/g,"-").replaceAll(/^-|-$/g,"")}function iM(e){let t=null;try{t=new URL(Ra.trim())}catch{t=null}if(!t||t.protocol!=="http:"&&t.protocol!=="https:")return Aa="Enter a valid URL (e.g. https://example.com)",e.rerender(),!1;return Aa="",!0}function JK(e){let t;try{t=new URL(Ra.trim())}catch{return Aa="Enter a valid URL (e.g. https://example.com)",e.rerender(),null}if(t.protocol!=="http:"&&t.protocol!=="https:")return Aa="The URL must start with http:// or https://",e.rerender(),null;let r=e.resolveDestination();if(!r)return null;return{aiComponents:nm,breakpoints:qK(),depth:Xu,directory:IO(r,e.form.directory),maxPages:Zu,model:Yu,name:e.form.name.trim(),prompt:im.trim(),minFidelity:mm,url:t.href,verify:ZO()&&pm}}function sM(e){if(!p().importSite)return;let t=JK(e);if(!t)return;zN(t),e.onHandoff(t)}function lM(){return"Import Site"}function GK(){if(Pn==="all")return"Every breakpoint the site declares becomes a canvas size. Real sites often declare nine.";if(Pn==="explicit")return"The project gets these widths, each backed by the declared width nearest it.";return"Evenly spaced across the widths the site declares — the narrowest, the widest, and the ones between."}function cM(e){return KO=e.rerender,{aiNaming:nm,breakpointCount:String(em),breakpointHint:GK(),breakpointMode:Pn,breakpointModes:[{label:"Limit to",value:"limit"},{label:"Custom widths",value:"explicit"},{label:"Keep all",value:"all"}],breakpointRounding:kl,breakpointValue:Pn==="limit"?"count":Pn==="explicit"?"widths":"none",breakpointWidths:tm,canVerify:ZO(),depth:String(Xu),error:Aa,maxBreakpoints:String(PL),maxDepth:String(jd),maxPages:String(Zu),minFidelity:String(mm),prompt:im,roundings:[{label:"nearest",value:"nearest"},{label:"round down",value:"down"},{label:"round up",value:"up"}],url:Ra,verify:pm}}function gM(e,t){if(Ra=t,e.form.name.trim())return;try{let r=new URL(Ra).hostname.replace(/^www\./,"");if(r){if(e.form.name=r,!VO)e.form.directory=UK(r)}}catch{}}function bM(e){Xu=Math.trunc(Number(e))||0}function yM(e){Zu=Math.trunc(Number(e))||1}function vM(e){Pn=e}function wM(e){em=Math.trunc(Number(e))||3}function xM(e){tm=e}function kM(e){kl=e}function SM(e){nm=e}function CM(e){pm=e}function jM(e){let t=Math.trunc(Number(e));mm=Number.isNaN(t)?0:Math.min(100,Math.max(0,t))}function MM(e){im=e}var $r=null,Ge={directory:"",name:""},pt="starter",En="source",cn="",Zv=!1,$l="",Nn="",Oo="",lw="";function KK(e){Nn=X(e),lw=pA(e)??""}var Tr=!1,hm=[],aw=null,gm=!0,FM=null;function Ia(){if($r)_e()}function YK(){return FM??=_d({onSaved:Ia,requestRender:Ia}),FM}var _M=null;function cw(){return _M??=Vd({requestRender:Ia}),_M}function BM(){if(zb())return!0;return cw().ensureProbe(),!1}function dw(e){if($r)return Promise.resolve(null);Ge={directory:"",name:""},pt=e?.tab??"starter",En="source",cn="",Zv=!1,$l="",Nn="",Oo="",lw="",Tr=!1,hm=[],gm=!0,WO(),TO();let t=p();if(PO(Ia),t.listStarters)t.listStarters().then((r)=>{if(hm=r,!Zv)cn=r[0]?.id??"";Ia()}).catch(()=>{});return new Promise((r)=>{aw=r,$r=kO({actions:{browse:()=>{HO(Ia)},closed:()=>{KM(null)},confirm:t8,pickCard:e8,pickTab:(o)=>{if(Tr)return;pt=o,Nn="",_e()},secondary:r8,setAgentPrompt:(o)=>{$l=o},setAiNaming:SM,setBreakpointCount:wM,setBreakpointMode:(o)=>{vM(o),_e()},setBreakpointRounding:kM,setBreakpointWidths:xM,setDepth:bM,setImportPrompt:MM,setMaxPages:yM,setMinFidelity:jM,setName:QK,setOwner:(o)=>{FO(o),_e()},setParent:(o)=>{MO(o),_e()},setSlug:ZK,setUrl:(o)=>{gM(ym(),o),_e()},setVerify:(o)=>{CM(o),_e()},setVisibility:(o)=>{zO(o),_e()}},islands:{creds:()=>YK().render(),managed:()=>cw().render(),model:()=>YO()},layer:dt("dialog"),view:TD()})})}function _e(){$r?.update(TD())}function KM(e){let t=$r,r=aw;$r=null,aw=null,Tr=!1,r?.(e),t?.close()}function YM(e){KM(e)}async function qM(e){let{adopted:t,error:r,openedElsewhere:o}=await mo(e.root);if(!t&&!o)w.warn("Created the project, but could not open it here.",r===null?{source:"New Project"}:{detail:r,source:"New Project"});YM(e)}function XM(e){return e.toLowerCase().replaceAll(/[^a-z0-9]+/g,"-").replaceAll(/^-|-$/g,"")}function XK(){switch(pt){case"import":return"Import";case"agent":return"Agent";default:return cn?`Starter site · ${hm.find((e)=>e.id===cn)?.name??cn}`:"Start from scratch"}}function ym(){return{form:Ge,onHandoff:(e)=>{YM(null),JN(e)},rerender:_e,resolveDestination:()=>ZM()}}function ZM(){if(!Ge.name.trim())return Oo="Project name is required",_e(),$r?.focusName(),null;if(!Ge.directory.trim())Ge.directory=XM(Ge.name);let e=NO(Ge.directory);if(!e)return Oo="",_e(),$r?.focusName(),null;return e}function QK(e){if(Ge.name=e,Oo="",!Ge.directory)gm=!0;if(gm)Ge.directory=XM(Ge.name);_e()}function ZK(e){Ge.directory=e,gm=!1,_e()}function e8(e){cn=e,Zv=!0,Nn="",_e()}function t8(){if(En==="source"){n8();return}if(pt==="import"){sM(ym());return}if(Tr)return;if(pt==="agent"){sw({template:"blank"},async(e)=>{vL(e.root,$l.trim()),await qM(e)});return}sw(cn?{starter:cn}:{template:"blank"},qM)}function n8(){if(pt==="import"&&!iM(ym()))return;if(pt==="agent"&&!$l.trim()){Nn="Describe the site you want the agent to build",_e();return}En="params",Nn="",_e()}function r8(){if(Tr)return;En="source",Nn="",Oo="",_e()}async function sw(e,t,r=!1){let o=ZM();if(!o)return;Tr=!0,Nn="",Oo="",_e();try{let a=await p().createProject({...Ge,destination:o,...e});await t(a)}catch(a){if(Tr=!1,KK(a),_e(),!r&&await Am(a))await sw(e,t,!0)}}function kD(){if(En==="params")return"params";if(pt==="import")return BM()?"import":"gate";if(pt==="agent")return BM()?"agent":"gate";return"starter"}function o8(){let e=cw().canOffer()?"Connect Cloudflare, or add an OpenAI-compatible API key, to continue.":"Add an OpenAI-compatible API key to continue.";return pt==="import"?`Importing uses an AI-guided pipeline to clone an existing site. ${e}`:`The agent uses your AI provider to build the site. ${e}`}function a8(){if(En==="source")return kD()==="gate"?"":"Next";if(pt==="import")return lM();if(Tr)return"Creating…";return pt==="agent"?"Create & Start Agent":"Create Project"}function i8(){let e=hm.map((t)=>({art:"thumb",id:t.id,name:t.name,selected:cn===t.id,tagline:t.tagline,thumbnail:t.thumbnail,title:t.description}));return e.push({art:"blank",id:"",name:"Start from scratch",selected:cn==="",tagline:"An empty site with one page",thumbnail:"",title:""}),e}function TD(){let e=p(),t=OO(Ge.directory),r=cM(ym());return{agentPrompt:$l,aiNaming:r.aiNaming,body:kD(),breakpointCount:r.breakpointCount,breakpointHint:r.breakpointHint,breakpointMode:r.breakpointMode,breakpointModes:r.breakpointModes,breakpointRounding:r.breakpointRounding,breakpointWidths:r.breakpointWidths,browseLabel:t.browseLabel,browsing:t.browsing,canBrowse:t.canBrowse,canVerify:r.canVerify,cards:i8(),confirmLabel:a8(),contextLabel:XK(),depth:r.depth,destination:t.destination,destinationError:t.error,error:Nn,errorInstallUrl:lw,gateIntro:o8(),headline:En==="source"?"Choose a starting point":"Name your project",importError:r.error,importPrompt:r.prompt,maxBreakpoints:r.maxBreakpoints,maxDepth:r.maxDepth,maxPages:r.maxPages,minFidelity:r.minFidelity,name:Ge.name,nameError:Oo,note:pt==="import"?"The assistant runs the import and reports as it goes — this dialog closes as soon as it starts.":"The site's address, deployment target and design tokens are project settings — set them from Settings once the project is open.",owner:t.owner,owners:t.owners,parent:t.parent,parentPlaceholder:t.parentPlaceholder,preview:t.preview,previewLabel:t.previewLabel,repoTaken:t.repoTaken,roundings:r.roundings,secondaryLabel:En==="params"?"Back":"",showTabs:En==="source",slug:Ge.directory,slugLabel:t.slugLabel,tab:pt,tabs:[{label:"Starters",value:"starter"},...e.importSite?[{label:"Import",value:"import"}]:[],{label:"Agent",value:"agent"}],url:r.url,verify:r.verify,visibilities:[{label:"Private",value:"private"},{label:"Public",value:"public"}],visibility:t.visibility}}var GM=["starter","import","agent"];function s8(){return[{args:{additionalProperties:!1,properties:{tab:pi(GM,"Which source tab to open on. Defaults to Starters.")},required:[],type:"object"},category:"Project",id:"project.new",level:"application",menus:["commandbar/overflow","palette"],group:"1_file",run:(e,t)=>{let r=t.tab===void 0?void 0:qn("project.new",t,"tab",GM);dw(r===void 0?{}:{tab:r})},title:"New Project…"}]}function PD(e){e.registerAll(s8())}var ED={$schema:"https://jxsuite.com/schema/v1",$id:"StudioSeo",$description:"Search appearance: two rendered previews of the merged site → layout → page `$head`, the resolved fields with their counters and provenance chips, the named warnings, and the page and Open Graph meta rows that change them. A `jx-dialog`, so the platform owns modality, Escape, focus restoration and the backdrop — which is what retired the fixed card, its `z-index: 1000` and the hand-drawn close button the old `.seo-modal` needed to be a modal at all. There is deliberately no score anywhere in this document: a number out of a hundred aggregates unrelated facts into a verdict, and a verdict is what gets optimised (studio-ui-guidelines.md §9.2, §14). Nothing here knows what a donor is, which head layer supplied a value or when a field is over budget — `panels/seo-modal.ts` resolves all of that and hands over strings, flags and one discriminant per branch.",tagName:"jx-dialog",$props:{headline:"Search appearance",confirmLabel:"",cancelLabel:"Close",dismissible:!0,size:"lg"},attributes:{part:"seo"},oncancel:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},onclose:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},style:{$description:'Thirty-one rules become the parts below — the seven `.seo-modal*` in `styles/overlays.css` and the twenty-four `.seo-*` in `styles/panels.css` — and three of them do not travel. `.seo-modal` was a fixed card with its own width, backdrop shadow, radius, border and `z-index: 1000`, and a modal `<dialog>` is every one of those; `.seo-modal-body` was a scroll box `jx-dialog` already provides; and `.seo-modal-body .seo-previews` existed only to cancel the padding that box added. The header the surface drew by hand goes with them, but its two rules stay in the stylesheet rather than moving here: `.settings-modal-header` and `.settings-modal-title` have another writer in `panels/data-grid.ts`, and what draws the heading now is the kit\'s `[part="headline"]`. Every `--spectrum-font-size-*` reference is gone, and that is a repair rather than a rename: those names resolve only inside `<sp-theme>`, and a document mounted in the dialog layer is outside it, so all fourteen would silently have taken their hard-coded fallback. The one size left in pixels is the search-result title, which is above the chrome scale on purpose — it is a picture of what a search engine prints, not a label in this application.','& [part="doc"]':{$description:"WHICH document this is about. A modal covers the tab strip, so it has to say so itself, and every field below resolves through this document's layout and site head. `direction: rtl` truncates a long path from the LEFT, because the file name is the half that identifies it.",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",direction:"rtl",textAlign:"left",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"},'& [part="previews"]':{display:"flex",flexWrap:"wrap",gap:"var(--jx-space-3)",padding:"var(--jx-space-3) 0"},'& [part="card"]':{$description:"The two cards want different floors before they wrap: the result row is text and reads badly narrow, the social card is a fixed-height image with two lines under it. Below ~700px they wrap and the dialog is a tall column.",flex:"1 1 220px",minWidth:"0",margin:"0",padding:"var(--jx-space-3)",border:"1px solid var(--border)",borderRadius:"var(--radius)",background:"var(--bg)"},'& [part="card"][data-card="serp"]':{flexBasis:"260px"},'& [part="card"][data-card="social"]':{flexBasis:"200px"},'& [part="card-label"]':{display:"block",paddingBottom:"var(--jx-space-3)",fontSize:"var(--jx-text-sm)",fontWeight:"700",letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--fg-dim)"},'& [part="serp-url"]':{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="serp-title"]':{$description:"The largest thing in the card, and the one size here that is not on the chrome's scale: a search result's headline is drawn at the proportions a search engine draws it, because the card is a picture rather than a form. Clamped to two lines rather than truncated at a character count — where a given engine cuts is its business, and the counter beside the field is what states the budget.",overflow:"hidden",display:"-webkit-box","-webkit-box-orient":"vertical","-webkit-line-clamp":"2",lineClamp:"2",padding:"var(--jx-space-1) 0",fontSize:"16px",color:"var(--accent)"},'& [part="serp-desc"]':{overflow:"hidden",display:"-webkit-box","-webkit-box-orient":"vertical","-webkit-line-clamp":"2",lineClamp:"2",fontSize:"var(--jx-text-md)",color:"var(--fg)"},'& [part="social-media"]':{display:"flex",alignItems:"center",justifyContent:"center",height:"96px",overflow:"hidden",border:"1px solid var(--border)",borderRadius:"var(--radius)",background:"var(--bg-panel)"},'& [part="social-image"]':{width:"100%",height:"100%",objectFit:"cover"},'& [part="social-text"]':{display:"flex",flexDirection:"column",gap:"1px",paddingTop:"var(--jx-space-3)"},'& [part="social-domain"]':{fontSize:"var(--jx-text-sm)",textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--fg-dim)"},'& [part="social-title"]':{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"var(--jx-text-md)",fontWeight:"700",color:"var(--fg)"},'& [part="social-desc"]':{overflow:"hidden",display:"-webkit-box","-webkit-box-orient":"vertical","-webkit-line-clamp":"2",lineClamp:"2",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="unset"]':{$description:"Absence, said once and in one colour, wherever a preview has nothing to draw.",fontStyle:"italic",color:"var(--fg-dim)"},'& [part="fields"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-1)",margin:"0",padding:"0 0 var(--jx-space-3)",listStyle:"none"},'& [part="field"]':{display:"flex",alignItems:"baseline",gap:"var(--jx-space-3)",minWidth:"0",fontSize:"var(--jx-text-sm)"},'& [part="field-label"]':{flex:"0 0 96px",color:"var(--fg-dim)"},'& [part="field-value"]':{flex:"1",minWidth:"0",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--fg)"},'& [part="count"]':{$description:"The counter is a reference line, not a verdict — over budget is stated, never scored, and `data-over` is the whole of what the `.seo-field-count--over` modifier used to say.",flex:"0 0 auto",fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums",color:"var(--fg-dim)","&[data-over]":{color:"var(--warning)"}},'& [part="chip"]':{$description:"The provenance vocabulary of `panels/provenance.ts` (§6.7), drawn by this document rather than borrowed as a class: `set` keeps the accent dot it has always been, `inherited` is an amber pill naming its donor, and a field nothing supplies gets no chip at all — because a ghost dot on every unset row says less than silence. The two chips that can go somewhere are `<button>`s; the ones with nowhere to go are not, which is §6.7's rule that a control which looks pressable and does nothing is a defect.",flexShrink:"0"},'& jx-dot[part="chip"][data-state="set"]':{background:"var(--accent)"},'& [part="chip"][data-state="inherited"]':{display:"inline-flex",alignItems:"center",maxWidth:"14ch",overflow:"hidden",padding:"0 5px",border:"1px solid currentcolor",borderRadius:"var(--radius)",background:"transparent",font:"inherit",fontSize:"var(--jx-text-xs)",lineHeight:"14px",whiteSpace:"nowrap",textOverflow:"ellipsis",cursor:"default",color:"var(--warning)"},'& button[part="chip"]':{cursor:"pointer","&:hover, &:focus-visible":{background:"var(--hover-bg)"}},'& [part="warnings"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-2)",margin:"0",padding:"0 0 var(--jx-space-3)",listStyle:"none"},'& [part="warning"]':{display:"flex",gap:"var(--jx-space-3)",minWidth:"0",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="warning-field"]':{flex:"0 0 auto",fontFamily:"var(--font-mono)",color:"var(--warning)"},'& [part="empty"]':{$description:"A fully-described page says so rather than printing an empty list.",margin:"0",padding:"0 0 var(--jx-space-3)",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"},'& [part="group"]':{$description:'GROUPED, because the two sets collide by name: Open Graph has its own Title, Description and Image, and eight unlabelled rows in one column made "Description" mean two things. Each group is headed by the preview card it feeds, so a row and the picture it changes are nameable together.',marginTop:"var(--jx-space-4)",paddingTop:"var(--jx-space-3)",borderTop:"1px solid var(--border)"},'& [part="group-title"]':{margin:"0 0 var(--jx-space-1)",fontSize:"var(--jx-text-sm)",fontWeight:"600",textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--fg-dim)"},'& [part="group-note"]':{margin:"0 0 var(--jx-space-3)",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="row"]':{padding:"var(--jx-space-2) 0"},'& [part="row-body"]':{$description:"Every row wraps its control in one box, media row or not, so the thumbnail and the two media buttons have somewhere to sit and a text row is laid out by the same rule. It is also what keeps `jx-field` from naming the control: the row names a `div`, which observes no naming, and each `jx-textfield` carries the label as its own accessible name instead.",display:"flex",alignItems:"center",gap:"var(--jx-space-2)",minWidth:"0"},'& [part="entry"]':{flex:"1",minWidth:"0"},'& [part="thumb"]':{flex:"none",width:"24px",height:"24px",objectFit:"cover",borderRadius:"var(--jx-radius-xs)",border:"1px solid var(--border)"}},children:[{tagName:"div",attributes:{part:"doc",title:"${state.documentLabel}"},textContent:"${state.documentLabel}"},{tagName:"div",attributes:{part:"previews"},children:[{tagName:"figure",attributes:{part:"card","data-card":"serp","aria-label":"Search result preview"},children:[{tagName:"figcaption",attributes:{part:"card-label"},textContent:"Search result"},{tagName:"div",attributes:{part:"serp-url"},textContent:"${state.serpCrumb}"},{tagName:"div",attributes:{part:"serp-title"},textContent:"${state.serpTitle}"},{tagName:"div",attributes:{part:"serp-desc"},$switch:{$ref:"#/state/serpDescState"},cases:{text:{tagName:"span",textContent:"${state.serpDesc}"},unset:{tagName:"span",attributes:{part:"unset"},textContent:"${state.serpDescUnset}"}}}]},{tagName:"figure",attributes:{part:"card","data-card":"social","aria-label":"Social card preview"},children:[{tagName:"figcaption",attributes:{part:"card-label"},textContent:"Social card"},{tagName:"div",attributes:{part:"social-media"},$switch:{$ref:"#/state/socialImageState"},cases:{image:{tagName:"img",attributes:{part:"social-image",src:"${state.socialImage}",alt:""}},unset:{tagName:"span",attributes:{part:"unset"},textContent:"No image"}}},{tagName:"div",attributes:{part:"social-text"},children:[{tagName:"span",attributes:{part:"social-domain"},$switch:{$ref:"#/state/socialDomainState"},cases:{text:{tagName:"span",textContent:"${state.socialDomain}"},unset:{tagName:"span",attributes:{part:"unset"},textContent:"No site URL"}}},{tagName:"span",attributes:{part:"social-title"},$switch:{$ref:"#/state/socialTitleState"},cases:{text:{tagName:"span",textContent:"${state.socialTitle}"},unset:{tagName:"span",attributes:{part:"unset"},textContent:"${state.socialTitleUnset}"}}},{tagName:"span",attributes:{part:"social-desc"},$switch:{$ref:"#/state/socialDescState"},cases:{text:{tagName:"span",textContent:"${state.socialDesc}"},unset:{tagName:"span",attributes:{part:"unset"},textContent:"${state.socialDescUnset}"}}}]}]}]},{tagName:"ul",attributes:{part:"fields","aria-label":"Resolved head fields"},children:[{$prototype:"Array",items:{$ref:"#/state/fields"},key:{$ref:"$map/item/key"},map:{tagName:"li",attributes:{part:"field","data-seo-field":"${$map.item.key}"},children:[{tagName:"span",attributes:{part:"field-label"},textContent:"${$map.item.label}"},{tagName:"span",attributes:{part:"field-value",title:"${$map.item.value}"},$switch:{$ref:"$map/item/valueState"},cases:{text:{tagName:"span",textContent:"${$map.item.value}"},unset:{tagName:"span",attributes:{part:"unset"},textContent:"${$map.item.unsetLabel}"}}},{tagName:"span",attributes:{part:"count-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/counted"},cases:{true:{tagName:"span",attributes:{part:"count","data-over":"${$map.item.over ? '' : null}"},textContent:"${$map.item.count}"}}},{tagName:"span",attributes:{part:"chip-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/chipKind"},cases:{dot:{tagName:"jx-dot",attributes:{part:"chip","data-state":"set",title:"${$map.item.chipTitle}"}},static:{tagName:"span",attributes:{part:"chip","data-state":"inherited",title:"${$map.item.chipTitle}"},textContent:"${$map.item.chipText}"},link:{tagName:"button",attributes:{part:"chip","data-state":"inherited",type:"button",title:"${$map.item.chipTitle}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openDonor"},value:[{$ref:"$map/item/key"}]}]},textContent:"${$map.item.chipText}"}}}]}}]},{tagName:"div",attributes:{part:"warnings-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/warningsState"},cases:{none:{tagName:"p",attributes:{part:"empty"},textContent:"Nothing to flag — every previewed field resolves to a value."},list:{tagName:"ul",attributes:{part:"warnings","aria-label":"Search appearance warnings"},children:[{$prototype:"Array",items:{$ref:"#/state/warnings"},key:{$ref:"$map/item/id"},map:{tagName:"li",attributes:{part:"warning","data-seo-warning":"${$map.item.id}"},children:[{tagName:"code",attributes:{part:"warning-field"},textContent:"${$map.item.field}"},{tagName:"span",textContent:"${$map.item.message}"}]}}]}}},{$prototype:"Array",$description:'The form, split by the preview card each half feeds. GROUPED, because the two sets collide by name: Open Graph has its own Title, Description and Image, and eight unlabelled rows in one column made "Description" mean two things. The groups are a projection like everything else here, so the two headings and the one note are data rather than a second copy of the row template — the row below is written once and both groups render it.',items:{$ref:"#/state/groups"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"group","data-group":"${$map.item.key}"},children:[{tagName:"h3",attributes:{part:"group-title"},textContent:"${$map.item.title}"},{tagName:"div",attributes:{part:"note-slot",role:"none"},style:{display:"contents"},$description:`No fallback is promised in the Social card's note, because the build emits none: the warning list above says an unset og:title means "a shared link carries no headline of its own", and a note claiming otherwise would contradict the app two inches higher.`,$switch:{$ref:"$map/item/hasNote"},cases:{true:{tagName:"p",attributes:{part:"group-note"},textContent:"${$map.item.note}"}}},{$prototype:"Array",items:{$ref:"$map/item/rows"},key:{$ref:"$map/item/key"},map:{$description:"One editable head field, whatever kind it is. The label, the naming of the control and the announced refusal are the kit's; the clear affordance is `jx-textfield`'s own `clearable`, which is what the row's set dot used to be — a control that empties the field, drawn only while there is something to empty. Committing an empty value is what removes the `$head` entry, so clearing and typing nothing are one path rather than two.",tagName:"jx-field",attributes:{part:"row","data-prop":"${$map.item.key}"},$props:{label:{$ref:"$map/item/label"},span:!0},children:[{tagName:"div",attributes:{part:"row-body"},children:[{tagName:"span",attributes:{part:"thumb-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasThumb"},cases:{true:{tagName:"img",attributes:{part:"thumb",src:"${$map.item.thumb}",alt:""}}}},{tagName:"jx-textfield",attributes:{part:"entry"},$props:{label:{$ref:"$map/item/label"},value:{$ref:"$map/item/value"},placeholder:{$ref:"$map/item/placeholder"},multiline:{$ref:"$map/item/multiline"},clearable:!0,size:"sm"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/edit"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/commit"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},{tagName:"span",attributes:{part:"media-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/isMedia"},cases:{true:{tagName:"span",attributes:{part:"media-actions",role:"none"},style:{display:"contents"},children:[{tagName:"jx-action-button",attributes:{part:"upload"},$props:{icon:"upload-simple",label:"Upload media",size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/upload"},value:[{$ref:"$map/item/key"}]}]}},{tagName:"jx-action-button",attributes:{part:"browse"},$description:"Browse opens a kit menu of the project's media, and it has to be a kit one: a modal `<dialog>` is in the top layer, so an overlay drawn into a layer div — which is what `ui/media-picker.ts`'s Spectrum popover is — paints underneath the dialog that opened it and is inert besides. `specs/ui.md` §7 is the rule this follows.",$props:{icon:"image",label:"Browse media",size:"sm",haspopup:"menu"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/browse"},value:[{$ref:"$map/item/key"},{$ref:"event#/currentTarget"}]}]}}]}}}]}]}}]}}]};E("seo",ED);function Sl(e){return e.trim()===""?"unset":"text"}function jD(e){return{documentLabel:e.documentLabel,fields:e.fields.map((t)=>({...t,valueState:Sl(t.value)})),groups:e.groups.map((t)=>({hasNote:t.note!=="",key:t.key,note:t.note,rows:t.rows.map((r)=>({...r,hasThumb:r.thumb!==""})),title:t.title})),serpCrumb:e.crumb,serpDesc:e.description,serpDescState:Sl(e.description),serpDescUnset:e.descriptionUnset,serpTitle:e.title,socialDesc:e.socialDescription,socialDescState:Sl(e.socialDescription),socialDescUnset:e.socialDescriptionUnset,socialDomain:e.domain,socialDomainState:Sl(e.domain),socialImage:e.image,socialImageState:e.image===""?"unset":"image",socialTitle:e.socialTitle,socialTitleState:Sl(e.socialTitle),socialTitleUnset:e.socialTitleUnset,warnings:e.warnings,warningsState:e.warnings.length>0?"list":"none"}}function ID(e){let t=document.createElement("div");t.style.pointerEvents="auto",e.layer.append(t);let r=!1,o=()=>{if(r)return;r=!0,e.onClosed()},a=g({...jD(e.view),browse:(f,c)=>{if(c instanceof HTMLElement)e.onBrowse(f,c)},closed:o,commit:(f,c)=>{e.onCommit(f,c)},edit:(f,c)=>{e.onEdit(f,c)},openDonor:(f)=>{e.onOpenDonor(f)},upload:(f)=>{e.onUpload(f)}}),i=()=>r,s=null,l=R("seo",a,t).then(async(f)=>{s=f;let c=f.root;if(i())return f.dispose(),c;if(await sn(c),i())return c;return(c.querySelector('dialog[part="dialog"]')??c).setAttribute(Ve,vt("dialog","seo")),Jt(c),c});return{close(){let f=s?.root;if(f instanceof HTMLElement)Ut(f);s?.dispose(),s=null,t.remove(),o()},host:t,ready:l,update(f){Object.assign(a,jD(f))}}}function zD(e){let t=(r)=>()=>{ae()?.run("settings.open",{section:r})};switch(e.source){case"page":return{state:"set",title:`${e.label} is set on this page`};case"layout":{let r=e.donor??"the layout";return{donor:r,state:"inherited",title:`${e.label} comes from the ${r} layout — this page does not set it`}}case"site":{let r=e.donor==="Site name";return{donor:e.donor??"the site",onClick:t(r?"overview":"head"),state:"inherited",title:`${e.label} comes from ${r?"the project's name":"the site-level $head"} — click to open it`}}case"build":return{donor:"the build",state:"inherited",title:`Nothing declares ${e.label}, so the build supplies “${e.value}”`};default:return{state:"default"}}}function vm(e){return`No ${e.label.toLowerCase()}`}function c8(e){let t=wE(e.value),r=zD(e),o=r.state==="inherited";return{chipKind:r.state==="default"?"none":r.state==="set"?"dot":r.onClick?"link":"static",chipText:o?`from ${r.donor??"the cascade"}`:"",chipTitle:fm(e.key,r),count:e.limit===null?"":`${t}/${e.limit}`,counted:e.limit!==null,key:e.key,label:e.label,over:e.limit!==null&&t>e.limit,unsetLabel:vm(e),value:e.value}}var HD=new Map([...nw,...iw].map((e)=>[e.key,e])),BD="icon";function d8(e,t,r){if(e==="viewport")return"width=device-width, initial-scale=1";return r?"/image.jpg":`${t}…`}function pw(e,t,r,o={}){let a=Boolean(o.media);return{isMedia:a,key:e,label:t,multiline:Boolean(o.multiline),placeholder:d8(e,t,a),thumb:a&&r?Xc(r):"",value:r}}function LD(e,t){let r=HD.get(t);if(!r)return"";return String(ow(e,r.attr,r.key)?.attributes?.content??"")}function p8(e,t,r){let o=t.trim();if(e===BD){r((i)=>U_(i,"icon",o));return}if(e==="description"){r((i)=>V_(i,o));return}let a=HD.get(e);if(!a)return;r((i)=>rw(i,a.attr,a.key,o))}var La=new Map;function hw(e){if(e===void 0){for(let r of La.values())clearTimeout(r);La.clear();return}let t=La.get(e);if(t!==void 0)clearTimeout(t),La.delete(e)}var Oa=null,Mo=null,wm=new Map;function gw(e){let t=e.doc.mode==="content",r=t?q_(e.doc.document,e.doc.content.frontmatter):e.doc.document;return{applyMutation:t?(o)=>_E(e,Cl,o):(o)=>{Yd(e,o)},head:r.$head??[],headDoc:r}}function GD(e,t,r){let o=xE(e,t),a=lb(o,"description"),i=lb(o,"og:title"),s=lb(o,"og:description"),l=lb(o,"og:image").value.trim(),f=String(yE(r,"icon")?.attributes?.href??"");wm=new Map;for(let c of o.fields){let{onClick:d}=zD(c);if(d)wm.set(c.key,d)}return{crumb:o.url.crumb,description:a.value,descriptionUnset:vm(a),documentLabel:e.documentPath??$d(e),domain:o.url.host,fields:o.fields.map(c8),groups:[{key:"page",note:"",rows:[...nw.map((c)=>pw(c.key,c.label,c.key==="description"?vE(t):LD(r,c.key),{multiline:c.multiline})),pw(BD,"Icon",f,{media:!0})],title:"Search result"},{key:"og",note:"Open Graph — what a shared link shows.",rows:iw.map((c)=>pw(c.key,c.label,LD(r,c.key),{media:c.media,multiline:c.multiline})),title:"Social card"}],image:l?Xc(l):"",socialDescription:s.value,socialDescriptionUnset:vm(s),socialTitle:i.value,socialTitleUnset:vm(i),title:lb(o,"title").value,warnings:o.warnings}}function Cl(){if(!Oa||!Mo)return;let{head:e,headDoc:t}=gw(Mo);Oa.update(GD(Mo,t,e))}function Cm(e,t){if(hw(e),!Mo)return;p8(e,t,gw(Mo).applyMutation),Cl()}function u8(e){TS((t)=>Cm(e,t))}function m8(e,t){ES(t,(r)=>Cm(e,r),{images:!0})}function f8(e){if(Mo=e,!Oa){let{head:t,headDoc:r}=gw(e);Oa=ID({layer:dt("dialog"),onBrowse:m8,onClosed:h8,onCommit:Cm,onEdit:(o,a)=>{hw(o),La.set(o,setTimeout(()=>{La.delete(o),Cm(o,a)},d1))},onOpenDonor:(o)=>{wm.get(o)?.()},onUpload:u8,view:GD(e,r,t)})}Cl(),CD(xE(e,e.doc.document),e.documentPath??void 0)}function h8(){hw();let e=Oa;Oa=null,Mo=null,wm=new Map,e?.close()}function g8(){return[{category:"Document",id:"document.openSeo",level:"document",menus:["palette"],group:"2_document",requires:"an open document",when:(e)=>e.document.open,run:()=>{let e=h.value;if(!e)throw RangeError('command "document.openSeo" needs an open document');f8(e)},title:"Search Appearance"}]}function eF(e){e.registerAll(g8())}var b8="See docs/framework/concepts/accessibility.";function Ha(e,t){let r=sd(e),o=t in r?r[t]:e[t];if(o===void 0||o===null)return{kind:"absent"};if(Pe(o)||v(o))return{kind:"bound"};if(n(o))return o.includes("${")?{kind:"bound"}:{kind:"text",text:o};return{isTrue:o===!0,kind:"other"}}function Fa(e,t){let r=Ha(e,t);return r.kind==="text"&&r.text.trim()!==""?r.text:null}function Ke(e,t){return Ha(e,t).kind!=="absent"}var za="bound";function Pr(e){let t=Ha(e,"role");if(t.kind==="bound")return za;return t.kind==="text"?t.text.trim().toLowerCase().split(/\s+/)[0]:null}function Tm(e){let t=Ha(e,"id");if(t.kind==="bound")return za;return t.kind==="text"&&t.text!==""?t.text:null}function Nt(e,t){let r=Ha(e,t);return r.kind==="bound"||r.kind==="text"&&r.text.trim()!==""}function Mm(e){let t=e.textContent;if(n(t)){if(t.trim()!=="")return!0}else if(t!==void 0&&t!==null)return!0;if(Nt(e,"aria-label")||Ke(e,"aria-labelledby"))return!0;if(Lo(e)==="img"&&(Nt(e,"alt")||Nt(e,"title")))return!0;if(Lo(e)==="slot")return!0;let{children:r}=e;if(Array.isArray(r)){for(let a of r)if(n(a)){if(a.trim()!=="")return!0}else if(_(a)&&Mm(a))return!0}else if(r!=null)return!0;if(v(e.map))return!0;return(v(e.cases)?Object.values(e.cases):[]).some((a)=>Jn(a)&&Mm(a))}var y8=new Set(["button","checkbox","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","switch","tab","treeitem"]),v8=new Set(["combobox","listbox","searchbox","slider","spinbutton","textbox"]),w8=new Set(["button","reset","submit"]),nF=new Map([["menuitem",["menu","menubar"]],["menuitemcheckbox",["menu","menubar"]],["menuitemradio",["menu","menubar"]],["option",["listbox"]],["tab",["tablist"]]]),x8=new Set([...nF.values()].flat());function*Ma(e,t=[],r=[],o=[]){yield{node:e,path:t,roles:r,tags:o};let a=[...r,Pr(e)],i=[...o,Lo(e)],{children:s}=e;if(Array.isArray(s)){for(let[l,f]of s.entries())if(_(f))yield*Ma(f,[...t,"children",l],a,i)}else if(v(s)&&Jn(s.map))yield*Ma(s.map,[...t,"children","map"],a,i);if(Jn(e.map))yield*Ma(e.map,[...t,"map"],a,i);if(v(e.cases)){for(let[l,f]of Object.entries(e.cases))if(_(f))yield*Ma(f,[...t,"cases",l],a,i)}}function k8(e){return e.some((t)=>t.includes("-"))}function dn(e,t,r,o,a,i="error"){return{criterion:a,detail:`${o} ${b8}`,message:r,path:t,rule:e,severity:i}}function tF(e,t,r){if(r.includes("label"))return!0;if(e===za||t.bound)return!0;return e!==null&&t.ids.has(e)}function $8(e,t){let{node:r,path:o,tags:a}=e,i=Lo(r),s=Pr(r);if(s==="bound")return null;if(Nt(r,"aria-label")||Ke(r,"aria-labelledby")||Nt(r,"title"))return null;let f=Rs(r,"the control"),c=(b)=>dn("interactive-unnamed",o,`${f} has no accessible name.`,`A control with no name is announced as its role alone, so a reader hears "button" and nothing else. ${b}`,"4.1.2"),d=S8(r,i,t,a);if(d==="named"||d==="exempt")return null;if(s!==null&&y8.has(s))return Mm(r)?null:c("Give it text content, or an aria-label.");if(s!==null&&v8.has(s))return c("Give it an aria-label, or aria-labelledby naming its visible label.");if(s!==null)return null;if(i==="button"||i==="summary"||i==="a"&&Ke(r,"href"))return Mm(r)?null:c("Give it text content, or an aria-label.");if(d==="unnamed")return c("Give it a <label for> naming its id, or an aria-label.");if(d==="unnamed-value")return c("Give it a value, or an aria-label.");if(d==="unnamed-alt")return c("Give it an alt, or an aria-label.");return null}function S8(e,t,r,o){if(t==="area"){if(!Ke(e,"href"))return"none";return Nt(e,"alt")?"named":"unnamed-alt"}if(t==="select"||t==="textarea")return tF(Tm(e),r,o)||Nt(e,"placeholder")?"named":"unnamed";if(t!=="input")return"none";let a=(Fa(e,"type")??"text").toLowerCase();if(a==="hidden"||Ke(e,"type")&&Fa(e,"type")===null)return"exempt";if(w8.has(a))return Nt(e,"value")?"named":"unnamed-value";if(a==="image")return Nt(e,"alt")?"named":"unnamed-alt";return tF(Tm(e),r,o)||Nt(e,"placeholder")?"named":"unnamed"}var C8=new Set(["select","jx-select"]);function T8(e){let{node:t,path:r,tags:o}=e,a=Lo(t);if(!a.includes("-")||!o.some((i)=>C8.has(i)))return null;return dn("custom-element-in-select",r,`<${a}> is a custom element inside a <select>.`,'A <select> builds its own rows: an element it does not know is not in select.options, so it cannot be picked, cannot be reached with the arrow keys, and fires no change event — while role="option" on it still makes the accessibility tree read as though it could. Every row of a <select> is a native <option>; a listbox whose rows are jx-option elements is a jx-listbox.',"4.1.2")}function P8(e){let{node:t,path:r}=e;if(Lo(t)!=="img")return null;let o=Pr(t);if(o==="bound"||o==="presentation"||o==="none")return null;if(Ke(t,"alt")||Nt(t,"aria-label")||Ke(t,"aria-labelledby"))return null;return dn("img-alt-missing",r,`${Rs(t,"the image")} has no alt text.`,'An image with no alt is announced by its file name. Describe it in alt, or write alt="" for a decorative one.',"1.1.1")}var E8=["aria-activedescendant","aria-controls","aria-describedby","aria-details","aria-errormessage","aria-flowto","aria-labelledby","aria-owns"];function N8(e,t){let{node:r,path:o}=e,a=[];for(let i of E8){let s=Fa(r,i);if(s===null)continue;for(let l of s.split(/\s+/))if(l!==""&&!t.has(l))a.push(dn("aria-target-missing",o,`${Rs(r,"the element")} points ${i} at #${l}, which nothing in this document has as its id.`,"A reference to an id that is not in the document is silently dropped, so the relationship it declares does not exist. Name an element that is here, or give that element the id.","1.3.1"))}return a}function j8(e,t,r){for(let o of nF.get(t)??[]){let a=r.get(o);if(a===void 0)continue;if(a.bound)return!0;if(e===za&&a.ids.size>0)return!0;if(e!==null&&e!==za&&a.ids.has(e))return!0}return!1}function R8(e,t){let{node:r,path:o,roles:a,tags:i}=e,s=Pr(r);if(s===null||s==="bound"||o.length===0||k8(i))return null;if(a.includes("bound")||j8(Tm(r),s,t))return null;let l=Rs(r,"the element");if(s==="tab"&&!a.includes("tablist"))return dn("tab-outside-tablist",o,`${l} is a tab outside any tablist.`,'A tab is announced with its position in a tablist, so one with no tablist ancestor has no place to be counted in. Put the tabs in a container with role="tablist".',"1.3.1");if((s==="menuitem"||s==="menuitemcheckbox"||s==="menuitemradio")&&!a.includes("menu")&&!a.includes("menubar"))return dn("menuitem-outside-menu",o,`${l} is a ${s} outside any menu.`,'A menu item is owned by a menu, and is announced as one of its items. Put it in a container with role="menu" or role="menubar".',"1.3.1");if(s==="option"&&!a.includes("listbox")&&!i.includes("select")&&!i.includes("datalist"))return dn("option-outside-listbox",o,`${l} is an option outside any listbox.`,'An option is owned by a listbox, and is announced as one of its choices. Put it in a container with role="listbox", or in a <select>.',"1.3.1");return null}function A8(e){let t=[];for(let{node:r}of Ma(e)){if(Pr(r)!=="tab")continue;let o=Ha(r,"aria-selected");if(o.kind==="bound")return null;t.push(o.kind==="other"&&o.isTrue||o.kind==="text"&&o.text==="true")}return t}function I8(e){let{node:t,path:r}=e;if(Pr(t)!=="tablist")return null;let o=A8(t);if(o===null||o.length===0||o.includes(!0))return null;return dn("tablist-none-selected",r,`${Rs(t,"the tablist")} has ${o.length} tab(s) and none is selected.`,'A tablist always has a current tab, and aria-selected="true" is how it is announced. Mark the tab whose panel is showing.',"4.1.2","warn")}function L8(e){let{node:t,path:r}=e,o=Pr(t);if(!(Lo(t)==="dialog"||o==="dialog"||o==="alertdialog")||o==="bound")return null;if(Nt(t,"aria-label")||Ke(t,"aria-labelledby"))return null;return dn("dialog-unnamed",r,`${Rs(t,"the dialog")} has no accessible name.`,"A dialog is announced by its name when it opens, and its content does not name it. Give it aria-labelledby naming its heading, or an aria-label.","4.1.2")}var O8=new Set(["button","input","select","textarea"]);function M8(e){let{node:t,path:r}=e;if(!Ke(t,"aria-activedescendant"))return null;let o=Lo(t);if(O8.has(o)||o==="a"&&Ke(t,"href")||Ke(t,"tabIndex")||Ke(t,"tabindex")||Ke(t,"contenteditable"))return null;return dn("activedescendant-not-focusable",r,`${Rs(t,"the element")} manages focus with aria-activedescendant but cannot itself take focus.`,"aria-activedescendant names the active child of a FOCUSED container; on one that cannot be focused, the keyboard never reaches it. Give the container a tabindex.","2.1.1")}function rF(e){let t=[...Ma(e)],r=new Set,o={bound:!1,ids:new Set},a=new Map,i=!1;for(let{node:l}of t){let f=Pr(l);if(f!==null&&x8.has(f)){let d=a.get(f)??{bound:!1,ids:new Set},b=Fa(l,"aria-owns");if(b===null)d.bound||=Ke(l,"aria-owns");else for(let y of b.split(/\s+/))if(y!=="")d.ids.add(y);a.set(f,d)}let c=Tm(l);if(c===za)i=!0;else if(c!==null)r.add(c);if(Lo(l)==="label"){let d=Fa(l,"for")??Fa(l,"htmlFor");if(d===null)o.bound||=Ke(l,"for")||Ke(l,"htmlFor");else o.ids.add(d)}}let s=[];for(let l of t){let f=[$8(l,o),P8(l),R8(l,a),T8(l),I8(l),L8(l),M8(l)];for(let c of f)if(c)s.push(c);if(!i)s.push(...N8(l,r))}return s}function D8(e,t){if(t==="img"||t==="area")return!0;return t==="input"&&Er(e,"type")?.toLowerCase()==="image"}var F8=new Set(["input","select","textarea","button"]),_8=new Set(["button","hidden","image","reset","submit"]),z8=new Set(["click here","here","read more","more","learn more","this","link","download","continue"]);function oF(e){return e.attributes??{}}function Er(e,t){let r=oF(e)[t];return n(r)?r:null}function Tl(e,t){return t in oF(e)}function Pl(e){let t=[];if(n(e.textContent))t.push(e.textContent);let{children:r}=e;if(Array.isArray(r)){for(let o of r)if(n(o))t.push(o);else if(_(o))t.push(Pl(o))}return t.join(" ").trim()}function*yw(e){yield e;let{children:t}=e;if(Array.isArray(t)){for(let r of t)if(_(r))yield*yw(r)}for(let r of Object.values(e.cases??{}))if(_(r))yield*yw(r)}function H8(e){return Er(e,"aria-label")!==null||Er(e,"aria-labelledby")!==null||Tl(e,"aria-label")||Tl(e,"aria-labelledby")||n(e.title)&&e.title!==""||Pl(e)!==""}function B8(e){let t=[],r=new Map,o=0,a=0,i=0;for(let s of yw(e)){i+=1;let l=n(s.tagName)?s.tagName.toLowerCase():"",f=l===""?`element ${i}`:`<${l}>`;if(D8(s,l)){let d=Er(s,"alt");if(d!==null&&/^(image|photo|picture|graphic|icon)\b/i.test(d.trim()))t.push({criterion:"1.1.1",detail:'A screen reader already announces that it is an image, so "image of a cat" is heard as "image, image of a cat". Describe what it shows.',id:`img-alt-redundant:${i}`,message:`${f}'s alt text starts by saying it is an image.`,severity:"warn"})}let c=/^h([1-6])$/.exec(l)?.[1];if(c!==void 0){let d=Number(c);if(d===1){if(o+=1,o===2)t.push({criterion:"1.3.1",detail:"A page has one title, and readers who navigate by heading use the h1 to find it. "+"Two make the outline ambiguous — demote the second to an h2.",id:"multiple-h1",message:"This page has more than one top-level heading.",severity:"warn"})}if(a!==0&&d>a+1)t.push({criterion:"1.3.1",detail:`An h${a} is followed by an h${d}, so the outline has a hole in it. `+"Readers who navigate by heading use the levels as structure, not as sizes — style "+"the heading rather than skipping a level to get a smaller one.",id:`heading-skip:${i}`,message:`A heading level is skipped: h${a} to h${d}.`,severity:"warn"});a=d}if(F8.has(l)){let d=Er(s,"type")?.toLowerCase()??"",b=l==="button"||_8.has(d);if(l==="input"&&!b&&!Tl(s,"autocomplete")){let y=`${Er(s,"name")??""} ${Er(s,"id")??""}`.toLowerCase();if(/\b(email|name|tel|phone|address|postal|zip|country)\b/.test(y))t.push({criterion:"1.3.5",detail:"An autocomplete token lets a browser fill the field from the person's own stored details, which matters most for people who find typing costly.",id:`input-no-autocomplete:${i}`,message:`${f} asks for personal data but names no autocomplete purpose.`,severity:"warn"})}}if(l==="a"){let d=Pl(s).toLowerCase().replaceAll(/[^a-z ]/g,"").trim();if(H8(s)&&z8.has(d))t.push({criterion:"2.4.4",detail:"Readers who navigate by pulling up a list of a page's links see the text alone, with "+`no surrounding sentence — so a page of "${d}" is a list of identical entries.`,id:`link-vague:${i}`,message:`A link reads "${Pl(s)}", which names no destination.`,severity:"warn"});if(Er(s,"target")==="_blank"&&!/new (tab|window)/i.test(Pl(s)))t.push({criterion:"2.4.6",detail:"A link that replaces the page without warning is disorienting for anyone not watching the whole viewport. Say so in the text, or in the aria-label.",id:`link-new-window:${i}`,message:"A link opens in a new tab without saying so.",severity:"warn"})}if(Y(s.tabIndex)&&s.tabIndex>0)t.push({criterion:"1.3.1",detail:"A positive tabindex pulls the element out of document order and in front of every "+"element with tabindex 0 — on the whole page, not just this component. Reorder the "+"markup instead; 0 and -1 are the only values that compose.",id:`positive-tabindex:${i}`,message:`${f} has tabindex="${s.tabIndex}".`,severity:"error"});if(n(s.id)&&s.id!=="")if(r.get(s.id)!==void 0)t.push({criterion:"4.1.2",detail:"aria-labelledby, aria-controls and <label for> all resolve an id to the FIRST match, so a duplicate silently points half the references at the wrong element.",id:`duplicate-id:${s.id}`,message:`The id "${s.id}" is used more than once.`,severity:"error"});else r.set(s.id,i);if((l==="video"||l==="audio")&&Tl(s,"autoplay")&&!Tl(s,"controls"))t.push({criterion:"1.3.1",detail:"Media that starts by itself and cannot be stopped talks over a screen reader, which leaves a reader no way to hear the page at all.",id:`autoplay-no-controls:${i}`,message:`${f} plays automatically with no controls.`,severity:"error"})}if(!n(e.lang)||e.lang==="")t.push({criterion:"3.1.1",detail:"A screen reader picks its pronunciation rules from the page's language. Without one it "+"uses the reader's own, so French text is read with English phonetics — intelligible to "+"nobody.",id:"no-lang",message:"This document declares no language.",severity:"warn"});for(let s of rF(e))t.push({criterion:s.criterion,detail:s.detail,id:`${s.rule}:${s.path.join("/")}`,message:s.message,severity:s.severity});return V8(t)}function V8(e){let t=new Map;return e.map((r)=>{let o=t.get(r.id)??0;return t.set(r.id,o+1),o===0?r:{...r,id:`${r.id}#${o}`}})}function El(){return[{detail:"Contrast is between the colours that actually paint, which depends on the cascade, on "+"inherited values and on images behind text — none of which exist until the page is "+"built and rendered. Checking the declared values alone would pass a black-on-black page whose colours came from a class.",id:"contrast",message:"Colour contrast was not checked."},{detail:"Target size, focus order and reading order are all properties of the rendered layout. A document tree does not have a layout, so this run cannot see them.",id:"layout",message:"Target size and focus order were not checked."}]}var Nl="Accessibility";function W8(e,t){yl((o)=>o.source===Nl);let r=B8(e);for(let o of r){let a={detail:`WCAG ${o.criterion} — ${o.detail}`,key:`a11y.${o.id}`,source:Nl,tier:"problem"};if(o.action!==void 0)a.action=o.action;if(t!==void 0)a.path=t;w(o.severity,o.message,a)}for(let o of El())w.info(o.message,{action:"document.checkAccessibility",detail:o.detail,key:`a11y.unavailable.${o.id}`,source:Nl,tier:"problem"});return r.length+El().length}function q8(){return[{aiTool:{description:"Check the open document for accessibility problems an author can fix — missing alt "+"text, unlabelled controls, skipped heading levels, vague link text, duplicate ids — "+"and file each as a Problem naming its WCAG criterion. The findings come back as data.",name:"check_accessibility",report:()=>{let e=El().length,t=sf(Nl).filter((a)=>!a.key?.startsWith("a11y.unavailable.")),r=t.length,o=e===0?"":` ${e} check${e===1?"":"s"} could not run and ${e===1?"is":"are"} listed in Problems as such.`;return{data:t,summary:r===0?`No accessibility problems found in this document.${o}`:`Filed ${r} accessibility problem${r===1?"":"s"} in Problems.${o}`}}},category:"Document",group:"2_document",id:"document.checkAccessibility",level:"document",menus:["palette"],requires:"an open document",run:()=>{let e=h.value;if(!e)throw RangeError('command "document.checkAccessibility" needs an open document');let t=W8(e.doc.document,e.documentPath??void 0);w.success(t===El().length?"No accessibility problems found in this document.":`${t-El().length} accessibility problem(s) filed.`,{key:"a11y.run",source:Nl})},title:"Check Accessibility",when:(e)=>e.document.open}]}function iF(e){e.registerAll(q8())}function lF(e,t){return qp(e)&&!Gc[e].tabStrip&&ml(t)!==e}function U8(e,t,r=u.workspace){let o=pn(e);if(!o||!lF(r,t))return[];return o.tabOrder.filter((a)=>{let i=m.tabs.get(a);return a!==t&&i!==void 0&&ml(a)!==r&&sb(i)===r&&!i.pinned&&!i.doc.dirty&&!Cv(i)})}function J8(e,t=u.workspace){if(!qp(t)||Gc[t].tabStrip)return null;let r=$a(t);return pn(e)?.tabOrder.includes(r)===!0?r:null}function cF(e,t){for(let r of m.panes){if(r.id===t||r.derived)continue;let o=mE(r,e);if(o===r.activeTabId)continue;if(o)Ft(o,{focus:!1});else l1(r.id)}}function G8(){let e=u.workspace,t=m.activePaneId;for(let r of m.panes){let o=r.activeTabId;if(r.id===t||r.derived||!o||Nc(o,e))continue;Gr();try{let a=mE(r,e);if(a)Ft(a,{focus:!1});else l1(r.id)}finally{Kr()}}}function dF(e,t){let o=pn(e)?.tabOrder.find((a)=>m.tabs.get(a)?.documentPath===t);if(o&&!Nc(o))Ft(o)}function K8(){let e=h.value;return e?fE(e):!1}function pF(e){return{...e,writingOnCanvas:K8}}function Y8(e,t){if(e==="styles")return t.openStyles(),!0;if(qp(e))return t.openHome(e),!0;return!1}function uF(e,t){let r=_D(e);if(r)Ft(r);else Y8(e,t);VC(e,pF(t));let o=h.value,a=o&&Nc(o.id,e)?Da(o.id)?.id??null:null;cF(e,a)}var jl=null;function mF(e){if(jl)return sF;r1((a)=>Nc(a)),s1((a)=>X8(a,e)),a1((a)=>J8(a));let t=me();jl=t;let r=pF(e),o=null;return t.run(()=>{te(()=>{let s=h.value;if(!s)return;let l=sb(s),f=fE(s);Gr();try{let c=Da(s.id)?.id??null;if(c!==null)for(let d of U8(c,s.id,l))eu(d);if(VC(l,r)){if(cF(l,c),c!==null&&lF(l,s.id))e.placeHome?.(l,c)}else if(o!==null&&f!==o&&Gc[l].inspector.whileWriting===!0)ko("right",!W$(l,f))}finally{Kr()}o=f});let a=!1,i=te(G8,{scheduler:()=>{if(a)return;a=!0,queueMicrotask(()=>{if(a=!1,jl===t)i()})}})}),sF}function X8(e,t){let r=u.workspace,o=pn(e);if(!o||o.derived||Gc[r].tabStrip)return;if(r==="styles"){t.openStyles?.();return}if(!t.placeHome||!qp(r))return;t.placeHome(r,e),Ft($a(r))}function sF(){jl?.stop(),jl=null,r1(null),s1(null),a1(null)}var fF={$schema:"https://jxsuite.com/schema/v1",$id:"StudioAbout",$description:"The About dialog: the app's version and build metadata, its external links, and the resolved `@jxsuite/*` package versions. A `jx-dialog`, so the platform owns modality, Escape, focus restoration and the backdrop — which is what retired the `sp-underlay` this surface used to render itself, and with it the fixed-position box and scrolling body it drew by hand.",tagName:"jx-dialog",$props:{headline:{$ref:"#/state/headline"},confirmLabel:"",cancelLabel:"Close",size:"sm"},attributes:{part:"about"},oncancel:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/close"},value:[]}]},onclose:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},style:{$description:"The About dialog's own look. `.about-modal` and `.about-modal-body` are gone rather than moved: they positioned a fixed box, drew its panel and scrolled its body, and `jx-dialog` is all three — so converting this surface deleted two rules instead of transcribing them.",'& [part="meta"]':{margin:"0 0 16px",display:"flex",flexDirection:"column",gap:"6px"},'& [part="meta-row"]':{display:"flex",gap:"12px",fontSize:"13px"},'& [part="meta-label"]':{$description:"A fixed label column, so the values line up down the list rather than with each row's own text.",width:"96px",minWidth:"96px",margin:"0",color:"var(--fg-dim)"},'& [part="meta-value"]':{$description:"One of the two places in the chrome that opt back in to selection (`STYLING.md` §Text selection). The root sets `user-select: none` and `styles/tokens.json` restates it on every modal `dialog`, but this dialog's body IS its message: the version, the build date, the commit and the channel exist to be pasted into a bug report, and Studio offers no copy action for them.",margin:"0",color:"var(--fg)",wordBreak:"break-word",userSelect:"text"},'& [part="links"]':{display:"flex",gap:"16px",padding:"12px 0",marginBottom:"12px",borderTop:"1px solid var(--border)",borderBottom:"1px solid var(--border)"},'& [part="links"] a':{$description:"The accent, from the studio token layer. It read `--spectrum-accent-color-1000` with a hex fallback, which resolved only inside `<sp-theme>`; a document is mounted in the dialog layer, where that name is not in scope and every link would have fallen to the hex.",color:"var(--accent)",textDecoration:"none",":hover":{textDecoration:"underline"}},'& [part="section-title"]':{margin:"0 0 8px",fontSize:"13px",fontWeight:"600",color:"var(--fg)"},'& [part="muted"]':{margin:"0",fontSize:"13px",color:"var(--fg-dim)"},'& [part="packages"]':{listStyle:"none",margin:"0",padding:"0",display:"flex",flexDirection:"column",gap:"4px"},'& [part="package-row"]':{$description:"Selectable for the same reason `meta-value` is, and on the ROW rather than on the version alone: what a reader pastes is the pair, `@jxsuite/ai 0.37.0`, so a drag has to be able to cross from the name to the number and on down the list.",display:"flex",justifyContent:"space-between",gap:"12px",fontSize:"var(--jx-text-md)",userSelect:"text"},'& [part="package-name"]':{color:"var(--fg-dim)"},'& [part="package-version"]':{$description:"Tabular figures, so a column of versions does not jitter as it loads.",color:"var(--fg)",fontVariantNumeric:"tabular-nums"}},children:[{tagName:"dl",attributes:{part:"meta"},children:[{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/label"},map:{tagName:"div",attributes:{part:"meta-row"},children:[{tagName:"dt",attributes:{part:"meta-label"},textContent:"${$map.item.label}"},{tagName:"dd",attributes:{part:"meta-value"},textContent:"${$map.item.value}"}]}}]},{tagName:"div",attributes:{part:"links"},children:[{$prototype:"Array",items:{$ref:"#/state/links"},key:{$ref:"$map/item/href"},map:{tagName:"a",attributes:{href:"${$map.item.href}",target:"_blank",rel:"noreferrer noopener"},textContent:"${$map.item.label}"}}]},{tagName:"section",attributes:{part:"section"},children:[{tagName:"h3",attributes:{part:"section-title"},textContent:"Packages"},{tagName:"div",attributes:{part:"packages-slot",role:"none"},$switch:{$ref:"#/state/packagesState"},cases:{loading:{tagName:"p",attributes:{part:"muted"},textContent:"Loading packages…"},empty:{tagName:"p",attributes:{part:"muted"},textContent:"No packages reported."},listed:{tagName:"ul",attributes:{part:"packages"},children:[{$prototype:"Array",items:{$ref:"#/state/packages"},key:{$ref:"$map/item/name"},map:{tagName:"li",attributes:{part:"package-row"},children:[{tagName:"span",attributes:{part:"package-name"},textContent:"${$map.item.name}"},{tagName:"span",attributes:{part:"package-version"},textContent:"${$map.item.version}"}]}}]}}}]}]};E("about",fF);function hF(e){let t=document.createElement("div");t.style.pointerEvents="auto",t.setAttribute(Ve,vt("dialog","about")),e.layer.append(t);let r=!1,o=()=>{if(r)return;r=!0,e.onClosed()},a=()=>r,i=g({close:()=>f.close(),closed:o,headline:e.headline,links:e.links,packages:[],packagesState:"loading",rows:e.rows}),s=null,l=R("about",i,t).then(async(c)=>{s=c;let d=c.root;if(a())return c.dispose(),d;if(await sn(d),a())return d;return Jt(d),d}),f={close(){if(r)return;let c=s?.root;if(c instanceof HTMLElement)Ut(c);s?.dispose(),s=null,t.remove(),o()},host:t,ready:l,update(c){if(c.rows!==void 0)i.rows=c.rows;if(c.packages!==void 0)i.packages=c.packages,i.packagesState=c.packages.length===0?"empty":"listed"}};return f}var Rl="Jx Studio",Hm="10.4.0",gF="2026-11-05T00:33:16.906Z",Bm="d51e05c",Vm={github:"https://github.com/jxsuite/jx",docs:"https://github.com/jxsuite/jx#readme",license:"https://github.com/jxsuite/jx/blob/main/LICENSE"};var Al=null;function Z8(e){if(!e)return"—";let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function bF(e){let t=[{label:"Version",value:Hm},{label:"Build date",value:Z8(gF)},{label:"Commit",value:Bm}];if(e){if(t.push({label:"Channel",value:e.channel}),e.updateStatus)t.push({label:"Updates",value:e.updateStatus})}return t}async function e9(e){let t=p(),r=[];try{r=await t.listPackages()}catch{r=[]}let o=null;if(t.getAppInfo)try{o=await t.getAppInfo()}catch{o=null}if(Al===e)e.update({packages:r,rows:bF(o)})}function t9(){if(Al)return;let e=hF({headline:`About ${Rl}`,layer:dt("dialog"),links:[{href:Vm.github,label:"GitHub"},{href:Vm.docs,label:"Documentation"},{href:Vm.license,label:"License"}],onClosed:()=>{if(Al===e)Al=null},rows:bF(null)});Al=e,e9(e)}function n9(){return[{id:"help.about",title:`About ${Rl}`,category:"Help",level:"application",menus:["commandbar/overflow","palette"],group:"9_help",run:()=>{t9()}}]}function yF(e){e.registerAll(n9())}function Rt(){return h.value}function vF(){let e=Rt();return Boolean(e&&xn(e).active)}function r9(e){return`jx://collab/${(e.documentPath??"").replace(/^\.?\//,"")}`}function o9(){return[{id:"collab.setEnabled",title:"Collaborate: Share this document",category:"Collaborate",level:"document",menus:["palette"],group:"1_session",requires:"an open document",when:()=>Boolean(Rt()?.documentPath),args:{additionalProperties:!1,properties:{enabled:To("True to attach a live session, false to leave it.")},required:["enabled"],type:"object"},run:(e,t)=>{let r=Hi("collab.setEnabled",t,"enabled"),o=Rt();if(!o)return;if(pI(o)===r)return;hI(o,r),w.info(r?"Connecting this document to its collaboration session…":"Left the collaboration session for this document.",{source:"Collaboration"})}},{id:"collab.stop",title:"Collaborate: Stop sharing",category:"Collaborate",level:"document",menus:["palette"],group:"1_session",requires:"a live collaboration session",when:()=>Boolean(Rt()?.documentPath),enablement:vF,run:()=>{let e=Rt();if(!e||!pI(e))return;hI(e,!1),w.info("Left the collaboration session for this document.",{source:"Collaboration"})}},{id:"collab.copyLink",title:"Collaborate: Copy session link",category:"Collaborate",level:"document",menus:["palette"],group:"2_invite",requires:"a live collaboration session",when:()=>Boolean(Rt()?.documentPath),enablement:vF,run:async()=>{let e=Rt();if(!e)return;let t=r9(e);try{await navigator.clipboard.writeText(t)}catch(r){w.error(`Could not copy the session link — ${r instanceof Error?r.message:String(r)}`,{detail:t,source:"Collaboration"});return}w.success("Session link copied. It names the room; it does not grant access to it.",{source:"Collaboration"})}},{id:"collab.follow",title:"Collaborate: Follow a collaborator",category:"Collaborate",level:"document",menus:["palette"],group:"3_presence",requires:"another person in this session",when:()=>Boolean(Rt()?.documentPath),enablement:()=>{let e=Rt();return Boolean(e&&xn(e).peers.length>0)},args:{additionalProperties:!1,properties:{login:Fe("The collaborator's login, as shown on their presence chip.")},required:[],type:"object"},run:(e,t)=>{let r=Rt();if(!r)return;let o=ti("collab.follow",t,"login"),{peers:a}=xn(r),i=o?a.find((l)=>l.state.user.login===o):a[0];if(!i){w.warn(o?`${o} is not in this session.`:"Nobody else is in this session.",{source:"Collaboration"});return}let s=i.state.focusedPath;if(!s){w.info(`${i.state.user.login} is not in a document right now.`,{source:"Collaboration"});return}w.info(`${i.state.user.login} is in ${s}.`,{action:"file.open",actionArgs:{path:s},source:"Collaboration"})}},{id:"collab.showStatus",title:"Collaborate: What is happening in this document?",category:"Collaborate",level:"document",menus:["palette"],group:"3_presence",requires:"an open document",when:()=>Boolean(Rt()?.documentPath),run:()=>{let e=Rt();if(!e)return;let t=xn(e),r=[`Status: ${t.status}${t.attachError?` — ${t.attachError}`:""}`,`People here: ${t.peers.length===0?"just you":t.peers.map((o)=>o.state.user.login).join(", ")}`,t.readOnly?"You have read access: your edits stay on this machine.":"You can publish edits to this session.",t.sourceCanonical?"Someone holds the code view, so structural edits are paused. This is not an error.":"Structural editing is available.","Undo only takes back your own edits, never a collaborator's."];w.info(r[0],{detail:r.join(`
|
|
502
|
+
`),source:"Collaboration"})}}]}function wF(e){e.registerAll(o9())}function xF(){return["all",...Eb()]}async function a9(e){$D(e);let{openWorkspaceHome:t}=await (ce("rse9h8a0"),import("./chunks/workspace-home-rse9h8a0.js"));t("content")}function i9(){return[{args:Se({collection:gl(UL,'Which collection the Content home shows: "pages", or a collection project.json declares.')}),category:"Project",id:"content.showCollection",level:"project",menus:["palette"],group:"1_file",requires:"an open project",when:(e)=>e.project.open,run:async(e,t)=>{let r=qn("content.showCollection",t,"collection",UL());await a9(r)},title:"Content: Show Collection"},{args:Se({layout:pi(_m,`How the Content home arranges the collection it shows: ${_m.map((e)=>Ew[e]).join(", ")}.`)}),category:"Project",id:"content.setLayout",level:"project",menus:["palette"],group:"1_file",requires:"an open project",when:(e)=>e.project.open,run:(e,t)=>{let r=qn("content.setLayout",t,"layout",_m);TE(r)},title:"Content: Set View"},{args:{additionalProperties:!1,properties:{query:Fe("Text matched against each file's name and path. Empty clears it.")},type:"object"},category:"Project",id:"content.setSearch",level:"project",menus:["palette"],group:"1_file",requires:"an open project",when:(e)=>e.project.open,run:(e,t)=>{G_(ti("content.setSearch",t,"query")??"")},title:"Content: Search Collection"},{args:Se({locale:gl(xF,'Which language the Content home lists, as a BCP 47 tag the project declares. "all" clears the language filter.')}),category:"Project",id:"content.setLocale",level:"project",menus:["palette"],group:"1_file",requires:"a project with more than one locale",when:(e)=>e.project.open&&e.project.isMultilingual,run:(e,t)=>{let r=qn("content.setLocale",t,"locale",xF());K_(r==="all"?"":r)},title:"Content: Show Language"},{category:"Project",id:"content.refresh",level:"project",menus:["palette"],group:"1_file",requires:"an open project",when:(e)=>e.project.open,run:()=>$E(),title:"Content: Rescan Files"}]}function kF(e){e.registerAll(i9())}function s9(e){let t=e.replaceAll("\\","/");return t.includes("/")?t.slice(0,t.lastIndexOf("/")):"."}function vw(e){let t=e.lastIndexOf(".");return t>0?e.slice(t).toLowerCase():""}function SF(e,t){let r=vw(e);return r===""?`${e}${t}`:`${e.slice(0,e.length-r.length)}${t}`}async function CF(e,t){let{formatForPath:r}=await (ce("9gy76erh"),import("./chunks/format-host-9gy76erh.js"));if(r(e)){let{parseSourceForPath:o}=await (ce("1sghzgcr"),import("./chunks/file-ops-1sghzgcr.js")),a=await o(e,t);return{document:a.document,frontmatter:a.frontmatter}}return{document:JSON.parse(t),frontmatter:{}}}async function TF(e,t,r){let o={...r,...t};if(e===".json")return Co(o,null);let{formatByExtension:a,formatSerialize:i}=await (ce("9gy76erh"),import("./chunks/format-host-9gy76erh.js")),s=a(e,"serialize");if(!s)throw Error(`No installed format writes ${e} files.`);return i(s.name,{...o,children:t.children??[]},{frontmatter:Object.keys(o).some((l)=>l!=="children"),mode:"roundtrip"})}async function l9(e,t){if(vw(e)===".json")return!0;try{let r=await CF(e,t);return await TF(vw(e),r.document,r.frontmatter)===t}catch{return!0}}async function c9(e,t,r){let o=SF(e,r),a=[],i;try{let{document:c,frontmatter:d}=await CF(e,t);i=await TF(r,c,d)}catch(c){let{errorMessage:d}=await (ce("hee7ne9b"),import("./chunks/parse-hee7ne9b.js"));return{blocker:d(c),lines:a,targetExt:r,targetPath:o,text:""}}if(r===".json"){let{validateDocOrNull:c}=await (ce("r4ax11e3"),import("./chunks/jx-validate-r4ax11e3.js")),d=await c(JSON.parse(i));if(d===null)a.push("The result could not be checked against the document schema — that is not the same as "+"it being valid.");else if(d.length>0)return{blocker:`The result would not be a valid Jx document (${[...new Set(d.map((y)=>y.split(":")[0]))].join(", ")}).`,lines:a,targetExt:r,targetPath:o,text:i}}if(!await l9(o,i))a.push("This file will not read back identically after conversion.");let{loadUsages:s,usageWarning:l}=await (ce("vqyr5s9x"),import("./chunks/references-vqyr5s9x.js")),f=l(await s({path:e}),"convert");if(f!==null)a.push(f);return a.push(`${e} becomes ${o}. The original file is not kept.`),{blocker:null,lines:a,targetExt:r,targetPath:o,text:i}}async function d9(e,t){let{notify:r}=await (ce("bwehrp7q"),import("./chunks/notify-bwehrp7q.js")),{errorMessage:o}=await (ce("hee7ne9b"),import("./chunks/parse-hee7ne9b.js")),a=(V,F)=>(r.error(V,{detail:F,path:e,source:"Convert"}),null),{loadFormats:i}=await (ce("9gy76erh"),import("./chunks/format-host-9gy76erh.js"));await i();let s=IS(e);if(s.length===0)return a(`${e} cannot be converted to another format.`,$F);let{workspace:l}=await (ce("6ztqcrsh"),import("./chunks/workspace-6ztqcrsh.js")),{commitTabBuffers:f}=await (ce("pa0g6ax7"),import("./chunks/monaco-buffer-pa0g6ax7.js")),c=[...l.tabs.values()].find((V)=>V.documentPath===e);if(c){if(await f(c),c.doc.dirty)return a(`${e} has unsaved changes.`,u9)}let d=t??await h9(e,s);if(d===null)return null;if(!s.some((V)=>V.ext===d))return a(`${e} cannot be converted to ${d}.`,$F);let{getPlatform:b}=await (ce("kv0k65cy"),import("./chunks/platform-kv0k65cy.js")),y=b(),x=SF(e,d);try{let V=await y.listDirectory(s9(e));if(new Set(V.map((B)=>B.path.replaceAll("\\","/").toLowerCase())).has(x.toLowerCase()))return a(`${x} already exists.`,m9)}catch(V){return a(`Could not check whether ${x} already exists.`,o(V))}let S;try{let V=await y.readFile(e);S=n(V)?V:""}catch(V){return a(`Could not read ${e}.`,o(V))}let P=await c9(e,S,d);if(P.blocker!==null)return a(`${e} cannot be converted to ${d}.`,P.blocker);let{showConfirmDialog:j}=await (ce("m49nmwvx"),import("./chunks/layers-m49nmwvx.js")),{html:k}=await (ce("k2mb9k0r"),import("./chunks/lit-html-k2mb9k0r.js"));if(!await j("Convert Format",k`<span
|
|
503
503
|
>Convert <strong>${e.split("/").pop()}</strong> to
|
|
504
504
|
${s.find((V)=>V.ext===d)?.label??d}?</span
|
|
505
|
-
>${P.lines.map((V)=>k`<p class="dialog-consequence">${V}</p>`)}`,{confirmLabel:"Convert",destructive:!0}))return null;let{markLocalMutation:N}=await (ce("3424ezp3"),import("./chunks/fs-events-3424ezp3.js")),{notifyMoveOutcome:O,settleRename:D}=await (ce("t07yqqej"),import("./chunks/files-t07yqqej.js"));N(e,P.targetPath);try{await y.writeFile(e,P.text)}catch(V){return a(`Could not write the converted ${e}.`,o(V))}let M;try{M=await y.renameFile(e,P.targetPath)}catch(V){try{N(e),await y.writeFile(e,S)}catch{}return a(`Could not convert ${e}.`,o(V))}if(c)await p9(e,P.targetPath,P.text);return await D(e,P.targetPath,M),O(f9(P.targetPath,M),M,P.targetPath),P.targetPath}async function p9(e,t,r){let{openTab:o,renameTab:a}=await (ce("9btkc8tk"),import("./chunks/workspace-9btkc8tk.js")),{formatForPath:i}=await (ce("5ja5gxyk"),import("./chunks/format-host-5ja5gxyk.js"));a(e,t,t);let s=i(t),l,f,c=null;try{if(s){let{parseSourceForPath:b}=await (ce("9bxvk59j"),import("./chunks/file-ops-9bxvk59j.js"));({document:l,frontmatter:f}=await b(t,r))}else({document:l,layout:c}=Es(r))}catch{return}let d={document:l,documentPath:t,id:t,layout:c,sourceFormat:s?.name??null};if(f!==void 0)d.frontmatter=f;o(d)}var $F="Studio converts documents in pages/ and components/ between formats that can both read and write a Jx document. Layouts are JSON only, and a file inside a content collection keeps its collection's format.",u9="It is open in the editor with unsaved changes, and converting it would write over them. Save or discard the changes first.",m9="Rename or delete the existing file first; converting would replace it.";function f9(e,t){let r=t.references,o=e.split("/").pop()??e;return r&&r.refsUpdated>0?`Converted to ${o}; updated ${r.refsUpdated} reference(s) in ${r.filesChanged} file(s)`:`Converted to ${o}`}async function h9(e,t){if(t.length===1)return t[0].ext;let{showPromptDialog:r}=await (ce("m49nmwvx"),import("./chunks/layers-m49nmwvx.js")),o=t[0].ext;return await r("Convert Format",{choice:{initial:o,label:"Convert to",onChange:(i)=>{o=i},options:()=>t.map((i)=>({label:i.label,value:i.ext}))},confirmLabel:"Continue",message:`Converting ${e}.`,select:"none",validate:()=>"",value:e.split("/").pop()??e})===null?null:o}function g9(){return[{args:Se({format:gl(RN,"Extension to convert to. Omitted, Studio asks."),source:Fe("Project-relative path of the file to convert.")},["source"]),category:"File",id:"file.convertFormat",level:"project",menus:["context/file"],group:"1_file",requires:"an open project",when:(e)=>e.project.open,undo:"none",run:async(e,t)=>{let r=n(t.format)?t.format:void 0;await d9(St("file.convertFormat",t,"source"),...r===void 0?[]:[r])},title:"Convert Format…"}]}function PF(e){e.registerAll(g9())}var Nr="rewrite",Il=[...$w,Nr],Wm=301,b9=200;function Do(e){let t=e.trim();return t.length>1&&t.endsWith("/")?t.slice(0,-1):t}function Jm(e){return e.includes(":")||e.includes("*")}function y9(e){return/^[a-z][\d+.a-z-]*:/i.test(e)||e.startsWith("//")}function xw(e,t){let r=Do(e).split("/"),o=Do(t).split("/");for(let[a,i]of r.entries()){if(i==="*")return!0;if(a>=o.length)return!1;if(i.startsWith(":")){if(o[a]==="")return!1;continue}if(i!==o[a])return!1}return o.length===r.length}function EF(e){return e.replaceAll(/\[([^\]]+)]/g,":$1")}function Km(e){return Object.entries(e??{}).map(([t,r])=>{if(n(r))return{destination:r,source:t,status:Wm};if("rewrite"in r)return{destination:r.destination,source:t,status:Nr};let o=r.status??Wm;return{destination:r.destination,source:t,status:o}})}function NF(e){let t={};for(let r of e)if(r.status===Nr)t[r.source]={destination:r.destination,rewrite:!0};else if(r.status===Wm)t[r.source]=r.destination;else t[r.source]={destination:r.destination,status:r.status};return t}function v9(e,t){let r=Do(t);return e.find((o)=>!Jm(o.source)&&Do(o.source)===r)??e.find((o)=>Jm(o.source)&&xw(o.source,r))}function w9(e,t){let r=[t.source],o=new Set([Do(t.source)]),a=t;for(;;){if(Jm(a.destination)||y9(a.destination))return{looped:!1,path:r};let i=v9(e,a.destination);if(r.push(a.destination),!i)return{looped:!1,path:r};let s=Do(i.source);if(o.has(s))return{looped:!0,path:r};o.add(s),a=i}}function jF(e,t){let r=[],o=new Set;for(let a of e){let{looped:i,path:s}=w9(e,a);if(i){let l=[...new Set(s.map((f)=>Do(f)))].toSorted().join(">");if(!o.has(l))o.add(l),r.push({detail:`Following the rules from ${a.source} returns to a source already visited, so a request for it never reaches a page. Break the cycle by pointing one of these rules at a real route.`,message:`Redirect loop: ${s.join(" → ")}`,rule:"loop",source:a.source})}else if(s.length>2)r.push({detail:`Each hop is a separate request and is cached separately, so a visitor pays for the whole chain and a correction to the last hop can be masked by a cached earlier one. Point ${a.source} straight at ${s.at(-1)}.`,message:`Redirect chain: ${s.join(" → ")}`,rule:"chain",source:a.source})}for(let a of e){let i=t.filter((l)=>Jm(a.source)?xw(a.source,EF(l)):xw(EF(l),a.source)),[s]=i;if(s===void 0)continue;r.push({detail:`This project has a page at ${s}${i.length>1?` (and ${i.length-1} more)`:""}. A host that serves static files before consulting _redirects answers with the page and this rule never fires; the build meanwhile writes its meta-refresh file over that page in `+"dist/ and warns (site-architecture.md §11.1). Remove the rule or the page.",message:`Redirect shadowed by a page: ${a.source}`,rule:"shadow",source:a.source})}return r}function RF(e){if(e===void 0||e==="")return Wm;let t=e.trim().replace(/!$/,"");if(t.toLowerCase()===Nr||Number(t)===b9)return Nr;let r=Number(t);return $w.find((o)=>o===r)??null}function x9(e){let t=[],r=[];for(let[o,a]of e.split(/\r?\n/).entries()){let i=a.trim();if(i===""||i.startsWith("#"))continue;let[s,l,f]=i.split(/\s+/);if(!s||!l){r.push(`Line ${o+1}: "${i}" — expected "source destination [status]".`);continue}let c=RF(f);if(c===null){r.push(`Line ${o+1}: "${f}" is not an HTTP status.`);continue}t.push({destination:l,source:s,status:c})}return{errors:r,format:"_redirects",rules:t}}var ww={destination:["destination","to","new","target"],source:["source","from","old","path"],status:["status","code"]};function k9(e){let t=Fd(e),r=[],o=[],a=t.headers.map((b)=>b.trim().toLowerCase()),i=(b)=>a.findIndex((y)=>b.includes(y)),s=i(ww.source),l=i(ww.destination),f=s!==-1&&l!==-1,c=f?t.rows:[t.headers,...t.rows],d=f?{destination:l,source:s,status:i(ww.status)}:{destination:1,source:0,status:2};for(let[b,y]of c.entries()){let x=(y[d.source]??"").trim(),S=(y[d.destination]??"").trim();if(x===""&&S==="")continue;let P=f?b+2:b+1;if(x===""||S===""){r.push(`Row ${P}: both a source and a destination are required.`);continue}let j=RF(d.status===-1?void 0:(y[d.status]??"").trim());if(j===null){r.push(`Row ${P}: "${y[d.status]}" is not one of ${Il.join(", ")}.`);continue}o.push({destination:S,source:x,status:j})}return{errors:r,format:"csv",rules:o}}function AF(e){return e.split(/\r?\n/).map((r)=>r.trim()).find((r)=>r!==""&&!r.startsWith("#"))?.includes(",")?k9(e):x9(e)}var Xm="grid://redirects",Ll="Redirects",$9=[".json",".md",".html"];function S9(){return[{editable:!0,field:"source",kind:"string",required:!0,title:"Source",widthHint:260},{editable:!0,field:"destination",kind:"string",required:!0,title:"Destination",widthHint:260},{editable:!0,field:"status",kind:"enum",schema:{enum:Il.map(String)},title:"Status",widthHint:110}]}function C9(e,t){return{cells:{destination:e.destination,source:e.source,status:String(e.status)},key:String(t)}}function Sw(){return C?.projectConfig?.redirects}function OF(e){let t=e.trim();if(t.toLowerCase()===Nr)return Nr;let r=Number(t);return Number.isInteger(r)?r:t}function T9(e){let t=(r)=>r===null||r===void 0?"":String(r);return{destination:t(e.destination).trim(),source:t(e.source).trim(),status:OF(t(e.status))}}function P9(e){if(e.source==="")return"A source path is required.";if(e.destination==="")return"A destination is required.";if(!Il.includes(e.status))return`Status must be one of ${Il.join(", ")}.`;return null}async function Pw(){let e=p(),t=new Set,r=!0,o=async(a)=>{let i;try{i=await e.listDirectory(a)}catch{r=!1;return}for(let s of i){let l=s.path||`${a}/${s.name}`;if(s.type==="directory")await o(l);else if($9.some((f)=>l.endsWith(f))){let f=cm(l);if(f!==null)t.add(f)}}};return await o("pages"),{complete:r,routes:[...t]}}function jw(e,t){yl((o)=>o.source===Ll);let r=jF(e,t.complete?t.routes:[]);for(let o of r)w(o.rule==="loop"?"error":"warn",o.message,{action:"redirects.open",detail:o.detail,key:`redirects.${o.rule}:${o.source}`,path:an,source:Ll,tier:"problem"});if(!t.complete)return w.warn("Redirects were checked for chains and loops only.",{action:"redirects.validate",detail:"pages/ could not be listed, so this run cannot say whether a rule is shadowed by a real route. Reporting no shadowed rules from an incomplete list would be a guess.",key:"redirects.routes",path:"pages",source:Ll,tier:"problem"}),r.length+1;return r.length}function E9(){let e=()=>Km(Sw());return{backingPaths:()=>new Map([[an,"*"]]),capabilities:{delete:!0,insert:!0,remotePaging:!1,remoteSort:!1},columns:()=>Promise.resolve(S9()),async commit(t){let r=e(),o={cells:[],deletes:[],inserts:[]};for(let d of t.cells){let b=r[Number(d.rowKey)];if(!b){o.cells.push({error:"This row is no longer in project.json — refresh the grid.",field:d.field,ok:!1,rowKey:d.rowKey,stale:!0});continue}let y=d.value===null?"":String(d.value);if(d.field==="status")b.status=OF(y);else if(d.field==="source")b.source=y.trim();else b.destination=y.trim();o.cells.push({field:d.field,ok:!0,rowKey:d.rowKey})}let a=new Set(t.deletes.map((d)=>Number(d.rowKey))),i=r.filter((d,b)=>!a.has(b));for(let d of t.deletes)o.deletes.push({ok:!0,rowKey:d.rowKey});for(let d of t.inserts)i.push(T9(d.cells)),o.inserts.push({ok:!0,tempKey:d.tempKey});let s=new Set,l=[];for(let d of i){let b=P9(d)??(s.has(d.source)?"Duplicate source.":null);if(b)l.push(`${d.source||"(blank)"} — ${b}`);s.add(d.source)}if(l.length>0)return IF(t,l.join(" "));let f={redirects:i.length>0?NF(i):void 0};if(!(await ic(f)).ok)return IF(t,"project.json could not be written — see Problems.");return jw(i,await Pw()),o},id:Xm,label:"Redirects",refresh:()=>Promise.resolve(),rows(){let t=e();return Promise.resolve({rows:t.map((r,o)=>C9(r,o)),total:t.length})}}}function IF(e,t){return{cells:e.cells.map((r)=>({error:t,field:r.field,ok:!1,rowKey:r.rowKey})),deletes:e.deletes.map((r)=>({error:t,ok:!1,rowKey:r.rowKey})),inserts:e.inserts.map((r)=>({error:t,ok:!1,tempKey:r.tempKey}))}}async function LF(){let e=m.tabs.get(Xm);if(e){Ft(Xm);let o=er(e);if(o)return o}let t=e??Si({capabilities:{modes:["grid"]},document:structuredClone(Nb),documentPath:null,id:Xm}),r=$p(t,E9());return await r.load(),r}function N9(){return Fn("Import Redirects",{confirmLabel:"Import",message:"Paste a Netlify/Cloudflare _redirects file, or CSV with source,destination,status columns. "+"Rows are staged for review — nothing is written until you save.",mono:!0,multiline:!0,placeholder:"/old-page /new-page 301",rows:"10",size:"md"})}function j9(e,t,r){let o=new Set(e.effectiveRows().map((l)=>String(l.source??"").trim())),a=[],i=0;for(let l of t){if(o.has(l.source)){a.push(l.source);continue}o.add(l.source),e.addRow({destination:l.destination,source:l.source,status:String(l.status)}),i+=1}let s=[...r,...a.length>0?[`Already in the table, skipped: ${a.join(", ")}.`]:[]];if(s.length>0)w.warn(`Imported ${i} redirect${i===1?"":"s"} · ${s.length} line${s.length===1?"":"s"} not imported.`,{action:"redirects.import",detail:s.join(`
|
|
506
|
-
`),key:"redirects.import",path:an,source:Ll,tier:"problem"});else if(i>0)w.success(`Staged ${i} redirect${i===1?"":"s"} — review, then save.`,{action:"file.save",key:"redirects.import"});else w.info("Nothing to import.",{key:"redirects.import"});return i}function R9(){return[{category:"Project",id:"redirects.open",level:"project",menus:["palette"],group:"5_data",requires:"an open project",when:(e)=>e.project.open,run:async()=>{await LF(),jw(Km(Sw()),await Pw())},title:"Edit Redirects"},{category:"Project",id:"redirects.validate",level:"project",menus:["palette"],group:"5_data",requires:"an open project",when:(e)=>e.project.open,aiTool:{description:"Check the site's redirect rules for chains, loops and rules shadowed by a real page. Reports each finding as a Problem, and returns the findings as data.",name:"validate_redirects",report:()=>{let e=sf(Ll),t=e.length;return{data:e,summary:t===0?"No redirect problems: no chains, loops or shadowed rules.":`Filed ${t} redirect problem${t===1?"":"s"} in Problems.`}}},run:async()=>{let e=Km(Sw());if(jw(e,await Pw())===0)w.success(`${e.length} redirect${e.length===1?"":"s"} checked — no chains, loops or shadowed rules.`,{key:"redirects.validate"})},title:"Validate Redirects"},{args:{additionalProperties:!1,properties:{text:Fe("A _redirects file or CSV to import. Omit it and Studio asks for a paste.")},required:[],type:"object"},category:"Project",id:"redirects.import",level:"project",menus:["palette"],group:"5_data",requires:"an open project",when:(e)=>e.project.open,run:async(e,t)=>{let o=ti("redirects.import",t,"text")??await N9();if(o===null||o.trim()==="")return;let a=AF(o),i=await LF();j9(i,a.rules,a.errors)},title:"Import Redirects…"}]}function MF(e){e.registerAll(R9())}var Ba="file.new",Qm={created:null,opened:null};function A9(e){let t={};if(e.kind!==void 0)t.kind=qn(Ba,e,"kind",xb);let r=ti(Ba,e,"name");if(r!==void 0)t.name=r;let o=ti(Ba,e,"collection");if(o!==void 0)t.collection=o;let a=ti(Ba,e,"locale");if(a!==void 0)t.locale=a;let i=ti(Ba,e,"template");if(i!==void 0)t.template=i;return t}function I9(){let{created:e,opened:t}=Qm;if(e)return{summary:L9(e),wrote:e.wrote};return{summary:`Opened Add new on ${t??"page"} for the person; nothing is created until they confirm. Pass a name to create without the dialog.`,wrote:[]}}function L9(e){switch(e.kind){case"page":return`Created the page ${e.path}${e.route?`, which opens at ${e.route}`:""}, and opened it in Design.`;case"component":return`Created <${e.tag??""}> in ${e.path}; it is listed under Components in the Site panel and open in Design.`;case"template":return`Created the template ${e.path} and opened it in Design.`;case"entry":return`Created the entry ${e.path} and opened it.`;case"collection":return`Created the ${e.path.replace(/^content\//,"")} collection, writing ${e.wrote.join(", ")}.`;default:return`Uploaded ${e.wrote.length===1?"1 file":`${e.wrote.length} files`} to public/media/.`}}function O9(){return[{aiTool:{description:"Create a page, collection, template, component or collection entry, the way Add new does: pass kind and name and it is written and opened, with the path derived from the name (pages/<slug>.json, layouts/<slug>.json, components/<tag>.json, a content/<name>/ collection). Without a name it only opens the Add new dialog for the person.",name:"add_new",report:()=>I9()},args:Se({collection:gl(()=>Bw().map((e)=>e.name),"For an entry: the content collection it is created in."),kind:pi(xb,"What to create: page, collection, template, component, media (an upload) or entry."),locale:Fe("For a page or an entry of a localized collection: the language it is written in, one of the project's i18n locales such as fr-CA. A page in another language is saved in that language's folder and opens under its URL prefix."),name:Fe("The name. A page's URL, a template's file and a component's tag are derived from it. Omit it to open the Add new dialog instead of creating."),template:Fe("The template to start from: a layout such as base or layouts/base.json, article for a Markdown page, or blank for none. A collection uses it for its own page; a template is wrapped in it.")},[]),category:"File",group:"1_file",icon:"plus",id:Ba,keybinding:["mod+n","mod+alt+n"],level:"project",menus:["commandbar/overflow","palette"],requires:"an open project",run:async(e,t)=>{let r=A9(t),o=await (ce("3tkn72ey"),import("./chunks/add-new-flow-3tkn72ey.js"));if(r.name!==void 0){Qm={created:null,opened:null},Qm={created:await o.createDirect({...r,name:r.name}),opened:null};return}Qm={created:null,opened:r.kind??"page"},o.openAddNew(r)},title:"Add New…",undo:"none",when:(e)=>e.project.open}]}function DF(e){e.registerAll(O9())}var Zm="media.browse",M9="media.upload",FF="media.replace",_F="media.rename",zF="media.duplicate",HF="media.delete",BF="media.edit",VF=null,WF=null,qF=null;function Va(){return VF??=(ce("ae67q4at"),import("./chunks/media-library-ae67q4at.js")),VF}function D9(){return WF??=(ce("qcc4z5ag"),import("./chunks/workspace-home-qcc4z5ag.js")),WF}function F9(){return qF??=(ce("yp9jm834"),import("./chunks/media-open-yp9jm834.js")),qF}function qa(e,t,r){let o=St(e,t,r).replace(/^\.\//,"");if(!zd(o))throw RangeError(`command "${e}": "${o}" is not a media file (an image, video, audio, PDF or font).`);return o}function _9(e){let t={};if(e.filter!==void 0)t.filter=qn(Zm,e,"filter",lS);let r=ti(Zm,e,"query");if(r!==void 0)t.query=r;if(e.select!==void 0)t.select=qa(Zm,e,"select");return t}async function Iw(){let{openWorkspaceHome:e}=await D9();e("media")}var Wa="The media file's project path, such as public/media/hero.jpg.";function z9(){let e={category:"Project",group:"1_media",level:"project",menus:["palette"],requires:"an open project",when:(t)=>t.project.open};return[{...e,args:Se({filter:pi(lS,"Which media to show: all, image, video, audio, document, font, or unused (files no document references)."),query:Fe("Search the media by name or path."),select:Fe(`A file to select and describe. ${Wa}`)},[]),icon:"image",id:Zm,run:async(t,r)=>{let o=_9(r);(await Va()).applyMediaBrowse(o),await Iw()},title:"Browse Media",undo:"none"},{...e,icon:"upload-simple",id:M9,run:async()=>{let t=await Va();await Iw(),t.requestMediaUpload()},title:"Upload Media…",undo:"none"},{...e,args:Se({path:Fe(`The file to replace. ${Wa}`)},["path"]),icon:"arrows-clockwise",id:FF,run:async(t,r)=>{let o=qa(FF,r,"path"),a=await Va();await Iw(),a.requestMediaReplace(o)},title:"Replace Media File…",undo:"none"},{...e,args:Se({path:Fe(`The image to edit: a PNG, JPEG or WebP. ${Wa}`)},["path"]),icon:"crop",id:BF,requires:"an open project, on a backend that can read a file's raw bytes",run:async(t,r)=>{let o=qa(BF,r,"path");(await F9()).openImageEditor(o)},title:"Edit Image…",undo:"none",when:(t)=>t.project.open&&t.capability.readFileBytes},{...e,args:Se({path:Fe(`The file to rename. ${Wa}`)},["path"]),icon:"pencil-simple",id:_F,run:async(t,r)=>{let o=qa(_F,r,"path");await(await Va()).renameMediaFile(o)},title:"Rename Media File…",undo:"none"},{...e,args:Se({path:Fe(`The file to copy. ${Wa}`)},["path"]),icon:"copy",id:zF,requires:"an open project, on a backend that can read a file's raw bytes",run:async(t,r)=>{let o=qa(zF,r,"path");await(await Va()).duplicateMediaFile(o)},title:"Duplicate Media File",undo:"none",when:(t)=>t.project.open&&t.capability.readFileBytes},{...e,args:Se({path:Fe(`The file to delete. ${Wa}`)},["path"]),destructive:!0,group:"9_danger",icon:"trash",id:HF,run:async(t,r)=>{let o=qa(HF,r,"path");await(await Va()).deleteMediaFile(o)},title:"Delete Media File…",undo:"none"}]}function UF(e){e.registerAll(z9())}function Ow(){return Ts()?.locales??[]}var JF=!1;function GF(e,t){let r=ti(e,t,"path"),o=ti(e,t,"pane");if(r!==void 0){if(o!==void 0)throw RangeError(`command "${e}" argument "path": names a file while "pane" names a pane — give one`);return r}let a=o===void 0?h.value:bt(o);if(!a)throw RangeError(o===void 0?`command "${e}" needs a document open`:`command "${e}" argument "pane": no document is open in pane "${o}"`);if(a.documentPath===null)throw RangeError(`command "${e}" needs a document that has been saved to a file`);return a.documentPath}function KF(e,t){let r=Ts(),o=Qc(e,t,r);if(o!==null)return o;if(r===null||!r.locales.includes(t))return w.error(`This project does not declare ${Wt(t)}.`,{action:"settings.open",actionArgs:{section:"locales"},detail:"Add it in Settings › Locales, or with the Add Language command.",source:"Languages"}),null;return w.error(`${e} cannot have a translation.`,{detail:"A translation is the same file under a locale directory, so only files that live under a "+"routed directory — pages and content entries — have one. A layout, a component or a file "+"at the project root is shared by every language.",path:e,source:"Languages"}),null}async function YF(e){try{return await p().readFile(e),!0}catch{return!1}}var XF={pane:Fe("Pane whose document to translate. Defaults to the focused one."),path:Fe("Project-relative path of the document to translate. Defaults to the addressed pane's document; not combined with `pane`.")};function H9(){return[{args:Se({locale:gl(Ow,"The language to open this document's translation in."),...XF},["locale"]),category:"File",id:"i18n.openTranslation",level:"document",menus:["context/tab","palette"],group:"2_navigate",requires:"a document open in a project that declares more than one language",when:(e)=>e.project.isMultilingual&&e.document.open,run:async(e,t)=>{let r=GF("i18n.openTranslation",t),o=St("i18n.openTranslation",t,"locale"),a=KF(r,o);if(a===null)return;if(a===r){w.info(`${r} is already the ${Wt(o)} copy.`,{source:"Languages"});return}if(!await YF(a)){w.warn(`There is no ${Wt(o)} translation of this document yet.`,{action:"i18n.createTranslation",actionArgs:{locale:o,path:r},detail:`Create Translation writes ${a}, seeded from the document you are on.`,path:a,source:"Languages"});return}let{openFileInTab:i}=await (ce("t07yqqej"),import("./chunks/files-t07yqqej.js"));await i(a)},title:"Open Translation"},{args:Se({locale:gl(Ow,"The language to create this document's translation in."),...XF},["locale"]),category:"File",id:"i18n.createTranslation",level:"document",menus:["palette"],group:"2_navigate",requires:"a document open in a project that declares more than one language",when:(e)=>e.project.isMultilingual&&e.document.open,undo:"none",run:async(e,t)=>{let r=GF("i18n.createTranslation",t),o=St("i18n.createTranslation",t,"locale"),a=KF(r,o);if(a===null)return;if(await YF(a)){w.info(`The ${Wt(o)} translation already exists.`,{action:"i18n.openTranslation",actionArgs:{locale:o,path:r},path:a,source:"Languages"});return}let i;try{i=await p().readFile(r)}catch{w.error(`Could not read ${r} to copy it.`,{path:r,source:"Languages"});return}let s=a.lastIndexOf("/"),{createFileIn:l,openFileInTab:f}=await (ce("t07yqqej"),import("./chunks/files-t07yqqej.js")),c=await l({content:i,dir:s===-1?".":a.slice(0,s),source:"Languages",suggestedName:a.slice(s+1),title:`New ${Wt(o)} translation`});if(c!==null)await f(c)},title:"Create Translation"},{category:"View",id:"i18n.showParity",level:"project",menus:["commandbar/overflow","palette"],group:"2_view",requires:"a project that declares more than one language",when:(e)=>e.project.isMultilingual,run:()=>{Kc("i18n")},title:"Show Translation Parity"},{args:Se({locale:Fe("A BCP 47 language tag to declare — `fr`, `pt-BR`, `zh-Hant`. Canonicalized on the way "+"in; a malformed tag is refused rather than written.")}),category:"Project",id:"i18n.addLocale",level:"project",menus:["palette"],group:"7_settings",requires:"an open project",when:(e)=>e.project.open,undo:"project",aiTool:{description:"Declare a language for this project, adding it to project.json's i18n.locales. Every other language surface reads that list. Canonicalizes the tag; a malformed one is refused.",name:"add_project_locale",report:({args:e})=>{let t=jn(St("i18n.addLocale",e,"locale"))??"",r=Ow().join(", ")||t;return JF?`Declared ${t}; project locales are now ${r}.`:{summary:`${Wt(t)} was already one of this project's languages; the locales are ${r}.`,wrote:[]}}},run:async(e,t)=>{let r=St("i18n.addLocale",t,"locale");if(jn(r)===null)throw RangeError(`command "i18n.addLocale" argument "locale": "${r}" is not a well-formed BCP 47 `+"tag — a language, optionally a script and a region: fr, pt-BR, zh-Hant");JF=await AP(r)},title:"Add Language"}]}function QF(e){e.registerAll(H9())}var ZF={$schema:"https://jxsuite.com/schema/v1",$id:"StudioShell",$description:"The application frame: the one definition of what Studio's shell IS. Every cell here is a HOST another surface mounts into, and each is addressed by id because TypeScript adopts it (`store.ts`'s initShellRefs, `ui/panel-resize.ts`'s handles) — so the ids are a contract rather than styling, which is also why this document carries no style of its own: the frame must be laid out by the first paint, so its rules are the generated `styles/shell-frame.css` (specs/studio-ui-guidelines.md §1.1).",tagName:"div",attributes:{id:"app"},children:[{tagName:"div",attributes:{id:"toolbar","data-jx-region":"commandbar"}},{tagName:"div",$description:"The PANE GRID (studio.md §18.1). One cell per pane, each holding that pane's own strip, jump bar, chrome layer and stage — the four surfaces that used to be flat siblings of THIS grid, which is to say application rows that only ever described one pane. There is nothing to see here in markup: panels/pane-grid.ts reconciles the cells against workspace.panes, because how many there are is a fact about the workspace and a single div can only ever be one of them.",attributes:{id:"pane-grid"}},{tagName:"div",attributes:{id:"activity-bar","data-jx-region":"rail"}},{tagName:"div",attributes:{id:"left-panel","data-jx-region":"navigator","data-jx-scroller":""}},{tagName:"jx-split",attributes:{id:"resize-left",class:"resize-handle"},$description:'`jx-split` (ui.md §5.5): role="separator", a tab stop, aria-valuenow and its own arrow keys, Home/End and Enter — the door this handle owed a keyboard user, which a bare div driven by pointer events could not give (SC 2.1.1). Its share of the app box, its bounds and its reset point are all written by `ui/panel-resize.ts`, because the frame carries no scope: a dock is sized in PIXELS and persisted that way, so the px↔share arithmetic — and the window-resize listener that keeps it honest — is that adapter\'s, in one place for all three.',$props:{orientation:"vertical",label:"Resize the Navigator"}},{tagName:"jx-split",$description:"The Bottom dock (⌘J). It sits in the PANE's column, under the stage and above the status bar, so opening it never narrows the Navigator or the Inspector (studio.md §12 region ⑪). Its handle resizes on the other axis; panels/bottom-dock.ts stamps dock.bottom on this host while it is open, and nothing while it is closed. `jx-split` (ui.md §5.5): role=\"separator\", a tab stop, aria-valuenow and its own arrow keys, Home/End and Enter — the door this handle owed a keyboard user, which a bare div driven by pointer events could not give (SC 2.1.1). Its share of the app box, its bounds and its reset point are all written by `ui/panel-resize.ts`, because the frame carries no scope: a dock is sized in PIXELS and persisted that way, so the px↔share arithmetic — and the window-resize listener that keeps it honest — is that adapter's, in one place for all three.",attributes:{id:"resize-bottom",class:"resize-handle resize-handle-row"},$props:{orientation:"horizontal",label:"Resize the Bottom dock"}},{tagName:"div",attributes:{id:"bottom-dock"}},{tagName:"jx-split",attributes:{id:"resize-right",class:"resize-handle"},$description:'`jx-split` (ui.md §5.5): role="separator", a tab stop, aria-valuenow and its own arrow keys, Home/End and Enter — the door this handle owed a keyboard user, which a bare div driven by pointer events could not give (SC 2.1.1). Its share of the app box, its bounds and its reset point are all written by `ui/panel-resize.ts`, because the frame carries no scope: a dock is sized in PIXELS and persisted that way, so the px↔share arithmetic — and the window-resize listener that keeps it honest — is that adapter\'s, in one place for all three.',$props:{orientation:"vertical",label:"Resize the Inspector"}},{tagName:"div",$description:"The Inspector dock. Four tabs — Content · Style · Logic · Assistant (studio.md §12 region ⑨) — all inside this one host.",attributes:{id:"right-panel","data-jx-region":"inspector"}},{tagName:"div",$description:"The app's only status channel: announce what lands in it (studio.md §12 region ⑫).",attributes:{id:"statusbar",role:"status","aria-live":"polite","data-jx-region":"statusbar"}}]};E("shell",ZF);function e_(e){return R("shell",{},e)}var t_={$schema:"https://jxsuite.com/schema/v1",$id:"StudioBootFailure",$description:'What Studio draws INSTEAD of the application frame when a launcher was supposed to register a platform adapter and did not (`platforms/default-platform.ts`\'s `bootRefusal`). It replaces a failure that drew everything: desktop 5.0.0 to 5.1.3 fell back to the dev-server adapter inside a `views://` window, so every panel rendered and the first click said "Failed to fetch". This says so up front instead: what failed, the error the launcher recorded, and the facts a support thread needs, with a Reload for a transient failure and a Copy for everything else. The adapter decides every sentence; the document only draws them. It is the whole page, so it carries a window drag strip of its own — the desktop window hides its title bar, and with no Command Bar mounted there is otherwise nothing to move the window by.',tagName:"div",attributes:{part:"screen",role:"alert"},style:{$description:"Tokens throughout: the screen is mounted before anything but the kit's theme has run, so it can lean on nothing the frame's stylesheets declare. The top padding clears the macOS traffic lights, which sit over the page because the window's title bar is hidden.",position:"fixed",inset:"0",display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"max(10vh, calc(var(--jx-control-h) * 2))",overflowY:"auto",boxSizing:"border-box",background:"var(--jx-bg)",fontFamily:"var(--jx-font-sans)",color:"var(--jx-fg)",'& > [part="drag-strip"]':{$description:"The window's handle. The `app-region-drag` class (shell-frame) makes the strip drag the frameless window, so the rule here sizes it, as tall as the hidden title bar would have been, and repeats the drag region so the strip works even before the shell stylesheet loads.",position:"absolute",top:"0",left:"0",right:"0",height:"calc(var(--jx-control-h) + var(--jx-space-3))","-webkit-app-region":"drag"},'& > [part="content"]':{position:"relative",maxWidth:"40rem",width:"100%",padding:"0 var(--jx-space-6) var(--jx-space-7)",boxSizing:"border-box",display:"flex",flexDirection:"column",gap:"var(--jx-space-4)"},'& > [part="content"] > [part="icon"]':{$description:'The child, not any descendant: `jx-button` renders its own `<span part="icon">` into light DOM unconditionally, so a bare `[part="icon"]` reached the Reload and Copy buttons too. `--jx-icon-size` is a custom property and `color` inherits, so both passed through that span\'s `display: contents` and drew the Copy button\'s clipboard glyph at 32px in warning amber, stretching the actions row with it. This is the collision `[part="error"]` taught: a part name is shared with the kit unless a selector says otherwise.',"--jx-icon-size":"2rem",color:"var(--jx-warning)"},'& [part="title"]':{margin:"0",fontSize:"1.5rem",fontWeight:"400",color:"var(--jx-fg)"},'& [part="lead"]':{margin:"0",fontSize:"var(--jx-text-lg)",lineHeight:"1.5",color:"var(--jx-fg)"},'& [part="detail"]':{$description:"The launcher's own error, verbatim. Selectable, because the point of printing it is that someone pastes it into an issue, and wrapped, because a stack line is wider than any window it is likely to be read in.",margin:"0",padding:"var(--jx-space-3) var(--jx-space-4)",maxHeight:"40vh",overflow:"auto",background:"var(--jx-bg-panel)",border:"1px solid var(--jx-border)",borderRadius:"var(--jx-radius-sm)",fontFamily:"var(--jx-font-mono)",fontSize:"var(--jx-text-sm)",whiteSpace:"pre-wrap",wordBreak:"break-word",userSelect:"text"},'& [part="facts"]':{margin:"0",fontSize:"var(--jx-text-sm)",color:"var(--jx-fg-dim)",wordBreak:"break-all",userSelect:"text"},'& [part="actions"]':{display:"flex",flexWrap:"wrap",gap:"var(--jx-space-3)"}},children:[{tagName:"div",attributes:{part:"drag-strip",class:"app-region-drag","aria-hidden":"true"}},{tagName:"div",attributes:{part:"content"},children:[{tagName:"jx-icon",attributes:{part:"icon"},$props:{name:"warning",weight:"fill"}},{tagName:"h1",attributes:{part:"title"},textContent:"${state.title}"},{tagName:"p",attributes:{part:"lead"},textContent:"${state.lead}"},{tagName:"div",attributes:{part:"detail-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasDetail"},cases:{true:{tagName:"pre",attributes:{part:"detail"},textContent:"${state.detail}"}}},{tagName:"p",attributes:{part:"facts"},textContent:"${state.facts}"},{tagName:"div",attributes:{part:"actions"},children:[{tagName:"jx-button",attributes:{part:"reload"},$props:{variant:"accent"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/reload"},value:[]}]},children:[{tagName:"span",textContent:"Reload"}]},{tagName:"jx-button",attributes:{part:"copy"},$props:{quiet:!0},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/copy"},value:[]}]},children:[{tagName:"jx-icon",attributes:{slot:"icon"},$props:{name:"copy"}},{tagName:"span",textContent:"${state.copied ? 'Copied' : 'Copy details'}"}]}]}]}]};E("boot-failure",t_);function W9(e){if(e.kind==="launcher")return"The desktop app's bridge to its backend failed to start, so nothing can be opened, saved or created; reinstalling the latest release from the download page fixes this.";if(e.kind==="declared")return"This page's startup script never ran, so Studio has no backend to open, save or create projects with.";return`This page was opened from a ${e.protocol} URL, which has no Studio backend behind it; open Studio through the desktop app or a Jx dev server instead.`}function q9(){let e=Av()?.error;if(!e)return"";let{message:t,stack:r}=e;if(!r)return t;return r.includes(t)?r:`${t}
|
|
505
|
+
>${P.lines.map((V)=>k`<p class="dialog-consequence">${V}</p>`)}`,{confirmLabel:"Convert",destructive:!0}))return null;let{markLocalMutation:N}=await (ce("45rhg3me"),import("./chunks/fs-events-45rhg3me.js")),{notifyMoveOutcome:O,settleRename:D}=await (ce("zrqtgt41"),import("./chunks/files-zrqtgt41.js"));N(e,P.targetPath);try{await y.writeFile(e,P.text)}catch(V){return a(`Could not write the converted ${e}.`,o(V))}let M;try{M=await y.renameFile(e,P.targetPath)}catch(V){try{N(e),await y.writeFile(e,S)}catch{}return a(`Could not convert ${e}.`,o(V))}if(c)await p9(e,P.targetPath,P.text);return await D(e,P.targetPath,M),O(f9(P.targetPath,M),M,P.targetPath),P.targetPath}async function p9(e,t,r){let{openTab:o,renameTab:a}=await (ce("6ztqcrsh"),import("./chunks/workspace-6ztqcrsh.js")),{formatForPath:i}=await (ce("9gy76erh"),import("./chunks/format-host-9gy76erh.js"));a(e,t,t);let s=i(t),l,f,c=null;try{if(s){let{parseSourceForPath:b}=await (ce("1sghzgcr"),import("./chunks/file-ops-1sghzgcr.js"));({document:l,frontmatter:f}=await b(t,r))}else({document:l,layout:c}=Es(r))}catch{return}let d={document:l,documentPath:t,id:t,layout:c,sourceFormat:s?.name??null};if(f!==void 0)d.frontmatter=f;o(d)}var $F="Studio converts documents in pages/ and components/ between formats that can both read and write a Jx document. Layouts are JSON only, and a file inside a content collection keeps its collection's format.",u9="It is open in the editor with unsaved changes, and converting it would write over them. Save or discard the changes first.",m9="Rename or delete the existing file first; converting would replace it.";function f9(e,t){let r=t.references,o=e.split("/").pop()??e;return r&&r.refsUpdated>0?`Converted to ${o}; updated ${r.refsUpdated} reference(s) in ${r.filesChanged} file(s)`:`Converted to ${o}`}async function h9(e,t){if(t.length===1)return t[0].ext;let{showPromptDialog:r}=await (ce("m49nmwvx"),import("./chunks/layers-m49nmwvx.js")),o=t[0].ext;return await r("Convert Format",{choice:{initial:o,label:"Convert to",onChange:(i)=>{o=i},options:()=>t.map((i)=>({label:i.label,value:i.ext}))},confirmLabel:"Continue",message:`Converting ${e}.`,select:"none",validate:()=>"",value:e.split("/").pop()??e})===null?null:o}function g9(){return[{args:Se({format:gl(RN,"Extension to convert to. Omitted, Studio asks."),source:Fe("Project-relative path of the file to convert.")},["source"]),category:"File",id:"file.convertFormat",level:"project",menus:["context/file"],group:"1_file",requires:"an open project",when:(e)=>e.project.open,undo:"none",run:async(e,t)=>{let r=n(t.format)?t.format:void 0;await d9(St("file.convertFormat",t,"source"),...r===void 0?[]:[r])},title:"Convert Format…"}]}function PF(e){e.registerAll(g9())}var Nr="rewrite",Il=[...$w,Nr],Wm=301,b9=200;function Do(e){let t=e.trim();return t.length>1&&t.endsWith("/")?t.slice(0,-1):t}function Jm(e){return e.includes(":")||e.includes("*")}function y9(e){return/^[a-z][\d+.a-z-]*:/i.test(e)||e.startsWith("//")}function xw(e,t){let r=Do(e).split("/"),o=Do(t).split("/");for(let[a,i]of r.entries()){if(i==="*")return!0;if(a>=o.length)return!1;if(i.startsWith(":")){if(o[a]==="")return!1;continue}if(i!==o[a])return!1}return o.length===r.length}function EF(e){return e.replaceAll(/\[([^\]]+)]/g,":$1")}function Km(e){return Object.entries(e??{}).map(([t,r])=>{if(n(r))return{destination:r,source:t,status:Wm};if("rewrite"in r)return{destination:r.destination,source:t,status:Nr};let o=r.status??Wm;return{destination:r.destination,source:t,status:o}})}function NF(e){let t={};for(let r of e)if(r.status===Nr)t[r.source]={destination:r.destination,rewrite:!0};else if(r.status===Wm)t[r.source]=r.destination;else t[r.source]={destination:r.destination,status:r.status};return t}function v9(e,t){let r=Do(t);return e.find((o)=>!Jm(o.source)&&Do(o.source)===r)??e.find((o)=>Jm(o.source)&&xw(o.source,r))}function w9(e,t){let r=[t.source],o=new Set([Do(t.source)]),a=t;for(;;){if(Jm(a.destination)||y9(a.destination))return{looped:!1,path:r};let i=v9(e,a.destination);if(r.push(a.destination),!i)return{looped:!1,path:r};let s=Do(i.source);if(o.has(s))return{looped:!0,path:r};o.add(s),a=i}}function jF(e,t){let r=[],o=new Set;for(let a of e){let{looped:i,path:s}=w9(e,a);if(i){let l=[...new Set(s.map((f)=>Do(f)))].toSorted().join(">");if(!o.has(l))o.add(l),r.push({detail:`Following the rules from ${a.source} returns to a source already visited, so a request for it never reaches a page. Break the cycle by pointing one of these rules at a real route.`,message:`Redirect loop: ${s.join(" → ")}`,rule:"loop",source:a.source})}else if(s.length>2)r.push({detail:`Each hop is a separate request and is cached separately, so a visitor pays for the whole chain and a correction to the last hop can be masked by a cached earlier one. Point ${a.source} straight at ${s.at(-1)}.`,message:`Redirect chain: ${s.join(" → ")}`,rule:"chain",source:a.source})}for(let a of e){let i=t.filter((l)=>Jm(a.source)?xw(a.source,EF(l)):xw(EF(l),a.source)),[s]=i;if(s===void 0)continue;r.push({detail:`This project has a page at ${s}${i.length>1?` (and ${i.length-1} more)`:""}. A host that serves static files before consulting _redirects answers with the page and this rule never fires; the build meanwhile writes its meta-refresh file over that page in `+"dist/ and warns (site-architecture.md §11.1). Remove the rule or the page.",message:`Redirect shadowed by a page: ${a.source}`,rule:"shadow",source:a.source})}return r}function RF(e){if(e===void 0||e==="")return Wm;let t=e.trim().replace(/!$/,"");if(t.toLowerCase()===Nr||Number(t)===b9)return Nr;let r=Number(t);return $w.find((o)=>o===r)??null}function x9(e){let t=[],r=[];for(let[o,a]of e.split(/\r?\n/).entries()){let i=a.trim();if(i===""||i.startsWith("#"))continue;let[s,l,f]=i.split(/\s+/);if(!s||!l){r.push(`Line ${o+1}: "${i}" — expected "source destination [status]".`);continue}let c=RF(f);if(c===null){r.push(`Line ${o+1}: "${f}" is not an HTTP status.`);continue}t.push({destination:l,source:s,status:c})}return{errors:r,format:"_redirects",rules:t}}var ww={destination:["destination","to","new","target"],source:["source","from","old","path"],status:["status","code"]};function k9(e){let t=Fd(e),r=[],o=[],a=t.headers.map((b)=>b.trim().toLowerCase()),i=(b)=>a.findIndex((y)=>b.includes(y)),s=i(ww.source),l=i(ww.destination),f=s!==-1&&l!==-1,c=f?t.rows:[t.headers,...t.rows],d=f?{destination:l,source:s,status:i(ww.status)}:{destination:1,source:0,status:2};for(let[b,y]of c.entries()){let x=(y[d.source]??"").trim(),S=(y[d.destination]??"").trim();if(x===""&&S==="")continue;let P=f?b+2:b+1;if(x===""||S===""){r.push(`Row ${P}: both a source and a destination are required.`);continue}let j=RF(d.status===-1?void 0:(y[d.status]??"").trim());if(j===null){r.push(`Row ${P}: "${y[d.status]}" is not one of ${Il.join(", ")}.`);continue}o.push({destination:S,source:x,status:j})}return{errors:r,format:"csv",rules:o}}function AF(e){return e.split(/\r?\n/).map((r)=>r.trim()).find((r)=>r!==""&&!r.startsWith("#"))?.includes(",")?k9(e):x9(e)}var Xm="grid://redirects",Ll="Redirects",$9=[".json",".md",".html"];function S9(){return[{editable:!0,field:"source",kind:"string",required:!0,title:"Source",widthHint:260},{editable:!0,field:"destination",kind:"string",required:!0,title:"Destination",widthHint:260},{editable:!0,field:"status",kind:"enum",schema:{enum:Il.map(String)},title:"Status",widthHint:110}]}function C9(e,t){return{cells:{destination:e.destination,source:e.source,status:String(e.status)},key:String(t)}}function Sw(){return C?.projectConfig?.redirects}function OF(e){let t=e.trim();if(t.toLowerCase()===Nr)return Nr;let r=Number(t);return Number.isInteger(r)?r:t}function T9(e){let t=(r)=>r===null||r===void 0?"":String(r);return{destination:t(e.destination).trim(),source:t(e.source).trim(),status:OF(t(e.status))}}function P9(e){if(e.source==="")return"A source path is required.";if(e.destination==="")return"A destination is required.";if(!Il.includes(e.status))return`Status must be one of ${Il.join(", ")}.`;return null}async function Pw(){let e=p(),t=new Set,r=!0,o=async(a)=>{let i;try{i=await e.listDirectory(a)}catch{r=!1;return}for(let s of i){let l=s.path||`${a}/${s.name}`;if(s.type==="directory")await o(l);else if($9.some((f)=>l.endsWith(f))){let f=cm(l);if(f!==null)t.add(f)}}};return await o("pages"),{complete:r,routes:[...t]}}function jw(e,t){yl((o)=>o.source===Ll);let r=jF(e,t.complete?t.routes:[]);for(let o of r)w(o.rule==="loop"?"error":"warn",o.message,{action:"redirects.open",detail:o.detail,key:`redirects.${o.rule}:${o.source}`,path:an,source:Ll,tier:"problem"});if(!t.complete)return w.warn("Redirects were checked for chains and loops only.",{action:"redirects.validate",detail:"pages/ could not be listed, so this run cannot say whether a rule is shadowed by a real route. Reporting no shadowed rules from an incomplete list would be a guess.",key:"redirects.routes",path:"pages",source:Ll,tier:"problem"}),r.length+1;return r.length}function E9(){let e=()=>Km(Sw());return{backingPaths:()=>new Map([[an,"*"]]),capabilities:{delete:!0,insert:!0,remotePaging:!1,remoteSort:!1},columns:()=>Promise.resolve(S9()),async commit(t){let r=e(),o={cells:[],deletes:[],inserts:[]};for(let d of t.cells){let b=r[Number(d.rowKey)];if(!b){o.cells.push({error:"This row is no longer in project.json — refresh the grid.",field:d.field,ok:!1,rowKey:d.rowKey,stale:!0});continue}let y=d.value===null?"":String(d.value);if(d.field==="status")b.status=OF(y);else if(d.field==="source")b.source=y.trim();else b.destination=y.trim();o.cells.push({field:d.field,ok:!0,rowKey:d.rowKey})}let a=new Set(t.deletes.map((d)=>Number(d.rowKey))),i=r.filter((d,b)=>!a.has(b));for(let d of t.deletes)o.deletes.push({ok:!0,rowKey:d.rowKey});for(let d of t.inserts)i.push(T9(d.cells)),o.inserts.push({ok:!0,tempKey:d.tempKey});let s=new Set,l=[];for(let d of i){let b=P9(d)??(s.has(d.source)?"Duplicate source.":null);if(b)l.push(`${d.source||"(blank)"} — ${b}`);s.add(d.source)}if(l.length>0)return IF(t,l.join(" "));let f={redirects:i.length>0?NF(i):void 0};if(!(await ic(f)).ok)return IF(t,"project.json could not be written — see Problems.");return jw(i,await Pw()),o},id:Xm,label:"Redirects",refresh:()=>Promise.resolve(),rows(){let t=e();return Promise.resolve({rows:t.map((r,o)=>C9(r,o)),total:t.length})}}}function IF(e,t){return{cells:e.cells.map((r)=>({error:t,field:r.field,ok:!1,rowKey:r.rowKey})),deletes:e.deletes.map((r)=>({error:t,ok:!1,rowKey:r.rowKey})),inserts:e.inserts.map((r)=>({error:t,ok:!1,tempKey:r.tempKey}))}}async function LF(){let e=m.tabs.get(Xm);if(e){Ft(Xm);let o=er(e);if(o)return o}let t=e??Si({capabilities:{modes:["grid"]},document:structuredClone(Nb),documentPath:null,id:Xm}),r=$p(t,E9());return await r.load(),r}function N9(){return Fn("Import Redirects",{confirmLabel:"Import",message:"Paste a Netlify/Cloudflare _redirects file, or CSV with source,destination,status columns. "+"Rows are staged for review — nothing is written until you save.",mono:!0,multiline:!0,placeholder:"/old-page /new-page 301",rows:"10",size:"md"})}function j9(e,t,r){let o=new Set(e.effectiveRows().map((l)=>String(l.source??"").trim())),a=[],i=0;for(let l of t){if(o.has(l.source)){a.push(l.source);continue}o.add(l.source),e.addRow({destination:l.destination,source:l.source,status:String(l.status)}),i+=1}let s=[...r,...a.length>0?[`Already in the table, skipped: ${a.join(", ")}.`]:[]];if(s.length>0)w.warn(`Imported ${i} redirect${i===1?"":"s"} · ${s.length} line${s.length===1?"":"s"} not imported.`,{action:"redirects.import",detail:s.join(`
|
|
506
|
+
`),key:"redirects.import",path:an,source:Ll,tier:"problem"});else if(i>0)w.success(`Staged ${i} redirect${i===1?"":"s"} — review, then save.`,{action:"file.save",key:"redirects.import"});else w.info("Nothing to import.",{key:"redirects.import"});return i}function R9(){return[{category:"Project",id:"redirects.open",level:"project",menus:["palette"],group:"5_data",requires:"an open project",when:(e)=>e.project.open,run:async()=>{await LF(),jw(Km(Sw()),await Pw())},title:"Edit Redirects"},{category:"Project",id:"redirects.validate",level:"project",menus:["palette"],group:"5_data",requires:"an open project",when:(e)=>e.project.open,aiTool:{description:"Check the site's redirect rules for chains, loops and rules shadowed by a real page. Reports each finding as a Problem, and returns the findings as data.",name:"validate_redirects",report:()=>{let e=sf(Ll),t=e.length;return{data:e,summary:t===0?"No redirect problems: no chains, loops or shadowed rules.":`Filed ${t} redirect problem${t===1?"":"s"} in Problems.`}}},run:async()=>{let e=Km(Sw());if(jw(e,await Pw())===0)w.success(`${e.length} redirect${e.length===1?"":"s"} checked — no chains, loops or shadowed rules.`,{key:"redirects.validate"})},title:"Validate Redirects"},{args:{additionalProperties:!1,properties:{text:Fe("A _redirects file or CSV to import. Omit it and Studio asks for a paste.")},required:[],type:"object"},category:"Project",id:"redirects.import",level:"project",menus:["palette"],group:"5_data",requires:"an open project",when:(e)=>e.project.open,run:async(e,t)=>{let o=ti("redirects.import",t,"text")??await N9();if(o===null||o.trim()==="")return;let a=AF(o),i=await LF();j9(i,a.rules,a.errors)},title:"Import Redirects…"}]}function MF(e){e.registerAll(R9())}var Ba="file.new",Qm={created:null,opened:null};function A9(e){let t={};if(e.kind!==void 0)t.kind=qn(Ba,e,"kind",xb);let r=ti(Ba,e,"name");if(r!==void 0)t.name=r;let o=ti(Ba,e,"collection");if(o!==void 0)t.collection=o;let a=ti(Ba,e,"locale");if(a!==void 0)t.locale=a;let i=ti(Ba,e,"template");if(i!==void 0)t.template=i;return t}function I9(){let{created:e,opened:t}=Qm;if(e)return{summary:L9(e),wrote:e.wrote};return{summary:`Opened Add new on ${t??"page"} for the person; nothing is created until they confirm. Pass a name to create without the dialog.`,wrote:[]}}function L9(e){switch(e.kind){case"page":return`Created the page ${e.path}${e.route?`, which opens at ${e.route}`:""}, and opened it in Design.`;case"component":return`Created <${e.tag??""}> in ${e.path}; it is listed under Components in the Site panel and open in Design.`;case"template":return`Created the template ${e.path} and opened it in Design.`;case"entry":return`Created the entry ${e.path} and opened it.`;case"collection":return`Created the ${e.path.replace(/^content\//,"")} collection, writing ${e.wrote.join(", ")}.`;default:return`Uploaded ${e.wrote.length===1?"1 file":`${e.wrote.length} files`} to public/media/.`}}function O9(){return[{aiTool:{description:"Create a page, collection, template, component or collection entry, the way Add new does: pass kind and name and it is written and opened, with the path derived from the name (pages/<slug>.json, layouts/<slug>.json, components/<tag>.json, a content/<name>/ collection). Without a name it only opens the Add new dialog for the person.",name:"add_new",report:()=>I9()},args:Se({collection:gl(()=>Bw().map((e)=>e.name),"For an entry: the content collection it is created in."),kind:pi(xb,"What to create: page, collection, template, component, media (an upload) or entry."),locale:Fe("For a page or an entry of a localized collection: the language it is written in, one of the project's i18n locales such as fr-CA. A page in another language is saved in that language's folder and opens under its URL prefix."),name:Fe("The name. A page's URL, a template's file and a component's tag are derived from it. Omit it to open the Add new dialog instead of creating."),template:Fe("The template to start from: a layout such as base or layouts/base.json, article for a Markdown page, or blank for none. A collection uses it for its own page; a template is wrapped in it.")},[]),category:"File",group:"1_file",icon:"plus",id:Ba,keybinding:["mod+n","mod+alt+n"],level:"project",menus:["commandbar/overflow","palette"],requires:"an open project",run:async(e,t)=>{let r=A9(t),o=await (ce("v0pm96mr"),import("./chunks/add-new-flow-v0pm96mr.js"));if(r.name!==void 0){Qm={created:null,opened:null},Qm={created:await o.createDirect({...r,name:r.name}),opened:null};return}Qm={created:null,opened:r.kind??"page"},o.openAddNew(r)},title:"Add New…",undo:"none",when:(e)=>e.project.open}]}function DF(e){e.registerAll(O9())}var Zm="media.browse",M9="media.upload",FF="media.replace",_F="media.rename",zF="media.duplicate",HF="media.delete",BF="media.edit",VF=null,WF=null,qF=null;function Va(){return VF??=(ce("j74rt0w4"),import("./chunks/media-library-j74rt0w4.js")),VF}function D9(){return WF??=(ce("rse9h8a0"),import("./chunks/workspace-home-rse9h8a0.js")),WF}function F9(){return qF??=(ce("mypr0k6b"),import("./chunks/media-open-mypr0k6b.js")),qF}function qa(e,t,r){let o=St(e,t,r).replace(/^\.\//,"");if(!zd(o))throw RangeError(`command "${e}": "${o}" is not a media file (an image, video, audio, PDF or font).`);return o}function _9(e){let t={};if(e.filter!==void 0)t.filter=qn(Zm,e,"filter",lS);let r=ti(Zm,e,"query");if(r!==void 0)t.query=r;if(e.select!==void 0)t.select=qa(Zm,e,"select");return t}async function Iw(){let{openWorkspaceHome:e}=await D9();e("media")}var Wa="The media file's project path, such as public/media/hero.jpg.";function z9(){let e={category:"Project",group:"1_media",level:"project",menus:["palette"],requires:"an open project",when:(t)=>t.project.open};return[{...e,args:Se({filter:pi(lS,"Which media to show: all, image, video, audio, document, font, or unused (files no document references)."),query:Fe("Search the media by name or path."),select:Fe(`A file to select and describe. ${Wa}`)},[]),icon:"image",id:Zm,run:async(t,r)=>{let o=_9(r);(await Va()).applyMediaBrowse(o),await Iw()},title:"Browse Media",undo:"none"},{...e,icon:"upload-simple",id:M9,run:async()=>{let t=await Va();await Iw(),t.requestMediaUpload()},title:"Upload Media…",undo:"none"},{...e,args:Se({path:Fe(`The file to replace. ${Wa}`)},["path"]),icon:"arrows-clockwise",id:FF,run:async(t,r)=>{let o=qa(FF,r,"path"),a=await Va();await Iw(),a.requestMediaReplace(o)},title:"Replace Media File…",undo:"none"},{...e,args:Se({path:Fe(`The image to edit: a PNG, JPEG or WebP. ${Wa}`)},["path"]),icon:"crop",id:BF,requires:"an open project, on a backend that can read a file's raw bytes",run:async(t,r)=>{let o=qa(BF,r,"path");(await F9()).openImageEditor(o)},title:"Edit Image…",undo:"none",when:(t)=>t.project.open&&t.capability.readFileBytes},{...e,args:Se({path:Fe(`The file to rename. ${Wa}`)},["path"]),icon:"pencil-simple",id:_F,run:async(t,r)=>{let o=qa(_F,r,"path");await(await Va()).renameMediaFile(o)},title:"Rename Media File…",undo:"none"},{...e,args:Se({path:Fe(`The file to copy. ${Wa}`)},["path"]),icon:"copy",id:zF,requires:"an open project, on a backend that can read a file's raw bytes",run:async(t,r)=>{let o=qa(zF,r,"path");await(await Va()).duplicateMediaFile(o)},title:"Duplicate Media File",undo:"none",when:(t)=>t.project.open&&t.capability.readFileBytes},{...e,args:Se({path:Fe(`The file to delete. ${Wa}`)},["path"]),destructive:!0,group:"9_danger",icon:"trash",id:HF,run:async(t,r)=>{let o=qa(HF,r,"path");await(await Va()).deleteMediaFile(o)},title:"Delete Media File…",undo:"none"}]}function UF(e){e.registerAll(z9())}function Ow(){return Ts()?.locales??[]}var JF=!1;function GF(e,t){let r=ti(e,t,"path"),o=ti(e,t,"pane");if(r!==void 0){if(o!==void 0)throw RangeError(`command "${e}" argument "path": names a file while "pane" names a pane — give one`);return r}let a=o===void 0?h.value:bt(o);if(!a)throw RangeError(o===void 0?`command "${e}" needs a document open`:`command "${e}" argument "pane": no document is open in pane "${o}"`);if(a.documentPath===null)throw RangeError(`command "${e}" needs a document that has been saved to a file`);return a.documentPath}function KF(e,t){let r=Ts(),o=Qc(e,t,r);if(o!==null)return o;if(r===null||!r.locales.includes(t))return w.error(`This project does not declare ${Wt(t)}.`,{action:"settings.open",actionArgs:{section:"locales"},detail:"Add it in Settings › Locales, or with the Add Language command.",source:"Languages"}),null;return w.error(`${e} cannot have a translation.`,{detail:"A translation is the same file under a locale directory, so only files that live under a "+"routed directory — pages and content entries — have one. A layout, a component or a file "+"at the project root is shared by every language.",path:e,source:"Languages"}),null}async function YF(e){try{return await p().readFile(e),!0}catch{return!1}}var XF={pane:Fe("Pane whose document to translate. Defaults to the focused one."),path:Fe("Project-relative path of the document to translate. Defaults to the addressed pane's document; not combined with `pane`.")};function H9(){return[{args:Se({locale:gl(Ow,"The language to open this document's translation in."),...XF},["locale"]),category:"File",id:"i18n.openTranslation",level:"document",menus:["context/tab","palette"],group:"2_navigate",requires:"a document open in a project that declares more than one language",when:(e)=>e.project.isMultilingual&&e.document.open,run:async(e,t)=>{let r=GF("i18n.openTranslation",t),o=St("i18n.openTranslation",t,"locale"),a=KF(r,o);if(a===null)return;if(a===r){w.info(`${r} is already the ${Wt(o)} copy.`,{source:"Languages"});return}if(!await YF(a)){w.warn(`There is no ${Wt(o)} translation of this document yet.`,{action:"i18n.createTranslation",actionArgs:{locale:o,path:r},detail:`Create Translation writes ${a}, seeded from the document you are on.`,path:a,source:"Languages"});return}let{openFileInTab:i}=await (ce("zrqtgt41"),import("./chunks/files-zrqtgt41.js"));await i(a)},title:"Open Translation"},{args:Se({locale:gl(Ow,"The language to create this document's translation in."),...XF},["locale"]),category:"File",id:"i18n.createTranslation",level:"document",menus:["palette"],group:"2_navigate",requires:"a document open in a project that declares more than one language",when:(e)=>e.project.isMultilingual&&e.document.open,undo:"none",run:async(e,t)=>{let r=GF("i18n.createTranslation",t),o=St("i18n.createTranslation",t,"locale"),a=KF(r,o);if(a===null)return;if(await YF(a)){w.info(`The ${Wt(o)} translation already exists.`,{action:"i18n.openTranslation",actionArgs:{locale:o,path:r},path:a,source:"Languages"});return}let i;try{i=await p().readFile(r)}catch{w.error(`Could not read ${r} to copy it.`,{path:r,source:"Languages"});return}let s=a.lastIndexOf("/"),{createFileIn:l,openFileInTab:f}=await (ce("zrqtgt41"),import("./chunks/files-zrqtgt41.js")),c=await l({content:i,dir:s===-1?".":a.slice(0,s),source:"Languages",suggestedName:a.slice(s+1),title:`New ${Wt(o)} translation`});if(c!==null)await f(c)},title:"Create Translation"},{category:"View",id:"i18n.showParity",level:"project",menus:["commandbar/overflow","palette"],group:"2_view",requires:"a project that declares more than one language",when:(e)=>e.project.isMultilingual,run:()=>{Kc("i18n")},title:"Show Translation Parity"},{args:Se({locale:Fe("A BCP 47 language tag to declare — `fr`, `pt-BR`, `zh-Hant`. Canonicalized on the way "+"in; a malformed tag is refused rather than written.")}),category:"Project",id:"i18n.addLocale",level:"project",menus:["palette"],group:"7_settings",requires:"an open project",when:(e)=>e.project.open,undo:"project",aiTool:{description:"Declare a language for this project, adding it to project.json's i18n.locales. Every other language surface reads that list. Canonicalizes the tag; a malformed one is refused.",name:"add_project_locale",report:({args:e})=>{let t=jn(St("i18n.addLocale",e,"locale"))??"",r=Ow().join(", ")||t;return JF?`Declared ${t}; project locales are now ${r}.`:{summary:`${Wt(t)} was already one of this project's languages; the locales are ${r}.`,wrote:[]}}},run:async(e,t)=>{let r=St("i18n.addLocale",t,"locale");if(jn(r)===null)throw RangeError(`command "i18n.addLocale" argument "locale": "${r}" is not a well-formed BCP 47 `+"tag — a language, optionally a script and a region: fr, pt-BR, zh-Hant");JF=await AP(r)},title:"Add Language"}]}function QF(e){e.registerAll(H9())}var ZF={$schema:"https://jxsuite.com/schema/v1",$id:"StudioShell",$description:"The application frame: the one definition of what Studio's shell IS. Every cell here is a HOST another surface mounts into, and each is addressed by id because TypeScript adopts it (`store.ts`'s initShellRefs, `ui/panel-resize.ts`'s handles) — so the ids are a contract rather than styling, which is also why this document carries no style of its own: the frame must be laid out by the first paint, so its rules are the generated `styles/shell-frame.css` (specs/studio-ui-guidelines.md §1.1).",tagName:"div",attributes:{id:"app"},children:[{tagName:"div",attributes:{id:"toolbar","data-jx-region":"commandbar"}},{tagName:"div",$description:"The PANE GRID (studio.md §18.1). One cell per pane, each holding that pane's own strip, jump bar, chrome layer and stage — the four surfaces that used to be flat siblings of THIS grid, which is to say application rows that only ever described one pane. There is nothing to see here in markup: panels/pane-grid.ts reconciles the cells against workspace.panes, because how many there are is a fact about the workspace and a single div can only ever be one of them.",attributes:{id:"pane-grid"}},{tagName:"div",attributes:{id:"activity-bar","data-jx-region":"rail"}},{tagName:"div",attributes:{id:"left-panel","data-jx-region":"navigator","data-jx-scroller":""}},{tagName:"jx-split",attributes:{id:"resize-left",class:"resize-handle"},$description:'`jx-split` (ui.md §5.5): role="separator", a tab stop, aria-valuenow and its own arrow keys, Home/End and Enter — the door this handle owed a keyboard user, which a bare div driven by pointer events could not give (SC 2.1.1). Its share of the app box, its bounds and its reset point are all written by `ui/panel-resize.ts`, because the frame carries no scope: a dock is sized in PIXELS and persisted that way, so the px↔share arithmetic — and the window-resize listener that keeps it honest — is that adapter\'s, in one place for all three.',$props:{orientation:"vertical",label:"Resize the Navigator"}},{tagName:"jx-split",$description:"The Bottom dock (⌘J). It sits in the PANE's column, under the stage and above the status bar, so opening it never narrows the Navigator or the Inspector (studio.md §12 region ⑪). Its handle resizes on the other axis; panels/bottom-dock.ts stamps dock.bottom on this host while it is open, and nothing while it is closed. `jx-split` (ui.md §5.5): role=\"separator\", a tab stop, aria-valuenow and its own arrow keys, Home/End and Enter — the door this handle owed a keyboard user, which a bare div driven by pointer events could not give (SC 2.1.1). Its share of the app box, its bounds and its reset point are all written by `ui/panel-resize.ts`, because the frame carries no scope: a dock is sized in PIXELS and persisted that way, so the px↔share arithmetic — and the window-resize listener that keeps it honest — is that adapter's, in one place for all three.",attributes:{id:"resize-bottom",class:"resize-handle resize-handle-row"},$props:{orientation:"horizontal",label:"Resize the Bottom dock"}},{tagName:"div",attributes:{id:"bottom-dock"}},{tagName:"jx-split",attributes:{id:"resize-right",class:"resize-handle"},$description:'`jx-split` (ui.md §5.5): role="separator", a tab stop, aria-valuenow and its own arrow keys, Home/End and Enter — the door this handle owed a keyboard user, which a bare div driven by pointer events could not give (SC 2.1.1). Its share of the app box, its bounds and its reset point are all written by `ui/panel-resize.ts`, because the frame carries no scope: a dock is sized in PIXELS and persisted that way, so the px↔share arithmetic — and the window-resize listener that keeps it honest — is that adapter\'s, in one place for all three.',$props:{orientation:"vertical",label:"Resize the Inspector"}},{tagName:"div",$description:"The Inspector dock. Four tabs — Content · Style · Logic · Assistant (studio.md §12 region ⑨) — all inside this one host.",attributes:{id:"right-panel","data-jx-region":"inspector"}},{tagName:"div",$description:"The app's only status channel: announce what lands in it (studio.md §12 region ⑫).",attributes:{id:"statusbar",role:"status","aria-live":"polite","data-jx-region":"statusbar"}}]};E("shell",ZF);function e_(e){return R("shell",{},e)}var t_={$schema:"https://jxsuite.com/schema/v1",$id:"StudioBootFailure",$description:'What Studio draws INSTEAD of the application frame when a launcher was supposed to register a platform adapter and did not (`platforms/default-platform.ts`\'s `bootRefusal`). It replaces a failure that drew everything: desktop 5.0.0 to 5.1.3 fell back to the dev-server adapter inside a `views://` window, so every panel rendered and the first click said "Failed to fetch". This says so up front instead: what failed, the error the launcher recorded, and the facts a support thread needs, with a Reload for a transient failure and a Copy for everything else. The adapter decides every sentence; the document only draws them. It is the whole page, so it carries a window drag strip of its own — the desktop window hides its title bar, and with no Command Bar mounted there is otherwise nothing to move the window by.',tagName:"div",attributes:{part:"screen",role:"alert"},style:{$description:"Tokens throughout: the screen is mounted before anything but the kit's theme has run, so it can lean on nothing the frame's stylesheets declare. The top padding clears the macOS traffic lights, which sit over the page because the window's title bar is hidden.",position:"fixed",inset:"0",display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"max(10vh, calc(var(--jx-control-h) * 2))",overflowY:"auto",boxSizing:"border-box",background:"var(--jx-bg)",fontFamily:"var(--jx-font-sans)",color:"var(--jx-fg)",'& > [part="drag-strip"]':{$description:"The window's handle. The `app-region-drag` class (shell-frame) makes the strip drag the frameless window, so the rule here sizes it, as tall as the hidden title bar would have been, and repeats the drag region so the strip works even before the shell stylesheet loads.",position:"absolute",top:"0",left:"0",right:"0",height:"calc(var(--jx-control-h) + var(--jx-space-3))","-webkit-app-region":"drag"},'& > [part="content"]':{position:"relative",maxWidth:"40rem",width:"100%",padding:"0 var(--jx-space-6) var(--jx-space-7)",boxSizing:"border-box",display:"flex",flexDirection:"column",gap:"var(--jx-space-4)"},'& > [part="content"] > [part="icon"]':{$description:'The child, not any descendant: `jx-button` renders its own `<span part="icon">` into light DOM unconditionally, so a bare `[part="icon"]` reached the Reload and Copy buttons too. `--jx-icon-size` is a custom property and `color` inherits, so both passed through that span\'s `display: contents` and drew the Copy button\'s clipboard glyph at 32px in warning amber, stretching the actions row with it. This is the collision `[part="error"]` taught: a part name is shared with the kit unless a selector says otherwise.',"--jx-icon-size":"2rem",color:"var(--jx-warning)"},'& [part="title"]':{margin:"0",fontSize:"1.5rem",fontWeight:"400",color:"var(--jx-fg)"},'& [part="lead"]':{margin:"0",fontSize:"var(--jx-text-lg)",lineHeight:"1.5",color:"var(--jx-fg)"},'& [part="detail"]':{$description:"The launcher's own error, verbatim. Selectable, because the point of printing it is that someone pastes it into an issue, and wrapped, because a stack line is wider than any window it is likely to be read in.",margin:"0",padding:"var(--jx-space-3) var(--jx-space-4)",maxHeight:"40vh",overflow:"auto",background:"var(--jx-bg-panel)",border:"1px solid var(--jx-border)",borderRadius:"var(--jx-radius-sm)",fontFamily:"var(--jx-font-mono)",fontSize:"var(--jx-text-sm)",whiteSpace:"pre-wrap",wordBreak:"break-word",userSelect:"text"},'& [part="facts"]':{margin:"0",fontSize:"var(--jx-text-sm)",color:"var(--jx-fg-dim)",wordBreak:"break-all",userSelect:"text"},'& [part="actions"]':{display:"flex",flexWrap:"wrap",gap:"var(--jx-space-3)"}},children:[{tagName:"div",attributes:{part:"drag-strip",class:"app-region-drag","aria-hidden":"true"}},{tagName:"div",attributes:{part:"content"},children:[{tagName:"jx-icon",attributes:{part:"icon"},$props:{name:"warning",weight:"fill"}},{tagName:"h1",attributes:{part:"title"},textContent:"${state.title}"},{tagName:"p",attributes:{part:"lead"},textContent:"${state.lead}"},{tagName:"div",attributes:{part:"detail-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasDetail"},cases:{true:{tagName:"pre",attributes:{part:"detail"},textContent:"${state.detail}"}}},{tagName:"p",attributes:{part:"facts"},textContent:"${state.facts}"},{tagName:"div",attributes:{part:"actions"},children:[{tagName:"jx-button",attributes:{part:"reload"},$props:{variant:"accent"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/reload"},value:[]}]},children:[{tagName:"span",textContent:"Reload"}]},{tagName:"jx-button",attributes:{part:"copy"},$props:{quiet:!0},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/copy"},value:[]}]},children:[{tagName:"jx-icon",attributes:{slot:"icon"},$props:{name:"copy"}},{tagName:"span",textContent:"${state.copied ? 'Copied' : 'Copy details'}"}]}]}]}]};E("boot-failure",t_);function W9(e){if(e.kind==="launcher")return"The desktop app's bridge to its backend failed to start, so nothing can be opened, saved or created; reinstalling the latest release from the download page fixes this.";if(e.kind==="declared")return"This page's startup script never ran, so Studio has no backend to open, save or create projects with.";return`This page was opened from a ${e.protocol} URL, which has no Studio backend behind it; open Studio through the desktop app or a Jx dev server instead.`}function q9(){let e=Av()?.error;if(!e)return"";let{message:t,stack:r}=e;if(!r)return t;return r.includes(t)?r:`${t}
|
|
507
507
|
${r}`}function U9(e,t=location){let r=q9(),o=(e.kind==="launcher"?e.launcher:void 0)??Av()?.launcher??"none",[a]=t.href.split(/[?#]/u);return{detail:r,facts:`${Rl} bundle ${Hm} (${Bm}) · launcher ${o} · ${a}`,hasDetail:r!=="",lead:W9(e),title:"Jx Studio couldn't connect to its backend"}}function J9(e){return[e.title,e.lead,e.detail,e.facts].filter(Boolean).join(`
|
|
508
508
|
|
|
509
509
|
`)}function n_(e,t,r=location){let o=U9(t,r),a=g({...o,copied:!1,async copy(){try{await navigator.clipboard.writeText(J9(o)),a.copied=!0}catch{}},reload(){location.reload()}});return R("boot-failure",a,e)}function G9(){return Wr`
|
|
@@ -530,5 +530,5 @@ ${r}`}function U9(e,t=location){let r=q9(),o=(e.kind==="launcher"?e.launcher:voi
|
|
|
530
530
|
></div>
|
|
531
531
|
`}async function r_(e=document.body){let t=a_(e);t.textContent="",delete t._$litPart$,await e_(t),io(G9(),t)}async function o_(e,t=document.body){let r=a_(t);r.textContent="",delete r._$litPart$,await n_(r,e)}function a_(e){let t=e.querySelector("#shell-root");if(t)return t;let r=document.createElement("div");return r.id="shell-root",e.append(r),r}zw();w2(import.meta.url);var s_={fileExists:async(e)=>{try{return await p().readFile(e),!0}catch{return!1}},loadDiff:tL,openFileInPane:MS};function Ua(){return Vo(m.activePaneId)}function Fo(e,t){if(!e)return;if(ka(e)==="git-diff"&&t!=="git-diff")u.git.diffState=null;if(e.session.ui.canvasMode=t,e.documentPath===an)Uh(t)}async function Ol(e){let t=h.value,r=oc(qr().id),o=[...m.tabs.values()].some((i)=>i.documentPath===e);await _i(e,{paneId:r.id,preview:!0});let a=bt(r.id);if(!o&&t&&a&&a.documentPath===e)a.session.openedFrom={documentPath:t.documentPath,tabId:t.id};Kc("layers")}YR($v);if(!ye())try{MI(q1())}catch(e){if(e instanceof Eu)await o_(e.refusal);throw e}K1();FI();await r_();PM();xO();gL(of(RI,"toolbar"),{closeFunctionEditor:()=>Q_(),getCanvasMode:Ua,openProject:()=>Mw(),openRecentProject:(e)=>Rr(e),renderCanvas:()=>$t(),safeRenderRightPanel:()=>X9(),saveFile:()=>Ip(),setCanvasMode:Fo});Z$();EA();jE({openRecentProject:(e)=>Rr(e)});await WE();var l_=VE(fi);SD(l_?.strip??document.createElement("div"));function c_(e,t){if(t==="media")YE(e);else if(t==="publish")PE(e)}IE(l_?.chrome??document.createElement("div"),{exportFile:YT,parseMediaEntries:Hr,setCanvasMode:Fo,closeTab:ab,focusHome:c_});mx(fd);q$({isEditing:KA,renderBlockActionBar:qy});nD({getCanvasMode:Ua,navigateToComponent:Ol});y$(qy);w$(oD);p$(hS);f$(mD);DO(async(e,t)=>{if(Dw(),Rd(),rb(),await rl(e),Ar(),t!==void 0)for(let r of m.panes)$t(r.id)});m$(gS);g$(bS());b$((e,t)=>{if(e)Ld(e,t);else u.stylebook.selection=null,vl(h.value,{ui:{activeSelector:null}})});document.addEventListener("pointerdown",(e)=>{if(rD(e.target))return;if(nc().editing)yx();if(!(e.target instanceof Node)||nd(e.target)===null)iD()},!0);function K9(){for(let e of m.tabs.values())if(e.doc.dirty||ef(e)||al(e))return!0;return!1}window.addEventListener("beforeunload",(e)=>{if(wO(),K9())e.preventDefault()});uS({renderOverlays:iS,scheduleCanvasRender:Br});x$(Br);hO();eS({get gitDiffState(){return u.git.diffState},openFileFromTree:Z9,setCanvasMode:Fo,setGitDiffState:(e)=>{u.git.diffState=e}});Kk({addExistingRepo:async()=>{let e=await Ak();if(e)qS().then(()=>{sr()}),Rr(e.root)},cloneRepository:()=>JS({openRecentProject:Rr}),openNewProject:(e)=>{dw(e)},openProject:()=>Mw(),openRecentProject:(e)=>Rr(e)});function Y9(e){XD(e,s_),te(()=>{let t=bt(e);if(t&&fS(t.doc.document,e))return;Br(e)}),te(()=>{let t=bt(e),r=pn(e)?.derived;if(r?.status,r?.reason,r?.kind==="lens")r.mode,r.media;if(t)t.doc.mode,t.session.ui.canvasMode,t.session.ui.editingFormula,t.session.ui.editingFunction,t.session.ui.featureToggles,t.session.ui.preview,t.session.ui.previewParams,t.session.ui.previewProps,t.session.ui.showLayout;u.stylebook.filter,u.stylebook.customizedOnly,Br(e)}),te(()=>{let t=bt(e)?.session.ui.previewColorScheme;T$(t==="light"||t==="dark"?t:null,bo(e).wrap)}),te(()=>{let t=bt(e),r=Hp(t?.session.ui.previewLocale,t?.documentPath);L$(r,bo(e).wrap)})}var tf=new Map;te(()=>{let e=new Set(m.panes.map((t)=>t.id));for(let[t,r]of tf)if(!e.has(t))r.stop(),tf.delete(t);for(let t of e){if(tf.has(t))continue;let r=me();tf.set(t,r),r.run(()=>{Y9(t)})}});eE({getCanvasMode:Ua,mountAssistant:(e)=>SL(e),navigateToComponent:Ol,renderCanvas:()=>$t()});IN(Rr);qN(N1);TL();nL({cloneRepository:()=>{JS({openRecentProject:Rr})},setCanvasMode:Fo,setGitDiffState:(e)=>{u.git.diffState=e}});_L({defBadgeLabel:UE,defCategory:Wl,defaultDef:ah,getCanvasMode:Ua,navigateToComponent:Ol,registerComponentsDnD:cO,registerElementsDnD:dO,registerLayersDnD:lO,renderCanvas:()=>$t(),refreshData:()=>{let e=m.activePaneId;r$(e);let t=h.value;if(t)t.session.canvas.refreshing=!0;$t(e)},mountSignalsPanel:YD,setCanvasMode:Fo,webdata:$v});og("leftPanel",()=>xl());og("canvas",()=>$t());og("rightPanel",()=>tb());og("seoModal",Cl);og("chatPanel",()=>CL());og("overlays",()=>wi());Yf();BS();aL();function X9(){tb()}QO(Ju);eM(KT);tM((e)=>{w.warn(e,{key:"collab.freeze",source:"Collaboration"})});var i_=null;function nf(){i_?.(),i_=tI({invalidateDerivedCaches:(e,t=!0)=>{KD(),tw(),rb(e);let r=FA(e,t);if(r.scan)Rd();if(r.pages)Gb(),cb();if(r.entries)lT(),yC();if(e===void 0||e.some((o)=>kT(o)))Dw();AA(),BE()},onContentChange:AT,onResyncContent:OT,renderLeftPanel:Ar})}var lf=new URLSearchParams(location.search),Rn=lf.get("project")||lf.get("open");if(!Rn)p().activate().catch((t)=>{if(!fA(t))console.error("Boot activation failed:",t)}).then(()=>{sr()});if(Rn)if(!(Rn.startsWith("/")||Rn.startsWith("~")||/^[A-Za-z]:[/\\]/.test(Rn)))w.error(`?project= requires an absolute path (got "${Rn}").`,{key:"startup.projectParam",source:"Startup"}),sr();else{sr();let t=p();(async()=>{let r=lf.get("file")||Rn;try{let o=await t.resolveSiteContext(Rn);if(o.sitePath){if(o.sitePath)t.projectRoot=o.sitePath,await t.activate();Wp(),Um(),id({dirs:new Map,expanded:new Set,isSiteProject:!0,name:o.projectConfig?.name||"Project",projectConfig:o.projectConfig||null,projectDirs:[],projectRoot:o.sitePath,root:o.sitePath,searchQuery:"",selectedPath:o.fileRelPath||null}),rc(o.sitePath,o.projectConfig||null),sc(t),await Rm(),await Lb(),await Ea(),await Em(),nf(),Im(o.sitePath)}let a=lf.get("file")||(o.fileRelPath&&!o.fileRelPath.endsWith("project.json")?o.fileRelPath:null);if(!a){if(await Ib(),h.value){sr(),Ar();return}}if(r=a??o.fileRelPath??Rn,r==="project.json"||r.endsWith("/project.json"))r=await DS()??"project.json";let i=await t.readFile(r);if(i){let s,l,f,c=null;await jt();let d=fn(r);if(d||!r.endsWith(".json")){let b=await Fr(r,i);l=b.document,{frontmatter:s}=b,f=b.mode}else({document:l,layout:c}=Es(i));if(Si({id:r,documentPath:r,document:l,...s!=null&&{frontmatter:s},layout:c,sourceFormat:d?.name??null}),f==="content"&&h.value)h.value.doc.mode="content";if(r==="project.json"&&h.value)h.value.session.ui.canvasMode="stylebook";sr()}Ix(m.projectRoot)}catch(o){w.error(`Could not open ${r||"the project"}.`,{detail:X(o),path:r,source:"Open File"})}})()}else Q9(),sr(),nf();DN().then(()=>{Wv(),sr()});qS().then(()=>{sr()});Hd().then(()=>{WL(),sr()});LO().then(()=>{sr()});Bp(()=>{sr()});$O();globalThis.addEventListener("beforeunload",()=>{EO()});function Ar(){xl()}function Q9(){return $T()}async function Mw(e="thisWindow"){if(Rk()){let o=await Ik();if(!o)return"cancelled";return qS().then(()=>{sr()}),Rr(o.root),"opened"}let t=p();if(e==="newWindow"&&t.pickProject&&t.openProjectInNewWindow){let o=await t.pickProject();if(!o)return"cancelled";let{focused:a}=await t.openProjectInNewWindow(o.root);return a?"focused":"newWindow"}if(!await gE("Opening another project"))return"cancelled";let r=await IT({renderLeftPanel:Ar,resetProjectCaches:d_});return nf(),r?"opened":"cancelled"}function d_(){bD(),RD(),HA(),cb(),lT(),yC(),wT(),Gh(),vk(),P$(),Dw(),ZE()}async function Rr(e){let t=qs({title:`Opening ${e.split("/").pop()||e}`,source:"Open Project",steps:["Sync with the remote","Install dependencies","Read the project","Open the home page"]});try{let r=p();if(C&&r.openProjectInNewWindow){await r.openProjectInNewWindow(e),t.done("Opened in another window");return}if(!await gE("Opening another project")){t.done("Kept the current project");return}if(r.setWindowProject){if((await r.setWindowProject(e)).deduped){t.done("Already open in another window");return}}r.projectRoot=e,Fb(),Rx(),d_(),Ih(),jt(),sc(r);let o=await r.readFile("project.json"),a=JSON.parse(o);_I(),Wp(),Um(),id({...C,dirs:new Map,expanded:new Set,isSiteProject:!0,name:a.name||e.split("/").pop(),projectConfig:a,projectRoot:e,searchQuery:"",selectedPath:null}),rc(e,a),t.step("Sync with the remote"),await Rm(),t.step("Install dependencies"),await Lb(),t.step("Read the project"),await Em(),await Ea(),Aw(_n().name,e),Ar(),t.step("Open the home page"),await Ib(),nf(),t.done(`Opened ${_n().name}`),Im(e)}catch(r){RS(e),Wv(),sr(),t.log(X(r)),t.fail(`Could not open the project at ${e}.`,{path:e})}}function Z9(e){return _i(e)}var p_=(e)=>({applyTransform:()=>Gs(e),canvasMode:Vo(e.paneId),panX:e.panX,panY:e.panY,setPan:(t,r)=>{e.panX=t,e.panY=r,e.needsCenter=!1}}),fe=nb({getContext:Q1({aiConfigured:zb,aiStreaming:wu,aiWaiting:wv,canvasMode:Ua,isCaretActive:v$,isModalOpen:sv,platform:()=>ye()?p():null})});JP(fe,{buildSite:()=>mL(),openInBrowser:()=>uL(),openProject:Mw,saveDocument:async()=>{let e=h.value;if(!e)return;if(await nu(e),await Ip(e),!ef(e))Vx(e.id)}},p_);kI(fe,{openFile:_i,openFileInPane:async(e,t)=>{await MS(e,t),dF(e,t)}});fe.registerAll(QD(s_));var u_={openHome:(e)=>{uE(e)},openStyles:()=>{bn()},placeHome:hE,setInspectorTab:(e)=>Iu(e)};mF(u_);function m_(e){uF(e,u_)}DT(m_);CO(fe,{panelAvailable:(e)=>{let t=Np(e);return t?t.when?.(fe.context())??!0:!0},inspectorTab:()=>Hl(),restingInspectorTab:()=>tE(),setInspectorTab:(e)=>Iu(e),showWorkspace:m_});fe.registerAll(kE({closeTab:ab,focusHome:c_,setCanvasMode:Fo}));aO(fe,{getCanvasMode:Ua,renderPane:$t,setCanvasMode:Fo,setOpenPopover:sE,setOpenDialog:rE,setResolvingOpen:zE});var eY=GE({notify:w,redefineOnCanvases:oS,workspace:m});JT((e,t,r)=>{if(XT(e),yC(),aN(e,Ul(r)))Ar();if(eY(e,t),ev(e,t))bm(),Ar()});fe.registerAll(kx());lD();cS(fe);JD(fe);eF(fe);iF(fe);WN(fe);fe.registerAll(uD());dD(Ol);WD(fe,{renderLeftPanel:Ar});ZD(fe);qD(fe);zT(fe);MP(fe);lP(fe);Qj(fe);kF(fe);PF(fe);oT(fe);DF(fe);UF(fe);QF(fe);PD(fe);ZR(fe);bL(fe);FD(fe);ik(fe);MF(fe);yF(fe);wF(fe);fe.registerAll(L1());Uy(fe,{convertToComponent:dm,navigateToComponent:Ol});fe.registerAll(iE());GP(fe,p_);D$(()=>({chords:tD(fe.keymap,Y1,X1),mac:fe.keymap.mac}),(e)=>fe.keymap.onChange(e));ZN({registry:fe,seedAssistantMessages:j1,seedPublishConnected:NE});export{K9 as hasUnsavedTabs};
|
|
532
532
|
|
|
533
|
-
//# debugId=
|
|
533
|
+
//# debugId=1F4A8031AE986AF464756E2164756E21
|
|
534
534
|
//# sourceMappingURL=studio.js.map
|