@jxsuite/studio 8.0.0 → 8.0.1
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/studio.js +3 -3
- package/package.json +6 -6
package/dist/studio.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Q}from"./chunks/studio-nqxqf8p2.js";import{xb,mN,CS,bN,Yu,Zn,Cp,Mw,Pw,QT,vN}from"./chunks/studio-5g0rprdt.js";import{pt,Go,Ap,DA,Cr,Op,AA,OA}from"./chunks/studio-s32578pn.js";import{lI,Tv,p,_e}from"./chunks/studio-w4rz9hdk.js";import{ge,ne,Jr,Yr,g,he,Na,qx,Qp,dr,na,C,Lh,ul,ef,Sv}from"./chunks/studio-43sd2mam.js";import{Es,ko,WL,eC,Kl,XN,to,Sr,Zw,Ts,Rp,ol,no,nC,ix,GL,KL,ox,Vc,JL,rx,iA,YL,oC,rC,oA,h,Fd,sx,sA,XL,sC,_m,Ob,Mb,aA,Eo,lA,Uc,sh,QL,cA,ax,dA}from"./chunks/studio-d5grtb9e.js";import{Fn,vx,Vt,Qt,Hi,ev,Xc,tv,nv,Wp,Xl,ll,iv,Dm,Qs,iO,_x,mh,Sx,ov,oO,Nm,Cx,CC,rv,ho,bo,kx,gh,Ex,rO,A$,sO,aO,lO,kC,cO,EC,dO,Am,ln,TC,O$,hO,Me,mO,gO,Y,qd,Ix,Rx,LC,bO,vO,yO,$C,wO,Lo,Fm,Dx,Qc,Ve,Gd,Ia,Ox,Ln,St,Xn,zi,Vn,IO,F$,Se,di,cl,$o,Px,RO,We,Un,ed,uv,OO,MO,PO,FO,B$,z$,ui,W$,m,u,Kr,fn,Ql,Lr,ec,AC,OC,MC,tc,Yd,PC,_i,Zd,U$,Bt,G$}from"./chunks/studio-c05wdnt3.js";import{st,HO,vo,xh,qp,nd,BO,zO,WO,K$,Gp,fv,mv,Xd,Kp,Qd,Jp}from"./chunks/studio-kt3pjkwd.js";import{qm,tf,Cv,Ot,$h,kv,Gx,ic,Wi,cn}from"./chunks/studio-z97c48fk.js";import"./chunks/studio-8tr6cfrc.js";import{QS,Ae,_a,Ab,zc}from"./chunks/studio-fbhxxc5f.js";import{_b,vt,zr,kS,Pc,Uo,nl,Zu,Fc,TS,xN,_N,LS,SN,Cb,ci,mm,eL,Vl,Ul,eh,kN,jc,th,kb,kp,DS,TN,AS,nL,LN,$N,qo,jw,MS,PS,Di,nh,iL,Eb,oL,IN,RN,Ep,FS,NN,ON,MN,zw,Tp,Wr,PN,bm,FN,jN,HS,HN,BS,BN,zS,vm,Lp,zN,WN,Ww,qs,ih,$p,VN,UN,VS,aL,ym,US,qN,qS,lL,GN,cL,dL,uL,KN,Vw,hL,GS,oh,JN,YN,ZN,pL,fL,Ib,Rb,JS,ql,vL,wL,Bc,qw,Gw,xL,_L,SL,CL,kL,EL,TL,LL,$L,IL,YS,NL,Nb,AL,ML,PL,FL,jL,Kw,Gl,BL,rh,zL,Jw}from"./chunks/studio-rj9eamf8.js";import{Wd,qb,Hp,ch,$m,Ta,GA,Yc,dh,Pt,Nt,E$,bx,vC,Zc,To,$s,yC,XA,ae}from"./chunks/studio-q7rtx6zq.js";import{M_,Pu,P_,cD,Qy,Zg,mE,dD}from"./chunks/studio-mn0476ag.js";import{qr,mt,io}from"./chunks/studio-k3xxbagr.js";import"./chunks/studio-fyh0jc96.js";import{Rm}from"./chunks/studio-8m0y2qe7.js";import{ze,jb,Jl,Kc,Hb}from"./chunks/studio-ph84avkf.js";import{jd,pA}from"./chunks/studio-3exxhz5g.js";import{AT,Ew,YD}from"./chunks/studio-x1x167jh.js";import{MA,PA,g$,qe,Mp,b$,wi,FA,jA,fx,ft,T,WA,R,Jt,Zs,Tn,rt,tt,v$,Wb,y$,Ko,xi}from"./chunks/studio-x9hsze61.js";import{zp,L$}from"./chunks/studio-r5qy30vx.js";import{Bd,lC,cC,bA,a$,Bb,sr,ka,dC,l$,c$,d$,Np,u$,yA,wA,zd,xA,sl,dx,_A,SA,CA,Cm,uC,us,h$,p$,EA,ux,zb,hC,TA,km,LA,pC,Yl,lh,$A,fC,f$,mC,Em,IA,hx,m$}from"./chunks/studio-4hp8pkyt.js";import{hN}from"./chunks/studio-3e54qh39.js";import{Us,lN,tl}from"./chunks/studio-y0n7yxea.js";import{Gs,Ks}from"./chunks/studio-nh6d342n.js";import{bb,cs,zl,fm,ir,_p,eN,Gu,nN,_S,Dw,or,VT,UT,Sp,qT}from"./chunks/studio-q0tccd43.js";import{nw,fD,kE,iw,Fl,gD,bD,rm,sm,ow,nb,$E,rw,ED}from"./chunks/studio-03ct6yfv.js";import{aw}from"./chunks/studio-07rcfje3.js";import{Xt}from"./chunks/studio-pbxa5fpc.js";import"./chunks/studio-k1wvtp03.js";import{Md}from"./chunks/studio-tf9jryb1.js";import{Dy,Ru,Gf,Bg,h_,ER,p_,f_,m_,g_,Ny,Pk,TR,Ay,Oy,My,cp,LR,Cd,Kf}from"./chunks/studio-58xg6j2q.js";import{Vu,DT,kw,gS,bS}from"./chunks/studio-n0c5h6mf.js";import{uS,$T,IT}from"./chunks/studio-qwdqwkj0.js";import{rS,UD,qD,vw,sS,um,hm,ub,Vs,rT,lS,hb,lT,cT,pb,CT}from"./chunks/studio-syreb644.js";import{iS,iT}from"./chunks/studio-bavb31r0.js";import"./chunks/studio-dgk4dqtx.js";import{ab,J_,ND,AD,dw,uw,Y_,OD,zs,cm,BE,zE,WE,Z_,cb,VE,yi,Q_,GE,KE,dm,JE}from"./chunks/studio-ed3xx40h.js";import{qg,Qa,Au,XR,Zk,I_,R_,Ld,Xk,Qk,D_,eD}from"./chunks/studio-pgmvdv7z.js";import{iR,kk}from"./chunks/studio-a2bvaptz.js";import{n_,xk,_k,i_,Og,Sk}from"./chunks/studio-m8g16bgz.js";import{Uy,tD,nD,iD,oD,Kg,nE,Dc,rD,iE,Ou,sD,em,$d,Jg,oE,Mu,qy,Gy,Ky,sE,N_,Jy,aE,Yy,A_,lE,aD,Yg,cE,O_,dE}from"./chunks/studio-jsgf2q5k.js";import{dp,Py,$c,$R,IR,y_,Fy,jk,RR,DR,Jf,Rc,AR,Xf,OR,Ol,Vk,MR,PR}from"./chunks/studio-3qqjeep5.js";import"./chunks/studio-ccv2svc6.js";import{a_,Ty,pR,sp,Ik,l_,Eu,c_,Ly,fR,mR,Hg,gR,Rk,$y,Dk,d_,bR,vR,yR,Iy,ji,Tu,Lu,$u,wR,xR,ap,Uf,Iu,lp,Ry,Nk,Ak,_R,Ok,SR,Mk,CR,kR,qf,u_}from"./chunks/studio-ed1hp6zf.js";import{Tk,Fg}from"./chunks/studio-k7evxqh4.js";import{Vf,dR,uR,Lk,$k,jg,Nl,ku}from"./chunks/studio-b7y5mr30.js";import{W_,V_,Id,eb,Rd,ya}from"./chunks/studio-df0baea9.js";import{qR,Ug,GR,KR}from"./chunks/studio-rptgsk96.js";import{lm,Wu}from"./chunks/studio-jaaz8ce9.js";import{kd,E_,Ml,Hy,qk,T_,BR,zR,Du}from"./chunks/studio-3q40e3rj.js";import"./chunks/studio-zcd2e7yz.js";import{Dl,Ck}from"./chunks/studio-6m380wp7.js";import{Xg,xE}from"./chunks/studio-f14e1zdj.js";import{Cy}from"./chunks/studio-q0mvbaq6.js";import{rR}from"./chunks/studio-y3ahhdpx.js";import{L_}from"./chunks/studio-qmn1xc24.js";import{Ed,Qf,Kk,Nu,$_,WR,VR,By,Jk}from"./chunks/studio-svb7yyve.js";import{tm}from"./chunks/studio-zat62m0c.js";import{Pl}from"./chunks/studio-txf2kysx.js";import{cw,rb,$D,ID,OE,RD,DD,am}from"./chunks/studio-wc649wss.js";import"./chunks/studio-wys23mxz.js";import{gw}from"./chunks/studio-mx1smyq0.js";import{Ws,oT}from"./chunks/studio-tfkznv39.js";import"./chunks/studio-8vcvfs7r.js";import"./chunks/studio-9tmebf0s.js";import"./chunks/studio-3qeh9t0h.js";import{jC,lr,At,hi,$r,_h,Ir,x,id,wn,HC,Ch,Q$,eI,UO,Xp,Vm,Um,cr,xn,dl,Da,KO}from"./chunks/studio-gcxk20n7.js";import{oe}from"./chunks/studio-p4nrkvqr.js";import{dI,nM,iM}from"./chunks/studio-bbe4c90a.js";import{oM}from"./chunks/studio-jcnsdaep.js";import{n,Z,Xe,te,S,v,Ie,_n,it}from"./chunks/studio-vxq7fcvv.js";import{op,pe,eo,le,U2}from"./chunks/studio-qgh13jtz.js";U2(import.meta.url,["32dj5vv7","kzrjr3fv","dz7nxfhv","3afgwvbp","7v4rtd7m","bgyr11tr","v9gh687x","vq1hgnn0","r22xca09","4z1g062t","bv552sfx","h2wrh6hq","xsd7hkjw","v77xtwv7","9547rg5s","0egb88dm","ssv7kyj0","qg1b5eqx","psym14sn","haqazq5r","ttasrbh7","yxz0kjjs","qnab36ek","rcn56qvm","d1qxq4z4","sq468wts","nqxqf8p2","5g0rprdt","s32578pn","w4rz9hdk","43sd2mam","d5grtb9e","c05wdnt3","kt3pjkwd","z97c48fk","8tr6cfrc","fbhxxc5f","rj9eamf8","q7rtx6zq","mn0476ag","k3xxbagr","fyh0jc96","8m0y2qe7","ph84avkf","3exxhz5g","x1x167jh","x9hsze61","r5qy30vx","4hp8pkyt","3e54qh39","y0n7yxea","nh6d342n","q0tccd43","03ct6yfv","07rcfje3","pbxa5fpc","k1wvtp03","tf9jryb1","58xg6j2q","n0c5h6mf","qwdqwkj0","syreb644","bavb31r0","dgk4dqtx","ed3xx40h","pgmvdv7z","a2bvaptz","m8g16bgz","jsgf2q5k","3qqjeep5","ccv2svc6","ed1hp6zf","k7evxqh4","b7y5mr30","df0baea9","rptgsk96","jaaz8ce9","3q40e3rj","zcd2e7yz","6m380wp7","f14e1zdj","q0mvbaq6","y3ahhdpx","qmn1xc24","svb7yyve","zat62m0c","txf2kysx","wc649wss","wys23mxz","mx1smyq0","tfkznv39","8vcvfs7r","9tmebf0s","3qeh9t0h","gcxk20n7","p4nrkvqr","bbe4c90a","jcnsdaep","vxq7fcvv","qgh13jtz","80jyh1xh","83mk4bgg","s19tp1xr","tft6r105","f0jn7nnp","ccd9jwsa","xrd2cbkp","e1g64q43","he70fc2b","kwktr9y6","6qxz9e8p","shfe59pt","n0t0eqxb","5tphg7xe","wsgnr9pn","7ez66zeq","mmppmcyg","5wtzce5g","32eqzv1k","881z1xrx","2z9gw8ee","qx2455cj","wrc1dgwx","rthyg42z","njkvsa02","pjp734q4","zz9qe3rw","v8867ddv","wbcjbhy1","epyfz1hv"],[["./studio.js",26,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],["./chunks/notify-kzrjr3fv.js",30],["./chunks/workspace-dz7nxfhv.js",32,33,35,30,34,29],["./chunks/monaco-buffer-3afgwvbp.js",33,30],["./chunks/platform-7v4rtd7m.js",29],["./chunks/layers-bgyr11tr.js",46,40,38,35,30,26],["./chunks/lit-html-v9gh687x.js",40],["./chunks/monaco-binding-vq1hgnn0.js",100,101,98],["./chunks/components-r22xca09.js",36,29],["./chunks/grid-open-4z1g062t.js",62,57,52,93,50,49,27,37,36,31,51,44,43,48,28,46,40,38,47,41,42,32,33,35,30,26,34,29],["./chunks/ws-client-bv552sfx.js",101,81],["./chunks/cf-settings-h2wrh6hq.js",78,28,30,29],["./chunks/workspace-home-xsd7hkjw.js",67,66,82,65,86,53,54,64,88,89,62,55,61,63,60,91,59,45,92,57,52,93,50,49,27,37,36,31,51,44,43,48,28,46,40,38,47,41,42,32,33,35,30,26,34,29,56],["./chunks/parse-v77xtwv7.js",26],["./chunks/references-9547rg5s.js",41,26,29],["./chunks/extension-sections-0egb88dm.js",29,34,26,30,32,33,35,38,54,40,46,55,56,76,77,62,41,42,47,48,28,31,49,50,27,57,43,44,37,36,51,52,93,98],["./chunks/iframe-host-ssv7kyj0.js",37,36,31,51,43,28,38,42,32,33,35,30,26,34,29],["./chunks/grid-view-qg1b5eqx.js",29,34,35,40,38,46,30,26,59,42,32,33,41,43,44,57,47,48,28,31,49,50,27,37,36,51,52,84,102,92,93,98],["./chunks/add-new-flow-psym14sn.js",26,29,30,40,38,35,46,34,32,33,57,41,42,47,48,28,31,49,50,27,43,44,37,36,51,52,61,62,45,63,64,55,70,54,56,74,59,53,39,68,80,75,65,85,86,88,89,103,91,92,93,94,98],["./chunks/cf-account-picker-haqazq5r.js",26,29,30,40,38,35,46,63,28,78,48,87],["./chunks/jx-validate-ttasrbh7.js",76],["./chunks/format-host-yxz0kjjs.js",34,29],["./chunks/file-ops-qnab36ek.js",52,93,50,49,27,37,36,31,51,44,43,48,28,46,40,38,47,41,42,32,33,35,30,26,34,29],["./chunks/files-rcn56qvm.js",64,88,89,62,55,61,63,45,92,57,52,93,50,49,27,37,36,31,51,44,43,48,28,46,40,38,47,41,42,32,33,35,30,26,34,29],["./chunks/fs-events-d1qxq4z4.js",47,41,42,32,33,35,30,26,34,29],["./chunks/media-library-sq468wts.js",60,91,59,45,92,52,93,50,49,27,37,36,31,51,44,43,48,28,46,40,38,47,41,42,32,33,35,30,26,34,29],["./chunks/studio-nqxqf8p2.js"],["./chunks/studio-5g0rprdt.js",28,30,31,32,94],["./chunks/studio-s32578pn.js",29,30],["./chunks/studio-w4rz9hdk.js",98],["./chunks/studio-43sd2mam.js",98],["./chunks/studio-d5grtb9e.js",26,29,30,32,34,28,94,98,99],["./chunks/studio-c05wdnt3.js",30,33,29,34,35,94,95,98,99],["./chunks/studio-kt3pjkwd.js",30,98],["./chunks/studio-z97c48fk.js",29,98,99],["./chunks/studio-8tr6cfrc.js"],["./chunks/studio-fbhxxc5f.js",29,94,98],["./chunks/studio-rj9eamf8.js",29,32,30,33,34,36,42,43,38,51,31,94,95,97,98,99],["./chunks/studio-q7rtx6zq.js",35,30,98,99],["./chunks/studio-mn0476ag.js",36,37,32,30,31,94,95],["./chunks/studio-k3xxbagr.js"],["./chunks/studio-fyh0jc96.js",29,26,98],["./chunks/studio-8m0y2qe7.js",35,30,98],["./chunks/studio-ph84avkf.js",29,35,42,32,94],["./chunks/studio-3exxhz5g.js",26,29,30,41,32,35,42,43,94],["./chunks/studio-x1x167jh.js",32,30,43,44,107,92,50,46,99],["./chunks/studio-x9hsze61.js",40,38,30,26,98],["./chunks/studio-r5qy30vx.js",29,41,42,32,94],["./chunks/studio-4hp8pkyt.js",29,28,30,46,98],["./chunks/studio-3e54qh39.js",29,48,30,38,46,31,94,98],["./chunks/studio-y0n7yxea.js",40,38,30,35,46,31,49,27,41],["./chunks/studio-nh6d342n.js",99],["./chunks/studio-q0tccd43.js",29,26,41,30,32,34,44,38,46,37,47,31,50,93,95,98],["./chunks/studio-03ct6yfv.js",29,26,30,32,34,35,42,43,44,57,38,46,37,52,54,89,107,94,95,98,99],["./chunks/studio-07rcfje3.js",38,32,30,46,55,95,98],["./chunks/studio-pbxa5fpc.js",38,46,30,43],["./chunks/studio-k1wvtp03.js"],["./chunks/studio-tf9jryb1.js",29,32,30,34,35,47,37,52,94,98,99],["./chunks/studio-58xg6j2q.js",38,32,30,31,36,46,37,91,94,98,99],["./chunks/studio-n0c5h6mf.js",29,46,30,42,43,44,92,94,99],["./chunks/studio-qwdqwkj0.js",26,29,30,41,38,46,32,42,43,44,50,59,45,91,92,98,99],["./chunks/studio-syreb644.js",26,29,43,34,32,30,38,45,31,46,63,50,37,102,94,98,99],["./chunks/studio-bavb31r0.js",32,30,29,34,46,47,57,52,94,98],["./chunks/studio-dgk4dqtx.js",26,30,38,46],["./chunks/studio-ed3xx40h.js",40,26,38,46,30,29,34,41,42,32,47,28,31,50,27,36,43,51,61,44,62,52,45,55,88,89,103,90,94,98,99],["./chunks/studio-pgmvdv7z.js",29,57,26,30,46,32,50,55,41,43,44,37,52,64,53,86,88,89,91,107,94,98,99],["./chunks/studio-a2bvaptz.js",26,38,30,29,46,31,49,50,61,37,82,94,98],["./chunks/studio-m8g16bgz.js",32,60,65,66],["./chunks/studio-jsgf2q5k.js",32,30,33,29,31,38,54,46,55,53,43,57,37,51,52,39,64,74,89,94,98,99],["./chunks/studio-3qqjeep5.js",40,32,30,33,29,34,38,27,31,46,54,36,43,37,51,39,55,59,41,93,94,95,98,99],["./chunks/studio-ccv2svc6.js",103],["./chunks/studio-ed1hp6zf.js",40,32,30,33,31,27,36,38,58,41,43,46,37,51,69,55,85,88,94,95,98,99],["./chunks/studio-k7evxqh4.js",29,34,38,46,30,32,64,94,98],["./chunks/studio-b7y5mr30.js",32,30,31,38,58,69,46,54,37,55,41,68,94,95,98],["./chunks/studio-df0baea9.js",26,54,46,30,32,59,98,99],["./chunks/studio-rptgsk96.js",29,36,30,41,32,34,44,51,37,40,46,27,57,59,65,53,91,94,98,99],["./chunks/studio-jaaz8ce9.js",119,98,99],["./chunks/studio-3q40e3rj.js",26,29,30,32,38,54,46,76,62,31,94,98],["./chunks/studio-zcd2e7yz.js",28],["./chunks/studio-6m380wp7.js",38,29,48,30,46,49,78,94,98,99],["./chunks/studio-f14e1zdj.js",34,30,32,35,26,74,44,57,31,37,70,53,86,89,103,98,99],["./chunks/studio-q0mvbaq6.js"],["./chunks/studio-y3ahhdpx.js",29,38,30,26,32,31,49,50,61,103,94,99],["./chunks/studio-qmn1xc24.js",98],["./chunks/studio-svb7yyve.js",98],["./chunks/studio-zat62m0c.js",26,32,30,29,36,46,70,52,31,94,95,98],["./chunks/studio-txf2kysx.js",32,53,37,99],["./chunks/studio-wc649wss.js",63,29,78,48,99],["./chunks/studio-wys23mxz.js",43,98],["./chunks/studio-mx1smyq0.js",32,57,94,98],["./chunks/studio-tfkznv39.js",98],["./chunks/studio-8vcvfs7r.js",38,29,42,32,34,36,41,43,37,52,94,98],["./chunks/studio-9tmebf0s.js",29,35,42,43,44,98],["./chunks/studio-3qeh9t0h.js",29,94,95,34,98],["./chunks/studio-gcxk20n7.js",98],["./chunks/studio-p4nrkvqr.js",98],["./chunks/studio-bbe4c90a.js"],["./chunks/studio-jcnsdaep.js"],["./chunks/studio-vxq7fcvv.js"],["./chunks/studio-qgh13jtz.js"],["./chunks/studio-80jyh1xh.js",101,95,98],["./chunks/studio-83mk4bgg.js",98],["./chunks/studio-s19tp1xr.js"],["./chunks/studio-tft6r105.js"],["./chunks/index-f0jn7nnp.js",100,101,90,95],["./chunks/editor-ccd9jwsa.js",123],["./chunks/monaco-setup-xrd2cbkp.js",123,126,56,119,97,98,99],["./chunks/studio-e1g64q43.js"],["./chunks/convert-to-repeater-he70fc2b.js",32,30,33,29,34,35,40,38,46,26,69,54,56,27,28,31,36,42,43,37,51,39,55,59,41,44,92,93,94,95,98],["./chunks/source-control-kwktr9y6.js",61,63,45,92,50,49,27,37,36,31,51,44,43,48,28,46,40,38,41,42,32,33,35,30,26,34,29],["./chunks/entry-commands-6qxz9e8p.js",80,86,74,53,70,54,89,55,59,92,57,52,93,50,49,27,37,36,31,51,44,43,48,28,46,40,38,47,41,42,32,33,35,30,26,34,29,56],["./chunks/media-picker-shfe59pt.js",59,92,44,43,46,40,38,41,42,32,33,35,30,26,34,29],["./chunks/quick-search-n0t0eqxb.js",72,64,88,89,62,55,61,63,45,92,57,52,93,50,49,27,37,36,31,51,44,43,48,28,46,40,38,47,41,42,32,33,35,30,26,34,29],["./chunks/adapter-5tphg7xe.js",51],["./chunks/right-panel-wsgnr9pn.js",73,58,69,68,39,74,53,54,64,88,89,62,55,61,63,91,59,45,92,57,52,93,50,49,27,37,36,31,51,44,43,48,28,46,40,38,47,41,42,32,33,35,30,26,34,29,56],["./chunks/layers-panel-7ez66zeq.js",71,58,69,85,39,70,54,88,55,91,59,92,52,93,50,49,27,37,36,31,51,44,43,48,28,46,40,38,47,41,42,32,33,35,30,26,34,29,56],["./chunks/content-source-mmppmcyg.js",57,52,93,50,49,27,37,36,31,51,44,43,48,28,46,40,38,47,41,42,32,33,35,30,26,34,29],["./chunks/2020-5wtzce5g.js",127,99],["./chunks/index-32eqzv1k.js",127,99],["./chunks/studio-881z1xrx.js"],["./chunks/publish-panel-2z9gw8ee.js",79,78,49,31,48,28,46,40,38,32,33,35,30,26,34,29],["./chunks/publish-quick-qx2455cj.js",26,30,38,28,29,31,32,33,34,35,40,46,48,49,50,27,43,41,42,44,45,63,61,36,37,51,82,92],["./chunks/publish-workspace-wrc1dgwx.js",66,82,61,63,45,92,50,49,27,37,36,31,51,44,43,48,28,46,40,38,41,42,32,33,35,30,26,34,29],["./chunks/studio-rthyg42z.js"],["./chunks/jsonMode-njkvsa02.js",123,128,126],["./chunks/javascript-pjp734q4.js",123],["./chunks/studio-zz9qe3rw.js",123,99],["./chunks/studio-v8867ddv.js",99],["./chunks/studio-wbcjbhy1.js",123,126],["./chunks/tsMode-epyfz1hv.js",123,128,126]],0);
|
|
1
|
+
import{Q}from"./chunks/studio-nqxqf8p2.js";import{xb,mN,CS,bN,Yu,Zn,Cp,Mw,Pw,QT,vN}from"./chunks/studio-5g0rprdt.js";import{pt,Go,Ap,DA,Cr,Op,AA,OA}from"./chunks/studio-s32578pn.js";import{lI,Tv,p,_e}from"./chunks/studio-w4rz9hdk.js";import{ge,ne,Jr,Yr,g,he,Na,qx,Qp,dr,na,C,Lh,ul,ef,Sv}from"./chunks/studio-43sd2mam.js";import{Es,ko,WL,eC,Kl,XN,to,Sr,Zw,Ts,Rp,ol,no,nC,ix,GL,KL,ox,Vc,JL,rx,iA,YL,oC,rC,oA,h,Fd,sx,sA,XL,sC,_m,Ob,Mb,aA,Eo,lA,Uc,sh,QL,cA,ax,dA}from"./chunks/studio-d5grtb9e.js";import{Fn,vx,Vt,Qt,Hi,ev,Xc,tv,nv,Wp,Xl,ll,iv,Dm,Qs,iO,_x,mh,Sx,ov,oO,Nm,Cx,CC,rv,ho,bo,kx,gh,Ex,rO,A$,sO,aO,lO,kC,cO,EC,dO,Am,ln,TC,O$,hO,Me,mO,gO,Y,qd,Ix,Rx,LC,bO,vO,yO,$C,wO,Lo,Fm,Dx,Qc,Ve,Gd,Ia,Ox,Ln,St,Xn,zi,Vn,IO,F$,Se,di,cl,$o,Px,RO,We,Un,ed,uv,OO,MO,PO,FO,B$,z$,ui,W$,m,u,Kr,fn,Ql,Lr,ec,AC,OC,MC,tc,Yd,PC,_i,Zd,U$,Bt,G$}from"./chunks/studio-c05wdnt3.js";import{st,HO,vo,xh,qp,nd,BO,zO,WO,K$,Gp,fv,mv,Xd,Kp,Qd,Jp}from"./chunks/studio-kt3pjkwd.js";import{qm,tf,Cv,Ot,$h,kv,Gx,ic,Wi,cn}from"./chunks/studio-z97c48fk.js";import"./chunks/studio-8tr6cfrc.js";import{QS,Ae,_a,Ab,zc}from"./chunks/studio-fbhxxc5f.js";import{_b,vt,zr,kS,Pc,Uo,nl,Zu,Fc,TS,xN,_N,LS,SN,Cb,ci,mm,eL,Vl,Ul,eh,kN,jc,th,kb,kp,DS,TN,AS,nL,LN,$N,qo,jw,MS,PS,Di,nh,iL,Eb,oL,IN,RN,Ep,FS,NN,ON,MN,zw,Tp,Wr,PN,bm,FN,jN,HS,HN,BS,BN,zS,vm,Lp,zN,WN,Ww,qs,ih,$p,VN,UN,VS,aL,ym,US,qN,qS,lL,GN,cL,dL,uL,KN,Vw,hL,GS,oh,JN,YN,ZN,pL,fL,Ib,Rb,JS,ql,vL,wL,Bc,qw,Gw,xL,_L,SL,CL,kL,EL,TL,LL,$L,IL,YS,NL,Nb,AL,ML,PL,FL,jL,Kw,Gl,BL,rh,zL,Jw}from"./chunks/studio-rj9eamf8.js";import{Wd,qb,Hp,ch,$m,Ta,GA,Yc,dh,Pt,Nt,E$,bx,vC,Zc,To,$s,yC,XA,ae}from"./chunks/studio-q7rtx6zq.js";import{M_,Pu,P_,cD,Qy,Zg,mE,dD}from"./chunks/studio-mn0476ag.js";import{qr,mt,io}from"./chunks/studio-k3xxbagr.js";import"./chunks/studio-fyh0jc96.js";import{Rm}from"./chunks/studio-8m0y2qe7.js";import{ze,jb,Jl,Kc,Hb}from"./chunks/studio-ph84avkf.js";import{jd,pA}from"./chunks/studio-3exxhz5g.js";import{AT,Ew,YD}from"./chunks/studio-x1x167jh.js";import{MA,PA,g$,qe,Mp,b$,wi,FA,jA,fx,ft,T,WA,R,Jt,Zs,Tn,rt,tt,v$,Wb,y$,Ko,xi}from"./chunks/studio-x9hsze61.js";import{zp,L$}from"./chunks/studio-r5qy30vx.js";import{Bd,lC,cC,bA,a$,Bb,sr,ka,dC,l$,c$,d$,Np,u$,yA,wA,zd,xA,sl,dx,_A,SA,CA,Cm,uC,us,h$,p$,EA,ux,zb,hC,TA,km,LA,pC,Yl,lh,$A,fC,f$,mC,Em,IA,hx,m$}from"./chunks/studio-4hp8pkyt.js";import{hN}from"./chunks/studio-3e54qh39.js";import{Us,lN,tl}from"./chunks/studio-y0n7yxea.js";import{Gs,Ks}from"./chunks/studio-nh6d342n.js";import{bb,cs,zl,fm,ir,_p,eN,Gu,nN,_S,Dw,or,VT,UT,Sp,qT}from"./chunks/studio-q0tccd43.js";import{nw,fD,kE,iw,Fl,gD,bD,rm,sm,ow,nb,$E,rw,ED}from"./chunks/studio-03ct6yfv.js";import{aw}from"./chunks/studio-07rcfje3.js";import{Xt}from"./chunks/studio-pbxa5fpc.js";import"./chunks/studio-k1wvtp03.js";import{Md}from"./chunks/studio-tf9jryb1.js";import{Dy,Ru,Gf,Bg,h_,ER,p_,f_,m_,g_,Ny,Pk,TR,Ay,Oy,My,cp,LR,Cd,Kf}from"./chunks/studio-58xg6j2q.js";import{Vu,DT,kw,gS,bS}from"./chunks/studio-n0c5h6mf.js";import{uS,$T,IT}from"./chunks/studio-qwdqwkj0.js";import{rS,UD,qD,vw,sS,um,hm,ub,Vs,rT,lS,hb,lT,cT,pb,CT}from"./chunks/studio-syreb644.js";import{iS,iT}from"./chunks/studio-bavb31r0.js";import"./chunks/studio-dgk4dqtx.js";import{ab,J_,ND,AD,dw,uw,Y_,OD,zs,cm,BE,zE,WE,Z_,cb,VE,yi,Q_,GE,KE,dm,JE}from"./chunks/studio-ed3xx40h.js";import{qg,Qa,Au,XR,Zk,I_,R_,Ld,Xk,Qk,D_,eD}from"./chunks/studio-pgmvdv7z.js";import{iR,kk}from"./chunks/studio-a2bvaptz.js";import{n_,xk,_k,i_,Og,Sk}from"./chunks/studio-m8g16bgz.js";import{Uy,tD,nD,iD,oD,Kg,nE,Dc,rD,iE,Ou,sD,em,$d,Jg,oE,Mu,qy,Gy,Ky,sE,N_,Jy,aE,Yy,A_,lE,aD,Yg,cE,O_,dE}from"./chunks/studio-jsgf2q5k.js";import{dp,Py,$c,$R,IR,y_,Fy,jk,RR,DR,Jf,Rc,AR,Xf,OR,Ol,Vk,MR,PR}from"./chunks/studio-3qqjeep5.js";import"./chunks/studio-ccv2svc6.js";import{a_,Ty,pR,sp,Ik,l_,Eu,c_,Ly,fR,mR,Hg,gR,Rk,$y,Dk,d_,bR,vR,yR,Iy,ji,Tu,Lu,$u,wR,xR,ap,Uf,Iu,lp,Ry,Nk,Ak,_R,Ok,SR,Mk,CR,kR,qf,u_}from"./chunks/studio-ed1hp6zf.js";import{Tk,Fg}from"./chunks/studio-k7evxqh4.js";import{Vf,dR,uR,Lk,$k,jg,Nl,ku}from"./chunks/studio-b7y5mr30.js";import{W_,V_,Id,eb,Rd,ya}from"./chunks/studio-df0baea9.js";import{qR,Ug,GR,KR}from"./chunks/studio-rptgsk96.js";import{lm,Wu}from"./chunks/studio-jaaz8ce9.js";import{kd,E_,Ml,Hy,qk,T_,BR,zR,Du}from"./chunks/studio-3q40e3rj.js";import"./chunks/studio-zcd2e7yz.js";import{Dl,Ck}from"./chunks/studio-6m380wp7.js";import{Xg,xE}from"./chunks/studio-f14e1zdj.js";import{Cy}from"./chunks/studio-q0mvbaq6.js";import{rR}from"./chunks/studio-y3ahhdpx.js";import{L_}from"./chunks/studio-qmn1xc24.js";import{Ed,Qf,Kk,Nu,$_,WR,VR,By,Jk}from"./chunks/studio-svb7yyve.js";import{tm}from"./chunks/studio-zat62m0c.js";import{Pl}from"./chunks/studio-txf2kysx.js";import{cw,rb,$D,ID,OE,RD,DD,am}from"./chunks/studio-wc649wss.js";import"./chunks/studio-wys23mxz.js";import{gw}from"./chunks/studio-mx1smyq0.js";import{Ws,oT}from"./chunks/studio-tfkznv39.js";import"./chunks/studio-8vcvfs7r.js";import"./chunks/studio-9tmebf0s.js";import"./chunks/studio-3qeh9t0h.js";import{jC,lr,At,hi,$r,_h,Ir,x,id,wn,HC,Ch,Q$,eI,UO,Xp,Vm,Um,cr,xn,dl,Da,KO}from"./chunks/studio-gcxk20n7.js";import{oe}from"./chunks/studio-p4nrkvqr.js";import{dI,nM,iM}from"./chunks/studio-bbe4c90a.js";import{oM}from"./chunks/studio-jcnsdaep.js";import{n,Z,Xe,te,S,v,Ie,_n,it}from"./chunks/studio-vxq7fcvv.js";import{op,pe,eo,le,U2}from"./chunks/studio-qgh13jtz.js";U2(import.meta.url,["sq8vdfz8","kzrjr3fv","dz7nxfhv","3afgwvbp","7v4rtd7m","bgyr11tr","v9gh687x","vq1hgnn0","r22xca09","4z1g062t","bv552sfx","h2wrh6hq","xsd7hkjw","v77xtwv7","9547rg5s","0egb88dm","ssv7kyj0","qg1b5eqx","psym14sn","haqazq5r","ttasrbh7","yxz0kjjs","qnab36ek","rcn56qvm","d1qxq4z4","sq468wts","nqxqf8p2","5g0rprdt","s32578pn","w4rz9hdk","43sd2mam","d5grtb9e","c05wdnt3","kt3pjkwd","z97c48fk","8tr6cfrc","fbhxxc5f","rj9eamf8","q7rtx6zq","mn0476ag","k3xxbagr","fyh0jc96","8m0y2qe7","ph84avkf","3exxhz5g","x1x167jh","x9hsze61","r5qy30vx","4hp8pkyt","3e54qh39","y0n7yxea","nh6d342n","q0tccd43","03ct6yfv","07rcfje3","pbxa5fpc","k1wvtp03","tf9jryb1","58xg6j2q","n0c5h6mf","qwdqwkj0","syreb644","bavb31r0","dgk4dqtx","ed3xx40h","pgmvdv7z","a2bvaptz","m8g16bgz","jsgf2q5k","3qqjeep5","ccv2svc6","ed1hp6zf","k7evxqh4","b7y5mr30","df0baea9","rptgsk96","jaaz8ce9","3q40e3rj","zcd2e7yz","6m380wp7","f14e1zdj","q0mvbaq6","y3ahhdpx","qmn1xc24","svb7yyve","zat62m0c","txf2kysx","wc649wss","wys23mxz","mx1smyq0","tfkznv39","8vcvfs7r","9tmebf0s","3qeh9t0h","gcxk20n7","p4nrkvqr","bbe4c90a","jcnsdaep","vxq7fcvv","qgh13jtz","80jyh1xh","83mk4bgg","s19tp1xr","tft6r105","f0jn7nnp","ccd9jwsa","xrd2cbkp","e1g64q43","he70fc2b","kwktr9y6","6qxz9e8p","shfe59pt","n0t0eqxb","5tphg7xe","wsgnr9pn","7ez66zeq","mmppmcyg","5wtzce5g","32eqzv1k","881z1xrx","2z9gw8ee","qx2455cj","wrc1dgwx","rthyg42z","njkvsa02","pjp734q4","zz9qe3rw","v8867ddv","wbcjbhy1","epyfz1hv"],[["./studio.js",26,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],["./chunks/notify-kzrjr3fv.js",30],["./chunks/workspace-dz7nxfhv.js",32,33,35,30,34,29],["./chunks/monaco-buffer-3afgwvbp.js",33,30],["./chunks/platform-7v4rtd7m.js",29],["./chunks/layers-bgyr11tr.js",46,40,38,35,30,26],["./chunks/lit-html-v9gh687x.js",40],["./chunks/monaco-binding-vq1hgnn0.js",100,101,98],["./chunks/components-r22xca09.js",36,29],["./chunks/grid-open-4z1g062t.js",62,57,52,93,50,49,27,37,36,31,51,44,43,48,28,46,40,38,47,41,42,32,33,35,30,26,34,29],["./chunks/ws-client-bv552sfx.js",101,81],["./chunks/cf-settings-h2wrh6hq.js",78,28,30,29],["./chunks/workspace-home-xsd7hkjw.js",67,66,82,65,86,53,54,64,88,89,62,55,61,63,60,91,59,45,92,57,52,93,50,49,27,37,36,31,51,44,43,48,28,46,40,38,47,41,42,32,33,35,30,26,34,29,56],["./chunks/parse-v77xtwv7.js",26],["./chunks/references-9547rg5s.js",41,26,29],["./chunks/extension-sections-0egb88dm.js",29,34,26,30,32,33,35,38,54,40,46,55,56,76,77,62,41,42,47,48,28,31,49,50,27,57,43,44,37,36,51,52,93,98],["./chunks/iframe-host-ssv7kyj0.js",37,36,31,51,43,28,38,42,32,33,35,30,26,34,29],["./chunks/grid-view-qg1b5eqx.js",29,34,35,40,38,46,30,26,59,42,32,33,41,43,44,57,47,48,28,31,49,50,27,37,36,51,52,84,102,92,93,98],["./chunks/add-new-flow-psym14sn.js",26,29,30,40,38,35,46,34,32,33,57,41,42,47,48,28,31,49,50,27,43,44,37,36,51,52,61,62,45,63,64,55,70,54,56,74,59,53,39,68,80,75,65,85,86,88,89,103,91,92,93,94,98],["./chunks/cf-account-picker-haqazq5r.js",26,29,30,40,38,35,46,63,28,78,48,87],["./chunks/jx-validate-ttasrbh7.js",76],["./chunks/format-host-yxz0kjjs.js",34,29],["./chunks/file-ops-qnab36ek.js",52,93,50,49,27,37,36,31,51,44,43,48,28,46,40,38,47,41,42,32,33,35,30,26,34,29],["./chunks/files-rcn56qvm.js",64,88,89,62,55,61,63,45,92,57,52,93,50,49,27,37,36,31,51,44,43,48,28,46,40,38,47,41,42,32,33,35,30,26,34,29],["./chunks/fs-events-d1qxq4z4.js",47,41,42,32,33,35,30,26,34,29],["./chunks/media-library-sq468wts.js",60,91,59,45,92,52,93,50,49,27,37,36,31,51,44,43,48,28,46,40,38,47,41,42,32,33,35,30,26,34,29],["./chunks/studio-nqxqf8p2.js"],["./chunks/studio-5g0rprdt.js",28,30,31,32,94],["./chunks/studio-s32578pn.js",29,30],["./chunks/studio-w4rz9hdk.js",98],["./chunks/studio-43sd2mam.js",98],["./chunks/studio-d5grtb9e.js",26,29,30,32,34,28,94,98,99],["./chunks/studio-c05wdnt3.js",30,33,29,34,35,94,95,98,99],["./chunks/studio-kt3pjkwd.js",30,98],["./chunks/studio-z97c48fk.js",29,98,99],["./chunks/studio-8tr6cfrc.js"],["./chunks/studio-fbhxxc5f.js",29,94,98],["./chunks/studio-rj9eamf8.js",29,32,30,33,34,36,42,43,38,51,31,94,95,97,98,99],["./chunks/studio-q7rtx6zq.js",35,30,98,99],["./chunks/studio-mn0476ag.js",36,37,32,30,31,94,95],["./chunks/studio-k3xxbagr.js"],["./chunks/studio-fyh0jc96.js",29,26,98],["./chunks/studio-8m0y2qe7.js",35,30,98],["./chunks/studio-ph84avkf.js",29,35,42,32,94],["./chunks/studio-3exxhz5g.js",26,29,30,41,32,35,42,43,94],["./chunks/studio-x1x167jh.js",32,30,43,44,107,92,50,46,99],["./chunks/studio-x9hsze61.js",40,38,30,26,98],["./chunks/studio-r5qy30vx.js",29,41,42,32,94],["./chunks/studio-4hp8pkyt.js",29,28,30,46,98],["./chunks/studio-3e54qh39.js",29,48,30,38,46,31,94,98],["./chunks/studio-y0n7yxea.js",40,38,30,35,46,31,49,27,41],["./chunks/studio-nh6d342n.js",99],["./chunks/studio-q0tccd43.js",29,26,41,30,32,34,44,38,46,37,47,31,50,93,95,98],["./chunks/studio-03ct6yfv.js",29,26,30,32,34,35,42,43,44,57,38,46,37,52,54,89,107,94,95,98,99],["./chunks/studio-07rcfje3.js",38,32,30,46,55,95,98],["./chunks/studio-pbxa5fpc.js",38,46,30,43],["./chunks/studio-k1wvtp03.js"],["./chunks/studio-tf9jryb1.js",29,32,30,34,35,47,37,52,94,98,99],["./chunks/studio-58xg6j2q.js",38,32,30,31,36,46,37,91,94,98,99],["./chunks/studio-n0c5h6mf.js",29,46,30,42,43,44,92,94,99],["./chunks/studio-qwdqwkj0.js",26,29,30,41,38,46,32,42,43,44,50,59,45,91,92,98,99],["./chunks/studio-syreb644.js",26,29,43,34,32,30,38,45,31,46,63,50,37,102,94,98,99],["./chunks/studio-bavb31r0.js",32,30,29,34,46,47,57,52,94,98],["./chunks/studio-dgk4dqtx.js",26,30,38,46],["./chunks/studio-ed3xx40h.js",40,26,38,46,30,29,34,41,42,32,47,28,31,50,27,36,43,51,61,44,62,52,45,55,88,89,103,90,94,98,99],["./chunks/studio-pgmvdv7z.js",29,57,26,30,46,32,50,55,41,43,44,37,52,64,53,86,88,89,91,107,94,98,99],["./chunks/studio-a2bvaptz.js",26,38,30,29,46,31,49,50,61,37,82,94,98],["./chunks/studio-m8g16bgz.js",32,60,65,66],["./chunks/studio-jsgf2q5k.js",32,30,33,29,31,38,54,46,55,53,43,57,37,51,52,39,64,74,89,94,98,99],["./chunks/studio-3qqjeep5.js",40,32,30,33,29,34,38,27,31,46,54,36,43,37,51,39,55,59,41,93,94,95,98,99],["./chunks/studio-ccv2svc6.js",103],["./chunks/studio-ed1hp6zf.js",40,32,30,33,31,27,36,38,58,41,43,46,37,51,69,55,85,88,94,95,98,99],["./chunks/studio-k7evxqh4.js",29,34,38,46,30,32,64,94,98],["./chunks/studio-b7y5mr30.js",32,30,31,38,58,69,46,54,37,55,41,68,94,95,98],["./chunks/studio-df0baea9.js",26,54,46,30,32,59,98,99],["./chunks/studio-rptgsk96.js",29,36,30,41,32,34,44,51,37,40,46,27,57,59,65,53,91,94,98,99],["./chunks/studio-jaaz8ce9.js",119,98,99],["./chunks/studio-3q40e3rj.js",26,29,30,32,38,54,46,76,62,31,94,98],["./chunks/studio-zcd2e7yz.js",28],["./chunks/studio-6m380wp7.js",38,29,48,30,46,49,78,94,98,99],["./chunks/studio-f14e1zdj.js",34,30,32,35,26,74,44,57,31,37,70,53,86,89,103,98,99],["./chunks/studio-q0mvbaq6.js"],["./chunks/studio-y3ahhdpx.js",29,38,30,26,32,31,49,50,61,103,94,99],["./chunks/studio-qmn1xc24.js",98],["./chunks/studio-svb7yyve.js",98],["./chunks/studio-zat62m0c.js",26,32,30,29,36,46,70,52,31,94,95,98],["./chunks/studio-txf2kysx.js",32,53,37,99],["./chunks/studio-wc649wss.js",63,29,78,48,99],["./chunks/studio-wys23mxz.js",43,98],["./chunks/studio-mx1smyq0.js",32,57,94,98],["./chunks/studio-tfkznv39.js",98],["./chunks/studio-8vcvfs7r.js",38,29,42,32,34,36,41,43,37,52,94,98],["./chunks/studio-9tmebf0s.js",29,35,42,43,44,98],["./chunks/studio-3qeh9t0h.js",29,94,95,34,98],["./chunks/studio-gcxk20n7.js",98],["./chunks/studio-p4nrkvqr.js",98],["./chunks/studio-bbe4c90a.js"],["./chunks/studio-jcnsdaep.js"],["./chunks/studio-vxq7fcvv.js"],["./chunks/studio-qgh13jtz.js"],["./chunks/studio-80jyh1xh.js",101,95,98],["./chunks/studio-83mk4bgg.js",98],["./chunks/studio-s19tp1xr.js"],["./chunks/studio-tft6r105.js"],["./chunks/index-f0jn7nnp.js",100,101,90,95],["./chunks/editor-ccd9jwsa.js",123],["./chunks/monaco-setup-xrd2cbkp.js",123,126,56,119,97,98,99],["./chunks/studio-e1g64q43.js"],["./chunks/convert-to-repeater-he70fc2b.js",32,30,33,29,34,35,40,38,46,26,69,54,56,27,28,31,36,42,43,37,51,39,55,59,41,44,92,93,94,95,98],["./chunks/source-control-kwktr9y6.js",61,63,45,92,50,49,27,37,36,31,51,44,43,48,28,46,40,38,41,42,32,33,35,30,26,34,29],["./chunks/entry-commands-6qxz9e8p.js",80,86,74,53,70,54,89,55,59,92,57,52,93,50,49,27,37,36,31,51,44,43,48,28,46,40,38,47,41,42,32,33,35,30,26,34,29,56],["./chunks/media-picker-shfe59pt.js",59,92,44,43,46,40,38,41,42,32,33,35,30,26,34,29],["./chunks/quick-search-n0t0eqxb.js",72,64,88,89,62,55,61,63,45,92,57,52,93,50,49,27,37,36,31,51,44,43,48,28,46,40,38,47,41,42,32,33,35,30,26,34,29],["./chunks/adapter-5tphg7xe.js",51],["./chunks/right-panel-wsgnr9pn.js",73,58,69,68,39,74,53,54,64,88,89,62,55,61,63,91,59,45,92,57,52,93,50,49,27,37,36,31,51,44,43,48,28,46,40,38,47,41,42,32,33,35,30,26,34,29,56],["./chunks/layers-panel-7ez66zeq.js",71,58,69,85,39,70,54,88,55,91,59,92,52,93,50,49,27,37,36,31,51,44,43,48,28,46,40,38,47,41,42,32,33,35,30,26,34,29,56],["./chunks/content-source-mmppmcyg.js",57,52,93,50,49,27,37,36,31,51,44,43,48,28,46,40,38,47,41,42,32,33,35,30,26,34,29],["./chunks/2020-5wtzce5g.js",127,99],["./chunks/index-32eqzv1k.js",127,99],["./chunks/studio-881z1xrx.js"],["./chunks/publish-panel-2z9gw8ee.js",79,78,49,31,48,28,46,40,38,32,33,35,30,26,34,29],["./chunks/publish-quick-qx2455cj.js",26,30,38,28,29,31,32,33,34,35,40,46,48,49,50,27,43,41,42,44,45,63,61,36,37,51,82,92],["./chunks/publish-workspace-wrc1dgwx.js",66,82,61,63,45,92,50,49,27,37,36,31,51,44,43,48,28,46,40,38,41,42,32,33,35,30,26,34,29],["./chunks/studio-rthyg42z.js"],["./chunks/jsonMode-njkvsa02.js",123,128,126],["./chunks/javascript-pjp734q4.js",123],["./chunks/studio-zz9qe3rw.js",123,99],["./chunks/studio-v8867ddv.js",99],["./chunks/studio-wbcjbhy1.js",123,126],["./chunks/tsMode-epyfz1hv.js",123,128,126]],0);
|
|
2
2
|
var FI=pe(function(Twe,DI){var Vp=Object.prototype.hasOwnProperty,MI=Object.prototype.toString,{defineProperty:jI,getOwnPropertyDescriptor:RI}=Object,AI=function e(t){if(typeof Array.isArray==="function")return Array.isArray(t);return MI.call(t)==="[object Array]"},II=function e(t){if(!t||MI.call(t)!=="[object Object]")return!1;var r=Vp.call(t,"constructor"),o=t.constructor&&t.constructor.prototype&&Vp.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!r&&!o)return!1;var a;for(a in t);return typeof a>"u"||Vp.call(t,a)},LI=function e(t,r){if(jI&&r.name==="__proto__")jI(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(!Vp.call(t,r))return;else if(RI)return RI(t,r).value}return t[r]};DI.exports=function e(){var t,r,o,a,i,s,l=arguments[0],d=1,f=arguments.length,c=!1;if(typeof l==="boolean")c=l,l=arguments[1]||{},d=2;if(l==null||typeof l!=="object"&&typeof l!=="function")l={};for(;d<f;++d)if(t=arguments[d],t!=null){for(r in t)if(o=OI(l,r),a=OI(t,r),l!==a){if(c&&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(c,s,a)})}else if(typeof a<"u")LI(l,{name:r,newValue:a})}}return l}});var mw=[],zm=null,bl=null;function vF(){zm=null;let e=bl;if(!e)return;for(let t of mw.splice(0))e.call(document.head,t)}function wF(e){if(e instanceof HTMLLinkElement&&e.rel==="modulepreload"){if(mw.push(e),zm===null)zm=requestAnimationFrame(vF);return e}return bl?bl(e):e}function fw(){let e=document.head;if(!e||e.__modulePreloadsBatched)return;bl=Node.prototype.appendChild.bind(e),e.__modulePreloadsBatched=!0,e.appendChild=wF}var Cn=new Map;function hw(e){let t=Cn.get(e);if(t)return t;let r={map:null,step:-1,view:"visual"};return Cn.set(e,r),r}function Bm(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 Wm(e){return Cn.get(e)?.map??null}function yl(e){return Cn.get(e)?.map?.steps.length??0}function bw(e){return Cn.get(e)?.step??-1}function yw(e,t){let r=Cn.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 Mo(e){return Cn.get(e)?.view??"visual"}function Fa(e,t){return!t||Mo(e)==="code"}function Jm(e,t){hw(e).view=t}function ww(e){Cn.delete(e)}var xw={$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"}}}]};T("diff-toolbar",xw);function $w(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 Sw(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"});$w(o,t);let a=null,i=!1,s=R("diff-toolbar",o,e).then((l)=>{let d=l.root;if(i)return l.dispose(),d;return a=l,d});return{dispose(){i=!0,a?.dispose(),a=null},ready:s,update:(l)=>$w(o,l)}}var Ha=new Map;function vl(e,t){let r=Ha.get(e);if(r&&r.host!==t)r.surface?.dispose(),Ha.delete(e);if(t&&!Ha.has(e))Ha.set(e,{host:t,surface:null})}var Rw=()=>{};function Aw(e){Rw=e}var Iw=null;function Lw(e){Iw=e}function Ow(e){vo(e).prevCanvasMode=null,Rw(e),Iw?.()}function wl(e){let t=Ha.get(e);if(!t)return;let r=$F(e);if(t.surface){t.surface.update(r);return}t.surface=Sw(t.host,r,{next:()=>Tw(e,1),previous:()=>Tw(e,-1),showCode:()=>Cw(e,"code"),showVisual:()=>Cw(e,"visual")})}function Cw(e,t){if(Mo(e)===t)return;Jm(e,t),Ow(e)}function kF(e,t,r){let o=e.kind==="modified"?"changed":e.kind;return`Change ${t+1} of ${r}, ${o}.`}function Tw(e,t){Km(e,t).catch((r)=>{console.warn("stepDiffAndReveal:",r)})}async function Km(e,t){let r=yw(e,t);if(r===null)return;wl(e);let o=Wm(e)?.steps[r],{panels:a}=vo(e),i=a[0]?.canvas,s=a[1]?.canvas;if(!o)return;let{hostForCanvas:l,measureInCanvas:d,revealCanvasPathIn:f}=await (le("ssv7kyj0"),import("./chunks/iframe-host-ssv7kyj0.js")),b=(await Promise.all([o.originalPath&&i?d(i,o.originalPath):null,o.currentPath&&s?d(s,o.currentPath):null])).filter((A)=>A!==null),y=kF(o,r,yl(e));if(b.length===0){qx(`${y} Not shown on the canvas.`);return}let w=Math.min(...b.map((A)=>A.top)),k=Math.max(...b.map((A)=>A.top+A.height));qS({height:k-w,top:w},vo(e));let E=o.currentPath&&s?l(s):null;if(E&&o.currentPath)await f(E,o.currentPath);qx(y)}function $F(e){let t=Wm(e),r=Mo(e)==="code"||t===null,o=r?0:yl(e),a=r?-1:bw(e),i=r?"Changed lines are marked":o===0?"No changes":a<0?`${o} ${o===1?"change":"changes"}`:`${a+1} of ${o}`,s=Mo(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 Gm(e){let{pane:t}=e;return n(t)?t:m.activePaneId}var Fw=We("Which pane to act on. Defaults to the focused one."),Nw=Se({pane:Fw},[]);function _w(){let e=(t)=>yl(t)>0;return[{args:Nw,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)=>Km(Gm(r),1)},{args:Nw,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)=>Km(Gm(r),-1)},{args:Se({pane:Fw,view:di(["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=Vn("diff.setView",r,"view",["visual","code"]),a=Gm(r);if(Mo(a)===o)return;Jm(a,o),Ow(a)}}]}var SF=250000;class Hw{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 d of new Set([...Object.keys(r),...Object.keys(o)])){if(d==="children"||Ws(r[d],o[d]))continue;if(a){if(!this.rootKeys.includes(d))this.rootKeys.push(d)}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(!Ws(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=oT(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 d=r[l.aIndex],f=o[l.bIndex];if(v(d)&&v(f))this.diffNode([...e,"children",l.aIndex],[...t,"children",l.bIndex],d,f);else if(!Ws(d,f))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 Bw(e,t,r={}){let o=new Hw(r.maxCells??SF);return o.diffNode([],[],e,t),{current:o.current,degraded:o.degraded,original:o.original,rootKeys:o.rootKeys,steps:o.steps}}var Uw={$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}"}}]}]}}]};T("pane-grid",Uw);var TF="pane",PF="pane-stage",xl=`[part="${TF}"]`,Yw=`[part="${PF}"]`,EF=new Map([["pane","pane"],["strip","strip"],["chrome","chrome"],["pane-stage","stage"],["drop-zone","dropZone"]]);function NF(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function jF(e){let t=e?.$map,r=v(t)?t.item:void 0,o=v(r)?r.id:void 0;return n(o)?o:""}function Xw(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:(d,f,c,b)=>{let y=EF.get(NF(c));if(y)o.cellPart(jF(b),y,d)}}).then((d)=>{if(s){d.dispose();return}i=d});return{dispose(){s=!0,i?.dispose(),i=null,e.replaceChildren()},drag(d){a.armed=d.armed,a.edgePane=d.edgePane},ready:l,update(d,f){a.rows=d,a.paneSplit=f}}}var Qw="--stage-scrollbar-w";function RF(e){return Math.max(0,e.offsetWidth-e.clientWidth)}function ex(e){return xh(e)?.closest(xl)??document.documentElement}function tx(e,t){if(e.stageScrollbar?.scroller===t)return;if(za(e),!t)return;let r=ex(e),a=new ResizeObserver(()=>{r.style.setProperty(Qw,`${RF(t)}px`)});a.observe(t),e.stageScrollbar={observer:a,scroller:t}}function za(e){e.stageScrollbar?.observer.disconnect(),e.stageScrollbar=null,ex(e).style.setProperty(Qw,"0px")}function AF(e){return`"${e.replaceAll("\\",String.raw`\\`).replaceAll('"',String.raw`\"`)}"`}function IF(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:${AF(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 LF(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(IF(r,a.color,a.name??a.login??String(r)))}return t.join(`
|
|
4
4
|
`)}function nx(e,t){let r=t.createElement("style");r.dataset.jxCollabCursors="true",t.head.append(r);let o=()=>{r.textContent=LF(e)};return o(),e.on("change",o),()=>{e.off("change",o),r.remove()}}var kl=null,lx=null;function cx(){if(kl)return Promise.resolve(kl);return lx??=(le("qg1b5eqx"),import("./chunks/grid-view-qg1b5eqx.js")).then((e)=>(kl=e,e)),lx}function px(){return kl}var mx={$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"}}]}}}]};T("grid-panel",mx);function gx(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 MF(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function Ym(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"});gx(o,t);let a=null,i=!1,s=R("grid-panel",o,e,{onNodeCreated:(l,d,f)=>{if(MF(f)==="host"&&l instanceof HTMLElement)r.gridHost(l)}}).then((l)=>{let d=l.root;if(i)return l.dispose(),d;return a=l,d});return{dispose(){i=!0,a?.dispose(),a=null},ready:s,update:(l)=>gx(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"}]}]}}]}]};T("grid-views",yx);var FF="grid/views";function wx(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 xx(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});wx(o,e);let a={anchor:r,name:"grid-views",scope:o,slot:FF};if(t.dismissed)a.onDismissed=t.dismissed;let i=Vu(a);return{close:i.close,host:i.host,isOpen:i.isOpen,ready:i.ready,update:(s)=>{if(i.isOpen())wx(o,s)}}}var $x={$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"}]}]}]}]};T("grid-replace",$x);var HF="grid/replace";function Tx(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:HF};if(t.dismissed)a.onDismissed=t.dismissed;let i=Vu(a);return i}var $l=new Map,Xm=new Map;function Wa(e){return $l.get(e)??null}function qa(e){Xm.get(e)?.dispose(),Xm.delete(e);let t=$l.get(e);if(!t)return;t.views?.close(),t.replace?.close(),t.view?.destroy(),t.scope.stop(),t.surface?.dispose(),$l.delete(e)}function Qm(e,t){let r=Wa(e);return r!==null&&r.tabId===t.id&&r.wrap.isConnected}function zF(e){let t=$_(e);if(!t)return"View";return WR(e)?`${t} •`:t}function BF(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 VF(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 Nx(e){let{state:t}=e,r=e.source.id,o=e.buffer.dirtyCount(),a=zl(r),i=t.query.limit??50,s=t.query.offset??0,l=BF(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:Ed(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:VF(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:zF(r)}}function jx(e,t){let r=e.source.id,o=Ed(r)??{},a=Nu(r),i=$_(r),s=new Set(o.hidden),l=o.sort??null,{columns:d}=e.state,f=d.map((c)=>({label:c.title,value:c.field}));return{columns:d.map((c)=>({field:c.field,title:c.title,visible:!s.has(c.field)})),dirOptions:[{label:"Ascending",value:"asc"},{label:"Descending",value:"desc"}],fieldOptions:[{label:"Source order",value:""},...f],groupField:e.state.grouping??"",groupOptions:[{label:"Ungrouped",value:""},...f],saveLabel:i?"Save as…":"Save view…",sortDir:l?.dir??"asc",sortDirDisabled:l===null,sortField:l?.field??"",views:a.map((c)=>({active:c.name===i?"true":"false",current:c.name===i?"true":"false",deleteLabel:`Delete the saved view ${c.name}`,key:c.name,name:c.name})),viewsState:a.length===0?"empty":"listed",x:t.x,y:t.y}}function WF(e,t,r){if(t.views?.isOpen()){t.views.close(),t.views=null;return}let o=ze(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=(f,c)=>{Qf(i,f),c(),t.bump()},d=(f)=>l({sort:f},()=>{e.setSort(f)});t.views=xx(jx(e,a),{applyView:(f)=>{t.applyLayout(By(i,f)),s()},deleteView:(f)=>{qF(i,f,t)},dismissed:()=>{t.views=null},reset:()=>{Kk(i),t.applyLayout(null),s()},saveView:()=>{Ax(e,t)},setGroup:(f)=>{l({groupBy:f||null},()=>e.setGrouping(f||null))},setSortDir:(f)=>{let c=Ed(i)?.sort??null;if(c)d({dir:f==="desc"?"desc":"asc",field:c.field})},setSortField:(f)=>{let c=Ed(i)?.sort??null;d(f===""?null:{dir:c?.dir??"asc",field:f})},toggleColumn:(f,c)=>{let b=new Set(Ed(i)?.hidden);if(c)b.delete(f);else b.add(f);l({hidden:[...b]},()=>t.remount())}},r),t.bump()}async function qF(e,t,r){if(await Ko("Delete View",`Delete the saved view "${t}"? The grid keeps its current layout.`,{confirmLabel:"Delete",destructive:!0})&&Jk(e,t))r.bump()}async function Ax(e,t){let r=e.source.id,o=await xi("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:$_(r)??""});if(o===null)return null;let a=VR(r,o);if(!a)return C.warn("Views cannot be saved — this browser has local storage disabled.",{key:"grid.saveView",source:"Data"}),null;return t.bump(),a.name}function UF(e,t,r){if(t.replace?.isOpen()){t.replace.close(),t.replace=null;return}let o=ze(r);t.replace=Tx({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){C.info("No matches.",{key:"grid.replaceAll"});return}C.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 Lx(e,t){let{paneId:r,wrap:o}=e;if(Qm(r,t))return;qa(r);let a=ir(t);if(!a&&t.documentPath?.toLowerCase().endsWith(".csv"))a=_p(t,iS(t.documentPath)),a.load();if(!a){Xm.set(r,Ym(o,KF(),YF()));return}let i=ge(),s=g({views:0}),l=a,d=null;function f(y){if(c.view?.destroy(),c.view=null,!d)return;let w=d,k=px();if(k){let E=k.createGridView(w,l);c.view=E,y?.(E);return}cx().then(({createGridView:E})=>{if(Wa(r)!==c||d!==w||c.view)return;let A=E(w,l);c.view=A,y?.(A),c.bump()})}let c={applyLayout(y){l.setSort(y?.sort??null),l.setGrouping(y?.groupBy??null),f((w)=>w.setSearch(y?.filter??"")),c.bump()},bump(){s.views+=1},paneId:r,remount(){f()},replace:null,scope:i,surface:null,tabId:t.id,view:null,views:null,viewsAt:{x:0,y:0},wrap:o};$l.set(r,c),c.surface=Ym(o,Nx(l),{addRow:()=>l.addRow(),deleteRows:()=>l.deleteRows(c.view?.getSelectedRowKeys()??[]),fillDown:()=>c.view?.fillDown(),gridHost:(y)=>{d=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)=>{UF(l,c,y)},openViews:(y)=>{WF(l,c,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)=>{Qf(l.source.id,{filter:y}),c.view?.setSearch(y)}}),c.surface.ready.then(()=>{if(Wa(r)===c)c.bump()});let b=!1;i.run(()=>{ne(()=>{if(Wa(r)!==c)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,c.surface?.update(Nx(l)),c.views?.update(jx(l,c.viewsAt)),!c.view&&!l.state.loading&&l.state.columns.length>0&&d)f((y)=>{if(b)return;b=!0;let w=Ed(l.source.id);JF(l,w),y.setSearch(w?.filter??"")});GF(l,c,t.documentPath)})})}function JF(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 GF(e,t,r){let o=gD(r);if(o===void 0||!r||!t.view||e.state.loading)return;bD(r);let a=e.state.rows[o];if(a)t.view.revealRow(a.key)}function KF(){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 YF(){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 Va(){let e=ir(u.value),t=Wa(m.activePaneId);if(!e||!t||t.tabId!==e.tab.id)return null;return{controller:e,panel:t}}function Ba(e){let t=Va();if(!t)throw Error(`command "${e}" needs a grid on screen`);return t}function XF(){let e=(t,r)=>{let{controller:o}=Ba(t),a=o.source.id,i=St(t,r,"name"),s=Nu(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:()=>Va()!==null,run:async()=>{let{controller:t,panel:r}=Ba("grid.saveView");await Ax(t,r)},title:"Save Grid View…"},{args:Se({name:We("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:()=>Va()!==null,run:(t,r)=>{let{gridId:o,name:a}=e("grid.applyView",r),{panel:i}=Ba("grid.applyView");i.applyLayout(By(o,a))},title:"Apply Grid View"},{args:Se({name:We("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:()=>Va()!==null,run:(t,r)=>{let{gridId:o,name:a}=e("grid.deleteView",r);Jk(o,a),Ba("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:()=>Va()!==null,run:()=>{let{controller:t,panel:r}=Ba("grid.resetView");Kk(t.source.id),r.applyLayout(null)},title:"Reset Grid View"}]}function Mx(e){e.registerAll(XF())}function Fx(){jL();let e=Ay(Sr(u.value?.doc.document?.style));Kw(e)}var Hx={$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…"}]}]}}}]}}]};T("settings-css-vars",Hx);var Sl=new WeakMap;function zx(e){return{...e,hasError:e.error!==""}}function Bx(e,t,r){let o=Sl.get(e);if(o&&(o.handle===null||o.handle.root.isConnected)){Object.assign(o.scope,zx(t));return}o?.handle?.dispose(),e.textContent="";let a=g({...zx(t),...r}),i={handle:null,scope:a};Sl.set(e,i),R("settings-css-vars",a,e).then((s)=>{i.handle=s})}function Vx(e,t){let r=Sl.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 Wx(e,t,r){let o=Sl.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 Ux={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"}},ZF="#3b82f6",e_="#111111",t_={label:"Add override…",value:""},Jx=new WeakMap;function Do(e){let t=Jx.get(e);if(!t)t={add:{},current:null,error:""},Jx.set(e,t);return t}function Cl(e,t){let{add:r}=Do(e);return r[t]??={name:"",value:""}}function Yx(){return x?.projectConfig||{}}function wr(){return Yx().style||{}}function nf(){return g_(to(Yx().$media))}function Ua(e){Fx(),Ja(e),r_(e)}async function r_(e){try{await no({style:{...wr()}}),Do(e).error=""}catch(t){Do(e).error=`Could not save project.json — ${Q(t)}`}Ja(e)}function Xx(e,t){let r=e===void 0?"transparent":String(e);return{swatchBg:r,swatchInput:r.startsWith("#")?r:t}}function o_(e,t,r,o){let a=Ny(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),...Xx($c(o,a),e_)}}function s_(e,t,r,o,a){let i=t.id==="color",s=String(e.value),l=$c(r,e.value),d=dp(e.value),f=o.filter((b)=>i&&b.kind==="scheme"||Ny(r,b,e.name)!==void 0),c=s===""?[]:TR(r,o,e.name,f);return{addLabel:`Add an override for ${e.name}`,addOptions:[t_,...c.map((b)=>({label:b.label,value:b.name}))],addPick:"",addState:c.length===0?"none":"shown",chipLabel:d??"",chipState:d===null?"none":i&&l!==void 0?"swatch":"plain",chipSwatch:l===void 0?"":String(l),chipTitle:d===null?"":`${Py(d)} → ${l===void 0?"unresolved":String(l)}`,current:e.name===a,label:e.name,name:e.name,overrides:f.map((b)=>o_(e,b,i,r)),overrideState:f.length===0&&c.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,...Xx(i?l:void 0,ZF)}}function b_(e){let t=wr(),r=nf(),o=r.some((i)=>i.kind==="scheme"),a=[];for(let{group:i,tokens:s}of m_(t)){if(i.id==="other"&&s.length===0)continue;let l=Cl(e,i.id);a.push({addLabel:`Add a ${i.title} variable`,addName:l.name,addValue:l.value,id:i.id,nameHint:Ux[i.id].name,nameLabel:`New ${i.title} name`,noticeState:i.id==="color"&&!o?"shown":"none",title:i.title,tokens:s.map((d)=>s_(d,i,t,r,Do(e).current)),valueHint:Ux[i.id].value,valueLabel:`New ${i.title} value`})}return{error:Do(e).error,groups:a}}function Ja(e){Bx(e,b_(e),k_(e))}function Zm(e){return p_.find((t)=>t.id===e)}function v_(e,t){let r=Zm(t);if(!r)return;let o=Cl(e,r.id),a=uv(o.name,r.prefix);if(!a||!o.value)return;wr()[a]=o.value,o.name="",o.value="",Ua(e)}function w_(e,t,r){let o=wr(),a=nf().find((s)=>s.name===r);if(!a||Ny(o,a,t)!==void 0){Ja(e);return}let i=o[t];if(!n(i)&&!Z(i))return;Pk(o,a,t,String(i)),Ua(e)}function x_(){rt("settings.open",{section:"contexts"},"Styles")}var Kx=new WeakMap;function k_(e){let t=Kx.get(e);if(!t)t={addOverride:(r,o)=>{w_(e,r,o)},addToken:(r)=>{v_(e,r)},manageContexts:()=>{x_()},removeToken:(r)=>{delete wr()[r],Ua(e)},setAddName:(r,o)=>{let a=Zm(r);if(a)Cl(e,a.id).name=o},setAddValue:(r,o)=>{let a=Zm(r);if(a)Cl(e,a.id).value=o},setOverride:(r,o,a)=>{let i=nf().find((s)=>s.name===o);if(!i)return;Pk(wr(),i,r,a),Ua(e)},setToken:(r,o)=>{wr()[r]=o,Ua(e)}},Kx.set(e,t);return t}function rf(e){Ja(e)}function of(e,t,r={}){if(Do(e).current=t,Ja(e),t===null||r.reveal===!1)return;Vx(e,t)}function Qx(e,t,r={}){Wx(e,t,r.add===!0)}var Ga=Na({focus:null,served:!0});function Tl(e){if(e.kind==="variable")h.stylebook.variable=e.name;Ga.value={focus:e,served:!1}}function Zx(){Ga.value={focus:null,served:!0}}var ek={$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"}}]}]};T("styles-variables",ek);function C_(e,t){Object.assign(e,t),e.headingId=`styles-variables-${t.region.replaceAll(/[^\w-]/g,"-")}`}function j_(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function tk(e,t,r,o){e.replaceChildren();let a=g({headingId:"",lede:"",manageContexts:r.manageContexts,manageLabel:"",region:"",saving:"",schemes:"",title:""});C_(a,t);let i=null,s=!1,l=R("styles-variables",a,e,{onNodeCreated:(d,f,c)=>{if(d instanceof HTMLElement&&j_(c)==="editor")o.editorSlot(d)}}).then((d)=>{if(s){d.dispose();return}i=d});return{attached:()=>{if(s)return!1;let d=i?.root;return d===void 0?!0:e.contains(d)},dispose(){s=!0,i?.dispose(),i=null},ready:l}}var F_="Variables",__="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).",H_="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.",z_="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 B_(e){return{lede:__,manageLabel:"Manage contexts…",region:wi(e,"variables"),saving:H_,schemes:z_,title:F_}}var El=new Map;function af(e,t){let r=El.get(e);return r!==void 0&&r.tabId===t.id&&r.wrap.isConnected&&r.surface.attached()}function Ka(e){let t=El.get(e);if(!t)return;t.scope.stop(),t.surface.dispose(),El.delete(e)}function q_(){rt("settings.open",{section:"contexts"},"Styles")}function nk(e){if(x&&e.documentPath===ln)eC()}function U_(e,t){if(t?.kind==="group"){Qx(e,t.group,{add:t.add});return}of(e,t?.name??h.stylebook.variable)}function rk(e){let t=Ga.value;if(t.served)return!1;return t.served=!0,U_(e,t.focus),!0}function ok(e){Jr();try{e()}finally{Yr()}}function ak(e,t){let{paneId:r,wrap:o}=e;if(af(r,t))return;Ka(r),nk(t);let a=null,i=tk(o,B_(r),{manageContexts:q_},{editorSlot:(l)=>{if(a=l,rf(l),!rk(l)&&h.stylebook.variable!==null)of(l,h.stylebook.variable,{reveal:!1})}}),s=ge();El.set(r,{paneId:r,scope:s,surface:i,tabId:t.id,wrap:o}),s.run(()=>{let l=null;ne(()=>{let{document:d}=t.doc,f=JSON.stringify([d.style??null,d.$media??null]);if(f===l)return;let c=l===null;l=f;let b=a;if(!c&&b)ok(()=>{nk(t),rf(b)})}),ne(()=>{Ga.value;let d=a;if(d)ok(()=>{rk(d)})})})}var ik={$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"}]}]}}}]}]};T("add-repo",ik);function K_(e){return`add-repo-repo-${e}`}function X_(e){return`add-repo-location-${e}`}function sk(e){let t=e.rows.map((i,s)=>({...i,id:K_(s)})),r=e.locations.map((i,s)=>({...i,id:X_(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 lk(e){let t=document.createElement("div");t.style.pointerEvents="auto",t.setAttribute(qe,ft("dialog","add-repo")),e.layer.append(t);let r=!1,o=()=>{if(r)return;r=!0,e.onClosed()},a=()=>r,i=g({...sk(e.view),closed:o,confirm:()=>{e.onConfirm()},move:(d)=>{e.onMove(d)},moveLocation:(d)=>{e.onMoveLocation(d)},openRepo:(d)=>{e.onOpenRepo(d)},pickLocation:(d)=>{e.onLocation(d)},refresh:()=>{e.onRefresh()},select:(d)=>{e.onSelect(d)},setFilter:(d)=>{i.filter=d,e.onFilter(d)},setFolder:(d)=>{i.folder=d,e.onFolder(d)},setOwner:(d)=>{i.owner=d,e.onOwner(d)}}),s=null,l=R("add-repo",i,t).then(async(d)=>{s=d;let f=d.root;if(a())return d.dispose(),f;if(await Jt(f),a())return f;Pt(f);let c=f.querySelector('[part="filter"]');if(c)vC(c);return f});return{close(){let d=s?.root;if(d instanceof HTMLElement)Nt(d);s?.dispose(),s=null,t.remove(),o()},host:t,ready:l,update(d){Object.assign(i,sk(d))}}}var eH=250,Et=null,Fo="add",Ht=null,Za="",_o="",et="",jt="",Pn=!1,ei="",wt=new Map,Ya=null,Xa="",Rt="",_t=!1,sf=null;function lf(){let e=p();return te(e.listRepos)&&te(e.importProject)}function pk(){return p().openProjectPicker==="repo-list"&&lf()}function uk(){return fk("add")}function mk(){return fk("open")}function fk(e){if(Et)return Promise.resolve(null);return Fo=e,Ht=null,Za="",_o="",et="",jt="",Pn=!1,ei="",wt=new Map,Rt="",_t=!1,new Promise((t)=>{sf=t,Et=lk({layer:tt("dialog"),onClosed:()=>{hk(null)},onConfirm:()=>{pf()},onFilter:(r)=>{Za=r,dt()},onFolder:(r)=>{jt=r,Pn=!0,Rt="",dt()},onLocation:(r)=>{jt=r,Pn=!0,Rt="",dt()},onMove:(r)=>{tH(r)},onMoveLocation:(r)=>{rH(r)},onOpenRepo:(r)=>{oH(r)},onOwner:(r)=>{_o=r,dt()},onRefresh:()=>{ck()},onSelect:(r)=>{jl(r,"now")},view:Hk()}),ck()})}function ck(){Ht=null,Rt="",df(),wt=new Map,dt(),Bd().then(dt),p().listRepos?.().then((e)=>{if(Ht=e,et)yk(et,"now")}).catch((e)=>{Ht=[],Rt=Q(e)}).finally(()=>{dt()})}function dt(){Et?.update(Hk())}function hk(e){let t=Et,r=sf;Et=null,sf=null,_t=!1,df(),r?.(e),t?.close()}function gk(){let e=Ht??[];if(Fo!=="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 cf(){let e=Za.trim().toLowerCase(),t=gk().filter((r)=>!_o||r.owner===_o);return e?t.filter((r)=>r.fullName.toLowerCase().includes(e)):t}function bk(){return et?(Ht??[]).find((e)=>e.fullName===et):void 0}function jl(e,t){if(e===et||_t)return;et=e,jt="",Pn=!1,ei="",Rt="",yk(e,t),dt()}function tH(e){let t=cf();if(t.length===0)return;let r=t.findIndex((i)=>i.fullName===et),o=r===-1?e>0?0:t.length-1:Math.min(t.length-1,Math.max(0,r+e)),a=t[o];if(a)jl(a.fullName,"soon")}function nH(){let e=wt.get(et);return e?.status==="done"?e.projects.locations:[]}function rH(e){let t=nH();if(t.length===0)return;let r=Dl(jt),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)jt=i.dir,Pn=!0,Rt="",dt()}function yk(e,t){let r=p(),o=(Ht??[]).find((i)=>i.fullName===e);if(!r.listRepoProjects||!o)return;let a=wt.get(e);if(a){if(a.status==="done")vk(e);return}if(df(),wt.set(e,{status:"loading"}),t==="now"){dk(o);return}Xa=e,Ya=setTimeout(()=>{Ya=null,Xa="",dk(o)},eH)}function df(){if(Ya===null)return;if(clearTimeout(Ya),Ya=null,Xa)wt.delete(Xa),Xa=""}async function dk(e){let t=Et,r;try{r={projects:await p().listRepoProjects({name:e.name,owner:e.owner}),status:"done"}}catch(o){r={message:Q(o),status:"failed"}}if(Et!==t||wt.get(e.fullName)?.status!=="loading")return;if(wt.set(e.fullName,r),e.fullName===et){if(vk(e.fullName),ei===e.fullName){if(ei="",r.status==="done"&&r.projects.locations.length===1){pf();return}}}dt()}function vk(e){let t=wt.get(e);if(Pn||e!==et||t?.status!=="done")return;let{locations:r}=t.projects;jt=(r.find((o)=>o.dir==="")??r[0])?.dir??""}function oH(e){jl(e,"now");let t=wt.get(e);if(t?.status==="loading"){ei=e;return}if(t?.status==="done"&&t.projects.locations.length>1&&!Pn)return;pf()}function wk(){return Dl(jt)===null?"A project folder is a path inside the repository, without . or .. segments.":""}function Ek(){let e=bk();if(!e||_t||wk()!=="")return!1;let t=wt.get(e.fullName);if(Pn||!t)return!0;return t.status==="failed"||t.status==="done"&&(t.projects.locations.length>0||t.projects.truncated)}function pf(){if(!et){let[e]=cf();if(e)jl(e.fullName,"now");return}if(!Ek())return;Fk(et,Dl(jt)??"")}async function Fk(e,t,r=!1){let o=(Ht??[]).find((i)=>i.fullName===e);if(!o||_t&&!r)return;let a=Et;_t=!0,Rt="",dt();try{let i={name:o.name,owner:o.owner},s=await p().importProject?.(t?{...i,dir:t}:i);if(Et!==a)return;if(s){hk(s);return}Rt="This platform cannot import repositories."}catch(i){if(Et!==a)return;if(Rt=Q(i),_t=!1,dt(),!r&&await Em(i)&&Et===a)await Fk(e,t,!0);return}_t=!1,dt()}function aH(e){return{fullName:e.fullName,isJx:e.isJxProject,isPrivate:e.private,meta:e.defaultBranch}}function iH(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 sH(){if(Za||_o)return"filter";if(Fo==="open"&&(Ht??[]).length>0)return"write";return cC()?"install":"none"}function lH(){let e=[...new Set(gk().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 cH(){let e=bA();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 dH(e){if(!e)return{branch:"",detailMeta:"",detailName:"",detailState:"none",folderHelp:"",locations:[]};let t=wt.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((d)=>iH(d,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 Hk(){let e=bk(),{branch:t,...r}=dH(e),o=wk(),a=Dl(jt)??"",i=Fo==="open"?"Open":"Add";return{...r,access:cH(),busy:_t,canConfirm:Ek(),confirmLabel:_t?Fo==="open"?"Opening…":"Adding…":i,emptyState:sH(),failure:Rt,chosenFolder:a,filter:Za,folder:jt,folderError:o,installUrl:lC()?.appInstallUrl??"",loading:Ht===null,owner:_o,owners:lH(),rows:cf().map((s)=>aH(s)),selected:et,summary:e&&o===""?`${i}s ${e.fullName} ${a?`at ${a}/`:"at the repository root"}${t?` on ${t}`:""}.`:"",title:Fo==="open"?"Open Project":"Add existing repository"}}var zk={$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}"}]}]}}]}]}}}]}]};T("welcome",zk);var Ho=null;function Yk(e){Ho=e}function mf(e){let t=/^\/(?:home|Users)\/[^/]+(?=\/|$)/.exec(e);return t?`~${e.slice(t[0].length)}`:e}function e$(e){return mf(e).split("/").filter(Boolean).slice(0,-1)}function Bk(e,t){let r=e$(e);if(r.length===0)return mf(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 Wk(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)=>e$(s.root).length),1),i=o.map((s)=>Bk(s.root,a));for(let s=1;s<=a;s++){let l=o.map((d)=>Bk(d.root,s));if(new Set(l).size===o.length){i=l;break}}if(new Set(i).size!==o.length)i=o.map((s)=>mf(s.root));for(let[s,l]of o.entries())r.set(l.root,i[s])}return r}var uf=60*Qp,Uk=24*uf;function uH(e,t=dr()){let r=Math.max(0,t-e);if(r<Qp)return"just now";if(r<uf){let i=Math.floor(r/Qp);return`${i} minute${i===1?"":"s"} ago`}if(r<Uk){let i=Math.floor(r/uf);return`${i} hour${i===1?"":"s"} ago`}let o=Math.floor(r/Uk);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,Rl=null,ti=null,xr=null;function mH(){let e=dw(),t=UD().filter((i)=>!e.some((s)=>s.root===i.root)),r=Wk(e),o=Wk(t);return{actions:[{icon:"plus",id:"new",title:"New Project…"},{icon:"folder-open",id:"open",title:"Open Project…"},...hb()?[{icon:"download-simple",id:"clone",title:"Clone Git Repository…"}]:[],...lf()?[{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:cC(),installUrl:lC()?.appInstallUrl??"#",notices:a$().map((i)=>fH(i)),recent:e.map((i)=>({location:r.get(i.root)??i.root,name:i.name,root:i.root,when:uH(i.timestamp)}))}}function fH(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 hH(e){for(let t of a$())for(let r of t.actions??[])if(`${t.id}/${r.id}`===e)return r;return null}function t$(){return Gk??=g({actions:[],catalogue:[],clear:()=>{OD(),Al()},hasCatalogue:!1,hasRecent:!1,installNeeded:!1,installUrl:"#",noticeRun:(e)=>{let t=hH(e);if(t)hx(t).then(Al)},notices:[],open:(e)=>{Ho?.openRecentProject(e)},recent:[],remove:(e)=>{Y_(e),Al()},run:(e)=>{switch(e){case"new":{Ho?.openNewProject();break}case"open":{Ho?.openProject();break}case"clone":{Ho?.cloneRepository();break}case"add":{Ho?.addExistingRepo();break}default:break}}}),Gk}function Al(){Object.assign(t$(),mH())}function n$(e){if(Al(),Rl===e&&xr!==null&&xr.root.isConnected)return;if(ti&&Rl===e&&!xr)return;gH(),Rl=e;let r=R("welcome",t$(),e);ti=r,r.then((o)=>{if(ti===r)xr=o;else o.dispose()})}function gH(){let e=ti;if(ti=null,xr)xr.dispose(),xr=null;else if(e)e.then((t)=>t.dispose());Rl=null}var r$={$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}"}]}}}]};T("writing-banner",r$);function o$(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 i$="Writing mode: text and media are editable, the layout is locked";function s$(e){let t=Un(e.documentPath);if(!t)return null;let r=Vl(t.name)?.item??"entry",o=th(t.name,jc(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=DS(n(a)||a===!1?a:void 0,o??null);if(!i)return null;return{actionLabel:`Edit the ${Cb(i)} template in Design`,path:i.replace(/^\.\//,"")}}function w$(e,t){let r=s$(t);return{actionLabel:r?.actionLabel??"",actionState:r?"shown":"hidden",region:wi(e,"writing-banner"),text:i$}}var kr=new Map,ff=null;async function yH(e){let t=kr.get(e)?.tabId,r=t?m.tabs.get(t):void 0,o=r?s$(r):null;if(!o)return;let{openFileInTab:a}=await (le("rcn56qvm"),import("./chunks/files-rcn56qvm.js"));await a(o.path)}function vH(){for(let[e,t]of kr){let r=t.tabId?m.tabs.get(t.tabId):void 0;if(r)t.handle.update(w$(e,r))}}function hf(e,t){let r=kr.get(e);if(r?.host===t)return;if(r)r.handle.dispose(),kr.delete(e);if(!t)return;ff??=kp(vH);let o=o$(t,{actionLabel:"",actionState:"hidden",region:wi(e,"writing-banner"),text:i$},{openTemplate:()=>{yH(e)}});kr.set(e,{handle:o,host:t,tabId:null})}function x$(e,t){let r=kr.get(e);if(!r)return;r.tabId=t.id,r.handle.update(w$(e,t))}function ni(e){hf(e,null)}function k$(){for(let e of kr.keys())ni(e);ff?.(),ff=null}var $$={$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"}}]}}}]};T("canvas-stage",$$);function gf(e,t){let r=n(e)?void 0:e.attributes?.[t];return n(r)?r:""}function xH(e){let t=e?.$map,r=v(t)?t.item:void 0,o=v(r)?r.key:"";return n(o)?o:""}var kH=new Set(["panel","panel-viewport","panel-canvas"]);function $H(e,t,r,o){let a=e.get(t);if(!a)a=new Map,e.set(t,a);a.set(r,o)}function S$(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 C$(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});S$(a,t);let i=null,s=!1,l=R("canvas-stage",a,e,{onNodeCreated:(d,f,c,b)=>{let y=gf(c,"part");if(kH.has(y)&&d instanceof HTMLElement)$H(o,xH(b),y,d);else if(y&&d instanceof HTMLElement){let w=gf(c,"data-slot"),k=w==="frame"?a.framePart:w==="inner"?a.innerPart:y;r.host(k,d,gf(c,"data-side"))}}}).then((d)=>{if(s){d.dispose(),o.clear();return}i=d});return{dispose(){s=!0,i?.dispose(),i=null,o.clear()},panelNode:(d,f)=>o.get(d)?.get(f)??null,ready:l,update(d){let f=new Set(d.panels.map((c)=>c.key));for(let c of o.keys())if(!f.has(c))o.delete(c);return S$(a,d),l.then(()=>{})}}}var SH={x:160,y:120},CH=0.5,T$=[{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 TH(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 ri(e,t,r){let o=e.scale(),i=((e.lead?.(r)??0)+t/Math.abs(o))/r;return o>0?i:1-i}function PH(e,t,r){let o=e.scale(),a=e.lead?.(r)??0;return((o>0?t:1-t)*r-a)*Math.abs(o)}function vf(e,t){let r=()=>{let i=bx(e,t.axis==="x");if(i<=0)return;let s=ri(t,t.min(),i),l=ri(t,t.max(),i);e.min=Math.min(s,l),e.max=Math.max(s,l),e.collapse=ri(t,t.reset(),i),e.value=ri(t,t.read(),i)},o=(i)=>{let s=bx(e,t.axis==="x");if(s<=0)return;let l=PH(t,e.value,s),d=TH(t,l,E$(i));t.write(d),e.value=ri(t,d,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(),bf.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),bf.delete(e)}}var bf=new Map;function EH(){for(let e of bf.values())e()}function NH(e){return(e==="x"?window.innerWidth:window.innerHeight)*CH}function jH(e,t,r){return{axis:t,lead:()=>RH[e],max:()=>NH(t),min:()=>SH[t],read:()=>h.docks[e].size,reset:()=>iA[e],scale:()=>r,settle:()=>Fd(),write:(o)=>lA(e,Math.round(o))}}var RH={bottom:24,left:56,right:0};function AH(){for(let{axis:e,dock:t,grow:r,selector:o}of T$){let a=document.querySelector(o);if(a)P$.push(vf(a,jH(t,e,r)))}yf=ne(()=>{for(let{dock:e}of T$)h.docks[e].size;EH()})}var P$=[],yf=null;function IH(){for(let e of P$.splice(0))e();yf?.(),yf=null}Mb({mount:AH,unmount:IH});function LH(e,t,r){let o=vt(e.paneId);if(!o)return;if(t.style.maxWidth=`${Math.round(r)}px`,o.session.ui.editZoom!==1)ih(e);let a=ze(t).width||r;zS(e.paneId,o,a),t.dataset.editWidth=`${Math.round(a)}px`,t.classList.add("is-resizing")}function OH(e,t,r){let o=()=>vt(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(bm,i-2*jN):Number.POSITIVE_INFINITY},min:()=>bm,read:()=>ze(t).width||(o()?HS(o()):bm),reset:()=>{let i=o();return i?HS(i):bm},scale:()=>2*r,settle:()=>{t.classList.remove("is-resizing"),ih(e)},snap:(i,s)=>{let l=o();if(s.altKey||!l)return i;return PN(i,BN(l),FN)},write:(i)=>{LH(e,t,i)}}}var Il=new Map;function MH(){for(let[e,t]of Il)if(!e.isConnected)t(),Il.delete(e)}function wf(e,t,r,o){if(MH(),!t||!r||Il.has(t))return;Il.set(t,vf(t,OH(e,r,o)))}var Ll=null,N$=null,xf=!1;function j$(e){Ll=e,N$=ge(),N$.run(()=>{ne(()=>{let t=u.value;if(!t)return;t.session.selection.map((r)=>r.join("/")).join("|"),t.session.hover,t.doc.mode,t.session.ui.activeMedia,oi()})})}function oi(){if(!Ll)return;if(!xf)xf=!0,queueMicrotask(DH)}function DH(){if(xf=!1,!Ll)return;if(!u.value)return;Vw(),Ll.renderBlockActionBar()}var H$=null;function V$(e){H$=e}function FH(e){let t=Wi(e.doc.sourceFormat);return t?Dw(t.mediaType)?.split("/").pop()??"plaintext":"json"}async function q$(e){if(Wi(e.doc.sourceFormat))return Gu(e);return ko(e.doc.document,e.doc.layout??null)}var kf=new Map;function Er(e=m.activePaneId){if(kf.has(e))return;kf.set(e,requestAnimationFrame(()=>{kf.delete(e);try{It(e)}catch(t){console.error("renderCanvas error:",t)}}))}function J$(e){Nb(e),e.textContent="",delete e._$litPart$}var _l=new WeakMap,Sf=new WeakMap,I$=new WeakMap;function _H(e){let t=_l.get(e);if(!t)t=new Map,_l.set(e,t);return t}function Tr(e,t){return _l.get(e)?.get(t)??null}function HH(e){let t=I$.get(e);if(t)return t;return t={host:(r,o,a)=>{if(_H(e).set(a?`${r}:${a}`:r,o),r==="panzoom")e.panzoomWrap=o;else if(r==="writing-banner")hf(e.paneId,o);else if(r==="diff-toolbar")vl(e.paneId,o)},pickPanel:(r)=>WN(Sf.get(e)??[],r)},I$.set(e,t),t}function En(e,t,r){Sf.set(e,r);let o=e.stage,a=o??C$(e.wrap,t,HH(e));return e.stage=a,(o?a.update(t):a.ready).then(()=>{if(e.stage!==a)return null;return zN(r,a),a})}function M$(e){return{frame:e,framePart:"panzoom",frameVars:"",handles:"hidden",hug:!1,innerPart:"boards",lead:e==="code"?"toolbar":"none",panels:[]}}function Y$(e){if(!e.stage)return;e.stage.dispose(),e.stage=null,_l.delete(e),Sf.delete(e),vl(e.paneId,null)}function Hl(e){e.sourceCollabCleanup?.(),e.sourceCollabCleanup=null}async function zH(e,t,r){let{bindMonacoToYText:o}=await (le("vq1hgnn0"),import("./chunks/monaco-binding-vq1hgnn0.js")),a=o({awareness:r.awareness,editors:[t],model:e,origin:r.localOrigin,text:r.text}),i=nx(r.awareness,document);return()=>{i(),a(),r.leave()}}function ai(e){let t=e.monacoEditor;if(!t)return;mv(t,"source"),t.getModel()?.dispose(),t.dispose(),e.monacoEditor=null}function ii(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 D$(e,t){return e?.map((r)=>({kind:r.kind==="modified"?t:r.kind,path:r.path}))??null}async function BH(e,t,r){let{paneId:o}=e,a=r.filePath;if(e.monacoDiffEditor&&e.monacoDiffEditor._diffKey!==a)ii(e);let i=await qm();if(!Cv(t,e.monacoDiffEditor,()=>Uo(o)==="git-diff"&&Fa(o,ub(a))))return;let s=nM(o,a||"document.json"),l=iM(a||"document.json"),d=i.editor.createModel(r.originalContent||"",l,i.Uri.parse(s.head)),f=i.editor.createModel(r.currentContent||"",l,i.Uri.parse(s.work)),c=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:_m()});c.setModel({modified:f,original:d}),c._diffKey=a,e.monacoDiffEditor=c}function _$(e){let t=e.wrap,{paneId:r}=e;if(qa(r),rw(r),ni(r),Ew(r),Ka(r),Og(r),Hl(e),ai(e),ii(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,J$(t),e.panzoomWrap=null,t.style.padding="",t.style.alignItems="",t.style.flexDirection="",t.style.gap="",t.style.display="",t.style.overflow="",d_(),Dk(),qf(),sp(),e.prevCanvasMode=null}async function VH(e,t,r,o,a){let{paneId:i}=t,s=await qm();if(!Cv(r,t.monacoEditor,()=>vt(i)===e&&Uo(i)==="source"))return;let l=s.Uri.parse(dI(o)),d=s.editor.createModel("",a,l),f=FO(e);if(f)f.enter().then(async()=>{let y=t.monacoEditor;if(!y||y.getModel()!==d){f.leave();return}let w=await zH(d,y,f);if(t.monacoEditor!==y||y.getModel()!==d){w();return}if(t.sourceCollabCleanup=w,y._writes?.markShared(),f.readOnly)y.updateOptions({readOnly:!0})}).catch(()=>{f.leave();let y=t.monacoEditor;if(y&&y.getModel()===d)y.updateOptions({readOnly:!0})});else q$(e).then((y)=>{let w=t.monacoEditor;if(w&&w.getModel()===d&&!Kp(w,""))w._ignoreNextChange=!0,d.setValue(y),w._writes?.markSettled()}).catch(()=>{});let c=s.editor.create(r,{automaticLayout:!0,fontFamily:"'JetBrains Mono', 'SF Mono', 'Fira Code', 'Consolas', monospace",fontSize:12,lineNumbers:"on",minimap:{enabled:!1},model:d,scrollBeyondLastLine:!1,tabSize:2,theme:_m(),wordWrap:"on"});t.monacoEditor=c,c._editingTab=e;let b=fv(c);if(f)return;c.onDidChangeModelContent(()=>{if(t.monacoEditor!==c)return;if(c._ignoreNextChange){c._ignoreNextChange=!1;return}b.markTyped(),Nm(e.id),b.arm(Gp,600,async()=>{if(!Yd(e)||!Xd(c))return;if(Wi(e.doc.sourceFormat)&&e.documentPath)try{let{document:y,frontmatter:w}=await or(e.documentPath,c.getValue());if(!Yd(e))return;e.doc.document=y,e.doc.content.frontmatter=w,e.doc.source=c.getValue(),e.doc.dirty=!0,b.markSettled()}catch{}else if(a==="json")try{let y=Es(c.getValue()),w=y.document;e.doc.bareRepeaters=Am(w),e.doc.document=w,e.doc.layout=y.layout,e.doc.dirty=!0,b.markSettled()}catch{}})})}function It(e=m.activePaneId){let t=vo(e);MS(nL,()=>{WH(t)})}function X$(e,t){let r=FL(e,t);for(let o of m.panes)It(o.id);return r}function $f(e,t,r=null){e.wrap.style.display="block";let o=ae(),a=o?.get("pane.pin");io(Mu(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 WH(e){let t=xh(e);if(!t)return;let r=e.panels,o=vt(e.paneId);if(!o){_$(e);let F=zr(e.paneId);if(F){$f(e,F.reason||"Looking for something to show here…");return}if(!x?.isSiteProject)n$(t);return}let a=zr(e.paneId);if(a?.status==="unavailable"&&a.reason){_$(e),$f(e,a.reason,a.kind==="companion"?o:null);return}let i=H$,s={document:o.doc.document,mode:o.doc.mode,ui:o.session.ui},l=Uo(e.paneId),d=l==="edit"&&zr(e.paneId)?.kind!=="lens"&&Boolean(x?.isSiteProject)&&eh(o.documentPath);if(!d)ni(e.paneId);e.renderGeneration=HO(),qo.fullRenders+=1;let f=l!==e.prevCanvasMode;if(f&&t._$litPart$)J$(t);if(f&&l!=="git-diff")ii(e);let c=l==="source"&&e.monacoEditor?tf():null;if(c&&e.monacoEditor){let F=c.Uri.parse(dI(o.documentPath||"document.json"));if(e.monacoEditor.getModel()?.uri.toString()!==F.toString())Hl(e),ai(e)}if(l==="source"&&e.monacoEditor&&!f){let F=e.monacoEditor;q$(o).then((W)=>{if(e.monacoEditor!==F)return;if(!Kp(F)&&F.getValue()!==W)F._ignoreNextChange=!0,F.setValue(W),F._writes?.markSettled()}).catch(()=>{});return}if(l==="grid"&&Qm(e.paneId,o)&&!f)return;if(l==="entry"&&$E(e.paneId,o)&&!f)return;if(l==="media"&&AT(e.paneId,o)&&!f)return;if(l===Gf&&af(e.paneId,o)&&!f)return;if(n_(l)&&i_(e.paneId,o)&&!f)return;if(l==="stylebook"&&!f){let F=h.stylebook.filter,W=h.stylebook.customizedOnly;if(!(F!==e.prevStylebookFilter||W!==e.prevStylebookCustomizedOnly||nl(e.paneId)!==e.prevStylebookMedia)){let V=Ay(Sr(o.doc.document.style));if(Kw(V)>0)return}}e.prevCanvasMode=l,Jw();for(let F of r)F.renderScope?.stop(),F.renderScope=null;if(r.length=0,f){if(e.centerObserver)e.centerObserver.disconnect(),e.centerObserver=null;za(e),qa(e.paneId),rw(e.paneId),Ew(e.paneId),Ka(e.paneId),Og(e.paneId),Hl(e),ai(e),Nb(t),Y$(e),io(mt,t),e.panzoomWrap=null,t.style.padding="",t.style.alignItems="",t.style.flexDirection="",t.style.gap="",t.style.display="",t.style.overflow="",d_(),Dk(),qf(),sp()}if(l==="stylebook"){e.prevStylebookFilter=h.stylebook.filter,e.prevStylebookCustomizedOnly=h.stylebook.customizedOnly,e.prevStylebookMedia=nl(e.paneId),LR(e,{applyTransform:qs,canvasPanelEntry:Lp,drawStage:En,observeCenterUntilStable:Ww,stageHost:Tr,updateActivePanelHeaders:Vw}).then(()=>{if(f)US(e)});return}if(l==="preview"){if(f)t.style.padding="0",t.style.display="block",t.style.overflow="hidden";let{baseWidth:F,sizeBreakpoints:W}=Wr(to(s.document.$media)),D=nl(e.paneId),V=W.find((q)=>q.name===D)?.width??F,J=Lp(null,null,!0);r.push(J.panel);let{featureToggles:B}=s.ui;En(e,{frame:"boards",framePart:"preview-stage",frameVars:`--preview-w:${V}px`,handles:"hidden",hug:!1,innerPart:"boards",lead:"none",panels:[J.item]},[J]).then((q)=>{if(!q)return;Pr(e,J.panel,B)});return}if(l==="entry"){t.style.padding="0",t.style.display="block",ED(e,o);return}if(l==="media"){t.style.padding="0",t.style.display="block",YD(e,o);return}if(l===Gf){ak(e,o);return}if(n_(l)){Sk(e,o);return}if(l==="grid"){t.style.padding="0",t.style.display="block",Lx(e,o);return}if(l==="source"){t.style.padding="0",t.style.display="block";let F=o.documentPath||"document.json",W=FH(o);En(e,M$("source"),[]).then((D)=>{if(!D)return;let V=Tr(e,"source-editor");if(V)VH(o,e,V,F,W)});return}if(l==="git-diff"){let F=zr(e.paneId),W=F?.kind==="lens"&&F.preset==="diff",D=W?F.diff:i.gitDiffState;if(!D){if(W){$f(e,F.reason||"Loading this file's changes…");return}i.setCanvasMode(o,"design"),It(e.paneId);return}if(f)t.style.padding="0",t.style.overflow="hidden";let V=ub(D.filePath);if(Fa(e.paneId,V)){if(!V)Bm(e.paneId,null);ai(e),En(e,M$("code"),[]).then((ue)=>{if(!ue)return;wl(e.paneId);let L=Tr(e,"diff-code-editor");if(L)BH(e,L,D)});return}ii(e);let J=800,B=Lp("git-diff-original","Original",!1,J),q=Lp("git-diff-current","Current",!1,J),K=En(e,{frame:"boards",framePart:"panzoom",frameVars:"",handles:"hidden",hug:!1,innerPart:"boards",lead:"toolbar",panels:[B.item,q.item]},[B,q]);r.push(B.panel,q.panel);let re=(ue)=>{let L=D.filePath;if(cn(L))return or(L,ue).then((Ee)=>Ee.document);return Promise.resolve().then(()=>{try{return JSON.parse(ue)}catch{return{children:[{tagName:"p",textContent:"Failed to parse"}],tagName:"div"}}})},{featureToggles:be}=s.ui,ye=e.renderGeneration;Promise.all([K,re(D.originalContent||""),re(D.currentContent||"")]).then(([ue,L,Ee])=>{let xe=null;try{xe=Bw(L,Ee)}catch(M){console.warn("buildChangeMap:",M)}if(!ue)return;Bm(e.paneId,xe),wl(e.paneId),Pr(e,B.panel,be,L,D$(xe?.original,"modified-before"),ye),Pr(e,q.panel,be,Ee,D$(xe?.current,"modified-after"),ye)}),K.then((ue)=>{if(!ue)return;if(qs(e),f)Ww(e)});return}if(l==="edit"){if(f)t.style.padding="0",t.style.overflow="hidden",BS(e.paneId);let F=HN(e,o),W=Lp(null,null,!0),D=s.document.tagName,V=n(D)&&D.includes("-"),{featureToggles:J}=s.ui,B=d;t.style.flexDirection=B?"column":"",t.style.alignItems=B?"stretch":"",t.style.gap=B?"0px":"",En(e,{frame:"boards",framePart:"edit-canvas",frameVars:"",handles:"shown",hug:V,innerPart:"edit-column",lead:d?"banner":"none",panels:[W.item]},[W]).then((q)=>{if(!q)return;if(d)x$(e.paneId,o);let K=Tr(e,"edit-column"),re=Tr(e,"edit-canvas");if(W.panel.scrollContainer=re,tx(e,re),K)K.style.maxWidth=`${Math.round(F)}px`,wf(e,Tr(e,"edit-handle:start")??void 0,K,-1),wf(e,Tr(e,"edit-handle:end")??void 0,K,1);Pr(e,W.panel,J),ih(e)}),r.push(W.panel);return}if(f)t.style.padding="0",t.style.overflow="hidden";let{sizeBreakpoints:b,featureQueries:y,baseWidth:w}=Wr(to(s.document.$media)),k=b.length>0,{featureToggles:E}=s.ui;if(!k){let W=to(s.document.$media)["--"],D=W?`${Di("--")} (${w}px)`:null,V=Lp(W?"base":null,D,!W,W?w:void 0);En(e,{frame:"boards",framePart:"panzoom",frameVars:"",handles:"hidden",hug:!1,innerPart:"boards",lead:"none",panels:[V.item]},[V]).then((J)=>{if(!J)return;if(Pr(e,V.panel,E),qs(e),f)US(e),Ww(e)}),r.push(V.panel);return}let A=[{displayName:Di("--"),name:"base",width:w}];for(let F of b)A.push({displayName:Di(F.name),name:F.name,width:F.width});let j=zr(e.paneId),P=j?.kind==="lens"&&j.preset==="breakpoint"?j.media??"base":null,N=P===null?A:A.filter((F)=>F.name===P),_=(N.length>0?N:A).map((F)=>Lp(F.name,`${F.displayName} (${F.width}px)`,!1,F.width)),O=En(e,{frame:"boards",framePart:"panzoom",frameVars:"",handles:"hidden",hug:!1,innerPart:"boards",lead:"none",panels:_.map((F)=>F.item)},_),H=e.renderGeneration;for(let{panel:F}of _)r.push(F);O.then((F)=>{if(!F)return;for(let W=0;W<_.length;W++){let{panel:D}=_[W];if(W===0)Pr(e,D,E,null,null,H);else setTimeout(()=>Pr(e,D,E,null,null,H),0)}if(Vw(e),qs(e),f)US(e),Ww(e)})}function Pr(e,t,r,o=null,a=null,i=null){let s=i??e.renderGeneration,l=vt(e.paneId),d=o||l?.doc.document,{canvas:f}=t;qo.panelRenders+=1,t.ready=!1,wL(f,Uo(e.paneId)==="preview"),PS(LN,()=>AL(s,d,f,t._width,o?null:l?.id??null,l,Uo(e.paneId),a)).then(()=>{if(s===e.renderGeneration)t.ready=!o,KO(l,{error:null,scope:null,status:"ready"})}).catch(qH)}function qH(e){C.error("The canvas could not be mounted.",{detail:Q(e),key:"canvas.mount",source:"Canvas"})}Aw(It);WO((e)=>{ii(e),ww(e.paneId),vl(e.paneId,null),qa(e.paneId),rw(e.paneId),Ew(e.paneId),Ka(e.paneId),Og(e.paneId),ni(e.paneId),Hl(e),ai(e),e.centerObserver?.disconnect(),e.centerObserver=null,za(e),e.panzoomWrap=null,Y$(e)});function Z$(){oi()}function UH(e){return/^[A-Za-z_$][\w$]*/.exec(e)?.[0]??""}function JH(e){let t=u.value;if(!t)throw RangeError('command "insert.data" needs an open document; no tab is active');let r=UH(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=Gl().snapshot?.path??Me(t.session.selection);if(!a_(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 GH(){return[{args:Se({path:Px("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=IO("selection.set",t,"path"),o=u.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:RO("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=F$("selection.setPaths",t,"paths"),o=u.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=mO(r)},title:"Select Elements"},{args:Se({token:We('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),rh({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:()=>{zL()},title:"Insert Block…"}]}function eS(e){e.registerAll(GH())}var nS=null,Cf=new WeakMap;function oS(e){nS=e,gO({apply:QH,classify:XH,escalate:KH,markConsumed:(t,r)=>{Cf.set(he(t),new Set(aS(r).map((o)=>o.paneId)))}})}function aS(e){return kS(e).filter((t)=>{let r=Uo(t.paneId);return r==="design"||r==="edit"})}function cS(e,t){let r=he(e),o=Cf.get(r);if(!o?.has(t))return!1;if(o.delete(t),o.size===0)Cf.delete(r);return qo.skippedFullRenders+=1,!0}function KH(e,t=null){jw(e);for(let r of kS(t))nS?.scheduleCanvasRender(r.paneId)}function si(e){return e.includes("cases")}function Bl(e,t,r=!0){if(si(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 tS(e,t){if(t.length===0)return"replace-root";if(si(t))return"replace-on-cases-path";let r=At(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 YH(e,t){switch(t.op){case"set-style":{if(si(t.path))return"style-on-cases-path";return oe(e.doc.document,t.path)?null:"node-not-found"}case"set-text":{if(si(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:tS(e,t.path);case"set-attr":case"replace":return tS(e,t.path);case"insert":return Bl(e,t.parentPath);case"remove":{let r=At(t.path);return r===null?"remove-no-parent":Bl(e,r)}case"move":{if(si(t.fromPath))return"structure-on-cases-path";let r=At(t.fromPath);if(r===null)return"move-no-parent";return Bl(e,r)??Bl(e,t.toParentPath)}default:return`${t.op}-unsupported`}}function XH(e,t){let r=(s)=>(jw(s),{patchable:!1,reason:s}),o=kS(e);if(o.length===0)return r("inactive-tab");let a=aS(e);if(a.length===0){let s=Uo(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((d)=>d.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=YH(e,s);if(l)return r(l)}return{patchable:!0,reason:""}}function QH(e,t,r){MS($N,()=>{let o=(r?.docOps??[]).map((i)=>i.forward);if(YS(o,e.id)===0)throw Error("no-ready-iframe-host");qo.patchedOps+=o.length})}function dS(e,t){Ty(e,"",{onSelect:(r)=>{let o=r.component===!0?FS(r.tag):null,a=o??nh(r.tag),{insertParentPath:i,index:s}=t,l=[...i,"children",s],d=u.value;Y(d,(f)=>{if(Lo(f,i,s,a),o)Ep(f,o.tagName);f.session.selection=[l]})},showFilter:!0})}var pS={dismiss:()=>sp(),nav:(e)=>Ik(e),show:({rect:e,filter:t,showFilter:r,onSelect:o,onDismiss:a})=>pR(e,t,{onDismiss:a,onSelect:o,showFilter:r===!0})};function mS(){return{dismiss:()=>qf(),show:({path:e,clientX:t,clientY:r})=>{if(!e)return;let o=MN(u.value?.doc.document,e),a=new MouseEvent("contextmenu",{clientX:t,clientY:r});u_(a,o)}}}var fS={$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"}]}]}}}}]}}]};T("jump-bar",fS);function hS(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 ez="statusbar/document",tz="block-start span-inline-end";function yS(e){if(!e)return"Untitled";let t=x?.projectRoot;return t&&e.startsWith(`${t}/`)?e.slice(t.length+1):e}function nz(e){if(e.documentPath)return{label:yS(e.documentPath),title:e.documentPath};let t=iv(e.id);if(t)return{label:t,title:`The ${t} workspace's home, a view rather than a file`};let r=fm(e.id);if(r)return{label:r,title:`${r}, a view of many files rather than one`};return{label:yS(null),title:"Not saved to disk yet"}}function rz(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),d=l?.tag,f=l?.$prototype==="Array"?"Repeater":it(l?.tagName)||(n(d)?d:"")||(a==="cases"?String(t[o+1]):`[${t[o+1]}]`);r.push({label:f,path:s}),o+=i}return r}function oz(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 f=i?.cases;if(!S(f))return[];return Object.keys(f).map((c)=>{let b=[...a,"cases",c];return vS(e,b,c,l)})}if(s!=="children")return[];let d=[];for(let[f,c]of lr(i).entries()){if(n(c))continue;let b=[...a,"children",f];d.push(vS(e,b,Ir(c),l))}return d}function vS(e,t,r,o){let a=oe(e,t),i=a?Ir(a):r,s={args:{path:t},command:"selection.set",label:i};return $r(t,o)?{...s,current:!0}:s}function az(e,t=null){if(!e)return[];let r=[{choices:[],command:t?"pane.pin":"palette.openFiles",kind:"file",...nz(e)}],{editingFormula:o,editingFunction:a}=e.session.ui;if(a)return r.push(wS("ƒ",a)),r;if(o)return r.push(wS("fx",o)),r;let i=Me(e.session.selection);if(i&&i.length>0){let s=rz(e.doc.document,i);for(let[l,d]of s.entries()){let f=oe(e.doc.document,d.path);r.push({args:{path:d.path},choices:oz(e.doc.document,s,l),command:"selection.set",kind:"node",label:l===s.length-1&&f?Ir(f):d.label,title:d.path.join(" / ")})}}return r}function wS(e,t){return{choices:[],command:null,kind:"editor",label:`${e} ${t.defName??t.eventKey??"editor"}`}}function iz(e){let t=e.args?.path;return e.kind==="node"&&Array.isArray(t)?`node:${t.join("/")}`:e.kind}function sz(e,t){return t!==null&&Boolean(e?.get(t))&&e.isVisible(t)}function lz(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 cz(e,t,r,o){let a=t.command,i=sz(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:iz(t),kind:t.kind,label:t.label,leading:r,title:i?lz(e,t,a):t.title??t.label}}var zt=null,li=null,pi=null;function Wl(){let e=pi;pi=null,e?.close()}function dz(e,t){let r=ae();if(!r)return;Wl();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(pi===s)pi=null},opener:t,placement:tz,region:"jump-bar",rows:o};if(t)a.place=(s)=>pz(t,s);pi=Xt(a)}function pz(e,t){let r=ze(e);return{x:Math.round(r.left),y:Math.max(0,Math.round(r.top-t.height))}}function uz(){let e=Kr().id,t=az(vt(e),zr(e)),r=ae();return{segments:t,steps:t.map((o,a)=>cz(r,o,a===0,a===t.length-1))}}function xS(){if(!zt)return;Wl();let{segments:e,steps:t}=uz();zt.segments=new Map(t.map((r,o)=>[r.key,e[o]])),zt.surface.update(t)}function Tf(e){if(zt?.host===e)return;if(zt)Wl(),zt.surface.dispose(),zt=null;if(!e)return;zt={host:e,segments:new Map,surface:hS(e,ez,{choose:(t,r)=>{let o=zt?.segments.get(t);if(o)dz(o,r)},run:(t)=>{let r=zt?.segments.get(t),o=ae();if(r?.command&&o)Tn(o,r.command,r.args,"Jump Bar")}})},xS()}function $S(){li?.stop(),li=ge(),li.run(()=>{ne(()=>{ae(),x?.name,m.activePaneId,m.panes.length;let e=vt(Kr().id);if(e)e.doc.document,e.documentPath,e.session.selection.map((t)=>t.join("/")).join("|"),e.session.ui.editingFormula,e.session.ui.editingFunction;xS()})})}function SS(){Wl(),li?.stop(),li=null,Tf(null)}var ES={$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}"}}}}]}}]};T("statusbar",ES);var nc=null;function fz(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 Pf(e,t,r){let o=`statusbar/${t}`,a=r.flatMap((i)=>{let s=i===null?null:fz(e,o,i);return s===null?[]:[s]});if(a.length===0)return null;return{id:t,items:a,region:o}}function hz(e,t){return`${e>0?` ↑${e}`:""}${t>0?` ↓${t}`:""}`}function gz(e){if(e===0)return"No changes";return e===1?"1 changed file":`${e} changed files`}function bz(e){let t=x,{status:r}=h.git,o=Sv(),a=hN(),i=u.value?Ln(u.value).peers.length:0;return Pf(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}${hz(r.ahead,r.behind)}`,title:`${gz(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 yz(e){let t=u.value;if(t?.session.ui.canvasMode===Ru){let o=Vf(t);return o?Pf(e,"selection",[{command:null,label:o.replaceAll(" "," › "),title:"The style rule being edited"}]):null}let r=t?.session.selection??[];return r.length>1?Pf(e,"selection",[{command:null,label:`${r.length} selected`,title:`${r.length} elements are selected; the trail names the primary`}]):null}function NS(e){return e.filter((t)=>t!==null)}var mi=null,fi=null,Zl=null;function jS(){return mi??=g({hasDocument:!1,leading:[],run:(e)=>{let t=[...mi?.leading??[],...mi?.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:[]}),mi}function vz(){let e=eI;if(fi||!e)return;let t=R("statusbar",jS(),e);fi=t,t.then((r)=>{if(fi!==t)return;Zl=r,Tf(e.querySelector('[part="trail"]'))})}function Ef(){let e=ae(),t=jS();t.leading=NS([bz(e)]),t.hasDocument=u.value!==null,t.trailing=NS([yz(e)]),vz()}function RS(){wz(),$S(),nc=ge(),nc.run(()=>{ne(()=>{ae(),h.stylebook.selection,u.value?.session.ui.canvasMode,h.git.status,na.length;let e=u.value;if(e)e.session.selection.length,Ln(e).peers.length;Ef()})})}function wz(){nc?.stop(),nc=null;let e=fi;if(fi=null,SS(),Zl)Zl.dispose(),Zl=null;else if(e)e.then((t)=>t.dispose());mi=null}var IS={$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}>"}]}}]}}]}]};T("panel-elements",IS);function OS(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 WS(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});OS(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)=>OS(o,l)}}var ZS="Components",Nr=null,an=null;function kz(){return st.elementsFilter.toLowerCase()}function $z(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 Sz(){let e=u.value,t=Zw(e?.doc.document?.$elements),r=new Set;for(let o of t){if(!n(o))continue;let a=Ae.find((i)=>i.source==="npm"&&i.modulePath&&o===`${i.package}/${i.modulePath}`);if(a){r.add(a.tagName);continue}for(let i of Ae)if(i.source==="npm"&&i.package===o)r.add(i.tagName)}return r}function Cz(e){if(Ae.length===0)return[];let t=Sz();return Ae.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 tC(e){let t=kz(),r=$z(e.webdata,t),o=Cz(t),a=r.length===0&&o.length===0;return{categories:r,components:o,componentsOpen:!st.elementsCollapsed.has(ZS),emptyState:a?t?"filtered":"empty":"none",filter:st.elementsFilter,hasComponents:o.length>0}}function KS(e){let t=u.value;if(!t)return;let r=Me(t.session.selection)??[],o=oe(t.doc.document,r),a=lr(o).length;Y(t,(i)=>{Lo(i,r,a,structuredClone(e)),Ep(i,e.tagName)})}function gi(){let e=an;if(!e||!Nr)return;e.handle.update(tC(Nr)),e.handle.ready.then(()=>{if(an!==e)return;Nr?.registerElementsDnD(),Nr?.registerComponentsDnD()})}var Tz={clearFilter:()=>{st.elementsFilter="",gi()},insertComponent:(e)=>{let t=Ae.find((r)=>r.tagName===e);if(t)KS(zc(t))},insertElement:(e)=>{if(Nr)KS(Nr.defaultDef(e))},setComponentsOpen:(e)=>{XS(ZS,!e),gi()},setFilter:(e)=>{st.elementsFilter=e,gi()},setSectionOpen:(e,t)=>{XS(e,!t),gi()}};function XS(e,t){if(t)st.elementsCollapsed.add(e);else st.elementsCollapsed.delete(e)}function Pz(e,t){Nr=e.deps;let r=t.querySelector(".panel-content")??t;if(an&&(an.host!==r||!an.handle.connected()))an.handle.dispose(),an=null;if(!an)an={handle:WS(r,tC(e.deps),Tz),host:r};gi()}function aC(){Zn({id:"insert",title:"Insert",level:"document",dock:"navigator",icon:"grid-four",rail:!1,render:()=>mt,afterRender:(e,t)=>{Pz(e,t)}})}var iC={$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}"}}}]}}}]};T("panel-i18n",iC);function gC(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 bC(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:""});gC(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)=>gC(o,s)}}var wC=["pages","content"],xC=200,jn=null,rc=null;function Nz(){jn=null,rc=null}async function jz(e,t){try{let r=await rm(wC,p());jn={declared:await Rz(r.files),failures:r.failures,files:r.files,root:e}}catch(r){jn={declared:new Map,failures:[{dir:wC.join(", "),error:Q(r)}],files:[],root:e}}rc=null,t()}async function Rz(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 d=/"\$translationKey"\s*:\s*"((?:[^"\\]|\\.)*)"/.exec(l)?.[1];if(d!==void 0&&d!=="")a.set(s.path,d.replaceAll(/\$\{(\w+)\}/g,"[$1]").replaceAll(/^\/+|\/+$/g,""))}return a}function SC(e){if(!e)return null;let t=Date.parse(e);return Number.isNaN(t)?null:t}function Az(e,t,r=new Map){let o=new Map,a=new Set(e.flatMap((l)=>l.media?[]:[ev(l.path,t)])),i=(l)=>{let d=r.get(l.path);if(d===void 0)return ev(l.path,t);let f=/\.[^./]+$/.exec(l.path)?.[0]??"";for(let c of[`pages/${d}${f}`,`pages/${d}/index${f}`])if(a.has(c))return c;return`pages/${d}${f}`};for(let l of e){if(l.media)continue;let d=i(l),f=Hi(l.path,t)??t.defaultLocale,c=o.get(d)??new Map;if(!c.has(f)||l.path===Xc(d,f,t))c.set(f,l);o.set(d,c)}let s=[];for(let[l,d]of o){let f=d.get(t.defaultLocale),c=SC(f?.modified),b=new Map;for(let y of t.locales){let w=d.get(y);if(!w){b.set(y,{path:Xc(l,y,t),state:"missing"});continue}let k=SC(w.modified),E=f!==void 0&&f.path!==w.path&&c!==null&&k!==null&&c>k;b.set(y,E?{behind:f.path,path:w.path,state:"stale"}:{path:w.path,state:"present"})}s.push({cells:b,key:l})}return s.toSorted((l,d)=>l.key.localeCompare(d.key))}var RC="settings.open",Iz={missing:"i18n.createTranslation",present:"i18n.openTranslation",stale:"i18n.openTranslation"},Lz={missing:"+",present:"✓",stale:"!"};function Oz(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 Mz(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 Dz(e,t,r){let o=Vt(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 NC(e,t={}){let r=ae();if(!r?.get(e))return;Tn(r,e,t,"Languages")}function Fz(e,t){let r=Oz(e,t);return{cells:t.locales.map((a)=>{let i=e.cells.get(a)??{path:null,state:"missing"},s=Iz[i.state],l=Mz(i,s);return{command:s,disabled:l!==void 0,glyph:Lz[i.state],locale:a,rowPath:r,state:i.state,title:Dz(i,a,l)}}),key:e.key}}function _z(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 Hz(e){let{missing:t,stale:r}=_z(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 Nf(e){return{heads:[],incomplete:"",mode:e,rows:[],settingsDisabled:ae()?.get(RC)===void 0,summary:"",truncated:""}}function zz(e){let t=Ts();if(t===null||t.locales.length<2)return Nf("mono");let r=x?.projectRoot??"";if(jn===null||jn.root!==r){if(rc!==r)rc=r,jz(r,e.rerender);return Nf("scanning")}let o=Az(jn.files,t,jn.declared),a=o.slice(0,xC),i=o.length-a.length;return{...Nf("grid"),heads:t.locales.map((s)=>({isDefault:s===t.defaultLocale,label:Vt(s),locale:s})),incomplete:jn.failures.map((s)=>`${s.dir} (${s.error})`).join("; "),rows:a.map((s)=>Fz(s,t)),summary:Hz(o),truncated:i>0?`${i} more page${i===1?" is":"s are"} not shown — the grid stops at `+`${xC}.`:""}}var IC=()=>{},Bz={openSettings:()=>{NC(RC,{section:"locales"})},rescan:()=>{Nz(),IC()},runCell:(e,t,r)=>{NC(e,{locale:t,path:r})}},Nn=null;function Vz(e,t){({rerender:IC}=e);let r=t.querySelector(".panel-content")??t;if(Nn&&(Nn.host!==r||!Nn.handle.connected()))Nn.handle.dispose(),Nn=null;let o=zz(e);if(Nn){Nn.handle.update(o);return}Nn={handle:bC(r,o,Bz),host:r}}function DC(){Zn({id:"i18n",title:"Languages",level:"project",dock:"navigator",icon:"globe",rail:!1,when:(e)=>e.project.isMultilingual,render:()=>mt,afterRender:(e,t)=>{Vz(e,t)}})}var FC={$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:[]}]}}]}]}}}]};T("panel-imports",FC);var _C=new WeakMap,qz={label:"Add component…",value:""};function zC(e){return{...e,hasOptions:e.pickerOptions.length>0,moduleCount:e.modules.length,moduleState:e.modules.length===0?"empty":"listed",pickerOptions:[qz,...e.pickerOptions],refCount:e.refs.length,refState:e.refs.length===0?"empty":"listed"}}function BC(e,t,r){let o=_C.get(e);if(o&&(o.handle===null||o.handle.root.isConnected)){Object.assign(o.scope,zC(t));return}o?.handle?.dispose(),e.textContent="";let a=g({...zC(t),...r}),i={handle:null,scope:a};_C.set(e,i),R("panel-imports",a,e).then((s)=>{i.handle=s})}var oc=null,ac=null,zo="",Bo="",Vo="",sc="",jf=new Map;function Uz(e,t){return`${e}::${t.tagName}`}function Jz(){let e=new Map;for(let t of Ae){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 Rf(){return x?.projectConfig?.$elements??[]}function VC(e,t,r){return jf.clear(),[...Jz().entries()].map(([o,a])=>({canRemove:r,components:a.map((i)=>{let s=Uz(o,i);return jf.set(s,i),{enabled:iL(e,i,t),id:s,label:`<${i.tagName}>`}}),name:o}))}function Gz(){let e=x?.projectConfig?.imports??{};return{addName:zo,addPackageValue:Vo,addPath:Bo,mode:"site",modules:Object.entries(e).map(([t,r])=>({name:t,path:String(r)})),packages:VC(Rf(),null,!0),pickerOptions:[],pickerValue:"",refEmptyMessage:"",refs:[]}}function Kz(e){let{documentElements:t,documentPath:r}=e,o=t.flatMap((l)=>{let d=S(l)?l.$ref:void 0;return n(d)?[{ref:d}]:[]}),a=t.filter((l)=>n(l)),i=new Set(o.map((l)=>l.ref)),s=Ae.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:zo,addPackageValue:Vo,addPath:Bo,mode:"document",modules:[],packages:VC(a,r,!1),pickerOptions:s,pickerValue:sc,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 Yz(e){return e.documentPath?.endsWith("project.json")?Gz():Kz(e)}function Rn(){if(!oc||!ac)return;BC(oc,Yz(ac),oB)}function jr(){return ac}async function Xz(){let e=zo.trim(),t=Bo.trim();if(!e||!t)return;let r=x?.projectConfig?.imports??{};zo="",Bo="",Rn(),await no({imports:{...r,[e]:t}}),jr()?.renderLeftPanel()}async function Qz(e){let t={...x?.projectConfig?.imports};delete t[e],await no({imports:t}),jr()?.renderLeftPanel()}async function Zz(){let e=Vo.trim();if(!e)return;Vo="",Rn();try{await p().addPackage(e);let{loadComponentRegistry:t}=await (le("r22xca09"),import("./chunks/components-r22xca09.js"));await t(),jr()?.renderLeftPanel()}catch(t){console.error("Failed to add package:",t)}}async function eB(e){if(!await Ko("Remove Package",`Remove ${e}?`,{confirmLabel:"Remove",destructive:!0}))return;try{await p().removePackage(e);let r=IN(Rf(),e),{loadComponentRegistry:o}=await (le("r22xca09"),import("./chunks/components-r22xca09.js"));await o(),await no({$elements:r}),jr()?.renderLeftPanel()}catch(r){console.error("Failed to remove package:",r)}}async function tB(e,t){let r=jr(),o=jf.get(e);if(!r||!o)return;if(r.documentPath?.endsWith("project.json")){let a=Rf(),i=t?Eb(a,o,null):oL(a,o,null);await no({$elements:i}),r.renderLeftPanel();return}r.applyMutation((a)=>{let i=a.$elements??[];a.$elements=t?Eb(i,o,r.documentPath):oL(i,o,r.documentPath)}),r.renderLeftPanel()}function nB(e){let t=jr();if(sc=e,Rn(),sc="",Rn(),!t||!e)return;let r=Ae.find((o)=>o.tagName===e);if(!r?.path)return;t.applyMutation((o)=>{o.$elements=Eb(o.$elements??[],r,t.documentPath)}),t.renderLeftPanel()}function rB(e){let t=jr();if(!t)return;t.applyMutation((r)=>{r.$elements=RN(r.$elements??[],e)}),t.renderLeftPanel()}var oB={addModule:()=>{Xz()},addPackage:()=>{Zz()},editName:(e)=>{zo=e,Rn()},editPackage:(e)=>{Vo=e,Rn()},editPath:(e)=>{Bo=e,Rn()},pick:nB,removeModule:(e)=>{Qz(e)},removePackage:(e)=>{eB(e)},removeRef:rB,toggleComponent:(e,t)=>{tB(e,t)}};function aB(e,t){if(e!==oc)zo="",Bo="",Vo="",sc="";oc=e,ac=t,Rn()}function iB(e){return e.querySelector(".panel-content")??e}function WC(){Zn({id:"packages",title:"Packages",level:"document",dock:"navigator",icon:"cube",rail:"developer",requiresDocument:"Open a page to choose which components it can use.",render:()=>mt,afterRender:(e,t)=>{aB(iB(t),{applyMutation:(r)=>{qd(u.value,r)},documentElements:e.doc?.document.$elements??[],documentPath:e.doc?.documentPath??null,renderLeftPanel:e.rerender})}})}var qC={$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"}]}]}}]}}]}]}}]}}}]};T("panel-problems",qC);function UC(e,t){e.hasProblems=t.hasProblems,e.clearLabel=t.clearLabel,e.groups=t.groups}function JC(e,t,r){let o=g({clearAll:r.clearAll,clearLabel:"",dismissRow:r.dismissRow,groups:[],hasProblems:!1,openPath:r.openPath,runAction:r.runAction});UC(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)=>{UC(o,s)}}}var lB={error:"✕",info:"ℹ",success:"✓",warn:"!"},cB="Elsewhere";function dB(e=na){let t=[];for(let r of e){let o=r.source??cB,a=t.find((i)=>i.source===o);if(a)a.records.push(r);else t.push({records:[r],source:o})}return t}function pB(e){(le("rcn56qvm"),import("./chunks/files-rcn56qvm.js")).then((t)=>t.openFileInTab(e))}function uB(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:lB[e.severity],id:e.id,message:e.message,path:e.path??"",pathTitle:`Open ${e.path??""}`,severity:e.severity}}function GC(){let e=dB().map((t)=>({rows:t.records.map((r)=>uB(r)),source:t.source}));return{clearLabel:`Clear ${Sv()}`,groups:e,hasProblems:e.length>0}}var mB={clearAll:()=>{ul()},dismissRow:(e)=>{Lh(e)},openPath:(e)=>{pB(e)},runAction:(e)=>{let t=na.find((o)=>o.id===e),r=ae();if(t?.action===void 0||!r)return;Tn(r,t.action,t.actionArgs,"Problems")}},Rr=null,Af=!1;function KC(){if(!Rr)return;Rr.scope.stop(),Rr.handle.dispose(),Rr=null}function fB(e){let t=Af;if(Af=!1,!t){KC();return}if(Rr?.host===e&&Rr.handle.connected())return;KC();let r=JC(e,GC(),mB),o=ge();o.run(()=>{ne(()=>{ae(),r.update(GC())})}),Rr={handle:r,host:e,scope:o}}function YC(){Zn({id:"problems",title:"Problems",level:"project",dock:"bottom",rail:!1,icon:"warning-circle",badge:()=>Sv()||null,render:()=>(Af=!0,mt),afterRender:(e,t)=>{fB(t)}})}var XC={$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}"}}]}]};T("bottom-dock",XC);function gB(e,t){e.tab=t.tab,e.tabId=t.tabId,e.bodyRegion=t.bodyRegion,e.tabs=t.tabs}function bB(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function QC(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,d,f)=>{if(l instanceof HTMLElement&&bB(f)==="dock-body")o.onBody(l)}}).then((l)=>{if(s){l.dispose();return}i=l}),{dispose(){s=!0,i?.dispose(),i=null},update:(l)=>{gB(a,l)}}}var yB="#bottom-dock";function Lf(){if(Mw("bottom").length>0)return;YC(),RR(),lN()}function tT(){Lf();let e=[];for(let t of ix){let r=Cp(t);if(r)e.push(r)}return e}function nT(e=Yu()){return tT().filter((t)=>Pw(t,e))}function Of(e=Yu()){let t=nT(e),r=KL(h.bottomTab)?h.bottomTab:GL;return t.find((o)=>o.id===r)??t[0]??null}function aT(){return{deps:{},doc:null,rerender:sT}}function vB(e,t){let r=e.badge?.(t)??null;return r===null||r===0||r===""?e.title:`${e.title} ${r}`}function ZC(e=Yu()){let t=Of(e);return{bodyRegion:t?fx(t.id):"",tab:t?.id??"",tabId:t?`bottom-dock-tab-${t.id}`:"",tabs:nT(e).map((r)=>({key:r.id,label:vB(r,e),tabId:`bottom-dock-tab-${r.id}`}))}}var bi=null,ut=null,Ar=null,vi=null,If=null;function wB(){let e=Fy();return e?`${e.surface} ${JSON.stringify(e.editing)}`:null}function sT(){if(!ut)return;if(h.docks.bottom.collapsed){ut.removeAttribute(qe),Ar?.dispose(),Ar=null,vi=null,Mf(ut);return}if(ut.setAttribute(qe,"dock.bottom"),!Ar){Ar=QC(ut,ZC(),{closeDock:()=>{Eo("bottom",!0)},selectTab:(e)=>{if(e!==""&&e!==Of()?.id)sh(e)}},{onBody:(e)=>{vi=e,queueMicrotask(()=>{if(vi===e)eT()})}});return}Ar.update(ZC()),eT()}function eT(){let e=vi;if(!e)return;let t=Of();io(t?t.render(aT()):Mu(e,{message:"Nothing to show here yet."}),e),Mf(e)}function Mf(e){let t=aT();for(let r of tT())r.afterRender?.(t,e)}function xB(){if(bi)return;if(ut=document.querySelector(yB),!ut)return;bi=ge(),bi.run(()=>{ne(()=>{let e=wB();if(e!==null&&e!==If)jk();If=e}),ne(()=>{h.docks.bottom.collapsed,h.bottomTab,sT()})})}Mb({mount:xB,unmount:kB});function kB(){if(bi?.stop(),bi=null,If=null,Ar?.dispose(),Ar=null,vi=null,ut)ut.removeAttribute(qe),io(mt,ut),ut.textContent="",Mf(ut),ut=null}var dT={$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}"}]}]}]}}}]};T("collections-panel",dT);function Df(){return{backTitle:"",backCount:"",body:"none",collections:[],entries:[],entriesState:"loading",newLabel:""}}function pT(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 uT(e,t,r){let o=g({...Df(),...r});pT(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)=>pT(o,l)}}var ki="Collections";function fT(e){return e===ci?cs({kind:"pages"}):cs({kind:"collection",name:e})}function Ff(e){let t=Ul(e?.documentPath);return t!==null&&t!==ci&&!Vl(t)?.fileBacked?t:null}function SB(e){let t=Ul(e.documentPath);return t!==null&&Vl(t)?.fileBacked===!0?t:null}function CB(e){if(!e)return null;if(e.id===Xl("content"))return Au();let t=zl(e.id);if(t?.kind==="pages")return ci;return t?.kind==="collection"?t.name:SB(e)}function TB(e){let t=Xk(),r=CB(e);return mm().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:Nu(fT(o.key)).map((i)=>({key:`${o.key}
|
|
@@ -497,7 +497,7 @@ ${r}`}function qI(e){let t=e.indexOf(`
|
|
|
497
497
|
`);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(`
|
|
498
498
|
`).map((a)=>a.trim()).filter((a)=>a.length>0)}}function G3(e){try{let t=JSON.parse(e);if(v(t)&&Xe(t.success))return t}catch{}return null}function UI(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 JI(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 tu(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 Rs(e){return e.filter((t)=>t!==null)}function GI(e){return e>=1000?`${(e/1000).toFixed(1)}k`:String(e)}function KI(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 YI="import_site";function K3(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 Y3(e,t=!0){if(!e.result)return e.name===gd&&!t?"unanswered":"pending";return e.result.success?"ok":"failed"}function X3(e){let{result:t}=e;if(!t)return"";let r=(t.success?t.summary:t.error)??"";if(e.name===YI&&t.success){let o=/\.(?:\s|$)/.exec(r);return o?r.slice(0,o.index+1):r}return r}function Q3(){return{hasPhase:!1,importCount:"",importLog:[],importMessage:"",importOpen:!1,importPhase:"",importProgress:"",importSpinner:"none",importState:"none"}}function Z3(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 e6(e,t={}){let r=Y3(e,e.id===t.pendingId||Boolean(e.result)),o=X3(e),a=e.name===YI?t.importRun?.(e.id)??null:null,i=e.name===gd?K3(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||UI(e),key:e.id,kind:i?"ask":"chip",label:UI(e),mark:r==="ok"?"✓":"✗",options:(i?.options??[]).map((d)=>({key:d,label:d})),outcome:r,outcomeState:r==="pending"||r==="unanswered"?"hidden":"shown",outcomeText:o,question:i?.question??"",tool:e.name,...a?Z3(a):Q3()};if(i)l.askState=r==="pending"?"pending":r==="unanswered"?"unanswered":s?"answered":r==="failed"?"failed":"none";return l}function t6(e){let t=kC(e),r=t.length>0?cO(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 eu(e,t){return{body:"",canRestore:!1,changes:[],changesState:"none",changesSummary:"",chips:[],contextChips:[],hasChips:!1,hasContextChips:!1,key:e,kind:t,markdown:""}}function n6(e){return e.map((t,r)=>({key:`${r}:${t}`,label:t}))}function XI(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:d,contextLines:f}=qI(i.content);o.push({...eu(i.id,"user"),body:d,contextChips:n6(f),hasContextChips:f.length>0});continue}if(i.role==="tool"){let d=G3(i.content);if(d&&!d.success)o.push({...eu(i.id,"tool-error"),body:`⚠️ ${d.error||"Tool call failed"}`});continue}if(i.role!=="assistant")continue;let s=i.toolCalls??[],l=s.map((d)=>e6(d,t));if(e.status==="streaming"&&a===r){o.push({...eu(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({...eu(i.id,"assistant"),chips:l,hasChips:l.length>0,markdown:i.content?WI(i.id,i.content):"",...t6(i.id)})}return o}var QI={$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"}]}}}]};T("ai-model-picker",QI);function ZI(e){return{...e,hasFailure:e.failure!==""}}function e1(e,t){let r=document.createElement("div");r.style.display="contents";let o=g({...ZI(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,ZI(l)),i||a!==null&&r.contains(a.root))return;a?.dispose(),a=null,r.textContent="",s()}}}var t1="__loading__",o6=" — no tools";function a6(e){return p$(e.id)===!1?`${e.name}${o6}`:e.name}function nu(e){let t=e.getModel??Yl,r=e.onChange??_A,o=!1,a="",i=null,s=null;function l(k,E){return k!==null&&k.apiKey===E.apiKey&&k.baseUrl===E.baseUrl}function d(k=!1){let E=uC(),A=h$(E)!==null||l(i,E);if(o||A&&!k)return;o=!0,a="",i=E,lh({credentials:E,force:k}).catch((j)=>{a=j instanceof Error&&j.message||"Failed to fetch models"}).finally(()=>{o=!1,e.requestRender()})}function f(){i=null,d(!0),e.requestRender()}function c(k){if(k&&k!==t1)r(k)}function b(){let k=t(),E=h$(uC())??[],j=(E.some((P)=>P.id===k)?E:[{id:k,name:k},...E]).map((P)=>({label:a6(P),value:P.id}));if(o)j.push({disabled:!0,label:"Loading models…",value:t1});return j}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 w(){if(d(),s)s.update(y());else s=e1(y(),{choose:c,retry:f});return s.host}return{error:()=>a,isLoading:()=>o,render:w,selectedLacksTools:()=>p$(t())===!1}}function n1(e){let t="",r=[],o=null,a=null,i=nu({requestRender:e.requestRender});function s(){let A=u.value,j=A?.documentPath||null,P=Me(A?.session.selection),N=null;if(A&&P){let _=oe(A.doc.document,P),O=_n(_)?_:void 0,H=it(O?.tagName)||"element",F=O?.textContent,W=n(F)?F.slice(0,40):"";N={detail:`Selected element at ${JSON.stringify(P)}: <${H}>${W?` "${W}"`:""}`,kind:"selection",label:`<${H}>`}}return{pageChip:j?{detail:`Page: ${j}`,kind:"page",label:j}:null,selectionChip:N}}function l(A){r=[...r.filter((j)=>j.kind!==A.kind),A],e.requestRender()}function d(A){r=r.filter((j)=>j.kind!==A),e.requestRender()}function f(){let{selectionChip:A}=s();if(!A)return!1;return l(A),!0}function c(A){if(o){o.close(),o=null;return}let j=A instanceof HTMLElement?A:null,{pageChip:P,selectionChip:N}=s(),I={label:"Attach context",onClosed:(_)=>{if(o===_)o=null},region:"assistant-attach",rows:[{destructive:!1,disabled:P===null,dividerAbove:!1,id:"attach.page",requires:"a page open in this pane",run:()=>{if(P)l(P)},title:P?`Current page — ${P.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(j)I.opener=j,I.place=()=>{let _=ze(j);return{x:_.left,y:_.top-4}};else I.origin={x:0,y:0};o=Xt(I)}function b(A){let j=t.trim().length>0;if(t=A,j!==t.trim().length>0)e.requestRender()}function y(){if(!t.trim()||e.isStreaming()&&!(e.isAwaiting?.()??!1))return;let A=Zp(t,r);w(),e.onSend(A),e.requestRender()}function w(){t="",r=[]}function k(){let A=i.render();if(a&&A.parentNode!==a)a.append(A)}function E(){k();let A=e.isStreaming(),j=e.isAwaiting?.()??!1,P=i.selectedLacksTools()?"This model can't use editing tools — the assistant will answer but not edit.":"";return{awaiting:j,composerChips:r.map((N)=>({hint:N.detail,key:N.kind,label:N.label})),draft:t,hasComposerChips:r.length>0,note:P,noteState:P?"shown":"hidden",placeholder:j?"Answer the assistant… (Enter to reply)":"Ask the assistant… (Enter to send)",sendDisabled:t.trim().length===0,sendLabel:j?"Answer":"Send",sendState:!j&&A?"stop":"send"}}return{attachSelection:f,clear:w,dropChip:d,edit:b,openAttachMenu:c,pickerSlot:(A)=>{a=A,k()},send:y,view:E}}var jy=60*Qp,ru=24*jy;function i6(e,t=dr()){let r=Math.max(0,t-e);if(r<Qp)return"just now";if(r<jy)return`${Math.floor(r/Qp)}m ago`;if(r<ru)return`${Math.floor(r/jy)}h ago`;if(r<2*ru)return"yesterday";if(r<7*ru)return`${Math.floor(r/ru)}d ago`;return new Date(e).toLocaleDateString()}function s6(e){let t=e.messageCount;return{key:e.id,meta:`${i6(e.updatedAt)} · ${t} ${t===1?"message":"messages"}`,title:e.title}}function r1(e){return e.map((t)=>s6(t))}var l6=[{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 o1(e){for(let{pattern:t,what:r}of l6)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 ou=null;function c6(){if(ou)return ou;let e=globalThis.trustedTypes;if(!e)return null;return ou=e.createPolicy("jx-studio",{createHTML:o1,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.")}}),ou}function a1(e){let t=c6();return t?t.createHTML(e):o1(e)}var i1={$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"}}}]}}}]};T("ai-chat",i1);var p6=48,u6=24;function s1(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 Vy(){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 m6(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function _y(e){let t=e?.$map,r=v(t)?t.item:void 0;return v(r)?r:null}function zy(e,t){let r=e?.[t];return n(r)?r:""}function f6(e,t){if(e.scrollHeight-e.scrollTop-e.clientHeight<=t||e.scrollTop===0)e.scrollTop=e.scrollHeight}function l1(e,t,r){let o=null,a=null,i=!0,s=new Map,l=new Map,d=g({...Vy(),...r,scrolled:()=>{if(o)i=o.scrollHeight-o.scrollTop-o.clientHeight<p6}});s1(d,t);function f(){let k=new Set(d.rows.map((E)=>E.key));for(let[E,A]of s)if(!k.has(E)||!A.node.isConnected)s.delete(E);for(let E of d.rows){let A=s.get(E.key);if(A&&A.html!==E.markdown)c(A.node,E.markdown),A.html=E.markdown}}function c(k,E){k.innerHTML=a1(E)}let b=null,y=!1;e.replaceChildren(),R("ai-chat",d,e,{onNodeCreated:(k,E,A,j)=>{let P=m6(A);if(P===""||!(k instanceof HTMLElement))return;if(P==="messages"){o=k;return}if(P==="composer-input"){a=k;return}if(P==="composer-picker"){r.pickerSlot(k);return}if(P==="md"){let N=zy(_y(j),"key"),I=zy(_y(j),"markdown");if(N)c(k,I),s.set(N,{html:I,node:k});return}if(P==="import-log"){let N=zy(_y(j),"key");if(N)l.set(N,k)}}}).then((k)=>{if(y){k.dispose();return}b=k,f(),w()});function w(){if(o&&i)o.scrollTop=o.scrollHeight;for(let[k,E]of l){if(!E.isConnected){l.delete(k);continue}f6(E,u6)}}return{dispose(){y=!0,b?.dispose(),b=null,s.clear(),l.clear()},focusComposer:()=>a?.focus(),pin(){i=!0},update(k){s1(d,k),queueMicrotask(()=>{if(!y)f(),w()})}}}var c1=!1,nr="chat",De=vj();globalThis.assistant=De;var As=null,Lt=null;function u1(e){if(As?.stop(),As=null,Lt?.dispose(),Lt=null,!e)return;Lt=l1(e,y1(),{answer:(t)=>{au(t)},attach:(t,r)=>{wo.openAttachMenu(r.currentTarget)},deleteSession:$6,dropChip:(t)=>wo.dropChip(t),edit:(t)=>wo.edit(t),openSession:k6,openSettings:()=>{vg("assistant")},pickerSlot:(t)=>wo.pickerSlot(t),restore:v6,run:h6,send:()=>wo.send(),skip:()=>{LE(),Fe()},stop:g1}),g6()}var Wy=!1;function Fe(){if(Wy||!Lt)return;Wy=!0,queueMicrotask(()=>{Wy=!1,Lt?.update(y1())})}function h6(e){let t=ae();if(t?.isEnabled(e))Tn(t,e,void 0,"Assistant")}function g6(){As?.stop(),As=ge(),As.run(()=>{ne(()=>{let e=De.chatState;e.messages.length;let t=e.messages.at(-1);t?.content,t?.toolCalls?.length;for(let o of b6(e.messages)?.toolCalls??[])o.result;e.status,e.error,De.isTurnActive(),e.tokenCount,ae(),eg();let r=fN();r?.message,r?.log.length,r?.status,Fe()})})}function b6(e){for(let t=e.length-1;t>=0;t--)if(e[t].role!=="tool")return e[t];return}function m1(){if(c1)return;c1=!0,DD(Fe)}async function au(e){if(!e.trim())return;if(IE(e.trim())){Lt?.pin(),Fe();return}if(iu())return;nr="chat",Lt?.pin(),Fe();try{await De.sendMessage(e)}catch{}finally{Fe()}}async function y6(){let e=De.chatState,t=e.messages.toReversed().find((o)=>o.role==="user");if(!t)return;let{content:r}=t;e.retryLast(),Fe(),await au(r)}function v6(e){let t=kC(e);if(t.length===0){C.warn("There is no longer a record of what that turn changed.",{source:"Assistant"});return}let r=t.filter((a)=>a.disk).map((a)=>a.path);if(r.length>0){C.warn(`Cannot restore: ${r.join(", ")} ${r.length===1?"was":"were"} written straight to disk, which undo cannot reach.`,{source:"Assistant"});return}let o=u.value;if(!o){C.warn("Open the document that turn edited to restore it.",{source:"Assistant"});return}$C(o),C.success("Restored to before that turn.",{action:"edit.redo",source:"Assistant"}),Fe()}async function Xy(e){if(De.isTurnActive())await De.whenTurnEnds();await au(e)}async function f1(e){xo(),b1(),await Xy(x6(e))}function w6(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 x6(e){let t=e.prompt.trim()||`Import ${e.url} and get it ready for me to work on.`;return Zp(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: ${w6(e.breakpoints)}. Call import_site with the url; the destination and options above are already settled.`,kind:"import",label:`Import ${e.url}`}])}var d1=0;function h1(e){xA("sk-demo"),nr="chat",Lt?.pin();for(let t of e){d1+=1;let r=d1,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}));De.chatState.messages.push(o)}Fe()}function xo(){Eo("right",!1),ku("assistant")}function Zy(){return sd()}function iu(){return De.isTurnActive()}function g1(){De.stop()}function b1(){De.newChat(),Ey(),nr="chat",Lt?.pin(),Fe()}function k6(e){De.openSession(e),Ey(),nr="chat",Lt?.pin(),Fe()}function $6(e){De.deleteSession(e),Fe()}function S6(){nr="sessions",Fe()}function C6(){let e=De.activeSessionId();if(!e)return null;return De.listSessions().find((t)=>t.id===e)?.title??null}var wo=n1({isAwaiting:Zy,isStreaming:iu,onSend:(e)=>{au(e)},requestRender:Fe});function p1(){if(xo(),nr!=="chat")nr="chat",Fe();requestAnimationFrame(()=>{Lt?.focusComposer()})}function y1(){let e=De.chatState,t=e.status==="streaming",r=!t&&e.error?e.error:"",o=r?JI(r):"",a=tu("assistant.newChat",{icon:"plus"}),i=XI({ask:{importRun:os,pendingId:eg()?.id??null},messages:e.messages,status:e.status});return{...Vy(),...wo.view(),emptyState:i.length===0&&!t?"shown":"hidden",error:r,errorAdvice:o,errorState:r?"shown":"hidden",hasAdvice:o!=="",hasSessions:De.listSessions().length>0,headLead:Rs([tu("assistant.history",{icon:"clock-counter-clockwise"})]),headTrail:Rs([a]),retry:Rs([tu("assistant.retry",{text:"Retry"})]),rows:i,sessionCommands:Rs([a?{...a,text:"New Chat"}:null]),sessions:r1(De.listSessions()),setupState:zb()?"hidden":"shown",streaming:t,title:C6()??"New chat",tokens:GI(e.tokenCount),tokensHint:KI(e.tokenCount,e.contextWarning),tokensState:e.tokenCount>0?"shown":"hidden",tokensTone:e.contextWarning?"warn":"normal",view:nr}}function v1(){return[{category:"Assistant",id:"assistant.focus",level:"application",title:"Focus Composer",keybinding:"mod+shift+a",menus:["palette"],group:"1_chat",run:p1},{category:"Assistant",id:"assistant.newChat",level:"application",title:"New Chat",menus:["palette"],group:"1_chat",run:()=>{xo(),b1()}},{category:"Assistant",id:"assistant.history",level:"application",title:"Chat History",menus:["palette"],group:"1_chat",run:()=>{xo(),S6()}},{category:"Assistant",id:"assistant.attachSelection",level:"application",title:"Attach Selection",menus:["palette"],group:"2_turn",requires:"an element selected on the canvas",when:(e)=>mh(e),run:()=>{if(!wo.attachSelection()){C.warn("Nothing is selected to attach.",{source:"Assistant"});return}p1()}},{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:()=>{xo(),y6()}},{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:g1}]}var av={name:"jx-boot",content:"launcher"};var T6="warning";async function su(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 d=await fetch(e,l);if(!d.ok){let E=`Import failed (${d.status})`;try{let A=await d.json();if(v(A)&&A.error)E=String(A.error)}catch{}throw Error(E)}if(!d.body)throw Error("Import stream had no response body");let f=d.body.getReader(),c=new TextDecoder,b="",y=null,w=0,k=(E)=>{let A=E.trim();if(!A)return;let j;try{j=JSON.parse(A)}catch{w+=1;return}if(j.type==="progress"){let P={phase:j.phase??"",message:j.message??""};if(j.current!==void 0)P.current=j.current;if(j.total!==void 0)P.total=j.total;r(P)}else if(j.type==="ready"&&j.root!==void 0)a?.({root:j.root});else if(j.type==="done"&&j.root!==void 0&&j.config){let P={root:j.root,config:j.config};if(j.result!==void 0)P.result=j.result;return P}else if(j.type==="error")throw Error(j.error||"Import failed");return};try{for(;;){let{done:E,value:A}=await f.read();if(E)break;b+=c.decode(A,{stream:!0});let j=b.split(`
|
|
499
499
|
`);b=j.pop()??"";for(let P of j)y=k(P)??y}y=k(b)??y}finally{try{await f.cancel()}catch{}}if(w>0)r({message:`${w} progress line${w===1?"":"s"} could not be read and ${w===1?"was":"were"} skipped — the import may be missing steps.`,phase:T6});if(!y)throw Error("Import stream ended without a result");return y}function w1(e){let t=Math.max(1,e.maxPaths??l$),r=Math.max(1,e.maxInFlight??4),o=e.schedule??queueMicrotask,a=new Map,i=!1,s=!0,l=[],d=0;function f(A,j){let P=a.get(A);if(P)P.push(...j);else a.set(A,j);if(!i)i=!0,o(b)}function c(A,j){e.fetchOne(A).then((P)=>{for(let N of j)N.resolve(P)},(P)=>{for(let N of j)N.reject(P)})}function b(){i=!1;let A=a;if(a=new Map,!s||A.size===1){for(let[P,N]of A)c(P,N);return}let j=new Map;for(let[P,N]of A)if(j.set(P,N),j.size===t)l.push(j),j=new Map;if(j.size>0)l.push(j);y()}function y(){while(d<r&&l.length>0)w(l.shift())}function w(A){d+=1,k(A).finally(()=>{d-=1,y()})}async function k(A){if(!s){for(let[P,N]of A)c(P,N);return}let j;try{j=await e.fetchBatch([...A.keys()])}catch(P){for(let N of A.values())for(let I of N)I.reject(P);return}if(j==="retry-singly"||j==="unsupported"||!S(j)){if(j==="unsupported")s=!1;for(let[P,N]of A)c(P,N);return}try{E(A,j)}catch{for(let[P,N]of A)c(P,N)}}function E(A,j){let P=0;for(let I of Array.isArray(j.files)?j.files:[]){let[_,O]=Array.isArray(I)?I:[],H=_===void 0?void 0:A.get(_);if(_===void 0||!H)continue;A.delete(_),P+=1;let F=O,W=F?.content;if(n(W))for(let D of H)D.resolve(W);else{let D=F?.error?.message,V=Error(D||`Failed to read file: ${_}`);for(let J of H)J.reject(V)}}let N=(Array.isArray(j.omitted)?j.omitted:[]).filter((I)=>A.has(I));if(P===0&&N.length>0){let I=N.shift();c(I,A.get(I)),A.delete(I)}for(let I of N)f(I,A.get(I)),A.delete(I);for(let[I,_]of A)c(I,_)}return{read(A){return new Promise((j,P)=>{f(A,[{reject:P,resolve:j}])})}}}function P6(e){return v(e)&&Array.isArray(e.files)}function Is(e,t){return e[t]??{}}async function Ce(e){return await e.json()}function x1(e){return JSON.parse(e)}async function rr(e,t){try{return sr(await Ce(e))??t}catch{return t}}async function E6(e){let t;try{t=await Ce(e)}catch{return!1}let r=Bb(t?.type)??t?.code;return r==="read_only"||r==="read-only"}function $1(e){let t=e?.heading;return n(t)&&t?t:void 0}async function pu(e,t){let r;try{r=await Ce(e)}catch{r=null}let o=Bb(r?.type)??r?.code,a=Np(r?.actions),i=$1(r),s=u$(r?.retry),l=r?.installUrl,d={status:e.status};if(o)d.code=o;if(n(l))d.installUrl=l;if(a.length>0)d.actions=a;if(i!==void 0)d.heading=i;if(s!==void 0)d.retry=s;return Object.assign(Error(sr(r)??t),d)}async function $e(e,t){if(!e.ok)throw await pu(e,t);return Ce(e)}function S1(e){let t=Bb(e?.type)??e?.code;return t==="action-required"||t==="action_required"}async function N6(e){let t;try{t=await Ce(e)}catch{return}if(!S1(t))return;let r=Np(t?.actions);if(r.length===0)return;let o=sr(t),a=$1(t),i=u$(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;$A(s)}function C1(e){return e.dir?`${e.branch}:${e.dir}`:e.branch}function j6(e){let t=e.indexOf(":"),r=t===-1?e:e.slice(0,t),o=t===-1?"":Dl(e.slice(t+1));if(!r||o===null)return null;return o?{branch:r,dir:o}:{branch:r}}function sv(e){let t=e.dir?`:${e.dir.split("/").map((r)=>encodeURIComponent(r)).join("/")}`:"";return`/edit/${e.owner}/${e.repo}@${encodeURIComponent(e.branch)}${t}`}function R6(e){let{owner:t,repo:r}=e;return`/api/v1/p/${encodeURIComponent(t)}/${encodeURIComponent(r)}/${encodeURIComponent(C1(e))}/studio`}function lu(e){return`${e.owner}/${e.repo}@${C1(e)}`}function T1(e,t){return S(e.data)&&"source"in e.data&&e.data.source===t}async function Ls(){let e=await fetch("/api/v1/cf/connection",{credentials:"include"});if(!e.ok)return null;let t=await Ce(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 cu=null;async function A6(e,t){let r=await Ls().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 d=0,f=()=>{if(window.removeEventListener("message",w),window.clearTimeout(d),!a.closed)a.close()},c=(E)=>{f(),s(E)},b=(E)=>{f(),l(Error(E))},y=(E)=>Boolean(E?.connected&&!E.needsReconnect),w=(E)=>{if(E.origin!==location.origin)return;if(!T1(E,"jx-cf"))return;let{data:A}=E;if(A.status==="error"){b(A.reason??"Cloudflare authorization failed");return}Ls().then((j)=>{c(y(j)?{connection:j,status:"connected"}:{status:"timeout"})},()=>{b("Cloudflare connected, but the connection could not be confirmed")})};window.addEventListener("message",w);let k=async()=>{if(Date.now()>i){c({status:"timeout"});return}let E=null,A=!0;try{E=await Ls()}catch{A=!1}if(A&&y(E)&&!o){c({connection:E,status:"connected"});return}if(a.closed){let j=await Ls().catch(()=>null);c(y(j)?{connection:j,status:"connected"}:{status:"canceled"});return}d=window.setTimeout(()=>{k()},1500)};d=window.setTimeout(()=>{k()},1500)})}function pa(e){return n(e)&&e?e:void 0}function I6(e){if(!Array.isArray(e))return[];return e.flatMap((t)=>{if(!v(t))return[];let r=pa(t.id),o=pa(t.label),a=pa(t.detail);if(!r||!o||!a)return[];let i=Np(t.actions),{connected:s}=t,l={detail:a,id:r,label:o};if(Xe(s))l.connected=s;if(i.length>0)l.actions=i;return[l]})}function L6(e){if(!Array.isArray(e))return[];return e.flatMap((t)=>{if(!v(t))return[];let r=pa(t.id),o=pa(t.title),a=pa(t.message);if(!r||!o||!a)return[];let i=Np(t.actions),{display:s,level:l}=t,d={id:r,message:a,title:o};if(l==="info"||l==="warning")d.level=l;if(s==="banner"||s==="toast")d.display=s;if(i.length>0)d.actions=i;return[d]})}var du=null,O6=900000,M6=300;function D6(e){let t=Date.now()+O6;return new Promise((r,o)=>{let a=0,i=()=>{if(window.removeEventListener("message",l),window.clearTimeout(a),!e.closed)e.close()},s=(f)=>{i(),r(f)},l=(f)=>{if(f.origin!==location.origin)return;if(!T1(f,"jx-action"))return;let{data:c}=f;if(c.status==="done"||c.status==="canceled")s({status:c.status});else if(c.status==="error")i(),o(Error(c.reason??"The action could not be completed"))};window.addEventListener("message",l);let d=()=>{if(Date.now()>t){s({status:"unknown"});return}if(e.closed){a=window.setTimeout(()=>{s({status:"unknown"})},M6);return}a=window.setTimeout(d,1000)};a=window.setTimeout(d,1000)})}function F6(e){let t=/^([^/@]+)\/([^/@]+)@(.+)$/.exec(e);if(!t)return null;let[,r,o,a]=t,i=a?j6(a):null;if(!r||!o||!i)return null;return{owner:r,repo:o,...i}}async function P1(){let e=await fetch("/api/v1/projects",{credentials:"include"});return e.ok?Ce(e):[]}async function k1(e){let t=F6(e);if(t)return t;let r=/^([^/@]+)\/([^/@]+)$/.exec(e);if(!r)return null;let[,o,a]=r,s=(await P1().catch(()=>[])).find((l)=>l.owner===o&&l.name===a);return s?{owner:s.owner,repo:s.name,branch:s.defaultBranch}:null}function E1(e){let t=e?R6(e):"",r=e?lu(e):"",o=null,a=null;async function i(P,N){if(!e)throw Error("No project is open in this session");let I=await fetch(`${t}${P}`,{credentials:"include",...N});if(I.status===403)await N6(I.clone());return I}let s=e?`${e.owner}/${e.repo}`:null;function l(P,N){return i(P,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(N)})}async function d(){return $e(await i("/project-info"),"Failed to load project")}let f=null;function c(){return f??=d().then((P)=>P.defaultBranch||"",()=>(f=null,"")),f}async function b(P){return(await $e(await i(`/file?path=${encodeURIComponent(P)}`),`Failed to read file: ${P}`)).content}let y=w1({async fetchBatch(P){let N=await l("/files/read",{paths:P});if(N.status===404||N.status===405)return"unsupported";if(N.status===403&&await E6(N))return"unsupported";if(!N.ok)return"retry-singly";let I;try{I=await Ce(N)}catch{return"unsupported"}if(!P6(I))return"unsupported";return I},fetchOne:b}),w=null;async function k(){let P;try{w??=y.read("package.json").finally(()=>{w=null}),P=await w}catch{return{}}try{let N=x1(P);return v(N)?N:{}}catch{return{}}}async function E(P){let N=await i("/file",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:"package.json",content:`${JSON.stringify(P,null,2)}
|
|
500
|
-
`})});if(!N.ok)throw Error(await rr(N,"Failed to update package.json"))}let A={};if(t)A.assetSpace="repo",A.documentBaseUrl=`${t}/raw/`;let j={id:"cloud",projectRoot:r,gitHosted:!0,canvasUrl:"/canvas.html",...A,openProjectPicker:"repo-list",createDestination:"repo",async activate(){if(!e)return;let P=await l("/activate",{});if(!P.ok)throw await pu(P,"Failed to open the project session")},async openProject(){if(!e)return null;let P=await d(),N=P.projectConfig??{};return{config:N,handle:{root:r,name:N.name||P.name,projectConfig:N}}},async probeRootProject(){if(!e)return null;try{let P=await d();return{meta:{root:r,name:P.name},info:{isSiteProject:P.projectConfig!==null,projectConfig:P.projectConfig??null}}}catch{return null}},async listDirectory(P){return $e(await i(`/files?dir=${encodeURIComponent(P)}`),`Failed to list directory: ${P}`)},async readFile(P){return y.read(P)},async readFileBytes(P){let N=await i(`/file/bytes?path=${encodeURIComponent(P)}`);if(!N.ok)throw Error(await rr(N,`Failed to read file bytes: ${P}`));return N.arrayBuffer()},async writeFile(P,N){let I=await i("/file",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:P,content:N})});if(!I.ok)throw Error(await rr(I,`Failed to write file: ${P}`))},async uploadFile(P,N){let I=await i(`/file/upload?path=${encodeURIComponent(P)}`,{method:"POST",body:N}),_=await $e(I,`Upload failed: ${P}`),O={path:_.path??P};if(_.size!==void 0)O.size=_.size;return O},async deleteFile(P){let N=await i(`/file?path=${encodeURIComponent(P)}`,{method:"DELETE"});if(!N.ok&&N.status!==404)throw Error(await rr(N,`Failed to delete file: ${P}`))},async renameFile(P,N){return $e(await l("/file/rename",{from:P,to:N}),`Failed to rename: ${P} → ${N}`)},async findReferences(P){let N=new URLSearchParams;if(P.path)N.set("path",P.path);if(P.tagName)N.set("tag",P.tagName);return $e(await i(`/references?${N.toString()}`),`Failed to find references: ${P.path??P.tagName??""}`)},async createDirectory(P){},async collab(P){if(!e||typeof WebSocket>"u"||typeof location>"u")return null;a??=i("/collab").then(async(O)=>O.ok?L_(await Ce(O)):{offer:[],refused:null}).catch(()=>({offer:[],refused:null}));let N=await a;if(N.refused!==null)return console.warn(`Collaboration unavailable: ${N.refused}`),null;let{offer:I}=N;return o??=(async()=>{let{createWsCollabConnection:O}=await (le("bv552sfx"),import("./chunks/ws-client-bv552sfx.js")),H=location.protocol==="https:"?"wss":"ws";return O({hydratePath:async(F)=>y.read(F).then(()=>{},()=>{}),protocols:I,url:`${H}://${location.host}${t}/collab`})})(),(await o).openDoc(P)},subscribeFileEvents(P,N){if(!e||typeof WebSocket>"u"||typeof location>"u")return()=>{};let I=null,_=!1,O=!1,H=()=>{let W=location.protocol==="https:"?"wss":"ws",D=new WebSocket(`${W}://${location.host}${t}/events`);I=D,D.addEventListener("message",(V)=>{let J;try{J=JSON.parse(V.data)}catch{return}if(J.kind==="fs"&&J.events?.length)P(J.events);else if(J.kind==="git"&&J.event==="committed")N?.onResync?.("commit")}),D.addEventListener("open",()=>{F.opened(),N?.onResync?.(O?"reconnect":"open"),O=!0}),D.addEventListener("close",()=>{if(!_)F.scheduleRetry()})},F=Cy(H);return H(),()=>{_=!0,F.dispose(),I?.close()}},async listFormats(){try{let P=await i("/formats");if(!P.ok)return[];return(await Ce(P)).formats??[]}catch{return[]}},async listExtensions(){try{let P=await i("/formats");if(!P.ok)return[];return(await Ce(P)).extensions??[]}catch{return[]}},async listExtensionCatalog(){try{let P=await i("/catalog");if(!P.ok)return[];let N=await Ce(P),I=await k(),_=new Set([...Object.keys(Is(I,"dependencies")),...Object.keys(Is(I,"devDependencies"))]);for(let O of N)O.bundled=!0,O.installed=_.has(O.name);return N}catch{return[]}},async fetchProjectSchemas(){try{let P=await i("/project-schemas");if(!P.ok)return{};return await Ce(P)}catch{return{}}},async formatAction(P){let N=await l("/format",P);if(!N.ok)throw Error(await rr(N,"This cloud session cannot run format actions yet (the backend serves no format route)"));return(await Ce(N)).result},async discoverComponents(){let P=new Set(["node_modules","dist",".git",".claude",".obsidian","build"]),N=400,I=6,_=[],O=async(F,W)=>{if(W>6||_.length>=400)return;let D;try{D=await j.listDirectory(F)}catch{return}let V=[];for(let J of D)if(J.type==="directory"){if(!P.has(J.name)&&!J.name.startsWith("."))V.push(J.path)}else if(J.name.endsWith(".json")&&_.length<400)_.push(J.path);await Promise.all(V.map(async(J)=>O(J,W+1)))};return await O("",0),(await Promise.all(_.map(async(F)=>{try{return QS(x1(await j.readFile(F)),F)}catch{return null}}))).filter((F)=>F!==null)},async codeService(){return null},async fetchPluginSchema(){return null},async addPackage(P){let N=await k(),I=Is(N,"dependencies"),_=P.lastIndexOf("@"),[O,H]=_>0?[P.slice(0,_),P.slice(_+1)]:[P,"latest"];I[O]=H,N.dependencies=I,await E(N)},async removePackage(P){let N=await k();for(let I of["dependencies","devDependencies"]){let _=N[I];if(v(_)&&P in _)N[I]=Object.fromEntries(Object.entries(_).filter(([O])=>O!==P))}await E(N)},async listPackages(){let P=await k(),N=[],I=Is(P,"dependencies");for(let[O,H]of Object.entries(I))N.push({name:O,version:H});let _=Is(P,"devDependencies");for(let[O,H]of Object.entries(_))N.push({name:O,version:H,dev:!0});return N},async resolveSiteContext(P){try{let I=(await d()).projectConfig??void 0,_={sitePath:r};if(I!==void 0)_.projectConfig=I;if(P!==r)_.fileRelPath=P;return _}catch{return{sitePath:null}}},async locateFile(P){try{let N=await i(`/locate?name=${encodeURIComponent(P)}`);if(N.ok)return(await Ce(N)).path??null}catch{}return null},async searchFiles(P,N=[]){let I=["json",...N.map((O)=>O.replace(/^\./,""))],_=await i(`/search?query=${encodeURIComponent(P)}&extensions=${encodeURIComponent(I.join(","))}`);if(!_.ok)return[];return await Ce(_)},async gitStatus(){return $e(await i("/git/status"),"Failed to read git status")},async gitBranches(){let P=await $e(await i("/git/branches"),"Failed to list branches");if(P.defaultBranch)return P;let N=await c();return N?{...P,defaultBranch:N}:P},async gitLog(P){let N=P?`?limit=${P}`:"";return $e(await i(`/git/log${N}`),"Failed to read git log")},async gitStage(P){await $e(await l("/git/stage",{files:P}),"Failed to stage files")},async gitUnstage(P){await $e(await l("/git/unstage",{files:P}),"Failed to unstage files")},async gitCommit(P){await $e(await l("/git/commit",{message:P}),"Commit failed")},async gitPush(){await $e(await l("/git/push",{}),"Push failed")},async gitPull(){await $e(await l("/git/pull",{}),"Pull failed")},async gitFetch(){await $e(await l("/git/fetch",{}),"Fetch failed")},async gitCheckout(P){if(e&&typeof location<"u")location.assign(sv({...e,branch:P}))},async gitCreateBranch(P){await $e(await l("/git/create-branch",{name:P}),"Failed to create branch")},async gitDiff(P){return(await $e(await i(`/git/diff?path=${encodeURIComponent(P??"")}`),"Failed to compute diff")).diff},async gitShow(P){let N=new URLSearchParams({path:P.path});if(P.ref)N.set("ref",P.ref);return(await $e(await i(`/git/show?${N}`),`Failed to read ${P.path} at ref`)).content},async gitDiscard(P){await $e(await l("/git/discard",{files:P}),"Failed to discard changes")},async gitInit(){},async gitAddRemote(){},async buildSite(){return $e(await i("/build",{method:"POST"}),"The site could not be previewed.")},async listProjects(){return(await P1()).map((N)=>({name:N.fullName,root:lu({owner:N.owner,repo:N.name,branch:N.defaultBranch}),description:`${N.defaultBranch} · ${N.permission}`}))},async listStarters(){let P=await fetch("/api/v1/starters",{credentials:"include"});if(!P.ok)return[];return await Ce(P)},async setWindowProject(P){let N=await k1(P);if(!N)throw Error(`No project to open at ${P}`);if(typeof location<"u")location.assign(sv(N));return{deduped:!0,config:null}},async openProjectInNewWindow(P){let N=await k1(P);if(!N)throw Error(`No project to open at ${P}`);if(typeof window<"u")window.open(sv(N),"_blank","noopener");return{focused:!1}},async createProject(P){let{destination:N}=P;if(N.kind!=="repo"||!N.owner||!N.repo)throw Error("A destination repository is required.");let I=await fetch("/api/v1/projects",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:P.name,description:P.description,starter:P.starter,owner:N.owner,repo:N.repo,private:N.private})});if(!I.ok)throw await pu(I,"Failed to create project");let _=await Ce(I);return{root:lu({owner:_.owner,repo:_.name,branch:_.defaultBranch}),config:{name:P.name}}},async importSite(P,N,I,_){return await su("/api/v1/import/site",P,N,I,_)},async getUser(){let P=await fetch("/api/v1/me",{credentials:"include"});if(!P.ok)return null;let N=await Ce(P);if(!N.user)return null;let I={login:N.user.login};if(N.user.name)I.name=N.user.name;if(N.user.avatar_url)I.avatarUrl=N.user.avatar_url;return I},async listRepos(){let P=await fetch("/api/v1/repos",{credentials:"include"});if(!P.ok)throw Error(await rr(P,"Failed to list repositories"));return(await Ce(P)).map((I)=>({owner:I.owner,name:I.name,fullName:I.fullName,private:I.private,defaultBranch:I.defaultBranch,permission:I.permission,isJxProject:I.isJxProject}))},async listRepoProjects(P){let N=await fetch(`/api/v1/repos/${encodeURIComponent(P.owner)}/${encodeURIComponent(P.name)}/projects`,{credentials:"include"}),I=await $e(N,"Failed to look for projects"),_=[];for(let O of I.locations){let H=Dl(O.dir);if(H!==null)_.push(O.name?{dir:H,name:O.name}:{dir:H})}return{branch:I.branch,locations:_,truncated:I.truncated===!0}},async importProject(P){let N=Dl(P.dir??"");if(N===null)throw Error("The project folder must stay inside the repository.");let I={owner:P.owner,name:P.name};if(N)I.dir=N;let _=await fetch("/api/v1/projects/import",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify(I)}),O=await $e(_,"Failed to import repository"),H={owner:O.owner,repo:O.name,branch:O.defaultBranch};if(N)H.dir=N;return{root:lu(H)}},async getAccountStatus(){let P=await fetch("/api/v1/me",{credentials:"include"});if(!P.ok)return null;let N=await Ce(P),I=I6(N.entries),_=L6(N.notices),O={installations:(N.installations??[]).map((H)=>{let F={id:H.id,account:H.account};if(H.manageUrl)F.manageUrl=H.manageUrl;return F})};if(N.appInstallUrl)O.appInstallUrl=N.appInstallUrl;if(I.length>0)O.entries=I;if(_.length>0)O.notices=_;return O},performAction(P){if(typeof window>"u"||typeof location>"u"||!P.href)return Promise.resolve(null);let N=du;if(N){try{N.popup?.focus()}catch{}return N.promise}let I=window.open(P.href,"jx-action","width=980,height=820");if(!I)return location.assign(P.href),Promise.resolve({status:"redirect"});let _={popup:I,promise:Promise.resolve(null)};return du=_,_.promise=D6(I).finally(()=>{if(du===_)du=null}),_.promise},async createPullRequest(P){return $e(await l("/git/pr",P),"Failed to open pull request")},async cfConnection(){return Ls()},cfConnect(){if(typeof window>"u"||typeof location>"u")return Promise.resolve(null);let P=cu;if(P){try{P.popup?.focus()}catch{}return P.promise}let N={popup:null,promise:Promise.resolve(null)};cu=N;let I=s?`/api/v1/cf/connect?project=${encodeURIComponent(s)}`:"/api/v1/cf/connect";return N.promise=A6(N,I).finally(()=>{if(cu===N)cu=null}),N.promise},async cfAccounts(){let P=await fetch("/api/v1/cf/accounts",{credentials:"include"});return $e(P,"Failed to list Cloudflare accounts")},async cfSelectAccount(P){let N=await fetch("/api/v1/cf/select-account",{body:JSON.stringify({accountId:P.id,accountName:P.name}),credentials:"include",headers:{"Content-Type":"application/json"},method:"POST"});if(!N.ok)throw Error(await rr(N,"Failed to select a Cloudflare account"))},async cfDisconnect(){let P=await fetch("/api/v1/cf/connection",{credentials:"include",method:"DELETE"});if(!P.ok)throw Error(await rr(P,"Failed to disconnect Cloudflare"))},async cfApi(P,N){let I={};if(s)I["X-Jx-Project"]=s;if(N?.body!==void 0)I["Content-Type"]="application/json";let _={method:N?.method??"GET",credentials:"include"};if(Object.keys(I).length>0)_.headers=I;if(N?.body!==void 0)_.body=JSON.stringify(N.body);let O=await fetch(`/api/v1/cf/proxy${P}`,_);if(O.status===403){let F=await Ce(O.clone()).catch(()=>null);if(S1(F))throw await pu(O,"Publishing was refused")}let H=await Ce(O);if(!O.ok||H.success===!1){let F=H.errors?.map((W)=>W.message).join("; ")??H.error??O.statusText;throw Error(`Cloudflare API: ${F}`)}return H.result??H},aiChatUrl(){return s?`/api/v1/ai/chat?project=${encodeURIComponent(s)}`:"/api/v1/ai/chat"}};return j}function N1(e){return"showDirectoryPicker"in e&&typeof e.showDirectoryPicker==="function"}function j1(){return N1(globalThis)}function _6(){let e=new Uint8Array(16);return globalThis.crypto.getRandomValues(e),[...e].map((t)=>t.toString(16).padStart(2,"0")).join("")}function H6(e){return S(e)&&"name"in e&&n(e.name)?e.name:""}async function R1(e){let t=globalThis;if(!N1(t))throw TypeError("This browser has no folder chooser. Type the folder's path into Location instead.");let r=t.showDirectoryPicker,o;try{o=await r({id:"jx-new-project-location",mode:"readwrite",startIn:"documents"})}catch(l){if(H6(l)==="AbortError")return null;throw Error(`The folder chooser could not open (${Q(l)}). Type the folder's path into Location instead.`,{cause:l})}let{name:a}=o,i=_6(),s=!1;try{try{let d=await o.getFileHandle(dC,{create:!0});s=!0;let f=await d.createWritable();await f.write(i),await f.close()}catch(d){throw Error(`Jx Studio can't write to "${a}" (${Q(d)}), so it can't create a project there. Choose a folder you can write to.`,{cause:d})}let l;try{l=await e({id:i,name:a})}catch(d){throw Error(`Jx Studio could not look up where "${a}" is: ${Q(d)}. Type the folder's path into Location instead.`,{cause:d})}if(!l)throw Error(`Jx Studio could not find where "${a}" is. From a browser it can only find folders inside your home folder. Type its full path into Location instead.`);return l}finally{if(s)await o.removeEntry(dC).catch(()=>{})}}async function ee(e){return await e.json()}function z6(e){return"showDirectoryPicker"in e&&te(e.showDirectoryPicker)}function A1(){let e="",t=null,r=null,o=null;async function a(c){if(!c)return;let b=await fetch("/__studio/activate",{body:JSON.stringify({root:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!b.ok){let y=await ee(b).catch(()=>({}));throw Error(`Could not open ${c}: ${sr(y)??`activation failed (${b.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 b=c.replaceAll("\\","/");if(!e)return b;if(b===".")return e;return`${e}/${b}`}function l(c,b={}){let y=new URLSearchParams(b);if(e)y.set("dir",s("."));let w=y.toString();return`/__studio/git/${c}${w?`?${w}`:""}`}function d(c){let b=c.replaceAll("\\","/");if(!e)return b;return b.startsWith(`${e}/`)?b.slice(e.length+1):b}let f={};if(j1())f.pickDirectory=async()=>R1(async({id:c,name:b})=>{let y=await fetch(`/__studio/locate-directory?name=${encodeURIComponent(b)}&id=${encodeURIComponent(c)}`);if(!y.ok){let k=await ee(y).catch(()=>null);throw Error(ka(k,y.status))}return(await ee(y)).path??null});return{id:"devserver",createDestination:"path",get projectRoot(){return e},set projectRoot(c){if(e=c||"",e)t=this.activate(e).catch((b)=>{console.error("Project activation failed:",b)})},async activate(c){await a(c??e)},async openProject(){let c=window;if(!z6(c))throw Error("showDirectoryPicker not available — use a Chromium-based browser");let b;try{b=await c.showDirectoryPicker({mode:"readwrite"})}catch(P){if(P instanceof Error&&P.name==="AbortError")return null;throw P}let y;try{y=await b.getFileHandle("project.json")}catch{throw Error("No project.json found in selected folder")}let w=await y.getFile(),k=JSON.parse(await w.text()),E=await fetch("/__studio/sites");if(!E.ok)throw Error("Failed to fetch site list from server");let j=(await ee(E)).find((P)=>JSON.stringify(P.config)===JSON.stringify(k));if(!j){let P=await fetch(`/__studio/find-project?name=${encodeURIComponent(b.name)}`);if(!P.ok)throw Error("Could not locate project on disk");let N=await ee(P);if(!N.path)throw Error(`Could not find project directory "${b.name}"`);e=N.path}else e=j.path;return await this.activate(),{config:k,handle:{name:k.name||e.split("/").pop(),projectConfig:k,root:e}}},async probeRootProject(){try{let[c,b]=await Promise.all([fetch("/__studio/project"),fetch("/__studio/project-info?dir=.")]),y=c.ok?await ee(c):{name:"project",root:"."};return{info:b.ok?await ee(b):{isSiteProject:!1},meta:y}}catch{return null}},async createProject(c){let b=await fetch("/__studio/create-project",{body:JSON.stringify(c),headers:{"Content-Type":"application/json"},method:"POST"});if(!b.ok){let y=await ee(b);throw Error(sr(y)??"Failed to create project")}return await b.json()},...f,async listStarters(){let c=await fetch("/__studio/starters");if(!c.ok)throw Error("Failed to load starters");return await ee(c)},async importSite(c,b,y,w){return await su("/__studio/import-site",c,b,y,w)},async listDirectory(c){let b=await fetch(`/__studio/files?dir=${encodeURIComponent(s(c))}`);if(!b.ok)throw Error(`Failed to list directory: ${c}`);let y=await ee(b);for(let w of y)w.path=d(w.path);return y},async readFile(c){let b=await fetch(`/__studio/file?path=${encodeURIComponent(s(c))}&optional=1`);if(!b.ok)throw Error(`Failed to read file: ${c}`);let y=await ee(b);if(y.content===null)throw Error(`Failed to read file: ${c} (not found)`);return y.content},async readFileBytes(c){let b=await fetch(`/__studio/file/bytes?path=${encodeURIComponent(s(c))}`);if(!b.ok)throw Error(`Failed to read file bytes: ${c}`);return b.arrayBuffer()},async writeFile(c,b){if(!(await fetch(`/__studio/file?path=${encodeURIComponent(s(c))}`,{body:b,method:"PUT"})).ok)throw Error(`Failed to write file: ${c}`)},async uploadFile(c,b){let y=await fetch(`/__studio/file/upload?path=${encodeURIComponent(s(c))}`,{body:b,method:"POST"});if(!y.ok)throw Error(`Upload failed: ${c}`);let w=await ee(y),k={path:w.path??c};if(w.size!==void 0)k.size=w.size;return k},async deleteFile(c){let b=await fetch(`/__studio/file?path=${encodeURIComponent(s(c))}`,{method:"DELETE"});if(!b.ok&&b.status!==404)throw Error(`Failed to delete file: ${c}`)},async renameFile(c,b){let y=await fetch("/__studio/file/rename",{body:JSON.stringify({from:s(c),to:s(b)}),headers:{"Content-Type":"application/json"},method:"POST"});if(!y.ok)throw Error(`Failed to rename: ${c} → ${b}`);return ee(y)},async findReferences(c){await t;let b=new URLSearchParams;if(c.path)b.set("path",s(c.path));if(c.tagName)b.set("tag",c.tagName);let y=await fetch(`/__studio/references?${b.toString()}`);if(!y.ok)throw Error(`Failed to find references: ${c.path??c.tagName??""}`);return ee(y)},subscribeFileEvents(c,b){if(typeof EventSource>"u")return()=>{};let y=new EventSource("/__reload"),w=0;return y.addEventListener("open",()=>{if(w+=1,w>1)i(),b?.onResync?.("reconnect")}),y.addEventListener("fs",(k)=>{let E;try{E=JSON.parse(k.data)}catch{return}let A=[];for(let j of E.events??[]){let P=j.path.replaceAll("\\","/");if(e&&P!==e&&!P.startsWith(`${e}/`))continue;let N=d(P);if(N&&!N.startsWith(".."))A.push({isDir:j.isDir,path:N,type:j.type})}if(A.length>0)c(A)}),()=>{y.close()}},async collab(c){if(typeof WebSocket>"u"||typeof location>"u")return null;if(r===null)r=fetch("/__studio/collab").then(async(k)=>k.ok?L_(await ee(k)):null).catch(()=>null);let b=await r;if(b===null)return null;if(b.refused!==null)return console.warn(`Collaboration unavailable: ${b.refused}`),null;let{offer:y}=b;return o??=(async()=>{let{createWsCollabConnection:k}=await (le("bv552sfx"),import("./chunks/ws-client-bv552sfx.js")),E=location.protocol==="https:"?"wss":"ws";return k({protocols:y,url:`${E}://${location.host}/__studio/collab`})})(),(await o).openDoc(s(c))},async createDirectory(c){},async discoverComponents(c){let b=c||e;if(!b)return[];let y=`/__studio/components?dir=${encodeURIComponent(b)}`,w=await fetch(y);if(!w.ok)return[];return await w.json()},async addPackage(c){let b=await fetch("/__studio/packages/add",{body:JSON.stringify({name:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!b.ok)throw Error(await b.text());return await b.json()},async removePackage(c){let b=await fetch("/__studio/packages/remove",{body:JSON.stringify({name:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!b.ok)throw Error(await b.text());return await b.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 b=await ee(c);return Boolean(b.needsInstall)},async packageVersions(){let c=await fetch("/__studio/packages/versions");if(!c.ok)return[];return await c.json()},async setPackageVersions(c){let b=await fetch("/__studio/packages/set-versions",{body:JSON.stringify({updates:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!b.ok)return{log:await b.text(),ok:!1};return await b.json()},async codeService(c,b){try{let y=await fetch(`/__studio/code/${c}`,{body:JSON.stringify(b),headers:{"Content-Type":"application/json"},method:"POST"});if(!y.ok)return null;return await y.json()}catch{return null}},async resolveSiteContext(c){let b=await fetch(`/__studio/resolve-site?path=${encodeURIComponent(c)}`);if(!b.ok)return{sitePath:null};return await b.json()},async locateFile(c){try{let b=await fetch("/__studio/locate",{body:JSON.stringify({name:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(b.ok)return(await ee(b)).path||null}catch{}return null},async searchFiles(c,b=[]){let y=["json",...b.map((A)=>A.replace(/^\./,""))],w=`**/*${c}*.{${y.join(",")}}`,k=await fetch(`/__studio/files?dir=${encodeURIComponent(s("."))}&glob=${encodeURIComponent(w)}`);if(!k.ok)return[];let E=await ee(k);for(let A of E)A.path=d(A.path);return E},async listFormats(){let c=await fetch(`/__studio/formats?dir=${encodeURIComponent(s("."))}`);if(!c.ok)return[];return(await ee(c)).formats??[]},async listExtensions(){let c=await fetch(`/__studio/formats?dir=${encodeURIComponent(s("."))}`);if(!c.ok)return[];return(await ee(c)).extensions??[]},async listExtensionCatalog(){let c=await fetch(`/__studio/catalog?dir=${encodeURIComponent(s("."))}`);return c.ok?await ee(c):[]},async fetchProjectSchemas(){let c=await fetch(`/__studio/project-schemas?dir=${encodeURIComponent(s("."))}`);if(!c.ok)return{};return await ee(c)},async dataConnections(){let c=await fetch(`/__studio/data/connections?dir=${encodeURIComponent(s("."))}`);if(!c.ok){let b=await ee(c);throw Error(sr(b)??"Failed to list connections")}return await ee(c)},async dataConnectionTest(c){let b=await fetch(`/__studio/data/connections/test?dir=${encodeURIComponent(s("."))}`,{body:JSON.stringify({connection:c}),headers:{"Content-Type":"application/json"},method:"POST"}),y=await ee(b);if(!b.ok)throw Error(sr(y)??"Connection test failed");return y},async dataPush(c){let b=await fetch(`/__studio/data/push?dir=${encodeURIComponent(s("."))}`,{body:JSON.stringify(c??{}),headers:{"Content-Type":"application/json"},method:"POST"}),y=await ee(b);if(!b.ok)throw Error(sr(y)??"Schema push failed");return y},async dataRows(c){let b=new URLSearchParams({dir:s("."),table:c.table});if(c.connection)b.set("connection",c.connection);if(c.limit!==void 0)b.set("limit",String(c.limit));if(c.offset!==void 0)b.set("offset",String(c.offset));if(c.orderBy!==void 0)b.set("orderBy",c.orderBy);if(c.dir!==void 0)b.set("dir",c.dir);let y=await fetch(`/__studio/data/rows?${b}`),w=await ee(y);if(!y.ok)throw Error(sr(w)??"Failed to load rows");return w},async dataInsertRow(c){let b=await fetch(`/__studio/data/rows?dir=${encodeURIComponent(s("."))}`,{body:JSON.stringify(c),headers:{"Content-Type":"application/json"},method:"POST"}),y=await ee(b);if(!b.ok)throw Error(sr(y)??"Insert failed");return y},async dataUpdateRow(c){let b=await fetch(`/__studio/data/rows?dir=${encodeURIComponent(s("."))}`,{body:JSON.stringify(c),headers:{"Content-Type":"application/json"},method:"PUT"}),y=await ee(b);if(!b.ok)throw Error(sr(y)??"Update failed");return y},async dataDeleteRow(c){let b=new URLSearchParams({dir:s("."),pk:String(c.pk),table:c.table});if(c.connection)b.set("connection",c.connection);let y=await fetch(`/__studio/data/rows?${b}`,{method:"DELETE"}),w=await ee(y);if(!y.ok)throw Error(sr(w)??"Delete failed");return w},async listSecrets(){let c=await fetch(`/__studio/secrets?dir=${encodeURIComponent(s("."))}`);if(!c.ok){let y=await ee(c);throw Error(sr(y)??"Failed to list secrets")}return(await ee(c)).names},async setSecrets(c){let b=await fetch(`/__studio/secrets?dir=${encodeURIComponent(s("."))}`,{body:JSON.stringify(c),headers:{"Content-Type":"application/json"},method:"PUT"}),y=await ee(b);if(!b.ok)throw Error(sr(y)??"Failed to write secrets");return y},async formatAction(c){let b=await fetch("/__studio/format",{body:JSON.stringify({...c,dir:s(".")}),headers:{"Content-Type":"application/json"},method:"POST"}),y=await ee(b);if(!b.ok)throw Error(sr(y)??"Format action failed");return y.result},async fetchPluginSchema(c,b,y){let w=new URLSearchParams({src:c});if(b)w.set("prototype",b);if(y)w.set("base",y);let k=await fetch(`/__studio/plugin-schema?${w}`);if(!k.ok)return null;let{schema:E}=await ee(k);return E},async resolveClass(c){let b=await fetch("/__jx_resolve__",{body:JSON.stringify(c),headers:{"content-type":"application/json"},method:"POST"});if(!b.ok)throw Error(`Class resolution failed: ${b.status}`);return await ee(b)},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 b=await fetch(l("log",c?{limit:String(c)}:{}));if(!b.ok)throw Error(await b.text());return await b.json()},async gitStage(c){let b=await fetch(l("stage"),{body:JSON.stringify({files:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!b.ok){let y=await ee(b);throw Error(ka(y))}return await b.json()},async gitUnstage(c){let b=await fetch(l("unstage"),{body:JSON.stringify({files:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!b.ok){let y=await ee(b);throw Error(ka(y))}return await b.json()},async gitCommit(c){let b=await fetch(l("commit"),{body:JSON.stringify({message:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!b.ok){let y=await ee(b);throw Error(ka(y))}return await b.json()},async gitPush(c){let b=await fetch(l("push"),{body:JSON.stringify(c||{}),headers:{"Content-Type":"application/json"},method:"POST"});if(!b.ok){let y=await ee(b);throw Error(ka(y))}return await b.json()},async gitPull(){let c=await fetch(l("pull"),{method:"POST"});if(!c.ok){let b=await ee(c);throw Error(ka(b))}return await c.json()},async gitFetch(){let c=await fetch(l("fetch"),{method:"POST"});if(!c.ok){let b=await ee(c);throw Error(ka(b))}return await c.json()},async gitCheckout(c){let b=await fetch(l("checkout"),{body:JSON.stringify({branch:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!b.ok){let y=await ee(b);throw Error(ka(y))}return await b.json()},async gitCreateBranch(c){let b=await fetch(l("create-branch"),{body:JSON.stringify({name:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!b.ok){let y=await ee(b);throw Error(ka(y))}return await b.json()},async gitDiff(c){let b=await fetch(l("diff",{path:c??""}));if(!b.ok)throw Error(await b.text());return await b.json()},async gitShow(c){let b=await fetch(l("show",c.ref?{path:c.path,ref:c.ref}:{path:c.path}));if(!b.ok)throw Error(await b.text());return(await ee(b)).content},async gitDiscard(c){let b=await fetch(l("discard"),{body:JSON.stringify({files:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!b.ok){let y=await ee(b);throw Error(ka(y))}return await b.json()},async gitClone(c){let b=await fetch(l("clone"),{body:JSON.stringify({url:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!b.ok){let y=await ee(b);throw Error(ka(y))}return await b.json()},async gitInit(){let c=await fetch(l("init"),{method:"POST"});if(!c.ok){let b=await ee(c);throw Error(ka(b))}},async buildSite(){let c=await fetch("/__studio/build",{method:"POST"});if(!c.ok){let b=await ee(c);throw Error(sr(b)??"The site could not be built.")}return await ee(c)},async previewSite(c){let b=await fetch("/__studio/preview",{body:JSON.stringify(c),headers:{"Content-Type":"application/json"},method:"POST"});if(!b.ok){let y=await ee(b);throw Error(sr(y)??"The site could not be previewed.")}return await ee(b)},async setPreviewOverlay(c,b){await fetch("/__studio/preview/overlay",{body:JSON.stringify({contents:b,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,b){let y=await fetch(l("add-remote"),{body:JSON.stringify({name:c,url:b}),headers:{"Content-Type":"application/json"},method:"POST"});if(!y.ok){let w=await ee(y);throw Error(ka(w))}},async cfApi(c,b){let{getCfToken:y}=await (le("h2wrh6hq"),import("./chunks/cf-settings-h2wrh6hq.js")),w=y();if(!w)throw Error("No Cloudflare API token configured");let k=await fetch("/__studio/cf/proxy",{method:"POST",headers:{"Content-Type":"application/json","X-CF-Token":w},body:JSON.stringify({path:c,method:b?.method??"GET",body:b?.body})}),E=await ee(k);if(!k.ok||E.success===!1){let A=E.errors?.map((j)=>j.message).join("; ")??E.error??k.statusText;throw Error(`Cloudflare API: ${A}`)}return E.result??E},async cfConnection(){let{getCfAccountId:c,getCfToken:b,setCfAccountId:y}=await (le("h2wrh6hq"),import("./chunks/cf-settings-h2wrh6hq.js"));if(!b())return null;try{let w=await this.cfApi("/accounts");if(!Array.isArray(w)||w.length===0)return{connected:!1};let k=w,E=k.find((A)=>A.id===c())??k[0];return y(E.id),{connected:!0,accountId:E.id,accountName:E.name}}catch{return{connected:!1}}},async listProjects(){let c=await fetch("/__studio/sites");if(!c.ok)return[];return(await ee(c)).map((y)=>({name:y.config?.name||y.path.split("/").at(-1)||y.path,root:y.path,description:y.path}))},aiChatUrl(){return"/__studio/ai/chat"}}}var B6=new Set(["views:","file:"]);function V6(){let e=typeof document>"u"?void 0:document,t=`meta[name="${av.name}"][content="${av.content}"]`;return{cloud:globalThis.__jxCloud!=null,declared:e?.querySelector(t)!=null,launcher:Tv(),protocol:typeof location>"u"?"":location.protocol}}function W6(e=V6()){if(e.launcher)return{kind:"launcher",launcher:e.launcher.launcher};if(e.cloud)return null;if(e.declared)return{kind:"declared"};if(B6.has(e.protocol))return{kind:"scheme",protocol:e.protocol};return null}function q6(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 uu extends Error{refusal;constructor(e){super(q6(e));this.name="PlatformUnavailableError",this.refusal=e}}function I1(){let e=W6();if(e)throw new uu(e);let t=globalThis.__jxCloud;return t?E1(t.project):A1()}function U6(e){return S(e)&&"getFrame"in e&&te(e.getFrame)}function J6(){let e=globalThis.__jxPlatform;if(e==null||!("windowControls"in e))return;let t=e.windowControls;return U6(t)?t:void 0}var G6=["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],L1=400,O1=300,M1=!1;function D1(){let e=J6();if(!e||M1)return;M1=!0;let t=document.createElement("div");t.id="resize-edges";for(let r of G6){let o=document.createElement("div");o.className=`resize-edge ${r}`,o.addEventListener("mousedown",(a)=>K6(a,r,e)),t.append(o)}document.body.append(t)}async function K6(e,t,r){e.preventDefault(),e.stopPropagation();let{screenX:o,screenY:a}=e,s={...await r.getFrame()};function l(f){let c=f.screenX-o,b=f.screenY-a,{x:y,y:w,width:k,height:E}=s;if(t.includes("right"))k=Math.max(L1,k+c);if(t.includes("left")){let A=Math.max(L1,k-c);y+=k-A,k=A}if(t.includes("bottom"))E=Math.max(O1,E+b);if(t.includes("top")){let A=Math.max(O1,E-b);w+=E-A,E=A}r.setFrame(y,w,k,E)}function d(){document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",d)}document.addEventListener("mousemove",l),document.addEventListener("mouseup",d)}var lv={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 F1=["caret","canvas","global"],_1=new Set(["pane.backToHome"]);var X6="input, textarea, select, [contenteditable=true]";function Q6(e=document){let t=e.activeElement;return t instanceof HTMLElement&&t.matches(X6)}function Z6(e){let t=(r)=>te(e?.[r]);return{dataRows:t("dataRows"),findReferences:t("findReferences"),gitClone:t("gitClone"),importSite:t("importSite"),openProjectInNewWindow:t("openProjectInNewWindow"),readFileBytes:t("readFileBytes"),publish:t("cfApi"),windowControls:t("newWindow")}}function H1(e){return()=>{let t=ov(),r=u.value??null,o=x,a=e.canvasMode();t.project.open=o!==null,t.project.isSite=o?.isSiteProject===!0,t.project.isRepo=h.git.status?.isRepo===!0,t.project.isMultilingual=(Qt(o?.projectConfig??{}).i18n?.locales.length??0)>1,t.git.ahead=h.git.status?.ahead??0,t.git.behind=h.git.status?.behind??0,t.git.dirtyCount=h.git.status?.files.length??0,t.workspace.id=h.workspace,t.document.open=r!==null,t.document.dirty=r?r.doc.dirty===!0||CC(r.id):!1,t.document.mode=r?.doc.mode??"",t.document.canUndo=r?vO(r):!1,t.document.canRedo=r?yO(r):!1,t.editor.kind=r?Qs(a):"none",t.canvas.view=iO(a),t.pane.count=m.panes.length,t.pane.derived=m.panes.some((l)=>l.derived!==null);let i=r?.session.selection??[],s=Me(i);if(s){let l=oe(r.doc.document,s),d=l?.tagName;t.selection.count=i.length,t.selection.paths=i.map((f)=>[...f]),t.selection.kind=n(d)?d:"",t.selection.isRoot=i.some((f)=>f.length<2),t.selection.isComponentInstance=Ae.some((f)=>f.tagName===d),t.selection.isRepeater=l?.$prototype==="Array"}if(t.selection.isLayoutNode=h.layoutSelection!==null,t.caret.active=e.isCaretActive()||Q6(),t.caret.inCanvas=e.isCaretActive(),t.focus.region=h.focusRegion,t.modal.open=e.isModalOpen(),r){let l=Ln(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=Z6(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}"}]}}]}]}}]}]};T("rail",z1);var B1=null,V1=null,cv=null,t5=null;function n5(e){return!h.docks.left.collapsed&&h.leftTab===e.id}function r5(e){cA(nC(e.id,"the Navigator rail"))}function o5(){let e=Yu();return QT(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:n5(o),title:o.title}))}))}function W1(){return V1??=g({groups:[],toggle:(e)=>{let t=QT(Yu()).flatMap((r)=>r.panels).find((r)=>r.id===e);if(t)r5(t)}}),V1}function a5(){W1().groups=o5(),i5()}function i5(){if(cv||!HC)return;cv=R("rail",W1(),HC),cv.then((e)=>{t5=e})}function q1(){Vi(),B1=ge(),B1.run(()=>{ne(()=>{let{error:e,loading:t,status:r}=h.git;if(!r&&!t&&!e)Vs();a5()})})}function s5(e){return((e.state.user.name??e.state.user.login)[0]??"?").toUpperCase()}function l5(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 dv={connecting:"Connecting…",detached:"Solo",failed:"Not connected",offline:"Offline — changes sync on reconnect",synced:"Live",unavailable:""};function c5(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`${dv[e]}. Undo only takes back your own edits, never a collaborator's.`;return dv[e]}function U1(e){if(!e)return null;let t=Ln(e);if(t.status==="unavailable")return null;return{frozen:t.sourceCanonical,label:dv[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:s5(r),key:r.clientId,title:l5(r,e.documentPath)})),readOnly:t.readOnly,status:t.status,title:c5(t.status,t.attachError)}}var hv="settings/menu",So=null,pv=null,mu=null,d5=new Map([["app.preferences",()=>mn.map((e)=>({dividerAbove:!1,key:e.id,label:e.title}))],["settings.open",()=>Hy().flatMap((e,t)=>e.sections.map((r,o)=>({dividerAbove:t>0&&o===0,key:r.key,label:r.label})))]]);function p5(e){return d5.get(e)?.()??[]}function J1(e,t){let r=ae();if(!r)return;Tn(r,e,t,"Settings")}function G1(e){let t=[...e.forPlacement(hv)].toSorted((o,a)=>xb.indexOf(o.level)-xb.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),d=l&&l.toLowerCase()!==o.title.toLowerCase()?l:void 0,f=s?void 0:e.disabledReason(o.id),{id:c}=o,b={children:s?p5(c).map((y)=>({destructive:!1,disabled:!1,dividerAbove:y.dividerAbove,id:`${c}:${y.key}`,run:()=>J1(c,{section:y.key}),title:y.label})):[],destructive:o.destructive===!0,disabled:!s,dividerAbove:i,id:c,run:()=>J1(c),submenuLabel:`Sections of ${o.title}`,title:o.title};if(d)b.chord=d;if(f)b.requires=f;return b})}function gv(){return So!==null}function bv(){So?.close()}function K1(e,t={}){if(So){bv();return}let r=ae();if(!r)return;let o=G1(r);if(o.length===0)return;mu=t.rerender??null;let a=Xt({label:"Settings",onClosed:(i)=>{if(So!==i)return;So=null,pv?.(),pv=null;let s=mu;mu=null,s?.()},opener:e,place:(i)=>{let s=ze(e);return{x:Math.max(4,s.right-i.width),y:s.bottom+4}},placement:"block-end span-inline-start",region:"settings",rows:o});So=a,pv=E_(()=>{let i=ae();if(!i||So!==a)return;a.setRows(G1(i))}),mu?.()}var Y1={$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"]}]}}]}}}]};T("commandbar",Y1);var m5=null;function f5(){return m5??navigator.platform.startsWith("Mac")}var X1={frozen:!1,label:"",peers:[],readOnly:!1,status:"unavailable",title:""},h5=[{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}],g5="publish.quick",b5={document:"files",project:"projects",selection:"nodes"},yv=null,hu=null,Ms=null,gu=null,fu=null,ar=null;function vv(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 y5(e){let t=e?.documentPath?.replace(/^\.\//,"");if(!t)return{reason:"Open a page to view it in a browser."};if(!x?.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=Zu(t);if(r.includes("*"))return{reason:"Catch-all routes match many pages — open a generated one instead."};let o=Fc(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((d)=>`:${d}`).join(", ")} to open one of this route's pages.`};r=r.replaceAll(/:(\w+)/g,(l,d)=>encodeURIComponent(i[d]))}let a=x.projectConfig?.build?.trailingSlash??"always";return{path:r==="/"?"/":a==="always"?`${r}/`:r}}async function Q1(){let e=y5(u.value??null);if(!("path"in e)){C.warn(e.reason,{key:ot,source:"Preview"});return}let t=_e()?p():null;if(!t?.previewSite&&!t?.buildSite){C.warn("This backend cannot preview the site.",{key:ot,source:"Preview"});return}if(t.previewSite){await v5(t.previewSite,e.path);return}await w5(t.buildSite,e.path)}async function v5(e,t){nN(),await _S(),C.info("Opening a live preview…",{key:ot,source:"Preview"});let r;try{r=await e({route:t})}catch(o){C.error(`The site could not be previewed: ${wv(o)}`,{key:ot,source:"Preview"});return}if(!r.url){C.warn("This backend serves no preview of the site.",{key:ot,source:"Preview"});return}if(r.reused){C.info(`Updated your preview tab — switch to your browser to see ${t}`,{key:ot,source:"Preview"});return}if(r.errors.length>0)C.warn(`Previewed with ${r.errors.length} problem(s): ${r.errors[0]}`,{key:ot,source:"Preview"});else C.success(`Opened a live preview of ${r.routes} page(s) — rendered from your working tree, not a build.`,{key:ot,source:"Preview"});_b(`${r.url}${t}`)}async function w5(e,t){C.info("Building the site…",{key:ot,source:"Preview"});let r;try{r=await e()}catch(a){C.error(`The site could not be built: ${wv(a)}`,{key:ot,source:"Preview"});return}if(!r.url){C.warn("The site was built, but this backend serves no preview of it.",{key:ot,source:"Preview"});return}let o=r.mode==="live";if(r.errors.length>0){let a=o?"previewed":"built";C.warn(`The site ${a} with ${r.errors.length} error(s): ${r.errors[0]}`,{key:ot,source:"Preview"})}else if(o)C.success(`Opened a live preview of ${r.routes} page(s) — rendered from your working tree, not a build.`,{key:ot,source:"Preview"});else C.success(`Built ${r.routes} page(s).`,{key:ot,source:"Preview"});_b(`${r.url}${t}`)}async function Z1(){let e=_e()?p():null;if(!e?.buildSite){C.warn("This backend cannot build the site.",{key:Os,source:"Build"});return}C.info("Building the site…",{key:Os,source:"Build"});let t;try{t=await e.buildSite()}catch(r){C.error(`The site could not be built: ${wv(r)}`,{key:Os,source:"Build"});return}if(t.errors.length>0){C.warn(`Built with ${t.errors.length} error(s): ${t.errors[0]}`,{key:Os,source:"Build"});return}C.success(`Built ${t.routes} page(s), ${t.files} file(s).`,{key:Os,source:"Build"})}var Os="project.buildSite",ot="view.openInBrowser";function wv(e){return e instanceof Error?e.message:String(e)}function x5(e){let t=e?.documentPath;if(!t)return"No document";let r=x?.projectRoot,o=t.replace(/^\.\//,"");return r&&o.startsWith(`${r}/`)?o.slice(r.length+1):o}function k5(e){if(h.layoutSelection)return"layout";let t=Vf(e);if(t)return t.replaceAll(" "," › ");let r=e?.session.selection??[],o=Me(r);if(!e||!o)return"";if(r.length>1)return`${r.length} elements`;return Ir(oe(e.doc.document,o))}function xv(){let e=globalThis.__jxPlatform;if(e==null||!("windowControls"in e))return;return e.windowControls}function $5(e){let t=[{key:"project",label:x?.name??"No project",sepBefore:!1,title:"Switch project — opens Project: Open Recent…"},{key:"document",label:x5(e),sepBefore:!0,title:"Go to a file"}],r=k5(e);if(r)t.push({key:"selection",label:r,sepBefore:!0,title:"Go to an element in this document"});return t}function S5(e){if(!e?.get("view.setWorkspace")||!e.isEnabled("view.setWorkspace"))return[];let t=h.git.status?.files.length??0;return tv.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 C5(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:vv(e,t.id)}))}function T5(e){if(!e)return[];return h5.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:!h.docks[t.dock].collapsed,title:r.title,tooltip:vv(e,t.id)}]})}function tL(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),d={destructive:r.destructive===!0,disabled:!i,dividerAbove:a,id:r.id,title:r.title};if(s)d.chord=s;if(l)d.requires=l;return d})}function P5(e){if(ar){ar.close();return}let t=ae();if(!t)return;let r=$v();ar=Xt({label:"Studio menu",onClosed:(a)=>{if(ar!==a)return;ar=null,r.menuOpen=!1},opener:e,place:()=>{let a=ze(e);return{x:a.left,y:a.bottom+4}},region:"studio",rows:tL(t),run:(a)=>{if(t.isEnabled(a))Tn(t,a,void 0,"Command Bar")}}),r.menuOpen=!0}function $v(){return Ms??=g({chord:"",csd:"none",docks:[],hasChord:!1,menuOpen:!1,menuVisible:!1,openPicker:()=>{Fg("picker")},openSegment:(e)=>{Fg(b5[e])},openSettings:(e)=>{if(!(e instanceof HTMLElement))return;K1(e,{rerender:()=>{if(Ms)Ms.settingsOpen=gv()}})},openStudioMenu:P5,presence:X1,presenceVisible:!1,primary:[],run:(e)=>{let t=ae();if(t?.isEnabled(e))Tn(t,e,void 0,"Command Bar")},segments:[],setWorkspace:(e)=>{rt("view.setWorkspace",{workspace:e},"Command Bar")},settingsOpen:!1,settingsVisible:!1,windowControl:(e)=>{xv()?.[e]()},quickDisabled:!0,quickTooltip:"",quickVisible:!1,workspace:"",workspaces:[],workspacesVisible:!1}),Ms}function rL(){let e=$v(),t=ae(),r=u.value??null,o=xv();e.csd=o?f5()?"mac":"other":"none",e.menuVisible=t!==null,e.workspaces=S5(t),e.workspacesVisible=e.workspaces.length>0,e.workspace=h.workspace;let a=g5;e.quickVisible=e.workspacesVisible&&t?.get(a)!==void 0&&t.isVisible(a),e.quickDisabled=!e.quickVisible||!t?.isEnabled(a),e.quickTooltip=t&&e.quickVisible?vv(t,a):"",e.settingsVisible=t!==null&&t.forPlacement(hv).length>0,e.settingsOpen=gv(),e.segments=$5(r),e.chord=t?.keymap.formatBinding("palette.open")??"",e.hasChord=e.chord!=="",e.primary=C5(t);let i=U1(r);if(e.presence=i??X1,e.presenceVisible=i!==null,e.docks=T5(t),ar&&t)ar.setRows(tL(t))}function sL(e,t={}){if(E5(),yv=e,xv())e.classList.add("app-region-drag");hu=ge(),hu.run(()=>{ne(()=>{h.docks.left.collapsed,h.docks.right.collapsed,h.docks.bottom.collapsed,h.git.status,h.layoutSelection,h.stylebook.selection,h.workspace,m.projectRoot,ae();let r=u.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{rL()}catch(o){console.error("command bar projection error:",o)}})}),gu=R("commandbar",$v(),e),gu.then((r)=>{fu=r})}function E5(){ar?.close(),bv(),hu?.stop(),hu=null;let e=gu;if(gu=null,fu)fu.dispose(),fu=null;else if(e)e.then((t)=>t.dispose());Ms=null,yv=null}function Pv(){if(yv)rL()}var j5="jx.ai.pendingAgentPrompt",R5=900000;function bu(){return typeof localStorage>"u"?void 0:localStorage}function yu(e){return`${j5}:${e}`}function mL(e){try{let t=bu()?.getItem(yu(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)||!Z(a)||!(Date.now()-a<=R5))return bu()?.removeItem(yu(e)),null;return{prompt:o,ts:a}}catch{return null}}function gL(e,t){try{bu()?.setItem(yu(e),JSON.stringify({prompt:t,ts:Date.now()}))}catch{}}function bL(e){return mL(e)!==null}function yL(e){let t=mL(e);if(!t)return null;try{bu()?.removeItem(yu(e))}catch{}return t.prompt}var A5="inspector.assistant",RL=null,pr=null,Ev=null,Nv=!1;function I5(){if(Nv||!pr)return;Nv=!0,u1(pr)}function OL(e){if(!e||RL===e&&pr)return;RL=e,pr=document.createElement("div"),pr.className="ai-panel-host",pr.setAttribute(qe,A5),e.textContent="",e.append(pr),m1(),Nv=!1,Ev?.stop(),Ev=ge(),Ev.run(()=>{ne(()=>{if(Nl()==="assistant")I5()}),ne(()=>{let t=m.projectRoot;if(!t||!bL(t))return;xo();let r=yL(t);if(r)requestAnimationFrame(()=>{Xy(r)})})})}function DL(){if(pr)Fe()}var O5="platform:connection",ur=null;function HL(){let e=p().subscribeConnection;if(!e)return null;let t=e(({online:r,reason:o})=>{if(r){if(ur)Lh(ur.id),ur=null,C.success("Reconnected to the Jx backend.",{source:"Backend"});return}if(ur)return;ur=C.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:O5,source:"Backend"})});return()=>{if(t(),ur)Lh(ur.id),ur=null}}var VL={$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"}}]}}]};T("navigator-dock",VL);function D5(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function F5(e){let t=e?.$map,r=v(t)?t.item:void 0;return v(r)?r:null}function qL(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,d,f)=>{if(!(s instanceof HTMLElement)||D5(d)!=="content")return;let c=F5(f)?.key;if(n(c))r.onContent(c,s)}}).then((s)=>{if(i){s.dispose();return}a=s}),{dispose(){i=!0,a?.dispose(),a=null},update:(s)=>{o.panels=s.panels}}}var eO=null,UL=null,jv=null,ua=null;function tO(e){eO=e,Vi(),jv=qL(Xp(Ch,"left-panel"),{panels:[pO()]},{onContent:(t,r)=>{let o=ua!==null&&ua.panelId!==t;if(ua={host:r,panelId:t},o)requestAnimationFrame(()=>{if(ua?.host===r)Xp(Ch,"left-panel").scrollTop=0});queueMicrotask(()=>{if(ua?.host===r)uO()})}}),UL=ge(),UL.run(()=>{ne(()=>{h.leftTab;let t=u.value;if(t)t.doc.document,t.doc.mode,t.session.ui.canvasMode,t.session.selection.map((r)=>r.join("/")).join("|");Ds()})})}function Ds(){if(!jv)return;jv.update({panels:[pO()]}),uO()}function nO(){let e=Cp(h.leftTab);return e&&Pw(e,Yu())?e:null}function pO(){let e=nO();if(!e)return{hasHeader:!1,key:h.leftTab,level:"",region:"",title:""};return{hasHeader:!0,key:e.id,level:e.level,region:jA(e.id),title:e.title}}function _5(){let e=u.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 uO(){let e=eO,t=ua;if(!e||!t)return;let r=nO();if((r?.id??h.leftTab)!==t.panelId)return;try{ZL(e,r,t.host)}catch(o){console.error("left-panel render error:",o);try{t.host.textContent="",delete t.host._$litPart$,ZL(e,r,t.host)}catch(a){console.error("left-panel retry failed:",a)}}}function ZL(e,t,r){if(!t){io(Mu(r,{message:`No Navigator panel is registered as "${h.leftTab}".`}),r);return}let o=_5(),a={deps:e,doc:o,rerender:Ds},i=o===null?t.requiresDocument:void 0;if(io(i===void 0?t.render(a):Mu(r,{actions:[Rc()],message:i}),r),i===void 0)t.afterRender?.(a,r)}function Lv(e,t,r,o){let a=NN(e,o,r);return{drop:{cursor:a,dragSeq:t,kind:"drop"},move:{cursor:a,dragSeq:t,kind:"dragMove"}}}function Rv(e){return{x:e.current.input.clientX,y:e.current.input.clientY}}function Av(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 xO(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 kO=250;function Iv(e,t,r){let o=Rb(e,t,r);return{host:e,label:xO(NL(e),t,r),seq:o,src:t,srcData:r}}function fO(e,t){GS(t.x,t.y);let r=Ib(t);if(r===e.host){if(r){let{rect:i,scale:s}=ql(r);Bc(r,Lv(t,e.seq,s,i).move)}return}if(e.host)Bc(e.host,{dragSeq:e.seq,kind:"dragEnd"});if(!r){e.host=null;return}e.host=r,e.seq=Rb(r,e.src,e.srcData);let{rect:o,scale:a}=ql(r);Bc(r,Lv(t,e.seq,a,o).move)}function z5(e,t){let r=Ib(t);if(r&&r!==e.host){if(e.host)Bc(e.host,{dragSeq:e.seq,kind:"dragEnd"});e.host=r,e.seq=Rb(r,e.src,e.srcData)}if(!r){if(e.host)Bc(e.host,{dragSeq:e.seq,kind:"dragEnd"});qw(e.seq),oh();return}let{rect:o,scale:a}=ql(r);Bc(r,Lv(t,e.seq,a,o).drop);let{seq:i}=e;setTimeout(()=>{if(JS()===i)oh(),Gw(r)},kO)}function B5(e){if(e.host)Bc(e.host,{dragSeq:e.seq,kind:"dragEnd"}),Gw(e.host);qw(e.seq),oh()}function V5(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 $O(){let e=null,t=null;return xL((r)=>{if(!t||e?.host===r)return;if(e){if(e.host)Bc(e.host,{dragSeq:e.seq,kind:"dragEnd"});e.host=r,e.seq=Rb(r,e.src,e.srcData);return}e=Iv(r,t.src,t.srcData)}),Ks({onDrag({source:r,location:o}){let a=Av(r.data);if(!a)return;let i=Rv(o);if(e){fO(e,i);return}let s=Ib(i);if(s)e=Iv(s,a,r.data),hL(e.label,i.x,i.y),fO(e,i)},onDragStart({source:r,location:o}){let a=Av(r.data);if(!a)return;t={src:a,srcData:r.data};let i=Rv(o),s=Ib(i);e=s?Iv(s,a,r.data):null,hL(e?e.label:xO(u.value,a,r.data),i.x,i.y)},onDrop({source:r,location:o}){if(!Av(r.data))return;t=null;let i=Rv(o);if(!e){oh();return}if(pL(e.seq)){let{host:s,seq:l}=e;e=null,setTimeout(()=>{if(JS()!==l)return;if(s)Bc(s,{dragSeq:l,kind:"dragEnd"}),Gw(s);qw(l),oh()},kO);return}if(V5(o))B5(e);else z5(e,i);e=null}})}var SO={$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 →"}}}]}}}]}]};T("new-project",SO);function CO(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 q5(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function TO(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[c,b]of i){let w=(c==="creds-island"?e.islands.creds:c==="managed-island"?e.islands.managed:e.islands.model)();if(w&&w.parentNode!==b)b.append(w)}},l=g({...CO(e.view),...e.actions,browse:()=>{e.actions.browse()},closed:o}),d=null,f=R("new-project",l,t,{onNodeCreated:(c,b,y)=>{let w=q5(y);if(c instanceof HTMLElement&&w.endsWith("-island"))i.set(w,c),s()}}).then(async(c)=>{d=c;let b=c.root;if(a())return c.dispose(),b;if(await Jt(b),a())return b;return(b.querySelector('dialog[part="dialog"]')??b).setAttribute(qe,ft("dialog","new-project")),Pt(b),s(),b});return{close(){let c=d?.root;if(c instanceof HTMLElement)Nt(c);d?.dispose(),d=null,i.clear(),t.remove(),o()},focusName(){let c=d?.root;if(!(c instanceof HTMLElement))return;requestAnimationFrame(()=>{c.querySelector('[part="dialog"]')?.scrollTo(0,0),c.querySelector('[part="name"] [part="input"]')?.focus()})},host:t,ready:f,update(c){Object.assign(l,CO(c)),s()}}}var U5=/^(?:[a-zA-Z]:[/\\]|\/)/,fa="",bn="",wu=!0,vu=[],Ov=null,$t="",ma=!1;function EO(){fa="",bn="",wu=!0,vu=[],Ov=null,$t="",ma=!1}function NO(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)=>{Ov=o;for(let a of o)r.add(a.owner)})]).then(()=>{vu=[...r].toSorted((o,a)=>o.localeCompare(a)),bn||=vu[0]??"",e()})}function J5(){return p().createDestination==="repo"?"Repository":"Directory"}function jO(e){if($t="",p().createDestination==="repo"){if(!bn.trim())return $t="Choose an owner for the repository",null;if(!e.trim())return $t="Repository name is required",null;return{kind:"repo",owner:bn.trim(),private:wu,repo:e.trim()}}let t=fa.trim();if(!t)return $t="Choose a location for the project folder",null;if(!U5.test(t))return $t="Location must be an absolute path",null;if(!e.trim())return $t="Directory name is required",null;return{kind:"path",parent:AO(t)}}function AO(e){return e.replace(/[/\\]+$/,"")||e}function LO(e,t){let r=e.includes("\\")&&!e.includes("/")?"\\":"/";return e.endsWith("/")||e.endsWith("\\")?`${e}${t}`:`${e}${r}${t}`}function DO(e,t){if(e.kind==="repo")return`${e.owner}/${e.repo||t.trim()}`;return LO(e.parent,t.trim())}function G5(e){let t=e.trim()||"…";if(p().createDestination==="repo")return`${bn.trim()||"…"}/${t}`;let r=AO(fa.trim());return r?LO(r,t):`…/${t}`}function K5(e){let t=`${bn.trim()}/${e.trim()}`.toLowerCase();return(Ov??[]).some((r)=>r.fullName.toLowerCase()===t)}function _O(e){let t=p(),r=t.createDestination==="repo";return{browseLabel:ma?"Choosing…":"Browse…",browsing:ma,canBrowse:te(t.pickDirectory),destination:r?"repo":"path",error:$t,owner:bn,owners:vu.map((o)=>({label:o,value:o})),parent:fa,parentPlaceholder:t.pickDirectory?"Choose a folder to create the project in":"/absolute/path/to/your/projects",preview:G5(e),previewLabel:r?"Repository":"Creates",repoTaken:r&&K5(e)?`${bn}/${e.trim()} already exists — choose another name.`:"",slugLabel:J5(),visibility:wu?"private":"public"}}function VO(e){fa=e,$t=""}function qO(e){bn=e,$t=""}function JO(e){wu=e!=="public"}async function GO(e){let t=p();if(!t.pickDirectory||ma)return;ma=!0,e();try{let r=await t.pickDirectory();if(r)fa=r,$t=""}catch(r){$t=Q(r)||"The folder could not be chosen. Type its path into Location instead."}finally{ma=!1,e()}}var ha="",Su=1,Cu=20,yn="limit",ju=3,Fu="",Fs="nearest",_u=!0,xu="",Hu="",zu=!1,Bu=25,ga="",XO=!1;function QO(){ha="",Su=1,Cu=20,yn="limit",ju=3,Fu="",Fs="nearest",_u=!0,xu="",Hu="",zu=!1,Bu=25,ga="",XO=!1}var ZO=null,YO=null;function Y5(){return YO??=nu({getModel:()=>xu||Yl(),onChange:(e)=>{xu=e},requestRender:()=>ZO?.(),width:"fill"}),YO}function eM(){return Y5().render()}function X5(){if(yn==="all")return{mode:"all"};if(yn==="explicit"){let e=Fu.split(",").map((t)=>Math.trunc(Number(t.trim()))).filter((t)=>Number.isFinite(t)&&t>0);if(e.length>0)return{mode:"explicit",rounding:Fs,widths:e}}return{count:ju,mode:"limit",rounding:Fs}}function tM(){return p().createDestination!=="repo"}function Q5(e){return e.toLowerCase().replaceAll(/[^a-z0-9]+/g,"-").replaceAll(/^-|-$/g,"")}function rM(e){let t=null;try{t=new URL(ha.trim())}catch{t=null}if(!t||t.protocol!=="http:"&&t.protocol!=="https:")return ga="Enter a valid URL (e.g. https://example.com)",e.rerender(),!1;return ga="",!0}function Z5(e){let t;try{t=new URL(ha.trim())}catch{return ga="Enter a valid URL (e.g. https://example.com)",e.rerender(),null}if(t.protocol!=="http:"&&t.protocol!=="https:")return ga="The URL must start with http:// or https://",e.rerender(),null;let r=e.resolveDestination();if(!r)return null;return{aiComponents:_u,breakpoints:X5(),depth:Su,directory:DO(r,e.form.directory),maxPages:Cu,model:xu,name:e.form.name.trim(),prompt:Hu.trim(),minFidelity:Bu,url:t.href,verify:tM()&&zu}}function aM(e){if(!p().importSite)return;let t=Z5(e);if(!t)return;oN(t),e.onHandoff(t)}function sM(){return"Import Site"}function eK(){if(yn==="all")return"Every breakpoint the site declares becomes a canvas size. Real sites often declare nine.";if(yn==="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 lM(e){return ZO=e.rerender,{aiNaming:_u,breakpointCount:String(ju),breakpointHint:eK(),breakpointMode:yn,breakpointModes:[{label:"Limit to",value:"limit"},{label:"Custom widths",value:"explicit"},{label:"Keep all",value:"all"}],breakpointRounding:Fs,breakpointValue:yn==="limit"?"count":yn==="explicit"?"widths":"none",breakpointWidths:Fu,canVerify:tM(),depth:String(Su),error:ga,maxBreakpoints:String(d$),maxDepth:String(md),maxPages:String(Cu),minFidelity:String(Bu),prompt:Hu,roundings:[{label:"nearest",value:"nearest"},{label:"round down",value:"down"},{label:"round up",value:"up"}],url:ha,verify:zu}}function cM(e,t){if(ha=t,e.form.name.trim())return;try{let r=new URL(ha).hostname.replace(/^www\./,"");if(r){if(e.form.name=r,!XO)e.form.directory=Q5(r)}}catch{}}function dM(e){Su=Math.trunc(Number(e))||0}function pM(e){Cu=Math.trunc(Number(e))||1}function uM(e){yn=e}function mM(e){ju=Math.trunc(Number(e))||3}function fM(e){Fu=e}function hM(e){Fs=e}function gM(e){_u=e}function bM(e){zu=e}function yM(e){let t=Math.trunc(Number(e));Bu=Number.isNaN(t)?0:Math.min(100,Math.max(0,t))}function vM(e){Hu=e}var mr=null,Je={directory:"",name:""},at="starter",vn="source",en="",Mv=!1,_s="",kn="",Co="",_v="";function tK(e){kn=Q(e),_v=yA(e)??""}var fr=!1,qu=[],Dv=null,Uu=!0,wM=null;function ba(){if(mr)Re()}function nK(){return wM??=bd({onSaved:ba,requestRender:ba}),wM}var xM=null;function Hv(){return xM??=yd({requestRender:ba}),xM}function kM(){if(zb())return!0;return Hv().ensureProbe(),!1}function zv(e){if(mr)return Promise.resolve(null);Je={directory:"",name:""},at=e?.tab??"starter",vn="source",en="",Mv=!1,_s="",kn="",Co="",_v="",fr=!1,qu=[],Uu=!0,QO(),EO();let t=p();if(NO(ba),t.listStarters)t.listStarters().then((r)=>{if(qu=r,!Mv)en=r[0]?.id??"";ba()}).catch(()=>{});return new Promise((r)=>{Dv=r,mr=TO({actions:{browse:()=>{GO(ba)},closed:()=>{CM(null)},confirm:sK,pickCard:iK,pickTab:(o)=>{if(fr)return;at=o,kn="",Re()},secondary:cK,setAgentPrompt:(o)=>{_s=o},setAiNaming:gM,setBreakpointCount:mM,setBreakpointMode:(o)=>{uM(o),Re()},setBreakpointRounding:hM,setBreakpointWidths:fM,setDepth:dM,setImportPrompt:vM,setMaxPages:pM,setMinFidelity:yM,setName:oK,setOwner:(o)=>{qO(o),Re()},setParent:(o)=>{VO(o),Re()},setSlug:aK,setUrl:(o)=>{cM(Ju(),o),Re()},setVerify:(o)=>{bM(o),Re()},setVisibility:(o)=>{JO(o),Re()}},islands:{creds:()=>nK().render(),managed:()=>Hv().render(),model:()=>eM()},layer:tt("dialog"),view:jM()})})}function Re(){mr?.update(jM())}function CM(e){let t=mr,r=Dv;mr=null,Dv=null,fr=!1,r?.(e),t?.close()}function TM(e){CM(e)}async function $M(e){let{adopted:t,error:r,openedElsewhere:o}=await ro(e.root,{getTab:()=>null});if(!t&&!o)C.warn("Created the project, but could not open it here.",r===null?{source:"New Project"}:{detail:r,source:"New Project"});TM(e)}function PM(e){return e.toLowerCase().replaceAll(/[^a-z0-9]+/g,"-").replaceAll(/^-|-$/g,"")}function rK(){switch(at){case"import":return"Import";case"agent":return"Agent";default:return en?`Starter site · ${qu.find((e)=>e.id===en)?.name??en}`:"Start from scratch"}}function Ju(){return{form:Je,onHandoff:(e)=>{TM(null),dN(e)},rerender:Re,resolveDestination:()=>EM()}}function EM(){if(!Je.name.trim())return Co="Project name is required",Re(),mr?.focusName(),null;if(!Je.directory.trim())Je.directory=PM(Je.name);let e=jO(Je.directory);if(!e)return Co="",Re(),mr?.focusName(),null;return e}function oK(e){if(Je.name=e,Co="",!Je.directory)Uu=!0;if(Uu)Je.directory=PM(Je.name);Re()}function aK(e){Je.directory=e,Uu=!1,Re()}function iK(e){en=e,Mv=!0,kn="",Re()}function sK(){if(vn==="source"){lK();return}if(at==="import"){aM(Ju());return}if(fr)return;if(at==="agent"){Fv({template:"blank"},async(e)=>{gL(e.root,_s.trim()),await $M(e)});return}Fv(en?{starter:en}:{template:"blank"},$M)}function lK(){if(at==="import"&&!rM(Ju()))return;if(at==="agent"&&!_s.trim()){kn="Describe the site you want the agent to build",Re();return}vn="params",kn="",Re()}function cK(){if(fr)return;vn="source",kn="",Co="",Re()}async function Fv(e,t,r=!1){let o=EM();if(!o)return;fr=!0,kn="",Co="",Re();try{let a=await p().createProject({...Je,destination:o,...e});await t(a)}catch(a){if(fr=!1,tK(a),Re(),!r&&await Em(a))await Fv(e,t,!0)}}function NM(){if(vn==="params")return"params";if(at==="import")return kM()?"import":"gate";if(at==="agent")return kM()?"agent":"gate";return"starter"}function dK(){let e=Hv().canOffer()?"Connect Cloudflare, or add an OpenAI-compatible API key, to continue.":"Add an OpenAI-compatible API key to continue.";return at==="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 pK(){if(vn==="source")return NM()==="gate"?"":"Next";if(at==="import")return sM();if(fr)return"Creating…";return at==="agent"?"Create & Start Agent":"Create Project"}function uK(){let e=qu.map((t)=>({art:"thumb",id:t.id,name:t.name,selected:en===t.id,tagline:t.tagline,thumbnail:t.thumbnail,title:t.description}));return e.push({art:"blank",id:"",name:"Start from scratch",selected:en==="",tagline:"An empty site with one page",thumbnail:"",title:""}),e}function jM(){let e=p(),t=_O(Je.directory),r=lM(Ju());return{agentPrompt:_s,aiNaming:r.aiNaming,body:NM(),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:uK(),confirmLabel:pK(),contextLabel:rK(),depth:r.depth,destination:t.destination,destinationError:t.error,error:kn,errorInstallUrl:_v,gateIntro:dK(),headline:vn==="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:Je.name,nameError:Co,note:at==="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:vn==="params"?"Back":"",showTabs:vn==="source",slug:Je.directory,slugLabel:t.slugLabel,tab:at,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 SM=["starter","import","agent"];function mK(){return[{args:{additionalProperties:!1,properties:{tab:di(SM,"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:Vn("project.new",t,"tab",SM);zv(r===void 0?{}:{tab:r})},title:"New Project…"}]}function RM(e){e.registerAll(mK())}var AM={$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"}]}]}}]}}}]}]}}]}}]};T("seo",AM);function Hs(e){return e.trim()===""?"unset":"text"}function IM(e){return{documentLabel:e.documentLabel,fields:e.fields.map((t)=>({...t,valueState:Hs(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:Hs(e.description),serpDescUnset:e.descriptionUnset,serpTitle:e.title,socialDesc:e.socialDescription,socialDescState:Hs(e.socialDescription),socialDescUnset:e.socialDescriptionUnset,socialDomain:e.domain,socialDomainState:Hs(e.domain),socialImage:e.image,socialImageState:e.image===""?"unset":"image",socialTitle:e.socialTitle,socialTitleState:Hs(e.socialTitle),socialTitleUnset:e.socialTitleUnset,warnings:e.warnings,warningsState:e.warnings.length>0?"list":"none"}}function LM(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({...IM(e.view),browse:(d,f)=>{if(f instanceof HTMLElement)e.onBrowse(d,f)},closed:o,commit:(d,f)=>{e.onCommit(d,f)},edit:(d,f)=>{e.onEdit(d,f)},openDonor:(d)=>{e.onOpenDonor(d)},upload:(d)=>{e.onUpload(d)}}),i=()=>r,s=null,l=R("seo",a,t).then(async(d)=>{s=d;let f=d.root;if(i())return d.dispose(),f;if(await Jt(f),i())return f;return(f.querySelector('dialog[part="dialog"]')??f).setAttribute(qe,ft("dialog","seo")),Pt(f),f});return{close(){let d=s?.root;if(d instanceof HTMLElement)Nt(d);s?.dispose(),s=null,t.remove(),o()},host:t,ready:l,update(d){Object.assign(a,IM(d))}}}function MM(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 Ku(e){return`No ${e.label.toLowerCase()}`}function hK(e){let t=lE(e.value),r=MM(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:Jf(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:Ku(e),value:e.value}}var DM=new Map([...Gy,...Ky].map((e)=>[e.key,e])),FM="icon";function gK(e,t,r){if(e==="viewport")return"width=device-width, initial-scale=1";return r?"/image.jpg":`${t}…`}function Bv(e,t,r,o={}){let a=Boolean(o.media);return{isMedia:a,key:e,label:t,multiline:Boolean(o.multiline),placeholder:gK(e,t,a),thumb:a&&r?Kc(r):"",value:r}}function OM(e,t){let r=DM.get(t);if(!r)return"";return String(Jy(e,r.attr,r.key)?.attributes?.content??"")}function bK(e,t,r){let o=t.trim();if(e===FM){r((i)=>A_(i,"icon",o));return}if(e==="description"){r((i)=>N_(i,o));return}let a=DM.get(e);if(!a)return;r((i)=>Yy(i,a.attr,a.key,o))}var va=new Map;function Vv(e){if(e===void 0){for(let r of va.values())clearTimeout(r);va.clear();return}let t=va.get(e);if(t!==void 0)clearTimeout(t),va.delete(e)}var wa=null,Po=null,Xu=new Map;function Wv(e){let t=e.doc.mode==="content",r=t?O_(e.doc.document,e.doc.content.frontmatter):e.doc.document;return{applyMutation:t?(o)=>dE(e,Bs,o):(o)=>{qd(e,o)},head:r.$head??[],headDoc:r}}function _M(e,t,r){let o=cE(e,t),a=Yg(o,"description"),i=Yg(o,"og:title"),s=Yg(o,"og:description"),l=Yg(o,"og:image").value.trim(),d=String(aE(r,"icon")?.attributes?.href??"");Xu=new Map;for(let f of o.fields){let{onClick:c}=MM(f);if(c)Xu.set(f.key,c)}return{crumb:o.url.crumb,description:a.value,descriptionUnset:Ku(a),documentLabel:e.documentPath??$d(e),domain:o.url.host,fields:o.fields.map(hK),groups:[{key:"page",note:"",rows:[...Gy.map((f)=>Bv(f.key,f.label,f.key==="description"?sE(t):OM(r,f.key),{multiline:f.multiline})),Bv(FM,"Icon",d,{media:!0})],title:"Search result"},{key:"og",note:"Open Graph — what a shared link shows.",rows:Ky.map((f)=>Bv(f.key,f.label,OM(r,f.key),{media:f.media,multiline:f.multiline})),title:"Social card"}],image:l?Kc(l):"",socialDescription:s.value,socialDescriptionUnset:Ku(s),socialTitle:i.value,socialTitleUnset:Ku(i),title:Yg(o,"title").value,warnings:o.warnings}}function Bs(){if(!wa||!Po)return;let{head:e,headDoc:t}=Wv(Po);wa.update(_M(Po,t,e))}function Qu(e,t){if(Vv(e),!Po)return;bK(e,t,Wv(Po).applyMutation),Bs()}function yK(e){bS((t)=>Qu(e,t))}function vK(e,t){gS(t,(r)=>Qu(e,r),{images:!0})}function wK(e){if(Po=e,!wa){let{head:t,headDoc:r}=Wv(e);wa=LM({layer:tt("dialog"),onBrowse:vK,onClosed:xK,onCommit:Qu,onEdit:(o,a)=>{Vv(o),va.set(o,setTimeout(()=>{va.delete(o),Qu(o,a)},jC))},onOpenDonor:(o)=>{Xu.get(o)?.()},onUpload:yK,view:_M(e,r,t)})}Bs(),aD(cE(e,e.doc.document),e.documentPath??void 0)}function xK(){Vv();let e=wa;wa=null,Po=null,Xu=new Map,e?.close()}function kK(){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=u.value;if(!e)throw RangeError('command "document.openSeo" needs an open document');wK(e)},title:"Search Appearance"}]}function HM(e){e.registerAll(kK())}var $K="See docs/framework/concepts/accessibility.";function Ca(e,t){let r=Zc(e),o=t in r?r[t]:e[t];if(o===void 0||o===null)return{kind:"absent"};if(Ie(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 $a(e,t){let r=Ca(e,t);return r.kind==="text"&&r.text.trim()!==""?r.text:null}function Ge(e,t){return Ca(e,t).kind!=="absent"}var Sa="bound";function hr(e){let t=Ca(e,"role");if(t.kind==="bound")return Sa;return t.kind==="text"?t.text.trim().toLowerCase().split(/\s+/)[0]:null}function nm(e){let t=Ca(e,"id");if(t.kind==="bound")return Sa;return t.kind==="text"&&t.text!==""?t.text:null}function Ct(e,t){let r=Ca(e,t);return r.kind==="bound"||r.kind==="text"&&r.text.trim()!==""}function om(e){let t=e.textContent;if(n(t)){if(t.trim()!=="")return!0}else if(t!==void 0&&t!==null)return!0;if(Ct(e,"aria-label")||Ge(e,"aria-labelledby"))return!0;if(To(e)==="img"&&(Ct(e,"alt")||Ct(e,"title")))return!0;if(To(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(S(a)&&om(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)=>_n(a)&&om(a))}var SK=new Set(["button","checkbox","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","switch","tab","treeitem"]),CK=new Set(["combobox","listbox","searchbox","slider","spinbutton","textbox"]),TK=new Set(["button","reset","submit"]),BM=new Map([["menuitem",["menu","menubar"]],["menuitemcheckbox",["menu","menubar"]],["menuitemradio",["menu","menubar"]],["option",["listbox"]],["tab",["tablist"]]]),PK=new Set([...BM.values()].flat());function*xa(e,t=[],r=[],o=[]){yield{node:e,path:t,roles:r,tags:o};let a=[...r,hr(e)],i=[...o,To(e)],{children:s}=e;if(Array.isArray(s)){for(let[l,d]of s.entries())if(S(d))yield*xa(d,[...t,"children",l],a,i)}else if(v(s)&&_n(s.map))yield*xa(s.map,[...t,"children","map"],a,i);if(_n(e.map))yield*xa(e.map,[...t,"map"],a,i);if(v(e.cases)){for(let[l,d]of Object.entries(e.cases))if(S(d))yield*xa(d,[...t,"cases",l],a,i)}}function EK(e){return e.some((t)=>t.includes("-"))}function tn(e,t,r,o,a,i="error"){return{criterion:a,detail:`${o} ${$K}`,message:r,path:t,rule:e,severity:i}}function zM(e,t,r){if(r.includes("label"))return!0;if(e===Sa||t.bound)return!0;return e!==null&&t.ids.has(e)}function NK(e,t){let{node:r,path:o,tags:a}=e,i=To(r),s=hr(r);if(s==="bound")return null;if(Ct(r,"aria-label")||Ge(r,"aria-labelledby")||Ct(r,"title"))return null;let d=$s(r,"the control"),f=(b)=>tn("interactive-unnamed",o,`${d} 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"),c=jK(r,i,t,a);if(c==="named"||c==="exempt")return null;if(s!==null&&SK.has(s))return om(r)?null:f("Give it text content, or an aria-label.");if(s!==null&&CK.has(s))return f("Give it an aria-label, or aria-labelledby naming its visible label.");if(s!==null)return null;if(i==="button"||i==="summary"||i==="a"&&Ge(r,"href"))return om(r)?null:f("Give it text content, or an aria-label.");if(c==="unnamed")return f("Give it a <label for> naming its id, or an aria-label.");if(c==="unnamed-value")return f("Give it a value, or an aria-label.");if(c==="unnamed-alt")return f("Give it an alt, or an aria-label.");return null}function jK(e,t,r,o){if(t==="area"){if(!Ge(e,"href"))return"none";return Ct(e,"alt")?"named":"unnamed-alt"}if(t==="select"||t==="textarea")return zM(nm(e),r,o)||Ct(e,"placeholder")?"named":"unnamed";if(t!=="input")return"none";let a=($a(e,"type")??"text").toLowerCase();if(a==="hidden"||Ge(e,"type")&&$a(e,"type")===null)return"exempt";if(TK.has(a))return Ct(e,"value")?"named":"unnamed-value";if(a==="image")return Ct(e,"alt")?"named":"unnamed-alt";return zM(nm(e),r,o)||Ct(e,"placeholder")?"named":"unnamed"}var RK=new Set(["select","jx-select"]);function AK(e){let{node:t,path:r,tags:o}=e,a=To(t);if(!a.includes("-")||!o.some((i)=>RK.has(i)))return null;return tn("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 IK(e){let{node:t,path:r}=e;if(To(t)!=="img")return null;let o=hr(t);if(o==="bound"||o==="presentation"||o==="none")return null;if(Ge(t,"alt")||Ct(t,"aria-label")||Ge(t,"aria-labelledby"))return null;return tn("img-alt-missing",r,`${$s(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 LK=["aria-activedescendant","aria-controls","aria-describedby","aria-details","aria-errormessage","aria-flowto","aria-labelledby","aria-owns"];function OK(e,t){let{node:r,path:o}=e,a=[];for(let i of LK){let s=$a(r,i);if(s===null)continue;for(let l of s.split(/\s+/))if(l!==""&&!t.has(l))a.push(tn("aria-target-missing",o,`${$s(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 MK(e,t,r){for(let o of BM.get(t)??[]){let a=r.get(o);if(a===void 0)continue;if(a.bound)return!0;if(e===Sa&&a.ids.size>0)return!0;if(e!==null&&e!==Sa&&a.ids.has(e))return!0}return!1}function DK(e,t){let{node:r,path:o,roles:a,tags:i}=e,s=hr(r);if(s===null||s==="bound"||o.length===0||EK(i))return null;if(a.includes("bound")||MK(nm(r),s,t))return null;let l=$s(r,"the element");if(s==="tab"&&!a.includes("tablist"))return tn("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 tn("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 tn("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 FK(e){let t=[];for(let{node:r}of xa(e)){if(hr(r)!=="tab")continue;let o=Ca(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 _K(e){let{node:t,path:r}=e;if(hr(t)!=="tablist")return null;let o=FK(t);if(o===null||o.length===0||o.includes(!0))return null;return tn("tablist-none-selected",r,`${$s(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 HK(e){let{node:t,path:r}=e,o=hr(t);if(!(To(t)==="dialog"||o==="dialog"||o==="alertdialog")||o==="bound")return null;if(Ct(t,"aria-label")||Ge(t,"aria-labelledby"))return null;return tn("dialog-unnamed",r,`${$s(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 zK=new Set(["button","input","select","textarea"]);function BK(e){let{node:t,path:r}=e;if(!Ge(t,"aria-activedescendant"))return null;let o=To(t);if(zK.has(o)||o==="a"&&Ge(t,"href")||Ge(t,"tabIndex")||Ge(t,"tabindex")||Ge(t,"contenteditable"))return null;return tn("activedescendant-not-focusable",r,`${$s(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 VM(e){let t=[...xa(e)],r=new Set,o={bound:!1,ids:new Set},a=new Map,i=!1;for(let{node:l}of t){let d=hr(l);if(d!==null&&PK.has(d)){let c=a.get(d)??{bound:!1,ids:new Set},b=$a(l,"aria-owns");if(b===null)c.bound||=Ge(l,"aria-owns");else for(let y of b.split(/\s+/))if(y!=="")c.ids.add(y);a.set(d,c)}let f=nm(l);if(f===Sa)i=!0;else if(f!==null)r.add(f);if(To(l)==="label"){let c=$a(l,"for")??$a(l,"htmlFor");if(c===null)o.bound||=Ge(l,"for")||Ge(l,"htmlFor");else o.ids.add(c)}}let s=[];for(let l of t){let d=[NK(l,o),IK(l),DK(l,a),AK(l),_K(l),HK(l),BK(l)];for(let f of d)if(f)s.push(f);if(!i)s.push(...OK(l,r))}return s}function VK(e,t){if(t==="img"||t==="area")return!0;return t==="input"&&gr(e,"type")?.toLowerCase()==="image"}var WK=new Set(["input","select","textarea","button"]),qK=new Set(["button","hidden","image","reset","submit"]),UK=new Set(["click here","here","read more","more","learn more","this","link","download","continue"]);function WM(e){return e.attributes??{}}function gr(e,t){let r=WM(e)[t];return n(r)?r:null}function Js(e,t){return t in WM(e)}function Ys(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(S(o))t.push(Ys(o))}return t.join(" ").trim()}function*qv(e){yield e;let{children:t}=e;if(Array.isArray(t)){for(let r of t)if(S(r))yield*qv(r)}for(let r of Object.values(e.cases??{}))if(S(r))yield*qv(r)}function JK(e){return gr(e,"aria-label")!==null||gr(e,"aria-labelledby")!==null||Js(e,"aria-label")||Js(e,"aria-labelledby")||n(e.title)&&e.title!==""||Ys(e)!==""}function GK(e){let t=[],r=new Map,o=0,a=0,i=0;for(let s of qv(e)){i+=1;let l=n(s.tagName)?s.tagName.toLowerCase():"",d=l===""?`element ${i}`:`<${l}>`;if(VK(s,l)){let c=gr(s,"alt");if(c!==null&&/^(image|photo|picture|graphic|icon)\b/i.test(c.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:`${d}'s alt text starts by saying it is an image.`,severity:"warn"})}let f=/^h([1-6])$/.exec(l)?.[1];if(f!==void 0){let c=Number(f);if(c===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&&c>a+1)t.push({criterion:"1.3.1",detail:`An h${a} is followed by an h${c}, 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${c}.`,severity:"warn"});a=c}if(WK.has(l)){let c=gr(s,"type")?.toLowerCase()??"",b=l==="button"||qK.has(c);if(l==="input"&&!b&&!Js(s,"autocomplete")){let y=`${gr(s,"name")??""} ${gr(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:`${d} asks for personal data but names no autocomplete purpose.`,severity:"warn"})}}if(l==="a"){let c=Ys(s).toLowerCase().replaceAll(/[^a-z ]/g,"").trim();if(JK(s)&&UK.has(c))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 "${c}" is a list of identical entries.`,id:`link-vague:${i}`,message:`A link reads "${Ys(s)}", which names no destination.`,severity:"warn"});if(gr(s,"target")==="_blank"&&!/new (tab|window)/i.test(Ys(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(Z(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:`${d} 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")&&Js(s,"autoplay")&&!Js(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:`${d} 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 VM(e))t.push({criterion:s.criterion,detail:s.detail,id:`${s.rule}:${s.path.join("/")}`,message:s.message,severity:s.severity});return KK(t)}function KK(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 Xs(){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 el="Accessibility";function YK(e,t){ul((o)=>o.source===el);let r=GK(e);for(let o of r){let a={detail:`WCAG ${o.criterion} — ${o.detail}`,key:`a11y.${o.id}`,source:el,tier:"problem"};if(o.action!==void 0)a.action=o.action;if(t!==void 0)a.path=t;C(o.severity,o.message,a)}for(let o of Xs())C.info(o.message,{action:"document.checkAccessibility",detail:o.detail,key:`a11y.unavailable.${o.id}`,source:el,tier:"problem"});return r.length+Xs().length}function XK(){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=Xs().length,t=ef(el).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=u.value;if(!e)throw RangeError('command "document.checkAccessibility" needs an open document');let t=YK(e.doc.document,e.documentPath??void 0);C.success(t===Xs().length?"No accessibility problems found in this document.":`${t-Xs().length} accessibility problem(s) filed.`,{key:"a11y.run",source:el})},title:"Check Accessibility",when:(e)=>e.document.open}]}function qM(e){e.registerAll(XK())}function JM(e,t){return Wp(e)&&!Vc[e].tabStrip&&ll(t)!==e}function QK(e,t,r=h.workspace){let o=fn(e);if(!o||!JM(r,t))return[];return o.tabOrder.filter((a)=>{let i=m.tabs.get(a);return a!==t&&i!==void 0&&ll(a)!==r&&Kg(i)===r&&!i.pinned&&!i.doc.dirty})}function ZK(e,t=h.workspace){if(!Wp(t)||Vc[t].tabStrip)return null;let r=Xl(t);return fn(e)?.tabOrder.includes(r)===!0?r:null}function GM(e,t){for(let r of m.panes){if(r.id===t||r.derived)continue;let o=iE(r,e);if(o===r.activeTabId)continue;if(o)Bt(o,{focus:!1});else PC(r.id)}}function e8(){let e=h.workspace,t=m.activePaneId;for(let r of m.panes){let o=r.activeTabId;if(r.id===t||r.derived||!o||Dc(o,e))continue;Jr();try{let a=iE(r,e);if(a)Bt(a,{focus:!1});else PC(r.id)}finally{Yr()}}}function KM(e,t){let o=fn(e)?.tabOrder.find((a)=>m.tabs.get(a)?.documentPath===t);if(o&&!Dc(o))Bt(o)}function t8(){let e=u.value;return e?nE(e):!1}function YM(e){return{...e,writingOnCanvas:t8}}function n8(e,t){if(e==="styles")return t.openStyles(),!0;if(Wp(e))return t.openHome(e),!0;return!1}function XM(e,t){let r=rD(e);if(r)Bt(r);else n8(e,t);sC(e,YM(t));let o=u.value,a=o&&Dc(o.id,e)?Ql(o.id)?.id??null:null;GM(e,a)}var rl=null;function QM(e){if(rl)return UM;AC((a)=>Dc(a)),OC((a)=>r8(a,e)),MC((a)=>ZK(a));let t=ge();rl=t;let r=YM(e),o=null;return t.run(()=>{ne(()=>{let s=u.value;if(!s)return;let l=Kg(s),d=nE(s);Jr();try{let f=Ql(s.id)?.id??null;if(f!==null)for(let c of QK(f,s.id,l))Zd(c);if(sC(l,r)){if(GM(l,f),f!==null&&JM(l,s.id))e.placeHome?.(l,f)}else if(o!==null&&d!==o&&Vc[l].inspector.whileWriting===!0)Eo("right",!XL(l,d))}finally{Yr()}o=d});let a=!1,i=ne(e8,{scheduler:()=>{if(a)return;a=!0,queueMicrotask(()=>{if(a=!1,rl===t)i()})}})}),UM}function r8(e,t){let r=h.workspace,o=fn(e);if(!o||o.derived||Vc[r].tabStrip)return;if(r==="styles"){t.openStyles?.();return}if(!t.placeHome||!Wp(r))return;t.placeHome(r,e),Bt(Xl(r))}function UM(){rl?.stop(),rl=null,AC(null),OC(null),MC(null)}var ZM={$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}"}]}}]}}}]}]};T("about",ZM);function lD(e){let t=document.createElement("div");t.style.pointerEvents="auto",t.setAttribute(qe,ft("dialog","about")),e.layer.append(t);let r=!1,o=()=>{if(r)return;r=!0,e.onClosed()},a=()=>r,i=g({close:()=>d.close(),closed:o,headline:e.headline,links:e.links,packages:[],packagesState:"loading",rows:e.rows}),s=null,l=R("about",i,t).then(async(f)=>{s=f;let c=f.root;if(a())return f.dispose(),c;if(await Jt(c),a())return c;return Pt(c),c}),d={close(){if(r)return;let f=s?.root;if(f instanceof HTMLElement)Nt(f);s?.dispose(),s=null,t.remove(),o()},host:t,ready:l,update(f){if(f.rows!==void 0)i.rows=f.rows;if(f.packages!==void 0)i.packages=f.packages,i.packagesState=f.packages.length===0?"empty":"listed"}};return d}var al="Jx Studio",im="8.0.0",pD="2026-10-21T11:20:13.743Z",pm="0b8d085",gm={github:"https://github.com/jxsuite/jx",docs:"https://github.com/jxsuite/jx#readme",license:"https://github.com/jxsuite/jx/blob/main/LICENSE"};var il=null;function a8(e){if(!e)return"—";let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function uD(e){let t=[{label:"Version",value:im},{label:"Build date",value:a8(pD)},{label:"Commit",value:pm}];if(e){if(t.push({label:"Channel",value:e.channel}),e.updateStatus)t.push({label:"Updates",value:e.updateStatus})}return t}async function i8(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(il===e)e.update({packages:r,rows:uD(o)})}function s8(){if(il)return;let e=lD({headline:`About ${al}`,layer:tt("dialog"),links:[{href:gm.github,label:"GitHub"},{href:gm.docs,label:"Documentation"},{href:gm.license,label:"License"}],onClosed:()=>{if(il===e)il=null},rows:uD(null)});il=e,i8(e)}function l8(){return[{id:"help.about",title:`About ${al}`,category:"Help",level:"application",menus:["commandbar/overflow","palette"],group:"9_help",run:()=>{s8()}}]}function mD(e){e.registerAll(l8())}function Tt(){return u.value}function hD(){let e=Tt();return Boolean(e&&Ln(e).active)}function c8(e){return`jx://collab/${(e.documentPath??"").replace(/^\.?\//,"")}`}function d8(){return[{id:"collab.setEnabled",title:"Collaborate: Share this document",category:"Collaborate",level:"document",menus:["palette"],group:"1_session",requires:"an open document",when:()=>Boolean(Tt()?.documentPath),args:{additionalProperties:!1,properties:{enabled:$o("True to attach a live session, false to leave it.")},required:["enabled"],type:"object"},run:(e,t)=>{let r=zi("collab.setEnabled",t,"enabled"),o=Tt();if(!o)return;if(z$(o)===r)return;B$(o,r),C.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(Tt()?.documentPath),enablement:hD,run:()=>{let e=Tt();if(!e||!z$(e))return;B$(e,!1),C.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(Tt()?.documentPath),enablement:hD,run:async()=>{let e=Tt();if(!e)return;let t=c8(e);try{await navigator.clipboard.writeText(t)}catch(r){C.error(`Could not copy the session link — ${r instanceof Error?r.message:String(r)}`,{detail:t,source:"Collaboration"});return}C.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(Tt()?.documentPath),enablement:()=>{let e=Tt();return Boolean(e&&Ln(e).peers.length>0)},args:{additionalProperties:!1,properties:{login:We("The collaborator's login, as shown on their presence chip.")},required:[],type:"object"},run:(e,t)=>{let r=Tt();if(!r)return;let o=Xn("collab.follow",t,"login"),{peers:a}=Ln(r),i=o?a.find((l)=>l.state.user.login===o):a[0];if(!i){C.warn(o?`${o} is not in this session.`:"Nobody else is in this session.",{source:"Collaboration"});return}let s=i.state.focusedPath;if(!s){C.info(`${i.state.user.login} is not in a document right now.`,{source:"Collaboration"});return}C.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(Tt()?.documentPath),run:()=>{let e=Tt();if(!e)return;let t=Ln(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."];C.info(r[0],{detail:r.join(`
|
|
500
|
+
`})});if(!N.ok)throw Error(await rr(N,"Failed to update package.json"))}let A={};if(t)A.assetSpace="repo",A.documentBaseUrl=`${t}/raw/`;let j={id:"cloud",projectRoot:r,gitHosted:!0,canvasUrl:"/canvas.html",...A,openProjectPicker:"repo-list",createDestination:"repo",async activate(){if(!e)return;let P=await l("/activate",{});if(!P.ok)throw await pu(P,"Failed to open the project session")},async openProject(){if(!e)return null;let P=await d(),N=P.projectConfig??{};return{config:N,handle:{root:r,name:N.name||P.name,projectConfig:N}}},async probeRootProject(){if(!e)return null;try{let P=await d();return{meta:{root:r,name:P.name},info:{isSiteProject:P.projectConfig!==null,projectConfig:P.projectConfig??null}}}catch{return null}},async listDirectory(P){return $e(await i(`/files?dir=${encodeURIComponent(P)}`),`Failed to list directory: ${P}`)},async readFile(P){return y.read(P)},async readFileBytes(P){let N=await i(`/file/bytes?path=${encodeURIComponent(P)}`);if(!N.ok)throw Error(await rr(N,`Failed to read file bytes: ${P}`));return N.arrayBuffer()},async writeFile(P,N){let I=await i("/file",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:P,content:N})});if(!I.ok)throw Error(await rr(I,`Failed to write file: ${P}`))},async uploadFile(P,N){let I=await i(`/file/upload?path=${encodeURIComponent(P)}`,{method:"POST",body:N}),_=await $e(I,`Upload failed: ${P}`),O={path:_.path??P};if(_.size!==void 0)O.size=_.size;return O},async deleteFile(P){let N=await i(`/file?path=${encodeURIComponent(P)}`,{method:"DELETE"});if(!N.ok&&N.status!==404)throw Error(await rr(N,`Failed to delete file: ${P}`))},async renameFile(P,N){return $e(await l("/file/rename",{from:P,to:N}),`Failed to rename: ${P} → ${N}`)},async findReferences(P){let N=new URLSearchParams;if(P.path)N.set("path",P.path);if(P.tagName)N.set("tag",P.tagName);return $e(await i(`/references?${N.toString()}`),`Failed to find references: ${P.path??P.tagName??""}`)},async createDirectory(P){},async collab(P){if(!e||typeof WebSocket>"u"||typeof location>"u")return null;a??=i("/collab").then(async(O)=>O.ok?L_(await Ce(O)):{offer:[],refused:null}).catch(()=>({offer:[],refused:null}));let N=await a;if(N.refused!==null)return console.warn(`Collaboration unavailable: ${N.refused}`),null;let{offer:I}=N;return o??=(async()=>{let{createWsCollabConnection:O}=await (le("bv552sfx"),import("./chunks/ws-client-bv552sfx.js")),H=location.protocol==="https:"?"wss":"ws";return O({hydratePath:async(F)=>y.read(F).then(()=>{},()=>{}),protocols:I,url:`${H}://${location.host}${t}/collab`})})(),(await o).openDoc(P)},subscribeFileEvents(P,N){if(!e||typeof WebSocket>"u"||typeof location>"u")return()=>{};let I=null,_=!1,O=!1,H=()=>{let W=location.protocol==="https:"?"wss":"ws",D=new WebSocket(`${W}://${location.host}${t}/events`);I=D,D.addEventListener("message",(V)=>{let J;try{J=JSON.parse(V.data)}catch{return}if(J.kind==="fs"&&J.events?.length)P(J.events);else if(J.kind==="git"&&J.event==="committed")N?.onResync?.("commit")}),D.addEventListener("open",()=>{F.opened(),N?.onResync?.(O?"reconnect":"open"),O=!0}),D.addEventListener("close",()=>{if(!_)F.scheduleRetry()})},F=Cy(H);return H(),()=>{_=!0,F.dispose(),I?.close()}},async listFormats(){try{let P=await i("/formats");if(!P.ok)return[];return(await Ce(P)).formats??[]}catch{return[]}},async listExtensions(){try{let P=await i("/formats");if(!P.ok)return[];return(await Ce(P)).extensions??[]}catch{return[]}},async listExtensionCatalog(){try{let P=await i("/catalog");if(!P.ok)return[];let N=await Ce(P),I=await k(),_=new Set([...Object.keys(Is(I,"dependencies")),...Object.keys(Is(I,"devDependencies"))]);for(let O of N)O.bundled=!0,O.installed=_.has(O.name);return N}catch{return[]}},async fetchProjectSchemas(){try{let P=await i("/project-schemas");if(!P.ok)return{};return await Ce(P)}catch{return{}}},async formatAction(P){let N=await l("/format",P);if(!N.ok)throw Error(await rr(N,"This cloud session cannot run format actions yet (the backend serves no format route)"));return(await Ce(N)).result},async discoverComponents(){let P=new Set(["node_modules","dist",".git",".claude",".obsidian","build"]),N=400,I=6,_=[],O=async(F,W)=>{if(W>6||_.length>=400)return;let D;try{D=await j.listDirectory(F)}catch{return}let V=[];for(let J of D)if(J.type==="directory"){if(!P.has(J.name)&&!J.name.startsWith("."))V.push(J.path)}else if(J.name.endsWith(".json")&&_.length<400)_.push(J.path);await Promise.all(V.map(async(J)=>O(J,W+1)))};return await O("",0),(await Promise.all(_.map(async(F)=>{try{return QS(x1(await j.readFile(F)),F)}catch{return null}}))).filter((F)=>F!==null)},async codeService(){return null},async fetchPluginSchema(){return null},async addPackage(P){let N=await k(),I=Is(N,"dependencies"),_=P.lastIndexOf("@"),[O,H]=_>0?[P.slice(0,_),P.slice(_+1)]:[P,"latest"];I[O]=H,N.dependencies=I,await E(N)},async removePackage(P){let N=await k();for(let I of["dependencies","devDependencies"]){let _=N[I];if(v(_)&&P in _)N[I]=Object.fromEntries(Object.entries(_).filter(([O])=>O!==P))}await E(N)},async listPackages(){let P=await k(),N=[],I=Is(P,"dependencies");for(let[O,H]of Object.entries(I))N.push({name:O,version:H});let _=Is(P,"devDependencies");for(let[O,H]of Object.entries(_))N.push({name:O,version:H,dev:!0});return N},async resolveSiteContext(P){try{let I=(await d()).projectConfig??void 0,_={sitePath:r};if(I!==void 0)_.projectConfig=I;if(P!==r)_.fileRelPath=P;return _}catch{return{sitePath:null}}},async locateFile(P){try{let N=await i(`/locate?name=${encodeURIComponent(P)}`);if(N.ok)return(await Ce(N)).path??null}catch{}return null},async searchFiles(P,N=[]){let I=["json",...N.map((O)=>O.replace(/^\./,""))],_=await i(`/search?query=${encodeURIComponent(P)}&extensions=${encodeURIComponent(I.join(","))}`);if(!_.ok)return[];return await Ce(_)},async gitStatus(){return $e(await i("/git/status"),"Failed to read git status")},async gitBranches(){let P=await $e(await i("/git/branches"),"Failed to list branches");if(P.defaultBranch)return P;let N=await c();return N?{...P,defaultBranch:N}:P},async gitLog(P){let N=P?`?limit=${P}`:"";return $e(await i(`/git/log${N}`),"Failed to read git log")},async gitStage(P){await $e(await l("/git/stage",{files:P}),"Failed to stage files")},async gitUnstage(P){await $e(await l("/git/unstage",{files:P}),"Failed to unstage files")},async gitCommit(P){await $e(await l("/git/commit",{message:P}),"Commit failed")},async gitPush(){await $e(await l("/git/push",{}),"Push failed")},async gitPull(){await $e(await l("/git/pull",{}),"Pull failed")},async gitFetch(){await $e(await l("/git/fetch",{}),"Fetch failed")},async gitCheckout(P){if(e&&typeof location<"u")location.assign(sv({...e,branch:P}))},async gitCreateBranch(P){await $e(await l("/git/create-branch",{name:P}),"Failed to create branch")},async gitDiff(P){return(await $e(await i(`/git/diff?path=${encodeURIComponent(P??"")}`),"Failed to compute diff")).diff},async gitShow(P){let N=new URLSearchParams({path:P.path});if(P.ref)N.set("ref",P.ref);return(await $e(await i(`/git/show?${N}`),`Failed to read ${P.path} at ref`)).content},async gitDiscard(P){await $e(await l("/git/discard",{files:P}),"Failed to discard changes")},async gitInit(){},async gitAddRemote(){},async buildSite(){return $e(await i("/build",{method:"POST"}),"The site could not be previewed.")},async listProjects(){return(await P1()).map((N)=>({name:N.fullName,root:lu({owner:N.owner,repo:N.name,branch:N.defaultBranch}),description:`${N.defaultBranch} · ${N.permission}`}))},async listStarters(){let P=await fetch("/api/v1/starters",{credentials:"include"});if(!P.ok)return[];return await Ce(P)},async setWindowProject(P){let N=await k1(P);if(!N)throw Error(`No project to open at ${P}`);if(typeof location<"u")location.assign(sv(N));return{deduped:!0,config:null}},async openProjectInNewWindow(P){let N=await k1(P);if(!N)throw Error(`No project to open at ${P}`);if(typeof window<"u")window.open(sv(N),"_blank","noopener");return{focused:!1}},async createProject(P){let{destination:N}=P;if(N.kind!=="repo"||!N.owner||!N.repo)throw Error("A destination repository is required.");let I=await fetch("/api/v1/projects",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:P.name,description:P.description,starter:P.starter,owner:N.owner,repo:N.repo,private:N.private})});if(!I.ok)throw await pu(I,"Failed to create project");let _=await Ce(I);return{root:lu({owner:_.owner,repo:_.name,branch:_.defaultBranch}),config:{name:P.name}}},async importSite(P,N,I,_){return await su("/api/v1/import/site",P,N,I,_)},async getUser(){let P=await fetch("/api/v1/me",{credentials:"include"});if(!P.ok)return null;let N=await Ce(P);if(!N.user)return null;let I={login:N.user.login};if(N.user.name)I.name=N.user.name;if(N.user.avatar_url)I.avatarUrl=N.user.avatar_url;return I},async listRepos(){let P=await fetch("/api/v1/repos",{credentials:"include"});if(!P.ok)throw Error(await rr(P,"Failed to list repositories"));return(await Ce(P)).map((I)=>({owner:I.owner,name:I.name,fullName:I.fullName,private:I.private,defaultBranch:I.defaultBranch,permission:I.permission,isJxProject:I.isJxProject}))},async listRepoProjects(P){let N=await fetch(`/api/v1/repos/${encodeURIComponent(P.owner)}/${encodeURIComponent(P.name)}/projects`,{credentials:"include"}),I=await $e(N,"Failed to look for projects"),_=[];for(let O of I.locations){let H=Dl(O.dir);if(H!==null)_.push(O.name?{dir:H,name:O.name}:{dir:H})}return{branch:I.branch,locations:_,truncated:I.truncated===!0}},async importProject(P){let N=Dl(P.dir??"");if(N===null)throw Error("The project folder must stay inside the repository.");let I={owner:P.owner,name:P.name};if(N)I.dir=N;let _=await fetch("/api/v1/projects/import",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify(I)}),O=await $e(_,"Failed to import repository"),H={owner:O.owner,repo:O.name,branch:O.defaultBranch};if(N)H.dir=N;return{root:lu(H)}},async getAccountStatus(){let P=await fetch("/api/v1/me",{credentials:"include"});if(!P.ok)return null;let N=await Ce(P),I=I6(N.entries),_=L6(N.notices),O={installations:(N.installations??[]).map((H)=>{let F={id:H.id,account:H.account};if(H.manageUrl)F.manageUrl=H.manageUrl;return F})};if(N.appInstallUrl)O.appInstallUrl=N.appInstallUrl;if(I.length>0)O.entries=I;if(_.length>0)O.notices=_;return O},performAction(P){if(typeof window>"u"||typeof location>"u"||!P.href)return Promise.resolve(null);let N=du;if(N){try{N.popup?.focus()}catch{}return N.promise}let I=window.open(P.href,"jx-action","width=980,height=820");if(!I)return location.assign(P.href),Promise.resolve({status:"redirect"});let _={popup:I,promise:Promise.resolve(null)};return du=_,_.promise=D6(I).finally(()=>{if(du===_)du=null}),_.promise},async createPullRequest(P){return $e(await l("/git/pr",P),"Failed to open pull request")},async cfConnection(){return Ls()},cfConnect(){if(typeof window>"u"||typeof location>"u")return Promise.resolve(null);let P=cu;if(P){try{P.popup?.focus()}catch{}return P.promise}let N={popup:null,promise:Promise.resolve(null)};cu=N;let I=s?`/api/v1/cf/connect?project=${encodeURIComponent(s)}`:"/api/v1/cf/connect";return N.promise=A6(N,I).finally(()=>{if(cu===N)cu=null}),N.promise},async cfAccounts(){let P=await fetch("/api/v1/cf/accounts",{credentials:"include"});return $e(P,"Failed to list Cloudflare accounts")},async cfSelectAccount(P){let N=await fetch("/api/v1/cf/select-account",{body:JSON.stringify({accountId:P.id,accountName:P.name}),credentials:"include",headers:{"Content-Type":"application/json"},method:"POST"});if(!N.ok)throw Error(await rr(N,"Failed to select a Cloudflare account"))},async cfDisconnect(){let P=await fetch("/api/v1/cf/connection",{credentials:"include",method:"DELETE"});if(!P.ok)throw Error(await rr(P,"Failed to disconnect Cloudflare"))},async cfApi(P,N){let I={};if(s)I["X-Jx-Project"]=s;if(N?.body!==void 0)I["Content-Type"]="application/json";let _={method:N?.method??"GET",credentials:"include"};if(Object.keys(I).length>0)_.headers=I;if(N?.body!==void 0)_.body=JSON.stringify(N.body);let O=await fetch(`/api/v1/cf/proxy${P}`,_);if(O.status===403){let F=await Ce(O.clone()).catch(()=>null);if(S1(F))throw await pu(O,"Publishing was refused")}let H=await Ce(O);if(!O.ok||H.success===!1){let F=H.errors?.map((W)=>W.message).join("; ")??H.error??O.statusText;throw Error(`Cloudflare API: ${F}`)}return H.result??H},aiChatUrl(){return s?`/api/v1/ai/chat?project=${encodeURIComponent(s)}`:"/api/v1/ai/chat"}};return j}function N1(e){return"showDirectoryPicker"in e&&typeof e.showDirectoryPicker==="function"}function j1(){return N1(globalThis)}function _6(){let e=new Uint8Array(16);return globalThis.crypto.getRandomValues(e),[...e].map((t)=>t.toString(16).padStart(2,"0")).join("")}function H6(e){return S(e)&&"name"in e&&n(e.name)?e.name:""}async function R1(e){let t=globalThis;if(!N1(t))throw TypeError("This browser has no folder chooser. Type the folder's path into Location instead.");let r=t.showDirectoryPicker,o;try{o=await r({id:"jx-new-project-location",mode:"readwrite",startIn:"documents"})}catch(l){if(H6(l)==="AbortError")return null;throw Error(`The folder chooser could not open (${Q(l)}). Type the folder's path into Location instead.`,{cause:l})}let{name:a}=o,i=_6(),s=!1;try{try{let d=await o.getFileHandle(dC,{create:!0});s=!0;let f=await d.createWritable();await f.write(i),await f.close()}catch(d){throw Error(`Jx Studio can't write to "${a}" (${Q(d)}), so it can't create a project there. Choose a folder you can write to.`,{cause:d})}let l;try{l=await e({id:i,name:a})}catch(d){throw Error(`Jx Studio could not look up where "${a}" is: ${Q(d)}. Type the folder's path into Location instead.`,{cause:d})}if(!l)throw Error(`Jx Studio could not find where "${a}" is. From a browser it can only find folders inside your home folder. Type its full path into Location instead.`);return l}finally{if(s)await o.removeEntry(dC).catch(()=>{})}}async function ee(e){return await e.json()}function z6(e){return"showDirectoryPicker"in e&&te(e.showDirectoryPicker)}function A1(){let e="",t=null,r=null,o=null;async function a(c){if(!c)return;let b=await fetch("/__studio/activate",{body:JSON.stringify({root:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!b.ok){let y=await ee(b).catch(()=>({}));throw Error(`Could not open ${c}: ${sr(y)??`activation failed (${b.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 b=c.replaceAll("\\","/");if(!e)return b;if(b===".")return e;return`${e}/${b}`}function l(c,b={}){let y=new URLSearchParams(b);if(e)y.set("dir",s("."));let w=y.toString();return`/__studio/git/${c}${w?`?${w}`:""}`}function d(c){let b=c.replaceAll("\\","/");if(!e)return b;return b.startsWith(`${e}/`)?b.slice(e.length+1):b}let f={};if(j1())f.pickDirectory=async()=>R1(async({id:c,name:b})=>{let y=await fetch(`/__studio/locate-directory?name=${encodeURIComponent(b)}&id=${encodeURIComponent(c)}`);if(!y.ok){let k=await ee(y).catch(()=>null);throw Error(ka(k,y.status))}return(await ee(y)).path??null});return{id:"devserver",createDestination:"path",get projectRoot(){return e},set projectRoot(c){if(e=c||"",e)t=this.activate(e).catch((b)=>{console.error("Project activation failed:",b)})},async activate(c){await a(c??e)},async openProject(){let c=window;if(!z6(c))throw Error("showDirectoryPicker not available — use a Chromium-based browser");let b;try{b=await c.showDirectoryPicker({mode:"readwrite"})}catch(P){if(P instanceof Error&&P.name==="AbortError")return null;throw P}let y;try{y=await b.getFileHandle("project.json")}catch{throw Error("No project.json found in selected folder")}let w=await y.getFile(),k=JSON.parse(await w.text()),E=await fetch("/__studio/sites");if(!E.ok)throw Error("Failed to fetch site list from server");let j=(await ee(E)).find((P)=>JSON.stringify(P.config)===JSON.stringify(k));if(!j){let P=await fetch(`/__studio/find-project?name=${encodeURIComponent(b.name)}`);if(!P.ok)throw Error("Could not locate project on disk");let N=await ee(P);if(!N.path)throw Error(`Could not find project directory "${b.name}"`);e=N.path}else e=j.path;return await this.activate(),{config:k,handle:{name:k.name||e.split("/").pop(),projectConfig:k,root:e}}},async probeRootProject(){try{let[c,b]=await Promise.all([fetch("/__studio/project"),fetch("/__studio/project-info?dir=.")]),y=c.ok?await ee(c):{name:"project",root:"."};return{info:b.ok?await ee(b):{isSiteProject:!1},meta:y}}catch{return null}},async createProject(c){let b=await fetch("/__studio/create-project",{body:JSON.stringify(c),headers:{"Content-Type":"application/json"},method:"POST"});if(!b.ok){let y=await ee(b);throw Error(sr(y)??"Failed to create project")}return await b.json()},...f,async listStarters(){let c=await fetch("/__studio/starters");if(!c.ok)throw Error("Failed to load starters");return await ee(c)},async importSite(c,b,y,w){return await su("/__studio/import-site",c,b,y,w)},async listDirectory(c){let b=await fetch(`/__studio/files?dir=${encodeURIComponent(s(c))}`);if(!b.ok)throw Error(`Failed to list directory: ${c}`);let y=await ee(b);for(let w of y)w.path=d(w.path);return y},async readFile(c){let b=await fetch(`/__studio/file?path=${encodeURIComponent(s(c))}&optional=1`);if(!b.ok)throw Error(`Failed to read file: ${c}`);let y=await ee(b);if(y.content===null)throw Error(`Failed to read file: ${c} (not found)`);return y.content},async readFileBytes(c){let b=await fetch(`/__studio/file/bytes?path=${encodeURIComponent(s(c))}`);if(!b.ok)throw Error(`Failed to read file bytes: ${c}`);return b.arrayBuffer()},async writeFile(c,b){if(!(await fetch(`/__studio/file?path=${encodeURIComponent(s(c))}`,{body:b,method:"PUT"})).ok)throw Error(`Failed to write file: ${c}`)},async uploadFile(c,b){let y=await fetch(`/__studio/file/upload?path=${encodeURIComponent(s(c))}`,{body:b,method:"POST"});if(!y.ok)throw Error(`Upload failed: ${c}`);let w=await ee(y),k={path:w.path??c};if(w.size!==void 0)k.size=w.size;return k},async deleteFile(c){let b=await fetch(`/__studio/file?path=${encodeURIComponent(s(c))}`,{method:"DELETE"});if(!b.ok&&b.status!==404)throw Error(`Failed to delete file: ${c}`)},async renameFile(c,b){let y=await fetch("/__studio/file/rename",{body:JSON.stringify({from:s(c),to:s(b)}),headers:{"Content-Type":"application/json"},method:"POST"});if(!y.ok)throw Error(`Failed to rename: ${c} → ${b}`);return ee(y)},async findReferences(c){await t;let b=new URLSearchParams;if(c.path)b.set("path",s(c.path));if(c.tagName)b.set("tag",c.tagName);let y=await fetch(`/__studio/references?${b.toString()}`);if(!y.ok)throw Error(`Failed to find references: ${c.path??c.tagName??""}`);return ee(y)},subscribeFileEvents(c,b){if(typeof EventSource>"u")return()=>{};let y=new EventSource("/__reload"),w=0;return y.addEventListener("open",()=>{if(w+=1,w>1)i(),b?.onResync?.("reconnect")}),y.addEventListener("fs",(k)=>{let E;try{E=JSON.parse(k.data)}catch{return}let A=[];for(let j of E.events??[]){let P=j.path.replaceAll("\\","/");if(e&&P!==e&&!P.startsWith(`${e}/`))continue;let N=d(P);if(N&&!N.startsWith(".."))A.push({isDir:j.isDir,path:N,type:j.type})}if(A.length>0)c(A)}),()=>{y.close()}},async collab(c){if(typeof WebSocket>"u"||typeof location>"u")return null;if(r===null)r=fetch("/__studio/collab").then(async(k)=>k.ok?L_(await ee(k)):null).catch(()=>null);let b=await r;if(b===null)return null;if(b.refused!==null)return console.warn(`Collaboration unavailable: ${b.refused}`),null;let{offer:y}=b;return o??=(async()=>{let{createWsCollabConnection:k}=await (le("bv552sfx"),import("./chunks/ws-client-bv552sfx.js")),E=location.protocol==="https:"?"wss":"ws";return k({protocols:y,url:`${E}://${location.host}/__studio/collab`})})(),(await o).openDoc(s(c))},async createDirectory(c){},async discoverComponents(c){let b=c||e;if(!b)return[];let y=`/__studio/components?dir=${encodeURIComponent(b)}`,w=await fetch(y);if(!w.ok)return[];return await w.json()},async addPackage(c){let b=await fetch("/__studio/packages/add",{body:JSON.stringify({name:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!b.ok)throw Error(await b.text());return await b.json()},async removePackage(c){let b=await fetch("/__studio/packages/remove",{body:JSON.stringify({name:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!b.ok)throw Error(await b.text());return await b.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 b=await ee(c);return Boolean(b.needsInstall)},async packageVersions(){let c=await fetch("/__studio/packages/versions");if(!c.ok)return[];return await c.json()},async setPackageVersions(c){let b=await fetch("/__studio/packages/set-versions",{body:JSON.stringify({updates:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!b.ok)return{log:await b.text(),ok:!1};return await b.json()},async codeService(c,b){try{let y=await fetch(`/__studio/code/${c}`,{body:JSON.stringify(b),headers:{"Content-Type":"application/json"},method:"POST"});if(!y.ok)return null;return await y.json()}catch{return null}},async resolveSiteContext(c){let b=await fetch(`/__studio/resolve-site?path=${encodeURIComponent(c)}`);if(!b.ok)return{sitePath:null};return await b.json()},async locateFile(c){try{let b=await fetch("/__studio/locate",{body:JSON.stringify({name:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(b.ok)return(await ee(b)).path||null}catch{}return null},async searchFiles(c,b=[]){let y=["json",...b.map((A)=>A.replace(/^\./,""))],w=`**/*${c}*.{${y.join(",")}}`,k=await fetch(`/__studio/files?dir=${encodeURIComponent(s("."))}&glob=${encodeURIComponent(w)}`);if(!k.ok)return[];let E=await ee(k);for(let A of E)A.path=d(A.path);return E},async listFormats(){let c=await fetch(`/__studio/formats?dir=${encodeURIComponent(s("."))}`);if(!c.ok)return[];return(await ee(c)).formats??[]},async listExtensions(){let c=await fetch(`/__studio/formats?dir=${encodeURIComponent(s("."))}`);if(!c.ok)return[];return(await ee(c)).extensions??[]},async listExtensionCatalog(){let c=await fetch(`/__studio/catalog?dir=${encodeURIComponent(s("."))}`);return c.ok?await ee(c):[]},async fetchProjectSchemas(){let c=await fetch(`/__studio/project-schemas?dir=${encodeURIComponent(s("."))}`);if(!c.ok)return{};return await ee(c)},async dataConnections(){let c=await fetch(`/__studio/data/connections?dir=${encodeURIComponent(s("."))}`);if(!c.ok){let b=await ee(c);throw Error(sr(b)??"Failed to list connections")}return await ee(c)},async dataConnectionTest(c){let b=await fetch(`/__studio/data/connections/test?dir=${encodeURIComponent(s("."))}`,{body:JSON.stringify({connection:c}),headers:{"Content-Type":"application/json"},method:"POST"}),y=await ee(b);if(!b.ok)throw Error(sr(y)??"Connection test failed");return y},async dataPush(c){let b=await fetch(`/__studio/data/push?dir=${encodeURIComponent(s("."))}`,{body:JSON.stringify(c??{}),headers:{"Content-Type":"application/json"},method:"POST"}),y=await ee(b);if(!b.ok)throw Error(sr(y)??"Schema push failed");return y},async dataRows(c){let b=new URLSearchParams({dir:s("."),table:c.table});if(c.connection)b.set("connection",c.connection);if(c.limit!==void 0)b.set("limit",String(c.limit));if(c.offset!==void 0)b.set("offset",String(c.offset));if(c.orderBy!==void 0)b.set("orderBy",c.orderBy);if(c.dir!==void 0)b.set("dir",c.dir);let y=await fetch(`/__studio/data/rows?${b}`),w=await ee(y);if(!y.ok)throw Error(sr(w)??"Failed to load rows");return w},async dataInsertRow(c){let b=await fetch(`/__studio/data/rows?dir=${encodeURIComponent(s("."))}`,{body:JSON.stringify(c),headers:{"Content-Type":"application/json"},method:"POST"}),y=await ee(b);if(!b.ok)throw Error(sr(y)??"Insert failed");return y},async dataUpdateRow(c){let b=await fetch(`/__studio/data/rows?dir=${encodeURIComponent(s("."))}`,{body:JSON.stringify(c),headers:{"Content-Type":"application/json"},method:"PUT"}),y=await ee(b);if(!b.ok)throw Error(sr(y)??"Update failed");return y},async dataDeleteRow(c){let b=new URLSearchParams({dir:s("."),pk:String(c.pk),table:c.table});if(c.connection)b.set("connection",c.connection);let y=await fetch(`/__studio/data/rows?${b}`,{method:"DELETE"}),w=await ee(y);if(!y.ok)throw Error(sr(w)??"Delete failed");return w},async listSecrets(){let c=await fetch(`/__studio/secrets?dir=${encodeURIComponent(s("."))}`);if(!c.ok){let y=await ee(c);throw Error(sr(y)??"Failed to list secrets")}return(await ee(c)).names},async setSecrets(c){let b=await fetch(`/__studio/secrets?dir=${encodeURIComponent(s("."))}`,{body:JSON.stringify(c),headers:{"Content-Type":"application/json"},method:"PUT"}),y=await ee(b);if(!b.ok)throw Error(sr(y)??"Failed to write secrets");return y},async formatAction(c){let b=await fetch("/__studio/format",{body:JSON.stringify({...c,dir:s(".")}),headers:{"Content-Type":"application/json"},method:"POST"}),y=await ee(b);if(!b.ok)throw Error(sr(y)??"Format action failed");return y.result},async fetchPluginSchema(c,b,y){let w=new URLSearchParams({src:c});if(b)w.set("prototype",b);if(y)w.set("base",y);let k=await fetch(`/__studio/plugin-schema?${w}`);if(!k.ok)return null;let{schema:E}=await ee(k);return E},async resolveClass(c){let b=await fetch("/__jx_resolve__",{body:JSON.stringify(c),headers:{"content-type":"application/json"},method:"POST"});if(!b.ok)throw Error(`Class resolution failed: ${b.status}`);return await ee(b)},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 b=await fetch(l("log",c?{limit:String(c)}:{}));if(!b.ok)throw Error(await b.text());return await b.json()},async gitStage(c){let b=await fetch(l("stage"),{body:JSON.stringify({files:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!b.ok){let y=await ee(b);throw Error(ka(y))}return await b.json()},async gitUnstage(c){let b=await fetch(l("unstage"),{body:JSON.stringify({files:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!b.ok){let y=await ee(b);throw Error(ka(y))}return await b.json()},async gitCommit(c){let b=await fetch(l("commit"),{body:JSON.stringify({message:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!b.ok){let y=await ee(b);throw Error(ka(y))}return await b.json()},async gitPush(c){let b=await fetch(l("push"),{body:JSON.stringify(c||{}),headers:{"Content-Type":"application/json"},method:"POST"});if(!b.ok){let y=await ee(b);throw Error(ka(y))}return await b.json()},async gitPull(){let c=await fetch(l("pull"),{method:"POST"});if(!c.ok){let b=await ee(c);throw Error(ka(b))}return await c.json()},async gitFetch(){let c=await fetch(l("fetch"),{method:"POST"});if(!c.ok){let b=await ee(c);throw Error(ka(b))}return await c.json()},async gitCheckout(c){let b=await fetch(l("checkout"),{body:JSON.stringify({branch:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!b.ok){let y=await ee(b);throw Error(ka(y))}return await b.json()},async gitCreateBranch(c){let b=await fetch(l("create-branch"),{body:JSON.stringify({name:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!b.ok){let y=await ee(b);throw Error(ka(y))}return await b.json()},async gitDiff(c){let b=await fetch(l("diff",{path:c??""}));if(!b.ok)throw Error(await b.text());return await b.json()},async gitShow(c){let b=await fetch(l("show",c.ref?{path:c.path,ref:c.ref}:{path:c.path}));if(!b.ok)throw Error(await b.text());return(await ee(b)).content},async gitDiscard(c){let b=await fetch(l("discard"),{body:JSON.stringify({files:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!b.ok){let y=await ee(b);throw Error(ka(y))}return await b.json()},async gitClone(c){let b=await fetch(l("clone"),{body:JSON.stringify({url:c}),headers:{"Content-Type":"application/json"},method:"POST"});if(!b.ok){let y=await ee(b);throw Error(ka(y))}return await b.json()},async gitInit(){let c=await fetch(l("init"),{method:"POST"});if(!c.ok){let b=await ee(c);throw Error(ka(b))}},async buildSite(){let c=await fetch("/__studio/build",{method:"POST"});if(!c.ok){let b=await ee(c);throw Error(sr(b)??"The site could not be built.")}return await ee(c)},async previewSite(c){let b=await fetch("/__studio/preview",{body:JSON.stringify(c),headers:{"Content-Type":"application/json"},method:"POST"});if(!b.ok){let y=await ee(b);throw Error(sr(y)??"The site could not be previewed.")}return await ee(b)},async setPreviewOverlay(c,b){await fetch("/__studio/preview/overlay",{body:JSON.stringify({contents:b,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,b){let y=await fetch(l("add-remote"),{body:JSON.stringify({name:c,url:b}),headers:{"Content-Type":"application/json"},method:"POST"});if(!y.ok){let w=await ee(y);throw Error(ka(w))}},async cfApi(c,b){let{getCfToken:y}=await (le("h2wrh6hq"),import("./chunks/cf-settings-h2wrh6hq.js")),w=y();if(!w)throw Error("No Cloudflare API token configured");let k=await fetch("/__studio/cf/proxy",{method:"POST",headers:{"Content-Type":"application/json","X-CF-Token":w},body:JSON.stringify({path:c,method:b?.method??"GET",body:b?.body})}),E=await ee(k);if(!k.ok||E.success===!1){let A=E.errors?.map((j)=>j.message).join("; ")??E.error??k.statusText;throw Error(`Cloudflare API: ${A}`)}return E.result??E},async cfConnection(){let{getCfAccountId:c,getCfToken:b,setCfAccountId:y}=await (le("h2wrh6hq"),import("./chunks/cf-settings-h2wrh6hq.js"));if(!b())return null;try{let w=await this.cfApi("/accounts");if(!Array.isArray(w)||w.length===0)return{connected:!1};let k=w,E=k.find((A)=>A.id===c())??k[0];return y(E.id),{connected:!0,accountId:E.id,accountName:E.name}}catch{return{connected:!1}}},async listProjects(){let c=await fetch("/__studio/sites");if(!c.ok)return[];return(await ee(c)).map((y)=>({name:y.config?.name||y.path.split("/").at(-1)||y.path,root:y.path,description:y.path}))},aiChatUrl(){return"/__studio/ai/chat"}}}var B6=new Set(["views:","file:"]);function V6(){let e=typeof document>"u"?void 0:document,t=`meta[name="${av.name}"][content="${av.content}"]`;return{cloud:globalThis.__jxCloud!=null,declared:e?.querySelector(t)!=null,launcher:Tv(),protocol:typeof location>"u"?"":location.protocol}}function W6(e=V6()){if(e.launcher)return{kind:"launcher",launcher:e.launcher.launcher};if(e.cloud)return null;if(e.declared)return{kind:"declared"};if(B6.has(e.protocol))return{kind:"scheme",protocol:e.protocol};return null}function q6(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 uu extends Error{refusal;constructor(e){super(q6(e));this.name="PlatformUnavailableError",this.refusal=e}}function I1(){let e=W6();if(e)throw new uu(e);let t=globalThis.__jxCloud;return t?E1(t.project):A1()}function U6(e){return S(e)&&"getFrame"in e&&te(e.getFrame)}function J6(){let e=globalThis.__jxPlatform;if(e==null||!("windowControls"in e))return;let t=e.windowControls;return U6(t)?t:void 0}var G6=["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],L1=400,O1=300,M1=!1;function D1(){let e=J6();if(!e||M1)return;M1=!0;let t=document.createElement("div");t.id="resize-edges";for(let r of G6){let o=document.createElement("div");o.className=`resize-edge ${r}`,o.addEventListener("mousedown",(a)=>K6(a,r,e)),t.append(o)}document.body.append(t)}async function K6(e,t,r){e.preventDefault(),e.stopPropagation();let{screenX:o,screenY:a}=e,s={...await r.getFrame()};function l(f){let c=f.screenX-o,b=f.screenY-a,{x:y,y:w,width:k,height:E}=s;if(t.includes("right"))k=Math.max(L1,k+c);if(t.includes("left")){let A=Math.max(L1,k-c);y+=k-A,k=A}if(t.includes("bottom"))E=Math.max(O1,E+b);if(t.includes("top")){let A=Math.max(O1,E-b);w+=E-A,E=A}r.setFrame(y,w,k,E)}function d(){document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",d)}document.addEventListener("mousemove",l),document.addEventListener("mouseup",d)}var lv={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 F1=["caret","canvas","global"],_1=new Set(["pane.backToHome"]);var X6="input, textarea, select, [contenteditable=true]";function Q6(e=document){let t=e.activeElement;return t instanceof HTMLElement&&t.matches(X6)}function Z6(e){let t=(r)=>te(e?.[r]);return{dataRows:t("dataRows"),findReferences:t("findReferences"),gitClone:t("gitClone"),importSite:t("importSite"),openProjectInNewWindow:t("openProjectInNewWindow"),readFileBytes:t("readFileBytes"),publish:t("cfApi"),windowControls:t("newWindow")}}function H1(e){return()=>{let t=ov(),r=u.value??null,o=x,a=e.canvasMode();t.project.open=o!==null,t.project.isSite=o?.isSiteProject===!0,t.project.isRepo=h.git.status?.isRepo===!0,t.project.isMultilingual=(Qt(o?.projectConfig??{}).i18n?.locales.length??0)>1,t.git.ahead=h.git.status?.ahead??0,t.git.behind=h.git.status?.behind??0,t.git.dirtyCount=h.git.status?.files.length??0,t.workspace.id=h.workspace,t.document.open=r!==null,t.document.dirty=r?r.doc.dirty===!0||CC(r.id):!1,t.document.mode=r?.doc.mode??"",t.document.canUndo=r?vO(r):!1,t.document.canRedo=r?yO(r):!1,t.editor.kind=r?Qs(a):"none",t.canvas.view=iO(a),t.pane.count=m.panes.length,t.pane.derived=m.panes.some((l)=>l.derived!==null);let i=r?.session.selection??[],s=Me(i);if(s){let l=oe(r.doc.document,s),d=l?.tagName;t.selection.count=i.length,t.selection.paths=i.map((f)=>[...f]),t.selection.kind=n(d)?d:"",t.selection.isRoot=i.some((f)=>f.length<2),t.selection.isComponentInstance=Ae.some((f)=>f.tagName===d),t.selection.isRepeater=l?.$prototype==="Array"}if(t.selection.isLayoutNode=h.layoutSelection!==null,t.caret.active=e.isCaretActive()||Q6(),t.caret.inCanvas=e.isCaretActive(),t.focus.region=h.focusRegion,t.modal.open=e.isModalOpen(),r){let l=Ln(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=Z6(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}"}]}}]}]}}]}]};T("rail",z1);var B1=null,V1=null,cv=null,t5=null;function n5(e){return!h.docks.left.collapsed&&h.leftTab===e.id}function r5(e){cA(nC(e.id,"the Navigator rail"))}function o5(){let e=Yu();return QT(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:n5(o),title:o.title}))}))}function W1(){return V1??=g({groups:[],toggle:(e)=>{let t=QT(Yu()).flatMap((r)=>r.panels).find((r)=>r.id===e);if(t)r5(t)}}),V1}function a5(){W1().groups=o5(),i5()}function i5(){if(cv||!HC)return;cv=R("rail",W1(),HC),cv.then((e)=>{t5=e})}function q1(){Vi(),B1=ge(),B1.run(()=>{ne(()=>{let{error:e,loading:t,status:r}=h.git;if(!r&&!t&&!e)Vs();a5()})})}function s5(e){return((e.state.user.name??e.state.user.login)[0]??"?").toUpperCase()}function l5(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 dv={connecting:"Connecting…",detached:"Solo",failed:"Not connected",offline:"Offline — changes sync on reconnect",synced:"Live",unavailable:""};function c5(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`${dv[e]}. Undo only takes back your own edits, never a collaborator's.`;return dv[e]}function U1(e){if(!e)return null;let t=Ln(e);if(t.status==="unavailable")return null;return{frozen:t.sourceCanonical,label:dv[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:s5(r),key:r.clientId,title:l5(r,e.documentPath)})),readOnly:t.readOnly,status:t.status,title:c5(t.status,t.attachError)}}var hv="settings/menu",So=null,pv=null,mu=null,d5=new Map([["app.preferences",()=>mn.map((e)=>({dividerAbove:!1,key:e.id,label:e.title}))],["settings.open",()=>Hy().flatMap((e,t)=>e.sections.map((r,o)=>({dividerAbove:t>0&&o===0,key:r.key,label:r.label})))]]);function p5(e){return d5.get(e)?.()??[]}function J1(e,t){let r=ae();if(!r)return;Tn(r,e,t,"Settings")}function G1(e){let t=[...e.forPlacement(hv)].toSorted((o,a)=>xb.indexOf(o.level)-xb.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),d=l&&l.toLowerCase()!==o.title.toLowerCase()?l:void 0,f=s?void 0:e.disabledReason(o.id),{id:c}=o,b={children:s?p5(c).map((y)=>({destructive:!1,disabled:!1,dividerAbove:y.dividerAbove,id:`${c}:${y.key}`,run:()=>J1(c,{section:y.key}),title:y.label})):[],destructive:o.destructive===!0,disabled:!s,dividerAbove:i,id:c,run:()=>J1(c),submenuLabel:`Sections of ${o.title}`,title:o.title};if(d)b.chord=d;if(f)b.requires=f;return b})}function gv(){return So!==null}function bv(){So?.close()}function K1(e,t={}){if(So){bv();return}let r=ae();if(!r)return;let o=G1(r);if(o.length===0)return;mu=t.rerender??null;let a=Xt({label:"Settings",onClosed:(i)=>{if(So!==i)return;So=null,pv?.(),pv=null;let s=mu;mu=null,s?.()},opener:e,place:(i)=>{let s=ze(e);return{x:Math.max(4,s.right-i.width),y:s.bottom+4}},placement:"block-end span-inline-start",region:"settings",rows:o});So=a,pv=E_(()=>{let i=ae();if(!i||So!==a)return;a.setRows(G1(i))}),mu?.()}var Y1={$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"]}]}}]}}}]};T("commandbar",Y1);var m5=null;function f5(){return m5??navigator.platform.startsWith("Mac")}var X1={frozen:!1,label:"",peers:[],readOnly:!1,status:"unavailable",title:""},h5=[{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}],g5="publish.quick",b5={document:"files",project:"projects",selection:"nodes"},yv=null,hu=null,Ms=null,gu=null,fu=null,ar=null;function vv(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 y5(e){let t=e?.documentPath?.replace(/^\.\//,"");if(!t)return{reason:"Open a page to view it in a browser."};if(!x?.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=Zu(t);if(r.includes("*"))return{reason:"Catch-all routes match many pages — open a generated one instead."};let o=Fc(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((d)=>`:${d}`).join(", ")} to open one of this route's pages.`};r=r.replaceAll(/:(\w+)/g,(l,d)=>encodeURIComponent(i[d]))}let a=x.projectConfig?.build?.trailingSlash??"always";return{path:r==="/"?"/":a==="always"?`${r}/`:r}}async function Q1(){let e=y5(u.value??null);if(!("path"in e)){C.warn(e.reason,{key:ot,source:"Preview"});return}let t=_e()?p():null;if(!t?.previewSite&&!t?.buildSite){C.warn("This backend cannot preview the site.",{key:ot,source:"Preview"});return}if(t.previewSite){await v5(t.previewSite,e.path);return}await w5(t.buildSite,e.path)}async function v5(e,t){nN(),await _S(),C.info("Opening a live preview…",{key:ot,source:"Preview"});let r;try{r=await e({route:t})}catch(o){C.error(`The site could not be previewed: ${wv(o)}`,{key:ot,source:"Preview"});return}if(!r.url){C.warn("This backend serves no preview of the site.",{key:ot,source:"Preview"});return}if(r.reused){C.info(`Updated your preview tab — switch to your browser to see ${t}`,{key:ot,source:"Preview"});return}if(r.errors.length>0)C.warn(`Previewed with ${r.errors.length} problem(s): ${r.errors[0]}`,{key:ot,source:"Preview"});else C.success(`Opened a live preview of ${r.routes} page(s) — rendered from your working tree, not a build.`,{key:ot,source:"Preview"});_b(`${r.url}${t}`)}async function w5(e,t){C.info("Building the site…",{key:ot,source:"Preview"});let r;try{r=await e()}catch(a){C.error(`The site could not be built: ${wv(a)}`,{key:ot,source:"Preview"});return}if(!r.url){C.warn("The site was built, but this backend serves no preview of it.",{key:ot,source:"Preview"});return}let o=r.mode==="live";if(r.errors.length>0){let a=o?"previewed":"built";C.warn(`The site ${a} with ${r.errors.length} error(s): ${r.errors[0]}`,{key:ot,source:"Preview"})}else if(o)C.success(`Opened a live preview of ${r.routes} page(s) — rendered from your working tree, not a build.`,{key:ot,source:"Preview"});else C.success(`Built ${r.routes} page(s).`,{key:ot,source:"Preview"});_b(`${r.url}${t}`)}async function Z1(){let e=_e()?p():null;if(!e?.buildSite){C.warn("This backend cannot build the site.",{key:Os,source:"Build"});return}C.info("Building the site…",{key:Os,source:"Build"});let t;try{t=await e.buildSite()}catch(r){C.error(`The site could not be built: ${wv(r)}`,{key:Os,source:"Build"});return}if(t.errors.length>0){C.warn(`Built with ${t.errors.length} error(s): ${t.errors[0]}`,{key:Os,source:"Build"});return}C.success(`Built ${t.routes} page(s), ${t.files} file(s).`,{key:Os,source:"Build"})}var Os="project.buildSite",ot="view.openInBrowser";function wv(e){return e instanceof Error?e.message:String(e)}function x5(e){let t=e?.documentPath;if(!t)return"No document";let r=x?.projectRoot,o=t.replace(/^\.\//,"");return r&&o.startsWith(`${r}/`)?o.slice(r.length+1):o}function k5(e){if(h.layoutSelection)return"layout";let t=Vf(e);if(t)return t.replaceAll(" "," › ");let r=e?.session.selection??[],o=Me(r);if(!e||!o)return"";if(r.length>1)return`${r.length} elements`;return Ir(oe(e.doc.document,o))}function xv(){let e=globalThis.__jxPlatform;if(e==null||!("windowControls"in e))return;return e.windowControls}function $5(e){let t=[{key:"project",label:x?.name??"No project",sepBefore:!1,title:"Switch project — opens Project: Open Recent…"},{key:"document",label:x5(e),sepBefore:!0,title:"Go to a file"}],r=k5(e);if(r)t.push({key:"selection",label:r,sepBefore:!0,title:"Go to an element in this document"});return t}function S5(e){if(!e?.get("view.setWorkspace")||!e.isEnabled("view.setWorkspace"))return[];let t=h.git.status?.files.length??0;return tv.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 C5(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:vv(e,t.id)}))}function T5(e){if(!e)return[];return h5.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:!h.docks[t.dock].collapsed,title:r.title,tooltip:vv(e,t.id)}]})}function tL(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),d={destructive:r.destructive===!0,disabled:!i,dividerAbove:a,id:r.id,title:r.title};if(s)d.chord=s;if(l)d.requires=l;return d})}function P5(e){if(ar){ar.close();return}let t=ae();if(!t)return;let r=$v();ar=Xt({label:"Studio menu",onClosed:(a)=>{if(ar!==a)return;ar=null,r.menuOpen=!1},opener:e,place:()=>{let a=ze(e);return{x:a.left,y:a.bottom+4}},region:"studio",rows:tL(t),run:(a)=>{if(t.isEnabled(a))Tn(t,a,void 0,"Command Bar")}}),r.menuOpen=!0}function $v(){return Ms??=g({chord:"",csd:"none",docks:[],hasChord:!1,menuOpen:!1,menuVisible:!1,openPicker:()=>{Fg("picker")},openSegment:(e)=>{Fg(b5[e])},openSettings:(e)=>{if(!(e instanceof HTMLElement))return;K1(e,{rerender:()=>{if(Ms)Ms.settingsOpen=gv()}})},openStudioMenu:P5,presence:X1,presenceVisible:!1,primary:[],run:(e)=>{let t=ae();if(t?.isEnabled(e))Tn(t,e,void 0,"Command Bar")},segments:[],setWorkspace:(e)=>{rt("view.setWorkspace",{workspace:e},"Command Bar")},settingsOpen:!1,settingsVisible:!1,windowControl:(e)=>{xv()?.[e]()},quickDisabled:!0,quickTooltip:"",quickVisible:!1,workspace:"",workspaces:[],workspacesVisible:!1}),Ms}function rL(){let e=$v(),t=ae(),r=u.value??null,o=xv();e.csd=o?f5()?"mac":"other":"none",e.menuVisible=t!==null,e.workspaces=S5(t),e.workspacesVisible=e.workspaces.length>0,e.workspace=h.workspace;let a=g5;e.quickVisible=e.workspacesVisible&&t?.get(a)!==void 0&&t.isVisible(a),e.quickDisabled=!e.quickVisible||!t?.isEnabled(a),e.quickTooltip=t&&e.quickVisible?vv(t,a):"",e.settingsVisible=t!==null&&t.forPlacement(hv).length>0,e.settingsOpen=gv(),e.segments=$5(r),e.chord=t?.keymap.formatBinding("palette.open")??"",e.hasChord=e.chord!=="",e.primary=C5(t);let i=U1(r);if(e.presence=i??X1,e.presenceVisible=i!==null,e.docks=T5(t),ar&&t)ar.setRows(tL(t))}function sL(e,t={}){if(E5(),yv=e,xv())e.classList.add("app-region-drag");hu=ge(),hu.run(()=>{ne(()=>{h.docks.left.collapsed,h.docks.right.collapsed,h.docks.bottom.collapsed,h.git.status,h.layoutSelection,h.stylebook.selection,h.workspace,m.projectRoot,ae();let r=u.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{rL()}catch(o){console.error("command bar projection error:",o)}})}),gu=R("commandbar",$v(),e),gu.then((r)=>{fu=r})}function E5(){ar?.close(),bv(),hu?.stop(),hu=null;let e=gu;if(gu=null,fu)fu.dispose(),fu=null;else if(e)e.then((t)=>t.dispose());Ms=null,yv=null}function Pv(){if(yv)rL()}var j5="jx.ai.pendingAgentPrompt",R5=900000;function bu(){return typeof localStorage>"u"?void 0:localStorage}function yu(e){return`${j5}:${e}`}function mL(e){try{let t=bu()?.getItem(yu(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)||!Z(a)||!(Date.now()-a<=R5))return bu()?.removeItem(yu(e)),null;return{prompt:o,ts:a}}catch{return null}}function gL(e,t){try{bu()?.setItem(yu(e),JSON.stringify({prompt:t,ts:Date.now()}))}catch{}}function bL(e){return mL(e)!==null}function yL(e){let t=mL(e);if(!t)return null;try{bu()?.removeItem(yu(e))}catch{}return t.prompt}var A5="inspector.assistant",RL=null,pr=null,Ev=null,Nv=!1;function I5(){if(Nv||!pr)return;Nv=!0,u1(pr)}function OL(e){if(!e||RL===e&&pr)return;RL=e,pr=document.createElement("div"),pr.className="ai-panel-host",pr.setAttribute(qe,A5),e.textContent="",e.append(pr),m1(),Nv=!1,Ev?.stop(),Ev=ge(),Ev.run(()=>{ne(()=>{if(Nl()==="assistant")I5()}),ne(()=>{let t=m.projectRoot;if(!t||!bL(t))return;xo();let r=yL(t);if(r)requestAnimationFrame(()=>{Xy(r)})})})}function DL(){if(pr)Fe()}var O5="platform:connection",ur=null;function HL(){let e=p().subscribeConnection;if(!e)return null;let t=e(({online:r,reason:o})=>{if(r){if(ur)Lh(ur.id),ur=null,C.success("Reconnected to the Jx backend.",{source:"Backend"});return}if(ur)return;ur=C.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:O5,source:"Backend"})});return()=>{if(t(),ur)Lh(ur.id),ur=null}}var VL={$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"}}]}}]};T("navigator-dock",VL);function D5(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function F5(e){let t=e?.$map,r=v(t)?t.item:void 0;return v(r)?r:null}function qL(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,d,f)=>{if(!(s instanceof HTMLElement)||D5(d)!=="content")return;let c=F5(f)?.key;if(n(c))r.onContent(c,s)}}).then((s)=>{if(i){s.dispose();return}a=s}),{dispose(){i=!0,a?.dispose(),a=null},update:(s)=>{o.panels=s.panels}}}var eO=null,UL=null,jv=null,ua=null;function tO(e){eO=e,Vi(),jv=qL(Xp(Ch,"left-panel"),{panels:[pO()]},{onContent:(t,r)=>{let o=ua!==null&&ua.panelId!==t;if(ua={host:r,panelId:t},o)requestAnimationFrame(()=>{if(ua?.host===r)Xp(Ch,"left-panel").scrollTop=0});queueMicrotask(()=>{if(ua?.host===r)uO()})}}),UL=ge(),UL.run(()=>{ne(()=>{h.leftTab;let t=u.value;if(t)t.doc.document,t.doc.mode,t.session.ui.canvasMode,t.session.selection.map((r)=>r.join("/")).join("|");Ds()})})}function Ds(){if(!jv)return;jv.update({panels:[pO()]}),uO()}function nO(){let e=Cp(h.leftTab);return e&&Pw(e,Yu())?e:null}function pO(){let e=nO();if(!e)return{hasHeader:!1,key:h.leftTab,level:"",region:"",title:""};return{hasHeader:!0,key:e.id,level:e.level,region:jA(e.id),title:e.title}}function _5(){let e=u.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 uO(){let e=eO,t=ua;if(!e||!t)return;let r=nO();if((r?.id??h.leftTab)!==t.panelId)return;try{ZL(e,r,t.host)}catch(o){console.error("left-panel render error:",o);try{t.host.textContent="",delete t.host._$litPart$,ZL(e,r,t.host)}catch(a){console.error("left-panel retry failed:",a)}}}function ZL(e,t,r){if(!t){io(Mu(r,{message:`No Navigator panel is registered as "${h.leftTab}".`}),r);return}let o=_5(),a={deps:e,doc:o,rerender:Ds},i=o===null?t.requiresDocument:void 0;if(io(i===void 0?t.render(a):Mu(r,{actions:[Rc()],message:i}),r),i===void 0)t.afterRender?.(a,r)}function Lv(e,t,r,o){let a=NN(e,o,r);return{drop:{cursor:a,dragSeq:t,kind:"drop"},move:{cursor:a,dragSeq:t,kind:"dragMove"}}}function Rv(e){return{x:e.current.input.clientX,y:e.current.input.clientY}}function Av(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 xO(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 kO=250;function Iv(e,t,r){let o=Rb(e,t,r);return{host:e,label:xO(NL(e),t,r),seq:o,src:t,srcData:r}}function fO(e,t){GS(t.x,t.y);let r=Ib(t);if(r===e.host){if(r){let{rect:i,scale:s}=ql(r);Bc(r,Lv(t,e.seq,s,i).move)}return}if(e.host)Bc(e.host,{dragSeq:e.seq,kind:"dragEnd"});if(!r){e.host=null;return}e.host=r,e.seq=Rb(r,e.src,e.srcData);let{rect:o,scale:a}=ql(r);Bc(r,Lv(t,e.seq,a,o).move)}function z5(e,t){let r=Ib(t);if(r&&r!==e.host){if(e.host)Bc(e.host,{dragSeq:e.seq,kind:"dragEnd"});e.host=r,e.seq=Rb(r,e.src,e.srcData)}if(!r){if(e.host)Bc(e.host,{dragSeq:e.seq,kind:"dragEnd"});qw(e.seq),oh();return}let{rect:o,scale:a}=ql(r);Bc(r,Lv(t,e.seq,a,o).drop);let{seq:i}=e;setTimeout(()=>{if(JS()===i)oh(),Gw(r)},kO)}function B5(e){if(e.host)Bc(e.host,{dragSeq:e.seq,kind:"dragEnd"}),Gw(e.host);qw(e.seq),oh()}function V5(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 $O(){let e=null,t=null;return xL((r)=>{if(!t||e?.host===r)return;if(e){if(e.host)Bc(e.host,{dragSeq:e.seq,kind:"dragEnd"});e.host=r,e.seq=Rb(r,e.src,e.srcData);return}e=Iv(r,t.src,t.srcData)}),Ks({onDrag({source:r,location:o}){let a=Av(r.data);if(!a)return;let i=Rv(o);if(e){fO(e,i);return}let s=Ib(i);if(s)e=Iv(s,a,r.data),hL(e.label,i.x,i.y),fO(e,i)},onDragStart({source:r,location:o}){let a=Av(r.data);if(!a)return;t={src:a,srcData:r.data};let i=Rv(o),s=Ib(i);e=s?Iv(s,a,r.data):null,hL(e?e.label:xO(u.value,a,r.data),i.x,i.y)},onDrop({source:r,location:o}){if(!Av(r.data))return;t=null;let i=Rv(o);if(!e){oh();return}if(pL(e.seq)){let{host:s,seq:l}=e;e=null,setTimeout(()=>{if(JS()!==l)return;if(s)Bc(s,{dragSeq:l,kind:"dragEnd"}),Gw(s);qw(l),oh()},kO);return}if(V5(o))B5(e);else z5(e,i);e=null}})}var SO={$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 →"}}}]}}}]}]};T("new-project",SO);function CO(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 q5(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function TO(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[c,b]of i){let w=(c==="creds-island"?e.islands.creds:c==="managed-island"?e.islands.managed:e.islands.model)();if(w&&w.parentNode!==b)b.append(w)}},l=g({...CO(e.view),...e.actions,browse:()=>{e.actions.browse()},closed:o}),d=null,f=R("new-project",l,t,{onNodeCreated:(c,b,y)=>{let w=q5(y);if(c instanceof HTMLElement&&w.endsWith("-island"))i.set(w,c),s()}}).then(async(c)=>{d=c;let b=c.root;if(a())return c.dispose(),b;if(await Jt(b),a())return b;return(b.querySelector('dialog[part="dialog"]')??b).setAttribute(qe,ft("dialog","new-project")),Pt(b),s(),b});return{close(){let c=d?.root;if(c instanceof HTMLElement)Nt(c);d?.dispose(),d=null,i.clear(),t.remove(),o()},focusName(){let c=d?.root;if(!(c instanceof HTMLElement))return;requestAnimationFrame(()=>{c.querySelector('[part="dialog"]')?.scrollTo(0,0),c.querySelector('[part="name"] [part="input"]')?.focus()})},host:t,ready:f,update(c){Object.assign(l,CO(c)),s()}}}var U5=/^(?:[a-zA-Z]:[/\\]|\/)/,fa="",bn="",wu=!0,vu=[],Ov=null,$t="",ma=!1;function EO(){fa="",bn="",wu=!0,vu=[],Ov=null,$t="",ma=!1}function NO(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)=>{Ov=o;for(let a of o)r.add(a.owner)})]).then(()=>{vu=[...r].toSorted((o,a)=>o.localeCompare(a)),bn||=vu[0]??"",e()})}function J5(){return p().createDestination==="repo"?"Repository":"Directory"}function jO(e){if($t="",p().createDestination==="repo"){if(!bn.trim())return $t="Choose an owner for the repository",null;if(!e.trim())return $t="Repository name is required",null;return{kind:"repo",owner:bn.trim(),private:wu,repo:e.trim()}}let t=fa.trim();if(!t)return $t="Choose a location for the project folder",null;if(!U5.test(t))return $t="Location must be an absolute path",null;if(!e.trim())return $t="Directory name is required",null;return{kind:"path",parent:AO(t)}}function AO(e){return e.replace(/[/\\]+$/,"")||e}function LO(e,t){let r=e.includes("\\")&&!e.includes("/")?"\\":"/";return e.endsWith("/")||e.endsWith("\\")?`${e}${t}`:`${e}${r}${t}`}function DO(e,t){if(e.kind==="repo")return`${e.owner}/${e.repo||t.trim()}`;return LO(e.parent,t.trim())}function G5(e){let t=e.trim()||"…";if(p().createDestination==="repo")return`${bn.trim()||"…"}/${t}`;let r=AO(fa.trim());return r?LO(r,t):`…/${t}`}function K5(e){let t=`${bn.trim()}/${e.trim()}`.toLowerCase();return(Ov??[]).some((r)=>r.fullName.toLowerCase()===t)}function _O(e){let t=p(),r=t.createDestination==="repo";return{browseLabel:ma?"Choosing…":"Browse…",browsing:ma,canBrowse:te(t.pickDirectory),destination:r?"repo":"path",error:$t,owner:bn,owners:vu.map((o)=>({label:o,value:o})),parent:fa,parentPlaceholder:t.pickDirectory?"Choose a folder to create the project in":"/absolute/path/to/your/projects",preview:G5(e),previewLabel:r?"Repository":"Creates",repoTaken:r&&K5(e)?`${bn}/${e.trim()} already exists — choose another name.`:"",slugLabel:J5(),visibility:wu?"private":"public"}}function VO(e){fa=e,$t=""}function qO(e){bn=e,$t=""}function JO(e){wu=e!=="public"}async function GO(e){let t=p();if(!t.pickDirectory||ma)return;ma=!0,e();try{let r=await t.pickDirectory();if(r)fa=r,$t=""}catch(r){$t=Q(r)||"The folder could not be chosen. Type its path into Location instead."}finally{ma=!1,e()}}var ha="",Su=1,Cu=20,yn="limit",ju=3,Fu="",Fs="nearest",_u=!0,xu="",Hu="",zu=!1,Bu=25,ga="",XO=!1;function QO(){ha="",Su=1,Cu=20,yn="limit",ju=3,Fu="",Fs="nearest",_u=!0,xu="",Hu="",zu=!1,Bu=25,ga="",XO=!1}var ZO=null,YO=null;function Y5(){return YO??=nu({getModel:()=>xu||Yl(),onChange:(e)=>{xu=e},requestRender:()=>ZO?.(),width:"fill"}),YO}function eM(){return Y5().render()}function X5(){if(yn==="all")return{mode:"all"};if(yn==="explicit"){let e=Fu.split(",").map((t)=>Math.trunc(Number(t.trim()))).filter((t)=>Number.isFinite(t)&&t>0);if(e.length>0)return{mode:"explicit",rounding:Fs,widths:e}}return{count:ju,mode:"limit",rounding:Fs}}function tM(){return p().createDestination!=="repo"}function Q5(e){return e.toLowerCase().replaceAll(/[^a-z0-9]+/g,"-").replaceAll(/^-|-$/g,"")}function rM(e){let t=null;try{t=new URL(ha.trim())}catch{t=null}if(!t||t.protocol!=="http:"&&t.protocol!=="https:")return ga="Enter a valid URL (e.g. https://example.com)",e.rerender(),!1;return ga="",!0}function Z5(e){let t;try{t=new URL(ha.trim())}catch{return ga="Enter a valid URL (e.g. https://example.com)",e.rerender(),null}if(t.protocol!=="http:"&&t.protocol!=="https:")return ga="The URL must start with http:// or https://",e.rerender(),null;let r=e.resolveDestination();if(!r)return null;return{aiComponents:_u,breakpoints:X5(),depth:Su,directory:DO(r,e.form.directory),maxPages:Cu,model:xu,name:e.form.name.trim(),prompt:Hu.trim(),minFidelity:Bu,url:t.href,verify:tM()&&zu}}function aM(e){if(!p().importSite)return;let t=Z5(e);if(!t)return;oN(t),e.onHandoff(t)}function sM(){return"Import Site"}function eK(){if(yn==="all")return"Every breakpoint the site declares becomes a canvas size. Real sites often declare nine.";if(yn==="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 lM(e){return ZO=e.rerender,{aiNaming:_u,breakpointCount:String(ju),breakpointHint:eK(),breakpointMode:yn,breakpointModes:[{label:"Limit to",value:"limit"},{label:"Custom widths",value:"explicit"},{label:"Keep all",value:"all"}],breakpointRounding:Fs,breakpointValue:yn==="limit"?"count":yn==="explicit"?"widths":"none",breakpointWidths:Fu,canVerify:tM(),depth:String(Su),error:ga,maxBreakpoints:String(d$),maxDepth:String(md),maxPages:String(Cu),minFidelity:String(Bu),prompt:Hu,roundings:[{label:"nearest",value:"nearest"},{label:"round down",value:"down"},{label:"round up",value:"up"}],url:ha,verify:zu}}function cM(e,t){if(ha=t,e.form.name.trim())return;try{let r=new URL(ha).hostname.replace(/^www\./,"");if(r){if(e.form.name=r,!XO)e.form.directory=Q5(r)}}catch{}}function dM(e){Su=Math.trunc(Number(e))||0}function pM(e){Cu=Math.trunc(Number(e))||1}function uM(e){yn=e}function mM(e){ju=Math.trunc(Number(e))||3}function fM(e){Fu=e}function hM(e){Fs=e}function gM(e){_u=e}function bM(e){zu=e}function yM(e){let t=Math.trunc(Number(e));Bu=Number.isNaN(t)?0:Math.min(100,Math.max(0,t))}function vM(e){Hu=e}var mr=null,Je={directory:"",name:""},at="starter",vn="source",en="",Mv=!1,_s="",kn="",Co="",_v="";function tK(e){kn=Q(e),_v=yA(e)??""}var fr=!1,qu=[],Dv=null,Uu=!0,wM=null;function ba(){if(mr)Re()}function nK(){return wM??=bd({onSaved:ba,requestRender:ba}),wM}var xM=null;function Hv(){return xM??=yd({requestRender:ba}),xM}function kM(){if(zb())return!0;return Hv().ensureProbe(),!1}function zv(e){if(mr)return Promise.resolve(null);Je={directory:"",name:""},at=e?.tab??"starter",vn="source",en="",Mv=!1,_s="",kn="",Co="",_v="",fr=!1,qu=[],Uu=!0,QO(),EO();let t=p();if(NO(ba),t.listStarters)t.listStarters().then((r)=>{if(qu=r,!Mv)en=r[0]?.id??"";ba()}).catch(()=>{});return new Promise((r)=>{Dv=r,mr=TO({actions:{browse:()=>{GO(ba)},closed:()=>{CM(null)},confirm:sK,pickCard:iK,pickTab:(o)=>{if(fr)return;at=o,kn="",Re()},secondary:cK,setAgentPrompt:(o)=>{_s=o},setAiNaming:gM,setBreakpointCount:mM,setBreakpointMode:(o)=>{uM(o),Re()},setBreakpointRounding:hM,setBreakpointWidths:fM,setDepth:dM,setImportPrompt:vM,setMaxPages:pM,setMinFidelity:yM,setName:oK,setOwner:(o)=>{qO(o),Re()},setParent:(o)=>{VO(o),Re()},setSlug:aK,setUrl:(o)=>{cM(Ju(),o),Re()},setVerify:(o)=>{bM(o),Re()},setVisibility:(o)=>{JO(o),Re()}},islands:{creds:()=>nK().render(),managed:()=>Hv().render(),model:()=>eM()},layer:tt("dialog"),view:jM()})})}function Re(){mr?.update(jM())}function CM(e){let t=mr,r=Dv;mr=null,Dv=null,fr=!1,r?.(e),t?.close()}function TM(e){CM(e)}async function $M(e){let{adopted:t,error:r,openedElsewhere:o}=await ro(e.root,{getTab:()=>null});if(!t&&!o)C.warn("Created the project, but could not open it here.",r===null?{source:"New Project"}:{detail:r,source:"New Project"});TM(e)}function PM(e){return e.toLowerCase().replaceAll(/[^a-z0-9]+/g,"-").replaceAll(/^-|-$/g,"")}function rK(){switch(at){case"import":return"Import";case"agent":return"Agent";default:return en?`Starter site · ${qu.find((e)=>e.id===en)?.name??en}`:"Start from scratch"}}function Ju(){return{form:Je,onHandoff:(e)=>{TM(null),dN(e)},rerender:Re,resolveDestination:()=>EM()}}function EM(){if(!Je.name.trim())return Co="Project name is required",Re(),mr?.focusName(),null;if(!Je.directory.trim())Je.directory=PM(Je.name);let e=jO(Je.directory);if(!e)return Co="",Re(),mr?.focusName(),null;return e}function oK(e){if(Je.name=e,Co="",!Je.directory)Uu=!0;if(Uu)Je.directory=PM(Je.name);Re()}function aK(e){Je.directory=e,Uu=!1,Re()}function iK(e){en=e,Mv=!0,kn="",Re()}function sK(){if(vn==="source"){lK();return}if(at==="import"){aM(Ju());return}if(fr)return;if(at==="agent"){Fv({template:"blank"},async(e)=>{gL(e.root,_s.trim()),await $M(e)});return}Fv(en?{starter:en}:{template:"blank"},$M)}function lK(){if(at==="import"&&!rM(Ju()))return;if(at==="agent"&&!_s.trim()){kn="Describe the site you want the agent to build",Re();return}vn="params",kn="",Re()}function cK(){if(fr)return;vn="source",kn="",Co="",Re()}async function Fv(e,t,r=!1){let o=EM();if(!o)return;fr=!0,kn="",Co="",Re();try{let a=await p().createProject({...Je,destination:o,...e});await t(a)}catch(a){if(fr=!1,tK(a),Re(),!r&&await Em(a))await Fv(e,t,!0)}}function NM(){if(vn==="params")return"params";if(at==="import")return kM()?"import":"gate";if(at==="agent")return kM()?"agent":"gate";return"starter"}function dK(){let e=Hv().canOffer()?"Connect Cloudflare, or add an OpenAI-compatible API key, to continue.":"Add an OpenAI-compatible API key to continue.";return at==="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 pK(){if(vn==="source")return NM()==="gate"?"":"Next";if(at==="import")return sM();if(fr)return"Creating…";return at==="agent"?"Create & Start Agent":"Create Project"}function uK(){let e=qu.map((t)=>({art:"thumb",id:t.id,name:t.name,selected:en===t.id,tagline:t.tagline,thumbnail:t.thumbnail,title:t.description}));return e.push({art:"blank",id:"",name:"Start from scratch",selected:en==="",tagline:"An empty site with one page",thumbnail:"",title:""}),e}function jM(){let e=p(),t=_O(Je.directory),r=lM(Ju());return{agentPrompt:_s,aiNaming:r.aiNaming,body:NM(),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:uK(),confirmLabel:pK(),contextLabel:rK(),depth:r.depth,destination:t.destination,destinationError:t.error,error:kn,errorInstallUrl:_v,gateIntro:dK(),headline:vn==="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:Je.name,nameError:Co,note:at==="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:vn==="params"?"Back":"",showTabs:vn==="source",slug:Je.directory,slugLabel:t.slugLabel,tab:at,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 SM=["starter","import","agent"];function mK(){return[{args:{additionalProperties:!1,properties:{tab:di(SM,"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:Vn("project.new",t,"tab",SM);zv(r===void 0?{}:{tab:r})},title:"New Project…"}]}function RM(e){e.registerAll(mK())}var AM={$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"}]}]}}]}}}]}]}}]}}]};T("seo",AM);function Hs(e){return e.trim()===""?"unset":"text"}function IM(e){return{documentLabel:e.documentLabel,fields:e.fields.map((t)=>({...t,valueState:Hs(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:Hs(e.description),serpDescUnset:e.descriptionUnset,serpTitle:e.title,socialDesc:e.socialDescription,socialDescState:Hs(e.socialDescription),socialDescUnset:e.socialDescriptionUnset,socialDomain:e.domain,socialDomainState:Hs(e.domain),socialImage:e.image,socialImageState:e.image===""?"unset":"image",socialTitle:e.socialTitle,socialTitleState:Hs(e.socialTitle),socialTitleUnset:e.socialTitleUnset,warnings:e.warnings,warningsState:e.warnings.length>0?"list":"none"}}function LM(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({...IM(e.view),browse:(d,f)=>{if(f instanceof HTMLElement)e.onBrowse(d,f)},closed:o,commit:(d,f)=>{e.onCommit(d,f)},edit:(d,f)=>{e.onEdit(d,f)},openDonor:(d)=>{e.onOpenDonor(d)},upload:(d)=>{e.onUpload(d)}}),i=()=>r,s=null,l=R("seo",a,t).then(async(d)=>{s=d;let f=d.root;if(i())return d.dispose(),f;if(await Jt(f),i())return f;return(f.querySelector('dialog[part="dialog"]')??f).setAttribute(qe,ft("dialog","seo")),Pt(f),f});return{close(){let d=s?.root;if(d instanceof HTMLElement)Nt(d);s?.dispose(),s=null,t.remove(),o()},host:t,ready:l,update(d){Object.assign(a,IM(d))}}}function MM(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 Ku(e){return`No ${e.label.toLowerCase()}`}function hK(e){let t=lE(e.value),r=MM(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:Jf(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:Ku(e),value:e.value}}var DM=new Map([...Gy,...Ky].map((e)=>[e.key,e])),FM="icon";function gK(e,t,r){if(e==="viewport")return"width=device-width, initial-scale=1";return r?"/image.jpg":`${t}…`}function Bv(e,t,r,o={}){let a=Boolean(o.media);return{isMedia:a,key:e,label:t,multiline:Boolean(o.multiline),placeholder:gK(e,t,a),thumb:a&&r?Kc(r):"",value:r}}function OM(e,t){let r=DM.get(t);if(!r)return"";return String(Jy(e,r.attr,r.key)?.attributes?.content??"")}function bK(e,t,r){let o=t.trim();if(e===FM){r((i)=>A_(i,"icon",o));return}if(e==="description"){r((i)=>N_(i,o));return}let a=DM.get(e);if(!a)return;r((i)=>Yy(i,a.attr,a.key,o))}var va=new Map;function Vv(e){if(e===void 0){for(let r of va.values())clearTimeout(r);va.clear();return}let t=va.get(e);if(t!==void 0)clearTimeout(t),va.delete(e)}var wa=null,Po=null,Xu=new Map;function Wv(e){let t=e.doc.mode==="content",r=t?O_(e.doc.document,e.doc.content.frontmatter):e.doc.document;return{applyMutation:t?(o)=>dE(e,Bs,o):(o)=>{qd(e,o)},head:r.$head??[],headDoc:r}}function _M(e,t,r){let o=cE(e,t),a=Yg(o,"description"),i=Yg(o,"og:title"),s=Yg(o,"og:description"),l=Yg(o,"og:image").value.trim(),d=String(aE(r,"icon")?.attributes?.href??"");Xu=new Map;for(let f of o.fields){let{onClick:c}=MM(f);if(c)Xu.set(f.key,c)}return{crumb:o.url.crumb,description:a.value,descriptionUnset:Ku(a),documentLabel:e.documentPath??$d(e),domain:o.url.host,fields:o.fields.map(hK),groups:[{key:"page",note:"",rows:[...Gy.map((f)=>Bv(f.key,f.label,f.key==="description"?sE(t):OM(r,f.key),{multiline:f.multiline})),Bv(FM,"Icon",d,{media:!0})],title:"Search result"},{key:"og",note:"Open Graph — what a shared link shows.",rows:Ky.map((f)=>Bv(f.key,f.label,OM(r,f.key),{media:f.media,multiline:f.multiline})),title:"Social card"}],image:l?Kc(l):"",socialDescription:s.value,socialDescriptionUnset:Ku(s),socialTitle:i.value,socialTitleUnset:Ku(i),title:Yg(o,"title").value,warnings:o.warnings}}function Bs(){if(!wa||!Po)return;let{head:e,headDoc:t}=Wv(Po);wa.update(_M(Po,t,e))}function Qu(e,t){if(Vv(e),!Po)return;bK(e,t,Wv(Po).applyMutation),Bs()}function yK(e){bS((t)=>Qu(e,t))}function vK(e,t){gS(t,(r)=>Qu(e,r),{images:!0})}function wK(e){if(Po=e,!wa){let{head:t,headDoc:r}=Wv(e);wa=LM({layer:tt("dialog"),onBrowse:vK,onClosed:xK,onCommit:Qu,onEdit:(o,a)=>{Vv(o),va.set(o,setTimeout(()=>{va.delete(o),Qu(o,a)},jC))},onOpenDonor:(o)=>{Xu.get(o)?.()},onUpload:yK,view:_M(e,r,t)})}Bs(),aD(cE(e,e.doc.document),e.documentPath??void 0)}function xK(){Vv();let e=wa;wa=null,Po=null,Xu=new Map,e?.close()}function kK(){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=u.value;if(!e)throw RangeError('command "document.openSeo" needs an open document');wK(e)},title:"Search Appearance"}]}function HM(e){e.registerAll(kK())}var $K="See docs/framework/concepts/accessibility.";function Ca(e,t){let r=Zc(e),o=t in r?r[t]:e[t];if(o===void 0||o===null)return{kind:"absent"};if(Ie(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 $a(e,t){let r=Ca(e,t);return r.kind==="text"&&r.text.trim()!==""?r.text:null}function Ge(e,t){return Ca(e,t).kind!=="absent"}var Sa="bound";function hr(e){let t=Ca(e,"role");if(t.kind==="bound")return Sa;return t.kind==="text"?t.text.trim().toLowerCase().split(/\s+/)[0]:null}function nm(e){let t=Ca(e,"id");if(t.kind==="bound")return Sa;return t.kind==="text"&&t.text!==""?t.text:null}function Ct(e,t){let r=Ca(e,t);return r.kind==="bound"||r.kind==="text"&&r.text.trim()!==""}function om(e){let t=e.textContent;if(n(t)){if(t.trim()!=="")return!0}else if(t!==void 0&&t!==null)return!0;if(Ct(e,"aria-label")||Ge(e,"aria-labelledby"))return!0;if(To(e)==="img"&&(Ct(e,"alt")||Ct(e,"title")))return!0;if(To(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(S(a)&&om(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)=>_n(a)&&om(a))}var SK=new Set(["button","checkbox","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","switch","tab","treeitem"]),CK=new Set(["combobox","listbox","searchbox","slider","spinbutton","textbox"]),TK=new Set(["button","reset","submit"]),BM=new Map([["menuitem",["menu","menubar"]],["menuitemcheckbox",["menu","menubar"]],["menuitemradio",["menu","menubar"]],["option",["listbox"]],["tab",["tablist"]]]),PK=new Set([...BM.values()].flat());function*xa(e,t=[],r=[],o=[]){yield{node:e,path:t,roles:r,tags:o};let a=[...r,hr(e)],i=[...o,To(e)],{children:s}=e;if(Array.isArray(s)){for(let[l,d]of s.entries())if(S(d))yield*xa(d,[...t,"children",l],a,i)}else if(v(s)&&_n(s.map))yield*xa(s.map,[...t,"children","map"],a,i);if(_n(e.map))yield*xa(e.map,[...t,"map"],a,i);if(v(e.cases)){for(let[l,d]of Object.entries(e.cases))if(S(d))yield*xa(d,[...t,"cases",l],a,i)}}function EK(e){return e.some((t)=>t.includes("-"))}function tn(e,t,r,o,a,i="error"){return{criterion:a,detail:`${o} ${$K}`,message:r,path:t,rule:e,severity:i}}function zM(e,t,r){if(r.includes("label"))return!0;if(e===Sa||t.bound)return!0;return e!==null&&t.ids.has(e)}function NK(e,t){let{node:r,path:o,tags:a}=e,i=To(r),s=hr(r);if(s==="bound")return null;if(Ct(r,"aria-label")||Ge(r,"aria-labelledby")||Ct(r,"title"))return null;let d=$s(r,"the control"),f=(b)=>tn("interactive-unnamed",o,`${d} 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"),c=jK(r,i,t,a);if(c==="named"||c==="exempt")return null;if(s!==null&&SK.has(s))return om(r)?null:f("Give it text content, or an aria-label.");if(s!==null&&CK.has(s))return f("Give it an aria-label, or aria-labelledby naming its visible label.");if(s!==null)return null;if(i==="button"||i==="summary"||i==="a"&&Ge(r,"href"))return om(r)?null:f("Give it text content, or an aria-label.");if(c==="unnamed")return f("Give it a <label for> naming its id, or an aria-label.");if(c==="unnamed-value")return f("Give it a value, or an aria-label.");if(c==="unnamed-alt")return f("Give it an alt, or an aria-label.");return null}function jK(e,t,r,o){if(t==="area"){if(!Ge(e,"href"))return"none";return Ct(e,"alt")?"named":"unnamed-alt"}if(t==="select"||t==="textarea")return zM(nm(e),r,o)||Ct(e,"placeholder")?"named":"unnamed";if(t!=="input")return"none";let a=($a(e,"type")??"text").toLowerCase();if(a==="hidden"||Ge(e,"type")&&$a(e,"type")===null)return"exempt";if(TK.has(a))return Ct(e,"value")?"named":"unnamed-value";if(a==="image")return Ct(e,"alt")?"named":"unnamed-alt";return zM(nm(e),r,o)||Ct(e,"placeholder")?"named":"unnamed"}var RK=new Set(["select","jx-select"]);function AK(e){let{node:t,path:r,tags:o}=e,a=To(t);if(!a.includes("-")||!o.some((i)=>RK.has(i)))return null;return tn("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 IK(e){let{node:t,path:r}=e;if(To(t)!=="img")return null;let o=hr(t);if(o==="bound"||o==="presentation"||o==="none")return null;if(Ge(t,"alt")||Ct(t,"aria-label")||Ge(t,"aria-labelledby"))return null;return tn("img-alt-missing",r,`${$s(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 LK=["aria-activedescendant","aria-controls","aria-describedby","aria-details","aria-errormessage","aria-flowto","aria-labelledby","aria-owns"];function OK(e,t){let{node:r,path:o}=e,a=[];for(let i of LK){let s=$a(r,i);if(s===null)continue;for(let l of s.split(/\s+/))if(l!==""&&!t.has(l))a.push(tn("aria-target-missing",o,`${$s(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 MK(e,t,r){for(let o of BM.get(t)??[]){let a=r.get(o);if(a===void 0)continue;if(a.bound)return!0;if(e===Sa&&a.ids.size>0)return!0;if(e!==null&&e!==Sa&&a.ids.has(e))return!0}return!1}function DK(e,t){let{node:r,path:o,roles:a,tags:i}=e,s=hr(r);if(s===null||s==="bound"||o.length===0||EK(i))return null;if(a.includes("bound")||MK(nm(r),s,t))return null;let l=$s(r,"the element");if(s==="tab"&&!a.includes("tablist"))return tn("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 tn("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 tn("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 FK(e){let t=[];for(let{node:r}of xa(e)){if(hr(r)!=="tab")continue;let o=Ca(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 _K(e){let{node:t,path:r}=e;if(hr(t)!=="tablist")return null;let o=FK(t);if(o===null||o.length===0||o.includes(!0))return null;return tn("tablist-none-selected",r,`${$s(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 HK(e){let{node:t,path:r}=e,o=hr(t);if(!(To(t)==="dialog"||o==="dialog"||o==="alertdialog")||o==="bound")return null;if(Ct(t,"aria-label")||Ge(t,"aria-labelledby"))return null;return tn("dialog-unnamed",r,`${$s(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 zK=new Set(["button","input","select","textarea"]);function BK(e){let{node:t,path:r}=e;if(!Ge(t,"aria-activedescendant"))return null;let o=To(t);if(zK.has(o)||o==="a"&&Ge(t,"href")||Ge(t,"tabIndex")||Ge(t,"tabindex")||Ge(t,"contenteditable"))return null;return tn("activedescendant-not-focusable",r,`${$s(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 VM(e){let t=[...xa(e)],r=new Set,o={bound:!1,ids:new Set},a=new Map,i=!1;for(let{node:l}of t){let d=hr(l);if(d!==null&&PK.has(d)){let c=a.get(d)??{bound:!1,ids:new Set},b=$a(l,"aria-owns");if(b===null)c.bound||=Ge(l,"aria-owns");else for(let y of b.split(/\s+/))if(y!=="")c.ids.add(y);a.set(d,c)}let f=nm(l);if(f===Sa)i=!0;else if(f!==null)r.add(f);if(To(l)==="label"){let c=$a(l,"for")??$a(l,"htmlFor");if(c===null)o.bound||=Ge(l,"for")||Ge(l,"htmlFor");else o.ids.add(c)}}let s=[];for(let l of t){let d=[NK(l,o),IK(l),DK(l,a),AK(l),_K(l),HK(l),BK(l)];for(let f of d)if(f)s.push(f);if(!i)s.push(...OK(l,r))}return s}function VK(e,t){if(t==="img"||t==="area")return!0;return t==="input"&&gr(e,"type")?.toLowerCase()==="image"}var WK=new Set(["input","select","textarea","button"]),qK=new Set(["button","hidden","image","reset","submit"]),UK=new Set(["click here","here","read more","more","learn more","this","link","download","continue"]);function WM(e){return e.attributes??{}}function gr(e,t){let r=WM(e)[t];return n(r)?r:null}function Js(e,t){return t in WM(e)}function Ys(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(S(o))t.push(Ys(o))}return t.join(" ").trim()}function*qv(e){yield e;let{children:t}=e;if(Array.isArray(t)){for(let r of t)if(S(r))yield*qv(r)}for(let r of Object.values(e.cases??{}))if(S(r))yield*qv(r)}function JK(e){return gr(e,"aria-label")!==null||gr(e,"aria-labelledby")!==null||Js(e,"aria-label")||Js(e,"aria-labelledby")||n(e.title)&&e.title!==""||Ys(e)!==""}function GK(e){let t=[],r=new Map,o=0,a=0,i=0;for(let s of qv(e)){i+=1;let l=n(s.tagName)?s.tagName.toLowerCase():"",d=l===""?`element ${i}`:`<${l}>`;if(VK(s,l)){let c=gr(s,"alt");if(c!==null&&/^(image|photo|picture|graphic|icon)\b/i.test(c.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:`${d}'s alt text starts by saying it is an image.`,severity:"warn"})}let f=/^h([1-6])$/.exec(l)?.[1];if(f!==void 0){let c=Number(f);if(c===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&&c>a+1)t.push({criterion:"1.3.1",detail:`An h${a} is followed by an h${c}, 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${c}.`,severity:"warn"});a=c}if(WK.has(l)){let c=gr(s,"type")?.toLowerCase()??"",b=l==="button"||qK.has(c);if(l==="input"&&!b&&!Js(s,"autocomplete")){let y=`${gr(s,"name")??""} ${gr(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:`${d} asks for personal data but names no autocomplete purpose.`,severity:"warn"})}}if(l==="a"){let c=Ys(s).toLowerCase().replaceAll(/[^a-z ]/g,"").trim();if(JK(s)&&UK.has(c))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 "${c}" is a list of identical entries.`,id:`link-vague:${i}`,message:`A link reads "${Ys(s)}", which names no destination.`,severity:"warn"});if(gr(s,"target")==="_blank"&&!/new (tab|window)/i.test(Ys(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(Z(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:`${d} 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")&&Js(s,"autoplay")&&!Js(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:`${d} 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 VM(e))t.push({criterion:s.criterion,detail:s.detail,id:`${s.rule}:${s.path.join("/")}`,message:s.message,severity:s.severity});return KK(t)}function KK(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 Xs(){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 el="Accessibility";function YK(e,t){ul((o)=>o.source===el);let r=GK(e);for(let o of r){let a={detail:`WCAG ${o.criterion} — ${o.detail}`,key:`a11y.${o.id}`,source:el,tier:"problem"};if(o.action!==void 0)a.action=o.action;if(t!==void 0)a.path=t;C(o.severity,o.message,a)}for(let o of Xs())C.info(o.message,{action:"document.checkAccessibility",detail:o.detail,key:`a11y.unavailable.${o.id}`,source:el,tier:"problem"});return r.length+Xs().length}function XK(){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=Xs().length,t=ef(el).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=u.value;if(!e)throw RangeError('command "document.checkAccessibility" needs an open document');let t=YK(e.doc.document,e.documentPath??void 0);C.success(t===Xs().length?"No accessibility problems found in this document.":`${t-Xs().length} accessibility problem(s) filed.`,{key:"a11y.run",source:el})},title:"Check Accessibility",when:(e)=>e.document.open}]}function qM(e){e.registerAll(XK())}function JM(e,t){return Wp(e)&&!Vc[e].tabStrip&&ll(t)!==e}function QK(e,t,r=h.workspace){let o=fn(e);if(!o||!JM(r,t))return[];return o.tabOrder.filter((a)=>{let i=m.tabs.get(a);return a!==t&&i!==void 0&&ll(a)!==r&&Kg(i)===r&&!i.pinned&&!i.doc.dirty})}function ZK(e,t=h.workspace){if(!Wp(t)||Vc[t].tabStrip)return null;let r=Xl(t);return fn(e)?.tabOrder.includes(r)===!0?r:null}function GM(e,t){for(let r of m.panes){if(r.id===t||r.derived)continue;let o=iE(r,e);if(o===r.activeTabId)continue;if(o)Bt(o,{focus:!1});else PC(r.id)}}function e8(){let e=h.workspace,t=m.activePaneId;for(let r of m.panes){let o=r.activeTabId;if(r.id===t||r.derived||!o||Dc(o,e))continue;Jr();try{let a=iE(r,e);if(a)Bt(a,{focus:!1});else PC(r.id)}finally{Yr()}}}function KM(e,t){let o=fn(e)?.tabOrder.find((a)=>m.tabs.get(a)?.documentPath===t);if(o&&!Dc(o))Bt(o)}function t8(){let e=u.value;return e?nE(e):!1}function YM(e){return{...e,writingOnCanvas:t8}}function n8(e,t){if(e==="styles")return t.openStyles(),!0;if(Wp(e))return t.openHome(e),!0;return!1}function XM(e,t){let r=rD(e);if(r)Bt(r);else n8(e,t);sC(e,YM(t));let o=u.value,a=o&&Dc(o.id,e)?Ql(o.id)?.id??null:null;GM(e,a)}var rl=null;function QM(e){if(rl)return UM;AC((a)=>Dc(a)),OC((a)=>r8(a,e)),MC((a)=>ZK(a));let t=ge();rl=t;let r=YM(e),o=null;return t.run(()=>{ne(()=>{let s=u.value;if(!s)return;let l=Kg(s),d=nE(s);Jr();try{let f=Ql(s.id)?.id??null;if(f!==null)for(let c of QK(f,s.id,l))Zd(c);if(sC(l,r)){if(GM(l,f),f!==null&&JM(l,s.id))e.placeHome?.(l,f)}else if(o!==null&&d!==o&&Vc[l].inspector.whileWriting===!0)Eo("right",!XL(l,d))}finally{Yr()}o=d});let a=!1,i=ne(e8,{scheduler:()=>{if(a)return;a=!0,queueMicrotask(()=>{if(a=!1,rl===t)i()})}})}),UM}function r8(e,t){let r=h.workspace,o=fn(e);if(!o||o.derived||Vc[r].tabStrip)return;if(r==="styles"){t.openStyles?.();return}if(!t.placeHome||!Wp(r))return;t.placeHome(r,e),Bt(Xl(r))}function UM(){rl?.stop(),rl=null,AC(null),OC(null),MC(null)}var ZM={$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}"}]}}]}}}]}]};T("about",ZM);function lD(e){let t=document.createElement("div");t.style.pointerEvents="auto",t.setAttribute(qe,ft("dialog","about")),e.layer.append(t);let r=!1,o=()=>{if(r)return;r=!0,e.onClosed()},a=()=>r,i=g({close:()=>d.close(),closed:o,headline:e.headline,links:e.links,packages:[],packagesState:"loading",rows:e.rows}),s=null,l=R("about",i,t).then(async(f)=>{s=f;let c=f.root;if(a())return f.dispose(),c;if(await Jt(c),a())return c;return Pt(c),c}),d={close(){if(r)return;let f=s?.root;if(f instanceof HTMLElement)Nt(f);s?.dispose(),s=null,t.remove(),o()},host:t,ready:l,update(f){if(f.rows!==void 0)i.rows=f.rows;if(f.packages!==void 0)i.packages=f.packages,i.packagesState=f.packages.length===0?"empty":"listed"}};return d}var al="Jx Studio",im="8.0.1",pD="2026-10-21T14:11:51.136Z",pm="b299a10",gm={github:"https://github.com/jxsuite/jx",docs:"https://github.com/jxsuite/jx#readme",license:"https://github.com/jxsuite/jx/blob/main/LICENSE"};var il=null;function a8(e){if(!e)return"—";let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function uD(e){let t=[{label:"Version",value:im},{label:"Build date",value:a8(pD)},{label:"Commit",value:pm}];if(e){if(t.push({label:"Channel",value:e.channel}),e.updateStatus)t.push({label:"Updates",value:e.updateStatus})}return t}async function i8(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(il===e)e.update({packages:r,rows:uD(o)})}function s8(){if(il)return;let e=lD({headline:`About ${al}`,layer:tt("dialog"),links:[{href:gm.github,label:"GitHub"},{href:gm.docs,label:"Documentation"},{href:gm.license,label:"License"}],onClosed:()=>{if(il===e)il=null},rows:uD(null)});il=e,i8(e)}function l8(){return[{id:"help.about",title:`About ${al}`,category:"Help",level:"application",menus:["commandbar/overflow","palette"],group:"9_help",run:()=>{s8()}}]}function mD(e){e.registerAll(l8())}function Tt(){return u.value}function hD(){let e=Tt();return Boolean(e&&Ln(e).active)}function c8(e){return`jx://collab/${(e.documentPath??"").replace(/^\.?\//,"")}`}function d8(){return[{id:"collab.setEnabled",title:"Collaborate: Share this document",category:"Collaborate",level:"document",menus:["palette"],group:"1_session",requires:"an open document",when:()=>Boolean(Tt()?.documentPath),args:{additionalProperties:!1,properties:{enabled:$o("True to attach a live session, false to leave it.")},required:["enabled"],type:"object"},run:(e,t)=>{let r=zi("collab.setEnabled",t,"enabled"),o=Tt();if(!o)return;if(z$(o)===r)return;B$(o,r),C.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(Tt()?.documentPath),enablement:hD,run:()=>{let e=Tt();if(!e||!z$(e))return;B$(e,!1),C.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(Tt()?.documentPath),enablement:hD,run:async()=>{let e=Tt();if(!e)return;let t=c8(e);try{await navigator.clipboard.writeText(t)}catch(r){C.error(`Could not copy the session link — ${r instanceof Error?r.message:String(r)}`,{detail:t,source:"Collaboration"});return}C.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(Tt()?.documentPath),enablement:()=>{let e=Tt();return Boolean(e&&Ln(e).peers.length>0)},args:{additionalProperties:!1,properties:{login:We("The collaborator's login, as shown on their presence chip.")},required:[],type:"object"},run:(e,t)=>{let r=Tt();if(!r)return;let o=Xn("collab.follow",t,"login"),{peers:a}=Ln(r),i=o?a.find((l)=>l.state.user.login===o):a[0];if(!i){C.warn(o?`${o} is not in this session.`:"Nobody else is in this session.",{source:"Collaboration"});return}let s=i.state.focusedPath;if(!s){C.info(`${i.state.user.login} is not in a document right now.`,{source:"Collaboration"});return}C.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(Tt()?.documentPath),run:()=>{let e=Tt();if(!e)return;let t=Ln(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."];C.info(r[0],{detail:r.join(`
|
|
501
501
|
`),source:"Collaboration"})}}]}function yD(e){e.registerAll(d8())}function vD(){return["all",...nb()]}async function p8(e){XR(e);let{openWorkspaceHome:t}=await (le("xsd7hkjw"),import("./chunks/workspace-home-xsd7hkjw.js"));t("content")}function u8(){return[{args:Se({collection:cl(eL,'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=Vn("content.showCollection",t,"collection",eL());await p8(r)},title:"Content: Show Collection"},{args:Se({layout:di(sm,`How the Content home arranges the collection it shows: ${sm.map((e)=>ow[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=Vn("content.setLayout",t,"layout",sm);Zk(r)},title:"Content: Set View"},{args:{additionalProperties:!1,properties:{query:We("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)=>{I_(Xn("content.setSearch",t,"query")??"")},title:"Content: Search Collection"},{args:Se({locale:cl(vD,'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=Vn("content.setLocale",t,"locale",vD());R_(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:()=>Qk(),title:"Content: Rescan Files"}]}function wD(e){e.registerAll(u8())}function m8(e){let t=e.replaceAll("\\","/");return t.includes("/")?t.slice(0,t.lastIndexOf("/")):"."}function Uv(e){let t=e.lastIndexOf(".");return t>0?e.slice(t).toLowerCase():""}function kD(e,t){let r=Uv(e);return r===""?`${e}${t}`:`${e.slice(0,e.length-r.length)}${t}`}async function SD(e,t){let{formatForPath:r}=await (le("yxz0kjjs"),import("./chunks/format-host-yxz0kjjs.js"));if(r(e)){let{parseSourceForPath:o}=await (le("qnab36ek"),import("./chunks/file-ops-qnab36ek.js")),a=await o(e,t);return{document:a.document,frontmatter:a.frontmatter}}return{document:JSON.parse(t),frontmatter:{}}}async function CD(e,t,r){let o={...r,...t};if(e===".json")return ko(o,null);let{formatByExtension:a,formatSerialize:i}=await (le("yxz0kjjs"),import("./chunks/format-host-yxz0kjjs.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 f8(e,t){if(Uv(e)===".json")return!0;try{let r=await SD(e,t);return await CD(Uv(e),r.document,r.frontmatter)===t}catch{return!0}}async function h8(e,t,r){let o=kD(e,r),a=[],i;try{let{document:f,frontmatter:c}=await SD(e,t);i=await CD(r,f,c)}catch(f){let{errorMessage:c}=await (le("v77xtwv7"),import("./chunks/parse-v77xtwv7.js"));return{blocker:c(f),lines:a,targetExt:r,targetPath:o,text:""}}if(r===".json"){let{validateDocOrNull:f}=await (le("ttasrbh7"),import("./chunks/jx-validate-ttasrbh7.js")),c=await f(JSON.parse(i));if(c===null)a.push("The result could not be checked against the document schema — that is not the same as "+"it being valid.");else if(c.length>0)return{blocker:`The result would not be a valid Jx document (${[...new Set(c.map((y)=>y.split(":")[0]))].join(", ")}).`,lines:a,targetExt:r,targetPath:o,text:i}}if(!await f8(o,i))a.push("This file will not read back identically after conversion.");let{loadUsages:s,usageWarning:l}=await (le("9547rg5s"),import("./chunks/references-9547rg5s.js")),d=l(await s({path:e}),"convert");if(d!==null)a.push(d);return a.push(`${e} becomes ${o}. The original file is not kept.`),{blocker:null,lines:a,targetExt:r,targetPath:o,text:i}}async function g8(e,t){let{notify:r}=await (le("kzrjr3fv"),import("./chunks/notify-kzrjr3fv.js")),{errorMessage:o}=await (le("v77xtwv7"),import("./chunks/parse-v77xtwv7.js")),a=(H,F)=>(r.error(H,{detail:F,path:e,source:"Convert"}),null),{loadFormats:i}=await (le("yxz0kjjs"),import("./chunks/format-host-yxz0kjjs.js"));await i();let s=J_(e);if(s.length===0)return a(`${e} cannot be converted to another format.`,xD);let{workspace:l}=await (le("dz7nxfhv"),import("./chunks/workspace-dz7nxfhv.js")),{commitTabBuffers:d}=await (le("3afgwvbp"),import("./chunks/monaco-buffer-3afgwvbp.js")),f=[...l.tabs.values()].find((H)=>H.documentPath===e);if(f){if(await d(f),f.doc.dirty)return a(`${e} has unsaved changes.`,y8)}let c=t??await x8(e,s);if(c===null)return null;if(!s.some((H)=>H.ext===c))return a(`${e} cannot be converted to ${c}.`,xD);let{getPlatform:b}=await (le("7v4rtd7m"),import("./chunks/platform-7v4rtd7m.js")),y=b(),w=kD(e,c);try{let H=await y.listDirectory(m8(e));if(new Set(H.map((W)=>W.path.replaceAll("\\","/").toLowerCase())).has(w.toLowerCase()))return a(`${w} already exists.`,v8)}catch(H){return a(`Could not check whether ${w} already exists.`,o(H))}let k;try{let H=await y.readFile(e);k=n(H)?H:""}catch(H){return a(`Could not read ${e}.`,o(H))}let E=await h8(e,k,c);if(E.blocker!==null)return a(`${e} cannot be converted to ${c}.`,E.blocker);let{showConfirmDialog:A}=await (le("bgyr11tr"),import("./chunks/layers-bgyr11tr.js")),{html:j}=await (le("v9gh687x"),import("./chunks/lit-html-v9gh687x.js"));if(!await A("Convert Format",j`<span
|
|
502
502
|
>Convert <strong>${e.split("/").pop()}</strong> to
|
|
503
503
|
${s.find((H)=>H.ext===c)?.label??c}?</span
|
|
@@ -529,5 +529,5 @@ ${r}`}function X8(e,t=location){let r=Y8(),o=(e.kind==="launcher"?e.launcher:voi
|
|
|
529
529
|
></div>
|
|
530
530
|
`}async function lF(e=document.body){let t=dF(e);t.textContent="",delete t._$litPart$,await aF(t),io(Z8(),t)}async function cF(e,t=document.body){let r=dF(t);r.textContent="",delete r._$litPart$,await sF(r,e)}function dF(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}fw();oM(import.meta.url);var uF={fileExists:async(e)=>{try{return await p().readFile(e),!0}catch{return!1}},loadDiff:lT,openFileInPane:Q_};function Ea(){return Uo(m.activePaneId)}function jo(e,t){if(!e)return;if(Pc(e)==="git-diff"&&t!=="git-diff")h.git.diffState=null;if(e.session.ui.canvasMode=t,e.documentPath===ln)Th(t)}async function fl(e){let t=u.value,r=ec(Kr().id),o=[...m.tabs.values()].some((i)=>i.documentPath===e);await yi(e,{paneId:r.id,preview:!0});let a=vt(r.id);if(!o&&t&&a&&a.documentPath===e)a.session.openedFrom={documentPath:t.documentPath,tabId:t.id};Uc("layers")}dR(lv);if(!_e())try{lI(I1())}catch(e){if(e instanceof uu)await cF(e.refusal);throw e}D1();g$();await lF();UO();aA();sL(Xp(Q$,"toolbar"),{closeFunctionEditor:()=>y_(),getCanvasMode:Ea,openProject:()=>lw(),openRecentProject:(e)=>yr(e),renderCanvas:()=>It(),safeRenderRightPanel:()=>nY(),saveFile:()=>Sp(),setCanvasMode:jo});v$();IA();Tk({openRecentProject:(e)=>yr(e)});await fE();var mF=uE(ui);sD(mF?.strip??document.createElement("div"));function fF(e,t){if(t==="media")$T(e);else if(t==="publish")kk(e)}QP(mF?.chrome??document.createElement("div"),{exportFile:qT,parseMediaEntries:Wr,setCanvasMode:jo,closeTab:Jg,focusHome:fF});Lw(_c);j$({isEditing:ON,renderBlockActionBar:Iy});gR({getCanvasMode:Ea,navigateToComponent:fl});LL(Iy);$L(vR);_L(dS);SL(qR);pA(async(e)=>{kw(),Ld(),Ug(),await zs(e),vr()});CL(pS);kL(mS());EL((e,t)=>{if(e)Cd(e,t);else h.stylebook.selection=null,dl(u.value,{ui:{activeSelector:null}})});document.addEventListener("pointerdown",(e)=>{if(yR(e.target))return;if(Gl().editing)Jw();if(!(e.target instanceof Node)||nd(e.target)===null)bR()},!0);function eY(){for(let e of m.tabs.values())if(e.doc.dirty||Jp(e))return!0;return!1}window.addEventListener("beforeunload",(e)=>{if(sA(),eY())e.preventDefault()});oS({renderOverlays:Z$,scheduleCanvasRender:Er});IL(Er);$O();V$({get gitDiffState(){return h.git.diffState},openFileFromTree:oY,setCanvasMode:jo,setGitDiffState:(e)=>{h.git.diffState=e}});Yk({addExistingRepo:async()=>{let e=await uk();if(e)rS().then(()=>{cr()}),yr(e.root)},cloneRepository:()=>lS({openRecentProject:yr}),openNewProject:(e)=>{zv(e)},openProject:()=>lw(),openRecentProject:(e)=>yr(e)});function tY(e){cD(e,uF),ne(()=>{let t=vt(e);if(t&&cS(t.doc.document,e))return;Er(e)}),ne(()=>{let t=vt(e),r=fn(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;h.stylebook.filter,h.stylebook.customizedOnly,Er(e)}),ne(()=>{let t=vt(e)?.session.ui.previewColorScheme;ML(t==="light"||t==="dark"?t:null,vo(e).wrap)}),ne(()=>{let t=vt(e),r=Rp(t?.session.ui.previewLocale,t?.documentPath);PL(r,vo(e).wrap)})}var Lm=new Map;ne(()=>{let e=new Set(m.panes.map((t)=>t.id));for(let[t,r]of Lm)if(!e.has(t))r.stop(),Lm.delete(t);for(let t of e){if(Lm.has(t))continue;let r=ge();Lm.set(t,r),r.run(()=>{tY(t)})}});Lk({getCanvasMode:Ea,mountAssistant:(e)=>OL(e),navigateToComponent:fl,renderCanvas:()=>It()});XE(yr);cN(f1);HL();cT({cloneRepository:()=>{lS({openRecentProject:yr})},setCanvasMode:jo,setGitDiffState:(e)=>{h.git.diffState=e}});tO({defBadgeLabel:Vk,defCategory:Ol,defaultDef:nh,getCanvasMode:Ea,navigateToComponent:fl,registerComponentsDnD:YN,registerElementsDnD:ZN,registerLayersDnD:JN,renderCanvas:()=>It(),refreshData:()=>{let e=m.activePaneId;fL(e);let t=u.value;if(t)t.session.canvas.refreshing=!0;It(e)},mountSignalsPanel:MR,setCanvasMode:jo,webdata:lv});Um("leftPanel",()=>Ds());Um("canvas",()=>It());Um("rightPanel",()=>jg());Um("seoModal",Bs);Um("chatPanel",()=>DL());Um("overlays",()=>oi());Ef();RS();q1();function nY(){jg()}OO(Gu);MO(VT);PO((e)=>{C.warn(e,{key:"collab.freeze",source:"Collaboration"})});var pF=null;function sw(){pF?.(),pF=L$({invalidateDerivedCaches:(e,t=!0)=>{AR(),qy(),Ug(e);let r=kN(e,t);if(r.scan)Ld();if(r.pages)kb(),qg();if(r.entries)kE(),AS();if(e===void 0||e.some((o)=>DT(o)))kw();xN(),pE()},onContentChange:GE,onResyncContent:KE,renderLeftPanel:vr})}var Om=new URLSearchParams(location.search),$n=Om.get("project")||Om.get("open");if(!$n)p().activate().catch((t)=>{if(!wA(t))console.error("Boot activation failed:",t)}).then(()=>{cr()});if($n)if(!($n.startsWith("/")||$n.startsWith("~")||/^[A-Za-z]:[/\\]/.test($n)))C.error(`?project= requires an absolute path (got "${$n}").`,{key:"startup.projectParam",source:"Startup"}),cr();else{cr();let t=p();(async()=>{let r=Om.get("file")||$n;try{let o=await t.resolveSiteContext($n);if(o.sitePath){if(o.sitePath)t.projectRoot=o.sitePath,await t.activate();zp(),Rm(),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}),tc(o.sitePath,o.projectConfig||null),ic(t),await hm(),await ab(),await _a(),await cm(),um(o.sitePath)}let a=Om.get("file")||(o.fileRelPath&&!o.fileRelPath.endsWith("project.json")?o.fileRelPath:null);if(!a){if(await cb(),u.value){cr(),vr();return}}if(r=a??o.fileRelPath??$n,r==="project.json"||r.endsWith("/project.json"))r=await Z_()??"project.json";let i=await t.readFile(r);if(i){let s,l,d,f=null;await Ot();let c=cn(r);if(c||!r.endsWith(".json")){let b=await or(r,i);l=b.document,{frontmatter:s}=b,d=b.mode}else({document:l,layout:f}=Es(i));if(_i({id:r,documentPath:r,document:l,...s!=null&&{frontmatter:s},layout:f,sourceFormat:c?.name??null}),d==="content"&&u.value)u.value.doc.mode="content";if(r==="project.json"&&u.value)u.value.session.ui.canvasMode="stylebook";cr()}sx(m.projectRoot)}catch(o){C.error(`Could not open ${r||"the project"}.`,{detail:Q(o),path:r,source:"Open File"})}})()}else rY(),cr(),sw();AD().then(()=>{Pv(),cr()});rS().then(()=>{cr()});Bd().then(()=>{m$(),cr()});AA().then(()=>{cr()});Ap(()=>{cr()});OA();globalThis.addEventListener("beforeunload",()=>{DA()});function vr(){Ds()}function rY(){return BE()}async function lw(e="thisWindow"){if(pk()){let o=await mk();if(!o)return"cancelled";return rS().then(()=>{cr()}),yr(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 oE("Opening another project"))return"cancelled";let r=await zE({renderLeftPanel:vr,resetProjectCaches:hF});return sw(),r?"opened":"cancelled"}function hF(){KR(),eD(),TN(),qg(),kE(),AS(),gT(),Eh(),Zx(),k$(),kw(),IT()}async function yr(e){let t=Us({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(x&&r.openProjectInNewWindow){await r.openProjectInNewWindow(e),t.done("Opened in another window");return}if(!await oE("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,pb(),ax(),hF(),$h(),Ot(),ic(r);let o=await r.readFile("project.json"),a=JSON.parse(o);U$(),zp(),Rm(),id({...x,dirs:new Map,expanded:new Set,isSiteProject:!0,name:a.name||e.split("/").pop(),projectConfig:a,projectRoot:e,searchQuery:"",selectedPath:null}),tc(e,a),t.step("Sync with the remote"),await hm(),t.step("Install dependencies"),await ab(),t.step("Read the project"),await cm(),await _a(),uw(wn().name,e),vr(),t.step("Open the home page"),await cb(),sw(),t.done(`Opened ${wn().name}`),um(e)}catch(r){Y_(e),Pv(),cr(),t.log(Q(r)),t.fail(`Could not open the project at ${e}.`,{path:e})}}function oY(e){return yi(e)}var gF=(e)=>({applyTransform:()=>qs(e),canvasMode:Uo(e.paneId),panX:e.panX,panY:e.panY,setPan:(t,r)=>{e.panX=t,e.panY=r,e.needsCenter=!1}}),de=Hg({getContext:H1({aiConfigured:zb,aiStreaming:iu,aiWaiting:Zy,canvasMode:Ea,isCaretActive:TL,isModalOpen:Wb,platform:()=>_e()?p():null})});MP(de,{buildSite:()=>Z1(),openInBrowser:()=>Q1(),openProject:lw,saveDocument:async()=>{let e=u.value;if(!e)return;if(await Qd(e),await Sp(e),!Jp(e))Cx(e.id)}},gF);G$(de,{openFile:yi,openFileInPane:async(e,t)=>{await Q_(e,t),KM(e,t)}});de.registerAll(dD(uF));var bF={openHome:(e)=>{xk(e)},openStyles:()=>{dn()},placeHome:_k,setInspectorTab:(e)=>ku(e)};QM(bF);function yF(e){XM(e,bF)}VE(yF);dA(de,{panelAvailable:(e)=>{let t=Cp(e);return t?t.when?.(de.context())??!0:!0},inspectorTab:()=>Nl(),restingInspectorTab:()=>$k(),setInspectorTab:(e)=>ku(e),showWorkspace:yF});de.registerAll(qP({closeTab:Jg,focusHome:fF,setCanvasMode:jo}));KN(de,{getCanvasMode:Ea,renderPane:It,setCanvasMode:jo,setOpenPopover:Ak,setOpenDialog:Nk,setResolvingOpen:rE});var aY=bE({notify:C,redefineOnCanvases:X$,workspace:m});UT((e,t,r)=>{if(rT(e),AS(),fD(e,Fl(r)))vr();if(aY(e,t),Ab(e,t))Xf(),vr()});de.registerAll(_w());_R();eS(de);OR(de);HM(de);qM(de);eN(de);de.registerAll(kR());CR(fl);$R(de,{renderLeftPanel:vr});PR(de);DR(de);iT(de);CP(de);YT(de);Wj(de);wD(de);TD(de);xE(de);VD(de);XD(de);rF(de);RM(de);uR(de);CT(de);rR(de);Mx(de);BD(de);mD(de);yD(de);de.registerAll(v1());$y(de,{convertToComponent:tm,navigateToComponent:fl});de.registerAll(Rk());DP(de,gF);BL(()=>({chords:mR(de.keymap,F1,_1),mac:de.keymap.mac}),(e)=>de.keymap.onChange(e));qD({registry:de,seedAssistantMessages:h1,seedPublishConnected:Ck});export{eY as hasUnsavedTabs};
|
|
531
531
|
|
|
532
|
-
//# debugId=
|
|
532
|
+
//# debugId=9A2D205E804000A564756E2164756E21
|
|
533
533
|
//# sourceMappingURL=studio.js.map
|