No widgets to display"),K=u("
");function V(){const[v,y]=b([]),[o,k]=b({templateId:null,widgetPlacements:[]}),[g,S]=b(""),W=D(()=>{const e=o().templateId?$(o().templateId):null;if(!e)return 1;const l=e.template?.width||800,d=e.template?.height||600,i=window.innerWidth-40,w=window.innerHeight-40,h=i/l,x=w/d;return Math.min(h,x)*.98});return G(()=>{try{const l=new URLSearchParams(window.location.search).get("config");if(l){const d=decodeURIComponent(l),i=JSON.parse(d);Array.isArray(i)?y(i):(i.widgets&&y(i.widgets),i.grid&&k(i.grid))}else S("No configuration found in URL")}catch(e){console.error("Error loading config:",e),S("Failed to load dashboard configuration")}}),(()=>{var e=p(K),l=e.firstChild,[d,i]=c(l.nextSibling),w=d.nextSibling,[h,x]=c(w.nextSibling),N=h.nextSibling,[R,H]=c(N.nextSibling);return e.$$click=()=>window.location.reload(),r(e,"width","100vw"),r(e,"height","100vh"),r(e,"position","fixed"),r(e,"top","0"),r(e,"left","0"),r(e,"background","var(--bg, #fff)"),r(e,"overflow","hidden"),r(e,"display","flex"),r(e,"padding","20px"),s(e,a(f,{get when(){return g()},get children(){var t=p(Y),_=t.firstChild,m=_.nextSibling;return r(t,"padding","2rem"),r(t,"color","var(--gray)"),s(m,g),t}}),d,i),s(e,a(f,{get when(){return P(()=>!g())()&&v().length>0},get children(){var t=p(q),_=t.firstChild,[m,M]=c(_.nextSibling),F=m.nextSibling,[U,j]=c(F.nextSibling);return r(t,"position","relative"),s(t,a(f,{get when(){return o().templateId},children:()=>{const n=$(o().templateId);return n?a(z,{get component(){return n.Component}}):null}}),m,M),s(t,a(J,{get each(){return v()},children:n=>a(X,{config:n,locked:!0})}),U,j),O(n=>{var I=o().templateId?`${$(o().templateId)?.template.width||800}px`:"100%",C=o().templateId?`${$(o().templateId)?.template.height||600}px`:"100%",E=`scale(${W()})`;return I!==n.e&&r(t,"width",n.e=I),C!==n.t&&r(t,"height",n.t=C),E!==n.a&&r(t,"transform",n.a=E),n},{e:void 0,t:void 0,a:void 0}),t}}),h,x),s(e,a(f,{get when(){return P(()=>!g())()&&v().length===0},get children(){var t=p(B);return r(t,"padding","2rem"),r(t,"color","var(--gray)"),t}}),R,H),L(),e})()}A(["click"]);export{V as Preview};