create-fs-app 3.0.0 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,114 @@
1
+ /* <cfa-welcome>, the start page made by create-fs-app (https://github.com/Om-jannu/create-fs-app). Generated file. */
2
+ /* eslint-disable */
3
+ var ue="https://github.com/Om-jannu/create-fs-app",me="https://create-fs-app.vercel.app/docs",fe="'CFA Display','Barlow Condensed','Avenir Next Condensed','Roboto Condensed','Arial Narrow',sans-serif",s=$=>String($??"").replace(/[&<>"']/g,e=>`&#${e.charCodeAt(0)};`),o=$=>`<code>${s($).replace(/\//g,"/<wbr>")}</code>`,be=0,V=!1;async function z($,e){let n=new AbortController,l=setTimeout(()=>n.abort(),e),i=performance.now();try{let c=await fetch($,{signal:n.signal,cache:"no-store",headers:{accept:"application/json"}}),m=Math.round(performance.now()-i),g=c.ok?await c.json().catch(()=>null):null;return{s:c.ok?"ok":"error",code:c.status,ms:m,body:g}}catch{if(n.signal.aborted)return{s:"timeout"};try{return await fetch($,{mode:"no-cors",cache:"no-store",signal:AbortSignal.timeout(e)}),{s:"cors"}}catch{return{s:"down"}}}finally{clearTimeout(l)}}var ge=`
4
+ :host{--ground:#ece6d6;--sunk:#e3dcc9;--text:#23262b;--text2:#4a4a44;--muted:#5e5c54;--line:#23262b;--soft:#9b9584;--ok:#1a6b43;--err:#a33a1c;--slip:#23262b;--on-slip:#ece6d6;--on-slip-2:#b9b2a0;--sel:#d9c49a;
5
+ display:block;min-height:100vh;min-height:100dvh;background:var(--ground);color:var(--text);color-scheme:light;
6
+ font:400 1.0625rem/1.55 'Iowan Old Style','Source Serif 4',Charter,Georgia,serif;-webkit-text-size-adjust:100%}
7
+ :host([hidden]){display:none}
8
+ @media (prefers-color-scheme:dark){:host(:not([theme=light])){--ground:#1c1f23;--sunk:#272b30;--text:#ece6d6;--text2:#c9c2b0;--muted:#a8a191;--line:#cfc8b6;--soft:#6d6b63;--ok:#6cc596;--err:#ff9b94;--slip:#ece6d6;--on-slip:#23262b;--on-slip-2:#4a4a44;--sel:#ff7a52;color-scheme:dark}}
9
+ :host([theme=dark]){--ground:#1c1f23;--sunk:#272b30;--text:#ece6d6;--text2:#c9c2b0;--muted:#a8a191;--line:#cfc8b6;--soft:#6d6b63;--ok:#6cc596;--err:#ff9b94;--slip:#ece6d6;--on-slip:#23262b;--on-slip-2:#4a4a44;--sel:#ff7a52;color-scheme:dark}
10
+ *{box-sizing:border-box;margin:0;padding:0}
11
+ ::selection{background:var(--sel);color:#23262b}
12
+ .w{container-type:inline-size;min-height:inherit}
13
+ .d{font-family:${fe};font-weight:700;font-stretch:condensed;letter-spacing:-.015em;line-height:1}
14
+ code,.m{font-family:ui-monospace,'SF Mono',SFMono-Regular,Menlo,Consolas,monospace;font-size:.8125rem;font-variant-numeric:tabular-nums}
15
+ a{color:inherit;text-decoration:underline 1.5px;text-underline-offset:3px}
16
+ a:hover{text-decoration-color:#ff7a52}
17
+ :focus-visible{outline:2px solid var(--text);outline-offset:3px}
18
+ .sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
19
+ .pad{padding-inline:clamp(20px,4cqi,56px);max-width:1440px;margin-inline:auto}
20
+ .hd{border-bottom:1.5px solid var(--line)}
21
+ .hd .pad{display:flex;flex-wrap:wrap;gap:8px 24px;align-items:center;justify-content:space-between;padding-block:16px}
22
+ .brand{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
23
+ .brand b{font-size:1.375rem}
24
+ .brand svg{flex:none;color:var(--text)}
25
+ .brand .m,.credit{color:var(--muted)}
26
+ .credit{font-size:.875rem}
27
+ .credit a,.credit button{color:var(--text)}
28
+ .lk{font:inherit;background:none;border:0;cursor:pointer;text-decoration:underline 1.5px;text-underline-offset:3px}
29
+ .lk:hover{text-decoration-color:#ff7a52}
30
+ .jump{display:none;color:var(--err);font-weight:600}
31
+ .rm{border:1.5px dashed var(--soft);padding:12px 16px;margin-top:20px;font-size:.9375rem;max-width:72ch}
32
+ main,.main{display:block;padding-block:clamp(24px,3cqi,40px) 40px}
33
+ .top{display:flex;flex-wrap:wrap;gap:20px 40px;justify-content:space-between;align-items:flex-end}
34
+ h1.d,.hl{font-size:clamp(2.5rem,1.2rem + 4cqi,4rem);line-height:.98;overflow-wrap:anywhere;text-wrap:balance}
35
+ .lede{font-size:clamp(1.0625rem,1rem + .3cqi,1.1875rem);line-height:1.45;margin-top:12px;max-width:62ch;color:var(--text2)}
36
+ .lede code,.next code,.fix code,.note code,.rm code{background:var(--sunk);color:var(--text);padding:1px 5px;overflow-wrap:anywhere}
37
+ .sum{display:flex;flex-wrap:wrap;gap:10px 14px;align-items:center}
38
+ .sq{display:inline-flex;gap:6px}
39
+ .q{display:inline-block;width:10px;height:10px;border:1.5px solid var(--line);flex:none}
40
+ .q.ok{background:var(--ok);border-color:var(--ok)}
41
+ .q.down{background:var(--err);border-color:var(--err)}
42
+ .q.wait{animation:bl 1.2s steps(2,start) infinite}
43
+ .q.unknown{border-style:dashed;border-color:var(--soft)}
44
+ @keyframes bl{50%{background:var(--line)}}
45
+ .btn{font:700 .75rem/1 ui-monospace,'SF Mono',Menlo,Consolas,monospace;letter-spacing:.12em;text-transform:uppercase;color:var(--text);background:transparent;border:1.5px solid var(--line);padding:10px 16px;min-width:7.5em;min-height:40px;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:8px;text-decoration:none}
46
+ .btn:hover,.btn[data-done]{background:var(--text);color:var(--ground);border-color:var(--text)}
47
+ .btn[aria-disabled=true]{cursor:progress}
48
+ .grid{display:grid;grid-template-columns:minmax(0,1fr) 48px minmax(0,1.3fr) 48px minmax(0,1.1fr);margin-top:clamp(24px,2.6cqi,36px)}
49
+ .p{border:1.5px solid var(--line);display:flex;flex-direction:column;min-width:0}
50
+ .p[data-s=down]{border-color:var(--err)}
51
+ .strip{display:block;width:100%;height:14px;border-bottom:1.5px solid var(--line)}
52
+ .p[data-s=down] .strip{border-bottom-color:var(--err)}
53
+ .in{padding:18px 20px 20px;display:flex;flex-direction:column;gap:12px;flex:1}
54
+ .in h2,.in h3,.in h4,.in h5,.in h6{font-size:clamp(1.625rem,1.2rem + 1cqi,1.875rem)}
55
+ .role{color:var(--muted);margin-top:-4px}
56
+ .nw{white-space:nowrap;overflow-wrap:anywhere}
57
+ .state{display:flex;gap:8px;align-items:baseline;font-weight:600;font-size:.9375rem;line-height:1.4}
58
+ .state .m{font-weight:700}
59
+ .state .q{transform:translateY(1px)}
60
+ .state.down{color:var(--err)}
61
+ .state.unknown,.state.wait{color:var(--muted)}
62
+ .p p{font-size:.9375rem;line-height:1.45}
63
+ .note{color:var(--text2)}
64
+ table{border-collapse:collapse;width:100%}
65
+ th,td{padding:7px 0;border-bottom:1.5px dashed var(--soft);text-align:left;vertical-align:baseline}
66
+ td+td{padding-left:12px}
67
+ td:first-child{font-weight:700;width:5.5em}
68
+ td:last-child{text-align:right;color:var(--muted)}
69
+ td.bad{color:var(--err)}
70
+ .fix{display:flex;flex-direction:column;gap:10px;border-top:1.5px solid var(--err);padding-top:12px}
71
+ .fix>p{font-size:.9375rem}
72
+ .fix.aux{border-top-color:var(--line)}
73
+ .slip{background:var(--slip);color:var(--on-slip);display:flex;flex-wrap:wrap;gap:8px 12px;align-items:center;justify-content:space-between;padding:10px 10px 10px 14px}
74
+ .slip code{font-size:.875rem;font-weight:600;white-space:pre-wrap;overflow-wrap:break-word;flex:1 1 12ch;min-width:0;background:none;color:inherit;padding:0}
75
+ .slip .btn{color:var(--on-slip);border-color:var(--on-slip);min-height:34px;min-width:5.5em;padding:7px 10px}
76
+ .slip .btn:hover,.slip .btn[data-done]{background:var(--on-slip);color:var(--slip)}
77
+ .slip:has(.btn:focus-visible){outline:2px solid var(--text);outline-offset:2px}
78
+ .slip .btn:focus-visible{outline-color:var(--on-slip);outline-offset:-5px}
79
+ .then{color:var(--text2)}
80
+ .wire{position:relative;min-height:28px}
81
+ .wire svg{position:absolute;overflow:visible}
82
+ .wire .h{left:0;width:100%;top:calc(50% - 6px)}
83
+ .wire .v{top:0;height:100%;left:calc(50% - 6px)}
84
+ .wire line{stroke:var(--line);stroke-width:1.5px;vector-effect:non-scaling-stroke}
85
+ .wire .v{display:none}
86
+ .wire[data-s=wait] line{stroke-dasharray:6 6;animation:mv .9s linear infinite}
87
+ .wire[data-s=down] line{stroke:var(--err);stroke-dasharray:7 5;stroke-width:2px}
88
+ .wire[data-s=unknown] line{stroke:var(--soft);stroke-dasharray:2 6}
89
+ @keyframes mv{to{stroke-dashoffset:-12}}
90
+ .next{display:flex;flex-wrap:wrap;gap:10px 28px;align-items:baseline;margin-top:24px;padding-top:16px;border-top:1.5px dashed var(--soft)}
91
+ .next h2,.next h3,.next h4,.next h5,.next h6{font:700 .6875rem/1.4 ui-monospace,Menlo,Consolas,monospace;letter-spacing:.14em;text-transform:uppercase;color:var(--muted)}
92
+ .next{flex-wrap:nowrap}
93
+ .next ul{list-style:none;display:flex;flex-wrap:wrap;gap:10px 28px;font-size:.9375rem;flex:1;min-width:0}
94
+ @container (max-width:999px){
95
+ .grid{grid-template-columns:minmax(0,1fr)}
96
+ .wire{height:32px;min-height:0}
97
+ .wire .h{display:none}.wire .v{display:block}
98
+ .jump{display:inline;flex-basis:100%;text-align:left;order:3}
99
+ .sum{width:100%}
100
+ }
101
+ @container (max-width:479px){.sum .btn{margin-left:auto}.next{flex-direction:column}.next ul{flex-direction:column}}
102
+ @container (max-width:20rem){.nw{white-space:normal}table{table-layout:fixed}td:first-child{width:auto}td{overflow-wrap:anywhere}td+td{padding-left:8px}}
103
+ @media (prefers-reduced-motion:reduce){.wire[data-s=wait] line,.q.wait{animation:none}}
104
+ @media (forced-colors:active){.q.ok,.q.down{background:CanvasText}.slip{border:1.5px solid CanvasText}}
105
+ `,B={wait:"Checking",ok:"Connected",down:"Not reachable",unknown:"Unknown",cors:"Blocked by CORS",timeout:"No answer",error:"Answered with an error"},we=typeof HTMLElement>"u"?class{}:HTMLElement,D=class extends we{static observedAttributes=["stack","api","theme","heading-level"];#n;#u=`cfa${++be}`;#o=null;#e={s:"wait"};#t={s:"wait"};#r={s:"wait"};#l=0;#i=!1;#c=!1;#d=!1;#p;#s;constructor(){super(),this.#n=this.attachShadow({mode:"open"}),this.#n.innerHTML=`<style>${ge}</style><div class="w"></div><p class="sr" role="status" aria-live="polite"></p>`,this.#s=this.#n.querySelector(".w"),this.#s.setAttribute("role","region"),this.#s.setAttribute("aria-labelledby",`${this.#u}-h`),this.#p=this.#n.querySelector("[role=status]"),this.#n.addEventListener("click",e=>this.#w(e))}get stack(){return this.#o}set stack(e){if(typeof e=="string")try{e=JSON.parse(e)}catch{e=null}this.#o=e??null,this.#a(),this.#d&&this.isConnected&&this.check()}get api(){return(this.getAttribute("api")||"http://localhost:3001").replace(/\/$/,"")}set api(e){e?this.setAttribute("api",e):this.removeAttribute("api")}connectedCallback(){this.#d=!0,this.#b(),this.#o||this.#m(),this.#a(),this.check()}attributeChangedCallback(e,n,l){n===l||!this.#d||!this.isConnected||(e==="stack"&&this.#m(),this.#a(),(e==="stack"||e==="api")&&this.check())}#m(){try{this.#o=JSON.parse(this.getAttribute("stack")||"null")}catch{this.#o=null}}#b(){let e=this.getAttribute("font-src")??new URL("./cfa-welcome-display.woff2",import.meta.url).href;if(V||e==="none"||typeof FontFace>"u")return;V=!0,new FontFace("CFA Display",`url(${JSON.stringify(e)}) format('woff2')`,{weight:"700",display:"swap"}).load().then(l=>document.fonts.add(l),()=>{})}async check(){let e=this.#o;if(!e)return;let n=++this.#l,l=Number(this.getAttribute("timeout"))||4e3;this.#i=!0,this.#e=this.#t={s:"wait"},this.#r={s:e.backend.docs?"wait":"none"},this.#a();let i=this.api,c=new Promise(g=>setTimeout(g,450)),m=await z(i+(e.backend.health||"/health"),l);if(await c,n===this.#l){if(this.#e=m,m.s!=="ok")this.#t={s:"unknown"},e.backend.docs&&(this.#r={s:"unknown"});else{let g=m.body?.database,M=typeof g=="string"?Promise.resolve({s:g==="ok"||g==="up"?"ok":"down",ms:m.ms,code:m.code}):e.backend.probe===null?Promise.resolve({s:"unknown"}):z(i+(e.backend.probe||"/users"),Math.max(l*3,12e3)).then(u=>u.s==="ok"?u:u.s==="timeout"||(u.code??0)>=500?{...u,s:"down"}:{...u,s:u.s==="error"?"unknown":u.s}),S=e.backend.docs?z(i+e.backend.docs,l):Promise.resolve({s:"none"}),[N,v]=await Promise.all([M,S]);if(n!==this.#l)return;this.#t=N,this.#r=v.s==="ok"||v.s==="none"?v:{...v,s:"error"}}this.#i=!1,this.#a(),this.#h(this.#g())}}#f(){return 1+ +(this.#e.s==="ok")+ +(this.#t.s==="ok")}#g(){let e=this.#o,n=[this.#e.s!=="ok"&&`${e.backend.name}: ${B[this.#e.s].toLowerCase()}`,this.#t.s!=="ok"&&`${e.database.name}: ${B[this.#t.s].toLowerCase()}`].filter(Boolean);return`Checks finished. ${this.#f()} of 3 connected.${n.length?" "+n.join(". ")+".":""}`}#h(e){this.#p.textContent="",setTimeout(()=>{this.#p.textContent=e},60)}#w=async e=>{let n=e.target.closest("button");if(n){if(n.dataset.act==="check"){if(this.#i)return;this.#h("Checking again"),this.check()}else if(n.dataset.act==="jump"){let l=this.#n.querySelector(".p[data-s=down]"),i=l?.querySelector("[data-copy]");l?.scrollIntoView({block:"start",behavior:matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"}),i?.focus({preventScroll:!0})}else if(n.dataset.act==="remove")this.#c=!this.#c,this.#a();else if(n.dataset.copy!=null){let l=n.dataset.copy,i=!1;try{await navigator.clipboard.writeText(l),i=!0}catch{let c=document.createElement("textarea");c.value=l,c.setAttribute("readonly",""),c.style.cssText="position:fixed;opacity:0",this.#n.appendChild(c),c.select();try{i=document.execCommand("copy")}catch{i=!1}c.remove(),n.focus()}if(!i){let c=n.previousElementSibling;c&&getSelection()?.selectAllChildren(c)}n.textContent=i?"Copied":"Select and copy",n.toggleAttribute("data-done",i),this.#h(i?`Copied: ${l}`:"Copy failed. The command is selected; press Control or Command and C."),setTimeout(()=>{n.textContent="Copy",n.removeAttribute("data-done")},2e3)}}};#a(){if(!this.isConnected&&!this.#s.childElementCount)return;let e=this.#o,n=this.#n.activeElement?.dataset?.k;this.#s.innerHTML=e?this.#k(e):'<div class="pad main"><p>cfa-welcome: no stack description. Set the <code>stack</code> attribute.</p></div>',n&&this.#s.querySelector(`[data-k="${n}"]`)?.focus()}#k(e){let n=Math.min(Math.max(Number(this.getAttribute("heading-level"))||1,1),5),l=(t,h,x,f="")=>`<h${n+t} class="${h}"${f?` id="${f}"`:""}>${x}</h${n+t}>`,i=e.packageManager||"npm",c=this.api,m=c.replace(/^https?:\/\//,""),g=this.#f(),M=this.#e.s==="wait"||this.#t.s==="wait",S=t=>`<span class="q ${t==="ok"?"ok":t==="wait"?"wait":t==="unknown"?"unknown":"down"}"></span>`,N=[e.monorepo&&e.monorepo[0].toUpperCase()+e.monorepo.slice(1),i,e.node&&`Node ${e.node}`].filter(Boolean).join(" \xB7 "),v=e.entry||`${e.frontend.path||"apps/frontend"}`,u=this.#u,K=0,X=`<div class="hd"><div class="pad"><div class="brand">
106
+ <svg width="26" height="26" viewBox="0 0 512 512" aria-hidden="true"><polygon points="140,360 372,360 256,280" fill="#2ec4b6"/><polygon points="256,120 140,360 256,280" fill="#c2a173"/><polygon points="256,120 372,360 256,280" fill="#ff7a52"/><polygon points="256,120 140,360 372,360" fill="none" stroke="currentColor" stroke-width="18" stroke-linejoin="round"/></svg>
107
+ <b class="d">${s(e.name)}</b>${N?`<span class="m">${s(N)}</span>`:""}</div>
108
+ <p class="credit">Made with <a href="${ue}" target="_blank" rel="noopener">create-fs-app</a> \xB7 <a href="${me}" target="_blank" rel="noopener">Docs</a> \xB7 <button type="button" class="lk" data-act="remove" data-k="rm" aria-expanded="${this.#c}" aria-controls="${u}-rm">Remove this page</button></p></div></div>`,Y=`<div id="${u}-rm" class="rm"${this.#c?"":" hidden"}><p>Delete the <code>&lt;cfa-welcome&gt;</code> element and its import from ${o(v)}, then put your own page there. Nothing else in the project uses it.</p></div>`,Q=`<div class="top"><div>${l(0,"d hl",`${s(e.name)} is running.`,`${u}-h`)}
109
+ <p class="lede">Edit ${o(v)} to start. This page checks that the frontend, the backend and the database are connected.</p></div>
110
+ <div class="sum"><span class="sq" aria-hidden="true">${S("ok")}${S(this.#e.s)}${S(this.#t.s)}</span><span class="m">${M?"Checking 3 parts\u2026":`${g} of 3 connected`}</span>
111
+ ${!M&&g<3?`<button type="button" class="lk jump" data-act="jump" data-k="jump">Go to the fix for ${s(this.#e.s!=="ok"?e.backend.name:e.database.name)}</button>`:""}
112
+ <button type="button" class="btn" data-act="check" data-k="check"${this.#i?' aria-disabled="true"':""}>${this.#i?"Checking\u2026":"Check again"}</button></div></div>`,I=t=>`<div class="wire" data-s="${t==="ok"?"ok":t==="wait"?"wait":t==="unknown"?"unknown":"down"}" aria-hidden="true"><svg class="h" height="12"><line x1="0" y1="1" x2="100%" y2="1"/><line x1="0" y1="11" x2="100%" y2="11"/></svg><svg class="v" width="12"><line x1="1" y1="0" x2="1" y2="100%"/><line x1="11" y1="0" x2="11" y2="100%"/></svg></div>`,Z=t=>{let h=`${u}-${t}`;return`<svg class="strip" aria-hidden="true" preserveAspectRatio="none"><defs>${t==="sand"?`<pattern id="${h}" width="8" height="8" patternUnits="userSpaceOnUse"><rect width="8" height="8" fill="#d9c49a"/><circle cx="2" cy="2" r="1" fill="#8a5a2b"/><circle cx="6" cy="6" r="1" fill="#8a5a2b"/></pattern>`:t==="brick"?`<pattern id="${h}" width="16" height="14" patternUnits="userSpaceOnUse"><rect width="16" height="14" fill="#ff7a52"/><path d="M0 7.5H16M4 0V7M12 7V14" stroke="#23262b" stroke-width="1.2"/></pattern>`:`<pattern id="${h}" width="8" height="8" patternUnits="userSpaceOnUse" patternTransform="rotate(45)"><rect width="8" height="8" fill="#3b3f45"/><path d="M0 0V8" stroke="#8a8f86" stroke-width="1.5"/></pattern>`}</defs><rect width="100%" height="100%" fill="url(#${h})"/></svg>`},P=t=>`<div class="slip"><code>${s(t)}</code><button type="button" class="btn" data-copy="${s(t)}" data-k="copy-${++K}" aria-label="Copy: ${s(t)}">Copy</button></div>`,w=(t,h,...x)=>`<div class="fix"><p>${t}</p>${P(h)}${x.map(f=>f?`<p class="then">${f[0]}</p>${P(f[1])}`:"").join("")}</div>`,F=(t,h,x,f,L,pe)=>`<section class="p" data-s="${h==="ok"||h==="wait"||h==="unknown"||h==="none"?h:"down"}" aria-labelledby="${u}-${t}">${Z(x)}<div class="in">${l(1,"d",s([f.name,f.version].filter(Boolean).join(" ")),`${u}-${t}`)}<p class="role m">${L.split(" \xB7 ").map(he=>`<span class="nw">${s(he)}</span>`).join(" \xB7 ")}</p>${pe}</div></section>`,U=(t,h)=>`<p class="state ${t==="ok"?"ok":t==="wait"?"wait":t==="unknown"?"unknown":"down"}">${S(t)}<span>${h}</span></p>`,b=t=>`<span class="m">${s(t)}</span>`,C=e.frontend,ee=F("fe","ok","sand",C,["Frontend",C.path,C.port&&`:${C.port}`].filter(Boolean).join(" \xB7 "),U("ok",`Serving this page at ${b(location.host||"localhost")}`)+`<p class="note">${C.notes?.length?s(C.notes.join(" and "))+". ":""}Calls the API at ${o(m)}.</p>`),a=e.backend,r=this.#e,y=a.health||"/health",te=r.s==="wait"?`Checking ${b("GET "+y)}\u2026`:r.s==="ok"?`${b("GET "+y)} \xB7 ${b(r.code)} \xB7 ${b(r.ms+" ms")}`:r.s==="down"?`Not reachable at ${b(m)}`:r.s==="timeout"?`No answer in ${b(Math.round((Number(this.getAttribute("timeout"))||4e3)/1e3)+" s")}`:r.s==="cors"?"Answered, but the browser blocked it":`${b("GET "+y)} answered ${b(r.code)}`,d=this.#t,H=a.probe===void 0?"/users":a.probe,G=(a.routes||[]).map(([t,h,x])=>{let f=x?s(x):"",L="";return h===H&&t==="GET"&&(d.s==="ok"?f=String(d.code??200):d.s==="down"?(f=d.code?`${d.code}`:"no answer",L=' class="bad"'):d.s==="wait"&&r.s==="ok"&&(f="\u2026")),`<tr><td>${s(t)}</td><td>${s(h)}</td><td${L}>${f}</td></tr>`}).join(""),ne=G?`<table class="m"><caption class="sr">Routes in ${s(a.path||"apps/backend")}</caption><thead class="sr"><tr><th scope="col">Method</th><th scope="col">Path</th><th scope="col">Result</th></tr></thead><tbody>${G}</tbody></table>`:"",A=this.#r,oe=a.docs?A.s==="ok"?`<p><a class="btn" href="${s(c+a.docs)}" target="_blank" rel="noopener">Open API docs ${s(a.docs)}</a></p>`:A.s==="error"?`<p class="note">No API docs at ${o(m+a.docs)} (${A.code?`answered ${A.code}`:"no answer"}).</p>`:`<p class="note">API docs at ${o(a.docs)} once the backend answers.</p>`:`<p class="note">${s(a.name)} has no API docs page in this template. The routes are in ${o(a.routesFile||"apps/backend/src")}.</p>`,J=e.auth==="jwt",T=`${a.path||"apps/backend"}/.env`,p=e.database,E=e.docker!==!1&&p.service?`docker compose up -d ${p.service}`:"",O=!!p.blocksStart&&!!E,W=`${s(a.name)} waits for ${s(p.name)} before it listens, so a stopped ${s(p.name)} keeps it from starting.`,se=["Then start the frontend and backend from the project root:",`${i} run dev`],j="";if(r.s==="down")j=J?w(`Nothing answers at ${o(m)}. With JWT auth the backend exits on start when ${o("JWT_SECRET")} is empty. Add one to ${o(T)}:`,`echo "JWT_SECRET=$(openssl rand -hex 32)" >> ${T}`,O?[`${W} Start it:`,E]:null,se):O?w(`Nothing answers at ${o(m)}. ${W} Start ${s(p.name)} first:`,E,["Then press Check again. If the backend has stopped, start the frontend and backend from the project root:",`${i} run dev`]):w(`Nothing answers at ${o(m)}. Start the frontend and backend together from the project root:`,`${i} run dev`)+`<p class="note">Already running? Read the backend's error in that terminal.</p>`;else if(r.s==="timeout")j=w(`${o("GET "+y)} took longer than the limit. The backend may still be starting: press Check again in a moment, or test it from a terminal:`,`curl -i ${c}${y}`);else if(r.s==="cors"){let t=location.origin;j=w(`The backend answered, but it only allows requests from ${o("FRONTEND_URL")} (default ${o("http://localhost:3000")}) and this page is ${o(t)}. Allow this origin, then restart the backend:`,`echo "FRONTEND_URL=${t}" >> ${T}`)}else r.s==="error"&&(j=w(`${o("GET "+y)} answered ${r.code}. The backend's terminal shows the error. Test it with:`,`curl -i ${c}${y}`));let ae=J&&r.s==="ok"?`<div class="fix aux"><p>JWT auth is on and ${o("JWT_SECRET")} is set. To log in, set ${o("AUTH_USER_EMAIL")} in ${o(T)}, create the password hash, and paste it into ${o("AUTH_USER_PASSWORD_HASH")}:</p>${P(`cd ${a.path||"apps/backend"} && ${i} run auth:hash-password -- '<password>'`)}</div>`:"",ie=F("be",r.s,"brick",a,["Backend",a.path,a.port&&`:${a.port}`,...(a.notes||[]).filter(t=>t!=="Swagger")].filter(Boolean).join(" \xB7 "),U(r.s,te)+j+ne+(r.s==="ok"||r.s==="wait"||!a.docs?oe:"")+ae),k=e.orm,_=p.kind==="sqlite",re=["Database",_?p.file||"apps/backend/dev.db":e.docker!==!1&&p.service?"docker compose":null,_?"no Docker":p.port&&`:${p.port}`,k&&[k.name,k.version].filter(Boolean).join(" ")].filter(Boolean).join(" \xB7 "),ce=d.s==="wait"?r.s==="wait"?"Waiting for the backend":`Checking through ${b("GET "+H)}\u2026`:d.s==="ok"?`Connected \xB7 ${b(d.ms+" ms")} through the backend`:d.s==="unknown"?O&&r.s==="down"?`Unknown \xB7 probably stopped, so ${s(a.name)} can't start`:"Unknown until the backend answers":d.s==="down"?`Not reachable \xB7 ${b("GET "+H)} ${d.code?`answered ${b(d.code)}`:"got no answer"}`:B[d.s],q="";if(d.s==="down"){let t=p.env||(p.kind==="mongodb"?"MONGODB_URI":"DATABASE_URL");_?q=w(`The backend can't open ${o(p.file||"apps/backend/dev.db")}. It creates the file and applies the migrations when it starts, so restart it from the project root:`,`${i} run dev`)+`<p class="note">Still failing? ${o(t)} in ${o(T)} must be a file URL (the default is ${o("file:./dev.db")}). No Docker is involved.</p>`:E?q=w(`The backend is up but can't reach ${s(p.name)}. Start it from the project root:`,E,k?.setup?["First run? Create the tables:",k.setup]:null):q=w(`The backend is up but can't reach ${s(p.name)}. Start ${s(p.name)}${p.port?` on :${p.port}`:""}, check ${o(t)} in ${o(T)}, then restart:`,`${i} run dev`)}let le=(d.s==="ok"||d.s==="wait")&&k?.schema?`<p class="note">Schema in ${o(k.schema)}.</p>`:"",de=F("db",d.s,"bed",p,re,U(d.s,ce)+q+le),R=[];return a.routesFile&&R.push(`Add a route in ${o(a.routesFile)}`),k?.schema&&R.push(`Change the schema in ${o(k.schema)}`),R.push(`Run the tests with ${o(`${i} test`)}`),a.docs&&r.s==="ok"&&A.s==="ok"&&R.push(`Try the API at <a href="${s(c+a.docs)}" target="_blank" rel="noopener">${s(m+a.docs)}</a>`),`${X}<div class="pad main">${Y}${Q}
113
+ <div class="grid">${ee}${I(r.s)}${ie}${I(d.s)}${de}</div>
114
+ <section class="next" aria-labelledby="${u}-n">${l(1,"","Next",`${u}-n`)}<ul>${R.map(t=>`<li>${t}</li>`).join("")}</ul></section></div>`}};typeof customElements<"u"&&!customElements.get("cfa-welcome")&&customElements.define("cfa-welcome",D);export{D as CfaWelcome};