PageSourceSearch

https://dgac.gob.gt/assets/ProjectEsquemaEditor-CdSgQUhq.js

js dgac.gob.gt collected 2026-10-02 11:16:36 UTC 140,749 bytes, 30 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/jspdf.es.min-DzOvLlYn.js","assets/index-DVu_w4ho.js","assets/ui-vendor-Cm2ZkKHv.js","assets/radix-vendor-CtEXKD-D.js","assets/chart-vendor-b_bTPWgQ.js","assets/table-vendor-C2kIG4hh.js","assets/react-vendor-DVzxkp4A.js","assets/index-JjaNiqZo.css"])))=>i.map(i=>d[i]);
2import{r as i,b1 as Us,B as $r,T as Ys,bY as tt,z as ys,bD as Xs,eg as Ar,eh as rt,di as Ir,a0 as de,aO as Rr,ei as nt,d0 as ue,aJ as Zs,F as Ns,j as e,cH as ot,ej as Ks,b6 as ws,bF as Js,K as be,ci as Is,c9 as Qs,H as Xe,a8 as ea,cp as Lr,bq as Fr,bd as Ze,bz as sa,aC as Ke,aq as Rs,ek as Br,a7 as lt,ae as Ia,el as qr,aX as it,em as Or,U as Wr,ag as ct,_ as dt,en as mt,eo as Hr,ep as ht,cQ as Vr,cs as Gr,ce as Ur,eq as Yr,aM as Te,er as Xr,bE as aa,es as Zr,et as Kr,cu as ta,Z as ut,eu as Jr,cP as Qr,ev as en,d$ as sn,ew as an,ex as Ls,bH as tn,bP as rn,dk as nn,C as on,ey as xt,bj as ln,cI as cn,d2 as dn,ct as ra,p as Fs,dg as Ye,i as mn,ez as hn,eA as un,e4 as xn,eB as pn,eC as gn,eD as bn,aP as na,eE as pt,eF as gt,v as Ie,eG as oa,eH as jn,eI as fn,eJ as yn,eK as Nn,eL as bt,eM as wn,eN as jt,b7 as Ra,dH as vn,aN as ze,dG as ft,cF as La,dX as Je,eO as Qe,eP as bs,bx as vs,al as Bs,eQ as yt,eR as Ee,dl as kn,bU as la,aV as Nt,aU as ia,dY as Cn,ak as Sn,X as Re,eS as Tn,O as wt,am as qs,cA as vt,W as zn,eT as Fa,eU as Ba,n as Os,bv as kt,eV as En,eW as Mn,eX as qa,eY as _n,eZ as Ct,bZ as Dn,x as Ws,y as Hs,N as Pn,e_ as $n,L as An,cO as In,Y as Rn,ax as Ln}from"./ui-vendor-Cm2ZkKHv.js";import{a4 as Fn,a5 as J,a6 as Q,B as S,a7 as ee,ae as He,af as Ve,ag as Ge,ah as ae,L as I,ai as Oa,bK as St,bU as Bn,bL as Tt,bM as zt,bN as Et,p as xe,I as V,S as Wa,k as Ha,l as Va,m as Ga,o as Ae,aG as Mt,D as _t,A as Dt,E as Pt,F as $t,bV as Ua,bW as Ya,bX as Xa,bY as Z,bZ as Ce,b_ as hs,b$ as us,c0 as xs,t as P,f as qn,Y as On,v as Wn,_ as Ds,s as Za,bJ as Hn,i as Vn,r as Gn,av as Un,aw as Yn,ax as Xn,ay as Zn,az as Kn,c1 as Jn}from"./index-DVu_w4ho.js";import{T as Qn}from"./TourButton-BlXtTvkT.js";import{E as Ps,a as $s}from"./esquemaService-D8ltyFNb.js";import{H as G,P as U,u as es,N as ps,R as gs,a as ce,M as Ue,b as eo,c as so,d as ao,e as to,f as ro,i as no,S as oo,C as lo,g as io,h as co,B as mo,j as ho}from"./style-2C4_WjcM.js";import{P as uo,a as xo,b as po}from"./popover-QQzRiqgZ.js";import{S as ve}from"./slider-BZ_z5xWI.js";import{T as At}from"./textarea-gQKtTFwB.js";import{S as go}from"./switch-CZO0JRho.js";import{T as Vs,a as Gs,b as Ne,c as we}from"./tabs-oAd-VtsP.js";import{u as bo,S as jo}from"./useRealtimeQuery-dqtk93Nx.js";import{c as fo,a as yo}from"./react-vendor-DVzxkp4A.js";import"./radix-vendor-CtEXKD-D.js";import"./chart-vendor-b_bTPWgQ.js";import"./table-vendor-C2kIG4hh.js";const No=[{element:'[data-tour="editor-canvas"]',popover:{title:"🎨 Lienzo del Editor",description:"Este es tu espacio de trabajo. Arrastra, suelta y conecta nodos para crear tu diagrama.",side:"bottom",align:"center"}},{element:'[data-tour="editor-toolbar"]',popover:{title:"🔧 Barra de Herramientas",description:`Accede a todas las funciones:
3• Guardar
4• Deshacer/Rehacer
5• Zoom
6• Bloquear/Desbloquear
7• Exportar`,side:"bottom",align:"start"}},{element:'[data-tour="editor-palette"]',popover:{title:"📦 Paleta de Nodos",description:"Arrastra nodos al lienzo para agregarlos. Cada tipo de diagrama tiene nodos específicos.",side:"right",align:"start"}},{element:'[data-tour="editor-config"]',popover:{title:"⚙️ Panel de Configuración",description:"Selecciona un nodo para ver y editar sus propiedades: texto, colores, tamaño, etc.",side:"left",align:"start"}},{element:'[data-tour="editor-layers"]',popover:{title:"📚 Panel de Capas",description:"Organiza el orden de los elementos. Arrastra para reordenar o usa los botones de visibilidad.",side:"left",align:"start"}},{element:'[data-tour="editor-save"]',popover:{title:"💾 Guardar",description:"Guarda tu trabajo regularmente. También hay auto-guardado cada pocos minutos.",side:"bottom",align:"start"}}
7,{element:'[data-tour="editor-export"]',popover:{title:"📥 Exportar",description:"Descarga tu diagrama como imagen PNG, PDF o archivo JSON para respaldo.",side:"bottom",align:"start"}},{element:'[data-tour="editor-presentation"]',popover:{title:"🎬 Modo Presentación",description:"Activa el modo presentación para mostrar el diagrama sin controles ni distracciones.",side:"bottom",align:"start"}}],Ka={flat:"2D Plano",isometric:"3D Isométrico",minimal:"Minimalista",schematic:"Esquemático",neon:"Neón / Futurista",gradient:"Degradado",glass:"Cristal",outline:"Contorno"},wo={flat:"⬜",isometric:"📦",minimal:"◽",schematic:"📐",neon:"✨",gradient:"🌈",glass:"💎",outline:"⬛"},vo={flat:{borderRadius:"lg",borderWidth:2,borderStyle:"solid",shadowSize:"md",gradientDirection:"none",backdropBlur:!1,iconSize:"md",textSize:"sm",padding:"md"},isometric:{borderRadius:"md",borderWidth:3,borderStyle:"solid",shadowSize:"xl",gradientDirection:"to-br",backdropBlur:!1,iconSize:"lg",textSize:"sm",padding:"lg"},minimal:{borderRadius:"sm",borderWidth:1,borderStyle:"solid",shadowSize:"none",gradientDirection:"none",backdropBlur:!1,iconSize:"sm",textSize:"xs",padding:"xs"},schematic:{borderRadius:"none",borderWidth:2,borderStyle:"solid",shadowSize:"sm",gradientDirection:"none",backdropBlur:!1,iconSize:"sm",textSize:"xs",padding:"sm"},neon:{borderRadius:"lg",borderWidth:2,borderStyle:"solid",shadowSize:"glow",gradientDirection:"none",backdropBlur:!0,iconSize:"md",textSize:"sm",padding:"md",glowIntensity:15},gradient:{borderRadius:"xl",borderWidth:0,borderStyle:"solid",shadowSize:"lg",gradientDirection:"to-br",backdropBlur:!1,iconSize:"md",textSize:"sm",padding:"md"},glass:{borderRadius:"xl",borderWidth:1,borderStyle:"solid",shadowSize:"lg",gradientDirection:"none",backdropBlur:!0,iconSize:"md",textSize:"sm",padding:"md"},outline:{borderRadius:"lg",borderWidth:2,borderStyle:"dashed",shadowSize:"none",gradientDirection:"none",backdropBlur:!1,iconSize:"md",textSize:"sm",padding:"md"}};function ko(s){switch(s){case"none":return"rounded-none";case"sm":return"rounded-sm";case"md":return"rounded-md";case"lg":return"rounded-lg";case"xl":return"rounded-xl";case"full":return"rounded-full";default:return"rounded-lg"}}function Co(s){switch(s){case"none":return"";case"sm":return"shadow-sm";case"md":return"shadow-md";case"lg":return"shadow-lg";case"xl":return"shadow-xl";case"glow":return"shadow-xl";default:return"shadow-md"}}function js(s){switch(s){case"xs":return"h-3 w-3";case"sm":return"h-4 w-4";case"md":return"h-5 w-5";case"lg":return"h-6 w-6";case"xl":return"h-8 w-8";default:return"h-5 w-5"}}function Se(s){switch(s){case"xs":return"text-[9px]";case"sm":return"text-xs";case"md":return"text-sm";case"lg":return"text-base";default:return"text-xs"}}function So(s){switch(s){case"xs":return"p-1.5";case"sm":return"p-2";case"md":return"p-3";case"lg":return"p-4";default:return"p-3"}}function It(s,u,c){const l={...vo[s],...c};let p=[ko(l.borderRadius),Co(l.shadowSize),So(l.padding),"transition-all duration-300"].filter(Boolean).join(" "),o={borderWidth:l.borderWidth,borderStyle:l.borderStyle,borderColor:u};switch(s){case"isometric":p+=" transform-gpu",o={...o,transform:"perspective(1000px) rotateX(10deg) rotateY(-10deg)",transformStyle:"preserve-3d",background:`linear-gradient(135deg, ${u}20 0%, ${u}05 100%)`,boxShadow:`8px 8px 0 ${u}30, 12px 12px 20px rgba(0,0,0,0.2)`};break;case"minimal":o={...o,background:"transparent",borderColor:`${u}60`};break;case"schematic":o={...o,background:"transparent",fontFamily:"monospace"};break;case"neon":o={...o,background:`${u}10`,boxShadow:`0 0 ${l.glowIntensity||15}px ${u}, 0 0 ${(l.glowIntensity||15)*2}px ${u}50, inset 0 0 20px ${u}10`,borderColor:u},l.backdropBlur&&(p+=" backdrop-blur-sm");break;case"gradient":{const k=l.gradientTo||To(u,-30);o={...o,background:`linear-gradient(135deg, ${u} 0%, ${k} 100%)`,borderWidth:0,color:"white"};break}case"glass":o={...o,background:`${u}15`,backdropFilter:"blur(10px)",borderColor:`${u}40`,boxShadow:`0 8px 32px ${u}20`};break;case"outline":o={...o,background:"transparent"};break;case"flat":default:o={...o,background:`${u}10`};break}return{className:p,style:o}}function To(s,u){if(!s.startsWith("#"))return s;const c=s.replace("#",""),l=parseInt(c,16),p=Math.max(0,Math.min(255,(l>>16)+u)),o=Math.max(0,Math.min(255,(l>>8&255)+u)),k=Math.max(0,Math.min(255,(l&255)+u));return`#${(1<<24|p<<16|o<<8|k).toString(16).slice(1)}`}const Rt={texto:Ns,inicio:Zs,fin:ue,proceso:nt,decision:Rr,subproceso:de,documento:Ir,entrada:rt,salida:Ar,usuario:Xs,sistema:ys,espera:tt,error:Ys,notificacion:$r,integracion:Us},Lt={texto:"Texto",inicio:"Inicio",fin:"Fin",proceso:"Proceso",decision:"Decisión",subproceso:"Subproceso",documento:"Documento",entrada:"Entrada",salida:"Salida",usuario:"Usuario",sistema:"Sistema",espera:"Espera",error:"Error",notificacion:"Notificación",integracion:"Integración"},Ft={texto:"#6366f1",inicio:"#22c55e",fin:"#ef4444",proceso:"#3b82f6",decision:"#f59e0b",subproceso:"#8b5cf6",documento:"#06b6d4",entrada:"#10b981",salida:"#f97316",usuario:"#ec4899",sistema:"#6366f1",espera:"#94a3b8",error:"#dc2626",notificacion:"#eab308",integracion:"#14b8a6"},zo=({data:s,selected:u,id:c})=>{const l=s,p=l.flowType||l.subType||"texto",o=Rt[p]||Ns,k=l.color||Ft[p],m=Lt[p],T=l.viewMode||"flat",z=l._connectedHandles||new Set,E=l._isLocked||!1,_=p==="decision",{className:h,style:C}=It(T,k),f=T==="minimal"?"sm":T==="isometric"?"lg":"md",j=T==="minimal"?"xs":"sm",v=N=>{const a=z.has(N);return E&&!a?{backgroundColor:k,opacity:0,pointerEvents:"none"}:T==="neon"?{backgroundColor:k,boxShadow:`0 0 8px ${k}`}:{backgroundColor:k}},x=()=>{const N={...C};return T==="gradient"&&(N.color="white"),N},n=()=>T==="gradient"?{backgroundColor:"rgba(255,255,255,0.2)"}:T==="neon"?{backgroundColor:`${k}30`,boxShadow:`0 0 10px ${k}50`}:T==="glass"?{backgroundColor:`${k}20`,backdropFilter:"blur(4px)"}:{backgroundColor:`${k}20`};return e.jsxs("div",{className:`relative transition-all duration-300 ${u?"ring-2 ring-primary/50 scale-105":""}`,children:[e.jsx(G,{type:"target",position:U.Top,id:"top",style:v("top"),className:"!w-3 !h-3"}),e.jsx(G,{type:"target",position:U.Left,id:"left",style:v("left"),className:"!w-3 !h-3"}),e.jsx("div",{className:`${h} bg-card min-w-[120px] border-2 ${_?"rotate-45":""}`,style:x(),children:e.jsx("div",{className:_?"-rotate-45":"",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[T!=="minimal"&&e.jsx("div",{className:"p-2 rounded-lg",style:n(),children:e.jsx(o,{className:js(f),style:{color:T==="gradient"?"white":k}})}),e.jsx("div",{className:"text-center",children:T==="minimal"?e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(o,{className:js("xs"),style:{color:k}}),e.jsx("span",{className:`font-medium ${Se("xs")}`,children:l.label})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:`uppercase tracking-wide font-medium ${Se("xs")}`,style:{color:T==="gradient"?"rgba(255,255,255,0.9)":k},children:m}
7),e.jsx("p",{className:`font-medium mt-0.5 ${Se(j)}`,children:l.label})]})}),l.description&&T!=="minimal"&&e.jsx("p",{className:`text-muted-foreground text-center max-w-[100px] ${Se("xs")} ${T==="gradient"?"text-white/70":""}`,children:l.description})]})})}),e.jsx(G,{type:"source",position:U.Bottom,id:"bottom",style:v("bottom"),className:"!w-3 !h-3"}),e.jsx(G,{type:"source",position:U.Right,id:"right",style:v("right"),className:"!w-3 !h-3"})]})},Eo=i.memo(zo),Bt={internet:lt,router:Br,firewall:Rs,switch:Ke,access_point:sa,servidor_red:Ze,pc:ys,laptop:Fr,impresora:Lr,camara_ip:ea,nvr:Xe,nas:Qs,balanceador:Is,vpn:be,patch_panel:Js,rack:ws,iot_device:Ks,telefono_ip:ot},qt={internet:"Internet",router:"Router",firewall:"Firewall",switch:"Switch",access_point:"Access Point",servidor_red:"Servidor",pc:"PC",laptop:"Laptop",impresora:"Impresora",camara_ip:"Cámara IP",nvr:"NVR",nas:"NAS",balanceador:"Balanceador",vpn:"VPN",patch_panel:"Patch Panel",rack:"Rack",iot_device:"IoT Device",telefono_ip:"Teléfono IP"},Ot={internet:"#3b82f6",router:"#10b981",firewall:"#ef4444",switch:"#8b5cf6",access_point:"#06b6d4",servidor_red:"#6366f1",pc:"#64748b",laptop:"#64748b",impresora:"#f59e0b",camara_ip:"#ec4899",nvr:"#8b5cf6",nas:"#14b8a6",balanceador:"#f97316",vpn:"#22c55e",patch_panel:"#94a3b8",rack:"#475569",iot_device:"#a855f7",telefono_ip:"#0ea5e9"},Mo=({data:s,selected:u})=>{const c=s,l=c.networkType||c.subType||"switch",p=Bt[l]||Ke,o=c.color||Ot[l],k=qt[l],m=c.viewMode||"flat",{className:T,style:z}=It(m,o),E=m==="minimal"?"sm":m==="isometric"?"xl":"lg",_=()=>
7m==="neon"?{backgroundColor:o,boxShadow:`0 0 8px ${o}`}:{backgroundColor:o},h=()=>m==="gradient"?{backgroundColor:"rgba(255,255,255,0.2)"}:m==="neon"?{backgroundColor:`${o}30`,boxShadow:`0 0 15px ${o}60`}:m==="glass"?{backgroundColor:`${o}20`,backdropFilter:"blur(4px)"}:m==="isometric"?{backgroundColor:`${o}20`,transform:"translateZ(10px)",boxShadow:`4px 4px 0 ${o}40`}:{backgroundColor:`${o}15`},C=f=>{const j="text-[9px] px-1.5 py-0.5 rounded text-center";if(m==="gradient")return`${j} bg-white/20 text-white font-mono`;if(m==="neon")return`${j} bg-black/30 text-white font-mono border border-${o}/50`;if(m==="minimal")return`${j} bg-transparent text-muted-foreground font-mono`;switch(f){case"primary":return`${j} bg-muted font-mono`;case"secondary":return`${j} bg-muted/50 font-mono text-muted-foreground`;case"accent":return`${j}`}};return e.jsxs("div",{className:`${T} bg-card min-w-[130px] transition-all duration-300 ${u?"ring-2 ring-primary/30 scale-105":""}`,style:z,children:[e.jsx(G,{type:"target",position:U.Top,style:_(),className:"!w-3 !h-3"}),e.jsx(G,{type:"target",position:U.Left,style:_(),className:"!w-3 !h-3"}),e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[m!=="minimal"&&e.jsx("div",{className:"p-2.5 rounded-lg transition-all",style:h(),children:e.jsx(p,{className:js(E),style:{color:m==="gradient"?"white":o}})}),e.jsx("div",{className:"text-center",children:m==="minimal"?e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(p,{className:js("sm"),style:{color:o}}),e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:`font-medium ${Se("xs")}`,children:c.label}),c.ip&&e.jsx("span",{className:"text-[8px] text-muted-foreground font-mono",children:c.ip})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:`uppercase tracking-wide font-medium ${Se("xs")}`,style:{color:m==="gradient"?"rgba(255,255,255,0.9)":o},children:k}),e.jsx("p",{className:`font-medium mt-0.5 ${Se("sm")} ${m==="gradient"?"text-white":""}`,children:c.label})]})}),m!=="minimal"&&e.jsxs("div",{className:"flex flex-col gap-0.5 w-full",children:[c.ip&&e.jsx("span",{className:C("primary"),children:c.ip}),c.mac&&e.jsx("span",{className:C("secondary"),children:c.mac}),c.vlan&&e.jsxs("span",{className:C("accent"),style:{backgroundColor:m==="gradient"?"rgba(255,255,255,0.2)":`${o}20`,color:m==="gradient"?"white":o},children:["VLAN: ",c.vlan]})]})]}),e.jsx(G,{type:"source",position:U.Bottom,style:_(),className:"!w-3 !h-3"}),e.jsx(G,{type:"source",position:U.Right,style:_(),className:"!w-3 !h-3"})]})},_o=i.memo(Mo),Wt={usuario:Xs,dns:lt,cdn:Ia,load_balancer:Is,backend_server:Ze,frontend_server:ys,web_server:Or,app_server:Ks,api_server:Us,auth_server:be,firewall:Rs,proxy_server:Rs,balanceador:Is,database:Qs,cache:de,queue:tt,storage:Xe,backup:Xe,monitoring:it,logging:Ns,container:qr,vm:ws,bare_metal:Ze,external_service:Ia,cron_job:nt},Ht={usuario:"Usuario",dns:"DNS",cdn:"CDN",load_balancer:"Load Balancer",backend_server:"Backend",frontend_server:"Frontend",web_server:"Web Server",app_server:"App Server",api_server:"API Server",auth_server:"Auth Server",firewall:"Firewall",proxy_server:"Proxy",balanceador:"Balanceador",database:"Database",cache:"Cache",queue:"Queue",storage:"Storage",backup:"Backup",monitoring:"Monitoring",logging:"Logging",container:"Container",vm:"VM",bare_metal:"Bare Metal",external_service:"Servicio Ext.",cron_job:"Cron Job"},Vt={usuario:"#64748b",dns:"#3b82f6",cdn:"#06b6d4",load_balancer:"#f59e0b",backend_server:"#8b5cf6",frontend_server:"#10b981",web_server:"#6366f1",app_server:"#ec4899",api_server:"#14b8a6",auth_server:"#ef4444",firewall:"#dc2626",proxy_server:"#f97316",balanceador:"#eab308",database:"#22c55e",cache:"#a855f7",queue:"#0ea5e9",storage:"#64748b",backup:"#475569",monitoring:"#84cc16",logging:"#94a3b8",container:"#0284c7",vm:"#7c3aed",bare_metal:"#374151",external_service:"#06b6d4",cron_job:"#f59e0b"},Do={online:"bg-green-500",offline:"bg-red-500",warning:"bg-yellow-500",maintenance:"bg-blue-500"},Po=({data:s,selected:u})=>{const c=s,l=c.serverType||c.subType||"web_server",p=Wt[l]||Ze,o=c.color||Vt[l],k=Ht[l];return e.jsxs("div",{className:`p-3 rounded-lg border-2 bg-card shadow-lg min-w-[130px] transition-all ${u?"ring-2 ring-primary/30 scale-105":""}`,style:{borderColor:o},children:[e.jsx(G,{type:"target",position:U.Top,style:{backgroundColor:o},className:"!w-3 !h-3"}),e.jsx(G,{type:"target",position:U.Left,style:{backgroundColor:o},className:"!w-3 !h-3"}),e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"p-3 rounded-lg",style:{backgroundColor:`${o}15`},children:e.jsx(p,{className:"h-6 w-6",style:{color:o}})}),c.status&&e.jsx("div",{className:`absolute -top-1 -right-1 w-3 h-3 rounded-full ${Do[c.status]} ring-2 ring-card`})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("span",{className:"text-[10px] uppercase tracking-wide font-medium",style:{color:o},children:k}),e.jsx("p",{className:"font-semibold text-xs mt-0.5",children:c.label})]}),c.specs&&e.jsx("span",{className:"text-[9px] px-2 py-0.5 rounded-full bg-muted font-mono",children:c.specs}),c.port&&e.jsxs("span",{className:"text-[9px] px-2 py-0.5 rounded",style:{backgroundColor:`${o}20`,color:o},children:[":",c.port]})]}),e.jsx(G,{type:"source",position:U.Bottom,style:{backgroundColor:o},className:"!w-3 !h-3"}
7),e.jsx(G,{type:"source",position:U.Right,style:{backgroundColor:o},className:"!w-3 !h-3"})]})},$o=i.memo(Po),Gt={heat_point:dt,sensor:it,camera:ea,zona:ue,evento:ct,alerta:Ys,contador:Wr,fuente_datos:Qs},Ut={heat_point:"Punto de Calor",sensor:"Sensor",camera:"Cámara",zona:"Zona",evento:"Evento",alerta:"Alerta",contador:"Contador",fuente_datos:"Fuente Datos"},Yt={heat_point:"#ef4444",sensor:"#10b981",camera:"#6366f1",zona:"#8b5cf6",evento:"#f59e0b",alerta:"#dc2626",contador:"#0ea5e9",fuente_datos:"#64748b"},Ja={low:"bg-green-400",medium:"bg-yellow-400",high:"bg-orange-500",critical:"bg-red-500"},Ao=({data:s,selected:u})=>{const c=s,l=c.heatType||c.subType||"heat_point",p=Gt[l]||dt,o=c.color||Yt[l],k=Ut[l],m=c.intensity||"medium",T=l==="heat_point";return e.jsxs("div",{className:`p-3 rounded-lg border-2 bg-card shadow-lg min-w-[120px] transition-all ${u?"ring-2 ring-primary/30 scale-105":""}`,style:{borderColor:o},children:[e.jsx(G,{type:"target",position:U.Top,style:{backgroundColor:o},className:"!w-3 !h-3"}),e.jsx(G,{type:"target",position:U.Left,style:{backgroundColor:o},className:"!w-3 !h-3"}),e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsxs("div",{className:"relative",children:[T?e.jsx("div",{className:`p-3 rounded-full ${Ja[m]}`,children:e.jsx(p,{className:"h-6 w-6 text-white"})}):e.jsx("div",{className:"p-3 rounded-lg",style:{backgroundColor:`${o}15`},children:e.jsx(p,{className:"h-6 w-6",style:{color:o}})}),l==="alerta"&&e.jsx("div",{className:"absolute -top-1 -right-1 w-3 h-3 rounded-full bg-red-500 animate-pulse"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("span",{className:"text-[10px] uppercase tracking-wide font-medium",style:{color:o},children:k}),e.jsx("p",{className:"font-medium text-xs mt-0.5",children:c.label})]}),c.value&&e.jsx("span",{className:"text-sm font-bold",style:{color:o},children:c.value}),c.zone&&e.jsx("span",{className:"text-[9px] px-2 py-0.5 rounded-full bg-muted",children:c.zone}),T&&e.jsx("span",{className:`text-[9px] px-2 py-0.5 rounded-full capitalize ${Ja[m]} text-white`,children:m})]}),e.jsx(G,{type:"source",position:U.Bottom,style:{backgroundColor:o},className:"!w-3 !h-3"}),e.jsx(G,{type:"source",position:U.Right,style:{backgroundColor:o},className:"!w-3 !h-3"})]})},Io=i.memo(Ao),Xt={red_electrica:ut,transformador:ta,generador:Kr,ups:Zr,panel_principal:Js,subpanel:aa,breaker:Xr,circuito:Te,tomacorriente:Us,interruptor:Yr,luminaria:Ur,medidor:Gr,puesta_tierra:Vr,canalizacion:ht,carga:Hr,equipo_critico:Ys,tablero_control:mt},Zt={red_electrica:"Red Eléctrica",transformador:"Transformador",generador:"Generador",ups:"UPS",panel_principal:"Panel Principal",subpanel:"Subpanel",breaker:"Breaker",circuito:"Circuito",tomacorriente:"Tomacorriente",interruptor:"Interruptor",luminaria:"Luminaria",medidor:"Medidor",puesta_tierra:"Puesta a Tierra",canalizacion:"Canalización",carga:"Carga",equipo_critico:"Equipo Crítico",tablero_control:"Tablero Control"},Kt={red_electrica:"#f59e0b",transformador:"#8b5cf6",generador:"#22c55e",ups:"#10b981",panel_principal:"#6366f1",subpanel:"#3b82f6",breaker:"#ef4444",circuito:"#64748b",tomacorriente:"#0ea5e9",interruptor:"#14b8a6",luminaria:"#eab308",medidor:"#f97316",puesta_tierra:"#84cc16",canalizacion:"#94a3b8",carga:"#a855f7",equipo_critico:"#dc2626",tablero_control:"#475569"},Ro=({data:s,selected:u})=>{const c=s,l=c.electricalType||c.subType||"tomacorriente",p=Xt[l]||ut,o=c.color||Kt[l],k=Zt[l];return e.jsxs("div",{className:`p-3 rounded-lg border-2 bg-card shadow-md min-w-[120px] transition-all ${u?"ring-2 ring-primary/30 scale-105":""}`,style:{borderColor:o},children:[e.jsx(G,{type:"target",position:U.Top,style:{backgroundColor:o},className:"!w-3 !h-3"}),e.jsx(G,{type:"target",position:U.Left,style:{backgroundColor:o},className:"!w-3 !h-3"}),e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx("div",{className:"p-2.5 rounded-lg",style:{backgroundColor:`${o}20`},children:e.jsx(p,{className:"h-6 w-6",style:{color:o}})}),e.jsxs("div",{className:"text-center",children:[e.jsx("span",{className:"text-[10px] uppercase tracking-wide font-medium",style:{color:o},children:k}),e.jsx("p",{className:"font-medium text-xs mt-0.5",children:c.label})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 justify-center",children:[c.voltage&&e.jsxs("span",{className:"text-[9px] px-1.5 py-0.5 rounded bg-muted font-mono",children:[c.voltage,"V"]}),c.amperage&&e.jsxs("span",{className:"text-[9px] px-1.5 py-0.5 rounded bg-muted font-mono",children:[c.amperage,"A"]}),c.phase&&e.jsxs("span",{className:"text-[9px] px-1.5 py-0.5 rounded bg-muted font-mono",children:[c.p
7hase,"φ"]})]}),c.circuit&&e.jsx("span",{className:"text-[9px] px-2 py-0.5 rounded-full",style:{backgroundColor:`${o}20`,color:o},children:c.circuit})]}),e.jsx(G,{type:"source",position:U.Bottom,style:{backgroundColor:o},className:"!w-3 !h-3"}),e.jsx(G,{type:"source",position:U.Right,style:{backgroundColor:o},className:"!w-3 !h-3"})]})},Lo=i.memo(Ro),Jt={fuente_audio:nn,microfono:rn,mezcladora:mt,procesador_audio:Ks,amplificador:tn,parlante:Ls,subwoofer:Ls,monitor_audio:an,zona_audio:ue,control_volumen:sn,grabadora:Te,interface_audio:en,receptor_wireless:Qr,transmisor:sa,streaming_audio:Jr,rack_audio:ws},Qt={fuente_audio:"Fuente Audio",microfono:"Micrófono",mezcladora:"Mezcladora",procesador_audio:"Procesador",amplificador:"Amplificador",parlante:"Parlante",subwoofer:"Subwoofer",monitor_audio:"Monitor",zona_audio:"Zona Audio",control_volumen:"Control Vol.",grabadora:"Grabadora",interface_audio:"Interface",receptor_wireless:"Receptor",transmisor:"Transmisor",streaming_audio:"Streaming",rack_audio:"Rack Audio"},er={fuente_audio:"#ec4899",microfono:"#f59e0b",mezcladora:"#8b5cf6",procesador_audio:"#6366f1",amplificador:"#ef4444",parlante:"#10b981",subwoofer:"#14b8a6",monitor_audio:"#3b82f6",zona_audio:"#64748b",control_volumen:"#0ea5e9",grabadora:"#dc2626",interface_audio:"#a855f7",receptor_wireless:"#22c55e",transmisor:"#f97316",streaming_audio:"#06b6d4",rack_audio:"#475569"},Fo=({data:s,selected:u})=>{const c=s,l=c.soundType||c.subType||"parlante",p=Jt[l]||Ls,o=c.color||er[l],k=Qt[l];return e.jsxs("div",{className:`p-3 rounded-lg border-2 bg-card shadow-lg min-w-[125px] transition-all ${u?"ring-2 ring-primary/30 scale-105":""}`,style:{borderColor:o},children:[e.jsx(G,{type:"target",position:U.Top,style:{backgroundColor:o},className:"!w-3 !h-3"}),e.jsx(G,{type:"target",position:U.Left,style:{backgroundColor:o},className:"!w-3 !h-3"}),e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsxs("div",{className:"p-3 rounded-full relative",style:{backgroundColor:`${o}15`},children:[e.jsx(p,{className:"h-6 w-6",style:{color:o}}),(l==="parlante"||l==="subwoofer")&&e.jsx("div",{className:"absolute inset-0 rounded-full animate-ping opacity-20",style:{backgroundColor:o}})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("span",{className:"text-[10px] uppercase tracking-wide font-medium",style:{color:o},children:k}),e.jsx("p",{className:"font-semibold text-xs mt-0.5",children:c.label})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 justify-center",children:[c.power&&e.jsxs("span",{className:"text-[9px] px-1.5 py-0.5 rounded bg-muted font-mono",children:[c.power,"W"]}),c.impedance&&e.jsxs("span",{className:"text-[9px] px-1.5 py-0.5 rounded bg-muted font-mono",children:[c.impedance,"Ω"]}),c.frequency&&e.jsxs("span",{className:"text-[9px] px-1.5 py-0.5 rounded bg-muted font-mono",children:[c.frequency,"Hz"]})]}),c.channel&&e.jsxs("span",{className:"text-[9px] px-2 py-0.5 rounded-full",style:{backgroundColor:`${o}20`,color:o},children:["CH: ",c.channel]})]}),e.jsx(G,{type:"source",position:U.Bottom,style:{backgroundColor:o},className:"!w-3 !h-3"}),e.jsx(G,{type:"source",position:U.Right,style:{backgroundColor:o},className:"!w-3 !h-3"})]})},Bo=i.memo(Fo),sr={punto_red:Ke,faceplate:ue,patch_panel:Js,switch:Ke,rack:ws,canaleta:ht,bandeja:de,tuberia:Te,equipo_final:ys,camara:ea,telefono_ip:ot,punto_wifi:sa,servidor:Ze,etiqueta:ln,medicion:xt,certificacion:on},ar={punto_red:"Punto de Red",faceplate:"Faceplate",patch_panel:"Patch Panel",switch:"Switch",rack:"Rack",canaleta:"Canaleta",bandeja:"Bandeja",tuberia:"Tubería",equipo_final:"Equipo Final",camara:"Cámara",telefono_ip:"Teléfono IP",punto_wifi:"Punto WiFi",servidor:"Servidor",etiqueta:"Etiqueta",medicion:"Medición",certificacion:"Certificación"},tr={punto_red:"#3b82f6",faceplate:"#64748b",patch_panel:"#8b5cf6",switch:"#10b981",rack:"#475569",canaleta:"#f59e0b",bandeja:"#94a3b8",tuberia:"#6366f1",equipo_final:"#0ea5e9",camara:"#ec4899",telefono_ip:"#14b8a6",punto_wifi:"#22c55e",servidor:"#a855f7",etiqueta:"#f97316",medicion:"#84cc16",certificacion:"#06b6d4"},Qa={active:{bg:"bg-green-500/20",text:"text-green-600"},inactive:{bg:"bg-gray-500/20",text:"text-muted-foreground"},reserved:{bg:"bg-yellow-500/20",text:"text-yellow-600"},certified:{bg:"bg-blue-500/20",text:"text-blue-600"}},qo={active:"Activo",inactive:"Inactivo",reserved:"Reservado",certified:"Certificado"},Oo=({data:s,selected:u})=>{const c=s,l=c.pointType||c.subType||"punto_red",p=sr[l]||Ke,o=c.color||tr[l],k=ar[l],m=c.status||"active";return e.jsxs("div",{className:`p-3 rounded-lg border-2 bg-card shadow-md min-w-[125px] transition-all ${u?"ring-2 ring-primary/30 scale-105":""}`,style:{borderColor:o},children:[e.jsx(G,{type:"target",position:U.Top,style:{backgroundColor:o},className:"!w-3 !h-3"}),e.jsx(G,{type:"target",position:U.Left,style:{backgroundColor:o},className:"!w-3 !h-3"}),e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsxs("div",{className:"p-2.5 rounded-lg relative",style:{backgroundColor:`${o}15`},children:[e.jsx(p,{className:"h-6 w-6",style:{color:o}}),e.jsx("div",{className:`absolute -bottom-1 -right-1 w-2.5 h-2.5 rounded-full ring-2 ring-card ${m==="active"?"bg-green-500":m==="inactive"?"bg-gray-400":m==="reserved"?"bg-yellow-500":"bg-blue-500"}`})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("span",{className:"text-[10px] uppercase tracking-wide font-medium",style:{color:o},children:k}),e.jsx("p",{className:"font-medium text-xs mt-0.5",children:c.label})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 justify-center",children:[c.port&&e.jsxs("span",{className:"text-[9px] px-1.5 py-0.5 rounded bg-muted font-mono",children:["P:",c.port]}),c.vlan&&e.jsxs("span",{className:"text-[9px] px-1.5 py-0.5 rounded bg-muted font-mono",children:["V:",c.vlan]}),c.cable&&e.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded bg-muted font-mono",children:c.cable})]}),e.jsx("span",{className:`text-[9px] px-2 py-0.5 rounded-full ${Qa[m].bg} ${Qa[m].text}`,children:qo[m]})]}),e.jsx(G,{type:"source",position:U.Bottom,style:{backgroundColor:o},className:"!w-3 !h-3"}
7),e.jsx(G,{type:"source",position:U.Right,style:{backgroundColor:o},className:"!w-3 !h-3"})]})},Wo=i.memo(Oo),ge={rectangle:"Rectángulo",square:"Cuadrado",circle:"Círculo",ellipse:"Elipse",triangle:"Triángulo",diamond:"Diamante",hexagon:"Hexágono",pentagon:"Pentágono",octagon:"Octágono",star:"Estrella",line_horizontal:"Línea H",line_vertical:"Línea V",line_diagonal:"Línea D",arrow_right:"Flecha →",arrow_up:"Flecha ↑",corner:"Esquina",freeform:"Libre"},ss={rectangle:gn,square:ue,circle:Te,ellipse:Te,triangle:pn,diamond:ue,hexagon:xn,pentagon:un,octagon:hn,star:mn,line_horizontal:Ye,line_vertical:Ye,line_diagonal:Ye,arrow_right:Fs,arrow_up:ra,corner:dn,freeform:cn},as={rectangle:"#64748b",square:"#64748b",circle:"#64748b",ellipse:"#64748b",triangle:"#64748b",diamond:"#64748b",hexagon:"#64748b",pentagon:"#64748b",octagon:"#64748b",star:"#f59e0b",line_horizontal:"#374151",line_vertical:"#374151",line_diagonal:"#374151",arrow_right:"#374151",arrow_up:"#374151",corner:"#374151",freeform:"#6b7280"},Ho=({id:s,data:u,selected:c})=>{const l=u,{updateNodeData:p,updateNode:o}=es(),k=l.subType||"rectangle",m=l.color||l.fillColor||as[k]||"#64748b",T=l.strokeColor||m,z=l.strokeWidth||2,E=l.opacity??.5,_=l.rotation||0,h=l.showLabel!==!1,C=l.label||ge[k],f=l.locked===!0,j=l._isLocked===!0,v=l.animation||"none",x=l.viewMode||"flat",n=["line_horizontal","line_vertical","line_diagonal","arrow_right","arrow_up","corner"].includes(k),[N,a]=i.useState(!1),M=i.useRef({startAngle:0,startRotation:0}),b=i.useRef(null),D=i.useCallback(L=>{var je;if(f)return;L.stopPropagation(),L.preventDefault();const H=(je=b.current)==null?void 0:je.getBoundingClientRect();if(!H)return;const se=H.left+H.width/2,te=H.top+H.height/2,he=Math.atan2(L.clientY-te,L.clientX-se)*(180/Math.PI);M.current={startAngle:he,startRotation:_},a(!0)},[_,f]);i.useEffect(()=>{if(!N)return;const L=se=>{var fe;const te=(fe=b.current)==null?void 0:fe.getBoundingClientRect();if(!te)return;const he=te.left+te.width/2,je=te.top+te.height/2,Le=Math.atan2(se.clientY-je,se.clientX-he)*(180/Math.PI)-M.current.startAngle,re=(M.current.startRotation+Le+360)%360;p(s,{rotation:Math.round(re)})},H=()=>{a(!1)};return window.addEventListener("mousemove",L),window.addEventListener("mouseup",H),()=>{window.removeEventListener("mousemove",L),window.removeEventListener("mouseup",H)}},[N,s,p]);const w=()=>{switch(v){case"pulse":return"animate-pulse";case"bounce":return"animate-bounce";case"spin":return"animate-spin";case"ping":return"animate-ping";case"shake":return"animate-shake";case"glow":return"animate-glow";case"float":return"animate-float";case"wiggle":return"animate-wiggle";case"heartbeat":return"animate-heartbeat";case"flash":return"animate-flash";case"rubber":return"animate-rubber";case"swing":return"animate-swing";case"tada":return"animate-tada";case"jello":return"animate-jello";case"pop":return"animate-pop";default:return""}},B=i.useCallback((L,H)=>{p(s,{width:H.width,height:H.height}),o(s,{style:{width:H.width,height:H.height}})},[s,p,o]),R=()=>{let L={},H="";switch(x){case"isometric":L={filter:"drop-shadow(4px 4px 0px rgba(0,0,0,0.3))"};break;case"neon":L={filter:`drop-shadow(0 0 8px ${m}) drop-shadow(0 0 15px ${m}80)`};break;case"glass":H="";break;case"gradient":break;case"minimal":L={opacity:.3};break;case"outline":L={fillOpacity:0};break}return{fillStyle:L,svgClassName:H}},{fillStyle:$,svgClassName:q}=R(),oe=()=>{const L={fill:x==="outline"?"none":l.fillColor?l.fillColor:`${m}40`,stroke:T,strokeWidth:x==="neon"?z+1:z},H=`grad-${s}`,se=x==="gradient"?e.jsx("defs",{children:e.jsxs("linearGradient",{id:H,x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[e.jsx("stop",{offset:"0%",stopColor:m,stopOpacity:.9}),e.jsx("stop",{offset:"100%",stopColor:Vo(m,-40),stopOpacity:.9})]})}):null,te=x==="gradient"?`url(#${H})`:L.fill;switch(k){case"circle":return e.jsxs("svg",{width:"100%",height:"100%",preserveAspectRatio:"none",className:q,style:$,children:[se,e.jsx("ellipse",{cx:"50%",cy:"50%",rx:"48%",ry:"48%",fill:te,stroke:L.stroke,strokeWidth:L.strokeWidth,opacity:E})]});case"ellipse":return e.jsxs("svg",{width:"100%",height:"100%",preserveAspectRatio:"none",className:q,style:$,children:[se,e.jsx("ellipse",{cx:"50%",cy:"50%",rx:"48%",ry:"48%",fill:te,stroke:L.stroke,strokeWidth:L.strokeWidth,op
7acity:E})]});case"triangle":return e.jsxs("svg",{width:"100%",height:"100%",viewBox:"0 0 100 100",preserveAspectRatio:"none",className:q,style:$,children:[se,e.jsx("polygon",{points:"50,5 95,95 5,95",fill:te,stroke:L.stroke,strokeWidth:L.strokeWidth,opacity:E})]});case"diamond":return e.jsxs("svg",{width:"100%",height:"100%",viewBox:"0 0 100 100",preserveAspectRatio:"none",className:q,style:$,children:[se,e.jsx("polygon",{points:"50,5 95,50 50,95 5,50",fill:te,stroke:L.stroke,strokeWidth:L.strokeWidth,opacity:E})]});case"hexagon":return e.jsxs("svg",{width:"100%",height:"100%",viewBox:"0 0 100 100",preserveAspectRatio:"none",className:q,style:$,children:[se,e.jsx("polygon",{points:"25,5 75,5 95,50 75,95 25,95 5,50",fill:te,stroke:L.stroke,strokeWidth:L.strokeWidth,opacity:E})]});case"star":return e.jsxs("svg",{width:"100%",height:"100%",viewBox:"0 0 100 100",preserveAspectRatio:"none",className:q,style:$,children:[se,e.jsx("polygon",{points:"50,5 61,40 98,40 68,62 79,97 50,75 21,97 32,62 2,40 39,40",fill:te,stroke:L.stroke,strokeWidth:L.strokeWidth,opacity:E})]});case"line_horizontal":return e.jsx("svg",{width:"100%",height:"100%",preserveAspectRatio:"none",style:$,children:e.jsx("line",{x1:"0",y1:"50%",x2:"100%",y2:"50%",stroke:T,strokeWidth:z,strokeLinecap:"round",opacity:E})});case"line_vertical":return e.jsx("svg",{width:"100%",height:"100%",preserveAspectRatio:"none",style:$,children:e.jsx("line",{x1:"50%",y1:"0",x2:"50%",y2:"100%",stroke:T,strokeWidth:z,strokeLinecap:"round",opacity:E})});case"line_diagonal":return e.jsx("svg",{width:"100%",height:"100%",preserveAspectRatio:"none",style:$,children:e.jsx("line",{x1:"0",y1:"100%",x2:"100%",y2:"0",stroke:T,strokeWidth:z,strokeLinecap:"round",opacity:E})});case"arrow_right":return e.jsxs("svg",{width:"100%",height:"100%",viewBox:"0 0 100 50",preserveAspectRatio:"none",style:$,children:[e.jsx("line",{x1:"0",y1:"25",x2:"85",y2:"25",stroke:T,strokeWidth:z,opacity:E}),e.jsx("polygon",{points:"100,25 80,10 80,40",fill:T,opacity:E})]});case"arrow_up":return e.jsxs("svg",{width:"100%",height:"100%",viewBox:"0 0 50 100",preserveAspectRatio:"none",style:$,children:[e.jsx("line",{x1:"25",y1:"100",x2:"25",y2:"20",stroke:T,strokeWidth:z,opacity:E}),e.jsx("polygon",{points:"25,0 10,20 40,20",fill:T,opacity:E})]});case"corner":return e.jsx("svg",{width:"100%",height:"100%",viewBox:"0 0 100 100",preserveAspectRatio:"none",style:$,children:e.jsx("polyline",{points:"5,5 5,95 95,95",fill:"none",stroke:T,strokeWidth:z,strokeLinecap:"round",strokeLinejoin:"round",opacity:E})});case"freeform":case"rectangle":case"square":default:return e.jsxs("svg",{width:"100%",height:"100%",preserveAspectRatio:"none",className:q,style:$,children:[se,e.jsx("rect",{x:"2%",y:"2%",width:"96%",height:"96%",rx:"4",fill:te,stroke:L.stroke,strokeWidth:L.strokeWidth,opacity:E})]})}},Y=()=>{let L={transform:`rotate(${_}deg)`};return x==="isometric"&&!n&&(L={...L,transformStyle:"preserve-3d",transform:`rotate(${_}deg) perspective(500px) rotateX(15deg) rotateY(-15deg)`}),x==="neon"&&(L={...L,filter:`drop-shadow(0 0 10px ${m}80)`}),L},me=f||j;return e.jsxs(e.Fragment,{children:[!me&&e.jsxs(e.Fragment,{children:[e.jsx(ps,{position:"top-left",variant:gs.Handle,minWidth:30,minHeight:20,onResize:B,style:{width:10,height:10,background:"hsl(var(--primary))",border:"2px solid hsl(var(--background))",borderRadius:"50%"}}),e.jsx(ps,{position:"top-right",variant:gs.Handle,minWidth:30,minHeight:20,onResize:B,style:{width:10,height:10,background:"hsl(var(--primary))",border:"2px solid hsl(var(--background))",borderRadius:"50%"}}),e.jsx(ps,{position:"bottom-left",variant:gs.Handle,minWidth:30,minHeight:20,onResize:B,style:{width:10,height:10,background:"hsl(var(--primary))",border:"2px solid hsl(var(--background))",borderRadius:"50%"}}),e.jsx(ps,{position:"bottom-right",variant:gs.Handle,minWidth:30,minHeight:20,onResize:B,style:{width:10,height:10,background:"hsl(var(--primary))",border:"2px solid hsl(var(--background))",borderRadius:"50%"}})]}),!me&&c&&!n&&e.jsx("div",{onMouseDown:D,className:"absolute -top-8 left-1/2 -translate-x-1/2 cursor-grab active:cursor-grabbing z-50",style:{touchAction:"none"},children:e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("div",{className:"w-5 h-5 rounded-full bg-primary border-2 border-background shadow-lg flex items-center justify-center hover:scale-110 transition-transform",children:e.jsx(bn,{className:"w-3 h-3 text-primary-foreground"})}),e.jsx("div",{className:"w-0.5 h-3 bg-primary/50"})]})}),e.jsxs("div",{ref:b,className:`w-full h-full relative ${c&&!j?"ring-2 ring-primary ring-offset-1 ring-offset-background rounded":""} ${me?"pointer-events-none":""} ${w()}`,style:Y(),children:[oe(),h&&!n&&e.jsx("div",{className:"absolute -bottom-5 left-0 right-0 text-center pointer-events-none",children:e.jsx("span",{className:`text-[10px] px-1 rounded bg-background/80 text-muted-foreground ${x==="neon"?"text-white":""}`,children:C})})]})]})};function Vo(s,u){if(!s.startsWith("#"))return s;const c=s.replace("#",""),l=parseInt(c,16),p=Math.max(0,Math.min(255,(l>>16)+u)),o=Math.max(0,Math.min(255,(l>>8&255)+u)),k=Math.max(0,Math.min(255,(l&255)+u));return`#${(1<<24|p<<16|o<<8|k).toString(16).slice(1)}`}const Go=i.memo(Ho),et=[{name:"Amarillo",bg:"#fef3c7",border:"#f59e0b"},{name:"Rosa",bg:"#fce7f3",border:"#ec4899"},{name:"Azul",bg:"#dbeafe",border:"#3b82f6"},{name:"Verde",bg:"#d1fae5",border:"#10b981"},{name:"Morado",bg:"#ede9fe",border:"#8b5cf6"}],Uo=({id:s,data:u,selected:c})=>{const l=u,{updateNodeData:p}=es(),[o,k]=i.useState(!1),m=l._isLocked===!0,T=et.find(h=>h.bg===l.color)||et[0],z=l.resolved===!0,E=h=>{p(s,{content:h.target.value})},_=h=>{p(s,{label:h.target.value})};return e.jsxs("div",{className:`
8        min-w-[180px] max-w-[280px] rounded-lg shadow-lg transition-all
9        ${c&&!m?"ring-2 ring-primary ring-offset-2":""}
10        ${z?"opacity-60":""}
11        ${m?"pointer-events-none":""}
12      `,style:{backgroundColor:T.bg,borderLeft:`4px solid ${T.border}`},children:[e.jsxs("div",{className:"px-3 py-2 border-b flex items-center gap-2",style:{borderColor:`${T.border}30`},children:[e.jsx(na,{className:"h-4 w-4",style:{color:T.border}}),o&&!m?e.jsx("input",{type:"text",value:l.label||"",onChange:_,onBlur:()=>k(!1),autoFocus:!0,className:"flex-1 bg-transparent border-none outline-none text-sm font-medium",placeholder:"Título de la nota"}):e.jsx("span",{className:"flex-1 text-sm font-medium cursor-text truncate",onDoubleClick:()=>!m&&k(!0),style:{color:T.border},children:l.label||"Nota"})]}),e.jsx("div",{className:"p-3",children:e.jsx("textarea",{value:l.content||"",onChange:E,disabled:m,placeholder:"Escribe tu nota aquí...",className:"w-full min-h-[60
12px] bg-transparent border-none outline-none text-sm resize-none text-foreground",style:{fontFamily:"'Caveat', cursive, sans-serif",fontSize:"15px"}})}),(l.author||l.createdAt)&&e.jsxs("div",{className:"px-3 py-1.5 border-t flex items-center gap-3 text-[10px] text-muted-foreground",style:{borderColor:`${T.border}30`},children:[l.author&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Xs,{className:"h-3 w-3"}),l.author]}),l.createdAt&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ct,{className:"h-3 w-3"}),l.createdAt]})]}),z&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:e.jsx("div",{className:"text-lg font-bold rotate-[-20deg] px-2 py-1 rounded",style:{color:T.border,backgroundColor:`${T.border}20`},children:"RESUELTO"})})]})},Yo=i.memo(Uo),Xo={textFlow:Eo,network:_o,server:$o,heatMap:Io,electrical:Lo,sound:Bo,networkPoint:Wo,shape:Go,stickyNote:Yo},ke={textFlow:{labels:Lt,colors:Ft,icons:Rt},network:{labels:qt,colors:Ot,icons:Bt},server:{labels:Ht,colors:Vt,icons:Wt},heatMap:{labels:Ut,colors:Yt,icons:Gt},electrical:{labels:Zt,colors:Kt,icons:Xt},sound:{labels:Qt,colors:er,icons:Jt},networkPoint:{labels:ar,colors:tr,icons:sr},shape:{labels:ge,colors:as,icons:ss}},Zo=["#374151","#000000","#3b82f6","#8b5cf6","#10b981","#ef4444","#f59e0b","#ec4899"],Ko=({onDeleteSelected:s,onDuplicateSelected:u,onGroupSelected:c,onUndo:l,onRedo:p,onZoomIn:o,onZoomOut:k,onFitView:m,onSave:T,onExport:z,onImport:E,onExportPNG:_,onExportPDF:h,onToggleLock:C,onToggleGrid:f,onToggleMinimap:j,onToggleDrawingLine:v,onTogglePresentationMode:x,onToggleLayers:n,onToggleSearch:N,onToggleRulers:a,onToggleBackgroun
12dImage:M,onShowKeyboardShortcuts:b,onAddStickyNote:D,onAlignNodes:w,onDistributeNodes:B,onAddQuickShape:R,isLocked:$,showGrid:q,showMinimap:oe,showLayers:Y,showRulers:me,showBackgroundImage:L,isPresentationMode:H,canUndo:se,canRedo:te,hasSelection:he,canGroup:je,canAlign:le,canDistribute:Le,isDrawingLine:re,drawingLineColor:fe,drawingLineWidth:Me,onDrawingLineColorChange:ts,onDrawingLineWidthChange:ye,hasBackgroundImage:Fe})=>e.jsx(ce,{position:"top-left",className:"flex flex-col gap-2",children:e.jsxs(Fn,{delayDuration:300,children:[e.jsxs("div",{className:"flex gap-1 bg-card/95 p-2 rounded-lg shadow-lg border border-border",children:[e.jsxs(J,{children:[e.jsx(Q,{asChild:!0,children:e.jsx(S,{size:"sm",variant:"ghost",onClick:l,disabled:!se||$,className:"h-8 w-8 p-0",children:e.jsx(pt,{className:"h-4 w-4"})})}),e.jsx(ee,{side:"right",children:e.jsx("p",{children:"Deshacer (Ctrl+Z)"})})]}),e.jsxs(J,{children:[e.jsx(Q,{asChild:!0,children:e.jsx(S,{size:"sm",variant:"ghost",onClick:p,disabled:!te||$,className:"h-8 w-8 p-0",children:e.jsx(gt,{className:"h-4 w-4"})})}),e.jsx(ee,{side:"right",children:e.jsx("p",{children:"Rehacer (Ctrl+Y)"})})]}),e.jsx("div",{className:"w-px bg-border mx-1"}),e.jsxs(J,{children:[e.jsx(Q,{asChild:!0,children:e.jsx(S,{size:"sm",variant:"ghost",onClick:u,disabled:!he||$,className:"h-8 w-8 p-0",children:e.jsx(Ie,{className:"h-4 w-4"})})}),e.jsx(ee,{side:"right",children:e.jsx("p",{children:"Duplicar (Ctrl+D)"})})]}),e.jsxs(J,{children:[e.jsx(Q,{asChild:!0,children:e.jsx(S,{size:"sm",variant:"ghost",onClick:c,disabled:!je||$,className:"h-8 w-8 p-0",children:e.jsx(oa,{className:"h-4 w-4"})})}),e.jsx(ee,{side:"right",children:e.jsx("p",{children:"Agrupar (Ctrl+G)"})})]}),e.jsxs(He,{children:[e.jsxs(J,{children:[e.jsx(Q,{asChild:!0,children:e.jsx(Ve,{asChild:!0,children:e.jsx(S,{size:"sm",variant:"ghost",disabled:!le||$,className:"h-8 w-8 p-0",children:e.jsx(jn,{className:"h-4 w-4"})})})}),e.jsx(ee,{side:"right",children:e.jsx("p",{children:"Alinear"})})]}),e.jsxs(Ge,{align:"start",className:"w-40",children:[e.jsxs(ae,{onClick:()=>w("left"),children:[e.jsx(fn,{className:"h-4 w-4 mr-2"}),"Izquierda"]}),e.jsxs(ae,{onClick:()=>w("centerH"),children:[e.jsx(yn,{className:"h-4 w-4 mr-2"}),"Centro H"]}),e.jsxs(ae,{onClick:()=>w("right"),children:[e.jsx(Nn,{className:"h-4 w-4 mr-2"}),"Derecha"]}),e.jsxs(ae,{onClick:()=>w("top"),children:[e.jsx(bt,{className:"h-4 w-4 mr-2"}),"Arriba"]}),e.jsxs(ae,{onClick:()=>w("centerV"),children:[e.jsx(wn,{className:"h-4 w-4 mr-2"}),"Centro V"]}),e.jsxs(ae,{onClick:()=>w("bottom"),children:[e.jsx(jt,{className:"h-4 w-4 mr-2"}),"Abajo"]})]})]}),e.jsxs(He,{children:[e.jsxs(J,{children:[e.jsx(Q,{asChild:!0,children:e.jsx(Ve,{asChild:!0,children:e.jsx(S,{size:"sm",variant:"ghost",disabled:!Le||$,className:"h-8 w-8 p-0",children:e.jsx(Ra,{className:"h-4 w-4"})})})}),e.jsx(ee,{side:"right",children:e.jsx("p",{children:"Distribuir"})})]}),e.jsxs(Ge,{align:"start",className:"w-44",children:[e.jsxs(ae,{onClick:()=>B("horizontal"),children:[e.jsx(Ra,{className:"h-4 w-4 mr-2"}),"Horizontal"]}),e.jsxs(ae,{onClick:()=>B("vertical"),children:[e.jsx(vn,{className:"h-4 w-4 mr-2"}),"Vertical"]})]})]}),e.jsxs(J,{children:[e.jsx(Q,{asChild:!0,children:e.jsx(S,{size:"sm",variant:"ghost",onClick:s,disabled:!he||$,className:"h-8 w-8 p-0 text-destructive hover:text-destructive",children:e.jsx(ze,{className:"h-4 w-4"})})}),e.jsx(ee,{side:"right",children:e.jsx("p",{children:"Eliminar (Delete)"})})]})]}),e.jsxs("div",{className:"flex gap-1 bg-card/95 p-2 rounded-lg shadow-lg border border-border",children:[e.jsxs(uo,{children:[e.jsx(xo,{asChild:!0,children:e.jsxs(S,{size:"sm",variant:re?"default":"ghost",onClick:v,disabled:$,className:"h-8 gap-1.5",children:[e.jsx(ft,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs",children:"Dibujar"})]})}),e.jsx(po,{side:"bottom",align:"start",className:"w-56",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx(I,{className:"text-xs",children:"Color de línea"}),e.jsx("div",{className:"flex gap-1 flex-wrap mt-1",children:Zo.map(pe=>e.jsx("button",{onClick:()=>ts(pe),className:`w-6 h-6 rounded-full border-2 transition-transform hover:scale-110 ${fe===pe?"border-foreground scale-110":"border-transparent"}`,style:{backgroundColor:pe}},pe))})]}),e.jsxs("div",{children:[e.jsxs(I,{className:"text-xs",children:["Grosor: ",Me,"px"]}),e.jsx(ve,{value:[Me],onValueChange:([pe])=>ye(pe),min:1,max:12,step:1,className:"mt-2"})]})]})})]}),e.jsxs(He,{children:[e.jsxs(J,{children:[e.jsx(Q,{asChild:!0,children:e.jsx(Ve,{asChild:!0,children:e.jsx(S,{size:"sm",variant:"ghost",disabled:$,className:"h-8 w-8 p-0",children:e.jsx(ue,{className:"h-4 w-4"})})})}),e.jsx(ee,{side:"bottom",children:e.jsx("p",{children:"Formas rápidas"})})]}),e.jsxs(Ge,{align:"start",className:"w-40",children:[e.jsxs(ae,{onClick:()=>R("rectangle"),children:[e.jsx(ue,{className:"h-4 w-4 mr-2"}),"Rectángulo"]}),e.jsxs(ae,{onClick:()=>R("circle"),children:[e.jsx(Te,{className:"h-4 w-4 mr-2"}),"Círculo"]}),e.jsxs(ae,{onClick:()=>R("line_horizontal"),children:[e.jsx(Ye,{className:"h-4 w-4 mr-2"}),"Línea"]}),e.jsxs(ae,{onClick:()=>R("arrow_right"),children:[e.jsx(Fs,{className:"h-4 w-4 mr-2"}),"Flecha"]}),e.jsx(Oa,{}),e.jsxs(ae,{onClick:()=>R("text"),children:[e.jsx(La,{className:"h-4 w-4 mr-2"}),"Texto"]})]})]}),e.jsxs(J,{children:[e.jsx(Q,{asChild:!0,children:e.jsx(S,{size:"sm",variant:"ghost",onClick:D,disabled:$,className:"h-8 w-8 p-0",children:e.jsx(na,{className:"h-4 w-4"})})}),e.jsx(ee,{side:"bottom",children:e.jsx("p",{children:"Agregar nota"})})]}),e.jsxs(He,{children:[e.jsxs(J,{children:[e.jsx(Q,{asChild:!0,children:e.jsx(Ve,{asChild:!0,children:e.jsx(S,{size:"sm",variant:"ghost",disabled:$,className:"h-8 w-8 p-0",children:e.jsx(ue,{className:"h-4 w-4"})})})}),e.jsx(ee,{side:"bottom",children:e.jsx("p",{children:"Formas rápidas"})})]}),e.jsxs(Ge,{align:"start",className:"w-40",children:[e.jsxs(ae,{onClick:()=>R("rectangle"),children:[e.jsx(ue,{className:"h-4 w-4 mr-2"}),"Rectángulo"]}),e.jsxs(ae,{onClick:()=>R("circle"),children:[e.jsx(Te,{className:"h-4 w-4 mr-2"}),"Círculo"]}),e.jsxs(ae,{onClick:()=>R("line_horizontal"),children:[e.jsx(Ye,{className:"h-4 w-4 mr-2"}),"Línea"]}),e.jsxs(ae,{onClick:()=>R("arrow_right"),children:[e.jsx(Fs,{className:"h-4 w-4 mr-2"}),"Flecha"]}),e.jsx(Oa,{}),e.jsxs(ae,{onClick:()=>R("text"),children:[e.jsx(La,{className:"h-4 w-4 mr-2"}),"Texto"]})]})]})]}),e.jsxs("div",{className:"flex gap-1 bg-card/95 p-2 rounded-lg shadow-lg border border-border",children:[e.jsxs(J,{children:[e.jsx(Q,{asChild:!0,children:e.jsx(S,{size:"sm",variant:"ghost",onClick:o,className:"h-8 w-8 p-0",children:e.jsx(Je,{className:"h-4 w-4"})})}),e.jsx(ee,{side:"right",children:e.jsx("p",{children:"Acercar"})})]}),e.jsxs(J,{children:[e.jsx(Q,{asChild:!0,children:e.jsx(S,{size:"sm",variant:"ghost",onClick:k,className:"h-8 w-8 p-0",children:e.jsx(Qe,{className:"h-4 w-4"})})}),e.jsx(ee,{side:"right",children:e.jsx("p",{children:"Alejar"})})]}),e.jsxs(J,{children:[e.jsx(Q,{asChild:!0,children:e.jsx(S,{size:"sm",variant:"ghost",onClick:m,className:"h-8 w-8 p-0",children:e.jsx(bs,{className:"h-4 w-4"})})}),e.jsx(ee,{side:"right",children:e.jsx("p",{children:"Ajustar vista"})})]}),e.jsx("div",{className:"w-px bg-border mx-1"}),e.jsxs(J,{children:[e.jsx(Q,{asChild:!0,children:e.jsx(S,{size:"sm",variant:q?"secondary":"ghost",onClick:f,className:"h-8 w-8 p-0",children:e.jsx(aa,{className:"h-4 w-4"})})}),e.jsx(ee,{side:"right",children:e.jsx("p",{children:"Cuadrícula"})})]}),e.jsxs(J,{children:[e.jsx(Q,{asChild:!0,children:e.jsx(S,{size:"sm",variant:oe?"secondary":"ghost",onClick:j,className:"h-8 w-8 p-0",children:e.jsx(de,{className:"h-4 w-4"})})}),e.jsx(ee,{side:"right",children:e.jsx("p",{children:"Minimapa"})})]}),e.jsx("div",{className:"w-px bg-border mx-1"}),e.jsxs(J,{children:[e.jsx(Q,{asChild:!0,children:e.jsx(S,{size:"sm",variant:Y?"secondary":"ghost",onClick:n,className:"h-8 w-8 p-0",children:e.jsx(de,{className:"h-4 w-4"})})}),e.jsx(ee,{side:"right",children:e.jsx("p",{children:"Panel de capas"})})]}),e.jsxs(J,{children:[e.jsx(Q,{asChild:!0,children:e.jsx(S,{size:"sm",variant:"ghost",onClick:N,className:"h-8 w-8 p-0",children:e.jsx(vs,{className:"h-4 w-4"})})}),e.jsx(ee,{side:"right",children:e.jsx("p",{children:"Buscar nodos (Ctrl+F)"})})]}),e.jsxs(J,{children:[e.jsx(Q,{asChild:!0,children:e.jsx(S,{size:"sm",variant:me?"secondary":"ghost",onClick:a,className:"h-8 w-8 p-0",children:e.jsx(xt,{className:"h-4 w-4"})})}),e.jsx(ee,{side:"right",children:e.jsx("p",{children:"Reglas y medidas"})})]}),e.jsxs(J,{children:[e.jsx(Q,{asChild:!0,children:e.jsx(S,{size:"sm",variant:L||Fe?"secondary":"ghost",onClick:M,className:"h-8 w-8 p-0",children:e.jsx(Bs,{className:"h-4 w-4"})})}),e.jsx(ee,{side:"right",children:e.jsx("p",{children:"Imagen de fondo"})})]}),e.jsxs(J,{children:[e.jsx(Q,{asChild:!0,children:e.jsx(S,{size:"sm",variant:"ghost",onClick:b,className:"h-8 w-8 p-0",children:e.jsx(yt,{className:"h-4 w-4"})})}),e.jsx(ee,{side:"right",children:e.jsx("p",{children:"Atajos de teclado (?)"})})]})]}),e.jsxs("div",{className:"flex gap-1 bg-card/95 p-2 rounded-lg shadow-lg border border-border",children:[e.jsxs(J,{children:[e.jsx(Q,{asChild:!0,children:e.jsx(S,{size:"sm",variant:$?"secondary":"ghost",onClick:C,className:"h-8 w-8 p-0",children:$?e.jsx(be,{className:"h-4 w-4"}):e.jsx(Ee,{className:"h-4 w-4"})})}),e.jsx(ee,{side:"right",children:e.jsx("p",{children:$?"Desbloquear":"Bloquear"})})]}),e.jsxs(J,{children:[e.jsx(Q,{asChild:!0,children:e.jsx(S,{size:"sm",variant:H?"default":"ghost",onClick:x,className:"h-8 w-8 p-0",children:e.jsx(kn,{className:"h-4 w-4"})})}),e.jsx(ee,{side:"right",children:e.jsx("p",{children:"Modo presentación"})})]}),e.jsx("div",{className:"w-px bg-border mx-1"}),e.jsxs(J,{children:[e.jsx(Q,{asChild:!0,children:e.jsx(S,{size:"sm",variant:"ghost",onClick:T,disabled:$,className:"h-8 w-8 p-0",children:e.jsx(la,{className:"h-4 w-4"})})}),e.jsx(ee,{side:"right",children:e.jsx("p",{children:"Guardar"})})]}),e.jsx("div",{className:"w-px bg-border mx-1"}),e.jsxs(J,{children:[e.jsx(Q,{asChild:!0,children:e.jsx(S,{size:"sm",variant:"ghost",onClick:z,className:"h-8 w-8 p-0",children:e.jsx(Nt,{className:"h-4 w-4"})})}),e.jsx(ee,{side:"right",children:e.jsx("p",{children:"Exportar JSON"})})]}),e.jsxs(J,{children:[e.jsx(Q,{asChild:!0,children:e.jsx(S,{size:"sm",variant:"ghost",onClick:E,disabled:$,className:"h-8 w-8 p-0",children:e.jsx(ia,{className:"h-4 w-4"})})}),e.jsx(ee,{side:"right",children:e.jsx("p",{children:"Importar JSON"})})]}),e.jsxs(He,{children:[e.jsxs(J,{children:[e.jsx(Q,{asChild:!0,children:e.jsx(Ve,{asChild:!0,children:e.jsx(S,{size:"sm",variant:"ghost",className:"h-8 w-8 p-0",children:e.jsx(Cn,{className:"h-4 w-4"})})})}),e.jsx(ee,{side:"right",children:e.jsx("p",{children:"Exportar imagen"})})]}),e.jsxs(Ge,{align:"end",className:"w-44",children:[e.jsxs(ae,{onClick:_,children:[e.jsx(Bs,{className:"h-4 w-4 mr-2"}),"Exportar PNG"]}),e.jsxs(ae,{onClick:h,children:[e.jsx(Ns,{className:"h-4 w-4 mr-2"}),"Exportar PDF"]})]})]})]})]})}),Jo=i.memo(Ko),Qo=({onDeleteSelected:s,onDuplicateSelected:u,onGroupSelected:c,onUndo:l,onRedo:p,onZoomIn:o,onZoomOut:k,onFitView:m,onSave:T,onExport:z,onImport:E,onExportPNG:_,onToggleLock:h,onToggleGrid:C,onToggleMinimap:f,onToggleDrawingLine:j,isLocked:v,showGrid:x,showMinimap:n,canUndo:N,canRedo:a,hasSelection:M,canGroup:b,isDrawingLine:D,isSaving:w=!1,hasUnsavedChanges:B=!1})=>{const[R,$]=i.useState(!1),q=({icon:oe,label:Y,onClick:me,disabled:L=!1,active:H=!1,destructive:se=!1})=>e.jsxs("button",{onClick:()=>{me(),$(!1)},disabled:L,className:`
13        flex flex-col items-center gap-1 p-3 rounded-lg transition-colors
14        ${L?"opacity-40 cursor-not-allowed":"active:scale-95"}
15        ${H?"bg-primary text-primary-foreground":"bg-muted/50 hover:bg-muted"}
16        ${se&&!L?"text-destructive":""}
17      `,children:[e.jsx(oe,{className:"h-5 w-5"}),e.jsx("span",{className:"text-[10px] font-medium",children:Y})]});return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"fixed bottom-0 left-0 right-0 bg-card/95 border-t border-border p-2 flex items-center justify-between gap-2 z-50 safe-area-pb",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(S,{size:"sm",variant:"ghost",onClick:l,disabled:!N,className:"h-10 w-10 p-0",children:e.jsx(pt,{className:"h-5 w-5"})}),e.jsx(S,{size:"sm",variant:"ghost",onClick:p,disabled:!a,className:"h-10 w-10 p-0",children:e.jsx(gt,{className:"h-5 w-5"})})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(S,{size:"sm",variant:D?"default":"ghost",onClick:j,className:"h-10 w-10 p-0",children:e.jsx(ft,{className:"h-5 w-5"})}),e.jsx(S,{size:"sm",variant:"ghost",onClick:m,className:"h-10 w-10 p-0",children:e.jsx(bs,{className:"h-5 w-5"})}),e.jsxs(S,{size:"sm",variant:B?"default":"ghost",onClick:T,disabled:v||w,className:"h-10 w-10 p-0 relative",children:[e.jsx(la,{className:`h-5 w-5 ${w?"animate-pulse":""}`}),B&&!w&&e.jsx("span",{className:"absolute -top-0.5 -right-0.5 w-2 h-2 bg-destructive rounded-full"})]})]}),e.jsxs(St,{open:R,onOpenChange:$,children:[e.jsx(Bn,{asChild:!0,children:e.jsx(S,{size:"sm",variant:"outline",className:"h-10 w-10 p-0",children:e.jsx(Sn,{className:"h-5 w-5"})})}),e.jsxs(Tt,{className:"max-h-[70vh]",children:[e.jsx(zt,{children:e.jsx(Et,{children:"Herramientas"})}),e.jsxs("div",{className:"p-4 space-y-4 overflow-y-auto",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Edición"}),e.jsxs("div",{className:"grid grid-cols-4 gap-2",children:[e.jsx(q,{icon:Ie,label:"Duplicar",onClick:u,disabled:!M||v}),e.jsx(q,{icon:oa,label:"Agrupar",onClick:c,disabled:!b||v}),e.jsx(q,{icon:ze,label:"Eliminar",onClick:s,disabled:!M||v,destructive:!0})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Vista"}),e.jsxs("div",{className:"grid grid-cols-4 gap-2",children:[e.jsx(q,{icon:Je,label:"Acercar",onClick:o}),e.jsx(q,{icon:Qe,label:"Alejar",onClick:k}),e.jsx(q,{icon:aa,label:"Grilla",onClick:C,active:x}),e.jsx(q,{icon:de,label:"Mapa",onClick:f,active:n})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Archivo"}),e.jsxs("div",{className:"grid grid-cols-4 gap-2",children:[e.jsx(q,{icon:v?be:Ee,label:v?"Bloqueado":"Bloquear",onClick:h,active:v}),e.jsx(q,{icon:Nt,label:"Exportar",onClick:z}),e.jsx(q,{icon:ia,label:"Importar",onClick:E,disabled:v}),e.jsx(q,{icon:Bs,label:"PNG",onClick:_})]})]})]})]})]})]})})},el=i.memo(Qo),As=["#3b82f6","#8b5cf6","#10b981","#ef4444","#f59e0b","#ec4899","#06b6d4","#84cc16","#64748b","#374151","#000000","#ffffff"],sl=["flat","isometric","minimal","schematic","neon","gradient","glass","outline"],al=({node:s,tipo:u,onUpdate:c,onClose:l,onSendToBack:p,onBringToFront:o,onToggleLock:k})=>{var x,n,N;const[m,T]=i.useState({});i.useEffect(()=>{s&&T({...s.data})},[s]);const z=(a,M)=>{const b={...m,[a]:M};T(b),c(s.id,b)};if(!s)return null;const E=s.type,_=E==="shape",h=m.subType||"default",C=m.locked===!0;let f,j,v;if(_)f=ss[h],j=ge[h]||"Forma",v=m.color||as[h]||"#64748b";
17else{const a=ke[E];f=(x=a==null?void 0:a.icons)==null?void 0:x[h],j=((n=a==null?void 0:a.labels)==null?void 0:n[h])||"Nodo",v=m.color||((N=a==null?void 0:a.colors)==null?void 0:N[h])||"#3b82f6"}return e.jsx(ce,{position:"top-right",className:"w-72",children:e.jsxs("div",{className:"bg-card/95 rounded-lg shadow-lg border",children:[e.jsxs("div",{className:"flex items-center justify-between p-3 border-b",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[f&&e.jsx("div",{className:"w-8 h-8 rounded flex items-center justify-center",style:{backgroundColor:`${v}20`,color:v},children:e.jsx(f,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-sm",children:j}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Configuración"})]})]}),e.jsx(S,{size:"sm",variant:"ghost",onClick:l,className:"h-6 w-6 p-0",children:e.jsx(Re,{className:"h-4 w-4"})})]}),e.jsx(xe,{className:"h-[350px]",children:e.jsxs("div",{className:"p-3 space-y-4",children:[_&&e.jsxs("div",{className:"flex gap-1",children:[p&&e.jsxs(S,{size:"sm",variant:"outline",onClick:()=>p(s.id),className:"flex-1 h-8 text-xs",children:[e.jsx(rt,{className:"h-3 w-3 mr-1"}),"Al fondo"]}),o&&e.jsxs(S,{size:"sm",variant:"outline",onClick:()=>
17o(s.id),className:"flex-1 h-8 text-xs",children:[e.jsx(Tn,{className:"h-3 w-3 mr-1"}),"Al frente"]}),k&&e.jsx(S,{size:"sm",variant:C?"secondary":"outline",onClick:()=>k(s.id),className:"h-8 w-8 p-0",title:C?"Desbloquear":"Bloquear",children:C?e.jsx(be,{className:"h-3 w-3"}):e.jsx(Ee,{className:"h-3 w-3"})})]}),e.jsxs("div",{children:[e.jsxs(I,{className:"text-xs flex items-center gap-1 mb-2",children:[e.jsx(wt,{className:"h-3 w-3"})," Modo de Vista"]}),e.jsx("div",{className:"grid grid-cols-4 gap-1",children:sl.map(a=>e.jsxs("button",{onClick:()=>z("viewMode",a),className:`flex flex-col items-center justify-center p-1.5 rounded border text-[10px] transition-all ${(m.viewMode||"flat")===a?"bg-primary text-primary-foreground border-primary":"bg-background border-border hover:bg-accent hover:border-primary/50"}`,title:Ka[a],children:[e.jsx("span",{className:"text-sm",children:wo[a]}),e.jsx("span",{className:"truncate w-full text-center",children:Ka[a].split(" ")[0]})]},a))})]}),e.jsxs("div",{children:[e.jsx(I,{className:"text-xs",children:"Etiqueta"}),e.jsx(V,{value:m.label||"",onChange:a=>z("label",a.target.value),placeholder:"Nombre del nodo",className:"h-8 text-sm"})]}),_&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{children:[e.jsx(I,{className:"text-xs",children:"Ancho"}),e.jsx(V,{type:"number",value:m.width||100,onChange:a=>z("width",Number(a.target.value)),className:"h-8 text-sm"})]}),e.jsxs("div",{children:[e.jsx(I,{className:"text-xs",children:"Alto"}),e.jsx(V,{type:"number",value:m.height||60,onChange:a=>z("height",Number(a.target.value)),className:"h-8 text-sm"})]})]}),e.jsxs("div",{children:[e.jsx(I,{className:"text-xs",children:"Grosor del borde"}),e.jsx(ve,{value:[m.strokeWidth||2],onValueChange:([a])=>z("strokeWidth",a),min:1,max:10,step:1,className:"mt-2"}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[m.strokeWidth||2,"px"]})]}),e.jsxs("div",{children:[e.jsx(I,{className:"text-xs",children:"Rotación"}),e.jsx(ve,{value:[m.rotation||0],onValueChange:([a])=>z("rotation",a),min:0,max:360,step:15,className:"mt-2"}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[m.rotation||0,"°"]})]}),e.jsxs("div",{children:[e.jsx(I,{className:"text-xs",children:"Opacidad"}),e.jsx(ve,{value:[(m.opacity??1)*100],onValueChange:([a])=>z("opacity",a/100),min:10,max:100,step:10,className:"mt-2"}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[Math.round((m.opacity??1)*100),"%"]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(I,{className:"text-xs",children:"Mostrar etiqueta"}),e.jsx(go,{checked:m.showLabel!==!1,onCheckedChange:a=>z("showLabel",a)})]}),e.jsxs("div",{children:[e.jsxs(I,{className:"text-xs flex items-center gap-1",children:[e.jsx(qs,{className:"h-3 w-3"})," Color de relleno"]}),e.jsx("div",{className:"flex gap-1 flex-wrap mt-1",children:As.map(a=>e.jsx("button",{onClick:()=>z("fillColor",a),className:`w-6 h-6 rounded-full border-2 transition-transform hover:scale-110 ${m.fillColor===a?"border-foreground scale-110":"border-transparent"}`,style:{backgroundColor:a}},`fill-${a}`))})]}),e.jsxs("div",{children:[e.jsx(I,{className:"text-xs",children:"Color del borde"}),e.jsx("div",{className:"flex gap-1 flex-wrap mt-1",children:As.map(a=>e.jsx("button",{onClick:()=>z("strokeColor",a),className:`w-6 h-6 rounded-full border-2 transition-transform hover:scale-110 ${m.strokeColor===a?"border-foreground scale-110":"border-transparent"}`,style:{backgroundColor:a}},`stroke-${a}`))})]})]}),E==="textFlow"&&e.jsxs("div",{children:[e.jsx(I,{className:"text-xs",children:"Descripción"}),e.jsx(At,{value:m.description||"",onChange:a=>z("description",a.target.value),placeholder:"Descripción",className:"text-sm min-h-[60px]"})]}),E==="network"&&e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{children:[e.jsx(I,{className:"text-xs",children:"IP"}),e.jsx(V,{value:m.ip||"",onChange:a=>z("ip",a.target.value),placeholder:"192.168.1.1",className:"h-8 text-sm font-mono"})]}),e.jsxs("div",{children:[e.jsx(I,{className:"text-xs",children:"MAC"}),e.jsx(V,{value:m.mac||"",onChange:a=>z("mac",a.target.value),placeholder:"AA:BB:CC",className:"h-8 text-sm font-mono"})]})]}),E==="server"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx(I,{className:"text-xs",children:"Especificaciones"}),e.jsx(V,{value:m.specs||"",onChange:a=>z("specs",a.target.value),placeholder:"16GB RAM, 8 Cores",className:"h-8 text-sm"})]}),e.jsxs("div",{children:[e.jsx(I,{className:"text-xs",children:"Estado"}),e.jsxs(Wa,{value:m.status||"online",onValueChange:a=>z("status",a),children:[e.jsx(Ha,{className:"h-8 text-sm",children:e.jsx(Va,{})}),e.jsxs(Ga,{children:[e.jsx(Ae,{value:"online",children:"En línea"}),e.jsx(Ae,{value:"offline",children:"Fuera de línea"}),e.jsx(Ae,{value:"warning",children:"Advertencia"})]})]})]})]}),E==="heatMap"&&e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{children:[e.jsx(I,{className:"text-xs",children:"Temperatura (°C)"}),e.jsx(V,{type:"number",value:m.temperature||"",onChange:a=>z("temperature",Number(a.target.value)),className:"h-8 text-sm"})]}),e.jsxs("div",{children:[e.jsx(I,{className:"text-xs",children:"Zona"}),e.jsx(V,{value:m.zone||"",onChange:a=>z("zone",a.target.value),className:"h-8 text-sm"})]})]}),E==="electrical"&&e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[e.jsxs("div",{children:[e.jsx(I,{className:"text-xs",children:"Voltaje"}),e.jsx(V,{value:m.voltage||"",onChange:a=>z("voltage",a.target.value),placeholder:"120",className:"h-8 text-sm"})]}),e.jsxs("div",{children:[e.jsx(I,{className:"text-xs",children:"Amperaje"}),e.jsx(V,{value:m.amperage||"",onChange:a=>z("amperage",a.target.value),placeholder:"15",className:"h-8 text-sm"})]}),e.jsxs("div",{children:[e.jsx(I,{className:"text-xs",children:"Circuito"}
17),e.jsx(V,{value:m.circuit||"",onChange:a=>z("circuit",a.target.value),placeholder:"A1",className:"h-8 text-sm"})]})]}),E==="sound"&&e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[e.jsxs("div",{children:[e.jsx(I,{className:"text-xs",children:"Potencia"}),e.jsx(V,{value:m.power||"",onChange:a=>z("power",a.target.value),placeholder:"100",className:"h-8 text-sm"})]}),e.jsxs("div",{children:[e.jsx(I,{className:"text-xs",children:"Impedancia"}),e.jsx(V,{value:m.impedance||"",onChange:a=>z("impedance",a.target.value),placeholder:"8",className:"h-8 text-sm"})]}),e.jsxs("div",{children:[e.jsx(I,{className:"text-xs",children:"Canal"}),e.jsx(V,{value:m.channel||"",onChange:a=>z("channel",a.target.value),placeholder:"L1",className:"h-8 text-sm"})]})]}),E==="networkPoint"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[e.jsxs("div",{children:[e.jsx(I,{className:"text-xs",children:"Puerto"}),e.jsx(V,{value:m.port||"",onChange:a=>z("port",a.target.value),placeholder:"01",className:"h-8 text-sm"})]}),e.jsxs("div",{children:[e.jsx(I,{className:"text-xs",children:"VLAN"}),e.jsx(V,{value:m.vlan||"",onChange:a=>z("vlan",a.target.value),placeholder:"10",className:"h-8 text-sm"})]}),e.jsxs("div",{children:[e.jsx(I,{className:"text-xs",children:"Velocidad"}),e.jsx(V,{value:m.speed||"",onChange:a=>z("speed",a.target.value),placeholder:"1Gbps",className:"h-8 text-sm"})]})]}),e.jsxs("div",{children:[e.jsx(I,{className:"text-xs",children:"Estado"}),e.jsxs(Wa,{value:m.status||"active",onValueChange:a=>z("status",a),children:[e.jsx(Ha,{className:"h-8 text-sm",children:e.jsx(Va,{})}),e.jsxs(Ga,{children:[e.jsx(Ae,{value:"active",children:"Activo"}),e.jsx(Ae,{value:"inactive",children:"Inactivo"}),e.jsx(Ae,{value:"reserved",children:"Reservado"})]})]})]})]}),e.jsxs("div",{className:"border-t pt-3 mt-2",children:[e.jsxs(I,{className:"text-xs flex items-center gap-1 mb-2",children:[e.jsx(vt,{className:"h-3 w-3"})," Vincular a recurso"]}
17),e.jsxs("div",{className:"space-y-2",children:[e.jsx(V,{value:m.externalUrl||"",onChange:a=>z("externalUrl",a.target.value),placeholder:"https://ejemplo.com o ruta interna",className:"h-8 text-sm"}),m.externalUrl&&e.jsxs("a",{href:m.externalUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-xs text-primary hover:underline",children:[e.jsx(zn,{className:"h-3 w-3"}),"Abrir enlace"]})]})]}),!_&&e.jsxs("div",{children:[e.jsxs(I,{className:"text-xs flex items-center gap-1",children:[e.jsx(qs,{className:"h-3 w-3"})," Color"]}),e.jsx("div",{className:"flex gap-1 flex-wrap mt-1",children:As.slice(0,8).map(a=>e.jsx("button",{onClick:()=>z("color",a),className:`w-6 h-6 rounded-full border-2 transition-transform hover:scale-110 ${m.color===a?"border-foreground scale-110":"border-transparent"}`,style:{backgroundColor:a}},a))})]})]})})]})})},tl=i.memo(al),rr={solid:{label:"Sólida",strokeDasharray:void 0,strokeWidth:2},dashed:{label:"Punteada",strokeDasharray:"5 5",strokeWidth:2},dotted:{label:"Puntos",strokeDasharray:"2 2",strokeWidth:2},thick:{label:"Gruesa",strokeDasharray:void 0,strokeWidth:4},thickDashed:{label:"Gruesa Punteada",strokeDasharray:"8 4",strokeWidth:4},thin:{label:"Delgada",strokeDasharray:void 0,strokeWidth:1},double:{label:"Doble",strokeDasharray:void 0,strokeWidth:3}},ca={default:{label:"Por defecto",color:"#64748b"},blue:{label:"Azul",color:"#3b82f6"},green:{label:"Verde",color:"#10b981"},red:{label:"Rojo",color:"#ef4444"},yellow:{label:"Amarillo",color:"#f59e0b"},purple:{label:"Morado",color:"#8b5cf6"},pink:{label:"Rosa",color:"#ec4899"},orange:{label:"Naranja",color:"#f97316"},cyan:{label:"Cian",color:"#06b6d4"},black:{label:"Negro",color:"#000000"},white:{label:"Blanco",color:"#ffffff"}},da={none:{label:"Sin flecha",markerEnd:void 0,markerStart:void 0},arrowEnd:{label:"Flecha al final",markerEnd:{type:Ue.ArrowClosed},markerStart:void 0},arrowStart:{label:"Flecha al inicio",markerEnd:void 0,markerStart:{type:Ue.ArrowClosed}},arrowBoth:{label:"Flechas ambos",markerEnd:{type:Ue.ArrowClosed},markerStart:{type:Ue.ArrowClosed}},arrowOpenEnd:{label:"Flecha abierta final",markerEnd:{type:Ue.Arrow},markerStart:void 0}},nr={straight:{label:"Recta"},smoothstep:{label:"Suave"},step:{label:"Escalonada"},bezier:{label:"Curva"}},fs={none:{label:"Sin animación",description:"Línea estática"},flow:{label:"Flujo →",description:"Movimiento hacia adelante"},flowReverse:{label:"Flujo ←",description:"Movimiento hacia atrás"},pulse:{label:"Pulso",description:"Efecto de latido"},dash:{label:"Guiones",description:"Guiones en movimiento"},dots:{label:"Puntos",description:"Puntos fluyendo"},glow:{label:"Brillo",description:"Resplandor pulsante"},rainbow:{label:"Arcoíris",description:"Cambio de colores"},electricity:{label:"Electricidad",description:"Efecto eléctrico"},wave:{label:"Onda",description:"Ondulación continua"},snake:{label:"Serpiente",description:"Movimiento serpentino"}},rl=s=>{const u=(s==null?void 0:s.styleType)||"solid",c=(s==null?void 0:s.colorType)||"default",l=rr[u];return{stroke:ca[c].color,strokeWidth:l.strokeWidth,strokeDasharray:l.strokeDasharray}},nl=s=>{switch(s){case"flow":return"edge-flow";case"flowReverse":return"edge-flow-reverse";case"pulse":return"edge-pulse";case"dash":return"edge-dash";case"dots":return"edge-dots";case"glow":return"edge-glow";case"rainbow":return"edge-rainbow";case"electricity":return"edge-electricity";case"wave":return"edge-wave";case"snake":return"edge-snake";default:return""}},ol=s=>{const u=(s==null?void 0:s.markerType)||"arrowEnd";return da[u]},ll=({edge:s,onUpdate:u,onClose:c,onDelete:l})=>{var _;const p=s.data||{},o=h=>{u(s.id,{...p,styleType:h})},k=h=>{u(s.id,{...p,colorType:h})},m=h=>{u(s.id,{...p,markerType:h})},T=h=>{u(s.id,p,h)},z=h=>{u(s.id,{...p,label:h})},E=h=>{u(s.id,{...p,animationType:h})};return e.jsx(ce,{position:"top-right",className:"w-80",children:e.jsxs("div",{className:"bg-card/95 p-4 rounded-lg shadow-lg border",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"font-semibold text-sm",children:"Configurar Conexión"}),e.jsx(S,{size:"sm",variant:"ghost",onClick:c,className:"h-6 w-6 p-0",children:e.jsx(Re,{className:"h-4 w-4"})})]}),e.jsx(xe,{className:"h-[450px] pr-3",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(I,{className:"text-xs mb-1.5 block",children:"Etiqueta de la conexión"}),e.jsx(V,{value:p.label||"",onChange:h=>z(h.target.value),onKeyDownCapture:h=>h.stopPropagation(),placeholder:"Escribe el nombre aquí...",className:"h-9 text-sm bg-background border-input"}),p.label&&e.jsxs("p",{className:"text-[10px] text-muted-foreground mt-1",children:['✓ Etiqueta: "',String(p.label),'"']}
17)]}),e.jsxs("div",{children:[e.jsx(I,{className:"text-xs mb-2 block",children:"Tipo de línea"}),e.jsx("div",{className:"grid grid-cols-2 gap-1.5",children:Object.entries(nr).map(([h,{label:C}])=>e.jsx(S,{size:"sm",variant:(s.type||"smoothstep")===h?"default":"outline",onClick:()=>T(h),className:"h-8 text-xs",children:C},h))})]}),e.jsxs("div",{children:[e.jsx(I,{className:"text-xs mb-2 block",children:"Estilo de línea"}),e.jsx("div",{className:"grid grid-cols-2 gap-1.5",children:Object.entries(rr).map(([h,{label:C}])=>e.jsx(S,{size:"sm",variant:(p.styleType||"solid")===h?"default":"outline",onClick:()=>o(h),className:"h-8 text-xs",children:C},h))})]}),e.jsxs("div",{children:[e.jsx(I,{className:"text-xs mb-2 block",children:"Color"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:Object.entries(ca).map(([h,{label:C,color:f}])=>e.jsx("button",{onClick:()=>k(h),title:C,className:`w-7 h-7 rounded-full border-2 transition-all hover:scale-110 ${(p.colorType||"default")===h?"border-foreground scale-110 ring-2 ring-primary/50":"border-muted"}`,style:{backgroundColor:f}},h))})]}),e.jsxs("div",{children:[e.jsx(I,{className:"text-xs mb-2 block",children:"Flechas / Marcadores"}),e.jsx("div",{className:"grid grid-cols-1 gap-1.5",children:Object.entries(da).map(([h,{label:C}])=>e.jsx(S,{size:"sm",variant:(p.markerType||"arrowEnd")===h?"default":"outline",onClick:()=>m(h),className:"h-8 text-xs justify-start",children:C},h))})]}),e.jsxs("div",{children:[e.jsx(I,{className:"text-xs mb-2 block",children:"Animación de línea"}),e.jsx("div",{className:"grid grid-cols-2 gap-1.5",children:Object.entries(fs).map(([h,{label:C,description:f}])=>e.jsx(S,{size:"sm",variant:(p.animationType||"none")===h?"default":"outline",onClick:()=>E(h),className:"h-8 text-xs",title:f,children:C},h))}),p.animationType&&p.animationType!=="none"&&e.jsxs("p",{className:"text-[10px] text-primary mt-1.5",children:["✨ Animación activa: ",(_=fs[p.animationType])==null?void 0:_.label]})]}),e.jsx(S,{variant:"destructive",size:"sm",onClick:l,className:"w-full mt-4",children:"Eliminar Conexión"})]})})]})})},il=i.memo(ll),cl={flujo_texto:{nodeType:"textFlow",label:"Flujo"},red:{nodeType:"network",label:"Red"},servidor:{nodeType:"server",label:"Servidor"},mapa_calor:{nodeType:"heatMap",label:"Calor"},instalacion_electrica:{nodeType:"electrical",label:"Eléctrico"},instalacion_sonido:{nodeType:"sound",label:"Sonido"},puntos_red:{nodeType:"networkPoint",label:"Puntos"}},st=[{type:"pulse",label:"Pulso",description:"Efecto de latido suave",icon:"💓"},{type:"bounce",label:"Rebote",description:"Saltar arriba y abajo",icon:"⬆️"},{type:"shake",label:"Vibrar",description:"Movimiento lateral rápido",icon:"📳"},{type:"spin",label:"Girar",description:"Rotación continua 360°",icon:"🔄"},{type:"ping",label:"Ping",description:"Onda expansiva",icon:"📡"},{type:"glow",label:"Brillo",description:"Resplandor pulsante",icon:"✨"},{type:"float",label:"Flotar",description:"Movimiento suave arriba/abajo",icon:"🎈"},{type:"wiggle",label:"Meneo",description:"Balanceo de lado a lado",icon:"〰️"},{type:"heartbeat",label:"Latido",description:"Como un corazón",icon:"❤️"},{type:"flash",label:"Destello",description:"Parpadeo de opacidad",icon:"⚡"},{type:"rubber",label:"Elástico",description:"Efecto de goma",icon:"🎯"},{type:"swing",label:"Columpio",description:"Balanceo desde arriba",icon:"🎪"},{type:"tada",label:"Tada",description:"Presentación con giro",icon:"🎉"},{type:"jello",label:"Gelatina",description:"Efecto gelatinoso",icon:"🍮"},{type:"pop",label:"Pop",description:"Aparición con escala",icon:"💥"},{type:"none",label:"Quitar",description:"Sin animación",icon:"⏹️"}],dl=({tipo:s,isLocked:u,onAddNode:c,selectedNodeIds:l=[],onApplyAnimation:p})=>{const[o,k]=i.useState(null),[m,T]=i.useState(""),z=Mt(),{nodeType:E,label:_}=cl[s]||{nodeType:"textFlow",label:"Nodos"},h=ke[E],C=i.useMemo(()=>h?Object.keys(h.labels):[],[h]),f=i.useMemo(()=>Object.keys(ge),[]),j=i.useMemo(()=>{const b=m.toLowerCase().trim();return o==="nodes"?C.filter(D=>{var B;const w=(B=h==null?void 0:h.labels)==null?void 0:B[D];return!b||(w==null?void 0:w.toLowerCase().includes(b))}):o==="shapes"?f.filter(D=>{const w=ge[D];return!b||(w==null?void 0:w.toLowerCase().includes(b))}):o==="animations"?st.filter(D=>!b||D.label.toLowerCase().includes(b)||D.description.toLowerCase().includes(b)):[]},[o,m,C,f,h]),v=l.length>0,x=(b,D,w,B)=>{u||(b.dataTransfer.setData("application/reactflow/type",D),b.dataTransfer.setData("application/reactflow/subtype",w),B&&b.dataTransfer.setData("application/reactflow/extra",JSON.stringify(B)),b.dataTransfer.effectAllowed="move",k(null))},n=({icon:b,label:D,color:w,nodeType:B,subType:R,description:$,extraData:q})=>{const oe=b;return e.jsxs("div",{draggable:!u,onDragStart:Y=>x(Y,B,R,q),onClick:()=>{u||(c(B,R,q),k(null))},role:"button",tabIndex:0,onKeyDown:Y=>{(Y.key==="Enter"||Y.key===" ")&&(Y.preventDefault(),u||(c(B,R,q),k(null)))},className:"flex items-center gap-3 px-3 py-2.5 rounded-lg border transition-all select-none group "+(u?"opacity-50 cursor-not-allowed bg-muted/30":"cursor-grab active:cursor-grabbing hover:bg-accent hover:border-primary/50 active:scale-[0.98] bg-background/50"),title:$||`Clic o arrastra para agregar: ${D}`,children:[e.jsx(kt,{className:"h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0"}),e.jsx("div",{className:"w-8 h-8 rounded-md flex items-center justify-center flex-shrink-0",style:{backgroundColor:`${w}20`,color:w},children:oe?e.jsx(oe,{className:"h-5 w-5"}):null}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"text-sm font-medium text-foreground block",children:D}),$&&e.jsx("span",{className:"text-xs text-muted-foreground truncate block",children:$})]})]})},N=b=>{p&&v&&(p(b),k(null))},a=b=>{switch(b){case"pulse":return"animate-pulse";case"bounce":return"animate-bounce";case"spin":return"animate-spin";case"ping":return"animate-ping";case"shake":return"animate-shake";default:return"animate-pulse"}},M=()=>{switch(o){case"nodes":return _;case"shapes":return"Formas";case"animations":return"Animaciones";default:return""}};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"bg-card/95 border border-border rounded-lg shadow-lg overflow-hidden flex flex-col",style:{width:z?"140px":"180px"},children:e.jsxs("div",{className:"flex flex-col gap-1 p-1.5",children:[e.jsxs("button",{type:"button",onClick:()=>k("nodes"),className:"inline-flex items-center justify-between gap-2 h-9 px-3 rounded-md text-xs font-medium border transition-colors bg-background/50 text-foreground border-border hover:bg-accent hover:border-primary/50",children:[e.jsxs("span",{className:"inline-flex items-center gap-2",children:[e.jsx(Fa,{className:"h-4 w-4"}),e.jsx("span",{children:_})]}),e.jsx("span",{className:"text-[10px] bg-muted px-1.5 py-0.5 rounded-full text-muted-foreground",children:C.length})]}),e.jsxs("button",{type:"button",onClick:()=>k("shapes"),className:"inline-flex items-center justify-between gap-2 h-9 px-3 rounded-md text-xs font-medium border transition-colors bg-background/50 text-foreground border-border hover:bg-accent hover:border-primary/50",children:[e.jsxs("span",{className:"inline-flex items-center gap-2",children:[e.jsx(Ba,{className:"h-4 w-4"}),e.jsx("span",{children:"Formas"})]}),e.jsx("span",{className:"text-[10px] bg-muted px-1.5 py-0.5 rounded-full text-muted-foreground",children:f.length})]}),e.jsxs("button",{type:"button",onClick:()=>k("animations"),className:"inline-flex items-center justify-between gap-2 h-9 px-3 rounded-md text-xs font-medium border transition-colors bg-background/50 text-foreground border-border hover:bg-accent hover:border-primary/50",children:[e.jsxs("span",{className:"inline-flex items-center gap-2",children:[e.jsx(Os,{className:"h-4 w-4"}),e.jsx("span",{children:"Animar"})]}),e.jsx("span",{className:"text-[10px] bg-muted px-1.5 py-0.5 rounded-full text-muted-foreground",children:st.length})]})]})}),e.jsx(_t,{open:o!==null,onOpenChange:b=>!b&&k(null),modal:!0,children:e.jsxs(Dt,{size:"lg",className:"max-h-[80vh] flex flex-col",children:[e.jsx(Pt,{children:e.jsxs($t,{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[o==="nodes"&&e.jsx(Fa,{className:"h-5 w-5"}),o==="shapes"&&e.jsx(Ba,{className:"h-5 w-5"}),o==="animations"&&e.jsx(Os,{className:"h-5 w-5"}),M()]}),e.jsxs("span",{className:"text-sm font-normal text-muted-foreground",children:[j.length," elemento",j.length!==1?"s":""]})]})}),e.jsxs("div",{className:"relative",children:[e.jsx(vs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(V,{type:"text",placeholder:"Buscar...",value:m,onChange:b=>T(b.target.value),className:"pl-9"})]}),e.jsx(xe,{className:"flex-1 -mx-6 px-6",style:{maxHeight:"calc(80vh - 200px)"},children:e.jsxs("div",{className:"pb-4",children:[o==="animations"&&e.jsx("div",{className:"px-1 pb-2",children:v?e.jsxs("p",{className:"text-sm text-primary font-medium",children:["✓ ",l.length," nodo(s) seleccionado(s) - Clic para aplicar"]}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"Selecciona nodo(s) primero"})}),Array.isArray(j)&&j.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No encontrado"}):e.jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[o==="nodes"&&j.map(b=>{var R,$,q;const D=(R=h==null?void 0:h.icons)==null?void 0:R[b],w=($=h==null?void 0:h.labels)==null?void 0:$[b],B=((q=h==null?void 0:h.colors)==null?void 0:q[b])||"#64748b";return e.jsx(n,{icon:D,label:w,color:B,nodeType:E,subType:b},b)}),o==="shapes"&&j.map(b=>{const D=ss[b],w=ge[b],B=as[b];return e.jsx(n,{icon:D,label:w,color:B,nodeType:"shape",subType:b},b)}),o==="animations"&&j.map(b=>e.jsxs("div",{onClick:()=>N(b.type),role:"button",tabIndex:0,onKeyDown:D=>{(D.key==="Enter"||D.key===" ")&&(D.preventDefault(),N(b.type))},className:`
18                        flex items-center gap-3 px-3 py-2.5 rounded-lg border transition-all select-none group
19                        ${v?"cursor-pointer hover:bg-accent hover:border-primary/50 active:scale-[0.98] bg-background/50 border-border":"opacity-50 cursor-not-allowed bg-muted/30 border-transparent"}
20                      `,title:v?`Aplicar: ${b.label} - ${b.description}`:"Selecciona un nodo primero",children:[e.jsx("span",{className:"text-2xl flex-shrink-0",children:b.icon}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"text-sm font-medium text-foreground block",children:b.label}),e.jsx("span",{className:"text-xs text-muted-foreground block",children:b.description})]}),v&&b.type!=="none"&&e.jsx("div",{className:`w-4 h-4 bg-primary rounded-sm flex-shrink-0 ${a(b.type)}`})]},b.type))]})]})})]})})]})},ml=i.memo(dl),hl=[{type:"none",label:"Sin animación",icon:"⏹️"},{type:"pulse",label:"Pulso",icon:"💓"},{type:"bounce",label:"Rebote",icon:"⬆️"},{type:"shake",label:"Vibrar",icon:"📳"},{type:"spin",label:"Girar",icon:"🔄"},{type:"glow",label:"Brillo",icon:"✨"},{type:"float",label:"Flotar",icon:"🎈"}],ul=["#3b82f6","#10b981","#ef4444","#f59e0b","#8b5cf6","#ec4899","#06b6d4","#64748b","#22c55e","#6366f1","#d946ef","#14b8a6"],xl=({selectedNode:s,selectedEdge:u,tipo:c,onUpdateNode:l,onUpdateEdge:p,onDeleteNode:o,onDeleteEdge:k,onDuplicateNode:m,onSendToBack:T,onBringToFront:z,onToggleLockShape:E,onClose:_,isOpen:h})=>{if(!(s||u))return null;const f=()=>{if(!s)return null;const v=s.data||{},x=s.type==="shape";return e.jsxs(Vs,{defaultValue:"style",className:"w-full",children:[e.jsxs(Gs,{className:"grid w-full grid-cols-3",children:[e.jsx(Ne,{value:"style",children:"Estilo"}),e.jsx(Ne,{value:"animation",children:"Animar"}),e.jsx(Ne,{value:"actions",children:"Acciones"})]}),e.jsx(we,{value:"style",className:"mt-3",children:e.jsx(xe,{className:"h-[240px] pr-2",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(I,{className:"text-xs mb-1.5 block",children:"Etiqueta"}),e.jsx(V,{value:v.label||"",onChange:n=>l(s.id,{label:n.target.value}),onKeyDownCapture:n=>n.stopPropagation(),placeholder:"Nombre del elemento",className:"h-9"})]}),e.jsxs("div",{children:[e.jsx(I,{className:"text-xs mb-2 block",children:"Color"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:ul.map(n=>e.jsx("button",{onClick:()=>l(s.id,{color:n}),className:`w-8 h-8 rounded-full border-2 transition-transform hover:scale-110 ${v.color===n?"border-foreground scale-110 ring-2 ring-primary/50":"border-muted"}`,style:{backgroundColor:n}},n))})]}),x&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsxs(I,{className:"text-xs mb-2 block",children:["Opacidad: ",((Number(v.opacity)||.18)*100).toFixed(0),"%"]}),e.jsx(ve,{value:[Number(v.opacity)||.18],onValueChange:([n])=>l(s.id,{opacity:n}),min:.05,max:1,step:.05})]}),e.jsxs("div",{children:[e.jsxs(I,{className:"text-xs mb-2 block",children:["Borde: ",Number(v.strokeWidth)||2,"px"]}),e.jsx(ve,{value:[Number(v.strokeWidth)||2],onValueChange:([n])=>l(s.id,{strokeWidth:n}),min:0,max:10,step:1})]})]})]})})}),e.jsx(we,{value:"animation",className:"mt-3",children:e.jsx(xe,{className:"h-[240px] pr-2",children:e.jsxs("div",{className:"space-y-3",children:[e.jsx(I,{className:"text-xs block",children:"Animación"}),e.jsx("div",{className:"grid grid-cols-3 gap-2",children:hl.map(n=>e.jsxs("button",{onClick:()=>l(s.id,{animation:n.type}),className:`
21                      flex flex-col items-center justify-center p-2 rounded-lg border text-xs transition-all
22                      ${v.animation===n.type?"bg-primary text-primary-foreground border-primary":"bg-background border-border hover:bg-accent"}
23                    `,children:[e.jsx("span",{className:"text-lg mb-1",children:n.icon}),e.jsx("span",{className:"text-[10px]",children:n.label})]},n.type))}),v.animation&&v.animation!=="none"&&e.jsx("div",{className:"p-3 bg-muted/50 rounded-lg",children:e.jsxs("p",{className:"text-xs text-center",children:["✨ Animación activa: ",e.jsx("span",{className:"font-medium",children:String(v.animation)})]})})]})})}),e.jsx(we,{value:"actions",className:"mt-3",children:e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs(S,{size:"sm",variant:"outline",onClick:m,className:"h-10",children:[e.jsx(Ie,{className:"h-4 w-4 mr-1.5"})," Duplicar"]}),e.jsxs(S,{size:"sm",variant:"destructive",onClick:o,className:"h-10",children:[e.jsx(ze,{className:"h-4 w-4 mr-1.5"})," Eliminar"]}),x&&e.jsxs(e.Fragment,{children:[e.jsxs(S,{size:"sm",variant:"outline",onClick:()=>T(s.id),className:"h-10",children:[e.jsx(ta,{className:"h-4 w-4 mr-1.5"})," Al fondo"]}),e.jsxs(S,{size:"sm",variant:"outline",onClick:()=>z(s.id),className:"h-10",children:[e.jsx(ra,{className:"h-4 w-4 mr-1.5"})," Al frente"]}),e.jsxs(S,{size:"sm",variant:v.locked?"default":"outline",onClick:()=>E(s.id),className:"h-10 col-span-2",children:[v.locked?e.jsx(be,{className:"h-4 w-4 mr-1.5"}):e.jsx(Ee,{className:"h-4 w-4 mr-1.5"}),v.locked?"Desbloquer":"Bloquear"]})]})]})})]})},j=()=>{var x;if(!u)return null;const v=u.data||{};return e.jsxs(Vs,{defaultValue:"style",className:"w-full",children:[e.jsxs(Gs,{className:"grid w-full grid-cols-3",children:[e.jsx(Ne,{value:"style",children:"Estilo"}),e.jsx(Ne,{value:"animation",children:"Animar"}),e.jsx(Ne,{value:"label",children:"Etiqueta"})]}),e.jsx(we,{value:"style",className:"mt-3",children:e.jsx(xe,{className:"h-[240px] pr-2",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(I,{className:"text-xs mb-2 block",children:"Tipo de línea"}),e.jsx("div",{className:"grid grid-cols-2 gap-1.5",children:Object.entries(nr).map(([n,{label:N}])=>e.jsx(S,{size:"sm",variant:(u.type||"smoothstep")===n?"default":"outline",onClick:()=>p(u.id,v,n),className:"h-8 text-xs",children:N},n))})]}),e.jsxs("div",{children:[e.jsx(I,{className:"text-xs mb-2 block",children:"Color"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:Object.entries(ca).map(([n,{label:N,color:a}])=>e.jsx("button",{onClick:()=>p(u.id,{...v,colorType:n}),title:N,className:`w-7 h-7 rounded-full border-2 transition-all hover:scale-110 ${(v.colorType||"default")===n?"border-foreground scale-110 ring-2 ring-primary/50":"border-muted"}`,style:{backgroundColor:a}},n))})]}),e.jsxs("div",{children:[e.jsx(I,{className:"text-xs mb-2 block",children:"Flechas"}),e.jsx("div",{className:"grid grid-cols-2 gap-1.5",children:Object.entries(da).map(([n,{label:N}])=>e.jsx(S,{size:"sm",variant:(v.markerType||"arrowEnd")===n?"default":"outline",onClick:()=>p(u.id,{...v,markerType:n}),className:"h-8 text-xs",children:N},n))})]})]})})}),e.jsx(we,{value:"animation",className:"mt-3",children:e.jsx(xe,{className:"h-[240px] pr-2",children:e.jsxs("div",{className:"space-y-3",children:[e.jsx(I,{className:"text-xs block",children:"Animación de línea"}),e.jsx("div",{className:"grid grid-cols-2 gap-1.5",children:Object.entries(fs).map(([n,{label:N}])=>e.jsx(S,{size:"sm",variant:(v.animationType||"none")===n?"default":"outline",onClick:()=>p(u.id,{...v,animationType:n}),className:"h-8 text-xs",children:N},n))}),v.animationType&&v.animationType!=="none"&&e.jsx("div",{className:"p-3 bg-muted/50 rounded-lg",children:e.jsxs("p",{className:"text-xs text-center",children:["✨ Animación activa: ",e.jsx("span",{className:"font-medium",children:(x=fs[v.animationType])==null?void 0:x.label})]})})]})})}),e.jsx(we,{value:"label",className:"mt-3",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(I,{className:"text-xs mb-1.5 block",children:"Etiqueta de conexión"}),e.jsx(V,{value:v.label||"",onChange:n=>p(u.id,{...v,label:n.target.value}),onKeyDownCapture:n=>n.stopPropagation(),placeholder:"Escribe el nombre aquí...",className:"h-10"})]}),e.jsxs(S,{size:"sm",variant:"destructive",onClick:k,className:"w-full h-10",children:[e.jsx(ze,{className:"h-4 w-4 mr-1.5"})," Eliminar Conexión"]})]})})]})};return e.jsx(St,{open:h,onOpenChange:v=>!v&&_(),children:e.jsxs(Tt,{className:"max-h-[60vh]",children:[e.jsx(zt,{className:"pb-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(Et,{className:"flex items-center gap-2 text-base",children:s?e.jsxs(e.Fragment,{children:[e.jsx(qs,{className:"h-4 w-4"})," Editar Nodo"]}):e.jsxs(e.Fragment,{children:[e.jsx(de,{className:"h-4 w-4"})," Editar Conexión"]})}),e.jsx(S,{size:"sm",variant:"ghost",onClick:_,className:"h-8 w-8 p-0",children:e.jsx(Re,{className:"h-4 w-4"})})]})}),e.jsx("div",{className:"px-4 pb-6",children:s?f():j()})]})})},pl=i.memo(xl),gl=[{type:"none",label:"Sin animación",icon:"⏹️"},{type:"pulse",label:"Pulso",icon:"💓"},{type:"bounce",label:"Rebote",icon:"⬆️"},{type:"shake",label:"Vibrar",icon:"📳"},{type:"spin",label:"Girar",icon:"🔄"},{type:"glow",label:"Brillo",icon:"✨"},{type:"float",label:"Flotar",icon:"🎈"}],bl=({children:s,selectedNode:u,selectedEdge:c,selectedNodes:l,isLocked:p,animationsPaused:o,onCopy:k,onPaste:m,onDuplicate:T,onDelete:z,onGroup:E,onSendToBack:_,onBringToFront:h,onToggleLockShape:C,onApplyAnimation:f,onAlignNodes:j,onDistributeNodes:v,onToggleAnimationsPaused:x,onZoomIn:n,onZoomOut:N,onFitView:a,onAddNode:M})=>{var R;const b=u||c||l.length>0,D=l.length>=2,w=l.length>=3,B=(u==null?void 0:u.type)==="shape";return p?e.jsxs(Ua,{children:[e.jsx(Ya,{asChild:!0,children:s}),e.jsxs(Xa,{className:"w-48",children:[e.jsxs(Z,{onClick:n,children:[e.jsx(Je,{className:"mr-2 h-4 w-4"}),"Acercar"]}),e.jsxs(Z,{onClick:N,children:[e.jsx(Qe,{className:"mr-2 h-4 w-4"}),"Alejar"]}),e.jsxs(Z,{onClick:a,children:[e.jsx(bs,{className:"mr-2 h-4 w-4"}),"Ajustar vista"]})]})]}):e.jsxs(Ua,{children:[e.jsx(Ya,{asChild:!0,children:s}),e.jsxs(Xa,{className:"w-56",children:[u&&e.jsxs(e.Fragment,{children:[e.jsxs(Z,{onClick:k,children:[e.jsx(Ie,{className:"mr-2 h-4 w-4"}),"Copiar"]}),e.jsxs(Z,{onClick:T,children:[e.jsx(Ie,{className:"mr-2 h-4 w-4"}),"Duplicar"]}),e.jsxs(Z,{onClick:z,className:"text-destructive",children:[e.jsx(ze,{className:"mr-2 h-4 w-4"}),"Eliminar"]}),B&&e.jsxs(e.Fragment,{children:[e.jsx(Ce,{}),e.jsxs(Z,{onClick:()=>_(u.id),children:[e.jsx(ta,{className:"mr-2 h-4 w-4"}),"Enviar al fondo"]}),e.jsxs(Z,{onClick:()=>h(u.id),children:[e.jsx(ra,{className:"mr-2 h-4 w-4"}),"Traer al frente"]}),e.jsx(Z,{onClick:()=>C(u.id),children:(R=u.data)!=null&&R.locked?e.jsxs(e.Fragment,{children:[e.jsx(Ee,{className:"mr-2 h-4 w-4"})," Desbloquear"]}):e.jsxs(e.Fragment,{children:[e.jsx(be,{className:"mr-2 h-4 w-4"})," Bloquear"]})})]}),e.jsx(Ce,{}),e.jsxs(hs,{children:[e.jsxs(us,{children:[e.jsx(Os,{className:"mr-2 h-4 w-4"}),"Animación"]}),e.jsx(xs,{children:gl.map($=>e.jsxs(Z,{onClick:()=>f($.type),children:[e.jsx("span",{className:"mr-2",children:$.icon}),$.label]},$.type))})]})]}),c&&e.jsxs(Z,{onClick:z,className:"text-destructive",children:[e.jsx(ze,{className:"mr-2 h-4 w-4"}),"Eliminar conexión"]}),D&&e.jsxs(e.Fragment,{children:[e.jsx(Ce,{}),e.jsxs(Z,{onClick:E,children:[e.jsx(oa,{className:"mr-2 h-4 w-4"}),"Agrupar"]}),e.jsxs(hs,{children:[e.jsxs(us,{children:[e.jsx(de,{className:"mr-2 h-4 w-4"}),"Alinear"]}),e.jsxs(xs,{children:[e.jsxs(Z,{onClick:()=>j("left"),children:[e.jsx(En,{className:"mr-2 h-4 w-4"}),"Alinear izquierda"]}),e.jsxs(Z,{onClick:()=>j("right"),children:[e.jsx(Mn,{className:"mr-2 h-4 w-4"}),"Alinear derecha"]}),e.jsxs(Z,{onClick:()=>j("top"),children:[e.jsx(bt,{className:"mr-2 h-4 w-4"}),"Alinear arriba"]}),e.jsxs(Z,{onClick:()=>j("bottom"),children:[e.jsx(jt,{className:"mr-2 h-4 w-4"}),"Alinear abajo"]})]})]}),w&&e.jsxs(hs,{children:[e.jsxs(us,{children:[e.jsx(qa,{className:"mr-2 h-4 w-4"}),"Distribuir"]}),e.jsxs(xs,{children:[e.jsxs(Z,{onClick:()=>v("horizontal"),children:[e.jsx(qa,{className:"mr-2 h-4 w-4"}),"Horizontalmente"]}),e.jsxs(Z,{onClick:()=>v("vertical"),children:[e.jsx(_n,{className:"mr-2 h-4 w-4"}),"Verticalmente"]})]})]})]}),b&&e.jsx(Ce,{}),e.jsxs(Z,{onClick:m,children:[e.jsx(Ie,{className:"mr-2 h-4 w-4"}),"Pegar"]}),e.jsx(Ce,{}),e.jsx(Z,{onClick:x,children:o?e.jsxs(e.Fragment,{children:[e.jsx(Zs,{className:"mr-2 h-4 w-4"})," Reproducir animaciones"]}):e.jsxs(e.Fragment,{children:[e.jsx(Ct,{className:"mr-2 h-4 w-4"})," Pausar animaciones"]})}),e.jsx(Ce,{}),e.jsxs(Z,{onClick:n,children:[e.jsx(Je,{className:"mr-2 h-4 w-4"}),"Acercar"]}),e.jsxs(Z,{onClick:N,children:[e.jsx(Qe,{className:"mr-2 h-4 w-4"}),"Alejar"]}),e.jsxs(Z,{onClick:a,children:[e.jsx(bs,{className:"mr-2 h-4 w-4"}),"Ajustar vista"]}),!b&&e.jsxs(e.Fragment,{children:[e.jsx(Ce,{}),e.jsxs(hs,{children:[e.jsxs(us,{children:[e.jsx(Dn,{className:"mr-2 h-4 w-4"}),"Agregar elemento"]}),e.jsxs(xs,{children:[e.jsx(Z,{onClick:()=>M("shape","rectangle"),children:"Rectángulo"}),e.jsx(Z,{onClick:()=>M("shape","circle"),children:"Círculo"}),e.jsx(Z,{onClick:()=>M("shape","diamond"),children:"Diamante"}),e.jsx(Z,{onClick:()=>M("textFlow","default"),children:"Nodo de texto"})]})]})]})]})]})},jl=i.memo(bl),fl=({nodes:s,onClose:u,onNodeSelect:c,onToggleVisibility:l,onToggleLock:p,onMoveUp:o,onMoveDown:k,selectedNodeId:m})=>{const[T,z]=i.useState(""),{fitView:E}=es(),_=s.filter(x=>{var M,b;const n=((M=x.data)==null?void 0:M.label)||"",N=((b=x.data)==null?void 0:b.subType)||"",a=T.toLowerCase();return n.toLowerCase().includes(a)||N.toLowerCase().includes(a)}),h=x=>{var M;const n=x.type||"textFlow",N=((M=x.data)==null?void 0:M.subType)||"default";if(n==="shape"){const b=ss[N];return b?e.jsx(b,{className:"h-4 w-4"}):e.jsx(de,{className:"h-4 w-4"})}if(n==="stickyNote")return e.jsx(na,{className:"h-4 w-4"});const a=ke[n];if(a!=null&&a.icons){const b=a.icons[N];return b?e.jsx(b,{className:"h-4 w-4"}):e.jsx(de,{className:"h-4 w-4"})}return e.jsx(de,{className:"h-4 w-4"})},C=x=>{var M,b;if((M=x.data)!=null&&M.label)return x.data.label;const n=x.type||"textFlow",N=((b=x.data)==null?void 0:b.subType)||"default";if(n==="shape")return ge[N]||"Forma";if(n==="stickyNote")return"Nota";const a=ke[n];return a!=null&&a.labels&&a.labels[N]||"Nodo"},f=x=>{var M,b;if((M=x.data)!=null&&M.color)return x.data.color;const n=x.type||"textFlow",N=((b=x.data)==null?void 0:b.subType)||"default";if(n==="shape")return"#64748b";const a=ke[n];return a!=null&&a.colors&&a.colors[N]||"#3b82f6"},j=x=>{c(x),E({nodes:[{id:x}],duration:300,padding:.5})},v=[..._].sort((x,n)=>{var M,b;const N=((M=x.style)==null?void 0:M.zIndex)||0;return(((b=n.style)==null?void 0:b.zIndex)||0)-N});return e.jsx(ce,{position:"bottom-left",className:"w-72",children:e.jsxs("div",{className:"bg-card/95 rounded-lg shadow-lg border max-h-[350px] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-3 border-b shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(de,{className:"h-4 w-4 text-primary"}),e.jsxs("h3",{className:"font-semibold text-sm",children:["Capas (",s.length,")"]})]}),e.jsx(S,{size:"sm",variant:"ghost",onClick:u,className:"h-6 w-6 p-0",children:e.jsx(Re,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"p-2 border-b shrink-0",children:e.jsxs("div",{className:"relative",children:[e.jsx(vs,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),e.jsx(V,{placeholder:"Buscar nodos...",value:T,onChange:x=>z(x.target.value),className:"h-8 pl-7 text-sm"})]})}),e.jsx(xe,{className:"flex-1",children:e.jsx("div",{className:"p-2 space-y-1",children:v.length===0?e.jsx("div",{className:"text-center text-muted-foreground text-sm py-4",children:T?"No se encontraron nodos":"Sin nodos en el diagrama"}):v.map((x,n)=>{var b;const N=x.hidden===!0,a=((b=x.data)==null?void 0:b.locked)===!0,M=f(x);return e.jsxs("div",{className:`
24                      flex items-center gap-2 p-2 rounded-md cursor-pointer transition-colors
25                      ${m===x.id?"bg-primary/10 border border-primary/30":"hover:bg-accent"}
26                      ${N?"opacity-50":""}
27                    `,onClick:()=>j(x.id),children:[e.jsx(kt,{className:"h-3 w-3 text-muted-foreground shrink-0"}),e.jsx("div",{className:"w-6 h-6 rounded flex items-center justify-center shrink-0",style:{backgroundColor:`${M}
2720`,color:M},children:h(x)}),e.jsx("span",{className:"flex-1 text-sm truncate",children:C(x)}),e.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[e.jsx(S,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:D=>{D.stopPropagation(),o(x.id)},disabled:n===0,children:e.jsx(Ws,{className:"h-3 w-3"})}),e.jsx(S,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:D=>{D.stopPropagation(),k(x.id)},disabled:n===v.length-1,children:e.jsx(Hs,{className:"h-3 w-3"})}),e.jsx(S,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:D=>{D.stopPropagation(),l(x.id)},children:N?e.jsx(Pn,{className:"h-3 w-3"}):e.jsx(wt,{className:"h-3 w-3"})}),e.jsx(S,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:D=>{D.stopPropagation(),p(x.id)},children:a?e.jsx(be,{className:"h-3 w-3"}):e.jsx(Ee,{className:"h-3 w-3"})})]})]},x.id)})})})]})})},yl=i.memo(fl),Nl=({nodes:s,onClose:u})=>{const[c,l]=i.useState(""),[p,o]=i.useState(!1),[k,m]=i.useState(0),{setCenter:T,getZoom:z,setNodes:E}=es(),_=i.useMemo(()=>{if(!c.trim())return[];const n=c.toLowerCase();return s.filter(N=>{var D,w;const a=(((D=N.data)==null?void 0:D.label)||"").toLowerCase(),M=(((w=N.data)==null?void 0:w.subType)||"").toLowerCase(),b=(N.type||"").toLowerCase();return a.includes(n)||M.includes(n)||b.includes(n)})},[s,c]),h=n=>{var b,D;if((b=n.data)!=null&&b.label)return n.data.label;const N=n.type||"textFlow",a=((D=n.data)==null?void 0:D.subType)||"default";if(N==="shape")return ge[a]||"Forma";const M=ke[N];return M!=null&&M.labels&&M.labels[a]||"Nodo"},C=n=>{var b;const N=n.type||"textFlow",a=((b=n.data)==null?void 0:b.subType)||"default";if(N==="shape"){const D=ss[a];return D?e.jsx(D,{className:"h-3 w-3"}):null}const M=ke[N];if(M!=null&&M.icons){const D=M.icons[a];return D?e.jsx(D,{className:"h-3 w-3"}):null}return null},f=n=>{var b,D,w,B;const N=z(),a=((b=n.style)==null?void 0:b.width)||((D=n.data)==null?void 0:D.width)||100,M=((w=n.style)==null?void 0:w.height)||((B=n.data)==null?void 0:B.height)||60;T(n.position.x+a/2,n.position.y+M/2,{zoom:N,duration:300}),E(R=>R.map($=>({...$,selected:$.id===n.id})))},j=()=>
27{if(_.length===0)return;const n=k>0?k-1:_.length-1;m(n),f(_[n])},v=()=>{if(_.length===0)return;const n=k<_.length-1?k+1:0;m(n),f(_[n])},x=n=>{n.key==="Enter"?n.shiftKey?j():v():n.key==="Escape"&&u()};return e.jsx(ce,{position:"top-center",className:"mt-2",children:e.jsxs("div",{className:"bg-card/95 rounded-lg shadow-lg border overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 p-2",children:[e.jsx(vs,{className:"h-4 w-4 text-muted-foreground shrink-0"}),e.jsx(V,{placeholder:"Buscar nodos... (Enter para navegar)",value:c,onChange:n=>{l(n.target.value),m(0)},onKeyDown:x,autoFocus:!0,className:"h-8 border-none shadow-none focus-visible:ring-0 text-sm"}),_.length>0&&e.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:[k+1,"/",_.length]}),e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx(S,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:j,disabled:_.length===0,children:e.jsx(Ws,{className:"h-3 w-3"})}),e.jsx(S,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:v,disabled:_.length===0,children:e.jsx(Hs,{className:"h-3 w-3"})})]}),e.jsx(S,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:()=>o(!p),children:p?e.jsx(Ws,{className:"h-3 w-3"}):e.jsx(Hs,{className:"h-3 w-3"})}),e.jsx(S,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:u,children:e.jsx(Re,{className:"h-3 w-3"})})]}),p&&_.length>0&&e.jsx("div",{className:"border-t",children:e.jsx(xe,{className:"max-h-[200px]",children:e.jsx("div",{className:"p-1",children:_.map((n,N)=>{var a,M;return e.jsxs("button",{onClick:()=>{m(N),f(n)},className:`
28                      w-full flex items-center gap-2 px-2 py-1.5 rounded text-left text-sm
29                      ${N===k?"bg-primary/10":"hover:bg-accent"}
30                    `,children:[e.jsx("span",{className:"w-5 h-5 rounded flex items-center justify-center shrink-0",style:{backgroundColor:`${((a=n.data)==null?void 0:a.color)||"#3b82f6"}20`,color:((M=n.data)==null?void 0:M.color)||"#3b82f6"},children:C(n)}),e.jsx("span",{className:"flex-1 truncate",children:h(n)}),e.jsx($n,{className:"h-3 w-3 text-muted-foreground"})]},n.id)})})})}),p&&c&&_.length===0&&e.jsx("div",{className:"border-t p-4 text-center text-sm text-muted-foreground",children:"No se encontraron nodos"})]})})},wl=i.memo(Nl),vl=[{category:"General",items:[{keys:["Ctrl","S"],description:"Guardar diagrama"},{keys:["Ctrl","Z"],description:"Deshacer"},{keys:["Ctrl","Y"],description:"Rehacer"},{keys:["Ctrl","Shift","Z"],description:"Rehacer (alternativo)"},{keys:["Esc"],description:"Cancelar acción / Cerrar panel"},{keys:["?"],description:"Mostrar atajos de teclado"}]},{category:"Selección y Edición",items:[{keys:["Ctrl","A"],description:"Seleccionar todos los nodos"},{keys:["Ctrl","C"],description:"Copiar nodos seleccionados"},{keys:["Ctrl","V"],description:"Pegar nodos copiados"},{keys:["Ctrl","D"],description:"Duplicar selección"},{keys:["Ctrl","G"],description:"Agrupar nodos seleccionados"},{keys:["Delete"],description:"Eliminar selección"},{keys:["Backspace"],description:"Eliminar selección"}]},{category:"Navegación",items:[{keys:["Scroll"],description:"Zoom in/out"},{keys:["Ctrl","+"],description:"Acercar"},{keys:["Ctrl","-"],description:"Alejar"},{keys:["Ctrl","0"],description:"Ajustar vista"},{keys:["Space","Arrastrar"],description:"Mover canvas"},{keys:["←","↑","↓","→"],description:"Mover nodo seleccionado"}]},{category:"Herramientas",items:[{keys:["L"],description:"Bloquear/Desbloquear canvas"},{keys:["G"],description:"Mostrar/Ocultar cuadrícula"},{keys:["M"],description:"Mostrar/Ocultar minimapa"},{keys:["P"],description:"Modo presentación"},{keys:["D"],description:"Activar modo dibujo"}]},{category:"Capas y Z-Index",items:[{keys:["Ctrl","["],description:"Enviar al fondo"},{keys:["Ctrl","]"],description:"Traer al frente"}]}],kl=({isOpen:s,onClose:u})=>e.jsx(_t,{open:s,onOpenChange:c=>!c&&u(),children:e.jsxs(Dt,{size:"xl",children:[e.jsx(Pt,{children:e.jsxs($t,{className:"flex items-center gap-2",children:[e.jsx(yt,{className:"h-5 w-5"}),"Atajos de Teclado"]})}),e.jsx(xe,{className:"h-[400px] pr-4",children:e.jsx("div",{className:"space-y-6",children:vl.map(c=>e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-muted-foreground mb-3",children:c.category}),e.jsx("div",{className:"space-y-2",children:c.items.map((l,p)=>e.jsxs("div",{className:"flex items-center justify-between py-1.5 border-b border-border/50",children:[e.jsx("span",{className:"text-sm",children:l.description}),e.jsx("div",{className:"flex items-center gap-1",children:l.keys.map((o,k)=>e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-2 py-1 text-xs font-mono bg-muted rounded border border-border",children:o}
30),k<l.keys.length-1&&e.jsx("span",{className:"text-muted-foreground",children:"+"})]},k))})]},p))})]},c.category))})}),e.jsx("div",{className:"flex justify-end pt-4 border-t",children:e.jsx(S,{onClick:u,children:"Cerrar"})})]})}),Cl=i.memo(kl),Sl=({show:s,selectedNode:u,containerWidth:c,containerHeight:l})=>{var T,z,E,_;const p=eo(),o=i.useMemo(()=>{if(!s)return[];const h=[],C=50,f=100,j=-p.x/p.zoom,v=(c-p.x)/p.zoom,x=Math.floor(j/C)*C,n=Math.ceil(v/C)*C;for(let N=x;N<=n;N+=C){const a=N*p.zoom+p.x;a>=0&&a<=c&&h.push({position:a,label:N%f===0?String(N):"",isMajor:N%f===0})}return h},[s,p,c]),k=i.useMemo(()=>{if(!s)return[];const h=[],C=50,f=100,j=-p.y/p.zoom,v=(l-p.y)/p.zoom,x=Math.floor(j/C)*C,n=Math.ceil(v/C)*C;for(let N=x;N<=n;N+=C){const a=N*p.zoom+p.y;a>=20&&a<=l&&h.push({position:a,label:N%f===0?String(N):"",isMajor:N%f===0})}return h},[s,p,l]);if(!s)return null;const m=u?{x:Math.round(u.position.x),y:Math.round(u.position.y),width:Math.round(((T=u.style)==null?void 0:T.width)||((z=u.data)==null?void 0:z.width)||100),height:Math.round(((E=u.style)==null?void 0:E.height)||((_=u.data)==null?void 0:_.height)||60)}:null;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"absolute top-0 left-5 right-0 h-5 bg-background/90 border-b border-border z-50 pointer-events-none overflow-hidden",children:e.jsx("svg",{width:"100%",height:"100%",className:"text-muted-foreground",children:o.map((h,C)=>e.jsxs("g",{children:[e.jsx("line",{x1:h.position,y1:h.isMajor?8:14,x2:h.position,y2:20,stroke:"currentColor",strokeWidth:h.isMajor?1:.5}),h.label&&e.jsx("text",{x:h.position+3,y:12,fontSize:9,fill:"currentColor",children:h.label})]},C))})}),e.jsx("div",{className:"absolute top-5 left-0 w-5 bottom-0 bg-background/90 border-r border-border z-50 pointer-events-none overflow-hidden",children:e.jsx("svg",{width:"100%",height:"100%",className:"text-muted-foreground",children:k.map((h,C)=>e.jsxs("g",{children:[e.jsx("line",{x1:h.isMajor?8:14,y1:h.position-20,x2:20,y2:h.position-20,stroke:"currentColor",strokeWidth:h.isMajor?1:.5}),h.label&&e.jsx("text",{x:2,y:h.position-17,fontSize:8,fill:"currentColor",writingMode:"vertical-rl",textAnchor:"start",children:h.label})]},C))})}),e.jsx("div",{className:"absolute top-0 left-0 w-5 h-5 bg-background/90 border-r border-b border-border z-50"}),m&&e.jsx("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 z-50 pointer-events-none",children:e.jsxs("div",{className:"bg-primary text-primary-foreground px-3 py-1.5 rounded-lg shadow-lg text-xs font-mono flex items-center gap-3",children:[e.jsxs("span",{children:["X: ",m.x]}),e.jsxs("span",{children:["Y: ",m.y]}),e.jsx("span",{className:"text-primary-foreground/70",children:"|"}),e.jsxs("span",{children:["W: ",m.width]}),e.jsxs("span",{children:["H: ",m.height]})]})})]})},Tl=i.memo(Sl),or=i.memo(({config:s,onConfigChange:u,onClose:c})=>{const l=i.useRef(null),[p,o]=i.useState(!1),[k,m]=i.useState(s!=null&&s.isStored?"upload":"url"),T=async x=>{const n=new FormData;n.append("files",x);try{const N=await fetch(qn("upload"),{method:"POST",headers:On(),body:n});if(!N.ok)throw new Error("Error al subir archivo");const a=await N.json();if(a&&a.length>0){const M=a[0];return{url:Wn(M.url)||M.url,id:M.id}}return null}catch(N){throw console.error("Upload error:",N),N}},z=async x=>{var N;const n=(N=x.target.files)==null?void 0:N[0];
30if(n){if(!n.type.startsWith("image/")){P.error("Por favor selecciona un archivo de imagen");return}if(n.size>10*1024*1024){P.error("La imagen no puede superar los 10MB");return}o(!0);try{const a=await T(n);a?(u({url:a.url,opacity:(s==null?void 0:s.opacity)??.5,scale:(s==null?void 0:s.scale)??1,offsetX:(s==null?void 0:s.offsetX)??0,offsetY:(s==null?void 0:s.offsetY)??0,locked:(s==null?void 0:s.locked)??!1,isStored:!0,strapiFileId:a.id}),P.success("Imagen subida correctamente")):P.error("Error al procesar la imagen")}catch{P.error("Error al subir la imagen")}finally{o(!1),l.current&&(l.current.value="")}}},E=x=>{if(!x.trim()){u(null);return}u({url:x,opacity:(s==null?void 0:s.opacity)??.5,scale:(s==null?void 0:s.scale)??1,offsetX:(s==null?void 0:s.offsetX)??0,offsetY:(s==null?void 0:s.offsetY)??0,locked:(s==null?void 0:s.locked)??!1,isStored:!1})},_=x=>{s&&u({...s,opacity:x[0]})},h=x=>{s&&u({...s,scale:x[0]})},C=(x,n)=>{!s||s.locked||u({...s,offsetX:x==="x"?s.offsetX+n:s.offsetX,offsetY:x==="y"?s.offsetY+n:s.offsetY})},f=()=>{s&&u({...s,scale:1,offsetX:0,offsetY:0})},j=()=>{s&&u({...s,locked:!s.locked})},v=async()=>{s!=null&&s.url.startsWith("blob:")&&URL.revokeObjectURL(s.url),u(null),P.success("Imagen de fondo eliminada")};return e.jsx(ce,{position:"top-right",className:"!top-14 !right-4",children:e.jsxs("div",{className:"bg-card/95 border border-border rounded-lg shadow-lg p-4 w-80",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"font-semibold text-sm",children:"Imagen de Fondo"}),e.jsx(S,{size:"sm",variant:"ghost",onClick:c,className:"h-6 w-6 p-0",children:e.jsx(Re,{className:"h-4 w-4"})})]}),e.jsxs(Vs,{value:k,onValueChange:m,className:"w-full",children:[e.jsxs(Gs,{className:"grid w-full grid-cols-2 mb-3",children:[e.jsxs(Ne,{value:"upload",className:"gap-1.5 text-xs",children:[e.jsx(Xe,{className:"h-3 w-3"}),"Subir"]}),e.jsxs(Ne,{value:"url",className:"gap-1.5 text-xs",children:[e.jsx(vt,{className:"h-3 w-3"}),"URL"]})]}),e.jsxs(we,{value:"upload",className:"space-y-3 mt-0",children:[e.jsx("input",{ref:l,type:"file",accept:"image/*",onChange:z,className:"hidden"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(S,{size:"sm",variant:"outline",onClick:()=>{var x;return(x=l.current)==null?void 0:x.click()},disabled:p,className:"w-full gap-2",children:p?e.jsxs(e.Fragment,{children:[e.jsx(An,{className:"h-4 w-4 animate-spin"}),"Subiendo..."]}):e.jsxs(e.Fragment,{children:[e.jsx(ia,{className:"h-4 w-4"}),"Subir a servidor"]})}),e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"La imagen se guardará permanentemente en el servidor"})]}),(s==null?void 0:s.isStored)&&(s==null?void 0:s.url)&&e.jsxs("div",{className:"flex items-center gap-2 p-2 bg-green-500/10 border border-green-500/20 rounded text-xs text-green-600",children:[e.jsx(Xe,{className:"h-3 w-3"}),"Imagen almacenada en servidor"]})]}),e.jsxs(we,{value:"url",className:"space-y-3 mt-0",children:[e.jsxs("div",{children:[e.jsx(I,{className:"text-xs text-muted-foreground",children:"URL de imagen"}),e.jsx(V,{placeholder:"https://ejemplo.com/imagen.png",value:s!=null&&s.isStored?"":(s==null?void 0:s.url)||"",onChange:x=>E(x.target.value),className:"mt-1 text-xs h-8"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Usa una URL pública de imagen externa"})]})]}),(s==null?void 0:s.url)&&e.jsxs("div",{className:"space-y-3 mt-4 pt-4 border-t border-border",children:[e.jsxs("div",{className:"relative aspect-video bg-muted rounded overflow-hidden",children:[e.jsx("img",{src:s.url,alt:"Background preview",className:"w-full h-full object-contain",style:{opacity:s.opacity},onError:x=>{x.target.src='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><text x="50%" y="50%" text-anchor="middle" dy=".3em" fill="%23999">Error</text></svg>'}}),!s.isStored&&!s.url.startsWith("http")&&e.jsx("div",{className:"absolute bottom-1 left-1 right-1 bg-amber-500/90 text-amber-950 text-[10px] px-2 py-1 rounded",children:"⚠️ Temporal - no se guardará"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-center mb-1",children:[e.jsx(I,{className:"text-xs",children:"Opacidad"}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[Math.round(s.opacity*100),"%"]})]}),e.jsx(ve,{value:[s.opacity],onValueChange:_,min:.1,max:1,step:.
3005})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-center mb-1",children:[e.jsx(I,{className:"text-xs",children:"Escala"}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[Math.round(s.scale*100),"%"]})]}),e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsx(S,{size:"sm",variant:"outline",onClick:()=>h([Math.max(.1,s.scale-.1)]),className:"h-7 w-7 p-0",children:e.jsx(Qe,{className:"h-3 w-3"})}),e.jsx(ve,{value:[s.scale],onValueChange:h,min:.1,max:3,step:.1,className:"flex-1"}),e.jsx(S,{size:"sm",variant:"outline",onClick:()=>h([Math.min(3,s.scale+.1)]),className:"h-7 w-7 p-0",children:e.jsx(Je,{className:"h-3 w-3"})})]})]}),e.jsxs("div",{children:[e.jsx(I,{className:"text-xs",children:"Posición"}),e.jsxs("div",{className:"grid grid-cols-3 gap-1 mt-1 place-items-center",children:[e.jsx("div",{}),e.jsx(S,{size:"sm",variant:"outline",onClick:()=>C("y",-20),disabled:s.locked,className:"h-7 w-7 p-0",children:"↑"}),e.jsx("div",{}),e.jsx(S,{size:"sm",variant:"outline",onClick:()=>C("x",-20),disabled:s.locked,className:"h-7 w-7 p-0",children:"←"}),e.jsx(S,{size:"sm",variant:"outline",onClick:f,className:"h-7 w-7 p-0",title:"Restablecer posición",children:e.jsx(In,{className:"h-3 w-3"})}),e.jsx(S,{size:"sm",variant:"outline",onClick:()=>C("x",20),disabled:s.locked,className:"h-7 w-7 p-0",children:"→"}),e.jsx("div",{}),e.jsx(S,{size:"sm",variant:"outline",onClick:()=>C("y",20),disabled:s.locked,className:"h-7 w-7 p-0",children:"↓"}),e.jsx("div",{})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(S,{size:"sm",variant:s.locked?"secondary":"outline",onClick:j,className:"flex-1 gap-1.5",children:s.locked?e.jsxs(e.Fragment,{children:[e.jsx(be,{className:"h-3 w-3"})," Bloqueada"]}):e.jsxs(e.Fragment,{children:[e.jsx(Ee,{className:"h-3 w-3"})," Bloquear"]})}),e.jsxs(S,{size:"sm",variant:"destructive",onClick:v,className:"gap-1.5",children:[e.jsx(ze,{className:"h-3 w-3"}),"Quitar"]})]})]})]})})});or.displayName="BackgroundImagePanel";const at=(s,u)=>{if(s==="shape"){const T=u||"rectangle";return{label:ge[T]||"Forma",subType:T,color:as[T]||"#64748b",width:240,height:140,strokeWidth:2,opacity:.18,showLabel:!1,locked:!1}}const c=ke[s];if(!c)return{label:"Nuevo Nodo",subType:"default"};const l=u||Object.keys(c.labels)[0],p=c.labels[l]||"Nuevo Nodo",o=c.colors[l]||"#3b82f6",m={textFlow:"flowType",network:"networkType",server:"serverType",heatMap:"heatType",electrical:"electricalType",sound:"soundType",networkPoint:"pointType"}[s]||"subType";return{label:p,subType:l,color:o,[m]:l}};function zl({tipo:s,initialNodes:u=[],initialEdges:c=[],initialViewport:l={x:0,y:0,zoom:1},initialConfig:p={},onSave:o,readOnly:k=!1}){var Pa,$a;const m=i.useRef(null),{fitView:T,zoomIn:z,zoomOut:E,getViewport:_,screenToFlowPosition:h}=es(),C=Mt(),[f,j,v]=ao(u),[x,n,N]=to(c),[a,M]=i.useState(null),[b,D]=i.useState(null),[w,B]=i.useState(k),[R,$]=i.useState(!0),[q,oe]=i.useState(!C),[Y,me]=i.useState(!1),[L,H]=i.useState(null),[se,te]=i.useState("#374151"),[he,je]=i.useState(3),[le,Le]=i.useState([]),[re,fe]=i.useState(-1),[Me,ts]=i.useState([]),[ye,Fe]=i.useState(!1),[pe,rs]=i.useState(!1),Be=i.useRef(null),[ns,lr]=i.useState(!1),[ne,ir]=i.useState(!1),[ks,ma]=i.useState(!1),[ha,ua]=i.useState(!1),[os,cr]=i.useState(!1),[dr,xa]=i.useState(!1),[Cs,pa]=i.useState(!1),[ie,mr]=i.useState(p.backgroundImage||null),[hr,Ss]=i.useState(!1),[ga,qe]=i.useState(!1),[ur,Oe]=i.useState(null),[Ml,Ts]=i.useState(null),zs=i.useRef(null),K=i.useCallback(()=>{const r=le.slice(0,re+1);r.push({nodes:[...f],edges:[...x]}),Le(r),fe(r.length-1),Fe(!0)},[f,x,le,re]);i.useEffect(()=>(ye&&!w&&(Be.current&&clearTimeout(Be.current),Be.current=setTimeout(()=>{xr()},3e3)),()=>{Be.current&&clearTimeout(Be.current)}),[ye,f,x]);const xr=i.useCallback(()=>{if(w||!ye)return;rs(!0);const r=_();o(f,x,r,{backgroundImage:ie}),setTimeout(()=>{rs(!1),Fe(!1)},500)},[f,x,_,o,w,ye,ie]),ba=i.useMemo(()=>{const r=new Map;return x.forEach(t=>{var d,g;t.source&&(r.has(t.source)||r.set(t.source,new Set),(d=r.get(t.source))==null||d.add(t.sourceHandle||"default-source")),t.target&&(r.has(t.target)||r.set(t.target,new Set),(g=r.get(t.target))==null||g.add(t.targetHandle||"default-target"))}),r},[x]),pr=i.useMemo(()=>w?f.map(r=>({...r,data:{...r.data,_connectedHandles:ba.get(r.id)||new Set,_isLocked:w}})):f,[f,ba,w]),gr=i.useMemo(()=>x.map(r=>{const t=r.data,d=rl(t),g=ol(t),y=t!=null&&t.animationType?nl(t.animationType):"";return{...r,style:{...r.style,...d},markerEnd:g.markerEnd,markerStart:g.markerStart,label:(t==null?void 0:t.label)||void 0,labelStyle:{fill:"hsl(var(--foreground))",fontWeight:600,fontSize:12},labelShowBg:!!(t!=null&&t.label),labelBgStyle:{fill:"hsl(var(--card))",fillOpacity:.95,stroke:d.stroke,strokeWidth:1},labelBgPadding:[8,6],labelBgBorderRadius:6,className:y}}),[x]),br=i.useCallback(r=>
30{if(w){const d=r.filter(g=>g.type==="select"&&g.selected===!1);d.length>0&&v(d);return}const t=r.filter(d=>{var g,y;if(d.type==="position"&&d.dragging){const A=f.find(F=>F.id===d.id);if((A==null?void 0:A.type)==="shape"&&((g=A.data)!=null&&g.locked))return!1}if(d.type==="select"){const A=f.find(F=>F.id===d.id);if((A==null?void 0:A.type)==="shape"&&((y=A.data)!=null&&y.locked)&&d.selected)return!1}return!0});v(t)},[w,f,v]),jr=i.useCallback((r,{nodeId:t,handleId:d})=>{zs.current={nodeId:t||"",handleId:d}},[]),fr=i.useCallback(()=>{zs.current=null},[]),yr=i.useCallback(r=>{var y;if(w)return;const t=f.find(A=>A.id===r.source),d=f.find(A=>A.id===r.target);if((t==null?void 0:t.type)==="shape"||(d==null?void 0:d.type)==="shape")return;K();const g=((y=zs.current)==null?void 0:y.handleId)||r.sourceHandle;n(A=>ro({...r,sourceHandle:g,targetHandle:r.targetHandle,type:"smoothstep",animated:!1,data:{styleType:"solid",colorType:"default",markerType:"arrowEnd"}},A))},[n,w,K,f]),Nr=i.useCallback((r,t)=>{var d;t.type==="shape"&&((d=t.data)!=null&&d.locked)||(M(t),D(null),C&&Ss(!0))},[C]),wr=i.useCallback((r,t)=>{D(t),M(null),C&&Ss(!0)},[C]),vr=i.useCallback(r=>{if(Y&&L){const t=h({x:r.clientX,y:r.clientY});K();const d=t.x-L.x,g=t.y-L.y,y=Math.max(Math.sqrt(d*d+g*g),20),A=Math.atan2(g,d)*(180/Math.PI),F=Math.max(he*4,20),O={id:`line-${Date.now()}`,type:"shape",position:{x:L.x,y:L.y-F/2},data:{label:"Línea",subType:"line_horizontal",color:se,strokeColor:se,width:y,height:F,strokeWidth:he,opacity:1,rotation:A,showLabel:!1,locked:!1},style:{width:y,height:F,zIndex:0}};j(W=>[...W,O]),H(null),me(!1),P.success("Línea creada");return}if(Y&&!L){const t=h({x:r.clientX,y:r.clientY});H(t),P.info("Haz clic en el punto final de la línea");return}M(null),D(null)},[Y,L,h,K,j,se,he]),_e=i.useCallback((r,t)=>{if(w)return;K();const d=at(r,t),g={id:`${r}-${Date.now()}`,type:r,position:{x:Math.random()*400+100,y:Math.random()*300+100},data:d,...r==="shape"?{style:{width:d.width??240,height:d.height??140,zIndex:-1}}:{}};j(y=>[...y,g]),M(g),P.success("Elemento agregado")},[j,w,K]),kr=i.useCallback(r=>{if(r.preventDefault(),r.dataTransfer.dropEffect="move",w)return;if(r.dataTransfer.types.includes("application/reactflow/type")){qe(!0);const d=h({x:r.clientX,y:r.clientY});Oe(d)}},[w,h]),Cr=i.useCallback(()=>{qe(!1),Oe(null),Ts(null)},[]),Sr=i.useCallback(r=>{const t=r.dataTransfer.getData("application/reactflow/type");t&&Ts(t)}
30,[]),Tr=i.useCallback(r=>{if(r.preventDefault(),w){qe(!1),Oe(null);return}const t=r.dataTransfer.getData("application/reactflow/type"),d=r.dataTransfer.getData("application/reactflow/subtype");if(!t){qe(!1),Oe(null);return}const g=h({x:r.clientX,y:r.clientY});K();const y=at(t,d),A={id:`${t}-${Date.now()}`,type:t,position:g,data:y,...t==="shape"?{style:{width:y.width??240,height:y.height??140,zIndex:-1}}:{}};j(F=>[...F,A]),M(A),qe(!1),Oe(null),Ts(null),P.success("Elemento agregado")},[w,h,K,j]),De=i.useCallback(()=>{if(w)return;K();const r=f.filter(g=>g.selected),t=x.filter(g=>g.selected);if(r.length===0&&t.length===0){P.error("Selecciona elementos para eliminar");return}const d=r.map(g=>g.id);j(g=>g.filter(y=>!y.selected)),n(g=>g.filter(y=>!y.selected&&!d.includes(y.source)&&!d.includes(y.target))),M(null),D(null),P.success("Elementos eliminados")},[f,x,j,n,w,K]),Pe=i.useCallback(()=>{if(w)return;K();const r=f.filter(d=>d.selected);if(r.length===0){P.error("Selecciona nodos para duplicar");return}const t=r.map(d=>({...d,id:`${d.type}-${Date.now()}-${Math.random()}`,position:{x:d.position.x+50,y:d.position.y+50},selected:!1}));j(d=>[...d.map(g=>({...g,selected:!1})),...t]),P.success("Nodos duplicados")},[f,j,w,K]),We=i.useCallback(()=>{if(w)return;const r=f.filter(W=>W.selected);if(r.length<2){P.error("Selecciona al menos 2 nodos para agrupar");return}K();const t=Math.min(...r.map(W=>W.position.x))-20,d=Math.min(...r.map(W=>W.position.y))-20,g=Math.max(...r.map(W=>W.position.x+150))+20,y=Math.max(...r.map(W=>W.position.y+80))+20,A=g-t,F=y-d,O={id:`group-${Date.now()}`,type:"shape",position:{x:t,y:d},data:{label:"Grupo",subType:"rectangle",color:"#64748b",width:A,height:F,strokeWidth:2,opacity:.2,locked:!1},style:{width:A,height:F,zIndex:-1}};j(W=>[O,...W.map(X=>({...X,selected:!1}))]),P.success("Nodos agrupados")},[f,j,w,K]),ls=i.useCallback(()=>{if(re<=0)return;const r=le[re-1];j(r.nodes),n(r.edges),fe(re-1)},[le,re,j,n]),is=i.useCallback(()=>{if(re>=le.length-1)return;const r=le[re+1];j(r.nodes),n(r.edges),fe(re+1)},[le,re,j,n]),ja=i.useCallback((r,t)=>{j(d=>d.map(g=>g.id===r?{...g,data:{...g.data,...t}}:g)),M(d=>d&&d.id===r?{...d,data:{...d.data,...t}}:d)},[j]),cs=i.useCallback(r=>{j(t=>{if(!t.find(y=>y.id===r))return t;const g=Math.min(...t.map(y=>{var A;return((A=y.style)==null?void 0:A.zIndex)??0}))-1;return t.map(y=>y.id===r?{...y,style:{...y.style,zIndex:g}}:y)}),P.success("Enviado al fondo")},[j]),ds=i.useCallback(r=>{j(t=>{if(!t.find(y=>y.id===r))return t;const g=Math.max(...t.map(y=>{var A;return((A=y.style)==null?void 0:A.zIndex)??0}))+1;return t.map(y=>y.id===r?{...y,style:{...y.style,zIndex:g}}:y)}),P.success("Traído al frente")},[j]),ms=i.useCallback(r=>{j(t=>t.map(d=>{var g;return d.id===r?{...d,data:{...d.data,locked:!((g=d.data)!=null&&g.locked)}}:d})),M(t=>{var d;return t&&t.id===r?{...t,data:{...t.data,locked:!((d=t.data)!=null&&d.locked)}}:t})},[j]),fa=i.useCallback((r,t,d)=>{n(g=>g.map(y=>{if(y.id===r){const A={...y,data:{...y.data,...t}};return d&&(A.type=d),A}return y})),D(g=>g&&g.id===r?{...g,data:{...g.data,...t},type:d??g.type}:g)},[n]),ya=i.useCallback(()=>{!b||w||(K(),n(r=>r.filter(t=>t.id!==b.id)),D(null),P.success("Conexión eliminada"))},[b,n,w,K]),Na=i.useCallback(()=>{rs(!0);const r=_();o(f,x,r,{backgroundImage:ie}),setTimeout(()=>{rs(!1),Fe(!1),P.success("Guardado correctamente")},500)},[f,x,_,o,ie]),wa=i.useCallback(()=>{const r={nodes:f,edges:x,viewport:_(),tipo:s},t=new Blob([JSON.stringify(r,null,2)],{type:"application/json"}),d=URL.createObjectURL(t),g=document.createElement("a");g.href=d,g.download=`esquema-${s}-${Date.now()}.json`,g.click(),URL.revokeObjectURL(d),P.success("Esquema exportado como JSON")},[f,x,_,s]),va=i.useRef(null),ka=i.useCallback(()=>{var r;(r=va.current)==null||r.click()},[]),zr=i.useCallback(r=>{var g;const t=(g=r.target.files)==null?void 0:g[0];if(!t)return;const d=new FileReader;d.onload=y=>{var A;try{const F=JSON.parse((A=y.target)==null?void 0:A.result);if(!F.nodes||!Array.isArray(F.nodes)){P.error("Archivo JSON inválido: faltan nodos");return}K(),j(F.nodes),n(F.edges||[]),P.success("Esquema importado correctamente")}catch(F){P.error("Error al leer el archivo JSON"),console.error("Import error:",F)}},d.readAsText(t),r.target.value=""},[K,j,n]),Ca=i.useCallback(async()=>
30{if(m.current)try{P.loading("Generando imagen...");const{toPng:r}=await Ds(async()=>{const{toPng:A}=await import("./index-6sdqbm2o.js");return{toPng:A}},[]),t=m.current.querySelector(".react-flow");if(!t){P.dismiss(),P.error("No se pudo encontrar el lienzo");return}t.classList.add("export-mode");const d=getComputedStyle(document.documentElement).getPropertyValue("--background").trim(),g=await r(t,{backgroundColor:d?`hsl(${d})`:"#1a1a2e",quality:1,pixelRatio:2,filter:A=>{var O;const F=((O=A.classList)==null?void 0:O.toString())||"";return!(F.includes("react-flow__panel")||F.includes("react-flow__controls")||F.includes("react-flow__minimap")||F.includes("react-flow__background"))}});t.classList.remove("export-mode");const y=document.createElement("a");y.href=g,y.download=`esquema-${s}-${Date.now()}.png`,y.click(),P.dismiss(),P.success("Imagen PNG exportada")}catch(r){P.dismiss(),P.error("Error al exportar imagen"),console.error("Export PNG error:",r)}},[s]),Er=i.useCallback(async()=>{if(m.current)try{P.loading("Generando PDF...");const{toPng:r}=await Ds(async()=>{const{toPng:X}=await import("./index-6sdqbm2o.js");return{toPng:X}},[]),{default:t}=await Ds(async()=>{const{default:X}=await import("./jspdf.es.min-DzOvLlYn.js").then($e=>$e.j);return{default:X}},__vite__mapDeps([0,1,2,3,4,5,6,7])),d=m.current.querySelector(".react-flow");if(!d){P.dismiss(),P.error("No se pudo encontrar el lienzo");return}d.classList.add("export-mode");const g=getComputedStyle(document.documentElement).getPropertyValue("--background").trim(),y=await r(d,{backgroundColor:g?`hsl(${g})`:"#1a1a2e",quality:1,pixelRatio:2,filter:X=>{var Aa;const $e=((Aa=X.classList)==null?void 0:Aa.toString())||"";return!($e.includes("react-flow__panel")||$e.includes("react-flow__controls")||$e.includes("react-flow__minimap")||$e.includes("react-flow__background"))}});d.classList.remove("export-mode");const A=new t({orientation:"landscape",unit:"px",format:"a4"}),F=A.getImageProperties(y),O=A.internal.pageSize.getWidth(),W=F.height*O/F.width;A.addImage(y,"PNG",0,0,O,Math.min(W,A.internal.pageSize.getHeight())),A.save(`esquema-${s}-${Date.now()}.pdf`),P.dismiss(),P.success("PDF exportado")}catch(r){P.dismiss(),P.error("Error al exportar PDF"),console.error("Export PDF error:",r)}},[s]),Sa=i.useCallback(()=>{ir(r=>(r?P.success("Modo presentación desactivado"):(B(!0),$(!1),oe(!1),P.success("Modo presentación activado")),!r))},[]),Mr=i.useCallback(r=>{if(!w){if(r==="text"){_e("textFlow","process");return}_e("shape",r)}},[w,_e]),Ta=i.useMemo(()=>f.some(r=>r.selected)||x.some(r=>r.selected),[f,x]),_r=i.useMemo(()=>f.filter(r=>r.selected).map(r=>r.id),[f]),Es=i.useMemo(()=>f.filter(r=>r.selected).length>=2,[f]),Dr=i.useMemo(()=>f.filter(r=>r.selected).length>=3,[f]),za=i.useCallback(r=>{if(w)return;const t=f.filter(d=>d.selected);if(t.length===0){P.error("Selecciona nodos primero");return}K(),j(d=>d.map(g=>g.selected?{...g,data:{...g.data,animation:r}}:g)),r==="none"?P.success(`Animación removida de ${t.length} nodo(s)`):P.success(`Animación "${r}" aplicada a ${t.length} nodo(s)`)},[f,j,w,K]),Ea=i.useCallback(r=>{if(w)return;const t=f.filter(d=>d.selected);if(t.length<3){P.error("Selecciona al menos 3 nodos para distribuir");return}if(K(),r==="horizontal"){const d=[...t].sort((W,X)=>W.position.x-X.position.x),g=d[0].position.x,F=(d[d.length-1].position.x-g)/(d.length-1),O=new Map;d.forEach((W,X)=>{O.set(W.id,g+F*X)}),j(W=>W.map(X=>O.has(X.id)?{...X,position:{...X.position,x:O.get(X.id)}}:X))}else{const d=[...t].sort((W,X)=>W.position.y-X.position.y),g=d[0].position.y,F=(d[d.length-1].position.y-g)/(d.length-1),O=new Map;d.forEach((W,X)=>{O.set(W.id,g+F*X)}),j(W=>W.map(X=>O.has(X.id)?{...X,position:{...X.position,y:O.get(X.id)}}:X))}P.success("Nodos distribuidos")},[f,j,w,K]),Ma=i.useCallback(r=>{if(w)return;const t=f.filter(g=>g.selected);if(t.length<2){P.error("Selecciona al menos 2 nodos para alinear");return}K();let d;switch(r){case"left":d=Math.min(...t.map(g=>g.position.x)),j(g=>g.map(y=>y.selected?{...y,position:{...y.position,x:d}}:y));break;case"right":d=Math.max(...t.map(g=>{var y;return g.position.x+(((y=g.style)==null?void 0:y.width)||150)})),j(g=>g.map(y=>{var A;return y.selected?{...y,position:{...y.position,x:d-(((A=y.style)==null?void 0:A.width)||150)}}:y}));break;case"top":d=Math.min(...t.map(g=>g.position.y)),j(g=>g.map(y=>y.selected?{...y,position:{...y.position,y:d}}:y));break;case"bottom":d=Math.max(...t.map(g=>{var y;return g.position.y+(((y=g.style)==null?void 0:y.height)||80)})),j(g=>g.map(y=>{var A;return y.selected?{...y,position:{...y.position,y:d-(((A=y.style)==null?void 0:A.height)||80)}}:y}));break;case"centerH":{const g=Math.min(...t.map(F=>F.position.x)),y=Math.max(...t.map(F=>{var O;return F.position.x+(((O=F.style)==null?void 0:O.width)||150)})),A=(g+y)/2;j(F=>F.map(O=>{var W;return O.selected?{...O,position:{...O.position,x:A-(((W=O.style)==null?void 0:W.width)||150)/2}}:O}));break}case"centerV":{const g=Math.min(...t.map(F=>F.position.y)),y=Math.max(...t.map(F=>{var O;return F.position.y+(((O=F.style)==null?void 0:O.height)||80)})),A=(g+y)/2;j(F=>F.map(O=>{var W;return O.selected?{...O,position:{...O.position,y:A-(((W=O.style)==null?void 0:W.height)||80)/2}}:O}));break}}P.success("Nodos alineados")},[f,j,w,K]),Ms=i.useCallback(()=>{const r=f.filter(t=>t.selected);if(r.length===0){P.error("Selecciona nodos para copiar");return}ts(r.map(t=>({...t}))),P.success(`${r.length} nodo(s) copiado(s)`)},[f]),_s=i.useCallback(()=>
30{if(w)return;if(Me.length===0){P.error("No hay nodos en el portapapeles");return}K();const r=Me.map(t=>({...t,id:`${t.type}-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,position:{x:t.position.x+30,y:t.position.y+30},selected:!0,data:{...t.data}}));j(t=>[...t.map(d=>({...d,selected:!1})),...r]),ts(r.map(t=>({...t}))),P.success(`${r.length} nodo(s) pegado(s)`)},[Me,w,K,j]);i.useEffect(()=>{const r=t=>{if(t.target instanceof HTMLInputElement||t.target instanceof HTMLTextAreaElement)return;const d=t.ctrlKey||t.metaKey;d&&t.key==="z"&&!t.shiftKey&&(t.preventDefault(),ls()),(d&&t.key==="y"||d&&t.shiftKey&&t.key==="z")&&(t.preventDefault(),is()),(t.key==="Delete"||t.key==="Backspace")&&(t.preventDefault(),De()),d&&t.key==="g"&&(t.preventDefault(),We()),d&&t.key==="c"&&(t.preventDefault(),Ms()),d&&t.key==="v"&&(t.preventDefault(),_s()),d&&t.key==="d"&&(t.preventDefault(),Pe()),t.key==="Escape"&&Y&&(me(!1),H(null),P.info("Modo dibujar línea cancelado"))};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[ls,is,De,We,Ms,_s,Pe,Y]);const _a=i.useCallback(()=>{me(r=>(r||P.info("Haz clic en el punto inicial de la línea"),!r)),H(null)},[]),Da=i.useCallback(()=>{lr(r=>!r)},[]),Pr=i.useMemo(()=>f.filter(r=>r.selected),[f]);return e.jsxs("div",{ref:m,className:`w-full ${C?"h-[calc(100vh-180px)]":"h-[calc(100vh-140px)]"} min-h-[400px] relative`,onDragOver:kr,onDragLeave:Cr,onDragEnter:Sr,onDrop:Tr,children:[ga&&ur&&e.jsx("div",{className:"absolute pointer-events-none z-50",style:{left:"50%",top:"50%",transform:"translate(-50%, -50%)"},children:e.jsxs("div",{className:"bg-primary/90 text-primary-foreground px-3 py-2 rounded-lg shadow-lg flex items-center gap-2 text-sm font-medium animate-pulse",children:[e.jsx("div",{className:"w-3 h-3 bg-primary-foreground rounded-full"}),e.jsx("span",{children:"Soltar aquí"})]})}),ga&&e.jsx("svg",{className:"absolute inset-0 pointer-events-none z-40 overflow-visible",style:{width:"100%",height:"100%"},children:e.jsx("rect",{x:"4",y:"4",width:"calc(100% - 8px)",height:"calc(100% - 8px)",fill:"none",stroke:"hsl(var(--primary))",strokeWidth:"2",strokeDasharray:"8 4",rx:"8",className:"animate-pulse",style:{width:"calc(100% - 8px)",height:"calc(100% - 8px)"}})}),e.jsx(jl,{selectedNode:a,selectedEdge:b,selectedNodes:Pr,isLocked:w,animationsPaused:ns,onCopy:Ms,onPaste:_s,onDuplicate:Pe,onDelete:De,onGroup:We,onSendToBack:cs,onBringToFront:ds,onToggleLockShape:ms,onApplyAnimation:za,onAlignNodes:Ma,onDistributeNodes:Ea,onToggleAnimationsPaused:Da,onZoomIn:()=>z(),onZoomOut:()=>E(),onFitView:()=>T(),onAddNode:_e,children:e.jsxs(no,{nodes:pr,edges:gr,onNodesChange:br,onEdgesChange:w?void 0:N,onConnect:yr,onConnectStart:jr,onConnectEnd:fr,onNodeClick:Nr,onEdgeClick:wr,onPaneClick:vr,nodeTypes:Xo,connectionMode:lo.Loose,selectionMode:oo.Partial,panOnDrag:!Y,panOnScroll:!1,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,fitView:!0,snapToGrid:!0,snapGrid:[15,15],minZoom:.1,maxZoom:4,defaultEdgeOptions:{type:"smoothstep",animated:!1},proOptions:{hideAttribution:!0},className:`bg-background ${Y?"cursor-crosshair":""} ${ns?"animations-paused":""} ${ne?"presentation-mode":""} ${w?"locked-mode":""}`,children:[!C&&!ne&&e.jsx(Jo,{onDeleteSelected:De,onDuplicateSelected:Pe,onGroupSelected:We,onUndo:ls,onRedo:is,onZoomIn:()=>z(),onZoomOut:()=>E(),onFitView:()=>T(),onSave:Na,onExport:wa,onImport:ka,onExportPNG:Ca,onExportPDF:Er,onAlignNodes:Ma,onDistributeNodes:Ea,onToggleLock:()=>B(!w),onToggleGrid:()=>$(!R),onToggleMinimap:()=>oe(!q),onToggleDrawingLine:_a,onTogglePresentationMode:Sa,onAddQuickShape:Mr,isLocked:w,isPresentationMode:ne,showGrid:R,showMinimap:q,canUndo:re>0,canRedo:re<le.length-1,hasSelection:Ta,canGroup:Es,canAlign:Es,canDistribute:Dr,isDrawingLine:Y,drawingLineColor:se,drawingLineWidth:he,onDrawingLineColorChange:te,onDrawingLineWidthChange:je,onToggleLayers:()=>ma(!ks),onToggleSearch:()=>ua(!ha),onToggleRulers:()=>
30cr(!os),onToggleBackgroundImage:()=>pa(!Cs),onShowKeyboardShortcuts:()=>xa(!0),onAddStickyNote:()=>_e("stickyNote"),showLayers:ks,showRulers:os,showBackgroundImage:Cs,hasBackgroundImage:!!ie}),ne&&e.jsx(ce,{position:"top-right",className:"!top-4 !right-4",children:e.jsx(S,{variant:"outline",size:"sm",onClick:Sa,className:"bg-background/80 shadow-lg",children:"Salir de presentación"})}),e.jsx("input",{ref:va,type:"file",accept:".json",onChange:zr,className:"hidden"}),!ne&&e.jsx(ce,{position:C?"top-left":"bottom-left",className:C?"!top-2 !left-2":"!bottom-4 !left-4",children:e.jsx(ml,{tipo:s,isLocked:w,onAddNode:_e,selectedNodeIds:_r,onApplyAnimation:za})}),a&&!w&&!C&&!ne&&e.jsx(tl,{node:a,tipo:s,onUpdate:ja,onClose:()=>M(null),onSendToBack:cs,onBringToFront:ds,onToggleLock:ms}),b&&!w&&!C&&!ne&&e.jsx(il,{edge:b,onUpdate:fa,onClose:()=>D(null),onDelete:ya}),!C&&!ne&&e.jsx(io,{showInteractive:!1,className:"!bg-card/95 !border !border-border !shadow-lg [&>button]:!bg-background [&>button]:!border-border [&>button]:!text-foreground [&>button:hover]:!bg-accent"}),q&&!C&&!ne&&e.jsx(co,{className:"!bg-card/95 !border !border-border !shadow-lg",nodeStrokeWidth:3,zoomable:!0,pannable:!0}),R&&!ne&&e.jsx(mo,{variant:ho.Dots,gap:15,size:1,className:"!bg-background"}),ie&&e.jsx("div",{className:"absolute inset-0 pointer-events-none z-[-1]",style:{backgroundImage:`url(${ie.url})`,backgroundSize:`${ie.scale*100}%`,backgroundPosition:`calc(50% + ${ie.offsetX}px) calc(50% + ${ie.offsetY}px)`,backgroundRepeat:"no-repeat",opacity:ie.opacity}}),Cs&&!C&&!ne&&e.jsx(or,{config:ie,onConfigChange:mr,onClose:()=>pa(!1)}),w&&!C&&!ne&&e.jsx(ce,{position:"bottom-center",children:e.jsx("div",{className:"bg-yellow-500/90 text-yellow-950 px-4 py-2 rounded-lg text-sm font-medium",children:"🔒 Modo de solo lectura"})}),Y&&!C&&e.jsx(ce,{position:"bottom-center",children:e.jsxs("div",{className:"bg-primary/90 text-primary-foreground px-4 py-2 rounded-lg text-sm font-medium flex items-center gap-2",children:["✏️ Modo dibujar línea ",L?"- Haz clic en el punto final":"- Haz clic en el punto inicial",e.jsx("span",{className:"text-xs opacity-75",children:"(ESC para cancelar)"})]})}),ye&&!C&&!ne&&e.jsx(ce,{position:"top-right",className:"!top-2 !right-2",children:e.jsx("div",{className:"bg-amber-500/90 text-amber-950 px-3 py-1.5 rounded-lg text-xs font-medium flex items-center gap-1.5",children:pe?"💾 Guardando...":"● Cambios sin guardar"})}),!ne&&e.jsx(ce,{position:"top-center",className:"!top-2",children:e.jsx(S,{size:"sm",variant:ns?"default":"outline",onClick:Da,className:"h-8 gap-1.5 shadow-lg",children:ns?e.jsxs(e.Fragment,{children:[e.jsx(Zs,{className:"h-3.5 w-3.5"})," Reproducir"]}):e.jsxs(e.Fragment,{children:[e.jsx(Ct,{className:"h-3.5 w-3.5"})," Pausar"]})})}),ks&&!C&&!ne&&e.jsx(yl,{nodes:f,onClose:()=>ma(!1),onNodeSelect:r=>{const t=f.find(d=>d.id===r);t&&M(t)},onToggleVisibility:r=>{j(t=>t.map(d=>d.id===r?{...d,hidden:!d.hidden}:d))},onToggleLock:ms,onMoveUp:r=>ds(r),onMoveDown:r=>cs(r),selectedNodeId:a==null?void 0:a.id}),ha&&!C&&!ne&&e.jsx(wl,{nodes:f,onClose:()=>ua(!1)}),e.jsx(Cl,{isOpen:dr,onClose:()=>xa(!1)}),os&&!ne&&e.jsx(Tl,{show:os,selectedNode:a,containerWidth:((Pa=m.current)==null?void 0:Pa.clientWidth)||800,containerHeight:(($a=m.current)==null?void 0:$a.clientHeight)||600})]})}),C&&e.jsx(el,{onDeleteSelected:De,onDuplicateSelected:Pe,onGroupSelected:We,onUndo:ls,onRedo:is,onZoomIn:()=>z(),onZoomOut:()=>E(),onFitView:()=>T(),onSave:Na,onExport:wa,onImport:ka,onExportPNG:Ca,onToggleLock:()=>B(!w),onToggleGrid:()=>$(!R),onToggleMinimap:()=>oe(!q),onToggleDrawingLine:_a,isLocked:w,showGrid:R,showMinimap:q,canUndo:re>0,canRedo:re<le.length-1,hasSelection:Ta,canGroup:Es,isDrawingLine:Y,isSaving:pe,hasUnsavedChanges:ye}),C&&e.jsx(pl,{selectedNode:a,selectedEdge:b,tipo:s,onUpdateNode:ja,onUpdateEdge:fa,onDeleteNode:De,onDeleteEdge:ya,onDuplicateNode:Pe,onSendToBack:cs,onBringToFront:ds,onToggleLockShape:ms,onClose:()=>{Ss(!1),M(null),D(null)},isOpen:hr})]})}function El(s){return e.jsx(so,{children:e.jsx(zl,{...s})})}function Gl(){const{documentId:s,esquemaId:u}=fo(),c=Za(s),l=Za(u),p=Hn(c),o=yo(),{hasPermission:k}=Vn(),m=k("api::esquema.esquema.update"),{startTour:T,hasSeenTour:z}=Gn("esquema-editor-tour",No),[E,_]=i.useState(null),[h,C]=i.useState(!0),[f,j]=i.useState(!1),[v,x]=i.useState(""),[n,N]=i.useState(""),{data:a,isLoading:M}=bo(["project-esquema",l],async()=>{const R=await Ps.getEsquema(l);return R.success?{success:!0,data:R.data}:{success:!1,data:null}},jo.ESQUEMA,l||"",{enabled:!!l});i.useEffect(()=>{if(!(a!=null&&a.data)){!M&&l&&(P.error("Error al cargar esquema"),o(`/crm/project/${p}/esquemas`));return}const R=a.data;_(R),x(R.nombre||""),N(R.descripcion||""),C(!1)},[a,M,l,o,c,P]);const b=i.useCallback(async(R,$,q,oe)=>{if(!(!l||!E)){j(!0);try{const Y=await Ps.updateEsquema(l,{nombre:v,descripcion:n,nodes:R,edges:$,viewport:q,configuracion:oe});Y.success?P.success("Esquema guardado"):P.error(Y.error||"Error al guardar")}catch(Y){console.error("Error saving esquema:",Y),P.error("Error al guardar esquema")}finally{j(!1)}}},[l,E,v,n]),D=async()=>
30{if(l){j(!0);try{const R=await Ps.updateEsquema(l,{nombre:v,descripcion:n});R.success?(P.success("Configuración guardada"),_($=>$?{...$,nombre:v,descripcion:n}:null)):P.error(R.error||"Error al guardar")}catch(R){console.error("Error saving settings:",R),P.error("Error al guardar")}finally{j(!1)}}},w=()=>E?$s.find(R=>R.value===E.tipo)||$s[0]:$s[0];if(h)return e.jsx("div",{className:"w-full h-full min-h-[16rem] bg-background"});if(!E)return null;const B=w();return e.jsxs("div",{className:"h-screen flex flex-col",children:[e.jsx(Qn,{onClick:T,hasSeenTour:z}),e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b bg-card/95","data-tour":"editor-toolbar",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(S,{variant:"ghost",size:"icon",onClick:()=>o(`/crm/project/${p}/esquemas`),children:e.jsx(Rn,{className:"h-4 w-4"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"px-2 py-1 rounded text-xs font-medium",style:{backgroundColor:`${B.color}20`,color:B.color},children:B.label}),e.jsx("span",{className:"font-semibold",children:E.nombre}),e.jsxs("span",{className:"text-muted-foreground text-sm font-mono",children:["(",E.codigo,")"]})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs(Un,{children:[e.jsx(Yn,{asChild:!0,children:e.jsxs(S,{variant:"outline",size:"sm",className:"gap-2",children:[e.jsx(Ln,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Configuración"})]})}),e.jsxs(Xn,{children:[e.jsxs(Zn,{children:[e.jsx(Kn,{children:"Configuración del Esquema"}),e.jsx(Jn,{children:"Edita la información general del diagrama"})]}),e.jsxs("div",{className:"space-y-4 py-6",children:[e.jsxs("div",{children:[e.jsx(I,{htmlFor:"edit-nombre",children:"Nombre"}),e.jsx(V,{id:"edit-nombre",value:v,onChange:R=>x(R.target.value)})]}),e.jsxs("div",{children:[e.jsx(I,{htmlFor:"edit-codigo",children:"Código"}),e.jsx(V,{id:"edit-codigo",value:E.codigo,disabled:!0,className:"font-mono bg-muted"})]}),e.jsxs("div",{children:[e.jsx(I,{htmlFor:"edit-tipo",children:"Tipo"}),e.jsx(V,{id:"edit-tipo",value:B.label,disabled:!0,className:"bg-muted"})]}),e.jsxs("div",{children:[e.jsx(I,{htmlFor:"edit-descripcion",children:"Descripción"}),e.jsx(At,{id:"edit-descripcion",value:n,onChange:R=>N(R.target.value),placeholder:"Descripción del diagrama...",rows:4})]}),m&&e.jsxs(S,{onClick:D,disabled:f,className:"w-full",children:[e.jsx(la,{className:"h-4 w-4 mr-2"}),f?"Guardando...":"Guardar Configuración"]})]})]})]})})]}),e.jsx("div",{className:"flex-1","data-tour":"editor-canvas",children:e.jsx(El,{tipo:E.tipo,initialNodes:E.nodes||[],initialEdges:E.edges||[],initialViewport:E.viewport||{x:0,y:0,zoom:1},initialConfig:E.configuracion||{},onSave:m?b:void 0})})]})}export{Gl as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.