@decido/shell 4.0.2 → 4.0.4

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.
Files changed (37) hide show
  1. package/dist/CenterComposite-V3LL23PG.mjs +64 -0
  2. package/dist/DebugPanel-NFXQOZQ6.mjs +1 -0
  3. package/dist/MorphShell-4JGDAN46.mjs +1 -0
  4. package/dist/PlaygroundAppSidebar-QI73PNRI.mjs +1 -0
  5. package/dist/PlaygroundChat-CBIIQMWU.mjs +1 -0
  6. package/dist/PlaygroundTerminal-MVZKXTYW.mjs +1 -0
  7. package/dist/PluginSandbox-MUNBFWGH.mjs +1 -0
  8. package/dist/ReactFlowEditor-2ALQWCHQ.mjs +6 -0
  9. package/dist/ReactFlowEditor-ROZ6RF3K.css +1 -0
  10. package/dist/TimelineEditor-UPRRXXVM.mjs +3 -0
  11. package/dist/WidgetSlotPanel-YX2VBQAP.mjs +1 -0
  12. package/dist/chunk-3YEFIKFH.mjs +1 -0
  13. package/dist/chunk-53FADIUX.mjs +1 -0
  14. package/dist/chunk-5FWJFDER.mjs +285 -0
  15. package/dist/chunk-6K3AFDP5.mjs +1 -0
  16. package/dist/chunk-AGAAZ2MU.mjs +1 -0
  17. package/dist/chunk-BCP43BRV.mjs +2 -0
  18. package/dist/chunk-BSJBW64M.mjs +1 -0
  19. package/dist/chunk-C5FD536O.mjs +1 -0
  20. package/dist/chunk-DTH34ILQ.mjs +1 -0
  21. package/dist/chunk-DWP77YZU.mjs +1 -0
  22. package/dist/chunk-O3OWL3Q2.mjs +1 -0
  23. package/dist/chunk-POBZMHZ5.mjs +7 -0
  24. package/dist/chunk-S3AQ4QDD.mjs +42 -0
  25. package/dist/chunk-XDA6ZRIQ.mjs +1 -0
  26. package/dist/chunk-XTDMHHMW.mjs +5 -0
  27. package/dist/chunk-YAYNNUEX.mjs +12 -0
  28. package/dist/chunk-YEKQJ4YC.mjs +1 -0
  29. package/dist/chunk-YHFKY5MB.mjs +1 -0
  30. package/dist/chunk-ZKD74U4X.mjs +1 -0
  31. package/dist/index.css +1 -0
  32. package/dist/index.js +506 -0
  33. package/dist/index.mjs +89 -0
  34. package/dist/useIntentLens-OCAUBNOQ.mjs +1 -0
  35. package/dist/useSuggestionsStore-Q4KVPU7L.mjs +1 -0
  36. package/dist/wasm-A4BTVJWV.mjs +1 -0
  37. package/package.json +18 -19
