driftdetect-dashboard 0.7.1 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/client/assets/{GalaxyTab-Bc9PKsMk.js → GalaxyTab-BsAmWarF.js} +4 -4
  2. package/dist/client/assets/{GalaxyTab-Bc9PKsMk.js.map → GalaxyTab-BsAmWarF.js.map} +1 -1
  3. package/dist/client/assets/main-CVl-4C5E.css +2 -0
  4. package/dist/client/assets/main-QuEZvA3i.js +59 -0
  5. package/dist/client/assets/main-QuEZvA3i.js.map +1 -0
  6. package/dist/client/assets/{sfxr-CO3_Kukg.js → sfxr-Cr89uVKo.js} +2 -2
  7. package/dist/client/assets/{sfxr-CO3_Kukg.js.map → sfxr-Cr89uVKo.js.map} +1 -1
  8. package/dist/client/index.html +2 -2
  9. package/dist/server/api-routes.d.ts.map +1 -1
  10. package/dist/server/quality-gates-api.d.ts.map +1 -0
  11. package/package.json +21 -21
  12. package/LICENSE +0 -21
  13. package/dist/client/assets/main-BdVQNGtK.js +0 -59
  14. package/dist/client/assets/main-BdVQNGtK.js.map +0 -1
  15. package/dist/client/assets/main-NejYwKFb.css +0 -2
  16. package/dist/server/api-routes.d.ts +0 -50
  17. package/dist/server/api-routes.js +0 -634
  18. package/dist/server/api-routes.js.map +0 -1
  19. package/dist/server/dashboard-server.d.ts +0 -64
  20. package/dist/server/dashboard-server.js +0 -154
  21. package/dist/server/dashboard-server.js.map +0 -1
  22. package/dist/server/drift-data-reader.d.ts +0 -522
  23. package/dist/server/drift-data-reader.js +0 -1550
  24. package/dist/server/drift-data-reader.js.map +0 -1
  25. package/dist/server/express-app.d.ts +0 -24
  26. package/dist/server/express-app.js +0 -74
  27. package/dist/server/express-app.js.map +0 -1
  28. package/dist/server/galaxy-data-transformer.d.ts +0 -178
  29. package/dist/server/galaxy-data-transformer.js +0 -562
  30. package/dist/server/galaxy-data-transformer.js.map +0 -1
  31. package/dist/server/index.d.ts +0 -20
  32. package/dist/server/index.js +0 -14
  33. package/dist/server/index.js.map +0 -1
  34. package/dist/server/pattern-watcher.d.ts +0 -55
  35. package/dist/server/pattern-watcher.d.ts.map +0 -1
  36. package/dist/server/pattern-watcher.js +0 -157
  37. package/dist/server/pattern-watcher.js.map +0 -1
  38. package/dist/server/websocket-server.d.ts +0 -83
  39. package/dist/server/websocket-server.js +0 -189
  40. package/dist/server/websocket-server.js.map +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sfxr-CO3_Kukg.js","assets/main-BdVQNGtK.js","assets/main-NejYwKFb.css"])))=>i.map(i=>d[i]);
