nothumanallowed 14.5.0 → 14.5.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nothumanallowed",
3
- "version": "14.5.0",
3
+ "version": "14.5.2",
4
4
  "description": "NotHumanAllowed — 38 AI agents, 80 tools, Studio (visual agentic workflows). Email, calendar, browser automation, screen capture, canvas, cron/heartbeat, Alexandria E2E messaging, GitHub, Notion, Slack, voice chat, free AI (Liara), 28 languages. Zero-dependency CLI.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/constants.mjs CHANGED
@@ -5,7 +5,7 @@ import { fileURLToPath } from 'url';
5
5
  const __filename = fileURLToPath(import.meta.url);
6
6
  const __dirname = path.dirname(__filename);
7
7
 
8
- export const VERSION = '14.5.0';
8
+ export const VERSION = '14.5.2';
9
9
  export const BASE_URL = 'https://nothumanallowed.com/cli';
10
10
  export const API_BASE = 'https://nothumanallowed.com/api/v1';
11
11
 
@@ -1624,6 +1624,56 @@ Continue from here:`;
1624
1624
  }
1625
1625
  }
1626
1626
 
1627
+ // ── Cross-reference check: verify HTML src/href point to existing files ────
1628
+ if (!abortSignal?.aborted) {
1629
+ const allFileNames = new Set(generatedFiles.map((f) => f.name));
1630
+ let refsFixed = 0;
1631
+ for (const f of generatedFiles) {
1632
+ if (!f.name.endsWith('.html')) continue;
1633
+ let modified = false;
1634
+ let html = f.content;
1635
+
1636
+ // Find all src="..." and href="..." references to local files
1637
+ const refRegex = /(?:src|href)=["']([^"']*?\.(?:js|css|mjs))["']/gi;
1638
+ let match;
1639
+ while ((match = refRegex.exec(html)) !== null) {
1640
+ const ref = match[1];
1641
+ if (ref.startsWith('http') || ref.startsWith('//') || ref.startsWith('data:')) continue;
1642
+
1643
+ // Resolve relative path from HTML file location
1644
+ const htmlDir = path.dirname(f.name);
1645
+ const refPath = ref.startsWith('/') ? ref.slice(1) : path.join(htmlDir, ref).replace(/\\/g, '/');
1646
+ const publicRef = refPath.startsWith('public/') ? refPath : `public/${refPath}`;
1647
+
1648
+ // Check if file exists in generated files
1649
+ if (!allFileNames.has(refPath) && !allFileNames.has(publicRef) && !allFileNames.has(ref)) {
1650
+ // Try to find the actual file by name
1651
+ const baseName = path.basename(ref);
1652
+ const actualFile = generatedFiles.find((g) => g.name.endsWith('/' + baseName) || g.name === baseName);
1653
+ if (actualFile) {
1654
+ // Fix the reference
1655
+ const correctRef = actualFile.name.startsWith('public/') ? actualFile.name.slice(7) : actualFile.name;
1656
+ html = html.replace(match[0], match[0].replace(ref, correctRef));
1657
+ modified = true;
1658
+ refsFixed++;
1659
+ emit({ type: 'status', msg: `Fixed reference: ${ref} → ${correctRef} in ${f.name}` });
1660
+ } else {
1661
+ emit({ type: 'status', msg: `Warning: ${f.name} references missing file: ${ref}` });
1662
+ }
1663
+ }
1664
+ }
1665
+
1666
+ if (modified) {
1667
+ f.content = html;
1668
+ const abs = path.join(projectDir, f.name);
1669
+ fs.writeFileSync(abs, html, 'utf-8');
1670
+ }
1671
+ }
1672
+ if (refsFixed > 0) {
1673
+ emit({ type: 'status', msg: `Auto-fixed ${refsFixed} broken file reference(s)` });
1674
+ }
1675
+ }
1676
+
1627
1677
  // Save project metadata
1628
1678
  const meta = {
1629
1679
  description,
@@ -1894,6 +1944,28 @@ export function register(router) {
1894
1944
  message: 'Missing </html> closing tag',
1895
1945
  });
1896
1946
  }
1947
+ // Check references to local files
1948
+ const refRegex = /(?:src|href)=["']([^"']*?\.(?:js|css|mjs))["']/gi;
1949
+ let refMatch;
1950
+ const lines = content.split('\n');
1951
+ while ((refMatch = refRegex.exec(content)) !== null) {
1952
+ const ref = refMatch[1];
1953
+ if (ref.startsWith('http') || ref.startsWith('//') || ref.startsWith('data:')) continue;
1954
+ const htmlDir = path.dirname(relPath);
1955
+ const refPath = ref.startsWith('/') ? ref.slice(1) : path.join(htmlDir, ref).replace(/\\/g, '/');
1956
+ const publicRef = refPath.startsWith('public/') ? refPath : `public/${refPath}`;
1957
+ const fileExists = ProjectStore.readFile(projectName, refPath) !== null
1958
+ || ProjectStore.readFile(projectName, publicRef) !== null
1959
+ || ProjectStore.readFile(projectName, ref) !== null;
1960
+ if (!fileExists) {
1961
+ const lineNum = content.slice(0, refMatch.index).split('\n').length;
1962
+ diagnostics.push({
1963
+ from: { line: lineNum, col: 0 },
1964
+ severity: 'error',
1965
+ message: `Referenced file not found: ${ref}`,
1966
+ });
1967
+ }
1968
+ }
1897
1969
  }
1898
1970
 
1899
1971
  sendJSON(res, 200, { diagnostics });
@@ -774,8 +774,8 @@ FRONTEND:
774
774
  ❌ Sandbox error: `+e.msg,je(e=>{let t=[...e];return t[t.length-1]={...o},t});else if(e.type===`done`){if(d){let e=d.replace(/<tool>[\s\S]*?<\/tool>/g,``).replace(/<done\s*\/>/g,``);e&&(o.text+=e),d=``}t&&!u&&ze({plan:o.text,originalMessage:t}),Fe(!1),e.changed&&await B((o.tools??[]).filter(e=>e.op===`edit`||e.op===`write`).map(e=>e.path),r)}else e.type===`error`&&(o.text+=`
775
775
  Errore: `+e.msg,Fe(!1))}catch{}}}}catch(e){je(t=>[...t,{role:`agent`,text:`Errore di rete: `+e.message,tools:[]}])}Fe(!1)}async function B(e,t){if(!a)return;let n=await E(`/api/studio/webcraft/projects/load/${encodeURIComponent(a)}`);if(n?.files&&(m(n.files),e.length>0)){let r=e.map(e=>{let r=n.files.find(t=>t.name===e);return r?{file:e,before:t[e]??``,after:r.content}:null}).filter(Boolean);et(e=>[...e,...r])}}function Tt(){ht.current&&=(ht.current.abort(),null),ye(!1),Fe(!1),y(null),je(e=>[...e,{role:`system`,text:`⏹ Generazione interrotta.`}])}async function Et(){return a?(await D(`/api/studio/webcraft/snapshot`,{projectName:a}))?.snapshot??null:null}async function Dt(){let e=await Et();e&&(je(t=>[...t,{role:`system`,text:`💾 Snapshot salvato (${e.slice(0,16).replace(`T`,` `)})`}]),Ot())}async function Ot(){if(!a)return;let e=await E(`/api/studio/webcraft/snapshots/${encodeURIComponent(a)}`);e?.snapshots&&Ke(e.snapshots)}async function kt(e){confirm(`Ripristinare lo snapshot del ${e.replace(`T`,` `).slice(0,16)}? I file attuali verranno sovrascritti.`)&&await D(`/api/studio/webcraft/restore`,{projectName:a,ts:e})!==null&&(je(t=>[...t,{role:`agent`,text:`Snapshot ripristinato (${e}). Ricarico i file...`}]),B([],{}))}async function At(){if(!a)return;let e=await D(`/api/studio/webcraft/syntax-check`,{projectName:a});if(e?.results){let t=e.results.filter(e=>!e.ok);t.length>0?je(e=>[...e,{role:`system`,text:`⚠ Syntax check: ${t.length} errore/i trovato/i.`,syntaxErrors:t}]):je(e=>[...e,{role:`system`,text:`✓ Syntax check: tutti i file JS sono validi.`}])}}async function jt(){let e=p.filter(e=>e._error||e._syntaxError);if(e.length===0){yt.current?.();return}xe(!0),N(0),we(e.length),pt.current=Date.now(),ft(`0s`);for(let t=0;t<e.length;t++){let n=e[t];Ee(n.name),N(t),await wt(`REPAIR FILE: ${n.name}\nErrore: ${n._syntaxError??`generazione fallita`}\nRigenera il file correttamente. Output SOLO il contenuto del file, nessuna spiegazione.`,null,[])}N(e.length),Ee(``),xe(!1),setTimeout(()=>yt.current?.(),500)}async function Mt(e){if(!at){ot(!0),ct(null),it(null),i(`preview`);try{let t=await fetch(`/api/studio/webcraft/sandbox/start`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({projectName:e})});if(!t.ok||!t.body){ct(t.ok?`No response body`:`HTTP ${t.status}`),ot(!1);return}let n=t.body.getReader(),r=new TextDecoder,i=``;for(;;){let{done:e,value:t}=await n.read();if(e)break;i+=r.decode(t,{stream:!0});let a=i.split(`
776
776
 
777
- `);i=a.pop()??``;for(let e of a){let t=e.replace(/^data: /,``).trim();if(t)try{let e=JSON.parse(t);e.type===`phase`?O(!0):e.type===`ready`&&e.port?(it(e.port),ot(!1)):e.type===`status`||e.type===`log`||e.type===`warn`||(e.type===`error`?ct(e.msg):e.type)}catch{}}}}catch(e){ct(e.message||`Connection failed`)}ot(!1)}}async function Nt(){a&&await Mt(a)}(0,_.useEffect)(()=>{vt.current=jt,yt.current=Nt});async function V(){if(!Ye||!a)return;let e=await D(`/api/studio/webcraft/grep`,{projectName:a,query:Ye});e?.matches&&Qe(e.matches)}function Pt(e){let t=p.findIndex(t=>t.name===e);t>=0&&(g(t),i(`files`))}function Ft(){window.open(`/api/studio/webcraft/download/${encodeURIComponent(a)}`,`_blank`)}async function It(e,t,n,r){t.endsWith(`.md`)||(t+=`.md`);let i={name:t,content:n,type:r},s;s=e.mode===`edit`&&e.idx!==null?L.map((t,n)=>n===e.idx?i:t):[...L,i],Be(s),We(null);let c=a||`MyProject`;a||o(c),await D(`/api/studio/webcraft/skills/${encodeURIComponent(c)}`,{skills:s})}async function Lt(e){let t=L[e];!t||!confirm(`Eliminare "${t.name}"?`)||(await D(`/api/studio/webcraft/skills/${encodeURIComponent(a)}/delete`,{name:t.name}),Be(L.filter((t,n)=>n!==e)))}async function Rt(e){let t=L[e];if(!t||!confirm(`Svuotare "${t.name}"? Il file rimane ma il contenuto viene cancellato.`))return;let n=L.map((t,n)=>n===e?{...t,content:``}:t);Be(n),await D(`/api/studio/webcraft/skills/${encodeURIComponent(a)}`,{skills:n})}async function zt(){let e=await E(`/api/studio/webcraft/projects`);e?.projects&&nt(e.projects)}async function Bt(e){let t=await E(`/api/studio/webcraft/projects/load/${encodeURIComponent(e.name)}`);if(!t)return;o(t.projectName??e.name),c(t.description??``),m(t.files??[]),g(0),n(`new`),i(`files`),je([]),Be([]),He(!1);let r=await E(`/api/studio/webcraft/projects/chat/load/${encodeURIComponent(t.projectName??e.name)}`);r?.chat&&je(r.chat);let a=await E(`/api/studio/webcraft/skills/${encodeURIComponent(t.projectName??e.name)}`);a?.skills&&(Be(a.skills),He(!0))}async function H(e){confirm(`Eliminare: ${e.name} - ${e.dir}?`)&&(await D(`/api/studio/webcraft/projects/${encodeURIComponent(e.name)}`,{},`DELETE`),nt(tt.filter(t=>t.name!==e.name)),a===e.name&&(o(``),m([]),je([]),c(``)))}async function Vt(){if(!Re)return;let e=Re.originalMessage;ze(null),await wt(e+`
778
- [Piano approvato — procedi con le modifiche]`,null,[])}function Ht(e){e&&Array.from(e).forEach(e=>{let t=new FileReader;t.onload=t=>{let n=(t.target?.result).split(`,`)[1];Le(t=>[...t,{name:e.name,mimeType:e.type,base64:n,size:e.size}])},t.readAsDataURL(e)})}let Ut=a&&p.length>0,Wt=p[h],Gt=Pe||ve;return(0,k.jsxs)(`div`,{className:$.root,children:[(0,k.jsxs)(`div`,{className:$.header,children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:$.title,children:`⚙ WebCraft`}),(0,k.jsx)(`div`,{className:$.subtitle,children:`Genera progetti web completi con agenti AI`})]}),(0,k.jsxs)(`div`,{className:$.headerTabs,children:[(0,k.jsx)(`button`,{className:`${$.tabBtn} ${t===`new`?$.tabActive:``}`,onClick:()=>{S.size>0&&!confirm(`${S.size} unsaved file(s). Discard changes and create new project?`)||(rt&&(fetch(`/api/studio/webcraft/sandbox`,{method:`DELETE`}).catch(()=>{}),it(null)),m([]),g(0),y(null),x(null),C(new Set),je([]),o(``),c(``),Ne(``),Be([]),He(!1),I(null),ye(!1),Fe(!1),O(!1),A(null),n(`new`))},children:`+ Nuovo`}),(0,k.jsx)(`button`,{className:`${$.tabBtn} ${t===`projects`?$.tabActive:``}`,onClick:()=>{n(`projects`),zt()},children:`📁 Progetti`})]})]}),(0,k.jsx)(`div`,{className:$.body,children:t===`projects`?(0,k.jsx)(`div`,{className:$.projectsList,children:tt.length===0?(0,k.jsxs)(`div`,{className:$.emptyProjects,children:[(0,k.jsx)(`span`,{className:$.emptyIcon,children:`📁`}),(0,k.jsx)(`span`,{children:e(`webcraft.noProjects`)}),(0,k.jsx)(`span`,{className:$.emptyHint,children:`Crea un progetto nella tab Nuovo`})]}):tt.map(e=>(0,k.jsxs)(`div`,{className:$.projectCard,children:[(0,k.jsxs)(`div`,{className:$.projectInfo,children:[(0,k.jsx)(`div`,{className:$.projectName,children:e.name}),(0,k.jsx)(`div`,{className:$.projectDesc,children:e.description}),(0,k.jsxs)(`div`,{className:$.projectMeta,children:[(0,k.jsxs)(`span`,{children:[`📄 `,e.fileCount,` file`]}),(0,k.jsxs)(`span`,{children:[`📅 `,e.createdAt?new Date(e.createdAt).toLocaleString():``]})]})]}),(0,k.jsx)(`button`,{className:$.openBtn,onClick:()=>Bt(e),children:`↗ Apri`}),(0,k.jsx)(`button`,{className:$.deleteBtn,onClick:()=>H(e),children:`🗑`})]},e.name))}):(0,k.jsxs)(`div`,{className:$.editor,children:[(0,k.jsxs)(`div`,{className:$.examples,children:[(0,k.jsx)(`div`,{className:$.sectionLabel,children:`Esempi`}),(0,k.jsx)(`div`,{className:$.examplePills,children:RT.map(e=>(0,k.jsx)(`button`,{className:$.examplePill,onClick:()=>{o(e.name),c(e.desc),Ne(e.desc)},children:e.name},e.name))})]}),(0,k.jsxs)(`div`,{className:$.editorCols,children:[(0,k.jsxs)(`div`,{className:$.leftSidebar,children:[(0,k.jsxs)(`div`,{className:$.panel,children:[(0,k.jsx)(`div`,{className:$.panelTitle,children:`Blocchi`}),zT.map(e=>(0,k.jsxs)(`label`,{className:$.blockLabel,children:[(0,k.jsx)(`input`,{type:`checkbox`,checked:l[e.key],onChange:t=>u(n=>({...n,[e.key]:t.target.checked})),className:$.blockCheck}),(0,k.jsx)(`span`,{children:e.icon}),(0,k.jsx)(`span`,{children:e.label})]},e.key))]}),l.auth&&(0,k.jsxs)(`div`,{className:$.panel,children:[(0,k.jsxs)(`div`,{className:$.panelHeader,children:[(0,k.jsx)(`div`,{className:$.panelTitle,children:`Campi Auth`}),(0,k.jsx)(`button`,{className:$.addBtn,onClick:()=>f(e=>[...e,{label:`New field`,type:`text`,required:!1}]),children:`+ Campo`})]}),d.map((e,t)=>(0,k.jsxs)(`div`,{className:$.authField,children:[(0,k.jsx)(`input`,{value:e.label,onChange:e=>f(n=>n.map((n,r)=>r===t?{...n,label:e.target.value}:n)),className:$.authFieldInput}),(0,k.jsx)(`select`,{value:e.type,onChange:e=>f(n=>n.map((n,r)=>r===t?{...n,type:e.target.value}:n)),className:$.authFieldSelect,children:[`text`,`email`,`password`,`tel`,`date`,`number`].map(e=>(0,k.jsx)(`option`,{value:e,children:e},e))}),(0,k.jsx)(`input`,{type:`checkbox`,checked:e.required,onChange:e=>f(n=>n.map((n,r)=>r===t?{...n,required:e.target.checked}:n)),title:`Required`,className:$.authFieldReq}),(0,k.jsx)(`button`,{onClick:()=>f(e=>e.filter((e,n)=>n!==t)),className:$.removeFieldBtn,children:`×`})]},t))]}),(0,k.jsxs)(`div`,{className:$.panel,children:[(0,k.jsxs)(`div`,{className:$.panelHeader,children:[(0,k.jsx)(`div`,{className:$.panelTitle,children:`🗂 Contesto AI`}),(0,k.jsx)(`button`,{className:$.addBtn,onClick:()=>We({mode:`new`,idx:null,name:``,content:``,type:`skill`,generating:!1}),children:`+ Skill`})]}),L.length>0?(0,k.jsx)(`div`,{className:$.skillsList,children:L.map((e,t)=>(0,k.jsxs)(`div`,{className:$.skillRow,children:[(0,k.jsx)(`span`,{className:$.skillIcon,children:UT(e.type)}),(0,k.jsx)(`span`,{className:$.skillName,title:e.name,children:e.name}),(0,k.jsx)(`span`,{className:`${$.skillBadge} ${$[`skillBadge_`+e.type]}`,children:e.type}),!e.content&&e.type!==`log`&&(0,k.jsx)(`span`,{className:$.skillEmpty,children:`⚠`}),(0,k.jsx)(`button`,{className:$.skillBtn,onClick:()=>We({mode:e.type===`log`?`view`:`edit`,idx:t,name:e.name,content:e.content,type:e.type,generating:!1}),children:e.type===`log`?`👁`:`✏`}),e.type!==`memory`&&e.type!==`provider`&&e.type!==`log`&&(0,k.jsx)(`button`,{className:$.skillBtn,onClick:()=>Rt(t),children:`🗑`}),e.type===`log`&&(0,k.jsx)(`button`,{className:$.skillBtn,onClick:()=>Lt(t),children:`🗑`})]},t))}):(0,k.jsx)(`div`,{className:$.skillsEmpty,children:Ve?`Nessun file di contesto. Clicca "+ Skill" per aggiungerne uno.`:`Crea o carica un progetto per i file di contesto.`})]}),Ge.length>0&&(0,k.jsxs)(`div`,{className:$.panel,children:[(0,k.jsx)(`div`,{className:$.panelTitle,children:`💾 Snapshot`}),Ge.slice(0,5).map(e=>{let t=e.ts.replace(`T`,` `).slice(0,16);return(0,k.jsxs)(`div`,{className:$.snapshotRow,children:[(0,k.jsx)(`span`,{className:$.snapshotTs,children:t}),(0,k.jsxs)(`span`,{className:$.snapshotCount,children:[e.fileCount,`f`]}),(0,k.jsx)(`button`,{className:$.snapshotBtn,onClick:()=>kt(e.ts),children:`↺`})]},e.ts)})]}),ve&&(0,k.jsx)(`div`,{className:$.genStatus,children:`⏳ Generazione...`}),be&&(0,k.jsxs)(`div`,{className:$.repairStatus,children:[(0,k.jsx)(`div`,{className:$.repairStatusTitle,children:`🔧 Correzione automatica...`}),(0,k.jsxs)(`div`,{className:$.repairStatusProg,children:[Se,` / `,Ce,` file`]}),(0,k.jsx)(`div`,{className:$.repairStatusFile,children:Te})]}),p.length>0&&!ve&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`div`,{className:$.actionRow,children:[(0,k.jsx)(`button`,{className:$.actionBtn,onClick:Ft,children:`⬇ ZIP`}),(0,k.jsx)(`button`,{className:$.actionBtnIcon,title:`Syntax check`,onClick:At,children:`✅`}),(0,k.jsx)(`button`,{className:`${$.actionBtnIcon} ${qe?$.actionBtnActive:``}`,title:`Grep`,onClick:()=>Je(!qe),children:`🔍`}),(0,k.jsx)(`button`,{className:$.actionBtnIcon,title:`Snapshot`,onClick:Dt,children:`💾`})]}),p.some(e=>e._error||e._syntaxError)&&!be&&(0,k.jsx)(`button`,{className:$.repairBtn,onClick:jt,children:`🔧 Correggi tutti i file rossi`}),(0,k.jsx)(`button`,{className:$.sandboxBtn,onClick:()=>{a?Mt(a):i(`preview`)},children:at?`⏳ Starting...`:rt?`🌐 Sandbox Live`:`▶ Sandbox`}),F&&(0,k.jsxs)(`div`,{className:$.statsBar,children:[(0,k.jsxs)(`span`,{children:[`⏱ `,F.seconds>=60?`${Math.floor(F.seconds/60)}m ${F.seconds%60}s`:`${F.seconds}s`]}),(0,k.jsxs)(`span`,{children:[`↑ `,F.tokIn.toLocaleString(),` tok`]}),(0,k.jsxs)(`span`,{children:[`↓ `,F.tokOut.toLocaleString(),` tok`]}),(0,k.jsxs)(`span`,{children:[`📄 `,F.files,` file`]})]})]})]}),(0,k.jsxs)(`div`,{className:$.rightPanel,children:[(0,k.jsxs)(`div`,{className:$.rightTabBar,children:[(0,k.jsx)(`button`,{className:`${$.rightTab} ${r===`preview`?``:$.rightTabActive}`,onClick:()=>i(`files`),children:`📄 File`}),(0,k.jsx)(`button`,{className:`${$.rightTab} ${r===`preview`?$.rightTabActive:``}`,onClick:()=>i(`preview`),children:`🌐 Sandbox`})]}),be&&(0,k.jsxs)(`div`,{className:$.repairBar,children:[(0,k.jsxs)(`div`,{className:$.repairBarRow,children:[(0,k.jsx)(`span`,{className:$.repairBarIcon,children:`🔧`}),(0,k.jsx)(`span`,{className:$.repairBarLabel,children:`Auto-fix`}),(0,k.jsx)(`span`,{className:$.repairBarFile,children:Te}),(0,k.jsxs)(`span`,{className:$.repairBarCounter,children:[Se,` / `,Ce]}),(0,k.jsx)(`span`,{className:$.repairBarTime,children:dt}),(0,k.jsx)(`button`,{className:$.stopBtn,onClick:Tt,children:`⏹ Stop`})]}),(0,k.jsx)(`div`,{className:$.progressTrack,children:(0,k.jsx)(`div`,{className:$.repairProgress,style:{width:Ce>0?`${Math.round(Se/Ce*100)}%`:`0%`}})})]}),ve&&(0,k.jsxs)(`div`,{className:$.genBar,children:[(0,k.jsxs)(`div`,{className:$.genBarRow,children:[(0,k.jsx)(`span`,{className:$.genBarRobot,children:`🤖`}),(0,k.jsx)(`span`,{className:$.genBarLabel,children:P.total===0?`Pianificazione...`:`Generazione`}),(0,k.jsx)(`span`,{className:$.genBarFile,children:P.name.split(`,`)[0].trim()}),(0,k.jsx)(`span`,{className:$.genBarCounter,children:P.total>0?`${P.fi} / ${P.total}`:``}),(0,k.jsx)(`span`,{className:$.genBarCounter,children:Oe.tokIn+Oe.tokOut>0?`↑${z(Oe.tokIn)} ↓${z(Oe.tokOut)}`:``}),(0,k.jsx)(`span`,{className:$.genBarTime,children:lt}),(0,k.jsxs)(`span`,{className:$.genDots,children:[(0,k.jsx)(`span`,{className:`${$.dot} ${$.dot1}`}),(0,k.jsx)(`span`,{className:`${$.dot} ${$.dot2}`}),(0,k.jsx)(`span`,{className:`${$.dot} ${$.dot3}`})]})]}),(0,k.jsx)(`div`,{className:$.progressTrack,children:(0,k.jsx)(`div`,{className:$.genProgress,style:{width:P.total>0?`${Math.round(P.fi/P.total*100)}%`:`0%`}})})]}),r===`preview`?(0,k.jsxs)(`div`,{className:$.sandboxWrap,children:[(0,k.jsxs)(`div`,{className:$.sandboxStatusBar,children:[(0,k.jsx)(`span`,{className:$.sandboxStatusDot,style:{background:rt?`#4ade80`:at?`#facc15`:`#64748b`}}),(0,k.jsx)(`span`,{className:$.sandboxStatusText,children:rt?`Live :${rt}`:at?`Starting...`:`Stopped`}),rt&&(0,k.jsx)(`button`,{className:$.sandboxReloadBtn,onClick:()=>{let e=document.querySelector(`iframe[title="WebCraft Sandbox"]`);e&&(e.src=e.src)},children:`↻`}),rt&&(0,k.jsx)(`button`,{className:$.sandboxStopBtn,onClick:()=>{fetch(`/api/studio/webcraft/sandbox`,{method:`DELETE`}),it(null)},children:`⏹`}),!rt&&!at&&(0,k.jsx)(`button`,{className:$.sandboxStartBtnSmall,onClick:()=>{a&&Mt(a)},children:`▶ Start`})]}),ce.length>0&&(0,k.jsxs)(`div`,{className:$.runtimeErrors,children:[(0,k.jsxs)(`div`,{className:$.runtimeErrorsHeader,children:[(0,k.jsxs)(`span`,{children:[`❌ `,ce.length,` runtime error`,ce.length>1?`s`:``]}),(0,k.jsx)(`button`,{className:$.runtimeErrorsFix,onClick:()=>{Ne(`Fix these runtime errors:\n${ce.map(e=>`${e.message} (${e.source||``}:${e.line||0})`).join(`
777
+ `);i=a.pop()??``;for(let e of a){let t=e.replace(/^data: /,``).trim();if(t)try{let e=JSON.parse(t);e.type===`phase`||(e.type===`ready`&&e.port?(it(e.port),ot(!1)):e.type===`status`||e.type===`log`||e.type===`warn`||(e.type===`error`?ct(e.msg):e.type))}catch{}}}}catch(e){ct(e.message||`Connection failed`)}ot(!1)}}async function Nt(){a&&await Mt(a)}(0,_.useEffect)(()=>{vt.current=jt,yt.current=Nt});async function V(){if(!Ye||!a)return;let e=await D(`/api/studio/webcraft/grep`,{projectName:a,query:Ye});e?.matches&&Qe(e.matches)}function Pt(e){let t=p.findIndex(t=>t.name===e);t>=0&&(g(t),i(`files`))}function Ft(){window.open(`/api/studio/webcraft/download/${encodeURIComponent(a)}`,`_blank`)}async function It(e,t,n,r){t.endsWith(`.md`)||(t+=`.md`);let i={name:t,content:n,type:r},s;s=e.mode===`edit`&&e.idx!==null?L.map((t,n)=>n===e.idx?i:t):[...L,i],Be(s),We(null);let c=a||`MyProject`;a||o(c),await D(`/api/studio/webcraft/skills/${encodeURIComponent(c)}`,{skills:s})}async function Lt(e){let t=L[e];!t||!confirm(`Eliminare "${t.name}"?`)||(await D(`/api/studio/webcraft/skills/${encodeURIComponent(a)}/delete`,{name:t.name}),Be(L.filter((t,n)=>n!==e)))}async function Rt(e){let t=L[e];if(!t||!confirm(`Svuotare "${t.name}"? Il file rimane ma il contenuto viene cancellato.`))return;let n=L.map((t,n)=>n===e?{...t,content:``}:t);Be(n),await D(`/api/studio/webcraft/skills/${encodeURIComponent(a)}`,{skills:n})}async function zt(){let e=await E(`/api/studio/webcraft/projects`);e?.projects&&nt(e.projects)}async function Bt(e){let t=await E(`/api/studio/webcraft/projects/load/${encodeURIComponent(e.name)}`);if(!t)return;o(t.projectName??e.name),c(t.description??``),m(t.files??[]),g(0),n(`new`),i(`files`),je([]),Be([]),He(!1);let r=await E(`/api/studio/webcraft/projects/chat/load/${encodeURIComponent(t.projectName??e.name)}`);r?.chat&&je(r.chat);let a=await E(`/api/studio/webcraft/skills/${encodeURIComponent(t.projectName??e.name)}`);a?.skills&&(Be(a.skills),He(!0))}async function H(e){confirm(`Eliminare: ${e.name} - ${e.dir}?`)&&(await D(`/api/studio/webcraft/projects/${encodeURIComponent(e.name)}`,{},`DELETE`),nt(tt.filter(t=>t.name!==e.name)),a===e.name&&(o(``),m([]),je([]),c(``)))}async function Vt(){if(!Re)return;let e=Re.originalMessage;ze(null),await wt(e+`
778
+ [Piano approvato — procedi con le modifiche]`,null,[])}function Ht(e){e&&Array.from(e).forEach(e=>{let t=new FileReader;t.onload=t=>{let n=(t.target?.result).split(`,`)[1];Le(t=>[...t,{name:e.name,mimeType:e.type,base64:n,size:e.size}])},t.readAsDataURL(e)})}let Ut=a&&p.length>0,Wt=p[h],Gt=Pe||ve;return(0,k.jsxs)(`div`,{className:$.root,children:[(0,k.jsxs)(`div`,{className:$.header,children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:$.title,children:`⚙ WebCraft`}),(0,k.jsx)(`div`,{className:$.subtitle,children:`Genera progetti web completi con agenti AI`})]}),(0,k.jsxs)(`div`,{className:$.headerTabs,children:[(0,k.jsx)(`button`,{className:`${$.tabBtn} ${t===`new`?$.tabActive:``}`,onClick:()=>{S.size>0&&!confirm(`${S.size} unsaved file(s). Discard changes and create new project?`)||(rt&&(fetch(`/api/studio/webcraft/sandbox`,{method:`DELETE`}).catch(()=>{}),it(null)),m([]),g(0),y(null),x(null),C(new Set),je([]),o(``),c(``),Ne(``),Be([]),He(!1),I(null),ye(!1),Fe(!1),O(!1),A(null),n(`new`))},children:`+ Nuovo`}),(0,k.jsx)(`button`,{className:`${$.tabBtn} ${t===`projects`?$.tabActive:``}`,onClick:()=>{n(`projects`),zt()},children:`📁 Progetti`})]})]}),(0,k.jsx)(`div`,{className:$.body,children:t===`projects`?(0,k.jsx)(`div`,{className:$.projectsList,children:tt.length===0?(0,k.jsxs)(`div`,{className:$.emptyProjects,children:[(0,k.jsx)(`span`,{className:$.emptyIcon,children:`📁`}),(0,k.jsx)(`span`,{children:e(`webcraft.noProjects`)}),(0,k.jsx)(`span`,{className:$.emptyHint,children:`Crea un progetto nella tab Nuovo`})]}):tt.map(e=>(0,k.jsxs)(`div`,{className:$.projectCard,children:[(0,k.jsxs)(`div`,{className:$.projectInfo,children:[(0,k.jsx)(`div`,{className:$.projectName,children:e.name}),(0,k.jsx)(`div`,{className:$.projectDesc,children:e.description}),(0,k.jsxs)(`div`,{className:$.projectMeta,children:[(0,k.jsxs)(`span`,{children:[`📄 `,e.fileCount,` file`]}),(0,k.jsxs)(`span`,{children:[`📅 `,e.createdAt?new Date(e.createdAt).toLocaleString():``]})]})]}),(0,k.jsx)(`button`,{className:$.openBtn,onClick:()=>Bt(e),children:`↗ Apri`}),(0,k.jsx)(`button`,{className:$.deleteBtn,onClick:()=>H(e),children:`🗑`})]},e.name))}):(0,k.jsxs)(`div`,{className:$.editor,children:[(0,k.jsxs)(`div`,{className:$.examples,children:[(0,k.jsx)(`div`,{className:$.sectionLabel,children:`Esempi`}),(0,k.jsx)(`div`,{className:$.examplePills,children:RT.map(e=>(0,k.jsx)(`button`,{className:$.examplePill,onClick:()=>{o(e.name),c(e.desc),Ne(e.desc)},children:e.name},e.name))})]}),(0,k.jsxs)(`div`,{className:$.editorCols,children:[(0,k.jsxs)(`div`,{className:$.leftSidebar,children:[(0,k.jsxs)(`div`,{className:$.panel,children:[(0,k.jsx)(`div`,{className:$.panelTitle,children:`Blocchi`}),zT.map(e=>(0,k.jsxs)(`label`,{className:$.blockLabel,children:[(0,k.jsx)(`input`,{type:`checkbox`,checked:l[e.key],onChange:t=>u(n=>({...n,[e.key]:t.target.checked})),className:$.blockCheck}),(0,k.jsx)(`span`,{children:e.icon}),(0,k.jsx)(`span`,{children:e.label})]},e.key))]}),l.auth&&(0,k.jsxs)(`div`,{className:$.panel,children:[(0,k.jsxs)(`div`,{className:$.panelHeader,children:[(0,k.jsx)(`div`,{className:$.panelTitle,children:`Campi Auth`}),(0,k.jsx)(`button`,{className:$.addBtn,onClick:()=>f(e=>[...e,{label:`New field`,type:`text`,required:!1}]),children:`+ Campo`})]}),d.map((e,t)=>(0,k.jsxs)(`div`,{className:$.authField,children:[(0,k.jsx)(`input`,{value:e.label,onChange:e=>f(n=>n.map((n,r)=>r===t?{...n,label:e.target.value}:n)),className:$.authFieldInput}),(0,k.jsx)(`select`,{value:e.type,onChange:e=>f(n=>n.map((n,r)=>r===t?{...n,type:e.target.value}:n)),className:$.authFieldSelect,children:[`text`,`email`,`password`,`tel`,`date`,`number`].map(e=>(0,k.jsx)(`option`,{value:e,children:e},e))}),(0,k.jsx)(`input`,{type:`checkbox`,checked:e.required,onChange:e=>f(n=>n.map((n,r)=>r===t?{...n,required:e.target.checked}:n)),title:`Required`,className:$.authFieldReq}),(0,k.jsx)(`button`,{onClick:()=>f(e=>e.filter((e,n)=>n!==t)),className:$.removeFieldBtn,children:`×`})]},t))]}),(0,k.jsxs)(`div`,{className:$.panel,children:[(0,k.jsxs)(`div`,{className:$.panelHeader,children:[(0,k.jsx)(`div`,{className:$.panelTitle,children:`🗂 Contesto AI`}),(0,k.jsx)(`button`,{className:$.addBtn,onClick:()=>We({mode:`new`,idx:null,name:``,content:``,type:`skill`,generating:!1}),children:`+ Skill`})]}),L.length>0?(0,k.jsx)(`div`,{className:$.skillsList,children:L.map((e,t)=>(0,k.jsxs)(`div`,{className:$.skillRow,children:[(0,k.jsx)(`span`,{className:$.skillIcon,children:UT(e.type)}),(0,k.jsx)(`span`,{className:$.skillName,title:e.name,children:e.name}),(0,k.jsx)(`span`,{className:`${$.skillBadge} ${$[`skillBadge_`+e.type]}`,children:e.type}),!e.content&&e.type!==`log`&&(0,k.jsx)(`span`,{className:$.skillEmpty,children:`⚠`}),(0,k.jsx)(`button`,{className:$.skillBtn,onClick:()=>We({mode:e.type===`log`?`view`:`edit`,idx:t,name:e.name,content:e.content,type:e.type,generating:!1}),children:e.type===`log`?`👁`:`✏`}),e.type!==`memory`&&e.type!==`provider`&&e.type!==`log`&&(0,k.jsx)(`button`,{className:$.skillBtn,onClick:()=>Rt(t),children:`🗑`}),e.type===`log`&&(0,k.jsx)(`button`,{className:$.skillBtn,onClick:()=>Lt(t),children:`🗑`})]},t))}):(0,k.jsx)(`div`,{className:$.skillsEmpty,children:Ve?`Nessun file di contesto. Clicca "+ Skill" per aggiungerne uno.`:`Crea o carica un progetto per i file di contesto.`})]}),Ge.length>0&&(0,k.jsxs)(`div`,{className:$.panel,children:[(0,k.jsx)(`div`,{className:$.panelTitle,children:`💾 Snapshot`}),Ge.slice(0,5).map(e=>{let t=e.ts.replace(`T`,` `).slice(0,16);return(0,k.jsxs)(`div`,{className:$.snapshotRow,children:[(0,k.jsx)(`span`,{className:$.snapshotTs,children:t}),(0,k.jsxs)(`span`,{className:$.snapshotCount,children:[e.fileCount,`f`]}),(0,k.jsx)(`button`,{className:$.snapshotBtn,onClick:()=>kt(e.ts),children:`↺`})]},e.ts)})]}),ve&&(0,k.jsx)(`div`,{className:$.genStatus,children:`⏳ Generazione...`}),be&&(0,k.jsxs)(`div`,{className:$.repairStatus,children:[(0,k.jsx)(`div`,{className:$.repairStatusTitle,children:`🔧 Correzione automatica...`}),(0,k.jsxs)(`div`,{className:$.repairStatusProg,children:[Se,` / `,Ce,` file`]}),(0,k.jsx)(`div`,{className:$.repairStatusFile,children:Te})]}),p.length>0&&!ve&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`div`,{className:$.actionRow,children:[(0,k.jsx)(`button`,{className:$.actionBtn,onClick:Ft,children:`⬇ ZIP`}),(0,k.jsx)(`button`,{className:$.actionBtnIcon,title:`Syntax check`,onClick:At,children:`✅`}),(0,k.jsx)(`button`,{className:`${$.actionBtnIcon} ${qe?$.actionBtnActive:``}`,title:`Grep`,onClick:()=>Je(!qe),children:`🔍`}),(0,k.jsx)(`button`,{className:$.actionBtnIcon,title:`Snapshot`,onClick:Dt,children:`💾`})]}),p.some(e=>e._error||e._syntaxError)&&!be&&(0,k.jsx)(`button`,{className:$.repairBtn,onClick:jt,children:`🔧 Correggi tutti i file rossi`}),(0,k.jsx)(`button`,{className:$.sandboxBtn,onClick:()=>{a?Mt(a):i(`preview`)},children:at?`⏳ Starting...`:rt?`🌐 Sandbox Live`:`▶ Sandbox`}),F&&(0,k.jsxs)(`div`,{className:$.statsBar,children:[(0,k.jsxs)(`span`,{children:[`⏱ `,F.seconds>=60?`${Math.floor(F.seconds/60)}m ${F.seconds%60}s`:`${F.seconds}s`]}),(0,k.jsxs)(`span`,{children:[`↑ `,F.tokIn.toLocaleString(),` tok`]}),(0,k.jsxs)(`span`,{children:[`↓ `,F.tokOut.toLocaleString(),` tok`]}),(0,k.jsxs)(`span`,{children:[`📄 `,F.files,` file`]})]})]})]}),(0,k.jsxs)(`div`,{className:$.rightPanel,children:[(0,k.jsxs)(`div`,{className:$.rightTabBar,children:[(0,k.jsx)(`button`,{className:`${$.rightTab} ${r===`preview`?``:$.rightTabActive}`,onClick:()=>i(`files`),children:`📄 File`}),(0,k.jsx)(`button`,{className:`${$.rightTab} ${r===`preview`?$.rightTabActive:``}`,onClick:()=>i(`preview`),children:`🌐 Sandbox`})]}),be&&(0,k.jsxs)(`div`,{className:$.repairBar,children:[(0,k.jsxs)(`div`,{className:$.repairBarRow,children:[(0,k.jsx)(`span`,{className:$.repairBarIcon,children:`🔧`}),(0,k.jsx)(`span`,{className:$.repairBarLabel,children:`Auto-fix`}),(0,k.jsx)(`span`,{className:$.repairBarFile,children:Te}),(0,k.jsxs)(`span`,{className:$.repairBarCounter,children:[Se,` / `,Ce]}),(0,k.jsx)(`span`,{className:$.repairBarTime,children:dt}),(0,k.jsx)(`button`,{className:$.stopBtn,onClick:Tt,children:`⏹ Stop`})]}),(0,k.jsx)(`div`,{className:$.progressTrack,children:(0,k.jsx)(`div`,{className:$.repairProgress,style:{width:Ce>0?`${Math.round(Se/Ce*100)}%`:`0%`}})})]}),ve&&(0,k.jsxs)(`div`,{className:$.genBar,children:[(0,k.jsxs)(`div`,{className:$.genBarRow,children:[(0,k.jsx)(`span`,{className:$.genBarRobot,children:`🤖`}),(0,k.jsx)(`span`,{className:$.genBarLabel,children:P.total===0?`Pianificazione...`:`Generazione`}),(0,k.jsx)(`span`,{className:$.genBarFile,children:P.name.split(`,`)[0].trim()}),(0,k.jsx)(`span`,{className:$.genBarCounter,children:P.total>0?`${P.fi} / ${P.total}`:``}),(0,k.jsx)(`span`,{className:$.genBarCounter,children:Oe.tokIn+Oe.tokOut>0?`↑${z(Oe.tokIn)} ↓${z(Oe.tokOut)}`:``}),(0,k.jsx)(`span`,{className:$.genBarTime,children:lt}),(0,k.jsxs)(`span`,{className:$.genDots,children:[(0,k.jsx)(`span`,{className:`${$.dot} ${$.dot1}`}),(0,k.jsx)(`span`,{className:`${$.dot} ${$.dot2}`}),(0,k.jsx)(`span`,{className:`${$.dot} ${$.dot3}`})]})]}),(0,k.jsx)(`div`,{className:$.progressTrack,children:(0,k.jsx)(`div`,{className:$.genProgress,style:{width:P.total>0?`${Math.round(P.fi/P.total*100)}%`:`0%`}})})]}),r===`preview`?(0,k.jsxs)(`div`,{className:$.sandboxWrap,children:[(0,k.jsxs)(`div`,{className:$.sandboxStatusBar,children:[(0,k.jsx)(`span`,{className:$.sandboxStatusDot,style:{background:rt?`#4ade80`:at?`#facc15`:`#64748b`}}),(0,k.jsx)(`span`,{className:$.sandboxStatusText,children:rt?`Live :${rt}`:at?`Starting...`:`Stopped`}),rt&&(0,k.jsx)(`button`,{className:$.sandboxReloadBtn,onClick:()=>{let e=document.querySelector(`iframe[title="WebCraft Sandbox"]`);e&&(e.src=e.src)},children:`↻`}),rt&&(0,k.jsx)(`button`,{className:$.sandboxStopBtn,onClick:()=>{fetch(`/api/studio/webcraft/sandbox`,{method:`DELETE`}),it(null),le([])},children:`⏹`}),!rt&&!at&&(0,k.jsx)(`button`,{className:$.sandboxStartBtnSmall,onClick:()=>{a&&Mt(a)},children:`▶ Start`})]}),ce.length>0&&(0,k.jsxs)(`div`,{className:$.runtimeErrors,children:[(0,k.jsxs)(`div`,{className:$.runtimeErrorsHeader,children:[(0,k.jsxs)(`span`,{children:[`❌ `,ce.length,` runtime error`,ce.length>1?`s`:``]}),(0,k.jsx)(`button`,{className:$.runtimeErrorsFix,onClick:()=>{Ne(`Fix these runtime errors:\n${ce.map(e=>`${e.message} (${e.source||``}:${e.line||0})`).join(`
779
779
  `)}`),fetch(`/api/studio/webcraft/sandbox/errors`,{method:`DELETE`}),le([]),i(`files`)},children:`🔧 Auto-fix`}),(0,k.jsx)(`button`,{className:$.runtimeErrorsDismiss,onClick:()=>{fetch(`/api/studio/webcraft/sandbox/errors`,{method:`DELETE`}),le([])},children:`✕`})]}),ce.slice(0,3).map((e,t)=>(0,k.jsxs)(`div`,{className:$.runtimeErrorLine,children:[e.message,e.source?` — ${e.source.split(`/`).pop()}:${e.line}`:``]},t))]}),rt?(0,k.jsx)(`iframe`,{src:`http://127.0.0.1:${rt}`,className:$.sandboxFrame,title:`WebCraft Sandbox`,sandbox:`allow-scripts allow-same-origin allow-forms allow-popups`}):(0,k.jsxs)(`div`,{className:$.sandboxEmpty,children:[(0,k.jsx)(`span`,{style:{fontSize:48},children:at?`⏳`:st?`❌`:`🌐`}),(0,k.jsx)(`span`,{style:{fontWeight:700,fontSize:16},children:at?`Starting sandbox...`:st?`Sandbox Error`:`Preview`}),st&&(0,k.jsx)(`span`,{style:{fontSize:11,maxWidth:400,textAlign:`center`,color:`#f87171`},children:st}),!at&&(0,k.jsxs)(`button`,{className:$.sandboxStartBtn,onClick:()=>{a&&Mt(a)},children:[`▶ `,st?`Retry`:`Start Sandbox`]})]})]}):(0,k.jsx)(`div`,{className:$.codeArea,children:p.length===0&&ve?(0,k.jsx)(`div`,{className:$.noFiles,children:(0,k.jsxs)(`div`,{className:$.noFilesHero,children:[(0,k.jsx)(`span`,{className:$.noFilesIcon,children:`⏳`}),(0,k.jsx)(`span`,{className:$.noFilesTitle,children:`Pianificazione...`}),(0,k.jsx)(`span`,{className:$.noFilesTagline,children:P.name||`Analisi della struttura del progetto in corso`})]})}):p.length===0?(0,k.jsxs)(`div`,{className:$.noFiles,children:[(0,k.jsxs)(`div`,{className:$.noFilesHero,children:[(0,k.jsx)(`span`,{className:$.noFilesIcon,children:`🔨`}),(0,k.jsx)(`span`,{className:$.noFilesTitle,children:`WebCraft`}),(0,k.jsx)(`span`,{className:$.noFilesTagline,children:`Genera progetti web completi con AI`})]}),(0,k.jsxs)(`div`,{className:$.noFilesSteps,children:[(0,k.jsxs)(`div`,{className:$.noFilesStep,children:[(0,k.jsx)(`span`,{className:$.noFilesStepNum,children:`1`}),(0,k.jsx)(`span`,{children:`Scegli un esempio o scrivi una descrizione nel box in basso`})]}),(0,k.jsxs)(`div`,{className:$.noFilesStep,children:[(0,k.jsx)(`span`,{className:$.noFilesStepNum,children:`2`}),(0,k.jsxs)(`span`,{children:[`Premi `,(0,k.jsx)(`strong`,{children:`▶ Genera`}),` — l'AI crea tutti i file del progetto`]})]}),(0,k.jsxs)(`div`,{className:$.noFilesStep,children:[(0,k.jsx)(`span`,{className:$.noFilesStepNum,children:`3`}),(0,k.jsx)(`span`,{children:`Chiedi modifiche in chat, scarica lo ZIP o avvia il Sandbox`})]})]}),(0,k.jsxs)(`div`,{className:$.noFilesExamplesHint,children:[`💡 Prova: `,(0,k.jsx)(`button`,{className:$.noFilesExampleBtn,onClick:()=>{let e=RT[0];o(e.name),c(e.desc),Ne(e.desc)},children:`MySaaS`}),(0,k.jsx)(`button`,{className:$.noFilesExampleBtn,onClick:()=>{let e=RT[1];o(e.name),c(e.desc),Ne(e.desc)},children:`MyShop`}),(0,k.jsx)(`button`,{className:$.noFilesExampleBtn,onClick:()=>{let e=RT[3];o(e.name),c(e.desc),Ne(e.desc)},children:`MyPortfolio`})]})]}):(0,k.jsxs)(`div`,{className:$.codeLayout,children:[(0,k.jsx)(`div`,{className:$.ideTabBar,children:p.map((e,t)=>{let n=e._error||!!e._syntaxError,r=t===h;return(0,k.jsxs)(`button`,{className:`${$.ideTab} ${r?$.ideTabActive:``} ${n?$.ideTabError:``} ${e._pending?$.ideTabPending:``}`,onClick:()=>{g(t),x(null),y(null),ve&&ue.current!==null&&t!==ue.current&&(de.current&&clearTimeout(de.current),de.current=setTimeout(()=>{ue.current!==null&&(g(ue.current),y(null))},1e4))},title:e.name,children:[(0,k.jsx)(`span`,{className:$.ideTabIcon,children:e._pending?`⌛`:n?`⚠`:VT(e.name)}),(0,k.jsx)(`span`,{className:$.ideTabName,children:e.name.split(`/`).pop()}),S.has(e.name)&&(0,k.jsx)(`span`,{className:$.ideTabUnsaved,children:`●`}),n&&(0,k.jsx)(`span`,{className:$.ideTabDot})]},t)})}),ge&&(0,k.jsxs)(`div`,{className:$.diffOverlay,children:[(0,k.jsxs)(`div`,{className:$.diffOverlayHeader,children:[(0,k.jsxs)(`span`,{children:[`✏ Modifica proposta — `,(0,k.jsx)(`strong`,{children:ge.file})]}),(0,k.jsxs)(`div`,{className:$.diffOverlayActions,children:[(0,k.jsx)(`button`,{className:$.diffAcceptBtn,onClick:()=>{m(e=>e.map(e=>e.name===ge.file?{...e,content:ge.after}:e)),_e(null)},children:`✓ Accetta`}),(0,k.jsx)(`button`,{className:$.diffRejectBtn,onClick:()=>_e(null),children:`✕ Rifiuta`})]})]}),(0,k.jsxs)(`div`,{className:$.diffOverlayBody,children:[ge.before.split(`
780
780
  `).map((e,t)=>e===(ge.after.split(`
781
781
  `)[t]??``)?(0,k.jsxs)(`div`,{className:$.diffSame,children:[`\xA0`,e||` `]},t):(0,k.jsxs)(`div`,{className:$.diffRem,children:[`- `,e]},`r${t}`)),ge.after.split(`
@@ -8,7 +8,7 @@
8
8
  <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
9
9
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
10
10
  <title>NHA — NotHumanAllowed</title>
11
- <script type="module" crossorigin src="/assets/index-BkNJfwfK.js"></script>
11
+ <script type="module" crossorigin src="/assets/index-ZLG7Juqo.js"></script>
12
12
  <link rel="stylesheet" crossorigin href="/assets/index-1hoj2kvN.css">
13
13
  </head>
14
14
  <body>