@@ -0,0 +1,3 @@
1
+ import{a as f}from"./chunk-XDA6ZRIQ.mjs";import"./chunk-YEKQJ4YC.mjs";import{useTimelineStore as x}from"@decido/engine";import{Plus as C,MonitorPlay as z}from"lucide-react";import{AnimatePresence as T}from"motion/react";import v from"react";import{Trash2 as y,Clock as h}from"lucide-react";import{motion as N}from"motion/react";import{jsx as a,jsxs as d}from"react/jsx-runtime";var w={dialogue:{clock:"text-purple-400/70",input:"focus:border-purple-500/50",text:"text-purple-300",label:"text-purple-400/70"},ui:{clock:"text-cyan-400/70",input:"focus:border-cyan-500/50",text:"text-text-primary",label:"text-cyan-400/70"},logic:{clock:"text-orange-400/70",input:"focus:border-orange-500/50",text:"text-text-primary",label:"text-orange-400/70"}},g=v.memo(function({kf:r,track:p,activeTimelineId:i,updateKeyframe:n,removeKeyframe:m}){let t=w[p];return d(N.div,{layout:!0,initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2},style:{left:`${r.t*100}px`,width:"260px"},className:"absolute top-2 bottom-2 bg-surface-secondary border border-border-default rounded-xl p-3 flex flex-col gap-2 group hover:border-border-subtle0 shadow-[0_8px_30px_rgb(0,0,0,0.5)] hover:shadow-[0_8px_30px_rgb(0,0,0,0.8)] transition-all z-10",children:[d("div",{className:"flex items-center justify-between gap-2 border-b border-border-subtle pb-1.5",children:[d("div",{className:"flex items-center gap-1 bg-surface-overlay px-1.5 py-0.5 rounded border border-border-default transition-colors",children:[a(h,{size:10,className:t.clock}),a("input",{type:"number",step:"0.1",className:"bg-transparent w-10 text-xs text-text-primary font-mono focus:outline-hidden text-center",value:r.t,onChange:s=>n(i,r.id,{t:parseFloat(s.target.value)||0})})]}),a("button",{onClick:()=>m(i,r.id),className:"p-1 text-text-muted hover:text-red-400 hover:bg-red-500/10 rounded transition-colors opacity-0 group-hover:opacity-100",title:"Eliminar Keyframe",children:a(y,{size:12})})]}),p==="dialogue"&&d("div",{className:"flex flex-col gap-2 flex-1",children:[d("div",{className:"flex items-center gap-2",children:[a("span",{className:`text-[9px] uppercase tracking-wider ${t.label} w-10`,children:"Actor"}),a("input",{type:"text",className:`flex-1 bg-surface-glass border border-border-subtle rounded px-2 py-1 text-xs ${t.text} focus:outline-hidden ${t.input}`,value:r.actorId||"",placeholder:"system",onChange:s=>n(i,r.id,{actorId:s.target.value})})]}),a("textarea",{className:`w-full bg-surface-glass border border-border-subtle rounded px-2 py-1.5 text-xs text-text-primary focus:outline-hidden ${t.input} resize-none flex-1 min-h-0`,placeholder:"Texto a sintetizar...",value:r.speech||"",onChange:s=>n(i,r.id,{speech:s.target.value})})]}),p==="ui"&&d("div",{className:"flex flex-col gap-2 flex-1 justify-center",children:[d("div",{className:"flex flex-col gap-1",children:[a("span",{className:`text-[9px] uppercase tracking-wider ${t.label}`,children:"App State"}),a("input",{type:"text",className:`w-full bg-surface-glass border border-border-subtle rounded px-2 py-1.5 text-xs text-text-primary focus:outline-hidden ${t.input}`,value:r.state||"",placeholder:"idle",onChange:s=>n(i,r.id,{state:s.target.value})})]}),d("label",{className:"flex items-center gap-2 p-1.5 mt-1 rounded hover:bg-surface-glass cursor-pointer border border-transparent hover:border-border-subtle transition-colors",children:[a("input",{type:"checkbox",checked:r.canvas||!1,onChange:s=>n(i,r.id,{canvas:s.target.checked}),className:"rounded border-border-strong bg-surface-glass text-cyan-500 w-3.5 h-3.5"}),a("span",{className:"text-[10px] uppercase tracking-wider text-cyan-300",children:"Mostrar Lienzo 3D"})]})]}),p==="logic"&&d("div",{className:"flex flex-col gap-1 flex-1 justify-center",children:[a("span",{className:`text-[9px] uppercase tracking-wider ${t.label}`,children:"Intent / Action"}),a("input",{type:"text",className:`w-full bg-surface-glass border border-border-subtle rounded px-2 py-1.5 text-xs text-text-primary focus:outline-hidden ${t.input} font-mono mt-1`,value:r.intent||"",placeholder:"action_name",onChange:s=>n(i,r.id,{intent:s.target.value})}),a("span",{className:"text-[9px] text-text-muted leading-tight mt-2 px-1",children:"Dispara un trigger local o llamada MCP."})]})]})});import{jsx as o,jsxs as l}from"react/jsx-runtime";var j=()=>{let u=f(e=>e.prototypeBrand),r=x(e=>e.timelines),p=x(e=>e.addKeyframe),i=x(e=>e.updateKeyframe),n=x(e=>e.removeKeyframe),m=x(e=>e.updateDuration),t=r[u];if(!t)return null;let s=e=>{p(u,{t:t.duration,track:e,...e==="dialogue"?{speech:"",actorId:"system"}:{},...e==="ui"?{state:"new_state",canvas:!1}:{},...e==="logic"?{intent:""}:{}})},b=["dialogue","ui","logic"];return l("div",{className:"flex flex-col h-full bg-surface-secondary text-text-primary border-l border-border-default w-full shadow-2xl z-40 overflow-hidden relative",children:[o("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E')] opacity-[0.10] mix-blend-overlay pointer-events-none z-0"}),l("div",{className:"p-4 border-b border-border-default relative z-10 flex justify-between items-center bg-surface-glass",children:[l("div",{children:[l("h2",{className:"text-lg font-bold text-text-primary flex items-center gap-2",children:[o(z,{size:18,className:"text-purple-400"}),"Multi-Track Sequence"]}),l("p",{className:"text-xs text-text-secondary mt-1 font-mono uppercase tracking-wider",children:["Editando: ",t.name]})]}),l("div",{className:"text-right flex flex-col items-end gap-1",children:[o("span",{className:"text-xs text-text-muted font-mono",children:"Duraci\xF3n Global (s)"}),o("input",{type:"number",className:"bg-surface-glass border border-border-strong rounded px-2 py-1 w-20 text-text-primary text-right text-sm focus:outline-hidden focus:border-purple-400",value:t.duration,onChange:e=>m(u,parseFloat(e.target.value)||0)})]})]}),l("div",{className:"flex-1 flex overflow-hidden w-full relative z-10",children:[l("div",{className:"w-[220px] shrink-0 flex flex-col border-r border-border-default bg-surface-primary z-20",children:[o("div",{className:"h-8 border-b border-border-default shrink-0 bg-surface-secondary"}),b.map(e=>l("div",{className:`h-[170px] flex flex-col justify-center p-4 border-b border-border-subtle relative
2
+ ${e==="dialogue"?"bg-purple-500/5":e==="ui"?"bg-cyan-500/5":"bg-orange-500/5"}`,children:[o("div",{className:`text-[10px] font-bold uppercase tracking-widest
3
+ ${e==="dialogue"?"text-purple-400":e==="ui"?"text-cyan-400":"text-orange-400"}`,children:e==="dialogue"?"Track 1: Di\xE1logo & Audio":e==="ui"?"Track 2: UI & Canvas":"Track 3: L\xF3gica & MCP"}),l("button",{onClick:()=>s(e),className:"mt-3 w-fit py-1.5 px-3 rounded text-xs transition-colors flex items-center gap-1 border border-border-default hover:bg-surface-glass text-text-primary/70 hover:text-text-primary",children:[o(C,{size:12})," Add Node"]})]},e))]}),o("div",{className:"flex-1 overflow-x-auto overflow-y-hidden custom-scrollbar bg-surface-secondary relative",children:l("div",{className:"h-full relative min-w-max pb-10",style:{width:`${Math.max(t.duration,15)*100+400}px`},children:[o("div",{className:"h-8 border-b border-border-default sticky top-0 bg-surface-secondary z-20 flex items-end",children:Array.from({length:Math.ceil(Math.max(t.duration,15))+5}).map((e,c)=>l("div",{className:"absolute h-3 border-l border-border-strong",style:{left:`${c*100}px`},children:[l("span",{className:"absolute -top-5 -left-1.5 text-[10px] text-text-primary/30 font-mono tracking-tighter",children:[c,"s"]}),o("div",{className:"absolute left-[50px] -bottom-3 h-1.5 border-l border-border-default"})]},c))}),o("div",{className:"flex flex-col w-full relative",children:b.map(e=>o("div",{className:"h-[170px] border-b border-border-subtle relative hover:bg-surface-glass transition-colors group/lane",children:o(T,{children:t.keyframes.filter(c=>c.track===e).map(c=>o(g,{kf:c,track:e,activeTimelineId:u,updateKeyframe:i,removeKeyframe:n},c.id))})},e))})]})})]})]})};export{j as TimelineEditor};
@@ -0,0 +1 @@
1
+ import{a,b}from"./chunk-DWP77YZU.mjs";import"./chunk-AGAAZ2MU.mjs";import"./chunk-YHFKY5MB.mjs";import"./chunk-YEKQJ4YC.mjs";export{b as WidgetSlotPanel,a as pluginWidgetStore};
@@ -0,0 +1 @@
1
+ import m from"react";import{motion as d,AnimatePresence as c}from"motion/react";import{Terminal as p,Trash2 as x,X as y}from"lucide-react";import{jsx as e,jsxs as t}from"react/jsx-runtime";var v=m.memo(function({isOpen:a,setIsOpen:o,logs:r,setLogs:i,logsEndRef:n}){return e(c,{children:a&&t(d.div,{initial:{opacity:0,y:50},animate:{opacity:1,y:0},exit:{opacity:0,y:50},className:"absolute right-6 bottom-40 w-80 h-64 bg-surface-overlay backdrop-blur-md border border-border-default rounded-xl flex flex-col overflow-hidden z-30 shadow-2xl",children:[t("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border-default bg-surface-glass",children:[t("div",{className:"flex items-center gap-2",children:[e(p,{size:14,className:"text-text-secondary"}),e("span",{className:"text-xs font-mono text-text-secondary",children:"System Log"})]}),t("div",{className:"flex items-center gap-2",children:[e("button",{onClick:()=>i([]),className:"text-text-muted hover:text-red-400 transition-colors",title:"Limpiar logs",children:e(x,{size:14})}),e("button",{onClick:()=>o(!1),className:"text-text-muted hover:text-text-primary transition-colors",children:e(y,{size:14})})]})]}),t("div",{className:"flex-1 overflow-y-auto p-3 font-mono text-[10px] space-y-1 custom-scrollbar",children:[r.map((s,l)=>t("div",{className:`flex gap-2 ${s.type==="error"?"text-red-400":s.type==="success"?"text-emerald-400":s.type==="system"?"text-purple-400":"text-text-secondary"}`,children:[t("span",{className:"opacity-50 shrink-0",children:["[",s.time,"]"]}),e("span",{className:"wrap-break-word",children:s.msg})]},l)),e("div",{ref:n})]})]})})});export{v as a};
@@ -0,0 +1 @@
1
+ import{a as v}from"./chunk-ZKD74U4X.mjs";import{a as f}from"./chunk-XDA6ZRIQ.mjs";import{createContext as R,useContext as L,useEffect as k,useRef as C,useCallback as T}from"react";import{jsx as O}from"react/jsx-runtime";var g=typeof window<"u"&&window.__TAURI_INTERNALS__!==void 0,w=()=>import("@tauri-apps/api/event");var E=R({socket:null,isConnected:!1,isNativeOS:!1,emitEvent:()=>{},onEvent:()=>{},offEvent:()=>{}}),M=()=>L(E),G=(n,e)=>{let{onEvent:t,offEvent:i}=M();k(()=>(t(n,e),()=>i(n,e)),[n,e,t,i])},K=({children:n,socketInstance:e=null,isConnected:t=!1})=>{let i=C(new Map),a=C(new Map),c=T(async(o,l)=>{if(g){try{let{emit:r}=await w();await r(o,l)}catch(r){console.error(`[Tauri IPC] Error emitiendo ${o}:`,r)}return}if(!e){console.warn(`[NetworkProvider] Emit '${o}' ignorado: No hay red disponible.`);return}typeof e.emit=="function"?e.emit(o,l):typeof e.send=="function"&&e.send(JSON.stringify({event:o,payload:l}))},[e]),m=T((o,l)=>{if(g){let r=w().then(({listen:d})=>d(o,s=>{l(s.payload)}));a.current.has(o)||a.current.set(o,[]),a.current.get(o)?.push({originalCallback:l,unlistenPromise:r});return}if(e){if(typeof e.on=="function")e.on(o,l);else if(typeof e.addEventListener=="function"){let r=d=>{try{let s=JSON.parse(d.data);s.event===o&&l(s.payload)}catch{}};e.addEventListener("message",r),i.current.has(o)||i.current.set(o,[]),i.current.get(o)?.push({originalCallback:l,wrappedCallback:r})}}},[e]),u=T((o,l)=>{if(g){let r=a.current.get(o)||[],d=r.findIndex(s=>s.originalCallback===l);d>-1&&(r[d].unlistenPromise.then(s=>s()),r.splice(d,1));return}if(e){if(typeof e.off=="function")e.off(o,l);else if(typeof e.removeEventListener=="function"){let r=i.current.get(o)||[],d=r.findIndex(s=>s.originalCallback===l);if(d>-1){let{wrappedCallback:s}=r[d];e.removeEventListener("message",s),r.splice(d,1)}}}},[e]),y=g?!0:t;return O(E.Provider,{value:{socket:e,isConnected:y,isNativeOS:g,emitEvent:c,onEvent:m,offEvent:u},children:n})};import{Component as V}from"react";import{AlertTriangle as $,RefreshCw as I}from"lucide-react";import{jsx as b,jsxs as x}from"react/jsx-runtime";var N=class extends V{state={hasError:!1,error:null};static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error(`[PlaygroundErrorBoundary] Error capturado en ${this.props.fallbackName||"componente"}:`,e,t)}handleReset=()=>{this.setState({hasError:!1,error:null})};render(){return this.state.hasError?x("div",{className:"flex flex-col items-center justify-center w-full h-full min-h-[150px] bg-red-500/10 border border-red-500/20 rounded-xl p-4 text-center backdrop-blur-xs",children:[b($,{className:"text-red-400 mb-3",size:32}),x("h3",{className:"text-red-400 font-bold mb-1",children:["Fallo en ",this.props.fallbackName||"M\xF3dulo"]}),b("p",{className:"text-xs text-red-300/80 mb-4 max-w-xs truncate",title:this.state.error?.message,children:this.state.error?.message||"Excepci\xF3n desconocida en el renderizado."}),x("button",{onClick:this.handleReset,className:"flex items-center gap-2 px-3 py-1.5 bg-red-500/20 hover:bg-red-500/30 text-red-300 rounded-lg text-xs transition-colors border border-red-500/20",children:[b(I,{size:12}),"Reiniciar M\xF3dulo"]})]}):this.props.children}};function oe(n){let{chatId:e,shellType:t,label:i,data:a={},artifact:c}=n;v.getState().upsertInstance({id:e,sourceChatId:e,shellType:t,label:i,data:a}),c&&v.getState().pushArtifact(e,{id:c.id,name:c.name,shellType:c.shellType||t,version:c.version||1,data:c.data}),f.getState().setShowCanvas(!0),console.log(`[MorphBridge] \u{1F300} ${t} instance "${i}" \u2192 tab ${e}`)}function se(n){return typeof n=="string"?/<html|<div|<body|<script/i.test(n)?"iframe":(/^#{1,6}\s|^\*\*|^\- \[/m.test(n),"markdown"):n.artifact||n.schema?"iframe":n.keyframes||n.nodes?"shell-canvas":"markdown"}import{useEffect as A,useRef as U}from"react";import{useTimelineStore as q}from"@decido/engine";import{useEngineStore as z}from"@decido/engine";var S=(n,e=!1)=>{if(!e)try{let t=new(window.AudioContext||window.webkitAudioContext),i=t.createOscillator(),a=t.createGain();i.connect(a),a.connect(t.destination),n==="beep"?(i.frequency.setValueAtTime(600,t.currentTime),a.gain.setValueAtTime(.1,t.currentTime),a.gain.exponentialRampToValueAtTime(.01,t.currentTime+.1),i.start(t.currentTime),i.stop(t.currentTime+.1)):n==="success"?(i.frequency.setValueAtTime(400,t.currentTime),i.frequency.exponentialRampToValueAtTime(800,t.currentTime+.2),a.gain.setValueAtTime(.1,t.currentTime),a.gain.exponentialRampToValueAtTime(.01,t.currentTime+.3),i.start(t.currentTime),i.stop(t.currentTime+.3)):n==="alert"&&(i.type="square",i.frequency.setValueAtTime(300,t.currentTime),i.frequency.setValueAtTime(400,t.currentTime+.1),a.gain.setValueAtTime(.1,t.currentTime),a.gain.exponentialRampToValueAtTime(.01,t.currentTime+.3),i.start(t.currentTime),i.stop(t.currentTime+.3))}catch{console.error("Audio not supported")}};var fe=()=>{let n=f(r=>r.prototypeBrand),e=q(r=>r.timelines),t=z(r=>r.activeNodeIds),{addLog:i,addChatMessage:a,isMuted:c,demoState:m,setDemoState:u,showCanvas:y,setShowCanvas:o}=f(),l=U(new Set);return A(()=>{t.length===0&&(l.current.clear(),u("idle"))},[t,u]),A(()=>{let r=e[n]?.blueprint||{nodes:e[n]?.keyframes||[]};if(!r||t.length===0)return;r.nodes.filter(s=>t.includes(s.id)&&s.track==="ui").forEach(s=>{if(!l.current.has(s.id)){l.current.add(s.id);let p=s.state||"idle";u(p),s.canvas!==void 0&&o(s.canvas),i(`\u{1F500} System Authored Transition: UI Context [${p}]`,"system"),p.includes("whatsapp")&&!p.includes("resolved")&&!p.includes("idle")?a({type:"alert",sender:"system",text:"Alerta de SLA Cr\xEDtico detectada v\xEDa integraci\xF3n."}):p.includes("analyzing")&&a({type:"workflow",sender:"system",text:"Analizando informaci\xF3n contextual..."}),p.includes("alert")?S("alert",c):S("beep",c)}})},[t,n,e,c,i,a,u,o]),{demoState:m,setDemoState:u,showCanvas:y,setShowCanvas:o}};import{useState as D,useEffect as J,useMemo as P,useCallback as _}from"react";var h=Object.assign(n=>{let e={availableLicenses:[{id:"1",name:"Decido Personal",type:"personal"},{id:"2",name:"K\xFAspide Corp",type:"enterprise"},{id:"3",name:"Madefront Ind",type:"enterprise"}]};return n?n(e):e},{getState:()=>({availableLicenses:[{id:"1",name:"Decido Personal",type:"personal"},{id:"2",name:"K\xFAspide Corp",type:"enterprise"},{id:"3",name:"Madefront Ind",type:"enterprise"}],login:(n,e,t)=>{},setActiveContext:n=>{}})});function xe(n,e){let t=n||{environments:{},voices:[]},i=P(()=>t.environments[e]||Object.values(t.environments)[0]||{gradient:"from-gray-400 to-gray-600",greetingText:"Console",subtitle:"Sin configuraci\xF3n",borderColor:"border-border-strong",glowColor:"shadow-none",buttonColor:"bg-surface-glass",buttonGlow:"shadow-none",suggestions:[],widgets:[]},[t,e]),[a,c]=D([]);J(()=>{c(r=>{let d=i.suggestions||[];return JSON.stringify(r)===JSON.stringify(d)?r:d})},[i.suggestions]);let m=h(r=>r.availableLicenses),u=m?.find(r=>r.type==="enterprise"),y=u?u.name:"Empresa Local",o=P(()=>({id:n?.persona?.id||"agent-core",name:n?.persona?.name||"Agent",voiceName:n?.persona?.voiceName||"Zephyr",systemInstruction:n?.persona?.systemInstruction||"Eres un agente inteligente del Marco de Trabajo Decido OS. Est\xE1s dise\xF1ado para proporcionar asistencia r\xE1pida, ejecutar comandos del sistema de forma segura, y ayudar al usuario en el uso de la interfaz."}),[n]),l=_(r=>{let{setSelectedProfile:d,setStep:s,addLog:p}=f.getState();d(r.name),s("action"),setTimeout(()=>{h.getState().login("admin",`${r.name} Context`,m),h.getState().setActiveContext(r.id),s("chat"),p(`Perfil cargado: ${r.name}`,"success")},2500)},[m]);return{safeConfig:t,activeConfig:i,suggestions:a,setSuggestions:c,dynamicPersona:o,authAvailableLicenses:m,handleProfileSelect:l}}export{M as a,G as b,K as c,N as d,oe as e,se as f,S as g,fe as h,xe as i};
@@ -0,0 +1,285 @@
1
+ import{a as U,b as Q,d as Ne}from"./chunk-C5FD536O.mjs";import{h as ce}from"./chunk-BCP43BRV.mjs";import{a as j,c as te}from"./chunk-O3OWL3Q2.mjs";import{a as C}from"./chunk-ZKD74U4X.mjs";import{b as B}from"./chunk-AGAAZ2MU.mjs";import{a as L}from"./chunk-XDA6ZRIQ.mjs";import ye,{useCallback as he}from"react";import{AnimatePresence as ua,motion as xa}from"motion/react";import{ArrowLeft as ba,X as fa,Maximize2 as ga,Minimize2 as va}from"lucide-react";import de from"react";import{motion as ke,AnimatePresence as Ce}from"motion/react";import{X as lt,ArrowLeft as it,Layers as ct,Code2 as dt,Droplets as pt,MonitorPlay as mt}from"lucide-react";import tt,{Suspense as at}from"react";import{Code2 as st,Loader2 as Na}from"lucide-react";import{jsx as h,jsxs as V}from"react/jsx-runtime";var rt=tt.lazy(()=>import("recharts").then(e=>({default:({chartData:s,color:a})=>h(e.ResponsiveContainer,{width:"100%",height:"100%",children:h(e.AreaChart,{data:s,children:h(e.Area,{type:"monotone",dataKey:"val",stroke:"currentColor",fill:"currentColor",strokeWidth:2,className:a})})})})));var ot=({columns:e,rows:s})=>h("div",{className:"w-full h-full overflow-auto bg-surface-primary border border-border-default rounded-2xl shadow-xl p-4 custom-scrollbar",children:V("table",{className:"w-full text-left text-sm text-text-primary",children:[h("thead",{className:"text-xs text-text-muted uppercase bg-surface-glass",children:h("tr",{children:e?.map((a,t)=>h("th",{className:"px-6 py-3",children:a},t))})}),h("tbody",{children:s?.map((a,t)=>h("tr",{className:"border-b border-border-subtle hover:bg-surface-glass transition-colors",children:a?.map((u,d)=>h("td",{className:"px-6 py-4",children:u},d))},t))})]})}),nt=({content:e})=>h("div",{className:"w-full h-full overflow-auto bg-surface-primary border border-border-default rounded-2xl shadow-xl p-8 whitespace-pre-wrap text-text-primary font-sans leading-relaxed text-sm custom-scrollbar",children:e});function Se(e){let{renderingType:s,activeStage:a,activeArtifactData:t,activeConfig:u,activeState:d,prototypeBrand:f,chartData:o,dragConstraintsRef:b,defaultViewMode:p,instanceId:N}=e,g=Q(s);if(g)return h(g,{instanceId:N||a?.sourceNodeId||"default",data:a?.data||{},artifacts:[],activeArtifactIndex:0});if(s==="workbench"){let l=te("AdminWorkbench")||te("Workbench");return l?h(l,{...a?.data||{}}):h("div",{className:"w-full h-full flex items-center justify-center text-text-muted font-mono text-sm",children:V("div",{className:"text-center",children:[h(st,{size:48,className:"mx-auto mb-4 text-text-muted"}),h("p",{children:"AdminWorkbench no registrado"}),h("p",{className:"text-xs text-text-muted mt-1",children:"Usa registerShell('shell-vscode', Component)"})]})})}if(s==="liquid"){let l=te("SafeLiquidUI");return l&&a?.data?h("div",{className:"w-full h-full p-6 overflow-auto",children:h(l,{uiSchema:a.data.code||a.data,tenantId:"system"})}):h("div",{className:"w-full h-full p-6 overflow-auto",children:h("pre",{className:"text-xs text-text-secondary font-mono bg-surface-glass rounded-xl p-4 border border-border-subtle",children:JSON.stringify(a?.data||{},null,2)})})}if(s==="custom"&&a?.componentId){let l=te(a.componentId);return l?h(l,{...a?.data||{}}):V("div",{className:"w-full h-full flex items-center justify-center text-text-muted font-mono text-sm",children:["Componente '",a.componentId,"' no registrado"]})}if(s==="artifact"&&(t||a?.data)){let l=a?.data||t;return l.artifact==="graph-visualizer"?h("div",{className:"flex-1 flex items-center justify-center p-6 text-text-muted font-mono",children:"Graph Visualizer temporalmente deshabilitado por conflictos CSS."}):l.artifact==="data-table"?h("div",{className:"flex-1 w-full h-full p-6 py-2",children:h(ot,{columns:l.columns,rows:l.rows})}):l.artifact==="markdown"?h("div",{className:"flex-1 w-full h-full p-6 py-2",children:h(nt,{content:l.content})}):V("div",{className:"flex-1 flex items-center justify-center p-6 text-text-muted font-mono",children:["Componente ",l.artifact," desconocido."]})}return V("div",{ref:b,className:"flex-1 h-full rounded-2xl bg-surface-overlay flex items-center justify-center relative overflow-hidden group border border-border-subtle m-6 mt-2",children:[h("svg",{className:"absolute inset-0 pointer-events-none z-0 w-full h-full opacity-30",children:h("path",{d:"M 150 75 C 250 150, 350 50, 400 100",stroke:"cyan",strokeWidth:2,fill:"none",strokeDasharray:"10, 10"})}),u?.widgets?.map(l=>{let y=l.icon;return V("div",{className:`absolute cursor-grab rounded-2xl border ${l.bg} ${l.border} p-4 shadow-xl backdrop-blur-md flex flex-col justify-between`,style:{width:l.w,height:l.h,left:l.x,top:l.y},children:[V("div",{className:"flex justify-between items-start pointer-events-none z-10",children:[h("span",{className:"text-sm font-semibold text-text-primary/80",children:l.title}),h("div",{className:`p-1.5 rounded-lg bg-surface-glass ${l.color}`,children:h(y,{size:16})})]}),h("div",{className:`text-2xl font-bold mt-2 ${l.color} pointer-events-none z-10`,children:l.value}),l.chart&&h("div",{className:"absolute bottom-0 left-0 w-full h-16 opacity-30 pointer-events-none rounded-b-2xl overflow-hidden",children:h(at,{fallback:null,children:h(rt,{chartData:o,color:l.color})})})]},`${f}-${l.id}`)})]})}import{jsx as A,jsxs as W}from"react/jsx-runtime";var Ee={workbench:{icon:dt,label:"Workbench",color:"text-purple-400"},liquid:{icon:pt,label:"UI Din\xE1mica",color:"text-amber-400"},artifact:{icon:mt,label:"Artefacto",color:"text-emerald-400"},custom:{icon:ct,label:"Custom",color:"text-violet-400"}},Te=de.memo(function({showCanvas:s,setShowCanvas:a,activeConfig:t,prototypeBrand:u,activeState:d,chartData:f,dragConstraintsRef:o}){if(!s)return null;let b=j(T=>T.activeStage),p=j(T=>T.stageHistory),N=j(T=>T.popStage),g=j(T=>T.clearStages),l=L(T=>T.activeArtifactData),[y,P]=de.useState("3d"),D=b||(l?{type:"artifact",data:l}:null),E=D?.type||y,I=Ee[E]||Ee.custom,x=I.icon,i=()=>{g(),L.getState().setActiveArtifactData(null),a(!1)},w=()=>{p.length>0?N():g()};return A(Ce,{children:W(ke.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"w-full h-full bg-surface-secondary flex flex-col overflow-hidden relative border-l border-border-subtle",children:[W("div",{className:"flex justify-between items-center pl-2 z-10 p-4 pb-0 shrink-0",children:[W("div",{className:"flex items-center gap-2",children:[(b||l)&&A("button",{onClick:w,className:"p-1.5 rounded-lg hover:bg-surface-glass text-text-muted hover:text-text-primary transition-colors",title:"Volver",children:A(it,{size:16})}),W("h2",{className:"text-lg font-bold flex items-center gap-2 text-text-primary",children:[A("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center bg-surface-glass",children:A(x,{size:14,className:I.color})}),A("span",{className:"truncate max-w-[200px]",children:b?.label||(l?"Artefacto":"Lienzo de Trabajo")}),A("span",{className:"text-text-muted font-mono text-[10px] ml-1",children:E.toUpperCase()})]})]}),W("div",{className:"flex items-center gap-3",children:[p.length>0&&W("div",{className:"hidden md:flex items-center gap-1 text-[10px] text-text-muted font-mono",children:[p.map((T,M)=>W(de.Fragment,{children:[A("span",{className:"hover:text-text-secondary cursor-pointer",onClick:()=>{let z=j.getState();for(let Z=0;Z<p.length-M;Z++)z.popStage()},children:T.label||T.type}),A("span",{children:"\u203A"})]},M)),A("span",{className:"text-text-secondary",children:b?.label||E})]}),!D&&W("div",{className:"flex bg-surface-glass border border-border-default rounded-full p-1",children:[A("button",{onClick:()=>P("2d"),className:`px-3 py-1 text-[10px] font-bold tracking-wider rounded-full transition-all ${y==="2d"?"bg-surface-glass text-text-primary shadow-xs":"text-text-muted hover:text-text-primary"}`,children:"2D DATA"}),A("button",{onClick:()=>P("3d"),className:`px-3 py-1 text-[10px] font-bold tracking-wider rounded-full transition-all ${y==="3d"?"bg-cyan-500/20 text-cyan-400 shadow-[0_0_10px_rgba(6,182,212,0.3)]":"text-text-muted hover:text-text-primary"}`,children:"3D SCENE"})]}),A("button",{onClick:i,className:"p-2 bg-surface-glass hover:bg-red-500/20 text-text-secondary hover:text-red-400 rounded-full transition-colors",children:A(lt,{size:16})})]})]}),A("div",{className:"flex-1 relative overflow-hidden",children:A(Ce,{mode:"wait",children:A(ke.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},className:"w-full h-full",children:A(Se,{renderingType:E,activeStage:b,activeArtifactData:l,activeConfig:t,activeState:d,prototypeBrand:u,chartData:f,dragConstraintsRef:o,defaultViewMode:y})},E+(b?.componentId||""))})})]})})});import{motion as Ie,AnimatePresence as ut}from"motion/react";import{X as xt,FileCode as Ae,FileText as bt,Globe as ft,Layers as gt,MessageSquare as vt}from"lucide-react";import{jsx as J,jsxs as De}from"react/jsx-runtime";var yt={markdown:bt,iframe:ft,"shell-vscode":Ae,"shell-canvas":gt,"shell-omnichannel":vt};function ht(e){return yt[e]||Ae}function _e({instanceId:e,className:s=""}){let a=C(d=>d.getInstance(e)),t=C(d=>d.setActiveArtifact),u=C(d=>d.removeArtifact);return!a||a.artifacts.length<=1?null:J("div",{className:`flex items-center gap-0.5 px-2 py-1 bg-surface-primary border-b border-border-subtle overflow-x-auto scrollbar-hide ${s}`,children:J(ut,{mode:"popLayout",children:a.artifacts.map((d,f)=>{let o=f===a.activeArtifactIndex,b=ht(d.shellType);return De(Ie.button,{layout:!0,initial:{opacity:0,scale:.9,width:0},animate:{opacity:1,scale:1,width:"auto"},exit:{opacity:0,scale:.9,width:0},onClick:()=>t(e,f),className:`
2
+ flex items-center gap-1.5 px-2.5 py-1 rounded-md text-[10px] font-medium
3
+ transition-colors whitespace-nowrap group relative shrink-0
4
+ ${o?"bg-surface-glass text-text-primary border border-border-default":"text-text-muted hover:text-text-primary hover:bg-surface-glass border border-transparent"}
5
+ `,children:[J(b,{size:10,className:o?"text-cyan-400":"text-text-muted"}),J("span",{className:"truncate max-w-[100px]",children:d.name}),d.version>1&&De("span",{className:"text-[8px] text-text-muted font-mono",children:["v",d.version]}),a.artifacts.length>1&&J("span",{onClick:p=>{p.stopPropagation(),u(e,d.id)},className:`w-3.5 h-3.5 rounded flex items-center justify-center
6
+ opacity-0 group-hover:opacity-100 hover:bg-surface-glass hover:text-red-400
7
+ transition-all ml-0.5`,children:J(xt,{size:8})}),o&&J(Ie.div,{layoutId:"artifact-indicator",className:"absolute bottom-0 left-1 right-1 h-[1.5px] bg-cyan-500/50 rounded-full"})]},d.id)})})})}import{Box as wt,CodeXml as Nt,Droplets as St,Puzzle as kt,FileBox as Ct,LayoutDashboard as Et}from"lucide-react";var pe={"3d":{icon:wt,color:"text-cyan-400"},"2d":{icon:Et,color:"text-emerald-400"},workbench:{icon:Nt,color:"text-purple-400"},liquid:{icon:St,color:"text-blue-400"},custom:{icon:kt,color:"text-orange-400"},artifact:{icon:Ct,color:"text-yellow-400"}};import{useMemo as Tt,useRef as It,useEffect as ne,useState as ee,useCallback as ae}from"react";import{Paintbrush as Le,X as Pe,Plus as Dt,Copy as Me,RotateCcw as At,Search as _t,MousePointer as Re,ChevronDown as Pt,ChevronRight as Mt}from"lucide-react";import{jsx as v,jsxs as k}from"react/jsx-runtime";var je=({data:e})=>{let s=e?.content||e?.markdown||"";return v("div",{className:"w-full h-full overflow-auto bg-surface-primary p-8 custom-scrollbar",children:v("div",{className:"max-w-3xl mx-auto prose prose-invert prose-sm prose-zinc",children:v("div",{className:"whitespace-pre-wrap text-text-primary font-sans leading-relaxed text-sm",children:s})})})},me=`
8
+ <script>
9
+ (function() {
10
+ var inspectorActive = false;
11
+ var selectedEl = null;
12
+ var hoveredEl = null;
13
+
14
+ function generateSelector(el) {
15
+ var parts = [];
16
+ var cur = el;
17
+ while (cur && cur !== document.body && cur !== document.documentElement) {
18
+ var part = cur.tagName.toLowerCase();
19
+ if (cur.id) { parts.unshift('#' + cur.id); break; }
20
+ var parent = cur.parentElement;
21
+ if (parent) {
22
+ var sibs = Array.from(parent.children).filter(function(c) { return c.tagName === cur.tagName; });
23
+ if (sibs.length > 1) {
24
+ part += ':nth-of-type(' + (sibs.indexOf(cur) + 1) + ')';
25
+ }
26
+ }
27
+ parts.unshift(part);
28
+ cur = cur.parentElement;
29
+ }
30
+ return parts.join(' > ');
31
+ }
32
+
33
+ window.addEventListener('message', function(e) {
34
+ if (e.data && e.data.type === 'tw-bridge:toggle') {
35
+ inspectorActive = !!e.data.enabled;
36
+ document.body.style.cursor = inspectorActive ? 'crosshair' : '';
37
+ if (!inspectorActive) {
38
+ if (hoveredEl) { hoveredEl.style.outline = ''; hoveredEl.style.outlineOffset = ''; hoveredEl = null; }
39
+ if (selectedEl) { selectedEl.style.outline = ''; selectedEl.style.outlineOffset = ''; selectedEl = null; }
40
+ }
41
+ }
42
+ if (e.data && e.data.type === 'tw-bridge:apply') {
43
+ var el = document.querySelector(e.data.selector);
44
+ if (el) el.className = e.data.classes.join(' ');
45
+ }
46
+ });
47
+
48
+ document.addEventListener('mouseover', function(e) {
49
+ if (!inspectorActive) return;
50
+ var t = e.target;
51
+ if (hoveredEl && hoveredEl !== selectedEl) {
52
+ hoveredEl.style.outline = '';
53
+ hoveredEl.style.outlineOffset = '';
54
+ }
55
+ t.style.outline = '2px dashed rgba(139, 92, 246, 0.6)';
56
+ t.style.outlineOffset = '2px';
57
+ hoveredEl = t;
58
+ });
59
+
60
+ document.addEventListener('mouseout', function(e) {
61
+ if (!inspectorActive) return;
62
+ if (e.target !== selectedEl) {
63
+ e.target.style.outline = '';
64
+ e.target.style.outlineOffset = '';
65
+ }
66
+ });
67
+
68
+ document.addEventListener('click', function(e) {
69
+ if (!inspectorActive) return;
70
+ e.preventDefault();
71
+ e.stopPropagation();
72
+ var t = e.target;
73
+ if (selectedEl) { selectedEl.style.outline = ''; selectedEl.style.outlineOffset = ''; }
74
+ t.style.outline = '2px solid rgba(139, 92, 246, 0.9)';
75
+ t.style.outlineOffset = '2px';
76
+ selectedEl = t;
77
+ var classes = t.className ? t.className.split(/\\s+/).filter(Boolean) : [];
78
+ var rect = t.getBoundingClientRect();
79
+ window.parent.postMessage({
80
+ type: 'tw-bridge:select',
81
+ selector: generateSelector(t),
82
+ tagName: t.tagName,
83
+ classes: classes,
84
+ originalClasses: classes,
85
+ rect: { width: rect.width, height: rect.height }
86
+ }, '*');
87
+ }, true);
88
+ })();
89
+ </script>`,Rt=[{id:"layout",label:"Layout",classes:["flex","inline-flex","grid","block","hidden","flex-row","flex-col","items-center","items-start","items-end","justify-center","justify-between","justify-start","justify-end","relative","absolute","fixed","overflow-hidden","overflow-auto"]},{id:"spacing",label:"Spacing",classes:["p-0","p-1","p-2","p-3","p-4","p-6","p-8","px-2","px-4","px-6","py-1","py-2","py-3","py-4","m-0","m-1","m-2","m-4","mx-auto","my-2","my-4","gap-1","gap-2","gap-3","gap-4","gap-6"]},{id:"sizing",label:"Sizing",classes:["w-full","w-auto","w-1/2","w-1/3","h-full","h-auto","h-screen","min-w-0","max-w-sm","max-w-md","max-w-lg"]},{id:"typography",label:"Type",classes:["text-xs","text-sm","text-base","text-lg","text-xl","text-2xl","font-light","font-normal","font-medium","font-semibold","font-bold","text-left","text-center","text-right","truncate"]},{id:"colors",label:"Colors",classes:["text-white","text-black","text-gray-500","bg-white","bg-black","bg-transparent","bg-gray-100","bg-gray-800","bg-gray-900","bg-blue-500","bg-green-500","bg-red-500","bg-purple-500","bg-cyan-500"]},{id:"borders",label:"Borders",classes:["border","border-0","border-2","rounded-none","rounded-sm","rounded","rounded-md","rounded-lg","rounded-xl","rounded-2xl","rounded-full"]},{id:"effects",label:"Effects",classes:["shadow-sm","shadow","shadow-md","shadow-lg","shadow-xl","opacity-0","opacity-50","opacity-100","transition-all","transition-colors","cursor-pointer"]}];function Lt({iframeRef:e,isOpen:s,onClose:a}){let[t,u]=ee(null),[d,f]=ee(!0),[o,b]=ee(""),[p,N]=ee("layout"),[g,l]=ee("");ne(()=>{if(!s)return;let i=w=>{w.data?.type==="tw-bridge:select"&&u({selector:w.data.selector,tagName:w.data.tagName,classes:w.data.classes||[],originalClasses:w.data.originalClasses||w.data.classes||[],rect:w.data.rect||{width:0,height:0}})};return window.addEventListener("message",i),()=>window.removeEventListener("message",i)},[s]),ne(()=>{s&&e.current?.contentWindow?.postMessage({type:"tw-bridge:toggle",enabled:d},"*")},[d,s,e]),ne(()=>{s?(f(!0),e.current?.contentWindow?.postMessage({type:"tw-bridge:toggle",enabled:!0},"*")):e.current?.contentWindow?.postMessage({type:"tw-bridge:toggle",enabled:!1},"*")},[s,e]);let y=ae(i=>{t&&(u(w=>w?{...w,classes:i}:null),e.current?.contentWindow?.postMessage({type:"tw-bridge:apply",selector:t.selector,classes:i},"*"))},[t,e]),P=ae(i=>{t&&y(t.classes.filter(w=>w!==i))},[t,y]),D=ae(i=>{if(!t)return;let w=i.trim();!w||t.classes.includes(w)||(y([...t.classes,w]),b(""))},[t,y]),E=ae(()=>{t&&y([...t.originalClasses])},[t,y]),I=ae(()=>{t&&navigator.clipboard.writeText(t.classes.join(" "))},[t]),x=t&&JSON.stringify(t.classes)!==JSON.stringify(t.originalClasses);return s?k("div",{className:"w-[280px] shrink-0 flex flex-col bg-surface-primary border-l border-border-subtle h-full text-text-primary",children:[k("div",{className:"px-3 py-2 border-b border-border-subtle shrink-0",children:[k("div",{className:"flex items-center justify-between mb-1.5",children:[k("div",{className:"flex items-center gap-1.5",children:[v(Le,{size:12,className:"text-accent-purple"}),v("span",{className:"text-[11px] font-bold",children:"TW Editor"}),v("span",{className:"text-[7px] px-1 py-0.5 rounded-full bg-accent-purple/15 text-accent-purple font-mono font-bold",children:"LIVE"})]}),v("button",{onClick:a,className:"text-text-muted hover:text-text-primary transition-colors",children:v(Pe,{size:12})})]}),k("button",{onClick:()=>f(!d),className:`w-full flex items-center gap-1.5 px-2 py-1 rounded text-[10px] font-medium transition-all cursor-pointer ${d?"bg-accent-purple/15 text-accent-purple border border-accent-purple/30":"bg-surface-glass text-text-muted border border-border-subtle"}`,children:[v(Re,{size:10}),d?"Click un elemento":"Inspector off",v("span",{className:`ml-auto w-1.5 h-1.5 rounded-full ${d?"bg-accent-green animate-pulse":"bg-text-muted/30"}`})]})]}),t?k("div",{className:"flex-1 flex flex-col overflow-hidden",children:[v("div",{className:"px-3 py-1.5 border-b border-border-subtle/50 shrink-0",children:k("div",{className:"flex items-center gap-1.5",children:[k("span",{className:"text-[9px] font-mono px-1 py-0.5 rounded bg-surface-glass text-text-muted",children:["<",t.tagName.toLowerCase(),">"]}),k("span",{className:"text-[8px] font-mono text-text-muted/40 ml-auto",children:[Math.round(t.rect.width),"\xD7",Math.round(t.rect.height)]})]})}),k("div",{className:"px-3 py-1.5 border-b border-border-subtle/50 shrink-0",children:[k("div",{className:"flex items-center justify-between mb-1",children:[k("span",{className:"text-[8px] font-mono text-text-muted/60 uppercase tracking-wider",children:["Clases (",t.classes.length,")"]}),k("div",{className:"flex gap-1",children:[x&&k("button",{onClick:E,className:"text-[7px] text-accent-amber flex items-center gap-0.5 cursor-pointer",children:[v(At,{size:7})," Undo"]}),k("button",{onClick:I,className:"text-[7px] text-text-muted/40 hover:text-accent-cyan flex items-center gap-0.5 cursor-pointer",children:[v(Me,{size:7})," Copy"]})]})]}),v("div",{className:"flex flex-wrap gap-0.5 max-h-[100px] overflow-y-auto custom-scrollbar",children:t.classes.map(i=>{let w=!t.originalClasses.includes(i);return k("span",{className:`group inline-flex items-center gap-0.5 px-1 py-0.5 rounded text-[8px] font-mono transition-all ${w?"bg-accent-green/15 text-accent-green border border-accent-green/30":"bg-surface-glass text-text-secondary border border-border-subtle"}`,children:[i,v("button",{onClick:()=>P(i),className:"opacity-0 group-hover:opacity-100 text-red-400 cursor-pointer",children:v(Pe,{size:7})})]},i)})}),x&&v("div",{className:"mt-1 flex flex-wrap gap-0.5",children:t.originalClasses.filter(i=>!t.classes.includes(i)).map(i=>v("button",{onClick:()=>D(i),className:"px-1 py-0.5 rounded text-[8px] font-mono bg-red-500/10 text-red-400/60 border border-red-500/20 line-through hover:no-underline cursor-pointer",children:i},`rm-${i}`))})]}),k("div",{className:"px-3 py-1.5 border-b border-border-subtle/50 shrink-0 flex gap-1",children:[k("div",{className:"flex-1 relative",children:[v(Dt,{size:9,className:"absolute left-1.5 top-1/2 -translate-y-1/2 text-text-muted/40"}),v("input",{type:"text",value:o,onChange:i=>b(i.target.value),onKeyDown:i=>{i.key==="Enter"&&o.trim()&&D(o)},placeholder:"Agregar clase...",className:"w-full pl-5 pr-1 py-1 text-[10px] font-mono bg-surface-glass border border-border-subtle rounded text-text-primary placeholder:text-text-muted/30 focus:outline-none focus:border-accent-purple/40"})]}),v("button",{onClick:()=>D(o),disabled:!o.trim(),className:"px-2 py-1 rounded bg-accent-purple/15 text-accent-purple text-[9px] font-bold disabled:opacity-30 cursor-pointer",children:"+"})]}),k("div",{className:"flex-1 overflow-y-auto custom-scrollbar",children:[v("div",{className:"px-3 py-1 border-b border-border-subtle/30 sticky top-0 bg-surface-primary z-10",children:k("div",{className:"relative",children:[v(_t,{size:9,className:"absolute left-1.5 top-1/2 -translate-y-1/2 text-text-muted/30"}),v("input",{type:"text",value:g,onChange:i=>l(i.target.value),placeholder:"Filtrar...",className:"w-full pl-5 pr-1 py-0.5 text-[9px] font-mono bg-surface-glass border border-border-subtle/50 rounded text-text-primary placeholder:text-text-muted/20 focus:outline-none"})]})}),Rt.map(i=>{let w=g?i.classes.filter(M=>M.includes(g.toLowerCase())):i.classes;if(w.length===0)return null;let T=p===i.id;return k("div",{className:"border-b border-border-subtle/20",children:[k("button",{onClick:()=>N(T?null:i.id),className:"w-full flex items-center gap-1.5 px-3 py-1 hover:bg-surface-glass text-left cursor-pointer",children:[T?v(Pt,{size:8}):v(Mt,{size:8}),v("span",{className:"text-[9px] font-semibold text-text-primary flex-1",children:i.label}),v("span",{className:"text-[7px] font-mono text-text-muted/40",children:w.length})]}),T&&v("div",{className:"px-3 pb-1.5 flex flex-wrap gap-0.5",children:w.map(M=>{let z=t.classes.includes(M);return k("button",{onClick:()=>z?P(M):D(M),className:`px-1 py-0.5 rounded text-[8px] font-mono cursor-pointer transition-all ${z?"bg-accent-green/15 text-accent-green border border-accent-green/30":"bg-surface-glass text-text-muted border border-border-subtle/50 hover:border-accent-purple/30"}`,children:[z?"\u2713 ":"",M]},M)})})]},i.id)})]}),x&&k("div",{className:"px-3 py-1.5 border-t border-border-subtle bg-surface-secondary/50 shrink-0",children:[k("div",{className:"flex items-center justify-between mb-0.5",children:[v("span",{className:"text-[7px] font-mono text-accent-green/60 uppercase",children:"className"}),k("button",{onClick:I,className:"text-[7px] text-text-muted/40 hover:text-accent-cyan flex items-center gap-0.5 cursor-pointer",children:[v(Me,{size:7})," Copy"]})]}),v("div",{className:"text-[8px] font-mono text-text-secondary bg-surface-primary p-1.5 rounded border border-border-subtle max-h-[48px] overflow-y-auto break-all",children:t.classes.join(" ")})]})]}):k("div",{className:"flex-1 flex flex-col items-center justify-center p-4 text-center",children:[v(Re,{size:20,className:"text-accent-purple/30 mb-2"}),v("p",{className:"text-[10px] text-text-muted",children:"Click un elemento del preview"}),v("p",{className:"text-[8px] text-text-muted/40 mt-0.5",children:"para editar sus clases Tailwind"})]})]}):null}var ze=({data:e,instanceId:s})=>{let a=It(null),t=e?.content||e?.html||"",u=e?.url||"",[d,f]=ee(!1),o=Tt(()=>{if(u)return u;if(!t)return"about:blank";let b='<script src="https://cdn.tailwindcss.com"></script>',p=t;p.includes("</body>")?p=p.replace("</body>",`${b}${me}</body>`):p.includes("</html>")?p=p.replace("</html>",`${b}${me}</html>`):p+=`${b}${me}`;let N=new Blob([p],{type:"text/html"});return URL.createObjectURL(N)},[t,u]);return ne(()=>()=>{!u&&o!=="about:blank"&&URL.revokeObjectURL(o)},[o,u]),k("div",{className:"w-full h-full bg-surface-secondary rounded-lg overflow-hidden flex",children:[k("div",{className:"flex-1 relative",children:[v("iframe",{ref:a,src:o,title:`sandbox-${s}`,sandbox:"allow-scripts allow-same-origin allow-forms",className:"w-full h-full border-none"}),k("button",{onClick:()=>f(!d),className:`absolute top-2 right-2 z-10 flex items-center gap-1 px-2 py-1 rounded-lg text-[10px] font-semibold transition-all shadow-lg cursor-pointer ${d?"bg-accent-purple text-white":"bg-black/60 text-white/80 hover:bg-accent-purple/80 hover:text-white backdrop-blur-sm"}`,title:"Tailwind Editor",children:[v(Le,{size:11})," TW"]})]}),v(Lt,{iframeRef:a,isOpen:d,onClose:()=>f(!1)})]})};import{useState as jt,useCallback as zt}from"react";import{jsx as r,jsxs as S}from"react/jsx-runtime";var $t=[{title:"Surfaces",icon:"\u25FB\uFE0F",tokens:[{key:"surface-primary",label:"Primary"},{key:"surface-secondary",label:"Secondary"},{key:"surface-tertiary",label:"Tertiary"},{key:"surface-elevated",label:"Elevated"}]},{title:"Text",icon:"\u270F\uFE0F",tokens:[{key:"text-primary",label:"Primary"},{key:"text-secondary",label:"Secondary"},{key:"text-muted",label:"Muted"}]},{title:"Accents",icon:"\u{1F48E}",tokens:[{key:"accent-blue",label:"Blue"},{key:"accent-purple",label:"Purple"},{key:"accent-green",label:"Green"},{key:"accent-red",label:"Red"},{key:"accent-amber",label:"Amber"},{key:"accent-cyan",label:"Cyan"}]},{title:"Borders",icon:"\u25AC",tokens:[{key:"border-subtle",label:"Subtle"},{key:"border-default",label:"Default"},{key:"border-strong",label:"Strong"},{key:"border-glow",label:"Glow"}]},{title:"Status",icon:"\u25CF",tokens:[{key:"status-ok",label:"Success"},{key:"status-warn",label:"Warning"},{key:"status-error",label:"Error"},{key:"status-info",label:"Info"}]}];function Ot({tokenKey:e,label:s}){let{getCurrentPreset:a,setToken:t}=ce(),d=a().tokens[e];return S("div",{className:"flex items-center gap-2 py-1.5 px-2 rounded-lg bg-surface-glass hover:bg-surface-elevated/50 transition-colors group",children:[S("div",{className:"relative w-6 h-6 shrink-0",children:[r("div",{className:"w-6 h-6 rounded-md border border-border-default",style:{background:d}}),r("input",{type:"color",value:d.startsWith("#")?d:"#888888",onChange:f=>t(e,f.target.value),className:"absolute inset-0 opacity-0 w-full h-full cursor-pointer"})]}),S("div",{className:"flex-1 min-w-0",children:[r("div",{className:"text-[11px] font-semibold text-text-primary truncate",children:s}),S("div",{className:"text-[9px] text-text-muted font-mono",children:["--ds-",e]})]}),r("span",{className:"text-[10px] text-text-muted font-mono opacity-0 group-hover:opacity-100 transition-opacity",children:d.slice(0,9)})]})}function Bt({preset:e,isActive:s,onSelect:a}){return S("button",{onClick:a,className:`flex flex-col items-center gap-2 p-3 rounded-xl border transition-all duration-200 cursor-pointer ${s?"border-accent-purple bg-accent-purple/10 shadow-glow-sm":"border-border-subtle bg-surface-glass hover:border-border-default hover:bg-surface-elevated/30"}`,children:[r("div",{className:"flex gap-1",children:[e.preview.bg,e.preview.accent,e.preview.text].map((t,u)=>r("div",{className:"w-3 h-3 rounded-full border border-border-subtle",style:{background:t}},u))}),r("span",{className:"text-[10px] font-medium text-text-secondary",children:e.name})]})}function Ft(){return S("div",{className:"flex flex-col gap-4 p-3",children:[r(H,{title:"Buttons",children:S("div",{className:"flex flex-wrap gap-2",children:[r("button",{className:"px-4 py-2 bg-accent-purple text-text-inverse rounded-lg text-xs font-semibold hover:opacity-90 transition-opacity",children:"Primary"}),r("button",{className:"px-4 py-2 bg-surface-glass border border-border-default text-text-primary rounded-lg text-xs font-semibold hover:bg-surface-elevated transition-colors",children:"Secondary"}),r("button",{className:"px-4 py-2 bg-accent-red/10 text-accent-red border border-accent-red/20 rounded-lg text-xs font-semibold hover:bg-accent-red/20 transition-colors",children:"Destructive"}),r("button",{className:"px-3 py-1.5 text-text-secondary text-xs hover:text-text-primary transition-colors",children:"Ghost"})]})}),S(H,{title:"Cards",children:[S("div",{className:"surface-card p-4",children:[r("div",{className:"text-sm font-semibold text-text-primary mb-1",children:"Glass Card"}),r("div",{className:"text-xs text-text-secondary",children:"Surface secondary con border subtle y hover."})]}),S("div",{className:"glass-panel rounded-xl p-4 mt-2",children:[r("div",{className:"text-sm font-semibold text-text-primary mb-1",children:"Glass Panel"}),r("div",{className:"text-xs text-text-secondary",children:"Overlay + backdrop blur + border default."})]})]}),S(H,{title:"Inputs",children:[r("input",{type:"text",placeholder:"Escribe algo...",className:"w-full px-3 py-2 bg-surface-primary border border-border-default rounded-lg text-sm text-text-primary placeholder:text-text-muted focus:border-accent-purple focus:ring-1 focus:ring-accent-purple/30 outline-hidden transition-all"}),S("div",{className:"flex gap-2 mt-2",children:[r("input",{type:"text",value:"Readonly",readOnly:!0,className:"flex-1 px-3 py-2 bg-surface-glass border border-border-subtle rounded-lg text-sm text-text-secondary"}),S("select",{className:"px-3 py-2 bg-surface-primary border border-border-default rounded-lg text-sm text-text-primary outline-hidden",children:[r("option",{children:"Opci\xF3n A"}),r("option",{children:"Opci\xF3n B"})]})]})]}),r(H,{title:"Badges & Status",children:S("div",{className:"flex flex-wrap gap-2",children:[r("span",{className:"px-2 py-0.5 bg-status-ok/10 text-status-ok border border-status-ok/20 rounded-full text-[10px] font-semibold",children:"Active"}),r("span",{className:"px-2 py-0.5 bg-status-warn/10 text-status-warn border border-status-warn/20 rounded-full text-[10px] font-semibold",children:"Pending"}),r("span",{className:"px-2 py-0.5 bg-status-error/10 text-status-error border border-status-error/20 rounded-full text-[10px] font-semibold",children:"Error"}),r("span",{className:"px-2 py-0.5 bg-status-info/10 text-status-info border border-status-info/20 rounded-full text-[10px] font-semibold",children:"Info"}),r("span",{className:"px-2 py-0.5 bg-accent-purple/10 text-accent-purple border border-accent-purple/20 rounded-full text-[10px] font-semibold",children:"Plugin"})]})}),r(H,{title:"Chat Bubbles",children:S("div",{className:"flex flex-col gap-2",children:[r("div",{className:"self-end max-w-[80%] px-3 py-2 bg-accent-purple/10 border border-accent-purple/20 rounded-2xl rounded-br-sm",children:r("div",{className:"text-xs text-text-primary",children:"Hola, \xBFc\xF3mo puedo ayudarte hoy?"})}),r("div",{className:"self-start max-w-[80%] px-3 py-2 bg-surface-glass border border-border-subtle rounded-2xl rounded-bl-sm",children:r("div",{className:"text-xs text-text-primary",children:"Muestra el dashboard de ventas"})}),r("div",{className:"self-end max-w-[80%] px-3 py-2 bg-accent-blue/10 border border-accent-blue/20 rounded-2xl rounded-br-sm",children:r("span",{className:"inline-flex items-center gap-1 text-xs text-accent-blue font-medium",children:"\u25CF Generando dise\xF1o web..."})})]})}),S(H,{title:"Typography",children:[r("h1",{className:"text-xl font-bold text-text-primary",children:"Heading Primary"}),r("h2",{className:"text-base font-semibold text-text-secondary",children:"Heading Secondary"}),r("p",{className:"text-sm text-text-secondary mt-1",children:"Body text con color secundario para contenido descriptivo."}),r("p",{className:"text-xs text-text-muted mt-1",children:"Caption text en muted para metadata y timestamps."}),r("p",{className:"text-sm text-gradient font-bold mt-2",children:"\u2726 Gradient text premium"})]}),r(H,{title:"Accent Palette",children:r("div",{className:"grid grid-cols-6 gap-1",children:["accent-blue","accent-purple","accent-green","accent-red","accent-amber","accent-cyan"].map(e=>S("div",{className:"flex flex-col items-center gap-1",children:[r("div",{className:`w-8 h-8 rounded-lg bg-${e}`}),r("span",{className:"text-[8px] text-text-muted",children:e.split("-")[1]})]},e))})}),r(H,{title:"Graph Nodes",children:r("div",{className:"flex gap-2",children:[{name:"Dialogue",border:"border-accent-purple/30",header:"bg-accent-purple/10"},{name:"Logic",border:"border-accent-amber/30",header:"bg-accent-amber/10"},{name:"State",border:"border-accent-cyan/30",header:"bg-accent-cyan/10"}].map(e=>S("div",{className:`flex-1 bg-surface-tertiary ${e.border} border rounded-lg overflow-hidden`,children:[r("div",{className:`${e.header} px-2 py-1 text-[10px] font-semibold text-text-primary`,children:e.name}),r("div",{className:"px-2 py-2 text-[9px] text-text-muted",children:"Node content"})]},e.name))})})]})}function H({title:e,children:s}){return S("div",{children:[r("div",{className:"text-[10px] font-bold uppercase tracking-wider text-text-muted mb-2",children:e}),s]})}function $e(){let[e,s]=jt("themes"),{currentThemeId:a,setTheme:t,exportCSS:u,getAllPresets:d,getCurrentPreset:f}=ce(),o=zt(()=>{let p=u();navigator.clipboard.writeText(p)},[u]),b=[{id:"themes",icon:"\u{1F3A8}",label:"Temas"},{id:"tokens",icon:"\u{1F527}",label:"Tokens"},{id:"showroom",icon:"\u{1F3DB}\uFE0F",label:"Showroom"}];return S("div",{className:"flex flex-col h-full bg-surface-primary text-text-primary font-sans overflow-hidden",children:[S("div",{className:"flex items-center gap-2 px-3 py-2.5 border-b border-border-subtle bg-surface-glass",children:[r("span",{className:"text-sm",children:"\u{1F3A8}"}),r("span",{className:"text-xs font-bold flex-1",children:"Design System"}),r("span",{className:"text-[9px] px-1.5 py-0.5 bg-accent-purple/10 text-accent-purple rounded font-mono",children:f().name}),r("button",{onClick:o,className:"px-2.5 py-1 border border-border-default rounded-md bg-accent-purple hover:bg-accent-purple/80 text-[10px] text-text-primary font-medium cursor-pointer transition-colors",children:"Export CSS"})]}),r("div",{className:"flex border-b border-border-subtle",children:b.map(p=>S("button",{onClick:()=>s(p.id),className:`flex-1 flex items-center justify-center gap-1.5 py-2 text-[10px] font-semibold transition-all cursor-pointer ${e===p.id?"text-accent-purple border-b-2 border-accent-purple bg-accent-purple/5":"text-text-muted hover:text-text-secondary hover:bg-surface-glass"}`,children:[r("span",{children:p.icon}),r("span",{children:p.label})]},p.id))}),S("div",{className:"flex-1 overflow-auto custom-scrollbar",children:[e==="themes"&&S("div",{className:"p-3 flex flex-col gap-3",children:[r("div",{className:"text-[10px] font-bold uppercase tracking-wider text-text-muted",children:"Presets"}),r("div",{className:"grid grid-cols-2 gap-2",children:d().map(p=>r(Bt,{preset:p,isActive:a===p.id,onSelect:()=>t(p.id)},p.id))}),S("div",{className:"mt-2",children:[r("div",{className:"text-[10px] font-bold uppercase tracking-wider text-text-muted mb-2",children:"Vista R\xE1pida"}),S("div",{className:"surface-card p-3 flex flex-col gap-2",children:[S("div",{className:"flex items-center gap-2",children:[r("div",{className:"w-8 h-8 rounded-full bg-accent-purple flex items-center justify-center text-text-inverse text-[10px] font-bold",children:"Z"}),S("div",{children:[r("div",{className:"text-xs font-semibold text-text-primary",children:"Zephyr AI"}),r("div",{className:"text-[10px] text-text-muted",children:"Agente activo \u2022 ahora"})]})]}),r("div",{className:"px-3 py-2 bg-surface-glass rounded-xl text-xs text-text-secondary",children:"\xBFEn qu\xE9 puedo ayudarte hoy?"}),S("div",{className:"flex gap-1.5",children:[r("span",{className:"px-2 py-0.5 bg-status-ok/10 text-status-ok rounded-full text-[9px] font-medium",children:"Online"}),r("span",{className:"px-2 py-0.5 bg-accent-blue/10 text-accent-blue rounded-full text-[9px] font-medium",children:"GPT-4"})]})]})]})]}),e==="tokens"&&r("div",{className:"p-3 flex flex-col gap-3",children:$t.map(p=>S("div",{children:[S("div",{className:"text-[10px] font-bold uppercase tracking-wider text-text-muted mb-1.5 flex items-center gap-1",children:[r("span",{children:p.icon})," ",p.title]}),r("div",{className:"flex flex-col gap-1",children:p.tokens.map(N=>r(Ot,{tokenKey:N.key,label:N.label},N.key))})]},p.title))}),e==="showroom"&&r(Ft,{})]})]})}import{useEffect as Gt}from"react";import{Database as Ut}from"lucide-react";import{jsx as le,jsxs as Oe}from"react/jsx-runtime";var Be=({artifacts:e,activeArtifactIndex:s})=>{let a=e?.[s];if(Gt(()=>{if(!a)return;let u="";typeof a.content=="string"?u=a.content:a.data&&typeof a.data.content=="string"&&(u=a.data.content),u&&(u=u.replace(/```[a-zA-Z-]*\n/gi,"").replace(/```/g,"").trim(),window.dispatchEvent(new CustomEvent("intent:dataway-generate-script",{detail:{script:u}})))},[a]),!a)return null;let t=typeof a.content=="string"?a.content:a.data?.content||"";return t=t.replace(/```[a-zA-Z-]*\n/gi,"").replace(/```/g,"").trim(),Oe("div",{className:"w-full flex tracking-tight flex-col border border-teal-500/20 bg-teal-500/5 rounded-xl overflow-hidden mt-2",children:[Oe("div",{className:"bg-teal-500/10 px-3 py-2 flex items-center gap-2 border-b border-teal-500/10",children:[le(Ut,{className:"w-4 h-4 text-teal-600 dark:text-teal-400"}),le("span",{className:"text-[11px] font-bold text-teal-800 dark:text-teal-300 uppercase tracking-widest",children:"M-Script Aplicado"})]}),le("div",{className:"p-3",children:le("pre",{className:"text-[13px] font-mono text-teal-900/80 dark:text-teal-100/80 whitespace-pre-wrap break-all",children:t})})]})};import{useState as K,useRef as Yt,useMemo as Ke,useCallback as fe,useEffect as ge}from"react";import{Monitor as Qt,Tablet as ea,Smartphone as ta,RotateCcw as aa,ExternalLink as sa,Maximize2 as ra,Minimize2 as oa,MousePointer2 as Ve,Rocket as na,Copy as la,Check as Je,Loader2 as qe,Code2 as ia,Undo2 as ca,Redo2 as da}from"lucide-react";import{useState as Wt,useCallback as ue}from"react";function xe(e,s,a){return`<!DOCTYPE html>
90
+ <html lang="es">
91
+ <head>
92
+ <meta charset="UTF-8">
93
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
94
+ <title>Decido Preview</title>
95
+ <script src="https://cdn.tailwindcss.com"></script>
96
+ <style>
97
+ *, *::before, *::after { box-sizing: border-box; }
98
+ body {
99
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
100
+ margin: 0;
101
+ background: #fff;
102
+ min-height: 100vh;
103
+ }
104
+ ${s}
105
+ </style>
106
+ </head>
107
+ <body>
108
+ ${e}
109
+ <script>try { ${a} } catch(e) { console.error(e); }</script>
110
+ </body>
111
+ </html>`}function Fe(){let[e,s]=Wt({status:"idle",url:null,error:null,progress:0}),a=ue(async()=>{let d=C.getState().getActiveInstance();if(!d?.data?.html){s({status:"error",url:null,error:"No hay contenido para desplegar",progress:0});return}let{html:f,css:o,javascript:b}=d.data;s({status:"deploying",url:null,error:null,progress:10});let p=localStorage.getItem("nexusai_api_key");if(p)try{s(I=>({...I,progress:30}));let N="@nexusai/sdk",{NexusAI:g}=await import(N),l=new g({apiKey:p}),y=xe(f,o||"",b||""),{jobId:P}=await l.pipeline.deploy({componentName:`preview-${Date.now()}`,componentCode:y});s(I=>({...I,progress:60}));let D=await l.pipeline.waitForDeploy(P,{timeoutMs:6e4,onProgress:I=>s(x=>({...x,progress:60+Math.round((I.progress||0)*.4)}))}),E=D.result?.deploymentUrl||D.result?.url||"";s({status:"success",url:E,error:null,progress:100})}catch(N){let g=xe(f,o||"",b||""),l=new Blob([g],{type:"text/html"}),y=URL.createObjectURL(l);s({status:"success",url:y,error:`SDK fall\xF3 (${N.message}). Preview local generado.`,progress:100})}else{await new Promise(y=>setTimeout(y,500)),s(y=>({...y,progress:50}));let N=xe(f,o||"",b||""),g=new Blob([N],{type:"text/html"}),l=URL.createObjectURL(g);s({status:"success",url:l,error:null,progress:100})}},[]),t=ue(()=>{s({status:"idle",url:null,error:null,progress:0})},[]),u=ue(()=>{e.url&&navigator.clipboard.writeText(e.url)},[e.url]);return{...e,deploy:a,reset:t,copyUrl:u}}import Ht,{useState as Ge,useCallback as Kt,useEffect as Vt,useRef as Jt}from"react";import{jsx as se,jsxs as re}from"react/jsx-runtime";var Ue={html:{label:"HTML",color:"#e44d26"},css:{label:"CSS",color:"#2965f1"},js:{label:"JS",color:"#f7df1e"}},We=Ht.memo(function({code:s={html:"",css:"",js:""},onCodeChange:a}){let[t,u]=Ge("html"),d=Jt(null),[f,o]=Ge(s);Vt(()=>{o(s)},[s]);let b=Kt(g=>{let l={...f,[t]:g};o(l),a(l)},[t,f,a]),p=t==="html"?f.html:t==="css"?f.css:f.js,N=(p||"").split(`
112
+ `).length;return re("div",{className:"flex flex-col h-full bg-surface-tertiary border-l border-border-subtle overflow-hidden",style:{minWidth:280},children:[re("div",{className:"flex items-center gap-0.5 px-2 py-1.5 bg-surface-secondary border-b border-border-subtle shrink-0",children:[["html","css","js"].map(g=>re("button",{onClick:()=>u(g),className:`px-3 py-1 rounded text-[10px] font-mono uppercase tracking-wider transition-colors ${t===g?"bg-surface-glass text-text-primary":"text-text-muted hover:text-text-primary hover:bg-surface-glass"}`,children:[se("span",{className:"inline-block w-2 h-2 rounded-full mr-1.5",style:{background:Ue[g].color}}),Ue[g].label]},g)),re("span",{className:"ml-auto text-[9px] text-text-muted font-mono",children:[N," l\xEDneas"]})]}),se("div",{className:"flex-1 overflow-auto relative",style:{fontFamily:'ui-monospace, "SF Mono", "Cascadia Code", Menlo, monospace'},children:re("div",{className:"flex min-h-full",children:[se("div",{className:"select-none text-right pr-3 pl-3 py-3 text-[11px] text-text-muted leading-normal shrink-0 bg-surface-tertiary border-r border-border-subtle",children:Array.from({length:N},(g,l)=>se("div",{children:l+1},l))}),se("textarea",{ref:d,value:p,onChange:g=>b(g.target.value),spellCheck:!1,className:"flex-1 resize-none bg-transparent text-text-primary text-[11px] leading-normal p-3 outline-hidden min-h-full",style:{tabSize:2}})]})})]})});import qt from"react";import{motion as Zt}from"motion/react";import{jsx as F,jsxs as be}from"react/jsx-runtime";var Xt=[{id:"landing-saas",title:"Landing SaaS",category:"Marketing",emoji:"\u{1F680}",gradient:"from-violet-600 to-indigo-600",description:"Hero con CTA, features, testimonios",html:`<section class="min-h-screen bg-linear-to-br from-violet-950 via-indigo-950 to-black text-text-primary">
113
+ <nav class="flex items-center justify-between px-8 py-6">
114
+ <span class="text-xl font-bold bg-linear-to-r from-violet-400 to-indigo-400 bg-clip-text text-transparent">NexusAI</span>
115
+ <div class="flex gap-6 text-sm text-text-secondary"><a href="#" class="hover:text-text-primary">Features</a><a href="#" class="hover:text-text-primary">Pricing</a><a href="#" class="hover:text-text-primary">Docs</a></div>
116
+ <button class="px-5 py-2 bg-violet-600 hover:bg-violet-500 rounded-full text-sm font-medium transition">Get Started</button>
117
+ </nav>
118
+ <div class="flex flex-col items-center text-center pt-24 px-6">
119
+ <span class="px-4 py-1.5 bg-violet-500/10 border border-violet-500/20 rounded-full text-xs text-violet-300 mb-6">\u2728 Now in Beta</span>
120
+ <h1 class="text-5xl md:text-7xl font-bold leading-tight max-w-4xl">Build faster with <span class="bg-linear-to-r from-violet-400 to-cyan-400 bg-clip-text text-transparent">AI-powered</span> tools</h1>
121
+ <p class="text-lg text-text-secondary mt-6 max-w-2xl">Ship products 10x faster. Our AI understands your codebase and generates production-ready code in seconds.</p>
122
+ <div class="flex gap-4 mt-10"><button class="px-8 py-3 bg-violet-600 hover:bg-violet-500 rounded-full font-medium transition">Start Free Trial</button><button class="px-8 py-3 bg-surface-glass hover:bg-surface-glass border border-border-default rounded-full font-medium transition">Watch Demo \u2192</button></div>
123
+ </div>
124
+ </section>`,css:"",js:""},{id:"dashboard",title:"Dashboard",category:"App",emoji:"\u{1F4CA}",gradient:"from-cyan-600 to-blue-600",description:"M\xE9tricas, gr\xE1ficos, sidebar",html:`<div class="flex h-screen bg-surface-primary text-text-primary">
125
+ <aside class="w-56 bg-surface-secondary border-r border-border-subtle p-4 flex flex-col gap-2">
126
+ <span class="text-lg font-bold text-cyan-400 mb-4">\u{1F4CA} Dashboard</span>
127
+ <a class="px-3 py-2 rounded-lg bg-cyan-500/10 text-cyan-300 text-sm">Overview</a>
128
+ <a class="px-3 py-2 rounded-lg text-text-muted hover:text-text-primary text-sm">Analytics</a>
129
+ <a class="px-3 py-2 rounded-lg text-text-muted hover:text-text-primary text-sm">Reports</a>
130
+ <a class="px-3 py-2 rounded-lg text-text-muted hover:text-text-primary text-sm">Settings</a>
131
+ </aside>
132
+ <main class="flex-1 p-8 overflow-auto">
133
+ <h2 class="text-2xl font-bold mb-6">Good morning \u{1F44B}</h2>
134
+ <div class="grid grid-cols-3 gap-4 mb-8">
135
+ <div class="bg-surface-secondary border border-border-subtle rounded-2xl p-5"><p class="text-xs text-text-muted mb-1">Revenue</p><p class="text-3xl font-bold text-emerald-400">$48,352</p><p class="text-xs text-emerald-500 mt-1">\u2191 12.5%</p></div>
136
+ <div class="bg-surface-secondary border border-border-subtle rounded-2xl p-5"><p class="text-xs text-text-muted mb-1">Users</p><p class="text-3xl font-bold text-cyan-400">2,847</p><p class="text-xs text-cyan-500 mt-1">\u2191 8.3%</p></div>
137
+ <div class="bg-surface-secondary border border-border-subtle rounded-2xl p-5"><p class="text-xs text-text-muted mb-1">Conversion</p><p class="text-3xl font-bold text-violet-400">3.24%</p><p class="text-xs text-violet-500 mt-1">\u2191 2.1%</p></div>
138
+ </div>
139
+ <div class="bg-surface-secondary border border-border-subtle rounded-2xl p-6"><h3 class="text-sm font-medium text-text-secondary mb-4">Recent Activity</h3><div class="space-y-3"><div class="flex items-center gap-3 text-sm"><span class="w-8 h-8 rounded-full bg-emerald-500/10 flex items-center justify-center text-emerald-400">$</span><span class="text-text-primary">New subscription \u2014 Pro Plan</span><span class="ml-auto text-text-muted">2m ago</span></div><div class="flex items-center gap-3 text-sm"><span class="w-8 h-8 rounded-full bg-cyan-500/10 flex items-center justify-center text-cyan-400">\u{1F464}</span><span class="text-text-primary">New user registered</span><span class="ml-auto text-text-muted">15m ago</span></div></div></div>
140
+ </main>
141
+ </div>`,css:"",js:""},{id:"portfolio",title:"Portfolio",category:"Personal",emoji:"\u{1F3A8}",gradient:"from-pink-600 to-rose-600",description:"Bio, proyectos, contacto",html:`<div class="min-h-screen bg-surface-primary text-text-primary px-6 py-16 flex flex-col items-center">
142
+ <div class="max-w-2xl w-full">
143
+ <div class="flex items-center gap-4 mb-8"><div class="w-16 h-16 rounded-full bg-linear-to-br from-pink-500 to-rose-500 flex items-center justify-center text-2xl">JR</div><div><h1 class="text-2xl font-bold">Maria Garcia</h1><p class="text-text-muted">Full-Stack Designer & Developer</p></div></div>
144
+ <p class="text-text-secondary leading-relaxed mb-12">I craft beautiful digital experiences that bridge the gap between design and engineering. 5+ years building products for startups and enterprises.</p>
145
+ <h2 class="text-sm font-bold text-text-muted uppercase tracking-wider mb-4">Selected Work</h2>
146
+ <div class="grid grid-cols-2 gap-4 mb-12">
147
+ <div class="group bg-surface-tertiary rounded-2xl overflow-hidden border border-border-subtle hover:border-pink-500/30 transition"><div class="h-32 bg-linear-to-br from-pink-500/20 to-purple-500/20"></div><div class="p-4"><h3 class="font-medium">E-Commerce Platform</h3><p class="text-xs text-text-muted mt-1">React, Node.js, Stripe</p></div></div>
148
+ <div class="group bg-surface-tertiary rounded-2xl overflow-hidden border border-border-subtle hover:border-cyan-500/30 transition"><div class="h-32 bg-linear-to-br from-cyan-500/20 to-blue-500/20"></div><div class="p-4"><h3 class="font-medium">AI Dashboard</h3><p class="text-xs text-text-muted mt-1">Vue, Python, TensorFlow</p></div></div>
149
+ </div>
150
+ <div class="flex gap-4 text-sm text-text-muted"><a href="#" class="hover:text-text-primary">GitHub</a><a href="#" class="hover:text-text-primary">LinkedIn</a><a href="#" class="hover:text-text-primary">Twitter</a><a href="#" class="hover:text-text-primary">Email</a></div>
151
+ </div>
152
+ </div>`,css:"",js:""},{id:"pricing",title:"Pricing",category:"Marketing",emoji:"\u{1F4B3}",gradient:"from-emerald-600 to-teal-600",description:"3 planes con toggle mensual/anual",html:`<section class="min-h-screen bg-surface-primary text-text-primary py-20 px-6">
153
+ <div class="max-w-5xl mx-auto text-center">
154
+ <h2 class="text-4xl font-bold mb-4">Simple, transparent pricing</h2>
155
+ <p class="text-text-muted mb-12">No hidden fees. Cancel anytime.</p>
156
+ <div class="grid md:grid-cols-3 gap-6">
157
+ <div class="bg-surface-tertiary border border-border-subtle rounded-2xl p-8 text-left"><p class="text-sm text-text-muted mb-2">Starter</p><p class="text-4xl font-bold mb-1">$9<span class="text-lg text-text-muted">/mo</span></p><p class="text-xs text-text-muted mb-6">Perfect for getting started</p><ul class="space-y-2 text-sm text-text-secondary mb-8"><li>\u2713 5 projects</li><li>\u2713 Basic analytics</li><li>\u2713 Email support</li></ul><button class="w-full py-2.5 bg-surface-glass hover:bg-surface-glass border border-border-default rounded-xl text-sm transition">Get Started</button></div>
158
+ <div class="bg-surface-tertiary border-2 border-emerald-500/50 rounded-2xl p-8 text-left relative"><span class="absolute -top-3 left-1/2 -translate-x-1/2 px-3 py-0.5 bg-emerald-500 rounded-full text-xs font-medium">Popular</span><p class="text-sm text-text-muted mb-2">Pro</p><p class="text-4xl font-bold mb-1">$29<span class="text-lg text-text-muted">/mo</span></p><p class="text-xs text-text-muted mb-6">For growing teams</p><ul class="space-y-2 text-sm text-text-secondary mb-8"><li>\u2713 Unlimited projects</li><li>\u2713 Advanced analytics</li><li>\u2713 Priority support</li><li>\u2713 Custom domains</li></ul><button class="w-full py-2.5 bg-emerald-600 hover:bg-emerald-500 rounded-xl text-sm font-medium transition">Get Started</button></div>
159
+ <div class="bg-surface-tertiary border border-border-subtle rounded-2xl p-8 text-left"><p class="text-sm text-text-muted mb-2">Enterprise</p><p class="text-4xl font-bold mb-1">$99<span class="text-lg text-text-muted">/mo</span></p><p class="text-xs text-text-muted mb-6">For large organizations</p><ul class="space-y-2 text-sm text-text-secondary mb-8"><li>\u2713 Everything in Pro</li><li>\u2713 SSO & SAML</li><li>\u2713 Dedicated support</li><li>\u2713 SLA guarantee</li></ul><button class="w-full py-2.5 bg-surface-glass hover:bg-surface-glass border border-border-default rounded-xl text-sm transition">Contact Sales</button></div>
160
+ </div>
161
+ </div>
162
+ </section>`,css:"",js:""},{id:"login",title:"Login",category:"Auth",emoji:"\u{1F510}",gradient:"from-amber-600 to-orange-600",description:"Form con social login y glassmorphism",html:`<div class="min-h-screen bg-surface-primary flex items-center justify-center p-6">
163
+ <div class="w-full max-w-sm bg-surface-glass backdrop-blur-xl border border-border-default rounded-3xl p-8 text-text-primary">
164
+ <div class="text-center mb-8"><span class="text-4xl">\u{1F510}</span><h2 class="text-2xl font-bold mt-3">Welcome back</h2><p class="text-sm text-text-muted mt-1">Sign in to your account</p></div>
165
+ <div class="space-y-4">
166
+ <div><label class="text-xs text-text-muted mb-1 block">Email</label><input type="email" placeholder="you@email.com" class="w-full px-4 py-3 bg-surface-glass border border-border-default rounded-xl text-sm outline-hidden focus:border-amber-500/50 transition"/></div>
167
+ <div><label class="text-xs text-text-muted mb-1 block">Password</label><input type="password" placeholder="\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" class="w-full px-4 py-3 bg-surface-glass border border-border-default rounded-xl text-sm outline-hidden focus:border-amber-500/50 transition"/></div>
168
+ <button class="w-full py-3 bg-linear-to-r from-amber-500 to-orange-500 hover:from-amber-400 hover:to-orange-400 rounded-xl text-sm font-medium transition">Sign In</button>
169
+ <div class="flex items-center gap-3 my-2"><div class="flex-1 h-px bg-surface-glass"></div><span class="text-xs text-text-muted">or</span><div class="flex-1 h-px bg-surface-glass"></div></div>
170
+ <button class="w-full py-3 bg-surface-glass hover:bg-surface-glass border border-border-default rounded-xl text-sm transition flex items-center justify-center gap-2">\u{1F310} Continue with Google</button>
171
+ </div>
172
+ <p class="text-xs text-text-muted text-center mt-6">Don't have an account? <a href="#" class="text-amber-400 hover:underline">Sign up</a></p>
173
+ </div>
174
+ </div>`,css:"",js:""},{id:"blog",title:"Blog",category:"Content",emoji:"\u{1F4DD}",gradient:"from-sky-600 to-blue-600",description:"Lista de art\xEDculos con cards",html:`<div class="min-h-screen bg-surface-primary text-text-primary py-16 px-6">
175
+ <div class="max-w-3xl mx-auto">
176
+ <h1 class="text-4xl font-bold mb-2">Blog</h1>
177
+ <p class="text-text-muted mb-12">Thoughts on design, technology, and building products.</p>
178
+ <div class="space-y-6">
179
+ <article class="group bg-surface-tertiary border border-border-subtle rounded-2xl p-6 hover:border-sky-500/30 transition cursor-pointer"><div class="flex items-center gap-2 text-xs text-text-muted mb-3"><span class="px-2 py-0.5 bg-sky-500/10 text-sky-400 rounded">Design</span><span>Mar 15, 2026</span><span>\xB7 5 min read</span></div><h2 class="text-xl font-bold group-hover:text-sky-400 transition">The Future of AI-Powered Design Tools</h2><p class="text-sm text-text-muted mt-2 leading-relaxed">How generative AI is transforming the way we build user interfaces and what it means for designers.</p></article>
180
+ <article class="group bg-surface-tertiary border border-border-subtle rounded-2xl p-6 hover:border-violet-500/30 transition cursor-pointer"><div class="flex items-center gap-2 text-xs text-text-muted mb-3"><span class="px-2 py-0.5 bg-violet-500/10 text-violet-400 rounded">Engineering</span><span>Mar 10, 2026</span><span>\xB7 8 min read</span></div><h2 class="text-xl font-bold group-hover:text-violet-400 transition">Building a Real-Time Collaboration Engine</h2><p class="text-sm text-text-muted mt-2 leading-relaxed">A deep dive into the architecture behind our multi-user editing system using CRDTs and WebSockets.</p></article>
181
+ <article class="group bg-surface-tertiary border border-border-subtle rounded-2xl p-6 hover:border-emerald-500/30 transition cursor-pointer"><div class="flex items-center gap-2 text-xs text-text-muted mb-3"><span class="px-2 py-0.5 bg-emerald-500/10 text-emerald-400 rounded">Product</span><span>Mar 5, 2026</span><span>\xB7 3 min read</span></div><h2 class="text-xl font-bold group-hover:text-emerald-400 transition">Shipping Faster with Component Libraries</h2><p class="text-sm text-text-muted mt-2 leading-relaxed">How we reduced our time-to-market by 60% by investing in a robust design system.</p></article>
182
+ </div>
183
+ </div>
184
+ </div>`,css:"",js:""}],He=qt.memo(function({onSelect:s}){return be("div",{className:"flex flex-col items-center justify-center h-full p-6 overflow-auto",children:[be("div",{className:"text-center mb-8",children:[F("span",{className:"text-4xl",children:"\u{1F3A8}"}),F("h2",{className:"text-xl font-bold text-text-primary mt-3",children:"Elige un template"}),F("p",{className:"text-sm text-text-muted mt-1",children:"Click para cargar \u2014 luego refina con IA"})]}),F("div",{className:"grid grid-cols-2 lg:grid-cols-3 gap-3 max-w-3xl w-full",children:Xt.map((a,t)=>be(Zt.button,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{delay:t*.05},onClick:()=>s({html:a.html,css:a.css,js:a.js}),className:"group bg-surface-tertiary border border-border-subtle hover:border-border-strong rounded-2xl p-4 text-left transition-all hover:scale-[1.02] hover:shadow-xl overflow-hidden",children:[F("div",{className:`h-20 rounded-xl bg-linear-to-br ${a.gradient} opacity-30 group-hover:opacity-50 transition mb-3 flex items-center justify-center`,children:F("span",{className:"text-3xl opacity-70",children:a.emoji})}),F("h3",{className:"text-sm font-bold text-text-primary",children:a.title}),F("p",{className:"text-[10px] text-text-muted mt-0.5",children:a.category}),F("p",{className:"text-[10px] text-text-muted mt-1",children:a.description})]},a.id))})]})});import{Fragment as ve,jsx as c,jsxs as R}from"react/jsx-runtime";var Ze={desktop:{w:"100%",h:"100%",label:"Desktop"},tablet:{w:"768px",h:"1024px",label:"Tablet"},mobile:{w:"375px",h:"667px",label:"Mobile"}},pa={desktop:Qt,tablet:ea,mobile:ta},Xe=({artifacts:e,activeArtifactIndex:s,data:a})=>{let t=Yt(null),[u,d]=K("desktop"),[f,o]=K(Date.now()),[b,p]=K(!1),[N,g]=K(!1),[l,y]=K(null),[P,D]=K(!1),[E,I]=K(!1),x=Fe(),i=Ke(()=>{let m=a||e?.[s??0]?.data||{},n=m.html||m.content||"",$=m.css||m.styles||"",O=m.javascript||m.js||"";return{html:n,css:$,js:O}},[a,e,s]);ge(()=>{let m=n=>{n.data?.type==="DECIDO_ELEMENT_SELECTED"&&(y(n.data.selector||null),window.__DECIDO__&&(window.__DECIDO__.selectedElementSelector=n.data.selector||null))};return window.addEventListener("message",m),()=>window.removeEventListener("message",m)},[]);let[w,T]=K(!1);ge(()=>{let m=n=>{if(!(n.target instanceof HTMLInputElement||n.target instanceof HTMLTextAreaElement||!(n.metaKey||n.ctrlKey))){if(n.code==="KeyI"&&!n.shiftKey){n.preventDefault(),g(O=>!O);return}if(n.code==="KeyE"&&!n.shiftKey){n.preventDefault(),I(O=>!O);return}if(n.code==="KeyD"&&!n.shiftKey){n.preventDefault(),x.deploy();return}if(n.key==="/"){n.preventDefault(),T(O=>!O);return}}};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[x]),ge(()=>{t.current?.contentWindow&&t.current.contentWindow.postMessage({type:"DECIDO_SET_INSPECT",enabled:N},"*")},[N,f]);let M=Ke(()=>{let m=(i.js||"").replace(/<\/script/gi,"<\\/script");return`
185
+ <!DOCTYPE html>
186
+ <html lang="es">
187
+ <head>
188
+ <meta charset="UTF-8">
189
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
190
+ <base target="_blank">
191
+ <script src="https://cdn.tailwindcss.com"></script>
192
+ <style>
193
+ *, *::before, *::after { box-sizing: border-box; }
194
+ body {
195
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
196
+ margin: 0;
197
+ background: #fff;
198
+ min-height: 100vh;
199
+ color: #1a1a1a;
200
+ }
201
+ html, body { width: 100%; height: 100%; }
202
+ .__decido-hover { outline: 2px dashed #06b6d4 !important; outline-offset: 2px; cursor: crosshair !important; }
203
+ .__decido-selected { outline: 2px solid #06b6d4 !important; outline-offset: 2px; box-shadow: 0 0 0 4px rgba(6,182,212,0.15) !important; }
204
+ ${i.css}
205
+ </style>
206
+ </head>
207
+ <body>
208
+ ${i.html}
209
+ <script>
210
+ try { ${m} } catch(e) { console.error('[Preview]', e); }
211
+ </script>
212
+ <script>
213
+ // Link interceptor
214
+ document.addEventListener('click', function(e) {
215
+ var a = e.target.closest('a');
216
+ if (!a) return;
217
+ var href = a.getAttribute('href') || '';
218
+ if (href.startsWith('#')) return;
219
+ if (href.startsWith('javascript:')) { e.preventDefault(); return; }
220
+ e.preventDefault();
221
+ if (href && href !== '#') window.open(href, '_blank', 'noopener,noreferrer');
222
+ }, true);
223
+
224
+ // Element Inspector
225
+ var _inspectEnabled = false;
226
+ var _hoveredEl = null;
227
+ var _selectedEl = null;
228
+
229
+ function _getSelector(el) {
230
+ if (el.id) return '#' + el.id;
231
+ var path = [];
232
+ while (el && el !== document.body && el !== document.documentElement) {
233
+ var tag = el.tagName.toLowerCase();
234
+ if (el.className && typeof el.className === 'string') {
235
+ var cls = el.className.split(/s+/).filter(function(c) { return !c.startsWith('__decido'); }).slice(0, 2).join('.');
236
+ if (cls) tag += '.' + cls;
237
+ }
238
+ var parent = el.parentElement;
239
+ if (parent) {
240
+ var siblings = Array.from(parent.children).filter(function(c) { return c.tagName === el.tagName; });
241
+ if (siblings.length > 1) tag += ':nth-child(' + (Array.from(parent.children).indexOf(el) + 1) + ')';
242
+ }
243
+ path.unshift(tag);
244
+ el = parent;
245
+ if (path.length >= 3) break;
246
+ }
247
+ return path.join(' > ');
248
+ }
249
+
250
+ document.addEventListener('mouseover', function(e) {
251
+ if (!_inspectEnabled) return;
252
+ if (_hoveredEl) _hoveredEl.classList.remove('__decido-hover');
253
+ _hoveredEl = e.target;
254
+ if (_hoveredEl !== _selectedEl) _hoveredEl.classList.add('__decido-hover');
255
+ });
256
+ document.addEventListener('mouseout', function(e) {
257
+ if (_hoveredEl) _hoveredEl.classList.remove('__decido-hover');
258
+ });
259
+ document.addEventListener('click', function(e) {
260
+ if (!_inspectEnabled) return;
261
+ e.preventDefault();
262
+ e.stopPropagation();
263
+ if (_selectedEl) _selectedEl.classList.remove('__decido-selected');
264
+ _selectedEl = e.target;
265
+ _selectedEl.classList.add('__decido-selected');
266
+ _hoveredEl = null;
267
+ var sel = _getSelector(_selectedEl);
268
+ window.parent.postMessage({ type: 'DECIDO_ELEMENT_SELECTED', selector: sel, tagName: _selectedEl.tagName }, '*');
269
+ }, true);
270
+
271
+ window.addEventListener('message', function(e) {
272
+ if (e.data && e.data.type === 'DECIDO_SET_INSPECT') {
273
+ _inspectEnabled = e.data.enabled;
274
+ if (!_inspectEnabled) {
275
+ if (_hoveredEl) _hoveredEl.classList.remove('__decido-hover');
276
+ if (_selectedEl) _selectedEl.classList.remove('__decido-selected');
277
+ _hoveredEl = null; _selectedEl = null;
278
+ }
279
+ document.body.style.cursor = _inspectEnabled ? 'crosshair' : '';
280
+ }
281
+ });
282
+ </script>
283
+ </body>
284
+ </html>`},[i]),z=fe(()=>o(Date.now()),[]),Z=fe(()=>{let m=window.open();m&&(m.document.write(M),m.document.close())},[M]),ie=fe(()=>{let m=!N;g(m),m||y(null)},[N]),G=Ze[u],X=!!i.html?.trim();return R("div",{className:`w-full h-full flex flex-col bg-surface-primary overflow-hidden ${b?"fixed inset-0 z-9999":""}`,children:[R("div",{className:"flex items-center justify-between px-2 py-1.5 bg-surface-secondary border-b border-border-subtle text-[10px] text-text-muted select-none shrink-0",children:[R("div",{className:"flex items-center gap-1.5",children:[R("div",{className:"flex gap-1 px-1",children:[c("span",{className:"w-2.5 h-2.5 rounded-full bg-red-500/80"}),c("span",{className:"w-2.5 h-2.5 rounded-full bg-yellow-500/80"}),c("span",{className:"w-2.5 h-2.5 rounded-full bg-green-500/80"})]}),c("button",{onClick:z,className:"p-1 rounded hover:bg-surface-glass transition-colors",title:"Recargar",children:c(aa,{size:12})}),c("button",{onClick:()=>C.getState().undo(),disabled:!C.getState().canUndo(),className:`p-1 rounded transition-colors ${C.getState().canUndo()?"hover:bg-surface-glass text-text-secondary":"text-text-muted cursor-not-allowed"}`,title:"Deshacer",children:c(ca,{size:12})}),c("button",{onClick:()=>C.getState().redo(),disabled:!C.getState().canRedo(),className:`p-1 rounded transition-colors ${C.getState().canRedo()?"hover:bg-surface-glass text-text-secondary":"text-text-muted cursor-not-allowed"}`,title:"Rehacer",children:c(da,{size:12})}),R("span",{className:"px-2 py-0.5 bg-surface-overlay rounded text-[9px] font-mono",children:[G.w==="100%"?"Adaptable":G.w," \xD7 ",G.h==="100%"?"100%":G.h]})]}),c("div",{className:"flex items-center gap-0.5",children:["desktop","tablet","mobile"].map(m=>{let n=pa[m];return c("button",{onClick:()=>d(m),className:`p-1.5 rounded transition-colors ${u===m?"bg-surface-glass text-text-primary":"hover:bg-surface-glass text-text-muted hover:text-text-primary"}`,title:Ze[m].label,children:c(n,{size:13})},m)})}),R("div",{className:"flex items-center gap-1",children:[c("button",{onClick:ie,className:`p-1 rounded transition-colors ${N?"bg-cyan-500/20 text-cyan-400":"hover:bg-surface-glass text-text-muted"}`,title:N?"Desactivar inspector":"Seleccionar elemento",children:c(Ve,{size:12})}),c("button",{onClick:()=>I(!E),className:`p-1 rounded transition-colors ${E?"bg-violet-500/20 text-violet-400":"hover:bg-surface-glass text-text-muted"}`,title:E?"Ocultar c\xF3digo":"Ver / editar c\xF3digo",children:c(ia,{size:12})}),c("button",{onClick:()=>{x.deploy()},disabled:!X||x.status==="deploying",className:`p-1 rounded transition-colors ${x.status==="deploying"?"text-amber-400 animate-pulse":X?"hover:bg-emerald-500/10 text-text-muted hover:text-emerald-400":"text-text-muted cursor-not-allowed"}`,title:"Desplegar preview",children:x.status==="deploying"?c(qe,{size:12,className:"animate-spin"}):c(na,{size:12})}),c("button",{onClick:()=>p(!b),className:"p-1 rounded hover:bg-surface-glass transition-colors",title:b?"Salir fullscreen":"Fullscreen",children:b?c(oa,{size:12}):c(ra,{size:12})}),c("button",{onClick:Z,className:"p-1 rounded hover:bg-surface-glass transition-colors",title:"Abrir en nueva pesta\xF1a",children:c(sa,{size:12})})]})]}),x.status!=="idle"&&R("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b border-border-subtle text-[10px] shrink-0",style:{background:x.status==="success"?"rgba(16,185,129,0.08)":x.status==="error"?"rgba(239,68,68,0.08)":"rgba(245,158,11,0.08)"},children:[x.status==="deploying"&&R(ve,{children:[c(qe,{size:10,className:"text-amber-400 animate-spin"}),R("span",{className:"text-amber-300 font-mono",children:["Desplegando... ",x.progress,"%"]}),c("div",{className:"flex-1 h-1 bg-surface-glass rounded-full overflow-hidden",children:c("div",{className:"h-full bg-amber-400 transition-all duration-300 rounded-full",style:{width:`${x.progress}%`}})})]}),x.status==="success"&&x.url&&R(ve,{children:[c(Je,{size:10,className:"text-emerald-400"}),c("a",{href:x.url,target:"_blank",rel:"noopener noreferrer",className:"text-emerald-300 font-mono flex-1 truncate hover:underline",children:x.url.length>60?x.url.slice(0,60)+"...":x.url}),c("button",{onClick:()=>{x.copyUrl(),D(!0),setTimeout(()=>D(!1),1500)},className:"text-text-secondary hover:text-text-primary transition-colors",title:"Copiar URL",children:P?c(Je,{size:10,className:"text-emerald-400"}):c(la,{size:10})}),c("button",{onClick:x.reset,className:"text-text-muted hover:text-text-primary",children:"\u2715"})]}),x.status==="error"&&R(ve,{children:[c("span",{className:"text-red-400",children:"\u26A0"}),c("span",{className:"text-red-300 font-mono flex-1",children:x.error}),c("button",{onClick:x.reset,className:"text-text-muted hover:text-text-primary",children:"\u2715"})]})]}),l&&R("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-cyan-500/10 border-b border-cyan-500/20 text-[10px] shrink-0",children:[c(Ve,{size:10,className:"text-cyan-400"}),c("code",{className:"text-cyan-300 font-mono flex-1 truncate",children:l}),c("span",{className:"text-text-muted",children:"Escribe en el chat para modificar este elemento"}),c("button",{onClick:()=>{y(null),g(!1)},className:"text-text-muted hover:text-text-primary",children:"\u2715"})]}),R("div",{className:"flex-1 flex overflow-hidden",children:[c("div",{className:`flex items-center justify-center overflow-auto p-2 ${E?"w-1/2":"flex-1"}`,style:{background:"repeating-conic-gradient(#1a1a1b 0% 25%, #141415 0% 50%) 0 0 / 20px 20px"},children:X?c("div",{className:"bg-white shadow-2xl transition-all duration-300 overflow-hidden w-full h-full",style:{maxWidth:E?"100%":G.w,maxHeight:E?"100%":G.h,border:u!=="desktop"?"6px solid #333":"1px solid #2a2a2a",borderRadius:u!=="desktop"?"1.5rem":"4px"},children:c("iframe",{ref:t,srcDoc:M,title:"NexusAI Preview",sandbox:"allow-scripts allow-same-origin allow-forms allow-modals",className:"w-full h-full border-0"},f)}):c(He,{onSelect:m=>{let n=C.getState().getActiveInstance();if(n)C.getState().upsertInstance({...n,data:{...n.data,html:m.html,css:m.css,javascript:m.js}});else{let $="tpl-"+Date.now();C.getState().upsertInstance({id:$,shellType:"nexusai-preview",sourceChatId:"_default",label:"Template",data:{html:m.html,css:m.css,javascript:m.js}}),C.getState().setActiveInstance($)}}})}),E&&c("div",{className:"w-1/2 shrink-0",children:c(We,{code:i,onCodeChange:m=>{let n=C.getState().getActiveInstance();n&&C.getState().upsertInstance({...n,data:{...n.data,html:m.html,css:m.css,javascript:m.js}})}})})]}),w&&c("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-surface-overlay backdrop-blur-xs",onClick:()=>T(!1),children:R("div",{className:"bg-surface-tertiary border border-border-default rounded-2xl p-6 max-w-xs w-full shadow-2xl",onClick:m=>m.stopPropagation(),children:[c("h3",{className:"text-sm font-bold text-text-primary mb-4 flex items-center gap-2",children:"\u2328\uFE0F Atajos de Teclado"}),c("div",{className:"space-y-2 text-[11px]",children:[["\u2318 I","Inspector de elementos"],["\u2318 E","Editor de c\xF3digo"],["\u2318 D","Desplegar preview"],["\u2318 Z","Deshacer (topolog\xEDa)"],["\u2318 \u21E7 Z","Rehacer (topolog\xEDa)"],["\u2318 /","Esta ayuda"],["\u2318 B","Toggle sidebar"],["\u2318 \u21E7 C","Toggle modo Creator"],["\u2318 \u21E7 V","Toggle canvas"]].map(([m,n])=>R("div",{className:"flex items-center justify-between",children:[c("span",{className:"text-text-secondary",children:n}),c("kbd",{className:"px-2 py-0.5 bg-surface-glass border border-border-default rounded text-text-primary font-mono text-[10px]",children:m})]},m))}),c("button",{onClick:()=>T(!1),className:"w-full mt-4 py-2 bg-surface-glass hover:bg-surface-glass rounded-xl text-xs text-text-secondary transition",children:"Cerrar"})]})})]})};var Ye=!1;function Qe(){Ye||(Ye=!0,U("markdown",je),U("iframe",ze),U("shell-theme-editor",$e),U("nexusai-preview",Xe,{icon:"\u{1F310}",color:"#3b82f6",label:"Web Preview"}),U("dataway-studio",Be,{icon:"\u0192",color:"#14b8a6",label:"Dataway M-Script Studio"}))}import{useEffect as ma}from"react";function et(){ma(()=>{let e=s=>{if(!(s.metaKey||s.ctrlKey))return;let t=C.getState();if(s.key==="w"&&t.activeInstanceId&&(s.preventDefault(),t.removeInstance(t.activeInstanceId)),s.key>="1"&&s.key<="9"){let u=parseInt(s.key)-1,d=t.getInstances();u<d.length&&(s.preventDefault(),t.setActiveInstance(d[u].id))}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[])}import{jsx as _,jsxs as q}from"react/jsx-runtime";Qe();var we=null;async function ya(e,s){let a=s||localStorage.getItem("decido_gemini_model")||"gemini-3-flash-preview",t=localStorage.getItem("google_gemini_api_key")||window.__DECIDO__?._apiKey||import.meta.env?.VITE_GEMINI_API_KEY||"";if(!t){console.error('\u274C No Gemini API key. Set localStorage "google_gemini_api_key" or VITE_GEMINI_API_KEY'),L.getState().addChatMessage({type:"error",sender:"system",text:"\u26A0\uFE0F No se encontr\xF3 API key de Gemini."});return}L.getState().addChatMessage({type:"text",sender:"user",text:e});let d=new AbortController;we=d;let f=[{type:"thinking",label:"Processing",startTime:Date.now()}];try{let o=`https://generativelanguage.googleapis.com/v1beta/models/${a}:streamGenerateContent?alt=sse&key=${t}`,b=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({contents:[{role:"user",parts:[{text:e}]}],systemInstruction:{parts:[{text:"Eres Decido AI, un asistente del sistema operativo Decido OS. Responde en espa\xF1ol, s\xE9 conciso y \xFAtil."}]},generationConfig:{temperature:.7,maxOutputTokens:4096}}),signal:d.signal});if(!b.ok)throw new Error(`Gemini API ${b.status}: ${(await b.text()).slice(0,200)}`);f[0].endTime=Date.now(),f.push({type:"text_delta",label:"Streaming",startTime:Date.now()});let p=b.body?.getReader();if(!p)throw new Error("No reader");let N=new TextDecoder,g="",l=`gemini-${Date.now()}`,y="";for(;;){let{done:P,value:D}=await p.read();if(P)break;y+=N.decode(D,{stream:!0});let E=y.split(`
285
+ `);y=E.pop()||"";for(let I of E){let x=I.trim();if(!x.startsWith("data: "))continue;let i=x.slice(6);if(!(!i||i==="[DONE]"))try{let T=JSON.parse(i)?.candidates?.[0]?.content?.parts?.[0]?.text;T&&(g+=T,L.getState().upsertChatMessage(l,{id:l,type:"text",sender:"agent",text:g,timestamp:Date.now(),executionSteps:[...f]}))}catch(w){console.warn("[SSE] JSON parse failed:",i.slice(0,100),w)}}}if(y.trim().startsWith("data: "))try{let P=JSON.parse(y.trim().slice(6))?.candidates?.[0]?.content?.parts?.[0]?.text;P&&(g+=P)}catch{}f[1].endTime=Date.now(),f.push({type:"text_complete",label:"Complete",startTime:Date.now(),endTime:Date.now()}),L.getState().upsertChatMessage(l,{id:l,type:"text",sender:"agent",text:g,timestamp:Date.now(),executionSteps:f}),console.log("\u2705 Streaming complete:",g.length,"chars")}catch(o){o.name==="AbortError"?L.getState().addChatMessage({type:"alert",sender:"system",text:"\u23F9\uFE0F Generaci\xF3n cancelada."}):(console.error("\u274C",o.message),L.getState().addChatMessage({type:"error",sender:"system",text:`\u274C ${o.message}`}))}finally{we=null}}typeof window<"u"&&(window.__DECIDO__={...window.__DECIDO__,useMorphInstanceStore:C,useLayoutStore:B,useMorphologyStore:j,usePlaygroundStore:L,registerShell:U,resolveShell:Q,getRegisteredShellTypes:Ne,geminiStream:ya,geminiAbort:()=>we?.abort(),registerSuggestions:(e,s)=>{import("./useSuggestionsStore-Q4KVPU7L.mjs").then(a=>a.useSuggestionsStore.getState().registerPluginSuggestions(e,s))},registerIntent:e=>{import("./useIntentLens-OCAUBNOQ.mjs").then(s=>s.registerIntentPattern(e))},getIntentPatterns:()=>import("./useIntentLens-OCAUBNOQ.mjs").then(e=>e.getIntentPatterns())});function ar({showCanvas:e=!0,setShowCanvas:s,activeConfig:a,prototypeBrand:t="",activeState:u,chartData:d=[],dragConstraintsRef:f}){et();let o=C(n=>n.getActiveInstance()),b=C(n=>n.removeInstance),p=B(n=>n.activeStage),N=B(n=>n.stageHistory),g=j(n=>n.activeStage),l=j(n=>n.stageHistory),y=B(n=>n.isImmersive),P=B(n=>n.setIsImmersive),D=p||g,E=p?N:l,I=L(n=>n.activeArtifactData),x=D||(I?{type:"artifact",data:I}:null),i=x?.type||"3d",w=pe[i]||pe.custom,T=w.icon,M=B(n=>n.addTab);ye.useEffect(()=>{if(!(!x&&!o)){if(o)M({id:`morph-${o.id}`,label:o.label,componentId:`morph:${o.shellType}`,closeable:!0,data:o});else if(x){let n=`morph-${i}-${x.label||"stage"}`;M({id:n,label:x.label||i.toUpperCase(),componentId:`morph:${i}`,closeable:!0,data:x})}}},[x?.type,x?.label,o?.id,o?.shellType]);let z=he(()=>{o&&b(o.id),B.getState().clearStages(),j.getState().clearStages(),L.getState().setActiveArtifactData(null),s?.(!1)},[s,o,b]),Z=he(()=>{if(o){let n=Array.from(C.getState().instances.keys()),$=n.indexOf(o.id);if(B.getState().removeTab(`morph-${o.id}`),b(o.id),n.length>1){let O=$>0?$-1:n.length-2,Y=n.filter(oe=>oe!==o.id)[Math.min(O,n.length-2)];if(Y){C.getState().setActiveInstance(Y);let oe=C.getState().instances.get(Y);oe?.sourceChatId&&L.getState().setActiveChatId(oe.sourceChatId)}}else z()}else E.length>0?(B.getState().popStage(),j.getState().popStage()):z()},[o,E.length,z,b]),ie=he(()=>{P(!y)},[y,P]);if(!e)return null;let G=o&&Q(o.shellType),X=o?.label||D?.label||(I?"Artefacto":"Lienzo"),m=o?.shellType||i;return _(ua,{children:q(xa.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"w-full h-full bg-surface-secondary flex flex-col overflow-hidden relative border-l border-border-subtle",children:[q("div",{className:"flex justify-between items-center pl-2 z-10 p-3 pb-0 shrink-0",children:[q("div",{className:"flex items-center gap-2",children:[(D||I||o)&&_("button",{onClick:Z,className:"p-1.5 rounded-lg hover:bg-surface-glass text-text-muted hover:text-text-primary transition-colors",title:"Volver",children:_(ba,{size:16})}),q("h2",{className:"text-sm font-bold flex items-center gap-2 text-text-primary",children:[_("div",{className:"w-6 h-6 rounded-lg flex items-center justify-center bg-surface-glass",children:_(T,{size:12,className:w.color})}),_("span",{className:"truncate max-w-[180px]",children:X}),_("span",{className:"text-text-muted font-mono text-[9px] ml-1",children:String(m).toUpperCase()})]})]}),q("div",{className:"flex items-center gap-2",children:[E.length>0&&q("div",{className:"hidden md:flex items-center gap-1 text-[9px] text-text-muted font-mono",children:[E.map((n,$)=>q(ye.Fragment,{children:[_("span",{className:"hover:text-text-secondary cursor-pointer",onClick:()=>{let O=E.length-$;for(let Y=0;Y<O;Y++)B.getState().popStage(),j.getState().popStage()},children:n.label||n.type}),_("span",{children:"\u203A"})]},$)),_("span",{className:"text-text-secondary",children:X})]}),_("button",{onClick:ie,className:"p-1.5 rounded-lg hover:bg-surface-glass text-text-muted hover:text-text-primary transition-colors",title:y?"Salir de inmersivo":"Modo inmersivo",children:y?_(va,{size:14}):_(ga,{size:14})}),_("button",{onClick:z,className:"p-1.5 bg-surface-glass hover:bg-red-500/20 text-text-secondary hover:text-red-400 rounded-full transition-colors",children:_(fa,{size:14})})]})]}),o&&_(_e,{instanceId:o.id}),_("div",{className:"flex-1 relative overflow-hidden",children:G?ye.createElement(Q(o.shellType),{instanceId:o.id,data:o.data,artifacts:o.artifacts,activeArtifactIndex:o.activeArtifactIndex}):_(Te,{showCanvas:!0,setShowCanvas:s||(()=>{}),activeConfig:a,prototypeBrand:t,activeState:u,chartData:d,dragConstraintsRef:f||void 0})})]})})}export{Te as a,_e as b,et as c,ar as d};
@@ -0,0 +1 @@
1
+ import{create as o}from"zustand";import{persist as d}from"zustand/middleware";var a=o()(d((n,t)=>({seeds:["Expl\xEDcame c\xF3mo funciona este flujo","Crea un grafo de onboarding","Analiza el rendimiento del sistema"],generated:[],pluginSuggestions:{},addSeed:e=>n(s=>({seeds:[...s.seeds,e]})),removeSeed:e=>n(s=>({seeds:s.seeds.filter((g,i)=>i!==e)})),updateSeed:(e,s)=>n(g=>({seeds:g.seeds.map((i,r)=>r===e?s:i)})),setGenerated:e=>n({generated:e}),registerPluginSuggestions:(e,s)=>n(g=>({pluginSuggestions:{...g.pluginSuggestions,[e]:s}})),unregisterPluginSuggestions:e=>n(s=>{let g={...s.pluginSuggestions};return delete g[e],{pluginSuggestions:g}}),getAllSuggestions:()=>{let e=t(),s=Object.values(e.pluginSuggestions).flat();return[...e.generated,...e.seeds,...s]}}),{name:"decido-suggestions-store"}));export{a};
@@ -0,0 +1 @@
1
+ import{c as n}from"./chunk-YHFKY5MB.mjs";var p={R1:"workspace-chat",R2:null,R3:"graph-editor",R4:"debug",R5:null,R6:null},g={R1:"workspace-chat",R2:null,R3:null,R4:null,R5:null,R6:null},c={R1:null,R2:null,R3:null,R4:null,R5:null,R6:null},S={R1:"app-sidebar",R2:null,R3:"graph-editor",R4:"terminal",R5:null,R6:null},i={creator:p,player:g,minimal:c,studio:S};import{create as v}from"zustand";import{persist as u,createJSONStorage as I}from"zustand/middleware";import{get as b,set as R,del as m}from"idb-keyval";var y={getItem:async t=>await b(t)||null,setItem:async(t,r)=>{await R(t,r)},removeItem:async t=>{await m(t)}},M=v()(u((t,r)=>({slots:{...i.player},setSlot:(e,o)=>t(a=>({slots:{...a.slots,[e]:o}})),swapSlots:(e,o)=>t(a=>({slots:{...a.slots,[e]:a.slots[o],[o]:a.slots[e]}})),resetLayout:e=>{let o=i[e];o&&t({slots:{...o}})},isCreatorMode:!1,setIsCreatorMode:e=>{t({isCreatorMode:e});let o=e?i.creator:i.player;t({slots:{...o}})},showCanvas:!1,setShowCanvas:e=>t({showCanvas:e}),showChat:!0,setShowChat:e=>t({showChat:e}),isSidebarOpen:!1,setIsSidebarOpen:e=>t({isSidebarOpen:e}),isImmersive:!1,setIsImmersive:e=>t({isImmersive:e}),activeStage:null,stageHistory:[],setStage:e=>{n.layout(`setStage \u2192 ${e?.type||"null"}`,e),t({activeStage:e})},pushStage:e=>{let{activeStage:o,stageHistory:a}=r();n.layout(`pushStage \u2192 ${e.type}${e.label?` (${e.label})`:""} | depth: ${a.length+1}`,{stage:e,previousStage:o?.type});let s=o?[...a,o]:a;t({activeStage:e,stageHistory:s})},popStage:()=>{let{stageHistory:e,activeStage:o}=r();if(e.length===0){n.layout("popStage \u2192 null (history empty)",{poppedStage:o?.type},"warn"),t({activeStage:null});return}let a=e[e.length-1];n.layout(`popStage \u2192 ${a.type}${a.label?` (${a.label})`:""} | depth: ${e.length-1}`,{poppedStage:o?.type,restoredStage:a.type}),t({activeStage:a,stageHistory:e.slice(0,-1)})},clearStages:()=>{n.layout("clearStages \u2192 all cleared",{previousDepth:r().stageHistory.length}),t({activeStage:null,stageHistory:[]})},tabs:[],activeTabId:null,addTab:e=>{let{tabs:o}=r();if(o.some(a=>a.id===e.id)){t({activeTabId:e.id});return}t({tabs:[...o,e],activeTabId:e.id})},removeTab:e=>{let{tabs:o,activeTabId:a}=r(),s=o.filter(d=>d.id!==e),l=a===e?s.length>0?s[s.length-1].id:null:a;t({tabs:s,activeTabId:l})},setActiveTab:e=>t({activeTabId:e}),savedPresets:[],savePreset:e=>{let{slots:o,savedPresets:a}=r(),s={id:Date.now().toString(36),name:e,slots:{...o},createdAt:Date.now()};t({savedPresets:[...a,s]})},loadPreset:e=>{let{savedPresets:o}=r(),a=o.find(s=>s.id===e);a&&t({slots:{...a.slots}})},deletePreset:e=>{t(o=>({savedPresets:o.savedPresets.filter(a=>a.id!==e)}))}}),{name:"decido-layout-v4",storage:I(()=>y),partialize:t=>({slots:t.slots,isCreatorMode:t.isCreatorMode,isSidebarOpen:t.isSidebarOpen,showCanvas:t.showCanvas,showChat:t.showChat,tabs:t.tabs,activeTabId:t.activeTabId,savedPresets:t.savedPresets})}));export{i as a,M as b};
@@ -0,0 +1,2 @@
1
+ import{create as i}from"zustand";import{persist as u}from"zustand/middleware";var n={"radius-xs":"4px","radius-sm":"6px","radius-md":"10px","radius-lg":"16px","radius-xl":"24px","blur-xs":"4px","blur-sm":"8px","blur-md":"16px","blur-lg":"24px","blur-xl":"40px","font-sans":"'Inter', 'system-ui', sans-serif","font-mono":"'JetBrains Mono', 'Fira Code', monospace"},d={id:"decido-dark",name:"Decido Dark",description:"Tema por defecto \u2014 oscuro con acentos p\xFArpura y cyan",preview:{bg:"#0a0a0f",accent:"#a855f7",text:"#e8e8f0"},tokens:{"surface-primary":"#0a0a0f","surface-secondary":"#12121a","surface-tertiary":"#1a1a26","surface-elevated":"#22222e","surface-glass":"rgba(255, 255, 255, 0.03)","surface-overlay":"rgba(0, 0, 0, 0.6)","text-primary":"#e8e8f0","text-secondary":"#9898b0","text-muted":"#5a5a72","text-inverse":"#0a0a0f","accent-blue":"#4a9eff","accent-purple":"#a855f7","accent-green":"#34d399","accent-red":"#f87171","accent-amber":"#fbbf24","accent-cyan":"#22d3ee","border-subtle":"rgba(255, 255, 255, 0.06)","border-default":"rgba(255, 255, 255, 0.1)","border-strong":"rgba(255, 255, 255, 0.2)","border-glow":"rgba(168, 85, 247, 0.5)","status-ok":"#34d399","status-warn":"#fbbf24","status-error":"#f87171","status-info":"#4a9eff"},meta:n},b={id:"midnight-blue",name:"Midnight Blue",description:"Azul profundo con tonos slate",preview:{bg:"#0b1120",accent:"#3b82f6",text:"#f1f5f9"},tokens:{"surface-primary":"#0b1120","surface-secondary":"#111827","surface-tertiary":"#1e293b","surface-elevated":"#273548","surface-glass":"rgba(30, 41, 59, 0.5)","surface-overlay":"rgba(11, 17, 32, 0.7)","text-primary":"#f1f5f9","text-secondary":"#94a3b8","text-muted":"#64748b","text-inverse":"#0b1120","accent-blue":"#3b82f6","accent-purple":"#8b5cf6","accent-green":"#22c55e","accent-red":"#ef4444","accent-amber":"#f59e0b","accent-cyan":"#06b6d4","border-subtle":"rgba(148, 163, 184, 0.06)","border-default":"rgba(148, 163, 184, 0.12)","border-strong":"rgba(148, 163, 184, 0.25)","border-glow":"rgba(59, 130, 246, 0.5)","status-ok":"#22c55e","status-warn":"#f59e0b","status-error":"#ef4444","status-info":"#3b82f6"},meta:n},g={id:"emerald-noir",name:"Emerald Noir",description:"Oscuro con acentos esmeralda",preview:{bg:"#0a0f0d",accent:"#34d399",text:"#ecfdf5"},tokens:{"surface-primary":"#0a0f0d","surface-secondary":"#0f1a15","surface-tertiary":"#162620","surface-elevated":"#1e332b","surface-glass":"rgba(22, 38, 32, 0.5)","surface-overlay":"rgba(10, 15, 13, 0.7)","text-primary":"#ecfdf5","text-secondary":"#a7f3d0","text-muted":"#6ee7b7","text-inverse":"#0a0f0d","accent-blue":"#2dd4bf","accent-purple":"#a78bfa","accent-green":"#34d399","accent-red":"#fb7185","accent-amber":"#fbbf24","accent-cyan":"#2dd4bf","border-subtle":"rgba(167, 243, 208, 0.06)","border-default":"rgba(167, 243, 208, 0.12)","border-strong":"rgba(167, 243, 208, 0.25)","border-glow":"rgba(52, 211, 153, 0.5)","status-ok":"#34d399","status-warn":"#fbbf24","status-error":"#fb7185","status-info":"#2dd4bf"},meta:n},m={id:"rose-gold",name:"Rose Gold",description:"Elegante con tonos rosa y dorado",preview:{bg:"#120a0d",accent:"#f472b6",text:"#fdf2f8"},tokens:{"surface-primary":"#120a0d","surface-secondary":"#1a1015","surface-tertiary":"#26161e","surface-elevated":"#331c28","surface-glass":"rgba(38, 22, 30, 0.5)","surface-overlay":"rgba(18, 10, 13, 0.7)","text-primary":"#fdf2f8","text-secondary":"#f9a8d4","text-muted":"#f472b6","text-inverse":"#120a0d","accent-blue":"#e879f9","accent-purple":"#f472b6","accent-green":"#34d399","accent-red":"#fb7185","accent-amber":"#fcd34d","accent-cyan":"#e879f9","border-subtle":"rgba(249, 168, 212, 0.06)","border-default":"rgba(249, 168, 212, 0.12)","border-strong":"rgba(249, 168, 212, 0.25)","border-glow":"rgba(244, 114, 182, 0.5)","status-ok":"#34d399","status-warn":"#fcd34d","status-error":"#fb7185","status-info":"#e879f9"},meta:n},l={id:"oled-pure",name:"OLED Pure",description:"Negro absoluto para pantallas OLED",preview:{bg:"#000000",accent:"#a855f7",text:"#ffffff"},tokens:{"surface-primary":"#000000","surface-secondary":"#0a0a0a","surface-tertiary":"#141414","surface-elevated":"#1e1e1e","surface-glass":"rgba(255, 255, 255, 0.02)","surface-overlay":"rgba(0, 0, 0, 0.8)","text-primary":"#ffffff","text-secondary":"#a0a0a0","text-muted":"#666666","text-inverse":"#000000","accent-blue":"#4a9eff","accent-purple":"#a855f7","accent-green":"#34d399","accent-red":"#f87171","accent-amber":"#fbbf24","accent-cyan":"#22d3ee","border-subtle":"rgba(255, 255, 255, 0.04)","border-default":"rgba(255, 255, 255, 0.08)","border-strong":"rgba(255, 255, 255, 0.15)","border-glow":"rgba(168, 85, 247, 0.5)","status-ok":"#4ade80","status-warn":"#fbbf24","status-error":"#f87171","status-info":"#4a9eff"},meta:n},p={id:"decido-light",name:"Decido Light",description:"Tema claro premium \u2014 ideal para trabajo diurno",preview:{bg:"#f8f9fb",accent:"#6366f1",text:"#1a1a2e"},tokens:{"surface-primary":"#f8f9fb","surface-secondary":"#ffffff","surface-tertiary":"#eef0f4","surface-elevated":"#ffffff","surface-glass":"rgba(0, 0, 0, 0.03)","surface-overlay":"rgba(0, 0, 0, 0.4)","text-primary":"#1a1a2e","text-secondary":"#64648c","text-muted":"#9898b0","text-inverse":"#ffffff","accent-blue":"#3b82f6","accent-purple":"#6366f1","accent-green":"#10b981","accent-red":"#ef4444","accent-amber":"#f59e0b","accent-cyan":"#06b6d4","border-subtle":"rgba(0, 0, 0, 0.06)","border-default":"rgba(0, 0, 0, 0.12)","border-strong":"rgba(0, 0, 0, 0.2)","border-glow":"rgba(99, 102, 241, 0.4)","status-ok":"#10b981","status-warn":"#f59e0b","status-error":"#ef4444","status-info":"#3b82f6"},meta:n},o=[d,p,b,g,m,l];function f(a,s){let e=document.documentElement;Object.entries(a).forEach(([r,t])=>{e.style.setProperty(`--ds-${r}`,t)}),Object.entries(s).forEach(([r,t])=>{e.style.setProperty(`--ds-${r}`,t)})}var T=i()(u((a,s)=>({currentThemeId:"decido-dark",customPresets:[],setTheme:e=>{a({currentThemeId:e});let r=s().getCurrentPreset();f(r.tokens,r.meta)},setToken:(e,r)=>{document.documentElement.style.setProperty(`--ds-${e}`,r)},addPreset:e=>{a(r=>({customPresets:[...r.customPresets.filter(t=>t.id!==e.id),e]}))},inject:()=>{let e=s().getCurrentPreset();f(e.tokens,e.meta)},exportCSS:()=>{let e=s().getCurrentPreset(),r=[":root {"];return Object.entries(e.tokens).forEach(([t,c])=>{r.push(` --ds-${t}: ${c};`)}),Object.entries(e.meta).forEach(([t,c])=>{r.push(` --ds-${t}: ${c};`)}),r.push("}"),r.join(`
2
+ `)},getCurrentPreset:()=>{let{currentThemeId:e,customPresets:r}=s();return[...o,...r].find(t=>t.id===e)??d},getAllPresets:()=>[...o,...s().customPresets]}),{name:"decido-aura-theme",onRehydrateStorage:()=>a=>{a&&setTimeout(()=>a.inject(),0)}}));export{d as a,b,g as c,m as d,l as e,p as f,o as g,T as h};
@@ -0,0 +1 @@
1
+ import{create as i}from"zustand";import{persist as s}from"zustand/middleware";var p=[{id:"builtin_status_card",name:"Status Card",category:"card",schema:{type:"div",props:{className:"bg-zinc-900/80 border border-border-default rounded-xl p-4 backdrop-blur-xs"},children:[{type:"div",props:{className:"flex items-center gap-2 mb-2"},children:[{type:"span",props:{className:"w-2 h-2 rounded-full bg-emerald-400 animate-pulse"}},{type:"span",props:{className:"text-xs font-mono text-text-secondary uppercase tracking-wider"},children:"{{title}}"}]},{type:"h3",props:{className:"text-2xl font-bold text-white"},children:"{{value}}"},{type:"p",props:{className:"text-xs text-text-muted mt-1"},children:"{{subtitle}}"}]},dataContract:{inputs:{title:{type:"string",description:"Card title"},value:{type:"string",description:"Main value"},subtitle:{type:"string",description:"Description"}},outputs:{}},tags:["status","metric","dashboard"],source:"built-in",createdAt:Date.now(),updatedAt:Date.now()},{id:"builtin_alert_banner",name:"Alert Banner",category:"alert",schema:{type:"div",props:{className:"flex items-center gap-3 p-3 rounded-lg border border-amber-500/20 bg-amber-500/5"},children:[{type:"span",props:{className:"text-amber-400 text-lg"},children:"\u26A0\uFE0F"},{type:"div",children:[{type:"p",props:{className:"text-sm font-semibold text-amber-200"},children:"{{title}}"},{type:"p",props:{className:"text-xs text-amber-300/70"},children:"{{message}}"}]}]},dataContract:{inputs:{title:{type:"string",description:"Alert title"},message:{type:"string",description:"Alert message"}},outputs:{}},tags:["alert","warning","notification"],source:"built-in",createdAt:Date.now(),updatedAt:Date.now()},{id:"builtin_input_form",name:"Text Input Form",category:"form",schema:{type:"div",props:{className:"bg-zinc-900/80 border border-border-default rounded-xl p-4 space-y-3"},children:[{type:"label",props:{className:"text-sm text-text-primary font-medium"},children:"{{label}}"},{type:"input",props:{className:"w-full bg-zinc-800 border border-border-default rounded-lg px-3 py-2 text-white text-sm focus:border-purple-500/50 outline-hidden transition-colors",placeholder:"{{placeholder}}"},onAction:{command:"engine:setVariable",payload:{target:"{{variableKey}}"}}},{type:"button",props:{className:"w-full py-2 bg-purple-500 hover:bg-purple-400 text-white text-sm font-medium rounded-lg transition-colors"},children:"{{buttonText}}",onAction:{command:"engine:completeNode",payload:{handle:"success"}}}]},dataContract:{inputs:{label:{type:"string",description:"Input label"},placeholder:{type:"string",description:"Placeholder text"},variableKey:{type:"string",description:"Target variable key"},buttonText:{type:"string",description:"Submit button text"}},outputs:{value:{type:"string"}}},tags:["form","input","interactive"],source:"built-in",createdAt:Date.now(),updatedAt:Date.now()},{id:"builtin_data_table",name:"Data Table",category:"table",schema:{type:"div",props:{className:"bg-zinc-900/80 border border-border-default rounded-xl overflow-hidden"},children:[{type:"div",props:{className:"px-4 py-3 border-b border-border-subtle"},children:[{type:"h4",props:{className:"text-sm font-semibold text-white"},children:"{{title}}"}]},{type:"table",props:{className:"w-full"},children:[{type:"thead",children:[{type:"tr",props:{className:"text-xs text-text-muted uppercase"},children:"{{headers}}"}]},{type:"tbody",props:{className:"text-sm text-text-primary"},children:"{{rows}}"}]}]},dataContract:{inputs:{title:{type:"string",description:"Table title"},headers:{type:"string",description:"Column headers"},rows:{type:"string",description:"Table rows data"}},outputs:{}},tags:["table","data","list"],source:"built-in",createdAt:Date.now(),updatedAt:Date.now()}],l=i()(s((o,a)=>({components:Object.fromEntries(p.map(e=>[e.id,e])),addComponent:e=>o(t=>({components:{...t.components,[e.id]:e}})),removeComponent:e=>o(t=>{let{[e]:r,...n}=t.components;return{components:n}}),updateComponent:(e,t)=>o(r=>{let n=r.components[e];return n?{components:{...r.components,[e]:{...n,...t,updatedAt:Date.now()}}}:r}),getByCategory:e=>Object.values(a().components).filter(t=>t.category===e),getBySource:e=>Object.values(a().components).filter(t=>t.source===e)}),{name:"decido-ui-components"}));export{l as a};
@@ -0,0 +1 @@
1
+ import i from"react";var o=new Map,a={markdown:{icon:"\u{1F4DD}",color:"#10b981",label:"Markdown"},iframe:{icon:"\u{1F5A5}\uFE0F",color:"#6b7280",label:"iFrame"},"nexusai-preview":{icon:"\u{1F310}",color:"#3b82f6",label:"Web Preview"},"shell-vscode":{icon:"\u{1F4BB}",color:"#007acc",label:"VS Code"},"shell-canvas":{icon:"\u{1F5BC}\uFE0F",color:"#f59e0b",label:"Canvas"},"shell-theme-editor":{icon:"\u{1F3A8}",color:"#a855f7",label:"Theme Editor"}},t=new Map;function c(e,r,n){t.set(e,r),n?o.set(e,n):a[e]&&o.set(e,a[e])}function p(e){return t.get(e)}function h(e){return t.has(e)}function d(){return Array.from(t.keys())}function g(e){return o.get(e)||{icon:"\u{1F4E6}",color:"#71717a",label:e}}function f(e,r){let n=l=>i.createElement(r,{...l.data||{},...l});t.set(e,n)}function m(e){return t.get(e)}export{c as a,p as b,h as c,d,g as e,f,m as g};
@@ -0,0 +1 @@
1
+ import{useMemo as u}from"react";var c=[{type:"EDIT_GRAPH",pattern:/\b(agrega|suma|añade|conecta|modifica|cambia|elimina|borra|parchea|actualiza|inserta|mueve)\b/gi,label:"Editar Grafo",icon:"\u270F\uFE0F",color:"#f59e0b",examples:["Agrega un nodo de validaci\xF3n despu\xE9s de login","Conecta el nodo de pago con el de confirmaci\xF3n","Elimina el paso de verificaci\xF3n duplicado"]},{type:"CREATE_GRAPH",pattern:/\b(grafo|flujo|nodos|blueprint|escenario|onboarding|proceso|workflow|pipeline|trigger|subflujo|orquest)\b|\b(crea|diseña|genera|construye)\s+(un|una|el|la|los|las)\b/gi,label:"Crear Grafo",icon:"\u{1F517}",color:"#10b981",examples:["Crea un flujo de onboarding para nuevos usuarios","Dise\xF1a un pipeline de procesamiento de datos","Genera un blueprint con 5 nodos de decisi\xF3n"]},{type:"UI_ACTION",pattern:/\b(shell|tema|theme|sidebar|panel|activity\s*bar|status\s*bar|top\s*bar|notificaci[oó]n|shortcut|atajo|layout)\b|\b(configura)\s+(el|la|los|las)\b/gi,label:"Acci\xF3n UI",icon:"\u{1F3A8}",color:"#3b82f6",examples:["Abre el panel de sidebar","Configura el tema oscuro","Cambia el layout a pantalla completa"]},{type:"MCP_ACTION",pattern:/\b(ejecuta|invoca|llama|herramienta|tool|api|endpoint)\b/gi,label:"Acci\xF3n MCP",icon:"\u26A1",color:"#a855f7",examples:["Ejecuta la herramienta de an\xE1lisis de c\xF3digo","Invoca el endpoint de validaci\xF3n","Llama al API de b\xFAsqueda sem\xE1ntica"]},{type:"NAVIGATE",pattern:/\b(landing|página\s*web|web\s*page|website|diseño\s*web|sitio|homepage|portfolio|dashboard\s*ui|ui\s*design|mockup|prototipo\s*web)\b/gi,label:"Web Preview",icon:"\u{1F310}",color:"#06b6d4",examples:["Crea una landing page para un SaaS de IA","Dise\xF1a un portfolio moderno con tema oscuro","Genera un dashboard UI para m\xE9tricas de ventas","Crea una p\xE1gina de pricing con 3 planes"]}],p=[];function g(n){p.push(n)}function f(){return[...c,...p]}function d(n){if(!n.trim())return[];let i=[];for(let{type:e,pattern:o,color:r}of c){let l=new RegExp(o.source,o.flags),s;for(;(s=l.exec(n))!==null;)i.push({start:s.index,end:s.index+s[0].length,intent:e,color:r})}i.sort((e,o)=>e.start-o.start);let a=[],t=0;for(let e of i)e.start<t||(e.start>t&&a.push({text:n.slice(t,e.start),intent:"NONE",color:null,isMatch:!1}),a.push({text:n.slice(e.start,e.end),intent:e.intent,color:e.color,isMatch:!0}),t=e.end);return t<n.length&&a.push({text:n.slice(t),intent:"NONE",color:null,isMatch:!1}),a}function m(n){return u(()=>{let a=d(n),t=new Map;for(let e of a)if(e.isMatch&&e.intent!=="NONE"){let o=t.get(e.intent);if(o)o.matchedPhrases.push(e.text);else{let r=c.find(l=>l.type===e.intent);t.set(e.intent,{type:e.intent,label:r.label,color:r.color,icon:r.icon,matchedPhrases:[e.text]})}}return{tokens:a,detectedIntents:Array.from(t.values()),hasIntents:t.size>0,primaryIntent:t.size>0?Array.from(t.values())[0]:null}},[n])}export{c as a,g as b,f as c,m as d};