2
- var CS=Object.defineProperty;var RS=(r,e,t)=>e in r?CS(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var co=(r,e,t)=>RS(r,typeof e!="symbol"?e+"":e,t);import{r as W,g as PS,j as L,c as LS,S as IS,a as Is,b as K_,A as Q_,O as NS,C as Xg,_ as DS,u as Fn,L as Gn,T as qg,d as Wr,F as xd,E as US,P as us,e as Yg,G as Ii,f as Vr,h as OS,i as FS,k as zS,D as BS,l as kS,m as HS,n as VS}from"./main-BdVQNGtK.js";/**
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sfxr-Cr89uVKo.js","assets/main-QuEZvA3i.js","assets/main-CVl-4C5E.css"])))=>i.map(i=>d[i]);
2
+ var CS=Object.defineProperty;var RS=(r,e,t)=>e in r?CS(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var co=(r,e,t)=>RS(r,typeof e!="symbol"?e+"":e,t);import{r as W,g as PS,j as L,c as LS,S as IS,a as Is,b as K_,A as Q_,O as NS,C as Xg,_ as DS,u as Fn,L as Gn,T as qg,d as Wr,F as xd,E as US,P as us,e as Yg,G as Ii,f as Vr,h as OS,i as FS,k as zS,D as BS,l as kS,m as HS,n as VS}from"./main-QuEZvA3i.js";/**
3
3
  * @license
4
4
  * Copyright 2010-2023 Three.js Authors
5
5
  * SPDX-License-Identifier: MIT
@@ -4173,5 +4173,5 @@ No matching component was found for:
4173
4173
  gl_FragColor = vec4(gl_FragColor.rgb, mask * gl_FragColor.a );
4174
4174
  #include <tonemapping_fragment>
4175
4175
  #include <${Dy>=154?"colorspace_fragment":"encodings_fragment"}>
4176
- `)}}}const VR=W.forwardRef((r,e)=>{const[t]=W.useState(()=>new HR(null));return W.createElement("primitive",Ei({},r,{object:t,ref:e,attach:"material"}))});function GR(r,e){const t=r+"Geometry";return W.forwardRef(({args:n,children:i,...s},a)=>{const c=W.useRef(null);return W.useImperativeHandle(a,()=>c.current),W.useLayoutEffect(()=>void(e==null?void 0:e(c.current))),W.createElement("mesh",Ei({ref:c},s),W.createElement(t,{attach:"geometry",args:n}),i)})}const gp=GR("sphere");let Ss,Da;const WR=W.createContext(null),q_=new lt,Y_=new U,jR=W.forwardRef(({children:r,range:e,limit:t=1e3,...n},i)=>{const s=W.useRef(null);W.useImperativeHandle(i,()=>s.current,[]);const[a,c]=W.useState([]),[[u,h,d]]=W.useState(()=>[new Float32Array(t*3),Float32Array.from({length:t*3},()=>1),Float32Array.from({length:t},()=>1)]);W.useEffect(()=>{s.current.geometry.attributes.position.needsUpdate=!0}),Bi(()=>{for(s.current.updateMatrix(),s.current.updateMatrixWorld(),q_.copy(s.current.matrixWorld).invert(),s.current.geometry.drawRange.count=Math.min(t,e!==void 0?e:t,a.length),Ss=0;Ss<a.length;Ss++)Da=a[Ss].current,Da.getWorldPosition(Y_).applyMatrix4(q_),Y_.toArray(u,Ss*3),s.current.geometry.attributes.position.needsUpdate=!0,Da.matrixWorldNeedsUpdate=!0,Da.color.toArray(h,Ss*3),s.current.geometry.attributes.color.needsUpdate=!0,d.set([Da.size],Ss),s.current.geometry.attributes.size.needsUpdate=!0});const f=W.useMemo(()=>({getParent:()=>s,subscribe:m=>(c(g=>[...g,m]),()=>c(g=>g.filter(x=>x.current!==m.current)))}),[]);return W.createElement("points",Ei({userData:{instances:a},matrixAutoUpdate:!1,ref:s,raycast:()=>null},n),W.createElement("bufferGeometry",null,W.createElement("bufferAttribute",{attach:"attributes-position",count:u.length/3,array:u,itemSize:3,usage:Ds}),W.createElement("bufferAttribute",{attach:"attributes-color",count:h.length/3,array:h,itemSize:3,usage:Ds}),W.createElement("bufferAttribute",{attach:"attributes-size",count:d.length,array:d,itemSize:1,usage:Ds})),W.createElement(WR.Provider,{value:f},r))}),XR=W.forwardRef(({children:r,positions:e,colors:t,sizes:n,stride:i=3,...s},a)=>{const c=W.useRef(null);return W.useImperativeHandle(a,()=>c.current,[]),Bi(()=>{const u=c.current.geometry.attributes;u.position.needsUpdate=!0,t&&(u.color.needsUpdate=!0),n&&(u.size.needsUpdate=!0)}),W.createElement("points",Ei({ref:c},s),W.createElement("bufferGeometry",null,W.createElement("bufferAttribute",{attach:"attributes-position",count:e.length/i,array:e,itemSize:i,usage:Ds}),t&&W.createElement("bufferAttribute",{attach:"attributes-color",count:t.length/i,array:t,itemSize:3,usage:Ds}),n&&W.createElement("bufferAttribute",{attach:"attributes-size",count:n.length/i,array:n,itemSize:1,usage:Ds})),r)}),qR=W.forwardRef((r,e)=>r.positions instanceof Float32Array?W.createElement(XR,Ei({},r,{ref:e})):W.createElement(jR,Ei({},r,{ref:e})));function El(r){return new ke(r)}function dm(r){return El(Is[r])}function Uy(r){return IS[r]}function YR(r){return El(K_[r])}function ZR(r){return El(Q_[r])}function JR(r){return El(NS[r])}function KR(r){return Xg[r]??Xg.other??"#7f8c8d"}function QR(r){return El(KR(r))}function $R(r){return r>=80?"#22c55e":r>=60?"#eab308":r>=40?"#f97316":"#ef4444"}function Mi(r){return new U(r.x,r.y,r.z)}function e2(r,e){const t=e.x-r.x,n=e.y-r.y,i=e.z-r.z;return Math.sqrt(t*t+n*n+i*i)}function Oy(r,e){return{x:(r.x+e.x)/2,y:(r.y+e.y)/2,z:(r.z+e.z)/2}}function Z_(r){const e=Math.sqrt(r.x*r.x+r.y*r.y+r.z*r.z);return e===0?{x:0,y:0,z:0}:{x:r.x/e,y:r.y/e,z:r.z/e}}function t2(r,e){return{x:r.x-e.x,y:r.y-e.y,z:r.z-e.z}}function n2(r,e,t=50,n=.3){const i=Oy(r,e),s=e2(r,e),a=Z_(t2(e,r)),c=Z_({x:-a.z,y:a.y+n*s,z:a.x}),u={x:i.x+c.x*s*n,y:i.y+c.y*s*n,z:i.z+c.z*s*n};return new Vp([Mi(r),Mi(u),Mi(e)])}function i2(r,e,t,n=0){const i=r.x+Math.cos(t)*e,s=r.y+Math.sin(n)*Math.sin(t)*e*.3,a=r.z+Math.sin(t)*e;return{x:i,y:s,z:a}}function r2(r,e,t=.5,n=3){const i=Math.log10(r+1)/6,s=Math.log10(e+1)/4,a=i*.6+s*.4;return t+a*(n-t)}function s2(r,e,t=.15){const n=Math.log10(r+1)/3,i=e?1.5:1;return t*(1+n*.5)*i}function o2(r,e=.05,t=.3){const n=Math.log10(r+1)/3;return e+n*(t-e)}const J_={hover:{oldParams:!0,wave_type:1,p_env_attack:0,p_env_sustain:.05,p_env_punch:0,p_env_decay:.1,p_base_freq:.5,p_freq_limit:0,p_freq_ramp:.1,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:0,p_arp_speed:0,p_duty:.5,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:1,p_lpf_ramp:0,p_lpf_resonance:0,p_hpf_freq:.1,p_hpf_ramp:0,sound_vol:.15,sample_rate:44100,sample_size:8},select:{oldParams:!0,wave_type:0,p_env_attack:0,p_env_sustain:.1,p_env_punch:.3,p_env_decay:.2,p_base_freq:.4,p_freq_limit:0,p_freq_ramp:.2,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:.5,p_arp_speed:.6,p_duty:0,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:1,p_lpf_ramp:0,p_lpf_resonance:0,p_hpf_freq:0,p_hpf_ramp:0,sound_vol:.2,sample_rate:44100,sample_size:8},deselect:{oldParams:!0,wave_type:0,p_env_attack:0,p_env_sustain:.05,p_env_punch:0,p_env_decay:.15,p_base_freq:.5,p_freq_limit:0,p_freq_ramp:-.2,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:0,p_arp_speed:0,p_duty:0,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:.8,p_lpf_ramp:-.2,p_lpf_resonance:0,p_hpf_freq:0,p_hpf_ramp:0,sound_vol:.15,sample_rate:44100,sample_size:8},zoom:{oldParams:!0,wave_type:3,p_env_attack:.1,p_env_sustain:.2,p_env_punch:0,p_env_decay:.3,p_base_freq:.1,p_freq_limit:0,p_freq_ramp:.3,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:0,p_arp_speed:0,p_duty:0,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:.5,p_lpf_ramp:.2,p_lpf_resonance:.5,p_hpf_freq:.1,p_hpf_ramp:0,sound_vol:.1,sample_rate:44100,sample_size:8},pathActivate:{oldParams:!0,wave_type:2,p_env_attack:0,p_env_sustain:.15,p_env_punch:.2,p_env_decay:.25,p_base_freq:.3,p_freq_limit:0,p_freq_ramp:.15,p_freq_dramp:0,p_vib_strength:.1,p_vib_speed:.3,p_arp_mod:0,p_arp_speed:0,p_duty:0,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:.7,p_lpf_ramp:0,p_lpf_resonance:.3,p_hpf_freq:.05,p_hpf_ramp:0,sound_vol:.18,sample_rate:44100,sample_size:8},dataFlow:{oldParams:!0,wave_type:0,p_env_attack:.05,p_env_sustain:.1,p_env_punch:0,p_env_decay:.1,p_base_freq:.6,p_freq_limit:0,p_freq_ramp:0,p_freq_dramp:0,p_vib_strength:.2,p_vib_speed:.5,p_arp_mod:0,p_arp_speed:0,p_duty:0,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:.6,p_lpf_ramp:0,p_lpf_resonance:0,p_hpf_freq:.2,p_hpf_ramp:0,sound_vol:.08,sample_rate:44100,sample_size:8},alertLow:{oldParams:!0,wave_type:0,p_env_attack:0,p_env_sustain:.1,p_env_punch:0,p_env_decay:.2,p_base_freq:.35,p_freq_limit:0,p_freq_ramp:0,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:0,p_arp_speed:0,p_duty:0,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:1,p_lpf_ramp:0,p_lpf_resonance:0,p_hpf_freq:0,p_hpf_ramp:0,sound_vol:.15,sample_rate:44100,sample_size:8},alertMedium:{oldParams:!0,wave_type:1,p_env_attack:0,p_env_sustain:.15,p_env_punch:.1,p_env_decay:.15,p_base_freq:.4,p_freq_limit:0,p_freq_ramp:0,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:.3,p_arp_speed:.5,p_duty:.5,p_duty_ramp:0,p_repeat_speed:.5,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:1,p_lpf_ramp:0,p_lpf_resonance:0,p_hpf_freq:0,p_hpf_ramp:0,sound_vol:.18,sample_rate:44100,sample_size:8},alertHigh:{oldParams:!0,wave_type:1,p_env_attack:0,p_env_sustain:.2,p_env_punch:.2,p_env_decay:.1,p_base_freq:.5,p_freq_limit:0,p_freq_ramp:0,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:.4,p_arp_speed:.4,p_duty:.5,p_duty_ramp:0,p_repeat_speed:.4,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:1,p_lpf_ramp:0,p_lpf_resonance:0,p_hpf_freq:0,p_hpf_ramp:0,sound_vol:.22,sample_rate:44100,sample_size:8},alertCritical:{oldParams:!0,wave_type:1,p_env_attack:0,p_env_sustain:.25,p_env_punch:.3,p_env_decay:.1,p_base_freq:.6,p_freq_limit:0,p_freq_ramp:-.1,p_freq_dramp:0,p_vib_strength:.1,p_vib_speed:.8,p_arp_mod:.5,p_arp_speed:.3,p_duty:.5,p_duty_ramp:0,p_repeat_speed:.3,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:1,p_lpf_ramp:0,p_lpf_resonance:0,p_hpf_freq:0,p_hpf_ramp:0,sound_vol:.25,sample_rate:44100,sample_size:8},warp:{oldParams:!0,wave_type:3,p_env_attack:.1,p_env_sustain:.3,p_env_punch:.2,p_env_decay:.4,p_base_freq:.05,p_freq_limit:0,p_freq_ramp:.4,p_freq_dramp:.1,p_vib_strength:0,p_vib_speed:0,p_arp_mod:0,p_arp_speed:0,p_duty:0,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:.3,p_lpf_ramp:.3,p_lpf_resonance:.5,p_hpf_freq:0,p_hpf_ramp:.1,sound_vol:.2,sample_rate:44100,sample_size:8},scan:{oldParams:!0,wave_type:2,p_env_attack:.05,p_env_sustain:.4,p_env_punch:0,p_env_decay:.2,p_base_freq:.2,p_freq_limit:0,p_freq_ramp:.2,p_freq_dramp:-.1,p_vib_strength:.3,p_vib_speed:.6,p_arp_mod:0,p_arp_speed:0,p_duty:0,p_duty_ramp:0,p_repeat_speed:.6,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:.5,p_lpf_ramp:0,p_lpf_resonance:.3,p_hpf_freq:.1,p_hpf_ramp:0,sound_vol:.12,sample_rate:44100,sample_size:8},powerUp:{oldParams:!0,wave_type:0,p_env_attack:0,p_env_sustain:.2,p_env_punch:.3,p_env_decay:.3,p_base_freq:.2,p_freq_limit:0,p_freq_ramp:.3,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:.5,p_arp_speed:.5,p_duty:0,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:1,p_lpf_ramp:0,p_lpf_resonance:0,p_hpf_freq:0,p_hpf_ramp:0,sound_vol:.2,sample_rate:44100,sample_size:8},powerDown:{oldParams:!0,wave_type:0,p_env_attack:0,p_env_sustain:.15,p_env_punch:0,p_env_decay:.4,p_base_freq:.5,p_freq_limit:0,p_freq_ramp:-.3,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:-.3,p_arp_speed:.5,p_duty:0,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:.8,p_lpf_ramp:-.3,p_lpf_resonance:0,p_hpf_freq:0,p_hpf_ramp:0,sound_vol:.18,sample_rate:44100,sample_size:8},click:{oldParams:!0,wave_type:1,p_env_attack:0,p_env_sustain:.02,p_env_punch:0,p_env_decay:.05,p_base_freq:.6,p_freq_limit:0,p_freq_ramp:0,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:0,p_arp_speed:0,p_duty:.5,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:1,p_lpf_ramp:0,p_lpf_resonance:0,p_hpf_freq:.3,p_hpf_ramp:0,sound_vol:.12,sample_rate:44100,sample_size:8},blip:{oldParams:!0,wave_type:0,p_env_attack:0,p_env_sustain:.05,p_env_punch:0,p_env_decay:.1,p_base_freq:.55,p_freq_limit:0,p_freq_ramp:.1,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:0,p_arp_speed:0,p_duty:0,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:1,p_lpf_ramp:0,p_lpf_resonance:0,p_hpf_freq:.1,p_hpf_ramp:0,sound_vol:.15,sample_rate:44100,sample_size:8}};class a2{constructor(e={}){co(this,"config");co(this,"audioCache",new Map);co(this,"sfxr",null);co(this,"initialized",!1);co(this,"initPromise",null);this.config={enabled:!0,volume:.5,muted:!1,...e}}async initialize(){if(!this.initialized)return this.initPromise?this.initPromise:(this.initPromise=this.doInitialize(),this.initPromise)}async doInitialize(){try{this.sfxr=await DS(()=>import("./sfxr-CO3_Kukg.js").then(e=>e.s),__vite__mapDeps([0,1,2]));for(const[e,t]of Object.entries(J_)){const n=this.sfxr.sfxr.toAudio(t);this.audioCache.set(e,n)}this.initialized=!0}catch(e){console.warn("Failed to initialize Galaxy sound engine:",e),this.config.enabled=!1}}async play(e){if(!this.config.enabled||this.config.muted)return;this.initialized||await this.initialize();const t=this.audioCache.get(e);if(t)try{const n=t.cloneNode();n.volume=this.config.volume,await n.play()}catch{}}async playWithVariation(e,t=.1){if(!this.config.enabled||this.config.muted||!this.sfxr)return;this.initialized||await this.initialize();const n={...J_[e]},i=n.p_base_freq;n.p_base_freq=i*(1+(Math.random()-.5)*t*2);try{const s=this.sfxr.sfxr.toAudio(n);s.volume=this.config.volume,await s.play()}catch{}}async playAlert(e){const t={low:"alertLow",medium:"alertMedium",high:"alertHigh",critical:"alertCritical"};await this.play(t[e])}setConfig(e){this.config={...this.config,...e}}getConfig(){return{...this.config}}toggleMute(){return this.config.muted=!this.config.muted,this.config.muted}setVolume(e){this.config.volume=Math.max(0,Math.min(1,e))}setEnabled(e){this.config.enabled=e}}let gf=null;function l2(){return gf||(gf=new a2),gf}function fm(r={}){const{enabled:e=!0,volume:t=.5,debounceMs:n=50}=r,i=l2(),s=W.useRef(new Map);W.useEffect(()=>{i.setConfig({enabled:e,volume:t})},[e,t,i]);const a=W.useCallback(g=>{const x=Date.now(),S=s.current.get(g)??0;x-S<n||(s.current.set(g,x),i.play(g))},[i,n]),c=W.useCallback((g,x=.1)=>{const S=Date.now(),y=s.current.get(g)??0;S-y<n||(s.current.set(g,S),i.playWithVariation(g,x))},[i,n]),u=W.useCallback(g=>{i.playAlert(g)},[i]),h=W.useCallback(()=>i.toggleMute(),[i]),d=W.useCallback(g=>{i.setVolume(g)},[i]),f=W.useCallback(()=>i.getConfig(),[i]),m=W.useCallback(g=>{i.setConfig(g)},[i]);return{play:a,playVaried:c,playAlert:u,toggleMute:h,setVolume:d,getConfig:f,setConfig:m}}function c2({table:r,isSelected:e=!1,isHovered:t=!1,onClick:n,onPointerOver:i,onPointerOut:s}){const a=W.useRef(null),c=W.useRef(null),[u,h]=W.useState(!1),{display:d,viewMode:f}=Fn(),{play:m,playVaried:g}=fm({debounceMs:100}),x=W.useCallback(R=>{R.stopPropagation(),h(!0);const C=r.sensitivity==="critical"?.3:.1;g("hover",C),i==null||i()},[r.sensitivity,g,i]),S=W.useCallback(R=>{R.stopPropagation(),h(!1),s==null||s()},[s]),y=W.useCallback(()=>{m("select"),n==null||n()},[m,n]),_=W.useMemo(()=>r2(r.rowCount,r.accessCount,qg.MIN_RADIUS,qg.MAX_RADIUS),[r.rowCount,r.accessCount]),b=W.useMemo(()=>{const R=dm(r.sensitivity),C=Uy(r.sensitivity),N=QR(r.cluster||"other");return{main:R,emissive:R,emissiveIntensity:C,cluster:N}},[r.sensitivity,r.cluster]),M=W.useMemo(()=>r.position?Mi(r.position):new U(0,0,0),[r.position]);Bi((R,C)=>{if(!a.current)return;a.current.rotation.y+=Wr.IDLE_ROTATION*d.animationSpeed;const N=e?Wr.SELECTION_SCALE:t||u?Wr.HOVER_SCALE:1;if(a.current.scale.lerp(new U(N,N,N),.1),c.current&&r.sensitivity!=="public"){const B=Math.sin(R.clock.elapsedTime*Wr.PULSE_FREQUENCY)*.5+.5,A=c.current.material;A.opacity=.1+B*.2*b.emissiveIntensity}});const T=f==="security"&&(r.sensitivity==="critical"||r.sensitivity==="high");return L.jsxs("group",{position:M,children:[L.jsx(gp,{ref:a,args:[_,32,32],onClick:y,onPointerOver:x,onPointerOut:S,children:L.jsx("meshStandardMaterial",{color:b.main,emissive:b.emissive,emissiveIntensity:T?b.emissiveIntensity*2:b.emissiveIntensity,roughness:.7,metalness:.3})}),r.sensitivity!=="public"&&d.enableBloom&&L.jsx(gp,{ref:c,args:[_*1.3,16,16],children:L.jsx("meshBasicMaterial",{color:b.main,transparent:!0,opacity:.15,side:An})}),e&&L.jsxs("mesh",{rotation:[Math.PI/2,0,0],children:[L.jsx("ringGeometry",{args:[_*1.5,_*1.7,32]}),L.jsx("meshBasicMaterial",{color:"#ffffff",transparent:!0,opacity:.8,side:Si})]}),d.showLabels&&(t||u||e)&&L.jsx(cm,{position:[0,_+Gn.OFFSET,0],center:!0,style:{pointerEvents:"none",userSelect:"none"},children:L.jsxs("div",{style:{background:`rgba(15, 23, 42, ${Gn.BG_OPACITY})`,color:"#f8fafc",padding:`${Gn.PADDING}px ${Gn.PADDING*2}px`,borderRadius:"4px",fontSize:`${Gn.FONT_SIZE}px`,fontFamily:Gn.FONT_FAMILY,whiteSpace:"nowrap",border:`1px solid ${b.main.getStyle()}`},children:[L.jsx("div",{style:{fontWeight:600},children:r.name}),L.jsxs("div",{style:{fontSize:"10px",opacity:.7},children:[r.fields.length," fields • ",r.accessCount," accesses"]})]})})]})}function u2({field:r,parentPosition:e,parentRadius:t,orbitIndex:n,totalFields:i,isSelected:s=!1,isHovered:a=!1,onClick:c,onPointerOver:u,onPointerOut:h}){const d=W.useRef(null),f=W.useRef(n/i*Math.PI*2+Math.random()*.5),{display:m,viewMode:g}=Fn(),x=W.useMemo(()=>{const M=r.sensitivity!=="public"&&r.sensitivity!=="low";return s2(r.accessCount,M,xd.RADIUS)},[r.accessCount,r.sensitivity]),S=W.useMemo(()=>{const M=dm(r.sensitivity),T=Uy(r.sensitivity);return{main:M,emissive:M,emissiveIntensity:T}},[r.sensitivity]),y=t+xd.ORBIT_RADIUS,_=W.useMemo(()=>(n%3-1)*.3,[n]);Bi((M,T)=>{if(!d.current)return;f.current+=xd.ORBIT_SPEED*T*m.animationSpeed;const R=i2(e,y,f.current,_);d.current.position.set(R.x,R.y,R.z),d.current.rotation.y+=.02*m.animationSpeed;const C=s?Wr.SELECTION_SCALE:a?Wr.HOVER_SCALE:1;d.current.scale.lerp(new U(C,C,C),.1)});const b=g==="security"&&(r.sensitivity==="critical"||r.sensitivity==="high");return m.showFields?L.jsxs("group",{children:[L.jsx(gp,{ref:d,args:[x,16,16],onClick:M=>{M.stopPropagation(),c==null||c()},onPointerOver:M=>{M.stopPropagation(),u==null||u()},onPointerOut:M=>{M.stopPropagation(),h==null||h()},children:L.jsx("meshStandardMaterial",{color:S.main,emissive:S.emissive,emissiveIntensity:b?S.emissiveIntensity*3:S.emissiveIntensity,roughness:.5,metalness:.5})}),m.showLabels&&a&&d.current&&L.jsx(cm,{position:d.current.position.clone().add(new U(0,x+.3,0)),center:!0,style:{pointerEvents:"none",userSelect:"none"},children:L.jsxs("div",{style:{background:`rgba(15, 23, 42, ${Gn.BG_OPACITY})`,color:"#f8fafc",padding:`${Gn.PADDING}px ${Gn.PADDING*2}px`,borderRadius:"4px",fontSize:"10px",fontFamily:Gn.FONT_FAMILY,whiteSpace:"nowrap",border:`1px solid ${S.main.getStyle()}`},children:[L.jsx("div",{style:{fontWeight:600},children:r.name}),L.jsxs("div",{style:{opacity:.7},children:[r.dataType," • ",r.sensitivity]}),r.isPrimaryKey&&L.jsx("div",{style:{color:"#fbbf24"},children:"🔑 Primary Key"}),r.isForeignKey&&L.jsx("div",{style:{color:"#60a5fa"},children:"🔗 Foreign Key"}),!r.isTested&&L.jsx("div",{style:{color:"#ef4444"},children:"⚠️ Untested"})]})})]}):null}const _f={GET:"#22c55e",POST:"#3b82f6",PUT:"#f59e0b",PATCH:"#8b5cf6",DELETE:"#ef4444",ALL:"#6b7280"};function h2({entryPoint:r,isSelected:e=!1,isHovered:t=!1,onClick:n,onPointerOver:i,onPointerOut:s}){const a=W.useRef(null),[c,u]=W.useState(!1),{display:h,viewMode:d}=Fn(),{play:f,playAlert:m}=fm({debounceMs:100}),g=W.useCallback(T=>{T.stopPropagation(),u(!0),r.authLevel==="public"?m("medium"):f("hover"),i==null||i()},[r.authLevel,f,m,i]),x=W.useCallback(T=>{T.stopPropagation(),u(!1),s==null||s()},[s]),S=W.useCallback(()=>{r.securityTier==="P0"?m("critical"):r.securityTier==="P1"?m("high"):f("select"),n==null||n()},[r.securityTier,f,m,n]),y=W.useMemo(()=>{const T=ZR(r.authLevel),R=YR(r.securityTier),C=new ke(_f[r.method]??_f.ALL??"#6b7280");return{auth:T,tier:R,method:C}},[r.authLevel,r.securityTier,r.method]),_=W.useMemo(()=>r.position?Mi(r.position):new U(0,0,0),[r.position]);Bi((T,R)=>{if(!a.current)return;a.current.rotation.y+=.005*h.animationSpeed;const C=e?Wr.SELECTION_SCALE:t||c?Wr.HOVER_SCALE:1;a.current.scale.lerp(new U(C,C,C),.1)});const b=d==="security"&&r.authLevel==="public",M=US.SCALE;return L.jsxs("group",{ref:a,position:_,onClick:S,onPointerOver:g,onPointerOut:x,children:[L.jsxs("mesh",{children:[L.jsx("octahedronGeometry",{args:[M,0]}),L.jsx("meshStandardMaterial",{color:y.auth,emissive:y.auth,emissiveIntensity:b?.8:.3,roughness:.3,metalness:.7})]}),L.jsxs("mesh",{children:[L.jsx("octahedronGeometry",{args:[M*.5,0]}),L.jsx("meshStandardMaterial",{color:y.method,emissive:y.method,emissiveIntensity:.5,roughness:.2,metalness:.8})]}),L.jsxs("mesh",{rotation:[Math.PI/2,0,0],children:[L.jsx("torusGeometry",{args:[M*1.5,M*.1,8,32]}),L.jsx("meshStandardMaterial",{color:y.tier,emissive:y.tier,emissiveIntensity:.4,roughness:.4,metalness:.6})]}),e&&L.jsxs("mesh",{rotation:[0,0,Math.PI/4],children:[L.jsx("torusGeometry",{args:[M*2,M*.05,8,32]}),L.jsx("meshBasicMaterial",{color:"#ffffff",transparent:!0,opacity:.8})]}),r.authLevel==="public"&&h.enableBloom&&L.jsxs("mesh",{children:[L.jsx("sphereGeometry",{args:[M*2,16,16]}),L.jsx("meshBasicMaterial",{color:"#ff3333",transparent:!0,opacity:.1,side:An})]}),h.showLabels&&(t||c||e)&&L.jsx(cm,{position:[0,M*2,0],center:!0,style:{pointerEvents:"none",userSelect:"none"},children:L.jsxs("div",{style:{background:`rgba(15, 23, 42, ${Gn.BG_OPACITY})`,color:"#f8fafc",padding:`${Gn.PADDING}px ${Gn.PADDING*2}px`,borderRadius:"4px",fontSize:`${Gn.FONT_SIZE}px`,fontFamily:Gn.FONT_FAMILY,whiteSpace:"nowrap",border:`1px solid ${y.auth.getStyle()}`,maxWidth:"250px"},children:[L.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[L.jsx("span",{style:{background:_f[r.method],padding:"2px 6px",borderRadius:"3px",fontSize:"10px",fontWeight:700},children:r.method}),L.jsx("span",{style:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis"},children:r.path})]}),L.jsxs("div",{style:{fontSize:"10px",opacity:.7,marginTop:"4px"},children:[r.framework," • ",r.authLevel,r.authLevel==="public"&&L.jsx("span",{style:{color:"#ef4444",marginLeft:"4px"},children:"⚠️ PUBLIC"})]}),L.jsxs("div",{style:{fontSize:"10px",opacity:.7},children:["Reaches ",r.reachableTables.length," tables"]})]})})]})}function d2({path:r,sourcePosition:e,targetPosition:t,isSelected:n=!1,isHovered:i=!1,onClick:s,onPointerOver:a,onPointerOut:c}){const u=W.useRef(null),h=W.useRef(0),{display:d,viewMode:f}=Fn(),m=W.useMemo(()=>n2(e,t,us.CURVE_SEGMENTS),[e,t]),g=W.useMemo(()=>m.getPoints(us.CURVE_SEGMENTS),[m]),x=W.useMemo(()=>o2(r.frequency,us.BASE_WIDTH,us.MAX_WIDTH),[r.frequency]),S=W.useMemo(()=>f==="security"?dm(r.sensitivity):JR(r.operation),[r.operation,r.sensitivity,f]),y=W.useMemo(()=>{let _=d.pathOpacity;return f==="coverage"&&!r.isTested&&(_=Math.min(1,_*1.5)),n?1:i?Math.min(1,_*1.3):_},[d.pathOpacity,f,r.isTested,n,i]);return Bi((_,b)=>{if(!u.current)return;h.current-=us.FLOW_SPEED*b*d.animationSpeed;const M=u.current.material;M&&"dashOffset"in M&&(M.dashOffset=h.current)}),d.showPaths?L.jsxs("group",{onClick:s,onPointerOver:a,onPointerOut:c,children:[L.jsx(Tu,{ref:u,points:g,color:S,lineWidth:n?x*2:x,transparent:!0,opacity:y,dashed:!0,dashSize:us.DASH_SIZE,gapSize:us.GAP_SIZE}),(n||i)&&L.jsx(Tu,{points:g,color:S,lineWidth:x*3,transparent:!0,opacity:y*.3}),!r.isTested&&f==="coverage"&&L.jsx(Tu,{points:g,color:"#ef4444",lineWidth:x*.5,transparent:!0,opacity:.5,dashed:!0,dashSize:.2,gapSize:.8})]}):null}const f2={"one-to-one":"#60a5fa","one-to-many":"#34d399","many-to-many":"#a78bfa"};function p2({relationship:r,sourcePosition:e,targetPosition:t,isHighlighted:n=!1}){const{display:i}=Fn(),s=W.useMemo(()=>{const c=Mi(e),u=Mi(t),h=Mi(Oy(e,t));return h.y+=1,new Ku(c,h,u).getPoints(20)},[e,t]),a=W.useMemo(()=>f2[r.type]||"#6b7280",[r.type]);return i.showRelationships?L.jsxs("group",{children:[L.jsx(Tu,{points:s,color:a,lineWidth:n?2:1,transparent:!0,opacity:n?.8:.3,dashed:!n,dashSize:.3,gapSize:.2}),n&&L.jsxs(L.Fragment,{children:[L.jsxs("mesh",{position:Mi(e),children:[L.jsx("sphereGeometry",{args:[.15,8,8]}),L.jsx("meshBasicMaterial",{color:a,transparent:!0,opacity:.8})]}),L.jsxs("mesh",{position:Mi(t),children:[r.type.endsWith("many")?L.jsx("coneGeometry",{args:[.2,.3,8]}):L.jsx("sphereGeometry",{args:[.15,8,8]}),L.jsx("meshBasicMaterial",{color:a,transparent:!0,opacity:.8})]})]})]}):null}function m2({count:r=Yg.STAR_COUNT,radius:e=Ii.RADIUS*3,size:t=Yg.STAR_SIZE,twinkle:n=!0}){const i=W.useRef(null),s=W.useMemo(()=>{const u=new Float32Array(r*3);for(let h=0;h<r;h++){const d=Math.random()*Math.PI*2,f=Math.acos(2*Math.random()-1),m=e*(.5+Math.random()*.5);u[h*3]=m*Math.sin(f)*Math.cos(d),u[h*3+1]=m*Math.sin(f)*Math.sin(d),u[h*3+2]=m*Math.cos(f)}return u},[r,e]),a=W.useMemo(()=>{const u=new Float32Array(r);for(let h=0;h<r;h++)u[h]=t*(.5+Math.random()*1.5);return u},[r,t]),c=W.useMemo(()=>{const u=new Float32Array(r*3);for(let h=0;h<r;h++){const d=Math.random();d<.1?(u[h*3]=.7,u[h*3+1]=.8,u[h*3+2]=1):d<.2?(u[h*3]=1,u[h*3+1]=.95,u[h*3+2]=.8):(u[h*3]=1,u[h*3+1]=1,u[h*3+2]=1)}return u},[r]);return Bi(u=>{if(!n||!i.current)return;const d=i.current.geometry.getAttribute("size");if(d){const f=u.clock.elapsedTime;for(let m=0;m<r;m++){const g=.5+m%10*.1,x=Math.sin(f*g+m)*.3+.7;d.array[m]=a[m]*x}d.needsUpdate=!0}}),L.jsxs(qR,{ref:i,limit:r,children:[L.jsxs("bufferGeometry",{children:[L.jsx("bufferAttribute",{attach:"attributes-position",count:r,array:s,itemSize:3}),L.jsx("bufferAttribute",{attach:"attributes-color",count:r,array:c,itemSize:3}),L.jsx("bufferAttribute",{attach:"attributes-size",count:r,array:a,itemSize:1})]}),L.jsx(VR,{transparent:!0,vertexColors:!0,size:t,sizeAttenuation:!0,depthWrite:!1,opacity:.8})]})}function g2(){const{display:r}=Fn();return r.enableBloom,null}function _2({enableControls:r=!0,autoRotate:e=!1,autoRotateSpeed:t=.5}){const n=W.useRef(null),{camera:i}=Pi(),{camera:s,setCameraPosition:a,setCameraTarget:c}=Fn();W.useEffect(()=>{if(s.position){const h=Mi(s.position);i.position.copy(h)}},[s.position,i]),W.useEffect(()=>{if(n.current&&s.target){const h=Mi(s.target);n.current.target.copy(h),n.current.update()}},[s.target]),W.useEffect(()=>{i.zoom=s.zoom,i.updateProjectionMatrix()},[s.zoom,i]),Bi(()=>{if(!n.current)return;const h=i.position,d=n.current.target;Math.abs(h.x-s.position.x)+Math.abs(h.y-s.position.y)+Math.abs(h.z-s.position.z)>.1&&a({x:h.x,y:h.y,z:h.z}),Math.abs(d.x-s.target.x)+Math.abs(d.y-s.target.y)+Math.abs(d.z-s.target.z)>.1&&c({x:d.x,y:d.y,z:d.z})});const u={autoRotate:e,autoRotateSpeed:t,minDistance:Vr.MIN_ZOOM*20,maxDistance:Vr.MAX_ZOOM*100,maxPolarAngle:Math.PI*.85,minPolarAngle:Math.PI*.15};return L.jsx(kR,{ref:n,...u})}function v2(){const r=W.useRef(null),e=W.useRef(null),{viewMode:t}=Fn();Bi(s=>{const a=s.clock.elapsedTime;r.current&&(r.current.position.x=Math.sin(a*.1)*30,r.current.position.z=Math.cos(a*.1)*30),e.current&&(e.current.position.x=Math.cos(a*.08)*25,e.current.position.z=Math.sin(a*.08)*25)});const n=t==="security"?.2:.3,i=t==="security"?.8:.6;return L.jsxs(L.Fragment,{children:[L.jsx("ambientLight",{intensity:n,color:"#4a5568"}),L.jsx("directionalLight",{position:[50,50,25],intensity:.5,color:"#ffffff",castShadow:!1}),L.jsx("pointLight",{ref:r,position:[30,20,30],intensity:i,color:"#60a5fa",distance:100,decay:2}),L.jsx("pointLight",{ref:e,position:[-25,-10,-25],intensity:i*.7,color:"#f472b6",distance:80,decay:2}),L.jsx("pointLight",{position:[0,0,0],intensity:.4,color:"#a78bfa",distance:50,decay:2}),t==="security"&&L.jsx("pointLight",{position:[0,30,0],intensity:.3,color:"#ef4444",distance:100,decay:2})]})}function Fy(){return L.jsxs("mesh",{children:[L.jsx("sphereGeometry",{args:[1,16,16]}),L.jsx("meshBasicMaterial",{color:"#4a5568",wireframe:!0})]})}function x2(){const{galaxyData:r,selection:e,display:t,selectTable:n,selectEntryPoint:i,selectPath:s,setHovered:a}=Fn(),c=OS(),u=FS(),h=zS(),d=W.useMemo(()=>{const S=new Map;if(r){for(const y of r.tables)y.position&&S.set(y.id,y.position);for(const y of r.entryPoints)y.position&&S.set(y.id,y.position)}return S},[r]),f=W.useCallback(S=>{n(S)},[n]),m=W.useCallback(S=>{i(S)},[i]),g=W.useCallback(S=>{s(S)},[s]),x=W.useCallback((S,y)=>{a(S,y)},[a]);return r?L.jsxs(L.Fragment,{children:[L.jsx(m2,{}),L.jsx(v2,{}),L.jsx(_2,{}),L.jsx(g2,{}),t.showRelationships&&r.relationships.map(S=>{const y=d.get(S.sourceTableId),_=d.get(S.targetTableId);if(!y||!_)return null;const b=e.selectedTable===S.sourceTableId||e.selectedTable===S.targetTableId;return L.jsx(p2,{relationship:S,sourcePosition:y,targetPosition:_,isHighlighted:b},S.id)}),u.map(S=>{const y=d.get(S.sourceId),_=d.get(S.targetTableId);return!y||!_?null:L.jsx(d2,{path:S,sourcePosition:y,targetPosition:_,isSelected:e.selectedPath===S.id,isHovered:e.hoveredNode===S.id,onClick:()=>g(S.id),onPointerOver:()=>x(S.id,"path"),onPointerOut:()=>x(null,null)},S.id)}),c.map(S=>L.jsxs("group",{children:[L.jsx(c2,{table:S,isSelected:e.selectedTable===S.id,isHovered:e.hoveredNode===S.id,onClick:()=>f(S.id),onPointerOver:()=>x(S.id,"table"),onPointerOut:()=>x(null,null)}),t.showFields&&S.position&&S.fields.map((y,_)=>L.jsx(u2,{field:y,parentPosition:S.position,parentRadius:1,orbitIndex:_,totalFields:S.fields.length,isSelected:e.selectedField===y.id,isHovered:e.hoveredNode===y.id,onClick:()=>n(S.id),onPointerOver:()=>x(y.id,"field"),onPointerOut:()=>x(null,null)},y.id))]},S.id)),h.map(S=>L.jsx(h2,{entryPoint:S,isSelected:e.selectedEntryPoint===S.id,isHovered:e.hoveredNode===S.id,onClick:()=>m(S.id),onPointerOver:()=>x(S.id,"entryPoint"),onPointerOut:()=>x(null,null)},S.id))]}):L.jsx(Fy,{})}function y2({className:r="",enableControls:e=!0,autoRotate:t=!1}){return L.jsx("div",{className:`w-full h-full ${r}`,children:L.jsxs(vR,{camera:{position:[Vr.DEFAULT_POSITION.x,Vr.DEFAULT_POSITION.y,Vr.DEFAULT_POSITION.z],fov:Vr.FOV,near:Vr.NEAR,far:Vr.FAR},gl:{antialias:!0,toneMapping:Fu,toneMappingExposure:1},dpr:[1,2],children:[L.jsx("color",{attach:"background",args:["#0f172a"]}),L.jsx("fog",{attach:"fog",args:["#0f172a",50,200]}),L.jsx(W.Suspense,{fallback:L.jsx(Fy,{}),children:L.jsx(x2,{})})]})})}function pm(r){const e=r.toLowerCase();for(const[t,n]of Object.entries(BS))if(n.some(i=>e.includes(i)))return t;return"other"}function S2(r,e){for(let t=0;t<r.length;t++)for(let n=t+1;n<r.length;n++){const i=r[t],s=r[n];if(i.fixed&&s.fixed)continue;const a=s.x-i.x,c=s.y-i.y,u=s.z-i.z,h=Math.sqrt(a*a+c*c+u*u)||.1,d=i.cluster===s.cluster?.5:1,f=e*d/(h*h),m=a/h*f,g=c/h*f,x=u/h*f;i.fixed||(i.vx-=m/i.mass,i.vy-=g/i.mass,i.vz-=x/i.mass),s.fixed||(s.vx+=m/s.mass,s.vy+=g/s.mass,s.vz+=x/s.mass)}}function M2(r,e,t){const n=new Map(r.map(i=>[i.id,i]));for(const i of e){const s=n.get(i.source),a=n.get(i.target);if(!s||!a||s.fixed&&a.fixed)continue;const c=a.x-s.x,u=a.y-s.y,h=a.z-s.z,d=Math.sqrt(c*c+u*u+h*h)||.1,f=(d-t)*i.strength*.1,m=c/d*f,g=u/d*f,x=h/d*f;s.fixed||(s.vx+=m/s.mass,s.vy+=g/s.mass,s.vz+=x/s.mass),a.fixed||(a.vx-=m/a.mass,a.vy-=g/a.mass,a.vz-=x/a.mass)}}function E2(r,e,t){for(const n of r){if(n.fixed)continue;const i=e.get(n.cluster);if(!i)continue;const s=i.x-n.x,a=i.y-n.y,c=i.z-n.z;n.vx+=s*t,n.vy+=a*t,n.vz+=c*t}}function b2(r,e){for(const t of r)t.fixed||(t.x+=t.vx,t.y+=t.vy,t.z+=t.vz,t.vx*=e,t.vy*=e,t.vz*=e)}function w2(r,e,t){for(const n of r){const i=Math.sqrt(n.x*n.x+n.z*n.z);if(i>e){const s=e/i;n.x*=s,n.z*=s}n.y=Math.max(-t/2,Math.min(t/2,n.y))}}function T2(r){const e=new Map,t=2*Math.PI/r.length,n=Ii.RADIUS*.6;return r.forEach((i,s)=>{const a=s*t;e.set(i,{x:Math.cos(a)*n,y:(Math.random()-.5)*Ii.HEIGHT*.3,z:Math.sin(a)*n})}),e}function A2(r,e){return r.map(t=>{const n=t.cluster||pm(t.name),i=e.get(n)||{x:0,y:0,z:0},s=Ii.CLUSTER_SEPARATION*.3;return{id:t.id,x:i.x+(Math.random()-.5)*s,y:i.y+(Math.random()-.5)*s,z:i.z+(Math.random()-.5)*s,vx:0,vy:0,vz:0,mass:1+Math.log10(t.accessCount+1),cluster:n,fixed:!1}})}function C2(r){return r.map(e=>({source:e.sourceTableId,target:e.targetTableId,strength:e.type==="one-to-one"?1:.5}))}function R2(r,e,t){const n=new Map,i=Ii.RADIUS+15,s=new Map;for(const c of r){const u=new Map;for(const m of c.reachableTables){const g=e.find(x=>x.id===m);if(g){const x=g.cluster||pm(g.name);u.set(x,(u.get(x)||0)+1)}}let h="other",d=0;for(const[m,g]of u)g>d&&(h=m,d=g);const f=s.get(h)||[];s.set(h,[...f,c])}let a=0;for(const[c,u]of s)for(let h=0;h<u.length;h++){const d=a/r.length*2*Math.PI,f=(Math.random()-.5)*Ii.HEIGHT;n.set(u[h].id,{x:Math.cos(d)*i,y:f,z:Math.sin(d)*i}),a++}return n}function P2(r,e,t){const n=[...new Set(r.map(f=>f.cluster||pm(f.name)))],i=T2(n),s=A2(r,i),a=C2(t),c=Ii.SIMULATION_ITERATIONS,u=.9;for(let f=0;f<c;f++){const m=1-f/c;S2(s,Ii.FORCE_STRENGTH*m),M2(s,a,Ii.LINK_DISTANCE),E2(s,i,.05*m),b2(s,u),w2(s,Ii.RADIUS,Ii.HEIGHT)}const h=new Map;for(const f of s)h.set(f.id,{x:f.x,y:f.y,z:f.z});const d=R2(e,r);return{tables:h,entryPoints:d,clusters:i}}function L2(r,e,t){const n=[],i=new Set;for(const u of t){const h=`${u.sourceId}-${u.targetTableId}`;i.has(h)||(i.add(h),r.find(f=>f.id===u.sourceId)&&n.push({id:h,sourceTableId:u.sourceId,sourceFieldId:"",targetTableId:u.targetTableId,targetFieldId:"",type:"one-to-many"}))}const s=P2(r,e,n),a=r.map(u=>({...u,position:s.tables.get(u.id)})),c=e.map(u=>({...u,position:s.entryPoints.get(u.id)}));return{tables:a,entryPoints:c}}function I2(){const{isPanelOpen:r,activePanel:e,closePanel:t,selection:n}=Fn(),i=kS(),s=HS(),a=VS();return!r||e!=="details"?null:L.jsxs("div",{className:"absolute right-4 top-4 w-80 max-h-[calc(100vh-8rem)] overflow-y-auto bg-slate-900/95 backdrop-blur-sm rounded-lg border border-slate-700 shadow-xl",children:[L.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-slate-700",children:[L.jsx("h2",{className:"text-lg font-semibold text-white",children:"Details"}),L.jsx("button",{onClick:t,className:"text-slate-400 hover:text-white transition-colors",children:L.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:L.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),L.jsxs("div",{className:"p-4",children:[i&&L.jsx(N2,{table:i,paths:a}),s&&L.jsx(D2,{entryPoint:s}),!i&&!s&&L.jsx("p",{className:"text-slate-400 text-sm",children:"Select a node to view details"})]})]})}function N2({table:r,paths:e}){const t=r.fields.filter(i=>i.sensitivity!=="public"&&i.sensitivity!=="low"),n=e.filter(i=>!i.isTested);return L.jsxs("div",{className:"space-y-4",children:[L.jsxs("div",{children:[L.jsxs("div",{className:"flex items-center gap-2",children:[L.jsx("h3",{className:"text-xl font-bold text-white",children:r.name}),L.jsx("span",{className:"px-2 py-0.5 rounded text-xs font-medium",style:{backgroundColor:Is[r.sensitivity]+"33",color:Is[r.sensitivity]},children:r.sensitivity})]}),r.schema&&L.jsx("p",{className:"text-slate-400 text-sm",children:r.schema})]}),L.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[L.jsx(Ls,{label:"Fields",value:r.fields.length}),L.jsx(Ls,{label:"Accesses",value:r.accessCount}),L.jsx(Ls,{label:"Sensitive",value:t.length,color:t.length>0?"#f59e0b":void 0}),L.jsx(Ls,{label:"Untested Paths",value:n.length,color:n.length>0?"#ef4444":void 0})]}),L.jsxs("div",{children:[L.jsxs("h4",{className:"text-sm font-medium text-slate-300 mb-2",children:["Fields (",r.fields.length,")"]}),L.jsx("div",{className:"space-y-1 max-h-48 overflow-y-auto",children:r.fields.map(i=>L.jsxs("div",{className:"flex items-center justify-between p-2 rounded bg-slate-800/50 text-sm",children:[L.jsxs("div",{className:"flex items-center gap-2",children:[i.isPrimaryKey&&L.jsx("span",{title:"Primary Key",children:"🔑"}),i.isForeignKey&&L.jsx("span",{title:"Foreign Key",children:"🔗"}),L.jsx("span",{className:"text-white",children:i.name}),L.jsx("span",{className:"text-slate-500",children:i.dataType})]}),L.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:Is[i.sensitivity]},title:i.sensitivity})]},i.id))})]}),e.length>0&&L.jsxs("div",{children:[L.jsxs("h4",{className:"text-sm font-medium text-slate-300 mb-2",children:["Access Paths (",e.length,")"]}),L.jsx("div",{className:"space-y-1 max-h-32 overflow-y-auto",children:e.slice(0,10).map(i=>L.jsxs("div",{className:"flex items-center justify-between p-2 rounded bg-slate-800/50 text-sm",children:[L.jsx("span",{className:"text-slate-300",children:i.operation}),L.jsxs("div",{className:"flex items-center gap-2",children:[L.jsxs("span",{className:"text-slate-500",children:["depth: ",i.depth]}),!i.isTested&&L.jsx("span",{className:"text-red-400 text-xs",children:"untested"})]})]},i.id))})]})]})}function D2({entryPoint:r}){return L.jsxs("div",{className:"space-y-4",children:[L.jsxs("div",{children:[L.jsxs("div",{className:"flex items-center gap-2",children:[L.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-bold ${U2(r.method)}`,children:r.method}),L.jsx("h3",{className:"text-lg font-bold text-white truncate",children:r.path})]}),L.jsx("p",{className:"text-slate-400 text-sm mt-1",children:r.framework})]}),r.authLevel==="public"&&L.jsxs("div",{className:"p-3 rounded bg-red-500/20 border border-red-500/50",children:[L.jsxs("div",{className:"flex items-center gap-2 text-red-400",children:[L.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:L.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),L.jsx("span",{className:"font-medium",children:"Public Endpoint"})]}),L.jsx("p",{className:"text-red-300 text-sm mt-1",children:"This endpoint is accessible without authentication"})]}),L.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[L.jsx(Ls,{label:"Auth Level",value:r.authLevel,color:Q_[r.authLevel]}),L.jsx(Ls,{label:"Security Tier",value:r.securityTier}),L.jsx(Ls,{label:"Reachable Tables",value:r.reachableTables.length})]}),L.jsxs("div",{children:[L.jsx("h4",{className:"text-sm font-medium text-slate-300 mb-2",children:"Source"}),L.jsxs("div",{className:"p-2 rounded bg-slate-800/50 text-sm font-mono",children:[L.jsx("span",{className:"text-slate-400",children:r.file}),L.jsxs("span",{className:"text-slate-500",children:[":",r.line]})]})]}),r.reachableTables.length>0&&L.jsxs("div",{children:[L.jsx("h4",{className:"text-sm font-medium text-slate-300 mb-2",children:"Reachable Tables"}),L.jsx("div",{className:"flex flex-wrap gap-1",children:r.reachableTables.map(e=>L.jsx("span",{className:"px-2 py-1 rounded bg-slate-800 text-slate-300 text-xs",children:e},e))})]})]})}function Ls({label:r,value:e,color:t}){return L.jsxs("div",{className:"p-3 rounded bg-slate-800/50",children:[L.jsx("p",{className:"text-slate-400 text-xs",children:r}),L.jsx("p",{className:"text-lg font-semibold",style:{color:t||"#f8fafc"},children:e})]})}function U2(r){const e={GET:"bg-green-500/20 text-green-400",POST:"bg-blue-500/20 text-blue-400",PUT:"bg-amber-500/20 text-amber-400",PATCH:"bg-purple-500/20 text-purple-400",DELETE:"bg-red-500/20 text-red-400",ALL:"bg-slate-500/20 text-slate-400"};return e[r]||e.ALL}function O2(){const{isPanelOpen:r,activePanel:e,closePanel:t,galaxyData:n,setViewMode:i,setFilters:s}=Fn(),a=W.useMemo(()=>{if(!n)return null;const c=n.entryPoints.filter(m=>m.authLevel==="public"),u=n.tables.filter(m=>m.sensitivity==="critical"||m.sensitivity==="high"),h=n.dataPaths.filter(m=>!m.isTested),d=n.entryPoints.filter(m=>m.securityTier==="P0"),f=c.filter(m=>m.reachableTables.some(g=>u.some(x=>x.id===g)));return{publicEndpoints:c,criticalTables:u,untestedPaths:h,p0Endpoints:d,publicToSensitive:f,healthScore:n.stats.healthScore}},[n]);return!r||e!=="security"||!a?null:(a.publicToSensitive.length>0||a.untestedPaths.length>0,L.jsxs("div",{className:"absolute right-4 top-4 w-80 max-h-[calc(100vh-8rem)] overflow-y-auto bg-slate-900/95 backdrop-blur-sm rounded-lg border border-slate-700 shadow-xl",children:[L.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-slate-700",children:[L.jsx("h2",{className:"text-lg font-semibold text-white",children:"Security Overview"}),L.jsx("button",{onClick:t,className:"text-slate-400 hover:text-white transition-colors",children:L.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:L.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),L.jsxs("div",{className:"p-4 space-y-4",children:[L.jsxs("div",{className:"text-center p-4 rounded-lg bg-slate-800/50",children:[L.jsx("div",{className:"text-4xl font-bold",style:{color:F2(a.healthScore)},children:a.healthScore}),L.jsx("p",{className:"text-slate-400 text-sm",children:"Security Health Score"})]}),a.publicToSensitive.length>0&&L.jsxs("div",{className:"p-3 rounded bg-red-500/20 border border-red-500/50",children:[L.jsxs("div",{className:"flex items-center gap-2 text-red-400 font-medium",children:[L.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:L.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),a.publicToSensitive.length," Public → Sensitive Paths"]}),L.jsx("p",{className:"text-red-300 text-sm mt-1",children:"Public endpoints can reach sensitive data without authentication"}),L.jsx("button",{onClick:()=>{i("security"),s({publicOnly:!0})},className:"mt-2 text-sm text-red-400 hover:text-red-300 underline",children:"View in Security Mode →"})]}),L.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[L.jsx(_u,{label:"Public Endpoints",value:a.publicEndpoints.length,color:a.publicEndpoints.length>0?"#ef4444":"#22c55e",onClick:()=>s({publicOnly:!0})}),L.jsx(_u,{label:"P0 Endpoints",value:a.p0Endpoints.length,color:K_.P0}),L.jsx(_u,{label:"Sensitive Tables",value:a.criticalTables.length,color:Is.high,onClick:()=>s({minSensitivity:"high"})}),L.jsx(_u,{label:"Untested Paths",value:a.untestedPaths.length,color:a.untestedPaths.length>0?"#f59e0b":"#22c55e",onClick:()=>s({untestedOnly:!0})})]}),L.jsxs("div",{children:[L.jsx("h4",{className:"text-sm font-medium text-slate-300 mb-2",children:"Sensitivity Distribution"}),L.jsx("div",{className:"space-y-2",children:["critical","high","medium","low","public"].map(c=>{const u=(n==null?void 0:n.stats.sensitiveFields[c])||0,h=(n==null?void 0:n.stats.fieldCount)||1,d=Math.round(u/h*100);return L.jsxs("div",{className:"flex items-center gap-2",children:[L.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:Is[c]}}),L.jsx("span",{className:"text-slate-300 text-sm capitalize flex-1",children:c}),L.jsx("span",{className:"text-slate-400 text-sm",children:u}),L.jsx("div",{className:"w-20 h-2 bg-slate-700 rounded-full overflow-hidden",children:L.jsx("div",{className:"h-full rounded-full",style:{width:`${d}%`,backgroundColor:Is[c]}})})]},c)})})]}),L.jsxs("div",{children:[L.jsx("h4",{className:"text-sm font-medium text-slate-300 mb-2",children:"Quick Actions"}),L.jsxs("div",{className:"space-y-2",children:[L.jsx("button",{onClick:()=>i("security"),className:"w-full p-2 rounded bg-slate-800 hover:bg-slate-700 text-left text-sm text-slate-300 transition-colors",children:"🔒 Enable Security Mode"}),L.jsx("button",{onClick:()=>i("coverage"),className:"w-full p-2 rounded bg-slate-800 hover:bg-slate-700 text-left text-sm text-slate-300 transition-colors",children:"📊 View Test Coverage"}),L.jsx("button",{onClick:()=>s({untestedOnly:!0}),className:"w-full p-2 rounded bg-slate-800 hover:bg-slate-700 text-left text-sm text-slate-300 transition-colors",children:"⚠️ Show Untested Paths"})]})]})]})]}))}function _u({label:r,value:e,color:t,onClick:n}){return L.jsxs("button",{onClick:n,className:"p-3 rounded bg-slate-800/50 hover:bg-slate-800 transition-colors text-left",children:[L.jsx("p",{className:"text-slate-400 text-xs",children:r}),L.jsx("p",{className:"text-2xl font-bold",style:{color:t},children:e})]})}function F2(r){return r>=80?"#22c55e":r>=60?"#eab308":r>=40?"#f97316":"#ef4444"}function z2(){const{isPanelOpen:r,activePanel:e,closePanel:t,viewMode:n,setViewMode:i,filters:s,setFilters:a,resetFilters:c,display:u,setDisplay:h,resetCamera:d}=Fn(),{play:f,getConfig:m,setConfig:g,toggleMute:x,setVolume:S}=fm(),[y,_]=W.useState(m),b=W.useCallback(R=>{g({enabled:R}),_(C=>({...C,enabled:R})),R&&f("powerUp")},[g,f]),M=W.useCallback(()=>{const R=x();_(C=>({...C,muted:R})),R||f("click")},[x,f]),T=W.useCallback(R=>{S(R),_(C=>({...C,volume:R}))},[S]);return!r||e!=="settings"?null:L.jsxs("div",{className:"absolute right-4 top-4 w-72 max-h-[calc(100vh-8rem)] overflow-y-auto bg-slate-900/95 backdrop-blur-sm rounded-lg border border-slate-700 shadow-xl",children:[L.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-slate-700",children:[L.jsx("h2",{className:"text-lg font-semibold text-white",children:"Controls"}),L.jsx("button",{onClick:t,className:"text-slate-400 hover:text-white transition-colors",children:L.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:L.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),L.jsxs("div",{className:"p-4 space-y-6",children:[L.jsx(Ua,{title:"View Mode",children:L.jsx("div",{className:"grid grid-cols-2 gap-2",children:B2.map(R=>L.jsxs("button",{onClick:()=>i(R.value),className:`p-2 rounded text-sm transition-colors ${n===R.value?"bg-blue-500/20 text-blue-400 border border-blue-500/50":"bg-slate-800 text-slate-300 hover:bg-slate-700"}`,children:[R.icon," ",R.label]},R.value))})}),L.jsx(Ua,{title:"Filters",children:L.jsxs("div",{className:"space-y-3",children:[L.jsxs("div",{children:[L.jsx("label",{className:"text-xs text-slate-400 block mb-1",children:"Min Sensitivity"}),L.jsxs("select",{value:s.minSensitivity||"",onChange:R=>a({minSensitivity:R.target.value||null}),className:"w-full p-2 rounded bg-slate-800 text-slate-300 text-sm border border-slate-700",children:[L.jsx("option",{value:"",children:"All"}),L.jsx("option",{value:"low",children:"Low+"}),L.jsx("option",{value:"medium",children:"Medium+"}),L.jsx("option",{value:"high",children:"High+"}),L.jsx("option",{value:"critical",children:"Critical"})]})]}),L.jsxs("div",{children:[L.jsx("label",{className:"text-xs text-slate-400 block mb-1",children:"Operation Type"}),L.jsxs("select",{value:s.operationType||"",onChange:R=>a({operationType:R.target.value||null}),className:"w-full p-2 rounded bg-slate-800 text-slate-300 text-sm border border-slate-700",children:[L.jsx("option",{value:"",children:"All"}),L.jsx("option",{value:"read",children:"Read"}),L.jsx("option",{value:"write",children:"Write"}),L.jsx("option",{value:"delete",children:"Delete"})]})]}),L.jsx(gr,{label:"Untested paths only",checked:s.untestedOnly,onChange:R=>a({untestedOnly:R})}),L.jsx(gr,{label:"Public endpoints only",checked:s.publicOnly,onChange:R=>a({publicOnly:R})}),L.jsx("button",{onClick:c,className:"w-full p-2 rounded bg-slate-800 hover:bg-slate-700 text-slate-400 text-sm transition-colors",children:"Reset Filters"})]})}),L.jsx(Ua,{title:"Display",children:L.jsxs("div",{className:"space-y-3",children:[L.jsx(gr,{label:"Show field moons",checked:u.showFields,onChange:R=>h({showFields:R})}),L.jsx(gr,{label:"Show data paths",checked:u.showPaths,onChange:R=>h({showPaths:R})}),L.jsx(gr,{label:"Show relationships",checked:u.showRelationships,onChange:R=>h({showRelationships:R})}),L.jsx(gr,{label:"Show labels",checked:u.showLabels,onChange:R=>h({showLabels:R})}),L.jsx(gr,{label:"Enable bloom effect",checked:u.enableBloom,onChange:R=>h({enableBloom:R})}),L.jsxs("div",{children:[L.jsxs("label",{className:"text-xs text-slate-400 block mb-1",children:["Animation Speed: ",u.animationSpeed.toFixed(1),"x"]}),L.jsx("input",{type:"range",min:"0",max:"2",step:"0.1",value:u.animationSpeed,onChange:R=>h({animationSpeed:parseFloat(R.target.value)}),className:"w-full"})]}),L.jsxs("div",{children:[L.jsxs("label",{className:"text-xs text-slate-400 block mb-1",children:["Path Opacity: ",Math.round(u.pathOpacity*100),"%"]}),L.jsx("input",{type:"range",min:"0.1",max:"1",step:"0.1",value:u.pathOpacity,onChange:R=>h({pathOpacity:parseFloat(R.target.value)}),className:"w-full"})]})]})}),L.jsx(Ua,{title:"Camera",children:L.jsx("button",{onClick:d,className:"w-full p-2 rounded bg-slate-800 hover:bg-slate-700 text-slate-300 text-sm transition-colors",children:"🎥 Reset Camera"})}),L.jsx(Ua,{title:"Sound",children:L.jsxs("div",{className:"space-y-3",children:[L.jsx(gr,{label:"Enable sounds",checked:y.enabled,onChange:b}),L.jsx(gr,{label:"Mute",checked:y.muted,onChange:M}),L.jsxs("div",{children:[L.jsxs("label",{className:"text-xs text-slate-400 block mb-1",children:["Volume: ",Math.round(y.volume*100),"%"]}),L.jsx("input",{type:"range",min:"0",max:"1",step:"0.1",value:y.volume,onChange:R=>T(parseFloat(R.target.value)),className:"w-full",disabled:!y.enabled||y.muted})]}),L.jsxs("div",{className:"flex gap-2",children:[L.jsx("button",{onClick:()=>f("hover"),className:"flex-1 p-2 rounded bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs transition-colors",disabled:!y.enabled||y.muted,children:"🔊 Test"}),L.jsx("button",{onClick:()=>f("alertCritical"),className:"flex-1 p-2 rounded bg-red-900/50 hover:bg-red-800/50 text-red-300 text-xs transition-colors",disabled:!y.enabled||y.muted,children:"🚨 Alert"})]})]})})]})]})}const B2=[{value:"overview",label:"Overview",icon:"🌌"},{value:"security",label:"Security",icon:"🔒"},{value:"coverage",label:"Coverage",icon:"📊"},{value:"blast-radius",label:"Impact",icon:"💥"}];function Ua({title:r,children:e}){return L.jsxs("div",{children:[L.jsx("h3",{className:"text-sm font-medium text-slate-300 mb-2",children:r}),e]})}function gr({label:r,checked:e,onChange:t}){return L.jsxs("label",{className:"flex items-center justify-between cursor-pointer",children:[L.jsx("span",{className:"text-sm text-slate-300",children:r}),L.jsx("button",{onClick:()=>t(!e),className:`w-10 h-5 rounded-full transition-colors ${e?"bg-blue-500":"bg-slate-700"}`,children:L.jsx("div",{className:`w-4 h-4 rounded-full bg-white transition-transform ${e?"translate-x-5":"translate-x-0.5"}`})})]})}function k2(){const[r,e]=W.useState(!1),[t,n]=W.useState(""),{galaxyData:i,selectTable:s,selectEntryPoint:a,focusOnNode:c}=Fn(),u=W.useMemo(()=>{if(!i||!t.trim())return{tables:[],entryPoints:[],fields:[]};const f=t.toLowerCase(),m=i.tables.filter(S=>S.name.toLowerCase().includes(f)).slice(0,5),g=i.entryPoints.filter(S=>S.path.toLowerCase().includes(f)).slice(0,5),x=i.tables.flatMap(S=>S.fields.map(y=>({...y,tableName:S.name}))).filter(S=>S.name.toLowerCase().includes(f)).slice(0,5);return{tables:m,entryPoints:g,fields:x}},[i,t]);W.useEffect(()=>{const f=m=>{(m.metaKey||m.ctrlKey)&&m.key==="k"&&(m.preventDefault(),e(!0)),m.key==="Escape"&&(e(!1),n(""))};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[]);const h=W.useCallback((f,m)=>{f==="table"?s(m):a(m),c(m),e(!1),n("")},[s,a,c]),d=u.tables.length>0||u.entryPoints.length>0||u.fields.length>0;return L.jsxs(L.Fragment,{children:[L.jsxs("button",{onClick:()=>e(!0),className:"absolute left-4 top-4 flex items-center gap-2 px-3 py-2 rounded-lg bg-slate-800/80 hover:bg-slate-700 text-slate-400 text-sm transition-colors",children:[L.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:L.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),"Search...",L.jsx("kbd",{className:"px-1.5 py-0.5 rounded bg-slate-700 text-xs",children:"⌘K"})]}),r&&L.jsx("div",{className:"absolute inset-0 flex items-start justify-center pt-20 bg-black/50 backdrop-blur-sm z-50",children:L.jsxs("div",{className:"w-full max-w-lg bg-slate-900 rounded-lg border border-slate-700 shadow-2xl overflow-hidden",children:[L.jsxs("div",{className:"flex items-center gap-3 p-4 border-b border-slate-700",children:[L.jsx("svg",{className:"w-5 h-5 text-slate-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:L.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),L.jsx("input",{type:"text",value:t,onChange:f=>n(f.target.value),placeholder:"Search tables, fields, endpoints...",className:"flex-1 bg-transparent text-white placeholder-slate-500 outline-none",autoFocus:!0}),L.jsx("button",{onClick:()=>{e(!1),n("")},className:"text-slate-400 hover:text-white",children:L.jsx("kbd",{className:"px-1.5 py-0.5 rounded bg-slate-700 text-xs",children:"ESC"})})]}),t&&L.jsxs("div",{className:"max-h-80 overflow-y-auto",children:[!d&&L.jsx("p",{className:"p-4 text-slate-400 text-center",children:"No results found"}),u.tables.length>0&&L.jsx(vf,{title:"Tables",children:u.tables.map(f=>L.jsx(xf,{icon:"🪐",label:f.name,sublabel:`${f.fields.length} fields`,onClick:()=>h("table",f.id)},f.id))}),u.entryPoints.length>0&&L.jsx(vf,{title:"Entry Points",children:u.entryPoints.map(f=>L.jsx(xf,{icon:"🛸",label:f.path,sublabel:`${f.method} • ${f.framework}`,onClick:()=>h("entryPoint",f.id)},f.id))}),u.fields.length>0&&L.jsx(vf,{title:"Fields",children:u.fields.map(f=>L.jsx(xf,{icon:"🌙",label:f.name,sublabel:`${f.tableName} • ${f.dataType}`,onClick:()=>h("table",f.tableId)},f.id))})]})]})})]})}function vf({title:r,children:e}){return L.jsxs("div",{className:"border-b border-slate-800 last:border-0",children:[L.jsx("p",{className:"px-4 py-2 text-xs text-slate-500 uppercase",children:r}),e]})}function xf({icon:r,label:e,sublabel:t,onClick:n}){return L.jsxs("button",{onClick:n,className:"w-full flex items-center gap-3 px-4 py-2 hover:bg-slate-800 text-left transition-colors",children:[L.jsx("span",{children:r}),L.jsxs("div",{className:"flex-1 min-w-0",children:[L.jsx("p",{className:"text-white truncate",children:e}),L.jsx("p",{className:"text-slate-500 text-sm truncate",children:t})]})]})}function H2(){const{galaxyData:r,viewMode:e,isLiveMode:t}=Fn();if(!r)return null;const{stats:n}=r;return L.jsxs("div",{className:"absolute left-4 bottom-4 flex items-end gap-4",children:[L.jsx("div",{className:"bg-slate-900/80 backdrop-blur-sm rounded-lg p-3 border border-slate-700",children:L.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[L.jsx(yf,{icon:"🪐",value:n.tableCount,label:"Tables"}),L.jsx(yf,{icon:"🛸",value:n.entryPointCount,label:"Endpoints"}),L.jsx(yf,{icon:"🔗",value:n.pathCount,label:"Paths"}),L.jsx("div",{className:"w-px h-8 bg-slate-700"}),L.jsxs("div",{className:"text-center",children:[L.jsx("div",{className:"text-lg font-bold",style:{color:$R(n.healthScore)},children:n.healthScore}),L.jsx("div",{className:"text-slate-500 text-xs",children:"Health"})]})]})}),L.jsx("div",{className:"bg-slate-900/80 backdrop-blur-sm rounded-lg px-3 py-2 border border-slate-700",children:L.jsx("span",{className:"text-slate-400 text-sm",children:V2[e]})}),t&&L.jsxs("div",{className:"bg-green-500/20 backdrop-blur-sm rounded-lg px-3 py-2 border border-green-500/50 flex items-center gap-2",children:[L.jsx("span",{className:"w-2 h-2 rounded-full bg-green-500 animate-pulse"}),L.jsx("span",{className:"text-green-400 text-sm",children:"Live"})]})]})}function yf({icon:r,value:e,label:t}){return L.jsxs("div",{className:"text-center",children:[L.jsxs("div",{className:"flex items-center gap-1",children:[L.jsx("span",{children:r}),L.jsx("span",{className:"text-white font-medium",children:e})]}),L.jsx("div",{className:"text-slate-500 text-xs",children:t})]})}const V2={overview:"🌌 Overview",security:"🔒 Security",coverage:"📊 Coverage","blast-radius":"💥 Impact",timeline:"📅 Timeline"};function Sf(){const r=[{id:"users",name:"users",sensitivity:"high",cluster:"auth",fields:[{id:"users.id",name:"id",dataType:"uuid",isPrimaryKey:!0,sensitivity:"low"},{id:"users.email",name:"email",dataType:"varchar",sensitivity:"high"},{id:"users.password_hash",name:"password_hash",dataType:"varchar",sensitivity:"critical"},{id:"users.name",name:"name",dataType:"varchar",sensitivity:"medium"},{id:"users.created_at",name:"created_at",dataType:"timestamp",sensitivity:"low"}]},{id:"sessions",name:"sessions",sensitivity:"high",cluster:"auth",fields:[{id:"sessions.id",name:"id",dataType:"uuid",isPrimaryKey:!0,sensitivity:"low"},{id:"sessions.user_id",name:"user_id",dataType:"uuid",isForeignKey:!0,foreignKeyTarget:"users.id",sensitivity:"medium"},{id:"sessions.token",name:"token",dataType:"varchar",sensitivity:"critical"},{id:"sessions.expires_at",name:"expires_at",dataType:"timestamp",sensitivity:"low"}]},{id:"orders",name:"orders",sensitivity:"high",cluster:"commerce",fields:[{id:"orders.id",name:"id",dataType:"uuid",isPrimaryKey:!0,sensitivity:"low"},{id:"orders.user_id",name:"user_id",dataType:"uuid",isForeignKey:!0,foreignKeyTarget:"users.id",sensitivity:"medium"},{id:"orders.total",name:"total",dataType:"decimal",sensitivity:"high"},{id:"orders.status",name:"status",dataType:"varchar",sensitivity:"low"}]},{id:"products",name:"products",sensitivity:"low",cluster:"commerce",fields:[{id:"products.id",name:"id",dataType:"uuid",isPrimaryKey:!0,sensitivity:"low"},{id:"products.name",name:"name",dataType:"varchar",sensitivity:"public"},{id:"products.price",name:"price",dataType:"decimal",sensitivity:"public"},{id:"products.inventory",name:"inventory",dataType:"integer",sensitivity:"low"}]},{id:"payments",name:"payments",sensitivity:"critical",cluster:"commerce",fields:[{id:"payments.id",name:"id",dataType:"uuid",isPrimaryKey:!0,sensitivity:"low"},{id:"payments.order_id",name:"order_id",dataType:"uuid",isForeignKey:!0,foreignKeyTarget:"orders.id",sensitivity:"medium"},{id:"payments.card_last4",name:"card_last4",dataType:"varchar",sensitivity:"high"},{id:"payments.amount",name:"amount",dataType:"decimal",sensitivity:"high"}]},{id:"audit_logs",name:"audit_logs",sensitivity:"medium",cluster:"analytics",fields:[{id:"audit_logs.id",name:"id",dataType:"uuid",isPrimaryKey:!0,sensitivity:"low"},{id:"audit_logs.user_id",name:"user_id",dataType:"uuid",sensitivity:"medium"},{id:"audit_logs.action",name:"action",dataType:"varchar",sensitivity:"low"},{id:"audit_logs.timestamp",name:"timestamp",dataType:"timestamp",sensitivity:"low"}]}],e=[{id:"ep-login",path:"/api/auth/login",method:"POST",authLevel:"public",securityTier:"P0",file:"src/routes/auth.ts",line:15,framework:"Express",reachableTables:["users","sessions"]},{id:"ep-register",path:"/api/auth/register",method:"POST",authLevel:"public",securityTier:"P1",file:"src/routes/auth.ts",line:45,framework:"Express",reachableTables:["users"]},{id:"ep-profile",path:"/api/users/profile",method:"GET",authLevel:"authenticated",securityTier:"P2",file:"src/routes/users.ts",line:10,framework:"Express",reachableTables:["users"]},{id:"ep-orders",path:"/api/orders",method:"GET",authLevel:"authenticated",securityTier:"P2",file:"src/routes/orders.ts",line:20,framework:"Express",reachableTables:["orders","products"]},{id:"ep-checkout",path:"/api/checkout",method:"POST",authLevel:"authenticated",securityTier:"P0",file:"src/routes/checkout.ts",line:30,framework:"Express",reachableTables:["orders","payments","products"]},{id:"ep-products",path:"/api/products",method:"GET",authLevel:"public",securityTier:"P4",file:"src/routes/products.ts",line:5,framework:"Express",reachableTables:["products"]},{id:"ep-admin-users",path:"/api/admin/users",method:"GET",authLevel:"admin",securityTier:"P1",file:"src/routes/admin.ts",line:10,framework:"Express",reachableTables:["users","orders","audit_logs"]}],t=[{id:"path-1",sourceId:"ep-login",sourceType:"entryPoint",targetTableId:"users",operation:"read",frequency:1e3,depth:1,isTested:!0,sensitivity:"high"},{id:"path-2",sourceId:"ep-login",sourceType:"entryPoint",targetTableId:"sessions",operation:"write",frequency:1e3,depth:2,isTested:!0,sensitivity:"critical"},{id:"path-3",sourceId:"ep-register",sourceType:"entryPoint",targetTableId:"users",operation:"write",frequency:100,depth:1,isTested:!1,sensitivity:"high"},{id:"path-4",sourceId:"ep-profile",sourceType:"entryPoint",targetTableId:"users",operation:"read",frequency:500,depth:1,isTested:!0,sensitivity:"high"},{id:"path-5",sourceId:"ep-orders",sourceType:"entryPoint",targetTableId:"orders",operation:"read",frequency:300,depth:1,isTested:!0,sensitivity:"high"},{id:"path-6",sourceId:"ep-checkout",sourceType:"entryPoint",targetTableId:"orders",operation:"write",frequency:50,depth:1,isTested:!1,sensitivity:"high"},{id:"path-7",sourceId:"ep-checkout",sourceType:"entryPoint",targetTableId:"payments",operation:"write",frequency:50,depth:2,isTested:!1,sensitivity:"critical"},{id:"path-8",sourceId:"ep-products",sourceType:"entryPoint",targetTableId:"products",operation:"read",frequency:2e3,depth:1,isTested:!0,sensitivity:"public"},{id:"path-9",sourceId:"ep-admin-users",sourceType:"entryPoint",targetTableId:"users",operation:"read",frequency:10,depth:1,isTested:!0,sensitivity:"high"},{id:"path-10",sourceId:"ep-admin-users",sourceType:"entryPoint",targetTableId:"audit_logs",operation:"read",frequency:10,depth:2,isTested:!1,sensitivity:"medium"}],n=[{id:"rel-1",sourceTableId:"sessions",sourceFieldId:"sessions.user_id",targetTableId:"users",targetFieldId:"users.id",type:"one-to-many"},{id:"rel-2",sourceTableId:"orders",sourceFieldId:"orders.user_id",targetTableId:"users",targetFieldId:"users.id",type:"one-to-many"},{id:"rel-3",sourceTableId:"payments",sourceFieldId:"payments.order_id",targetTableId:"orders",targetFieldId:"orders.id",type:"one-to-one"}];return{tables:r.map(i=>({...i,rowCount:Math.floor(Math.random()*1e5),accessCount:Math.floor(Math.random()*1e3)})),entryPoints:e,dataPaths:t,relationships:n}}function G2(){const{setGalaxyData:r,setLoading:e,setError:t,isLoading:n,error:i,galaxyData:s}=Fn(),[a,c]=W.useState(!1),[u,h]=W.useState("api"),d=W.useCallback(async()=>{var f;e(!0),t(null);try{let m,g="api";if(a)m=Sf(),g="mock";else try{const _=await fetch("/api/galaxy");if(!_.ok)throw new Error(`HTTP ${_.status}: ${_.statusText}`);m=await _.json(),(!m.tables||m.tables.length===0)&&(console.log("No tables found in API response, falling back to mock data"),m=Sf(),g="mock")}catch(_){console.log("API fetch failed, falling back to mock data:",_),m=Sf(),g="mock"}h(g);const{tables:x,entryPoints:S}=L2(m.tables,m.entryPoints,m.dataPaths),y=m.stats??{tableCount:x.length,fieldCount:x.reduce((_,b)=>_+b.fields.length,0),entryPointCount:S.length,pathCount:m.dataPaths.length,sensitiveFields:{critical:x.reduce((_,b)=>_+b.fields.filter(M=>M.sensitivity==="critical").length,0),high:x.reduce((_,b)=>_+b.fields.filter(M=>M.sensitivity==="high").length,0),medium:x.reduce((_,b)=>_+b.fields.filter(M=>M.sensitivity==="medium").length,0),low:x.reduce((_,b)=>_+b.fields.filter(M=>M.sensitivity==="low").length,0),public:x.reduce((_,b)=>_+b.fields.filter(M=>M.sensitivity==="public").length,0)},untestedPaths:m.dataPaths.filter(_=>!_.isTested).length,deadCodeCount:0,healthScore:((f=m.stats)==null?void 0:f.healthScore)??72};r({tables:x,entryPoints:S,dataPaths:m.dataPaths,relationships:m.relationships??[],stats:y,lastUpdated:m.lastUpdated??new Date().toISOString()})}catch(m){t(m instanceof Error?m.message:"Failed to load galaxy data")}},[a,r,e,t]);return W.useEffect(()=>{d()},[d]),{isLoading:n,error:i,data:s,refetch:d,useMock:a,setUseMock:c,dataSource:u}}function W2(){const{viewMode:r,setViewMode:e,togglePanel:t,activePanel:n}=Fn();return L.jsxs("div",{className:"absolute right-4 top-4 flex items-center gap-2 z-10",children:[L.jsx("div",{className:"flex bg-slate-800/80 rounded-lg overflow-hidden",children:[{mode:"overview",icon:"🌌",label:"Overview"},{mode:"security",icon:"🔒",label:"Security"},{mode:"coverage",icon:"📊",label:"Coverage"}].map(({mode:i,icon:s,label:a})=>L.jsx("button",{onClick:()=>e(i),className:`px-3 py-2 text-sm transition-colors ${r===i?"bg-blue-500/30 text-blue-400":"text-slate-400 hover:text-white hover:bg-slate-700"}`,title:a,children:s},i))}),L.jsxs("div",{className:"flex bg-slate-800/80 rounded-lg overflow-hidden",children:[L.jsx("button",{onClick:()=>t("security"),className:`px-3 py-2 text-sm transition-colors ${n==="security"?"bg-red-500/30 text-red-400":"text-slate-400 hover:text-white"}`,title:"Security Panel",children:"🛡️"}),L.jsx("button",{onClick:()=>t("settings"),className:`px-3 py-2 text-sm transition-colors ${n==="settings"?"bg-purple-500/30 text-purple-400":"text-slate-400 hover:text-white"}`,title:"Settings",children:"⚙️"})]})]})}function j2({dataSource:r,useMock:e,setUseMock:t,tableCount:n,entryPointCount:i}){return L.jsxs("div",{className:"absolute left-4 top-4 z-10 flex flex-col gap-2",children:[L.jsxs("label",{className:"flex items-center gap-2 text-sm text-slate-400 bg-slate-800/80 px-3 py-2 rounded-lg cursor-pointer",children:[L.jsx("input",{type:"checkbox",checked:e,onChange:s=>t(s.target.checked),className:"rounded"}),"Use Mock Data"]}),L.jsxs("div",{className:`text-xs px-3 py-1.5 rounded-lg ${r==="api"?"bg-green-500/20 text-green-400":"bg-yellow-500/20 text-yellow-400"}`,children:[r==="api"?"🔗 Live Data":"🎭 Mock Data",L.jsxs("span",{className:"ml-2 opacity-70",children:[n," tables • ",i," endpoints"]})]})]})}function $2(){const{isLoading:r,error:e,data:t,refetch:n,useMock:i,setUseMock:s,dataSource:a}=G2();return e&&!t?L.jsxs("div",{className:"flex flex-col items-center justify-center h-[calc(100vh-200px)] text-center",children:[L.jsx("div",{className:"text-6xl mb-4",children:"🌑"}),L.jsx("h2",{className:"text-xl font-semibold text-white mb-2",children:"Galaxy Unavailable"}),L.jsx("p",{className:"text-slate-400 mb-4",children:e}),L.jsxs("div",{className:"flex gap-3",children:[L.jsx("button",{onClick:n,className:"px-4 py-2 bg-blue-500 hover:bg-blue-600 text-white rounded-lg transition-colors",children:"Retry"}),L.jsx("button",{onClick:()=>s(!0),className:"px-4 py-2 bg-slate-600 hover:bg-slate-500 text-white rounded-lg transition-colors",children:"Use Mock Data"})]})]}):r&&!t?L.jsxs("div",{className:"flex flex-col items-center justify-center h-[calc(100vh-200px)]",children:[L.jsx("div",{className:"text-6xl mb-4 animate-pulse",children:"🌌"}),L.jsx("p",{className:"text-slate-400",children:"Loading galaxy..."}),L.jsx("p",{className:"text-slate-500 text-sm mt-2",children:"Scanning boundaries and call graph..."})]}):L.jsxs("div",{className:"relative h-[calc(100vh-200px)] bg-slate-950 rounded-lg overflow-hidden",children:[L.jsx(j2,{dataSource:a,useMock:i,setUseMock:s,tableCount:(t==null?void 0:t.tables.length)??0,entryPointCount:(t==null?void 0:t.entryPoints.length)??0}),L.jsx(W2,{}),L.jsx(y2,{className:"w-full h-full"}),L.jsx(k2,{}),L.jsx(H2,{}),L.jsx(I2,{}),L.jsx(O2,{}),L.jsx(z2,{})]})}export{$2 as GalaxyTab};
4177
- //# sourceMappingURL=GalaxyTab-Bc9PKsMk.js.map
4176
+ `)}}}const VR=W.forwardRef((r,e)=>{const[t]=W.useState(()=>new HR(null));return W.createElement("primitive",Ei({},r,{object:t,ref:e,attach:"material"}))});function GR(r,e){const t=r+"Geometry";return W.forwardRef(({args:n,children:i,...s},a)=>{const c=W.useRef(null);return W.useImperativeHandle(a,()=>c.current),W.useLayoutEffect(()=>void(e==null?void 0:e(c.current))),W.createElement("mesh",Ei({ref:c},s),W.createElement(t,{attach:"geometry",args:n}),i)})}const gp=GR("sphere");let Ss,Da;const WR=W.createContext(null),q_=new lt,Y_=new U,jR=W.forwardRef(({children:r,range:e,limit:t=1e3,...n},i)=>{const s=W.useRef(null);W.useImperativeHandle(i,()=>s.current,[]);const[a,c]=W.useState([]),[[u,h,d]]=W.useState(()=>[new Float32Array(t*3),Float32Array.from({length:t*3},()=>1),Float32Array.from({length:t},()=>1)]);W.useEffect(()=>{s.current.geometry.attributes.position.needsUpdate=!0}),Bi(()=>{for(s.current.updateMatrix(),s.current.updateMatrixWorld(),q_.copy(s.current.matrixWorld).invert(),s.current.geometry.drawRange.count=Math.min(t,e!==void 0?e:t,a.length),Ss=0;Ss<a.length;Ss++)Da=a[Ss].current,Da.getWorldPosition(Y_).applyMatrix4(q_),Y_.toArray(u,Ss*3),s.current.geometry.attributes.position.needsUpdate=!0,Da.matrixWorldNeedsUpdate=!0,Da.color.toArray(h,Ss*3),s.current.geometry.attributes.color.needsUpdate=!0,d.set([Da.size],Ss),s.current.geometry.attributes.size.needsUpdate=!0});const f=W.useMemo(()=>({getParent:()=>s,subscribe:m=>(c(g=>[...g,m]),()=>c(g=>g.filter(x=>x.current!==m.current)))}),[]);return W.createElement("points",Ei({userData:{instances:a},matrixAutoUpdate:!1,ref:s,raycast:()=>null},n),W.createElement("bufferGeometry",null,W.createElement("bufferAttribute",{attach:"attributes-position",count:u.length/3,array:u,itemSize:3,usage:Ds}),W.createElement("bufferAttribute",{attach:"attributes-color",count:h.length/3,array:h,itemSize:3,usage:Ds}),W.createElement("bufferAttribute",{attach:"attributes-size",count:d.length,array:d,itemSize:1,usage:Ds})),W.createElement(WR.Provider,{value:f},r))}),XR=W.forwardRef(({children:r,positions:e,colors:t,sizes:n,stride:i=3,...s},a)=>{const c=W.useRef(null);return W.useImperativeHandle(a,()=>c.current,[]),Bi(()=>{const u=c.current.geometry.attributes;u.position.needsUpdate=!0,t&&(u.color.needsUpdate=!0),n&&(u.size.needsUpdate=!0)}),W.createElement("points",Ei({ref:c},s),W.createElement("bufferGeometry",null,W.createElement("bufferAttribute",{attach:"attributes-position",count:e.length/i,array:e,itemSize:i,usage:Ds}),t&&W.createElement("bufferAttribute",{attach:"attributes-color",count:t.length/i,array:t,itemSize:3,usage:Ds}),n&&W.createElement("bufferAttribute",{attach:"attributes-size",count:n.length/i,array:n,itemSize:1,usage:Ds})),r)}),qR=W.forwardRef((r,e)=>r.positions instanceof Float32Array?W.createElement(XR,Ei({},r,{ref:e})):W.createElement(jR,Ei({},r,{ref:e})));function El(r){return new ke(r)}function dm(r){return El(Is[r])}function Uy(r){return IS[r]}function YR(r){return El(K_[r])}function ZR(r){return El(Q_[r])}function JR(r){return El(NS[r])}function KR(r){return Xg[r]??Xg.other??"#7f8c8d"}function QR(r){return El(KR(r))}function $R(r){return r>=80?"#22c55e":r>=60?"#eab308":r>=40?"#f97316":"#ef4444"}function Mi(r){return new U(r.x,r.y,r.z)}function e2(r,e){const t=e.x-r.x,n=e.y-r.y,i=e.z-r.z;return Math.sqrt(t*t+n*n+i*i)}function Oy(r,e){return{x:(r.x+e.x)/2,y:(r.y+e.y)/2,z:(r.z+e.z)/2}}function Z_(r){const e=Math.sqrt(r.x*r.x+r.y*r.y+r.z*r.z);return e===0?{x:0,y:0,z:0}:{x:r.x/e,y:r.y/e,z:r.z/e}}function t2(r,e){return{x:r.x-e.x,y:r.y-e.y,z:r.z-e.z}}function n2(r,e,t=50,n=.3){const i=Oy(r,e),s=e2(r,e),a=Z_(t2(e,r)),c=Z_({x:-a.z,y:a.y+n*s,z:a.x}),u={x:i.x+c.x*s*n,y:i.y+c.y*s*n,z:i.z+c.z*s*n};return new Vp([Mi(r),Mi(u),Mi(e)])}function i2(r,e,t,n=0){const i=r.x+Math.cos(t)*e,s=r.y+Math.sin(n)*Math.sin(t)*e*.3,a=r.z+Math.sin(t)*e;return{x:i,y:s,z:a}}function r2(r,e,t=.5,n=3){const i=Math.log10(r+1)/6,s=Math.log10(e+1)/4,a=i*.6+s*.4;return t+a*(n-t)}function s2(r,e,t=.15){const n=Math.log10(r+1)/3,i=e?1.5:1;return t*(1+n*.5)*i}function o2(r,e=.05,t=.3){const n=Math.log10(r+1)/3;return e+n*(t-e)}const J_={hover:{oldParams:!0,wave_type:1,p_env_attack:0,p_env_sustain:.05,p_env_punch:0,p_env_decay:.1,p_base_freq:.5,p_freq_limit:0,p_freq_ramp:.1,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:0,p_arp_speed:0,p_duty:.5,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:1,p_lpf_ramp:0,p_lpf_resonance:0,p_hpf_freq:.1,p_hpf_ramp:0,sound_vol:.15,sample_rate:44100,sample_size:8},select:{oldParams:!0,wave_type:0,p_env_attack:0,p_env_sustain:.1,p_env_punch:.3,p_env_decay:.2,p_base_freq:.4,p_freq_limit:0,p_freq_ramp:.2,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:.5,p_arp_speed:.6,p_duty:0,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:1,p_lpf_ramp:0,p_lpf_resonance:0,p_hpf_freq:0,p_hpf_ramp:0,sound_vol:.2,sample_rate:44100,sample_size:8},deselect:{oldParams:!0,wave_type:0,p_env_attack:0,p_env_sustain:.05,p_env_punch:0,p_env_decay:.15,p_base_freq:.5,p_freq_limit:0,p_freq_ramp:-.2,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:0,p_arp_speed:0,p_duty:0,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:.8,p_lpf_ramp:-.2,p_lpf_resonance:0,p_hpf_freq:0,p_hpf_ramp:0,sound_vol:.15,sample_rate:44100,sample_size:8},zoom:{oldParams:!0,wave_type:3,p_env_attack:.1,p_env_sustain:.2,p_env_punch:0,p_env_decay:.3,p_base_freq:.1,p_freq_limit:0,p_freq_ramp:.3,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:0,p_arp_speed:0,p_duty:0,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:.5,p_lpf_ramp:.2,p_lpf_resonance:.5,p_hpf_freq:.1,p_hpf_ramp:0,sound_vol:.1,sample_rate:44100,sample_size:8},pathActivate:{oldParams:!0,wave_type:2,p_env_attack:0,p_env_sustain:.15,p_env_punch:.2,p_env_decay:.25,p_base_freq:.3,p_freq_limit:0,p_freq_ramp:.15,p_freq_dramp:0,p_vib_strength:.1,p_vib_speed:.3,p_arp_mod:0,p_arp_speed:0,p_duty:0,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:.7,p_lpf_ramp:0,p_lpf_resonance:.3,p_hpf_freq:.05,p_hpf_ramp:0,sound_vol:.18,sample_rate:44100,sample_size:8},dataFlow:{oldParams:!0,wave_type:0,p_env_attack:.05,p_env_sustain:.1,p_env_punch:0,p_env_decay:.1,p_base_freq:.6,p_freq_limit:0,p_freq_ramp:0,p_freq_dramp:0,p_vib_strength:.2,p_vib_speed:.5,p_arp_mod:0,p_arp_speed:0,p_duty:0,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:.6,p_lpf_ramp:0,p_lpf_resonance:0,p_hpf_freq:.2,p_hpf_ramp:0,sound_vol:.08,sample_rate:44100,sample_size:8},alertLow:{oldParams:!0,wave_type:0,p_env_attack:0,p_env_sustain:.1,p_env_punch:0,p_env_decay:.2,p_base_freq:.35,p_freq_limit:0,p_freq_ramp:0,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:0,p_arp_speed:0,p_duty:0,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:1,p_lpf_ramp:0,p_lpf_resonance:0,p_hpf_freq:0,p_hpf_ramp:0,sound_vol:.15,sample_rate:44100,sample_size:8},alertMedium:{oldParams:!0,wave_type:1,p_env_attack:0,p_env_sustain:.15,p_env_punch:.1,p_env_decay:.15,p_base_freq:.4,p_freq_limit:0,p_freq_ramp:0,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:.3,p_arp_speed:.5,p_duty:.5,p_duty_ramp:0,p_repeat_speed:.5,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:1,p_lpf_ramp:0,p_lpf_resonance:0,p_hpf_freq:0,p_hpf_ramp:0,sound_vol:.18,sample_rate:44100,sample_size:8},alertHigh:{oldParams:!0,wave_type:1,p_env_attack:0,p_env_sustain:.2,p_env_punch:.2,p_env_decay:.1,p_base_freq:.5,p_freq_limit:0,p_freq_ramp:0,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:.4,p_arp_speed:.4,p_duty:.5,p_duty_ramp:0,p_repeat_speed:.4,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:1,p_lpf_ramp:0,p_lpf_resonance:0,p_hpf_freq:0,p_hpf_ramp:0,sound_vol:.22,sample_rate:44100,sample_size:8},alertCritical:{oldParams:!0,wave_type:1,p_env_attack:0,p_env_sustain:.25,p_env_punch:.3,p_env_decay:.1,p_base_freq:.6,p_freq_limit:0,p_freq_ramp:-.1,p_freq_dramp:0,p_vib_strength:.1,p_vib_speed:.8,p_arp_mod:.5,p_arp_speed:.3,p_duty:.5,p_duty_ramp:0,p_repeat_speed:.3,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:1,p_lpf_ramp:0,p_lpf_resonance:0,p_hpf_freq:0,p_hpf_ramp:0,sound_vol:.25,sample_rate:44100,sample_size:8},warp:{oldParams:!0,wave_type:3,p_env_attack:.1,p_env_sustain:.3,p_env_punch:.2,p_env_decay:.4,p_base_freq:.05,p_freq_limit:0,p_freq_ramp:.4,p_freq_dramp:.1,p_vib_strength:0,p_vib_speed:0,p_arp_mod:0,p_arp_speed:0,p_duty:0,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:.3,p_lpf_ramp:.3,p_lpf_resonance:.5,p_hpf_freq:0,p_hpf_ramp:.1,sound_vol:.2,sample_rate:44100,sample_size:8},scan:{oldParams:!0,wave_type:2,p_env_attack:.05,p_env_sustain:.4,p_env_punch:0,p_env_decay:.2,p_base_freq:.2,p_freq_limit:0,p_freq_ramp:.2,p_freq_dramp:-.1,p_vib_strength:.3,p_vib_speed:.6,p_arp_mod:0,p_arp_speed:0,p_duty:0,p_duty_ramp:0,p_repeat_speed:.6,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:.5,p_lpf_ramp:0,p_lpf_resonance:.3,p_hpf_freq:.1,p_hpf_ramp:0,sound_vol:.12,sample_rate:44100,sample_size:8},powerUp:{oldParams:!0,wave_type:0,p_env_attack:0,p_env_sustain:.2,p_env_punch:.3,p_env_decay:.3,p_base_freq:.2,p_freq_limit:0,p_freq_ramp:.3,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:.5,p_arp_speed:.5,p_duty:0,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:1,p_lpf_ramp:0,p_lpf_resonance:0,p_hpf_freq:0,p_hpf_ramp:0,sound_vol:.2,sample_rate:44100,sample_size:8},powerDown:{oldParams:!0,wave_type:0,p_env_attack:0,p_env_sustain:.15,p_env_punch:0,p_env_decay:.4,p_base_freq:.5,p_freq_limit:0,p_freq_ramp:-.3,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:-.3,p_arp_speed:.5,p_duty:0,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:.8,p_lpf_ramp:-.3,p_lpf_resonance:0,p_hpf_freq:0,p_hpf_ramp:0,sound_vol:.18,sample_rate:44100,sample_size:8},click:{oldParams:!0,wave_type:1,p_env_attack:0,p_env_sustain:.02,p_env_punch:0,p_env_decay:.05,p_base_freq:.6,p_freq_limit:0,p_freq_ramp:0,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:0,p_arp_speed:0,p_duty:.5,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:1,p_lpf_ramp:0,p_lpf_resonance:0,p_hpf_freq:.3,p_hpf_ramp:0,sound_vol:.12,sample_rate:44100,sample_size:8},blip:{oldParams:!0,wave_type:0,p_env_attack:0,p_env_sustain:.05,p_env_punch:0,p_env_decay:.1,p_base_freq:.55,p_freq_limit:0,p_freq_ramp:.1,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:0,p_arp_speed:0,p_duty:0,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:1,p_lpf_ramp:0,p_lpf_resonance:0,p_hpf_freq:.1,p_hpf_ramp:0,sound_vol:.15,sample_rate:44100,sample_size:8}};class a2{constructor(e={}){co(this,"config");co(this,"audioCache",new Map);co(this,"sfxr",null);co(this,"initialized",!1);co(this,"initPromise",null);this.config={enabled:!0,volume:.5,muted:!1,...e}}async initialize(){if(!this.initialized)return this.initPromise?this.initPromise:(this.initPromise=this.doInitialize(),this.initPromise)}async doInitialize(){try{this.sfxr=await DS(()=>import("./sfxr-Cr89uVKo.js").then(e=>e.s),__vite__mapDeps([0,1,2]));for(const[e,t]of Object.entries(J_)){const n=this.sfxr.sfxr.toAudio(t);this.audioCache.set(e,n)}this.initialized=!0}catch(e){console.warn("Failed to initialize Galaxy sound engine:",e),this.config.enabled=!1}}async play(e){if(!this.config.enabled||this.config.muted)return;this.initialized||await this.initialize();const t=this.audioCache.get(e);if(t)try{const n=t.cloneNode();n.volume=this.config.volume,await n.play()}catch{}}async playWithVariation(e,t=.1){if(!this.config.enabled||this.config.muted||!this.sfxr)return;this.initialized||await this.initialize();const n={...J_[e]},i=n.p_base_freq;n.p_base_freq=i*(1+(Math.random()-.5)*t*2);try{const s=this.sfxr.sfxr.toAudio(n);s.volume=this.config.volume,await s.play()}catch{}}async playAlert(e){const t={low:"alertLow",medium:"alertMedium",high:"alertHigh",critical:"alertCritical"};await this.play(t[e])}setConfig(e){this.config={...this.config,...e}}getConfig(){return{...this.config}}toggleMute(){return this.config.muted=!this.config.muted,this.config.muted}setVolume(e){this.config.volume=Math.max(0,Math.min(1,e))}setEnabled(e){this.config.enabled=e}}let gf=null;function l2(){return gf||(gf=new a2),gf}function fm(r={}){const{enabled:e=!0,volume:t=.5,debounceMs:n=50}=r,i=l2(),s=W.useRef(new Map);W.useEffect(()=>{i.setConfig({enabled:e,volume:t})},[e,t,i]);const a=W.useCallback(g=>{const x=Date.now(),S=s.current.get(g)??0;x-S<n||(s.current.set(g,x),i.play(g))},[i,n]),c=W.useCallback((g,x=.1)=>{const S=Date.now(),y=s.current.get(g)??0;S-y<n||(s.current.set(g,S),i.playWithVariation(g,x))},[i,n]),u=W.useCallback(g=>{i.playAlert(g)},[i]),h=W.useCallback(()=>i.toggleMute(),[i]),d=W.useCallback(g=>{i.setVolume(g)},[i]),f=W.useCallback(()=>i.getConfig(),[i]),m=W.useCallback(g=>{i.setConfig(g)},[i]);return{play:a,playVaried:c,playAlert:u,toggleMute:h,setVolume:d,getConfig:f,setConfig:m}}function c2({table:r,isSelected:e=!1,isHovered:t=!1,onClick:n,onPointerOver:i,onPointerOut:s}){const a=W.useRef(null),c=W.useRef(null),[u,h]=W.useState(!1),{display:d,viewMode:f}=Fn(),{play:m,playVaried:g}=fm({debounceMs:100}),x=W.useCallback(R=>{R.stopPropagation(),h(!0);const C=r.sensitivity==="critical"?.3:.1;g("hover",C),i==null||i()},[r.sensitivity,g,i]),S=W.useCallback(R=>{R.stopPropagation(),h(!1),s==null||s()},[s]),y=W.useCallback(()=>{m("select"),n==null||n()},[m,n]),_=W.useMemo(()=>r2(r.rowCount,r.accessCount,qg.MIN_RADIUS,qg.MAX_RADIUS),[r.rowCount,r.accessCount]),b=W.useMemo(()=>{const R=dm(r.sensitivity),C=Uy(r.sensitivity),N=QR(r.cluster||"other");return{main:R,emissive:R,emissiveIntensity:C,cluster:N}},[r.sensitivity,r.cluster]),M=W.useMemo(()=>r.position?Mi(r.position):new U(0,0,0),[r.position]);Bi((R,C)=>{if(!a.current)return;a.current.rotation.y+=Wr.IDLE_ROTATION*d.animationSpeed;const N=e?Wr.SELECTION_SCALE:t||u?Wr.HOVER_SCALE:1;if(a.current.scale.lerp(new U(N,N,N),.1),c.current&&r.sensitivity!=="public"){const B=Math.sin(R.clock.elapsedTime*Wr.PULSE_FREQUENCY)*.5+.5,A=c.current.material;A.opacity=.1+B*.2*b.emissiveIntensity}});const T=f==="security"&&(r.sensitivity==="critical"||r.sensitivity==="high");return L.jsxs("group",{position:M,children:[L.jsx(gp,{ref:a,args:[_,32,32],onClick:y,onPointerOver:x,onPointerOut:S,children:L.jsx("meshStandardMaterial",{color:b.main,emissive:b.emissive,emissiveIntensity:T?b.emissiveIntensity*2:b.emissiveIntensity,roughness:.7,metalness:.3})}),r.sensitivity!=="public"&&d.enableBloom&&L.jsx(gp,{ref:c,args:[_*1.3,16,16],children:L.jsx("meshBasicMaterial",{color:b.main,transparent:!0,opacity:.15,side:An})}),e&&L.jsxs("mesh",{rotation:[Math.PI/2,0,0],children:[L.jsx("ringGeometry",{args:[_*1.5,_*1.7,32]}),L.jsx("meshBasicMaterial",{color:"#ffffff",transparent:!0,opacity:.8,side:Si})]}),d.showLabels&&(t||u||e)&&L.jsx(cm,{position:[0,_+Gn.OFFSET,0],center:!0,style:{pointerEvents:"none",userSelect:"none"},children:L.jsxs("div",{style:{background:`rgba(15, 23, 42, ${Gn.BG_OPACITY})`,color:"#f8fafc",padding:`${Gn.PADDING}px ${Gn.PADDING*2}px`,borderRadius:"4px",fontSize:`${Gn.FONT_SIZE}px`,fontFamily:Gn.FONT_FAMILY,whiteSpace:"nowrap",border:`1px solid ${b.main.getStyle()}`},children:[L.jsx("div",{style:{fontWeight:600},children:r.name}),L.jsxs("div",{style:{fontSize:"10px",opacity:.7},children:[r.fields.length," fields • ",r.accessCount," accesses"]})]})})]})}function u2({field:r,parentPosition:e,parentRadius:t,orbitIndex:n,totalFields:i,isSelected:s=!1,isHovered:a=!1,onClick:c,onPointerOver:u,onPointerOut:h}){const d=W.useRef(null),f=W.useRef(n/i*Math.PI*2+Math.random()*.5),{display:m,viewMode:g}=Fn(),x=W.useMemo(()=>{const M=r.sensitivity!=="public"&&r.sensitivity!=="low";return s2(r.accessCount,M,xd.RADIUS)},[r.accessCount,r.sensitivity]),S=W.useMemo(()=>{const M=dm(r.sensitivity),T=Uy(r.sensitivity);return{main:M,emissive:M,emissiveIntensity:T}},[r.sensitivity]),y=t+xd.ORBIT_RADIUS,_=W.useMemo(()=>(n%3-1)*.3,[n]);Bi((M,T)=>{if(!d.current)return;f.current+=xd.ORBIT_SPEED*T*m.animationSpeed;const R=i2(e,y,f.current,_);d.current.position.set(R.x,R.y,R.z),d.current.rotation.y+=.02*m.animationSpeed;const C=s?Wr.SELECTION_SCALE:a?Wr.HOVER_SCALE:1;d.current.scale.lerp(new U(C,C,C),.1)});const b=g==="security"&&(r.sensitivity==="critical"||r.sensitivity==="high");return m.showFields?L.jsxs("group",{children:[L.jsx(gp,{ref:d,args:[x,16,16],onClick:M=>{M.stopPropagation(),c==null||c()},onPointerOver:M=>{M.stopPropagation(),u==null||u()},onPointerOut:M=>{M.stopPropagation(),h==null||h()},children:L.jsx("meshStandardMaterial",{color:S.main,emissive:S.emissive,emissiveIntensity:b?S.emissiveIntensity*3:S.emissiveIntensity,roughness:.5,metalness:.5})}),m.showLabels&&a&&d.current&&L.jsx(cm,{position:d.current.position.clone().add(new U(0,x+.3,0)),center:!0,style:{pointerEvents:"none",userSelect:"none"},children:L.jsxs("div",{style:{background:`rgba(15, 23, 42, ${Gn.BG_OPACITY})`,color:"#f8fafc",padding:`${Gn.PADDING}px ${Gn.PADDING*2}px`,borderRadius:"4px",fontSize:"10px",fontFamily:Gn.FONT_FAMILY,whiteSpace:"nowrap",border:`1px solid ${S.main.getStyle()}`},children:[L.jsx("div",{style:{fontWeight:600},children:r.name}),L.jsxs("div",{style:{opacity:.7},children:[r.dataType," • ",r.sensitivity]}),r.isPrimaryKey&&L.jsx("div",{style:{color:"#fbbf24"},children:"🔑 Primary Key"}),r.isForeignKey&&L.jsx("div",{style:{color:"#60a5fa"},children:"🔗 Foreign Key"}),!r.isTested&&L.jsx("div",{style:{color:"#ef4444"},children:"⚠️ Untested"})]})})]}):null}const _f={GET:"#22c55e",POST:"#3b82f6",PUT:"#f59e0b",PATCH:"#8b5cf6",DELETE:"#ef4444",ALL:"#6b7280"};function h2({entryPoint:r,isSelected:e=!1,isHovered:t=!1,onClick:n,onPointerOver:i,onPointerOut:s}){const a=W.useRef(null),[c,u]=W.useState(!1),{display:h,viewMode:d}=Fn(),{play:f,playAlert:m}=fm({debounceMs:100}),g=W.useCallback(T=>{T.stopPropagation(),u(!0),r.authLevel==="public"?m("medium"):f("hover"),i==null||i()},[r.authLevel,f,m,i]),x=W.useCallback(T=>{T.stopPropagation(),u(!1),s==null||s()},[s]),S=W.useCallback(()=>{r.securityTier==="P0"?m("critical"):r.securityTier==="P1"?m("high"):f("select"),n==null||n()},[r.securityTier,f,m,n]),y=W.useMemo(()=>{const T=ZR(r.authLevel),R=YR(r.securityTier),C=new ke(_f[r.method]??_f.ALL??"#6b7280");return{auth:T,tier:R,method:C}},[r.authLevel,r.securityTier,r.method]),_=W.useMemo(()=>r.position?Mi(r.position):new U(0,0,0),[r.position]);Bi((T,R)=>{if(!a.current)return;a.current.rotation.y+=.005*h.animationSpeed;const C=e?Wr.SELECTION_SCALE:t||c?Wr.HOVER_SCALE:1;a.current.scale.lerp(new U(C,C,C),.1)});const b=d==="security"&&r.authLevel==="public",M=US.SCALE;return L.jsxs("group",{ref:a,position:_,onClick:S,onPointerOver:g,onPointerOut:x,children:[L.jsxs("mesh",{children:[L.jsx("octahedronGeometry",{args:[M,0]}),L.jsx("meshStandardMaterial",{color:y.auth,emissive:y.auth,emissiveIntensity:b?.8:.3,roughness:.3,metalness:.7})]}),L.jsxs("mesh",{children:[L.jsx("octahedronGeometry",{args:[M*.5,0]}),L.jsx("meshStandardMaterial",{color:y.method,emissive:y.method,emissiveIntensity:.5,roughness:.2,metalness:.8})]}),L.jsxs("mesh",{rotation:[Math.PI/2,0,0],children:[L.jsx("torusGeometry",{args:[M*1.5,M*.1,8,32]}),L.jsx("meshStandardMaterial",{color:y.tier,emissive:y.tier,emissiveIntensity:.4,roughness:.4,metalness:.6})]}),e&&L.jsxs("mesh",{rotation:[0,0,Math.PI/4],children:[L.jsx("torusGeometry",{args:[M*2,M*.05,8,32]}),L.jsx("meshBasicMaterial",{color:"#ffffff",transparent:!0,opacity:.8})]}),r.authLevel==="public"&&h.enableBloom&&L.jsxs("mesh",{children:[L.jsx("sphereGeometry",{args:[M*2,16,16]}),L.jsx("meshBasicMaterial",{color:"#ff3333",transparent:!0,opacity:.1,side:An})]}),h.showLabels&&(t||c||e)&&L.jsx(cm,{position:[0,M*2,0],center:!0,style:{pointerEvents:"none",userSelect:"none"},children:L.jsxs("div",{style:{background:`rgba(15, 23, 42, ${Gn.BG_OPACITY})`,color:"#f8fafc",padding:`${Gn.PADDING}px ${Gn.PADDING*2}px`,borderRadius:"4px",fontSize:`${Gn.FONT_SIZE}px`,fontFamily:Gn.FONT_FAMILY,whiteSpace:"nowrap",border:`1px solid ${y.auth.getStyle()}`,maxWidth:"250px"},children:[L.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[L.jsx("span",{style:{background:_f[r.method],padding:"2px 6px",borderRadius:"3px",fontSize:"10px",fontWeight:700},children:r.method}),L.jsx("span",{style:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis"},children:r.path})]}),L.jsxs("div",{style:{fontSize:"10px",opacity:.7,marginTop:"4px"},children:[r.framework," • ",r.authLevel,r.authLevel==="public"&&L.jsx("span",{style:{color:"#ef4444",marginLeft:"4px"},children:"⚠️ PUBLIC"})]}),L.jsxs("div",{style:{fontSize:"10px",opacity:.7},children:["Reaches ",r.reachableTables.length," tables"]})]})})]})}function d2({path:r,sourcePosition:e,targetPosition:t,isSelected:n=!1,isHovered:i=!1,onClick:s,onPointerOver:a,onPointerOut:c}){const u=W.useRef(null),h=W.useRef(0),{display:d,viewMode:f}=Fn(),m=W.useMemo(()=>n2(e,t,us.CURVE_SEGMENTS),[e,t]),g=W.useMemo(()=>m.getPoints(us.CURVE_SEGMENTS),[m]),x=W.useMemo(()=>o2(r.frequency,us.BASE_WIDTH,us.MAX_WIDTH),[r.frequency]),S=W.useMemo(()=>f==="security"?dm(r.sensitivity):JR(r.operation),[r.operation,r.sensitivity,f]),y=W.useMemo(()=>{let _=d.pathOpacity;return f==="coverage"&&!r.isTested&&(_=Math.min(1,_*1.5)),n?1:i?Math.min(1,_*1.3):_},[d.pathOpacity,f,r.isTested,n,i]);return Bi((_,b)=>{if(!u.current)return;h.current-=us.FLOW_SPEED*b*d.animationSpeed;const M=u.current.material;M&&"dashOffset"in M&&(M.dashOffset=h.current)}),d.showPaths?L.jsxs("group",{onClick:s,onPointerOver:a,onPointerOut:c,children:[L.jsx(Tu,{ref:u,points:g,color:S,lineWidth:n?x*2:x,transparent:!0,opacity:y,dashed:!0,dashSize:us.DASH_SIZE,gapSize:us.GAP_SIZE}),(n||i)&&L.jsx(Tu,{points:g,color:S,lineWidth:x*3,transparent:!0,opacity:y*.3}),!r.isTested&&f==="coverage"&&L.jsx(Tu,{points:g,color:"#ef4444",lineWidth:x*.5,transparent:!0,opacity:.5,dashed:!0,dashSize:.2,gapSize:.8})]}):null}const f2={"one-to-one":"#60a5fa","one-to-many":"#34d399","many-to-many":"#a78bfa"};function p2({relationship:r,sourcePosition:e,targetPosition:t,isHighlighted:n=!1}){const{display:i}=Fn(),s=W.useMemo(()=>{const c=Mi(e),u=Mi(t),h=Mi(Oy(e,t));return h.y+=1,new Ku(c,h,u).getPoints(20)},[e,t]),a=W.useMemo(()=>f2[r.type]||"#6b7280",[r.type]);return i.showRelationships?L.jsxs("group",{children:[L.jsx(Tu,{points:s,color:a,lineWidth:n?2:1,transparent:!0,opacity:n?.8:.3,dashed:!n,dashSize:.3,gapSize:.2}),n&&L.jsxs(L.Fragment,{children:[L.jsxs("mesh",{position:Mi(e),children:[L.jsx("sphereGeometry",{args:[.15,8,8]}),L.jsx("meshBasicMaterial",{color:a,transparent:!0,opacity:.8})]}),L.jsxs("mesh",{position:Mi(t),children:[r.type.endsWith("many")?L.jsx("coneGeometry",{args:[.2,.3,8]}):L.jsx("sphereGeometry",{args:[.15,8,8]}),L.jsx("meshBasicMaterial",{color:a,transparent:!0,opacity:.8})]})]})]}):null}function m2({count:r=Yg.STAR_COUNT,radius:e=Ii.RADIUS*3,size:t=Yg.STAR_SIZE,twinkle:n=!0}){const i=W.useRef(null),s=W.useMemo(()=>{const u=new Float32Array(r*3);for(let h=0;h<r;h++){const d=Math.random()*Math.PI*2,f=Math.acos(2*Math.random()-1),m=e*(.5+Math.random()*.5);u[h*3]=m*Math.sin(f)*Math.cos(d),u[h*3+1]=m*Math.sin(f)*Math.sin(d),u[h*3+2]=m*Math.cos(f)}return u},[r,e]),a=W.useMemo(()=>{const u=new Float32Array(r);for(let h=0;h<r;h++)u[h]=t*(.5+Math.random()*1.5);return u},[r,t]),c=W.useMemo(()=>{const u=new Float32Array(r*3);for(let h=0;h<r;h++){const d=Math.random();d<.1?(u[h*3]=.7,u[h*3+1]=.8,u[h*3+2]=1):d<.2?(u[h*3]=1,u[h*3+1]=.95,u[h*3+2]=.8):(u[h*3]=1,u[h*3+1]=1,u[h*3+2]=1)}return u},[r]);return Bi(u=>{if(!n||!i.current)return;const d=i.current.geometry.getAttribute("size");if(d){const f=u.clock.elapsedTime;for(let m=0;m<r;m++){const g=.5+m%10*.1,x=Math.sin(f*g+m)*.3+.7;d.array[m]=a[m]*x}d.needsUpdate=!0}}),L.jsxs(qR,{ref:i,limit:r,children:[L.jsxs("bufferGeometry",{children:[L.jsx("bufferAttribute",{attach:"attributes-position",count:r,array:s,itemSize:3}),L.jsx("bufferAttribute",{attach:"attributes-color",count:r,array:c,itemSize:3}),L.jsx("bufferAttribute",{attach:"attributes-size",count:r,array:a,itemSize:1})]}),L.jsx(VR,{transparent:!0,vertexColors:!0,size:t,sizeAttenuation:!0,depthWrite:!1,opacity:.8})]})}function g2(){const{display:r}=Fn();return r.enableBloom,null}function _2({enableControls:r=!0,autoRotate:e=!1,autoRotateSpeed:t=.5}){const n=W.useRef(null),{camera:i}=Pi(),{camera:s,setCameraPosition:a,setCameraTarget:c}=Fn();W.useEffect(()=>{if(s.position){const h=Mi(s.position);i.position.copy(h)}},[s.position,i]),W.useEffect(()=>{if(n.current&&s.target){const h=Mi(s.target);n.current.target.copy(h),n.current.update()}},[s.target]),W.useEffect(()=>{i.zoom=s.zoom,i.updateProjectionMatrix()},[s.zoom,i]),Bi(()=>{if(!n.current)return;const h=i.position,d=n.current.target;Math.abs(h.x-s.position.x)+Math.abs(h.y-s.position.y)+Math.abs(h.z-s.position.z)>.1&&a({x:h.x,y:h.y,z:h.z}),Math.abs(d.x-s.target.x)+Math.abs(d.y-s.target.y)+Math.abs(d.z-s.target.z)>.1&&c({x:d.x,y:d.y,z:d.z})});const u={autoRotate:e,autoRotateSpeed:t,minDistance:Vr.MIN_ZOOM*20,maxDistance:Vr.MAX_ZOOM*100,maxPolarAngle:Math.PI*.85,minPolarAngle:Math.PI*.15};return L.jsx(kR,{ref:n,...u})}function v2(){const r=W.useRef(null),e=W.useRef(null),{viewMode:t}=Fn();Bi(s=>{const a=s.clock.elapsedTime;r.current&&(r.current.position.x=Math.sin(a*.1)*30,r.current.position.z=Math.cos(a*.1)*30),e.current&&(e.current.position.x=Math.cos(a*.08)*25,e.current.position.z=Math.sin(a*.08)*25)});const n=t==="security"?.2:.3,i=t==="security"?.8:.6;return L.jsxs(L.Fragment,{children:[L.jsx("ambientLight",{intensity:n,color:"#4a5568"}),L.jsx("directionalLight",{position:[50,50,25],intensity:.5,color:"#ffffff",castShadow:!1}),L.jsx("pointLight",{ref:r,position:[30,20,30],intensity:i,color:"#60a5fa",distance:100,decay:2}),L.jsx("pointLight",{ref:e,position:[-25,-10,-25],intensity:i*.7,color:"#f472b6",distance:80,decay:2}),L.jsx("pointLight",{position:[0,0,0],intensity:.4,color:"#a78bfa",distance:50,decay:2}),t==="security"&&L.jsx("pointLight",{position:[0,30,0],intensity:.3,color:"#ef4444",distance:100,decay:2})]})}function Fy(){return L.jsxs("mesh",{children:[L.jsx("sphereGeometry",{args:[1,16,16]}),L.jsx("meshBasicMaterial",{color:"#4a5568",wireframe:!0})]})}function x2(){const{galaxyData:r,selection:e,display:t,selectTable:n,selectEntryPoint:i,selectPath:s,setHovered:a}=Fn(),c=OS(),u=FS(),h=zS(),d=W.useMemo(()=>{const S=new Map;if(r){for(const y of r.tables)y.position&&S.set(y.id,y.position);for(const y of r.entryPoints)y.position&&S.set(y.id,y.position)}return S},[r]),f=W.useCallback(S=>{n(S)},[n]),m=W.useCallback(S=>{i(S)},[i]),g=W.useCallback(S=>{s(S)},[s]),x=W.useCallback((S,y)=>{a(S,y)},[a]);return r?L.jsxs(L.Fragment,{children:[L.jsx(m2,{}),L.jsx(v2,{}),L.jsx(_2,{}),L.jsx(g2,{}),t.showRelationships&&r.relationships.map(S=>{const y=d.get(S.sourceTableId),_=d.get(S.targetTableId);if(!y||!_)return null;const b=e.selectedTable===S.sourceTableId||e.selectedTable===S.targetTableId;return L.jsx(p2,{relationship:S,sourcePosition:y,targetPosition:_,isHighlighted:b},S.id)}),u.map(S=>{const y=d.get(S.sourceId),_=d.get(S.targetTableId);return!y||!_?null:L.jsx(d2,{path:S,sourcePosition:y,targetPosition:_,isSelected:e.selectedPath===S.id,isHovered:e.hoveredNode===S.id,onClick:()=>g(S.id),onPointerOver:()=>x(S.id,"path"),onPointerOut:()=>x(null,null)},S.id)}),c.map(S=>L.jsxs("group",{children:[L.jsx(c2,{table:S,isSelected:e.selectedTable===S.id,isHovered:e.hoveredNode===S.id,onClick:()=>f(S.id),onPointerOver:()=>x(S.id,"table"),onPointerOut:()=>x(null,null)}),t.showFields&&S.position&&S.fields.map((y,_)=>L.jsx(u2,{field:y,parentPosition:S.position,parentRadius:1,orbitIndex:_,totalFields:S.fields.length,isSelected:e.selectedField===y.id,isHovered:e.hoveredNode===y.id,onClick:()=>n(S.id),onPointerOver:()=>x(y.id,"field"),onPointerOut:()=>x(null,null)},y.id))]},S.id)),h.map(S=>L.jsx(h2,{entryPoint:S,isSelected:e.selectedEntryPoint===S.id,isHovered:e.hoveredNode===S.id,onClick:()=>m(S.id),onPointerOver:()=>x(S.id,"entryPoint"),onPointerOut:()=>x(null,null)},S.id))]}):L.jsx(Fy,{})}function y2({className:r="",enableControls:e=!0,autoRotate:t=!1}){return L.jsx("div",{className:`w-full h-full ${r}`,children:L.jsxs(vR,{camera:{position:[Vr.DEFAULT_POSITION.x,Vr.DEFAULT_POSITION.y,Vr.DEFAULT_POSITION.z],fov:Vr.FOV,near:Vr.NEAR,far:Vr.FAR},gl:{antialias:!0,toneMapping:Fu,toneMappingExposure:1},dpr:[1,2],children:[L.jsx("color",{attach:"background",args:["#0f172a"]}),L.jsx("fog",{attach:"fog",args:["#0f172a",50,200]}),L.jsx(W.Suspense,{fallback:L.jsx(Fy,{}),children:L.jsx(x2,{})})]})})}function pm(r){const e=r.toLowerCase();for(const[t,n]of Object.entries(BS))if(n.some(i=>e.includes(i)))return t;return"other"}function S2(r,e){for(let t=0;t<r.length;t++)for(let n=t+1;n<r.length;n++){const i=r[t],s=r[n];if(i.fixed&&s.fixed)continue;const a=s.x-i.x,c=s.y-i.y,u=s.z-i.z,h=Math.sqrt(a*a+c*c+u*u)||.1,d=i.cluster===s.cluster?.5:1,f=e*d/(h*h),m=a/h*f,g=c/h*f,x=u/h*f;i.fixed||(i.vx-=m/i.mass,i.vy-=g/i.mass,i.vz-=x/i.mass),s.fixed||(s.vx+=m/s.mass,s.vy+=g/s.mass,s.vz+=x/s.mass)}}function M2(r,e,t){const n=new Map(r.map(i=>[i.id,i]));for(const i of e){const s=n.get(i.source),a=n.get(i.target);if(!s||!a||s.fixed&&a.fixed)continue;const c=a.x-s.x,u=a.y-s.y,h=a.z-s.z,d=Math.sqrt(c*c+u*u+h*h)||.1,f=(d-t)*i.strength*.1,m=c/d*f,g=u/d*f,x=h/d*f;s.fixed||(s.vx+=m/s.mass,s.vy+=g/s.mass,s.vz+=x/s.mass),a.fixed||(a.vx-=m/a.mass,a.vy-=g/a.mass,a.vz-=x/a.mass)}}function E2(r,e,t){for(const n of r){if(n.fixed)continue;const i=e.get(n.cluster);if(!i)continue;const s=i.x-n.x,a=i.y-n.y,c=i.z-n.z;n.vx+=s*t,n.vy+=a*t,n.vz+=c*t}}function b2(r,e){for(const t of r)t.fixed||(t.x+=t.vx,t.y+=t.vy,t.z+=t.vz,t.vx*=e,t.vy*=e,t.vz*=e)}function w2(r,e,t){for(const n of r){const i=Math.sqrt(n.x*n.x+n.z*n.z);if(i>e){const s=e/i;n.x*=s,n.z*=s}n.y=Math.max(-t/2,Math.min(t/2,n.y))}}function T2(r){const e=new Map,t=2*Math.PI/r.length,n=Ii.RADIUS*.6;return r.forEach((i,s)=>{const a=s*t;e.set(i,{x:Math.cos(a)*n,y:(Math.random()-.5)*Ii.HEIGHT*.3,z:Math.sin(a)*n})}),e}function A2(r,e){return r.map(t=>{const n=t.cluster||pm(t.name),i=e.get(n)||{x:0,y:0,z:0},s=Ii.CLUSTER_SEPARATION*.3;return{id:t.id,x:i.x+(Math.random()-.5)*s,y:i.y+(Math.random()-.5)*s,z:i.z+(Math.random()-.5)*s,vx:0,vy:0,vz:0,mass:1+Math.log10(t.accessCount+1),cluster:n,fixed:!1}})}function C2(r){return r.map(e=>({source:e.sourceTableId,target:e.targetTableId,strength:e.type==="one-to-one"?1:.5}))}function R2(r,e,t){const n=new Map,i=Ii.RADIUS+15,s=new Map;for(const c of r){const u=new Map;for(const m of c.reachableTables){const g=e.find(x=>x.id===m);if(g){const x=g.cluster||pm(g.name);u.set(x,(u.get(x)||0)+1)}}let h="other",d=0;for(const[m,g]of u)g>d&&(h=m,d=g);const f=s.get(h)||[];s.set(h,[...f,c])}let a=0;for(const[c,u]of s)for(let h=0;h<u.length;h++){const d=a/r.length*2*Math.PI,f=(Math.random()-.5)*Ii.HEIGHT;n.set(u[h].id,{x:Math.cos(d)*i,y:f,z:Math.sin(d)*i}),a++}return n}function P2(r,e,t){const n=[...new Set(r.map(f=>f.cluster||pm(f.name)))],i=T2(n),s=A2(r,i),a=C2(t),c=Ii.SIMULATION_ITERATIONS,u=.9;for(let f=0;f<c;f++){const m=1-f/c;S2(s,Ii.FORCE_STRENGTH*m),M2(s,a,Ii.LINK_DISTANCE),E2(s,i,.05*m),b2(s,u),w2(s,Ii.RADIUS,Ii.HEIGHT)}const h=new Map;for(const f of s)h.set(f.id,{x:f.x,y:f.y,z:f.z});const d=R2(e,r);return{tables:h,entryPoints:d,clusters:i}}function L2(r,e,t){const n=[],i=new Set;for(const u of t){const h=`${u.sourceId}-${u.targetTableId}`;i.has(h)||(i.add(h),r.find(f=>f.id===u.sourceId)&&n.push({id:h,sourceTableId:u.sourceId,sourceFieldId:"",targetTableId:u.targetTableId,targetFieldId:"",type:"one-to-many"}))}const s=P2(r,e,n),a=r.map(u=>({...u,position:s.tables.get(u.id)})),c=e.map(u=>({...u,position:s.entryPoints.get(u.id)}));return{tables:a,entryPoints:c}}function I2(){const{isPanelOpen:r,activePanel:e,closePanel:t,selection:n}=Fn(),i=kS(),s=HS(),a=VS();return!r||e!=="details"?null:L.jsxs("div",{className:"absolute right-4 top-4 w-80 max-h-[calc(100vh-8rem)] overflow-y-auto bg-slate-900/95 backdrop-blur-sm rounded-lg border border-slate-700 shadow-xl",children:[L.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-slate-700",children:[L.jsx("h2",{className:"text-lg font-semibold text-white",children:"Details"}),L.jsx("button",{onClick:t,className:"text-slate-400 hover:text-white transition-colors",children:L.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:L.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),L.jsxs("div",{className:"p-4",children:[i&&L.jsx(N2,{table:i,paths:a}),s&&L.jsx(D2,{entryPoint:s}),!i&&!s&&L.jsx("p",{className:"text-slate-400 text-sm",children:"Select a node to view details"})]})]})}function N2({table:r,paths:e}){const t=r.fields.filter(i=>i.sensitivity!=="public"&&i.sensitivity!=="low"),n=e.filter(i=>!i.isTested);return L.jsxs("div",{className:"space-y-4",children:[L.jsxs("div",{children:[L.jsxs("div",{className:"flex items-center gap-2",children:[L.jsx("h3",{className:"text-xl font-bold text-white",children:r.name}),L.jsx("span",{className:"px-2 py-0.5 rounded text-xs font-medium",style:{backgroundColor:Is[r.sensitivity]+"33",color:Is[r.sensitivity]},children:r.sensitivity})]}),r.schema&&L.jsx("p",{className:"text-slate-400 text-sm",children:r.schema})]}),L.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[L.jsx(Ls,{label:"Fields",value:r.fields.length}),L.jsx(Ls,{label:"Accesses",value:r.accessCount}),L.jsx(Ls,{label:"Sensitive",value:t.length,color:t.length>0?"#f59e0b":void 0}),L.jsx(Ls,{label:"Untested Paths",value:n.length,color:n.length>0?"#ef4444":void 0})]}),L.jsxs("div",{children:[L.jsxs("h4",{className:"text-sm font-medium text-slate-300 mb-2",children:["Fields (",r.fields.length,")"]}),L.jsx("div",{className:"space-y-1 max-h-48 overflow-y-auto",children:r.fields.map(i=>L.jsxs("div",{className:"flex items-center justify-between p-2 rounded bg-slate-800/50 text-sm",children:[L.jsxs("div",{className:"flex items-center gap-2",children:[i.isPrimaryKey&&L.jsx("span",{title:"Primary Key",children:"🔑"}),i.isForeignKey&&L.jsx("span",{title:"Foreign Key",children:"🔗"}),L.jsx("span",{className:"text-white",children:i.name}),L.jsx("span",{className:"text-slate-500",children:i.dataType})]}),L.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:Is[i.sensitivity]},title:i.sensitivity})]},i.id))})]}),e.length>0&&L.jsxs("div",{children:[L.jsxs("h4",{className:"text-sm font-medium text-slate-300 mb-2",children:["Access Paths (",e.length,")"]}),L.jsx("div",{className:"space-y-1 max-h-32 overflow-y-auto",children:e.slice(0,10).map(i=>L.jsxs("div",{className:"flex items-center justify-between p-2 rounded bg-slate-800/50 text-sm",children:[L.jsx("span",{className:"text-slate-300",children:i.operation}),L.jsxs("div",{className:"flex items-center gap-2",children:[L.jsxs("span",{className:"text-slate-500",children:["depth: ",i.depth]}),!i.isTested&&L.jsx("span",{className:"text-red-400 text-xs",children:"untested"})]})]},i.id))})]})]})}function D2({entryPoint:r}){return L.jsxs("div",{className:"space-y-4",children:[L.jsxs("div",{children:[L.jsxs("div",{className:"flex items-center gap-2",children:[L.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-bold ${U2(r.method)}`,children:r.method}),L.jsx("h3",{className:"text-lg font-bold text-white truncate",children:r.path})]}),L.jsx("p",{className:"text-slate-400 text-sm mt-1",children:r.framework})]}),r.authLevel==="public"&&L.jsxs("div",{className:"p-3 rounded bg-red-500/20 border border-red-500/50",children:[L.jsxs("div",{className:"flex items-center gap-2 text-red-400",children:[L.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:L.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),L.jsx("span",{className:"font-medium",children:"Public Endpoint"})]}),L.jsx("p",{className:"text-red-300 text-sm mt-1",children:"This endpoint is accessible without authentication"})]}),L.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[L.jsx(Ls,{label:"Auth Level",value:r.authLevel,color:Q_[r.authLevel]}),L.jsx(Ls,{label:"Security Tier",value:r.securityTier}),L.jsx(Ls,{label:"Reachable Tables",value:r.reachableTables.length})]}),L.jsxs("div",{children:[L.jsx("h4",{className:"text-sm font-medium text-slate-300 mb-2",children:"Source"}),L.jsxs("div",{className:"p-2 rounded bg-slate-800/50 text-sm font-mono",children:[L.jsx("span",{className:"text-slate-400",children:r.file}),L.jsxs("span",{className:"text-slate-500",children:[":",r.line]})]})]}),r.reachableTables.length>0&&L.jsxs("div",{children:[L.jsx("h4",{className:"text-sm font-medium text-slate-300 mb-2",children:"Reachable Tables"}),L.jsx("div",{className:"flex flex-wrap gap-1",children:r.reachableTables.map(e=>L.jsx("span",{className:"px-2 py-1 rounded bg-slate-800 text-slate-300 text-xs",children:e},e))})]})]})}function Ls({label:r,value:e,color:t}){return L.jsxs("div",{className:"p-3 rounded bg-slate-800/50",children:[L.jsx("p",{className:"text-slate-400 text-xs",children:r}),L.jsx("p",{className:"text-lg font-semibold",style:{color:t||"#f8fafc"},children:e})]})}function U2(r){const e={GET:"bg-green-500/20 text-green-400",POST:"bg-blue-500/20 text-blue-400",PUT:"bg-amber-500/20 text-amber-400",PATCH:"bg-purple-500/20 text-purple-400",DELETE:"bg-red-500/20 text-red-400",ALL:"bg-slate-500/20 text-slate-400"};return e[r]||e.ALL}function O2(){const{isPanelOpen:r,activePanel:e,closePanel:t,galaxyData:n,setViewMode:i,setFilters:s}=Fn(),a=W.useMemo(()=>{if(!n)return null;const c=n.entryPoints.filter(m=>m.authLevel==="public"),u=n.tables.filter(m=>m.sensitivity==="critical"||m.sensitivity==="high"),h=n.dataPaths.filter(m=>!m.isTested),d=n.entryPoints.filter(m=>m.securityTier==="P0"),f=c.filter(m=>m.reachableTables.some(g=>u.some(x=>x.id===g)));return{publicEndpoints:c,criticalTables:u,untestedPaths:h,p0Endpoints:d,publicToSensitive:f,healthScore:n.stats.healthScore}},[n]);return!r||e!=="security"||!a?null:(a.publicToSensitive.length>0||a.untestedPaths.length>0,L.jsxs("div",{className:"absolute right-4 top-4 w-80 max-h-[calc(100vh-8rem)] overflow-y-auto bg-slate-900/95 backdrop-blur-sm rounded-lg border border-slate-700 shadow-xl",children:[L.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-slate-700",children:[L.jsx("h2",{className:"text-lg font-semibold text-white",children:"Security Overview"}),L.jsx("button",{onClick:t,className:"text-slate-400 hover:text-white transition-colors",children:L.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:L.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),L.jsxs("div",{className:"p-4 space-y-4",children:[L.jsxs("div",{className:"text-center p-4 rounded-lg bg-slate-800/50",children:[L.jsx("div",{className:"text-4xl font-bold",style:{color:F2(a.healthScore)},children:a.healthScore}),L.jsx("p",{className:"text-slate-400 text-sm",children:"Security Health Score"})]}),a.publicToSensitive.length>0&&L.jsxs("div",{className:"p-3 rounded bg-red-500/20 border border-red-500/50",children:[L.jsxs("div",{className:"flex items-center gap-2 text-red-400 font-medium",children:[L.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:L.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),a.publicToSensitive.length," Public → Sensitive Paths"]}),L.jsx("p",{className:"text-red-300 text-sm mt-1",children:"Public endpoints can reach sensitive data without authentication"}),L.jsx("button",{onClick:()=>{i("security"),s({publicOnly:!0})},className:"mt-2 text-sm text-red-400 hover:text-red-300 underline",children:"View in Security Mode →"})]}),L.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[L.jsx(_u,{label:"Public Endpoints",value:a.publicEndpoints.length,color:a.publicEndpoints.length>0?"#ef4444":"#22c55e",onClick:()=>s({publicOnly:!0})}),L.jsx(_u,{label:"P0 Endpoints",value:a.p0Endpoints.length,color:K_.P0}),L.jsx(_u,{label:"Sensitive Tables",value:a.criticalTables.length,color:Is.high,onClick:()=>s({minSensitivity:"high"})}),L.jsx(_u,{label:"Untested Paths",value:a.untestedPaths.length,color:a.untestedPaths.length>0?"#f59e0b":"#22c55e",onClick:()=>s({untestedOnly:!0})})]}),L.jsxs("div",{children:[L.jsx("h4",{className:"text-sm font-medium text-slate-300 mb-2",children:"Sensitivity Distribution"}),L.jsx("div",{className:"space-y-2",children:["critical","high","medium","low","public"].map(c=>{const u=(n==null?void 0:n.stats.sensitiveFields[c])||0,h=(n==null?void 0:n.stats.fieldCount)||1,d=Math.round(u/h*100);return L.jsxs("div",{className:"flex items-center gap-2",children:[L.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:Is[c]}}),L.jsx("span",{className:"text-slate-300 text-sm capitalize flex-1",children:c}),L.jsx("span",{className:"text-slate-400 text-sm",children:u}),L.jsx("div",{className:"w-20 h-2 bg-slate-700 rounded-full overflow-hidden",children:L.jsx("div",{className:"h-full rounded-full",style:{width:`${d}%`,backgroundColor:Is[c]}})})]},c)})})]}),L.jsxs("div",{children:[L.jsx("h4",{className:"text-sm font-medium text-slate-300 mb-2",children:"Quick Actions"}),L.jsxs("div",{className:"space-y-2",children:[L.jsx("button",{onClick:()=>i("security"),className:"w-full p-2 rounded bg-slate-800 hover:bg-slate-700 text-left text-sm text-slate-300 transition-colors",children:"🔒 Enable Security Mode"}),L.jsx("button",{onClick:()=>i("coverage"),className:"w-full p-2 rounded bg-slate-800 hover:bg-slate-700 text-left text-sm text-slate-300 transition-colors",children:"📊 View Test Coverage"}),L.jsx("button",{onClick:()=>s({untestedOnly:!0}),className:"w-full p-2 rounded bg-slate-800 hover:bg-slate-700 text-left text-sm text-slate-300 transition-colors",children:"⚠️ Show Untested Paths"})]})]})]})]}))}function _u({label:r,value:e,color:t,onClick:n}){return L.jsxs("button",{onClick:n,className:"p-3 rounded bg-slate-800/50 hover:bg-slate-800 transition-colors text-left",children:[L.jsx("p",{className:"text-slate-400 text-xs",children:r}),L.jsx("p",{className:"text-2xl font-bold",style:{color:t},children:e})]})}function F2(r){return r>=80?"#22c55e":r>=60?"#eab308":r>=40?"#f97316":"#ef4444"}function z2(){const{isPanelOpen:r,activePanel:e,closePanel:t,viewMode:n,setViewMode:i,filters:s,setFilters:a,resetFilters:c,display:u,setDisplay:h,resetCamera:d}=Fn(),{play:f,getConfig:m,setConfig:g,toggleMute:x,setVolume:S}=fm(),[y,_]=W.useState(m),b=W.useCallback(R=>{g({enabled:R}),_(C=>({...C,enabled:R})),R&&f("powerUp")},[g,f]),M=W.useCallback(()=>{const R=x();_(C=>({...C,muted:R})),R||f("click")},[x,f]),T=W.useCallback(R=>{S(R),_(C=>({...C,volume:R}))},[S]);return!r||e!=="settings"?null:L.jsxs("div",{className:"absolute right-4 top-4 w-72 max-h-[calc(100vh-8rem)] overflow-y-auto bg-slate-900/95 backdrop-blur-sm rounded-lg border border-slate-700 shadow-xl",children:[L.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-slate-700",children:[L.jsx("h2",{className:"text-lg font-semibold text-white",children:"Controls"}),L.jsx("button",{onClick:t,className:"text-slate-400 hover:text-white transition-colors",children:L.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:L.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),L.jsxs("div",{className:"p-4 space-y-6",children:[L.jsx(Ua,{title:"View Mode",children:L.jsx("div",{className:"grid grid-cols-2 gap-2",children:B2.map(R=>L.jsxs("button",{onClick:()=>i(R.value),className:`p-2 rounded text-sm transition-colors ${n===R.value?"bg-blue-500/20 text-blue-400 border border-blue-500/50":"bg-slate-800 text-slate-300 hover:bg-slate-700"}`,children:[R.icon," ",R.label]},R.value))})}),L.jsx(Ua,{title:"Filters",children:L.jsxs("div",{className:"space-y-3",children:[L.jsxs("div",{children:[L.jsx("label",{className:"text-xs text-slate-400 block mb-1",children:"Min Sensitivity"}),L.jsxs("select",{value:s.minSensitivity||"",onChange:R=>a({minSensitivity:R.target.value||null}),className:"w-full p-2 rounded bg-slate-800 text-slate-300 text-sm border border-slate-700",children:[L.jsx("option",{value:"",children:"All"}),L.jsx("option",{value:"low",children:"Low+"}),L.jsx("option",{value:"medium",children:"Medium+"}),L.jsx("option",{value:"high",children:"High+"}),L.jsx("option",{value:"critical",children:"Critical"})]})]}),L.jsxs("div",{children:[L.jsx("label",{className:"text-xs text-slate-400 block mb-1",children:"Operation Type"}),L.jsxs("select",{value:s.operationType||"",onChange:R=>a({operationType:R.target.value||null}),className:"w-full p-2 rounded bg-slate-800 text-slate-300 text-sm border border-slate-700",children:[L.jsx("option",{value:"",children:"All"}),L.jsx("option",{value:"read",children:"Read"}),L.jsx("option",{value:"write",children:"Write"}),L.jsx("option",{value:"delete",children:"Delete"})]})]}),L.jsx(gr,{label:"Untested paths only",checked:s.untestedOnly,onChange:R=>a({untestedOnly:R})}),L.jsx(gr,{label:"Public endpoints only",checked:s.publicOnly,onChange:R=>a({publicOnly:R})}),L.jsx("button",{onClick:c,className:"w-full p-2 rounded bg-slate-800 hover:bg-slate-700 text-slate-400 text-sm transition-colors",children:"Reset Filters"})]})}),L.jsx(Ua,{title:"Display",children:L.jsxs("div",{className:"space-y-3",children:[L.jsx(gr,{label:"Show field moons",checked:u.showFields,onChange:R=>h({showFields:R})}),L.jsx(gr,{label:"Show data paths",checked:u.showPaths,onChange:R=>h({showPaths:R})}),L.jsx(gr,{label:"Show relationships",checked:u.showRelationships,onChange:R=>h({showRelationships:R})}),L.jsx(gr,{label:"Show labels",checked:u.showLabels,onChange:R=>h({showLabels:R})}),L.jsx(gr,{label:"Enable bloom effect",checked:u.enableBloom,onChange:R=>h({enableBloom:R})}),L.jsxs("div",{children:[L.jsxs("label",{className:"text-xs text-slate-400 block mb-1",children:["Animation Speed: ",u.animationSpeed.toFixed(1),"x"]}),L.jsx("input",{type:"range",min:"0",max:"2",step:"0.1",value:u.animationSpeed,onChange:R=>h({animationSpeed:parseFloat(R.target.value)}),className:"w-full"})]}),L.jsxs("div",{children:[L.jsxs("label",{className:"text-xs text-slate-400 block mb-1",children:["Path Opacity: ",Math.round(u.pathOpacity*100),"%"]}),L.jsx("input",{type:"range",min:"0.1",max:"1",step:"0.1",value:u.pathOpacity,onChange:R=>h({pathOpacity:parseFloat(R.target.value)}),className:"w-full"})]})]})}),L.jsx(Ua,{title:"Camera",children:L.jsx("button",{onClick:d,className:"w-full p-2 rounded bg-slate-800 hover:bg-slate-700 text-slate-300 text-sm transition-colors",children:"🎥 Reset Camera"})}),L.jsx(Ua,{title:"Sound",children:L.jsxs("div",{className:"space-y-3",children:[L.jsx(gr,{label:"Enable sounds",checked:y.enabled,onChange:b}),L.jsx(gr,{label:"Mute",checked:y.muted,onChange:M}),L.jsxs("div",{children:[L.jsxs("label",{className:"text-xs text-slate-400 block mb-1",children:["Volume: ",Math.round(y.volume*100),"%"]}),L.jsx("input",{type:"range",min:"0",max:"1",step:"0.1",value:y.volume,onChange:R=>T(parseFloat(R.target.value)),className:"w-full",disabled:!y.enabled||y.muted})]}),L.jsxs("div",{className:"flex gap-2",children:[L.jsx("button",{onClick:()=>f("hover"),className:"flex-1 p-2 rounded bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs transition-colors",disabled:!y.enabled||y.muted,children:"🔊 Test"}),L.jsx("button",{onClick:()=>f("alertCritical"),className:"flex-1 p-2 rounded bg-red-900/50 hover:bg-red-800/50 text-red-300 text-xs transition-colors",disabled:!y.enabled||y.muted,children:"🚨 Alert"})]})]})})]})]})}const B2=[{value:"overview",label:"Overview",icon:"🌌"},{value:"security",label:"Security",icon:"🔒"},{value:"coverage",label:"Coverage",icon:"📊"},{value:"blast-radius",label:"Impact",icon:"💥"}];function Ua({title:r,children:e}){return L.jsxs("div",{children:[L.jsx("h3",{className:"text-sm font-medium text-slate-300 mb-2",children:r}),e]})}function gr({label:r,checked:e,onChange:t}){return L.jsxs("label",{className:"flex items-center justify-between cursor-pointer",children:[L.jsx("span",{className:"text-sm text-slate-300",children:r}),L.jsx("button",{onClick:()=>t(!e),className:`w-10 h-5 rounded-full transition-colors ${e?"bg-blue-500":"bg-slate-700"}`,children:L.jsx("div",{className:`w-4 h-4 rounded-full bg-white transition-transform ${e?"translate-x-5":"translate-x-0.5"}`})})]})}function k2(){const[r,e]=W.useState(!1),[t,n]=W.useState(""),{galaxyData:i,selectTable:s,selectEntryPoint:a,focusOnNode:c}=Fn(),u=W.useMemo(()=>{if(!i||!t.trim())return{tables:[],entryPoints:[],fields:[]};const f=t.toLowerCase(),m=i.tables.filter(S=>S.name.toLowerCase().includes(f)).slice(0,5),g=i.entryPoints.filter(S=>S.path.toLowerCase().includes(f)).slice(0,5),x=i.tables.flatMap(S=>S.fields.map(y=>({...y,tableName:S.name}))).filter(S=>S.name.toLowerCase().includes(f)).slice(0,5);return{tables:m,entryPoints:g,fields:x}},[i,t]);W.useEffect(()=>{const f=m=>{(m.metaKey||m.ctrlKey)&&m.key==="k"&&(m.preventDefault(),e(!0)),m.key==="Escape"&&(e(!1),n(""))};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[]);const h=W.useCallback((f,m)=>{f==="table"?s(m):a(m),c(m),e(!1),n("")},[s,a,c]),d=u.tables.length>0||u.entryPoints.length>0||u.fields.length>0;return L.jsxs(L.Fragment,{children:[L.jsxs("button",{onClick:()=>e(!0),className:"absolute left-4 top-4 flex items-center gap-2 px-3 py-2 rounded-lg bg-slate-800/80 hover:bg-slate-700 text-slate-400 text-sm transition-colors",children:[L.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:L.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),"Search...",L.jsx("kbd",{className:"px-1.5 py-0.5 rounded bg-slate-700 text-xs",children:"⌘K"})]}),r&&L.jsx("div",{className:"absolute inset-0 flex items-start justify-center pt-20 bg-black/50 backdrop-blur-sm z-50",children:L.jsxs("div",{className:"w-full max-w-lg bg-slate-900 rounded-lg border border-slate-700 shadow-2xl overflow-hidden",children:[L.jsxs("div",{className:"flex items-center gap-3 p-4 border-b border-slate-700",children:[L.jsx("svg",{className:"w-5 h-5 text-slate-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:L.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),L.jsx("input",{type:"text",value:t,onChange:f=>n(f.target.value),placeholder:"Search tables, fields, endpoints...",className:"flex-1 bg-transparent text-white placeholder-slate-500 outline-none",autoFocus:!0}),L.jsx("button",{onClick:()=>{e(!1),n("")},className:"text-slate-400 hover:text-white",children:L.jsx("kbd",{className:"px-1.5 py-0.5 rounded bg-slate-700 text-xs",children:"ESC"})})]}),t&&L.jsxs("div",{className:"max-h-80 overflow-y-auto",children:[!d&&L.jsx("p",{className:"p-4 text-slate-400 text-center",children:"No results found"}),u.tables.length>0&&L.jsx(vf,{title:"Tables",children:u.tables.map(f=>L.jsx(xf,{icon:"🪐",label:f.name,sublabel:`${f.fields.length} fields`,onClick:()=>h("table",f.id)},f.id))}),u.entryPoints.length>0&&L.jsx(vf,{title:"Entry Points",children:u.entryPoints.map(f=>L.jsx(xf,{icon:"🛸",label:f.path,sublabel:`${f.method} • ${f.framework}`,onClick:()=>h("entryPoint",f.id)},f.id))}),u.fields.length>0&&L.jsx(vf,{title:"Fields",children:u.fields.map(f=>L.jsx(xf,{icon:"🌙",label:f.name,sublabel:`${f.tableName} • ${f.dataType}`,onClick:()=>h("table",f.tableId)},f.id))})]})]})})]})}function vf({title:r,children:e}){return L.jsxs("div",{className:"border-b border-slate-800 last:border-0",children:[L.jsx("p",{className:"px-4 py-2 text-xs text-slate-500 uppercase",children:r}),e]})}function xf({icon:r,label:e,sublabel:t,onClick:n}){return L.jsxs("button",{onClick:n,className:"w-full flex items-center gap-3 px-4 py-2 hover:bg-slate-800 text-left transition-colors",children:[L.jsx("span",{children:r}),L.jsxs("div",{className:"flex-1 min-w-0",children:[L.jsx("p",{className:"text-white truncate",children:e}),L.jsx("p",{className:"text-slate-500 text-sm truncate",children:t})]})]})}function H2(){const{galaxyData:r,viewMode:e,isLiveMode:t}=Fn();if(!r)return null;const{stats:n}=r;return L.jsxs("div",{className:"absolute left-4 bottom-4 flex items-end gap-4",children:[L.jsx("div",{className:"bg-slate-900/80 backdrop-blur-sm rounded-lg p-3 border border-slate-700",children:L.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[L.jsx(yf,{icon:"🪐",value:n.tableCount,label:"Tables"}),L.jsx(yf,{icon:"🛸",value:n.entryPointCount,label:"Endpoints"}),L.jsx(yf,{icon:"🔗",value:n.pathCount,label:"Paths"}),L.jsx("div",{className:"w-px h-8 bg-slate-700"}),L.jsxs("div",{className:"text-center",children:[L.jsx("div",{className:"text-lg font-bold",style:{color:$R(n.healthScore)},children:n.healthScore}),L.jsx("div",{className:"text-slate-500 text-xs",children:"Health"})]})]})}),L.jsx("div",{className:"bg-slate-900/80 backdrop-blur-sm rounded-lg px-3 py-2 border border-slate-700",children:L.jsx("span",{className:"text-slate-400 text-sm",children:V2[e]})}),t&&L.jsxs("div",{className:"bg-green-500/20 backdrop-blur-sm rounded-lg px-3 py-2 border border-green-500/50 flex items-center gap-2",children:[L.jsx("span",{className:"w-2 h-2 rounded-full bg-green-500 animate-pulse"}),L.jsx("span",{className:"text-green-400 text-sm",children:"Live"})]})]})}function yf({icon:r,value:e,label:t}){return L.jsxs("div",{className:"text-center",children:[L.jsxs("div",{className:"flex items-center gap-1",children:[L.jsx("span",{children:r}),L.jsx("span",{className:"text-white font-medium",children:e})]}),L.jsx("div",{className:"text-slate-500 text-xs",children:t})]})}const V2={overview:"🌌 Overview",security:"🔒 Security",coverage:"📊 Coverage","blast-radius":"💥 Impact",timeline:"📅 Timeline"};function Sf(){const r=[{id:"users",name:"users",sensitivity:"high",cluster:"auth",fields:[{id:"users.id",name:"id",dataType:"uuid",isPrimaryKey:!0,sensitivity:"low"},{id:"users.email",name:"email",dataType:"varchar",sensitivity:"high"},{id:"users.password_hash",name:"password_hash",dataType:"varchar",sensitivity:"critical"},{id:"users.name",name:"name",dataType:"varchar",sensitivity:"medium"},{id:"users.created_at",name:"created_at",dataType:"timestamp",sensitivity:"low"}]},{id:"sessions",name:"sessions",sensitivity:"high",cluster:"auth",fields:[{id:"sessions.id",name:"id",dataType:"uuid",isPrimaryKey:!0,sensitivity:"low"},{id:"sessions.user_id",name:"user_id",dataType:"uuid",isForeignKey:!0,foreignKeyTarget:"users.id",sensitivity:"medium"},{id:"sessions.token",name:"token",dataType:"varchar",sensitivity:"critical"},{id:"sessions.expires_at",name:"expires_at",dataType:"timestamp",sensitivity:"low"}]},{id:"orders",name:"orders",sensitivity:"high",cluster:"commerce",fields:[{id:"orders.id",name:"id",dataType:"uuid",isPrimaryKey:!0,sensitivity:"low"},{id:"orders.user_id",name:"user_id",dataType:"uuid",isForeignKey:!0,foreignKeyTarget:"users.id",sensitivity:"medium"},{id:"orders.total",name:"total",dataType:"decimal",sensitivity:"high"},{id:"orders.status",name:"status",dataType:"varchar",sensitivity:"low"}]},{id:"products",name:"products",sensitivity:"low",cluster:"commerce",fields:[{id:"products.id",name:"id",dataType:"uuid",isPrimaryKey:!0,sensitivity:"low"},{id:"products.name",name:"name",dataType:"varchar",sensitivity:"public"},{id:"products.price",name:"price",dataType:"decimal",sensitivity:"public"},{id:"products.inventory",name:"inventory",dataType:"integer",sensitivity:"low"}]},{id:"payments",name:"payments",sensitivity:"critical",cluster:"commerce",fields:[{id:"payments.id",name:"id",dataType:"uuid",isPrimaryKey:!0,sensitivity:"low"},{id:"payments.order_id",name:"order_id",dataType:"uuid",isForeignKey:!0,foreignKeyTarget:"orders.id",sensitivity:"medium"},{id:"payments.card_last4",name:"card_last4",dataType:"varchar",sensitivity:"high"},{id:"payments.amount",name:"amount",dataType:"decimal",sensitivity:"high"}]},{id:"audit_logs",name:"audit_logs",sensitivity:"medium",cluster:"analytics",fields:[{id:"audit_logs.id",name:"id",dataType:"uuid",isPrimaryKey:!0,sensitivity:"low"},{id:"audit_logs.user_id",name:"user_id",dataType:"uuid",sensitivity:"medium"},{id:"audit_logs.action",name:"action",dataType:"varchar",sensitivity:"low"},{id:"audit_logs.timestamp",name:"timestamp",dataType:"timestamp",sensitivity:"low"}]}],e=[{id:"ep-login",path:"/api/auth/login",method:"POST",authLevel:"public",securityTier:"P0",file:"src/routes/auth.ts",line:15,framework:"Express",reachableTables:["users","sessions"]},{id:"ep-register",path:"/api/auth/register",method:"POST",authLevel:"public",securityTier:"P1",file:"src/routes/auth.ts",line:45,framework:"Express",reachableTables:["users"]},{id:"ep-profile",path:"/api/users/profile",method:"GET",authLevel:"authenticated",securityTier:"P2",file:"src/routes/users.ts",line:10,framework:"Express",reachableTables:["users"]},{id:"ep-orders",path:"/api/orders",method:"GET",authLevel:"authenticated",securityTier:"P2",file:"src/routes/orders.ts",line:20,framework:"Express",reachableTables:["orders","products"]},{id:"ep-checkout",path:"/api/checkout",method:"POST",authLevel:"authenticated",securityTier:"P0",file:"src/routes/checkout.ts",line:30,framework:"Express",reachableTables:["orders","payments","products"]},{id:"ep-products",path:"/api/products",method:"GET",authLevel:"public",securityTier:"P4",file:"src/routes/products.ts",line:5,framework:"Express",reachableTables:["products"]},{id:"ep-admin-users",path:"/api/admin/users",method:"GET",authLevel:"admin",securityTier:"P1",file:"src/routes/admin.ts",line:10,framework:"Express",reachableTables:["users","orders","audit_logs"]}],t=[{id:"path-1",sourceId:"ep-login",sourceType:"entryPoint",targetTableId:"users",operation:"read",frequency:1e3,depth:1,isTested:!0,sensitivity:"high"},{id:"path-2",sourceId:"ep-login",sourceType:"entryPoint",targetTableId:"sessions",operation:"write",frequency:1e3,depth:2,isTested:!0,sensitivity:"critical"},{id:"path-3",sourceId:"ep-register",sourceType:"entryPoint",targetTableId:"users",operation:"write",frequency:100,depth:1,isTested:!1,sensitivity:"high"},{id:"path-4",sourceId:"ep-profile",sourceType:"entryPoint",targetTableId:"users",operation:"read",frequency:500,depth:1,isTested:!0,sensitivity:"high"},{id:"path-5",sourceId:"ep-orders",sourceType:"entryPoint",targetTableId:"orders",operation:"read",frequency:300,depth:1,isTested:!0,sensitivity:"high"},{id:"path-6",sourceId:"ep-checkout",sourceType:"entryPoint",targetTableId:"orders",operation:"write",frequency:50,depth:1,isTested:!1,sensitivity:"high"},{id:"path-7",sourceId:"ep-checkout",sourceType:"entryPoint",targetTableId:"payments",operation:"write",frequency:50,depth:2,isTested:!1,sensitivity:"critical"},{id:"path-8",sourceId:"ep-products",sourceType:"entryPoint",targetTableId:"products",operation:"read",frequency:2e3,depth:1,isTested:!0,sensitivity:"public"},{id:"path-9",sourceId:"ep-admin-users",sourceType:"entryPoint",targetTableId:"users",operation:"read",frequency:10,depth:1,isTested:!0,sensitivity:"high"},{id:"path-10",sourceId:"ep-admin-users",sourceType:"entryPoint",targetTableId:"audit_logs",operation:"read",frequency:10,depth:2,isTested:!1,sensitivity:"medium"}],n=[{id:"rel-1",sourceTableId:"sessions",sourceFieldId:"sessions.user_id",targetTableId:"users",targetFieldId:"users.id",type:"one-to-many"},{id:"rel-2",sourceTableId:"orders",sourceFieldId:"orders.user_id",targetTableId:"users",targetFieldId:"users.id",type:"one-to-many"},{id:"rel-3",sourceTableId:"payments",sourceFieldId:"payments.order_id",targetTableId:"orders",targetFieldId:"orders.id",type:"one-to-one"}];return{tables:r.map(i=>({...i,rowCount:Math.floor(Math.random()*1e5),accessCount:Math.floor(Math.random()*1e3)})),entryPoints:e,dataPaths:t,relationships:n}}function G2(){const{setGalaxyData:r,setLoading:e,setError:t,isLoading:n,error:i,galaxyData:s}=Fn(),[a,c]=W.useState(!1),[u,h]=W.useState("api"),d=W.useCallback(async()=>{var f;e(!0),t(null);try{let m,g="api";if(a)m=Sf(),g="mock";else try{const _=await fetch("/api/galaxy");if(!_.ok)throw new Error(`HTTP ${_.status}: ${_.statusText}`);m=await _.json(),(!m.tables||m.tables.length===0)&&(console.log("No tables found in API response, falling back to mock data"),m=Sf(),g="mock")}catch(_){console.log("API fetch failed, falling back to mock data:",_),m=Sf(),g="mock"}h(g);const{tables:x,entryPoints:S}=L2(m.tables,m.entryPoints,m.dataPaths),y=m.stats??{tableCount:x.length,fieldCount:x.reduce((_,b)=>_+b.fields.length,0),entryPointCount:S.length,pathCount:m.dataPaths.length,sensitiveFields:{critical:x.reduce((_,b)=>_+b.fields.filter(M=>M.sensitivity==="critical").length,0),high:x.reduce((_,b)=>_+b.fields.filter(M=>M.sensitivity==="high").length,0),medium:x.reduce((_,b)=>_+b.fields.filter(M=>M.sensitivity==="medium").length,0),low:x.reduce((_,b)=>_+b.fields.filter(M=>M.sensitivity==="low").length,0),public:x.reduce((_,b)=>_+b.fields.filter(M=>M.sensitivity==="public").length,0)},untestedPaths:m.dataPaths.filter(_=>!_.isTested).length,deadCodeCount:0,healthScore:((f=m.stats)==null?void 0:f.healthScore)??72};r({tables:x,entryPoints:S,dataPaths:m.dataPaths,relationships:m.relationships??[],stats:y,lastUpdated:m.lastUpdated??new Date().toISOString()})}catch(m){t(m instanceof Error?m.message:"Failed to load galaxy data")}},[a,r,e,t]);return W.useEffect(()=>{d()},[d]),{isLoading:n,error:i,data:s,refetch:d,useMock:a,setUseMock:c,dataSource:u}}function W2(){const{viewMode:r,setViewMode:e,togglePanel:t,activePanel:n}=Fn();return L.jsxs("div",{className:"absolute right-4 top-4 flex items-center gap-2 z-10",children:[L.jsx("div",{className:"flex bg-slate-800/80 rounded-lg overflow-hidden",children:[{mode:"overview",icon:"🌌",label:"Overview"},{mode:"security",icon:"🔒",label:"Security"},{mode:"coverage",icon:"📊",label:"Coverage"}].map(({mode:i,icon:s,label:a})=>L.jsx("button",{onClick:()=>e(i),className:`px-3 py-2 text-sm transition-colors ${r===i?"bg-blue-500/30 text-blue-400":"text-slate-400 hover:text-white hover:bg-slate-700"}`,title:a,children:s},i))}),L.jsxs("div",{className:"flex bg-slate-800/80 rounded-lg overflow-hidden",children:[L.jsx("button",{onClick:()=>t("security"),className:`px-3 py-2 text-sm transition-colors ${n==="security"?"bg-red-500/30 text-red-400":"text-slate-400 hover:text-white"}`,title:"Security Panel",children:"🛡️"}),L.jsx("button",{onClick:()=>t("settings"),className:`px-3 py-2 text-sm transition-colors ${n==="settings"?"bg-purple-500/30 text-purple-400":"text-slate-400 hover:text-white"}`,title:"Settings",children:"⚙️"})]})]})}function j2({dataSource:r,useMock:e,setUseMock:t,tableCount:n,entryPointCount:i}){return L.jsxs("div",{className:"absolute left-4 top-4 z-10 flex flex-col gap-2",children:[L.jsxs("label",{className:"flex items-center gap-2 text-sm text-slate-400 bg-slate-800/80 px-3 py-2 rounded-lg cursor-pointer",children:[L.jsx("input",{type:"checkbox",checked:e,onChange:s=>t(s.target.checked),className:"rounded"}),"Use Mock Data"]}),L.jsxs("div",{className:`text-xs px-3 py-1.5 rounded-lg ${r==="api"?"bg-green-500/20 text-green-400":"bg-yellow-500/20 text-yellow-400"}`,children:[r==="api"?"🔗 Live Data":"🎭 Mock Data",L.jsxs("span",{className:"ml-2 opacity-70",children:[n," tables • ",i," endpoints"]})]})]})}function $2(){const{isLoading:r,error:e,data:t,refetch:n,useMock:i,setUseMock:s,dataSource:a}=G2();return e&&!t?L.jsxs("div",{className:"flex flex-col items-center justify-center h-[calc(100vh-200px)] text-center",children:[L.jsx("div",{className:"text-6xl mb-4",children:"🌑"}),L.jsx("h2",{className:"text-xl font-semibold text-white mb-2",children:"Galaxy Unavailable"}),L.jsx("p",{className:"text-slate-400 mb-4",children:e}),L.jsxs("div",{className:"flex gap-3",children:[L.jsx("button",{onClick:n,className:"px-4 py-2 bg-blue-500 hover:bg-blue-600 text-white rounded-lg transition-colors",children:"Retry"}),L.jsx("button",{onClick:()=>s(!0),className:"px-4 py-2 bg-slate-600 hover:bg-slate-500 text-white rounded-lg transition-colors",children:"Use Mock Data"})]})]}):r&&!t?L.jsxs("div",{className:"flex flex-col items-center justify-center h-[calc(100vh-200px)]",children:[L.jsx("div",{className:"text-6xl mb-4 animate-pulse",children:"🌌"}),L.jsx("p",{className:"text-slate-400",children:"Loading galaxy..."}),L.jsx("p",{className:"text-slate-500 text-sm mt-2",children:"Scanning boundaries and call graph..."})]}):L.jsxs("div",{className:"relative h-[calc(100vh-200px)] bg-slate-950 rounded-lg overflow-hidden",children:[L.jsx(j2,{dataSource:a,useMock:i,setUseMock:s,tableCount:(t==null?void 0:t.tables.length)??0,entryPointCount:(t==null?void 0:t.entryPoints.length)??0}),L.jsx(W2,{}),L.jsx(y2,{className:"w-full h-full"}),L.jsx(k2,{}),L.jsx(H2,{}),L.jsx(I2,{}),L.jsx(O2,{}),L.jsx(z2,{})]})}export{$2 as GalaxyTab};
4177
+ //# sourceMappingURL=GalaxyTab-BsAmWarF.js.map