PageSourceSearch

https://cocoding.ai/_next/static/chunks/5216.ba51a611691b8c1e.js

js cocoding.ai collected 2026-10-05 11:57:14 UTC 45,459 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5216],{35216:(e,t,a)=>{a.r(t),a.d(t,{DatabaseContent:()=>ec});var r=a(95155),s=a(17652),l=a(35695),i=a(12115),n=a(64416),o=a(48836),d=a(25055),c=a(56287),m=a(62525),x=a(51591);function u(e){let{onEditRecord:t,onDeleteRecord:a}=e,l=(0,s.c3)("public.database_explorer"),{tableData:i,tableSchema:n,isLoadingTableData:o,currentTable:u}=(0,d.kM)(["tableData","tableSchema","isLoadingTableData","currentTable"]);if(o)return(0,r.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,r.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,r.jsx)("div",{className:"animate-spin rounded-full h-10 w-10 border-t-2 border-b-2 border-purple-600"}),(0,r.jsx)("p",{className:"text-gray-400 text-sm",children:l("data_table.loading")})]})});if(!u)return(0,r.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,r.jsx)("p",{className:"text-gray-400 text-sm",children:l("data_table.no_table_selected")})});if(0===i.length)return(0,r.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,r.jsx)("p",{className:"text-gray-400 text-sm",children:l("data_table.empty")})});let h=n.length>0?n.map(e=>e.column_name):Object.keys(i[0]||{});return(0,r.jsx)("div",{className:"h-full overflow-auto scroll-y scroll-x",children:(0,r.jsxs)("table",{className:"w-full text-sm text-left",children:[(0,r.jsx)("thead",{className:"sticky top-0 bg-gray-800 text-gray-300 border-b border-gray-700",children:(0,r.jsxs)("tr",{children:[h.map(e=>(0,r.jsx)("th",{className:"px-4 py-3 font-medium whitespace-nowrap",children:e},e)),(0,r.jsx)("th",{className:"px-4 py-3 font-medium whitespace-nowrap w-24",children:l("data_table.actions")})]})}),(0,r.jsx)("tbody",{className:"bg-midnight-950",children:i.map((e,s)=>(0,r.jsxs)("tr",{className:(0,x.cn)("border-b border-gray-800 hover:bg-gray-900/50 transition"),children:[h.map(t=>{var a;return(0,r.jsx)("td",{className:"px-4 py-3 text-gray-300 whitespace-nowrap max-w-xs truncate",title:String(null!=(a=e[t])?a:""),children:null===e[t]?(0,r.jsx)("span",{className:"text-gray-500 italic",children:l("data_table.null_value")}):String(e[t])},t)}),(0,r.jsx)("td",{className:"px-4 py-3 whitespace-nowrap",children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("button",{type:"button",onClick:()=>t(e),className:"p-1.5 rounded-md hover:bg-gray-800 text-gray-400 hover:text-purple-400 transition",title:l("data_table.edit_record"),children:(0,r.jsx)(c.A,{size:14})}),(0,r.jsx)("button",{type:"button",onClick:()=>a(e),className:"p-1.5 rounded-md hover:bg-gray-800 text-gray-400 hover:text-red-400 transition",title:l("data_table.delete_record"),children:(0,r.jsx)(m.A,{size:14})})]})})]},s))})]})})}var h=a(85339),p=a(51154),b=a(90010),g=a(30285);function y(e){let{isOpen:t,onClose:a,onConfirm:l,recordData:i,tableName:n,isDeleting:o,error:d}=e,c=(0,s.c3)("public.database_explorer");return(0,r.jsx)(b.AlertDialog,{open:t,onOpenChange:a,children:(0,r.jsxs)(b.AlertDialogContent,{className:"w-full sm:max-w-[650px] bg-purple-950 border-none rounded-md",children:[(0,r.jsxs)(b.AlertDialogHeader,{className:"pb-4 border-b border-ash-700",children:[(0,r.jsxs)(b.AlertDialogTitle,{className:"flex items-center gap-2 text-ash-100 text-xl font-semibold",children:[(0,r.jsx)(h.A,{className:"h-5 w-5 text-red-500"}),c("delete_dialog.title")]}),(0,r.jsx)(b.AlertDialogDescription,{className:"text-ash-500",children:c.rich("delete_dialog.description",{tableName:e=>(0,r.jsx)("strong",{children:e}),tableNameValue:n})})]}),(0,r.jsxs)("div",{className:"mt-4 p-4 bg-midnight-950 rounded border border-ash-700",children:[(0,r.jsx)("p",{className:"text-sm text-ash-400 mb-2",children:c("delete_dialog.record_details")}),(0,r.jsx)("div",{className:"space-y-1 max-h-60 overflow-y-auto scroll-y",children:Object.entries(i).map(e=>{let[t,a]=e;return(0,r.jsxs)("div",{className:"flex gap-2 text-xs",children:[(0,r.jsxs)("span",{className:"text-ash-500 font-medium min-w-[120px]",children:[t,":"]}),(0,r.jsx)("span",{className:"text-ash-300 break-all",children:null===a?(0,r.jsx)("span",{className:"italic",children:c("delete_dialog.null_value")}):String(a)})]},t)})})]}),d&&(0,r.jsx)("div",{className:"mt-4 rounded-md bg-red-500/10 border border-red-500/20 p-3",children:(0,r.jsx)("p",{className:"text-sm text-red-400",children:d})}),(0,r.jsxs)("div",{className:"flex gap-3 mt-6",children:[(0,r.jsx)(g.$,{type:"button",onClick:a,disabled:o,className:(0,x.cn)("flex-1 bg-ash-700 hover:bg-ash-600 text-ash-100","disabled:opacity-50 disabled:cursor-not-allowed"),children:c("delete_dialog.cancel")}),(0,r.jsx)(g.$,{type:"button",onClick:l,disabled:o,className:(0,x.cn)("flex-1 bg-red-600 hover:bg-red-700 text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:o?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(p.A,{className:"mr-2 h-4 w-4 animate-spin"}),c("delete_dialog.deleting")]}):c("delete_dialog.delete")})]})]})})}var f=a(53904),j=a(84616);function N(e){let{onAddRecord:t}=e,a=(0,s.c3)("public.database_explorer"),{currentTable:l,totalRecords:i,isLoadingTableData:n}=(0,d.kM)(["currentTable","totalRecords","isLoadingTableData"]),{loadTableData:o}=(0,d.KM)();return(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 bg-gray-900/50 border-b border-gray-700",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold text-gray-100",children:l}),(0,r.jsx)("span",{className:"text-sm text-gray-500",children:a("filter_bar.records",{count:i})})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsxs)("button",{type:"button",onClick:()=>{n||o()},disabled:n,className:(0,x.cn)("px-3 py-1.5 rounded-full flex items-center gap-2","bg-gray-800 hover:bg-gray-700 text-gray-300 text-sm font-medium transition","disabled:opacity-50 disabled:cursor-not-allowed"),title:a("filter_bar.refresh"),children:[(0,r.jsx)(f.A,{size:14,className:(0,x.cn)(n&&"animate-spin")}),a("filter_bar.refresh")]}),(0,r.jsxs)("button",{type:"button",onClick:t,className:(0,x.cn)("px-3 py-1.5 rounded-full flex items-center gap-2","bg-purple-600 hover:bg-purple-700 text-white text-sm font-medium transition"),children:[(0,r.jsx)(j.A,{size:14}),a("filter_bar.add_record")]})]})]})}var v=a(42355),_=a(13052);function w(){let e=(0,s.c3)("public.database_explorer"),{currentPage:t,pageSize:a,totalRecords:l,isLoadingTableData:i}=(0,d.kM)(["currentPage","pageSize","totalRecords","isLoadingTableData"]),{loadTableData:n,setDatabaseStore:o}=(0,d.KM)(),c=Math.ceil(l/a),m=Math.min(t*a,l),u=e=>{e>=1&&e<=c&&!i&&n(e)},h=e=>{o({pageSize:e,currentPage:1}),n(1)};return 0===l?null:(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 bg-gray-900/50 border-t border-gray-700",children:[(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"text-sm text-gray-400",children:e("pagination.rows_per_page")}),(0,r.jsxs)("select",{value:a,onChange:e=>h(Number(e.target.value)),disabled:i,"aria-label":e("pagination.rows_per_page"),className:(0,x.cn)("px-2 py-1 rounded-md bg-midnight-950 border border-gray-600/20","text-sm text-gray-300 focus:outline-none focus:ring-2 focus:ring-purple-500","disabled:opacity-50 disabled:cursor-not-allowed"),children:[(0,r.jsx)("option",{value:25,children:"25"}),(0,r.jsx)("option",{value:50,children:"50"}),(0,r.jsx)("option",{value:100,children:"100"}),(0,r.jsx)("option",{value:200,children:"200"})]})]}),(0,r.jsx)("div",{className:"text-sm text-gray-400",children:e("pagination.range",{start:(t-1)*a+1,end:m,total:l})})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("button",{type:"button",onClick:()=>u(t-1),disabled:1===t||i,className:(0,x.cn)("p-1.5 rounded-md transition","hover:bg-gray-800 text-gray-400 hover:text-gray-200","disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent"),title:e("pagination.previous"),children:(0,r.jsx)(v.A,{size:18})}),(0,r.jsx)("div",{className:"flex items-center gap-1",children:Array.from({length:Math.min(5,c)},(e,a)=>{let s;return s=c<=5||t<=3?a+1:t>=c-2?c-4+a:t-2+a,(0,r.jsx)("button",{type:"button",onClick:()=>u(s),disabled:i,className:(0,x.cn)("min-w-[32px] h-8 rounded-md text-sm font-medium transition",t===s?"bg-purple-600 text-white":"text-gray-400 hover:bg-gray-800 hover:text-gray-200","disabled:opacity-50 disabled:cursor-not-allowed"),children:s},s)})}),(0,r.jsx)("button",{type:"button",onClick:()=>u(t+1),disabled:t===c||i,className:(0,x.cn)("p-1.5 rounded-md transition","hover:bg-gray-800 text-gray-400 hover:text-gray-200","disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent"),title:e("pagination.next"),children:(0,r.jsx)(_.A,{size:18})})]})]})}var k=a(85690);function z(){let e=(0,s.c3)("public.database_explorer"),{isExecuting:t}=(0,d.kM)(["isExecuting"]),{executeQuery:a}=(0,d.KM)(),[l,n]=(0,i.useState)(""),o=(0,i.useCallback)(async()=>
1{if(l.trim()&&!t)try{await a(l)}catch(e){console.error("Query execution error:",e)}},[l,t,a]),c=(0,i.useCallback)(e=>{(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&(e.preventDefault(),o())},[o]);return(0,r.jsxs)("div",{className:"flex flex-col h-full bg-midnight-950",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-4 px-6 py-3 bg-gradient-to-b from-gray-900/70 to-gray-900/50 border-b border-gray-700/50 backdrop-blur-sm",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("div",{className:"h-2 w-2 rounded-full bg-purple-500 animate-pulse"}),(0,r.jsx)("h3",{className:"text-sm font-semibold text-gray-200",children:e("query_editor.title")})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsxs)("button",{type:"button",onClick:()=>{n("")},className:(0,x.cn)("px-4 py-2 rounded-lg flex items-center gap-2","bg-gray-800/80 hover:bg-gray-700 text-gray-300 hover:text-white text-sm font-medium","transition-all duration-200 shadow-sm hover:shadow-md","border border-gray-700/50 hover:border-gray-600"),title:e("query_editor.clear_title"),children:[(0,r.jsx)(m.A,{size:16}),e("query_editor.clear")]}),(0,r.jsx)("button",{type:"button",onClick:o,disabled:!l.trim()||t,className:(0,x.cn)("px-5 py-2 rounded-lg flex items-center gap-2","bg-gradient-to-r from-purple-600 to-purple-700 hover:from-purple-500 hover:to-purple-600","text-white text-sm font-semibold transition-all duration-200","shadow-lg shadow-purple-900/50 hover:shadow-xl hover:shadow-purple-900/60","disabled:opacity-50 disabled:cursor-not-allowed disabled:shadow-none","border border-purple-500/20"),title:e("query_editor.execute_title"),children:t?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(p.A,{size:16,className:"animate-spin"}),e("query_editor.executing")]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(k.A,{size:16}),e("query_editor.execute")]})})]})]}),(0,r.jsx)("div",{className:"flex-1 p-6",children:(0,r.jsx)("textarea",{value:l,onChange:e=>n(e.target.value),onKeyDown:c,placeholder:e("query_editor.placeholder"),className:(0,x.cn)("w-full h-full resize-none","bg-midnight-900/50 border border-gray-700/50 rounded-xl","text-gray-100 text-[13px] leading-relaxed font-mono","px-5 py-4 focus:outline-none focus:ring-2 focus:ring-purple-500/50 focus:border-purple-500/50","placeholder:text-gray-600 placeholder:font-mono","shadow-inner transition-all duration-200"),spellCheck:!1})}),(0,r.jsx)("div",{className:"px-6 py-3 bg-gradient-to-t from-gray-900/70 to-gray-900/50 border-t border-gray-700/50 backdrop-blur-sm",children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("div",{className:"h-1.5 w-1.5 rounded-full bg-purple-500 animate-pulse"}),(0,r.jsxs)("p",{className:"text-xs text-gray-400 font-medium",children:[e("query_editor.tip_prefix")," ",(0,r.jsx)("kbd",{className:"px-2 py-1 bg-gray-800/80 rounded border border-gray-700/50 text-gray-300 font-mono text-[11px] shadow-sm",children:"Cmd"})," ","+"," ",(0,r.jsx)("kbd",{className:"px-2 py-1 bg-gray-800/80 rounded border border-gray-700/50 text-gray-300 font-mono text-[11px] shadow-sm",children:"Enter"})," ",e("query_editor.tip_suffix")]})]})})]})}var C=a(29676),A=a(43453),S=a(54861);function T(){let e=(0,s.c3)("public.database_explorer"),{queryHistory:t}=(0,d.kM)(["queryHistory"]),{executeQuery:a}=(0,d.KM)(),l=t=>{let a=new Date(t),r=Math.floor((new Date().getTime()-a.getTime())/6e4);return r<1?e("query_history.just_now"):r<60?e("query_history.minutes_ago",{count:r}):r<1440?e("query_history.hours_ago",{count:Math.floor(r/60)}):a.toLocaleDateString()};return 0===t.length?(0,r.jsx)("div",{className:"flex items-center justify-center h-full bg-midnight-950 p-6",children:(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsxs)("div",{className:"relative inline-block mb-5",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-purple-500/10 rounded-full blur-xl animate-pulse"}),(0,r.jsx)(C.A,{size:56,className:"relative text-gray-600 mx-auto",strokeWidth:1.5})]}),(0,r.jsx)("p",{className:"text-gray-300 text-sm font-medium mb-2",children:e("query_history.empty_title")}),(0,r.jsx)("p",{className:"text-gray-500 text-xs leading-relaxed max-w-[200px] mx-auto",children:e("query_history.empty_description")})]})}):(0,r.jsxs)("div",{className:"flex flex-col h-full bg-midnight-950",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 bg-gradient-to-b from-gray-900/70 to-gray-900/50 border-b border-gray-700/50 backdrop-blur-sm",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(C.A,{className:"h-4 w-4 text-purple-400"}),(0,r.jsx)("span",{className:"text-sm font-semibold text-gray-200",children:e("query_history.title")})]}),(0,r.jsx)("span",{className:"text-xs text-gray-400 bg-gray-800/50 px-2 py-1 rounded-full border border-gray-700/50",children:t.length})]}),(0,r.jsx)("div",{className:"flex-1 overflow-y-auto scroll-y p-4 space-y-2",children:t.map(t=>(0,r.jsxs)("div",{className:(0,x.cn)("p-3 rounded-xl border transition-all duration-200 group relative overflow-hidden",t.success?"bg-gray-900/30 border-gray-700/50 hover:border-purple-500/30 hover:bg-gray-900/50 hover:shadow-lg hover:shadow-
1purple-900/10":"bg-red-500/5 border-red-500/20 hover:border-red-500/40 hover:bg-red-500/10"),children:[t.success&&(0,r.jsx)("div",{className:"absolute inset-0 bg-gradient-to-r from-purple-500/0 via-purple-500/5 to-purple-500/0 opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),(0,r.jsxs)("div",{className:"flex items-start justify-between gap-2 mb-2 relative",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[(0,r.jsx)("div",{className:(0,x.cn)("p-1 rounded-full",t.success?"bg-green-500/10":"bg-red-500/10"),children:t.success?(0,r.jsx)(A.A,{className:"h-3.5 w-3.5 text-green-400 shrink-0"}):(0,r.jsx)(S.A,{className:"h-3.5 w-3.5 text-red-400 shrink-0"})}),(0,r.jsx)("span",{className:"text-[11px] text-gray-500 font-medium",children:l(t.timestamp)}),t.success&&void 0!==t.rowCount&&(0,r.jsx)("span",{className:"text-[10px] text-gray-500 bg-gray-800/50 px-1.5 py-0.5 rounded-full border border-gray-700/50",children:e("query_history.rows",{count:t.rowCount})})]}),t.success&&(0,r.jsx)("button",{type:"button",onClick:()=>a(t.query),className:(0,x.cn)("opacity-0 group-hover:opacity-100 transition-all duration-200","p-1.5 rounded-lg hover:bg-purple-600/20 text-gray-400 hover:text-purple-400","border border-transparent hover:border-purple-500/30"),title:e("query_history.re_run"),children:(0,r.jsx)(k.A,{size:13})})]}),(0,r.jsx)("pre",{className:"text-[11px] text-gray-300 font-mono whitespace-pre-wrap break-words leading-relaxed relative",children:t.query}),t.error&&(0,r.jsx)("div",{className:"mt-2 text-[11px] text-red-400 font-mono bg-red-500/5 p-2 rounded-lg border border-red-500/20",children:e("query_history.error_prefix",{message:t.error})})]},t.id))})]})}var D=a(54213);function E(){let e=(0,s.c3)("public.database_explorer"),{queryResult:t,error:a,isExecuting:l}=(0,d.kM)(["queryResult","error","isExecuting"]);if(l)return(0,r.jsx)("div",{className:"flex items-center justify-center h-full bg-midnight-950",children:(0,r.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,r.jsx)("div",{className:"animate-spin rounded-full h-10 w-10 border-t-2 border-b-2 border-purple-600"}),(0,r.jsx)("p",{className:"text-gray-400 text-sm",children:e("query_results.executing")})]})});if(a)return(0,r.jsx)("div",{className:"flex items-center justify-center h-full bg-midnight-950",children:(0,r.jsx)("div",{className:"max-w-2xl mx-auto p-6",children:(0,r.jsxs)("div",{className:"flex items-start gap-3 p-4 bg-red-500/10 border border-red-500/20 rounded-lg",children:[(0,r.jsx)(S.A,{className:"h-5 w-5 text-red-500 shrink-0 mt-0.5"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("h3",{className:"text-red-400 font-medium mb-1",children:e("query_results.error_title")}),(0,r.jsx)("p",{className:"text-red-300 text-sm whitespace-pre-wrap font-mono",children:a})]})]})})});if(!t)return(0,r.jsx)("div",{className:"flex items-center justify-center h-full bg-midnight-950",children:(0,r.jsxs)("div",{className:"text-center p-8",children:[(0,r.jsxs)("div",{className:"relative inline-block mb-6",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-purple-500/10 rounded-full blur-xl animate-pulse"}),(0,r.jsx)(D.A,{size:64,className:"relative text-gray-600 mx-auto",strokeWidth:1.5})]}),(0,r.jsx)("p",{className:"text-gray-300 text-base font-medium mb-2",children:e("query_results.empty_title")}),(0,r.jsx)("p",{className:"text-gray-500 text-sm",children:e("query_results.empty_description")})]})});let i=t.rows.length>0?Object.keys(t.rows[0]):[];return(0,r.jsxs)("div",{className:"flex flex-col h-full bg-midnight-950",children:[(0,r.jsx)("div",{className:"flex items-center justify-between px-6 py-3 bg-gradient-to-r from-green-900/20 to-gray-900/50 border-b border-green-700/30 backdrop-blur-sm",children:(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"p-1.5 rounded-full bg-green-500/10",children:(0,r.jsx)(A.A,{className:"h-4 w-4 text-green-400"})}),(0,r.jsx)("span",{className:"text-sm text-gray-200 font-medium",children:e("query_results.success")}),(0,r.jsx)("span",{className:"text-xs text-gray-400 bg-gray-800/50 px-2 py-1 rounded-full border border-gray-700/50",children:e("query_results.rows",{count:t.rowCount})})]})}),0===t.rows.length?(0,r.jsx)("div",{className:"flex items-center justify-center flex-1",children:(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)(A.A,{size:48,className:"text-green-500 mx-auto mb-4"}),(0,r.jsx)("p",{className:"text-gray-400 text-sm",children:e("query_results.success")}),(0,r.jsx)("p",{className:"text-gray-500 text-xs mt-2",children:e("query_results.no_rows")})]})}):(0,r.jsx)("div",{className:"flex-1 overflow-auto scroll-y scroll-x",children:(0,r.jsxs)("table",{className:"w-full text-sm text-left",children:[(0,r.jsx)("thead",{className:"sticky top-0 bg-gray-800 text-gray-300 border-b border-gray-700",children:(0,r.jsx)("tr",{children:i.map(e=>(0,r.jsx)("th",{className:"px-4 py-3 font-medium whitespace-nowrap",children:e},e))})}),(0,r.jsx)("tbody",{children:t.rows.map((e,t)=>(0,r.jsx)("tr",{className:(0,x.cn)("border-b border-gray-800 hover:bg-gray-900/50 transition"),children:i.map(t=>{var a;return(0,r.jsx)("td",{className:"px-4 py-3 text-gray-300 whitespace-nowrap max-w-xs truncate",title:String(null!=(a=e[t])?a:""),children:null===e[t]?(0,r.jsx)("span",{className:"text-gray-500 italic",children:"NULL"}):String(e[t])},t)})},t))})]})})]})}var M=a(54165);function q(e){let{isOpen:t,onClose:a,mode:l,initialData:n}=e,o=(0,s.c3)("public.database_explorer"),{tableSchema:c,currentTable:m}=(0,d.kM)(["tableSchema","currentTable"]),{insertRecord:u,updateRecord:h}=(0,d.KM)(),[b,y]=(0,i.useState)({}),[f,j]=(0,i.useState)(!1),[N,v]=(0,i.useState)(null);(0,i.useEffect)(()=>{t&&(y(n),v(null))},[t,n]);let _=async e=>{e.preventDefault(),v(null),j(!0);try{if("create"===l)await u(b);else{let e=Object.entries(n).map(e=>
1{let[t,a]=e;return null===a?"".concat(t," IS NULL"):"".concat(t," = '").concat(a,"'")}).join(" AND ");await h(b,e)}a()}catch(e){v(e instanceof Error?e.message:o("errors.save_record_failed"))}finally{j(!1)}},w=(e,t)=>{y(a=>({...a,[e]:""===t?null:t}))};return(0,r.jsx)(M.lG,{open:t,onOpenChange:a,children:(0,r.jsxs)(M.Cf,{className:"w-full sm:max-w-[750px] max-h-[90vh] bg-purple-950 border-none rounded-md",children:[(0,r.jsxs)(M.c7,{className:"pb-5 border-b border-ash-700",children:[(0,r.jsx)(M.L3,{className:"text-xl font-semibold text-ash-100",children:"create"===l?o("record_editor.create_title"):o("record_editor.edit_title")}),(0,r.jsx)(M.rr,{className:"text-sm text-ash-500 mt-2",children:"create"===l?o("record_editor.create_description",{table:null!=m?m:""}):o("record_editor.edit_description",{table:null!=m?m:""})})]}),(0,r.jsxs)("form",{onSubmit:_,className:"space-y-6 mt-6 overflow-y-auto scroll-y max-h-[55vh] pr-3",children:[c.map(e=>{var t;return(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("label",{htmlFor:e.column_name,className:"flex items-center justify-between text-xs text-ash-100",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{children:e.column_name}),"NO"===e.is_nullable&&(0,r.jsx)("span",{className:"text-red-400",children:"*"})]}),(0,r.jsxs)("span",{className:"text-[11px] text-ash-500",children:[e.data_type,e.character_maximum_length&&" (".concat(e.character_maximum_length,")")]})]}),(0,r.jsx)("input",{id:e.column_name,type:"text",value:null!=(t=b[e.column_name])?t:"",onChange:t=>w(e.column_name,t.target.value),placeholder:"YES"===e.is_nullable?o("record_editor.null_placeholder"):e.column_default||o("record_editor.default_placeholder",{column:e.column_name}),required:"NO"===e.is_nullable&&!e.column_default,className:(0,x.cn)("h-10 px-3.5 w-full bg-white/10 rounded border border-ash-600/20","text-ash-100 placeholder:text-ash-500 text-sm","focus:outline-hidden focus:ring-1 focus:ring-ash-400/30")})]},e.column_name)}),N&&(0,r.jsx)("div",{className:"rounded-md bg-red-500/10 border border-red-500/20 p-3",children:(0,r.jsx)("p",{className:"text-sm text-red-400",children:N})})]}),(0,r.jsxs)("div",{className:"flex gap-3 pt-4 mt-4 border-t border-ash-700",children:[(0,r.jsx)(g.$,{type:"button",onClick:a,disabled:f,className:(0,x.cn)("flex-1 bg-ash-700 hover:bg-ash-600 text-ash-100","disabled:opacity-50 disabled:cursor-not-allowed"),children:o("record_editor.cancel")}),(0,r.jsx)(g.$,{type:"submit",disabled:f,onClick:_,className:(0,x.cn)("flex-1 bg-purple-600 hover:bg-purple-700 text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:f?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(p.A,{className:"mr-2 h-4 w-4 animate-spin"}),o("record_editor.saving")]}):"create"===l?o("record_editor.create"):o("record_editor.save")})]})]})})}var R=a(61772);a(66419);var O=a(56671),L=a(57901),P=a(54481),G=a(6262),F=a(40081);function H(e){let{onResetLayout:t}=e,a=(0,s.c3)("public.database_explorer"),{zoomIn:l,zoomOut:i,fitView:o}=(0,R.VH)(),d=()=>{o({padding:.2,duration:400})};return(0,r.jsx)(n.TooltipProvider,{delayDuration:100,children:(0,r.jsxs)(R.Zk,{position:"bottom-left",className:"flex space-x-3 items-center",children:[(0,r.jsxs)(n.Tooltip,{children:[(0,r.jsx)(n.TooltipTrigger,{asChild:!0,children:(0,r.jsx)(n.Button,{type:"button",size:"icon",variant:"outline",onClick:d,className:"rounded-sm hover:border-blue-500 hover:bg-blue-500/10 hover:text-blue-500 sm:size-11 border-gray-700 border-2 bg-[#1a1a1a] group",children:(0,r.jsx)(L.A,{className:"size-4.5 stroke-[2.5] stroke-gray-400 group-hover:stroke-blue-500"})})}),(0,r.jsxs)(n.TooltipContent,{side:"top",align:"start",className:"bg-gray-800 border-gray-700 text-gray-100",sideOffset:8,children:[a("schema_controls.fit_view"),(0,r.jsx)(n.TooltipArrow,{className:"fill-gray-800"})]})]}),(0,r.jsxs)(n.Tooltip,{children:[(0,r.jsx)(n.TooltipTrigger,{asChild:!0,children:(0,r.jsx)(n.Button,{type:"button",size:"icon",variant:"outline",onClick:()=>{l({duration:300})},className:"rounded-sm hover:border-blue-500 hover:bg-blue-500/10 hover:text-blue-500 sm:size-11 border-gray-700 border-2 bg-[#1a1a1a] group",children:(0,r.jsx)(P.A,{className:"size-4.5 stroke-[2.5] stroke-gray-400 group-hover:stroke-blue-500"})})}),(0,r.jsxs)(n.TooltipContent,{side:"top",align:"start",className:"bg-gray-800 border-gray-700 text-gray-100",sideOffset:8,children:[a("schema_controls.zoom_in"),(0,r.jsx)(n.TooltipArrow,{className:"fill-gray-800"})]})]}),(0,r.jsxs)(n.Tooltip,{children:[(0,r.jsx)(n.TooltipTrigger,{asChild:!0,children:(0,r.jsx)(n.Button,{type:"button",size:"icon",variant:"outline",onClick:()=>{i({duration:300})},className:"rounded-sm hover:border-blue-500 hover:bg-blue-500/10 hover:text-blue-500 sm:size-11 border-gray-700 border-2 bg-[#1a1a1a] group",children:(0,r.jsx)(G.A,{className:"size-4.5 stroke-[2.5] stroke-gray-400 group-hover:stroke-blue-500"})})}),(0,r.jsxs)(n.TooltipContent,{side:"top",align:"start",className:"bg-gray-800 border-gray-700 text-gray-100",sideOffset:8,children:[a("schema_controls.zoom_out"),(0,r.jsx)(n.TooltipArrow,{className:"fill-gray-800"})]})]}),(0,r.jsxs)(n.Tooltip,{children:[(0,r.jsx)(n.TooltipTrigger,{asChild:!0,children:(0,r.jsx)(n.Button,{type:"button",size:"icon",variant:"outline",onClick:()=>{t?t():d()},className:"rounded-sm hover:border-blue-500 hover:bg-blue-500/10 hover:text-blue-500 sm:size-11 border-gray-700 border-2 bg-[#1a1a1a] group",children:(0,r.jsx)(F.A,{className:"size-4.5 stroke-[2.5] stroke-gray-400 group-hover:stroke-blue-500"})})}),(0,r.jsxs)(n.TooltipContent,{side:"top",align:"start",className:"bg-gray-800 border-gray-700 text-gray-100",sideOffset:8,children:[a("schema_controls.organize_layout"),(0,r.jsx)(n.TooltipArrow,{className:"fill-gray-800"})]})]})]})})}var I=a(49919),B=a(31787),K=a(69803),W=a(38164),V=a(38564);let U=(0,i.memo)(e=>{let{data:t,selected:a}=e,l=(0,s.c3)("public.database_explorer"),{tableName:i,schema:n,columns:o,primaryKeys:d,foreignKeys:c,uniqueColumns:m}=t,u=e=>d.includes(e),h=e=>c.some(t=>t.column===e),p=e=>m.includes(e);return(0,r.jsxs)("div",{className:(0,x.cn)("bg-[#1a1a1a] rounded-lg shadow-lg border transition-all min-w-[280px] max-w-[400px]",a?"border-blue-500 shadow-blue-500/20":"border-gray-700 hover:border-gray-600"),children:[(0,r.jsxs)("div",{className:"bg-gray-800/50 px-4 py-3 rounded-t-lg border-b border-gray-700 flex items-center gap-2",children:[(0,r.jsx)(B.A,{size:18,className:"text-gray-400"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("h3",{className:"text-gray-100 font-semibold text-sm",children:i}),(0,r.jsx)("p",{className:"text-gray-400 text-xs",children:n})]})]}),(0,r.jsx)("div",{className:"p-2 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:bg-gray-700 [&::-webkit-scrollbar-thumb]:rounded-full hover:[&::-webkit-scrollbar-thumb]:bg-gray-600",children:o.map(e=>{let t=u(e.column_name),a=h(e.column_name),s=p(e.column_name);return(0,r.jsxs)("div",{className:(0,x.cn)("relative px-3 py-2 mb-0.5 rounded text-xs flex items-center gap-2 transition-colors",t?"bg-yellow-500/10 border border-yellow-500/30":a?"bg-blue-500/10 border border-blue-500/30":"hover:bg-gray-800/50"),children:[a&&(0,r.jsx)(R.h7,{type:"source",position:I.yX.Right,id:e.column_name,className:"!w-3 !h-3 !bg-blue-500 !border-2 !border-gray-800 !rounded-full !top-1/2 !-translate-y-1/2 !-right-[6px]"}),(t||s)&&(0,r.jsx)(R.h7,{type:"target",position:I.yX.Left,id:e.column_name,className:(0,x.cn)("!w-3 !h-3 !border-2 !border-gray-800 !rounded-full !top-1/2 !-translate-y-1/2 !-left-[6px]",t?"!bg-yellow-500":"!bg-purple-500")}),(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[t&&(0,r.jsx)("span",{title:l("schema_table_node.primary_key"),children:(0,r.jsx)(K.A,{size:12,className:"text-yellow-400"})}),a&&(0,r.jsx)("span",{title:l("schema_table_node.foreign_key"),children:(0,r.jsx)(W.A,{size:12,className:"text-blue-400"})}),s&&!t&&(0,r.jsx)("span",{title:l("schema_table_node.unique"),children:(0,r.jsx)(V.A,{size:12,className:"text-gray-400"})})]}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("div",{className:(0,x.cn)("font-medium truncate",t?"text-yellow-300":a?"text-blue-300":"text-gray-200"),children:e.column_name}),(0,r.jsx)("div",{className:"text-gray-400 text-[10px] truncate",children:e.data_type})]}),"NO"===e.is_nullable&&(0,r.jsx)("span",{className:"text-gray-500 text-[10px] font-medium",children:l("schema_table_node.not_null")})]},e.column_name)})}),(0,r.jsx)("div",{className:"px-4 py-2 bg-gray-800/30 rounded-b-lg border-t border-gray-700",children:(0,r.jsx)("p",{className:"text-gray-400 text-[10px]",children:l("schema_table_node.columns",{count:o.length})})})]})});U.displayName="TableNode";var $=a(47924),J=a(54416),Y=a(91788),Z=a(42118),X=a(84209);let Q=(0,i.memo)(e=>{let{onSearch:t,onExportPNG:a,onExportSVG:l,onResetLayout:n,isExporting:o}=e,d=(0,s.c3)("public.database_explorer"),[c,m]=(0,i.useState)(""),[u,h]=(0,i.useState)(!1),p=e
1=>{m(e),t(e)};return(0,r.jsxs)("div",{className:"absolute top-4 left-4 z-10 flex items-center gap-2",children:[(0,r.jsx)("div",{className:"relative",children:(0,r.jsxs)("div",{className:"flex items-center bg-[#1a1a1a] border border-gray-700 rounded-lg px-3 py-2 min-w-[250px]",children:[(0,r.jsx)($.A,{size:16,className:"text-gray-500 mr-2"}),(0,r.jsx)("input",{type:"text",value:c,onChange:e=>p(e.target.value),placeholder:d("schema_toolbar.search_placeholder"),className:"bg-transparent text-white text-sm outline-none flex-1 placeholder:text-gray-500"}),c&&(0,r.jsx)("button",{type:"button",onClick:()=>{m(""),t("")},className:"ml-2 text-gray-500 hover:text-gray-300 transition","aria-label":d("schema_toolbar.clear_search"),title:d("schema_toolbar.clear_search"),children:(0,r.jsx)(J.A,{size:14})})]})}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsxs)("button",{type:"button",onClick:()=>h(!u),disabled:o,className:(0,x.cn)("flex items-center gap-2 bg-[#1a1a1a] border border-gray-700 rounded-lg px-3 py-2","text-white text-sm hover:bg-gray-800 transition","disabled:opacity-50 disabled:cursor-not-allowed"),title:d("schema_toolbar.export_title"),children:[(0,r.jsx)(Y.A,{size:16}),d("schema_toolbar.export")]}),u&&(0,r.jsxs)("div",{className:"absolute top-full mt-2 left-0 bg-[#1a1a1a] border border-gray-700 rounded-lg shadow-xl min-w-[150px] overflow-hidden",children:[(0,r.jsxs)("button",{type:"button",onClick:()=>{a(),h(!1)},disabled:o,className:(0,x.cn)("w-full flex items-center gap-2 px-3 py-2 text-white text-sm","hover:bg-gray-800 transition","disabled:opacity-50 disabled:cursor-not-allowed"),children:[(0,r.jsx)(Z.A,{size:14}),d("schema_toolbar.export_png")]}),(0,r.jsxs)("button",{type:"button",onClick:()=>{l(),h(!1)},disabled:o,className:(0,x.cn)("w-full flex items-center gap-2 px-3 py-2 text-white text-sm","hover:bg-gray-800 transition border-t border-gray-800","disabled:opacity-50 disabled:cursor-not-allowed"),children:[(0,r.jsx)(X.A,{size:14}),d("schema_toolbar.export_svg")]})]})]}),(0,r.jsxs)("button",{type:"button",onClick:n,className:(0,x.cn)("flex items-center gap-2 bg-[#1a1a1a] border border-gray-700 rounded-lg px-3 py-2","text-white text-sm hover:bg-gray-800 transition"),title:d("schema_toolbar.reset_title"),children:[(0,r.jsx)(f.A,{size:16}),d("schema_toolbar.reset")]})]})});Q.displayName="Toolbar";var ee=a(88251),et=a.n(ee),ea=a(78064);async function er(e,t){let a=new(et()),r=e.map(e=>{var t;return{id:e.tableName,width:320,height:0===(t=e.columns.length)?120:Math.min(Math.max(60+48*t+40,120),600)}}),s=r.reduce((e,t)=>e+t.height,0)/r.length||200,l=Math.max(...r.map(e=>e.height),200),i={id:"root",layoutOptions:{"elk.algorithm":"layered","elk.direction":"DOWN","elk.spacing.nodeNode":String(Math.max(100,.3*s)),"elk.layered.spacing.nodeNodeBetweenLayers":String(Math.max(150,.6*l)),"elk.layered.spacing.edgeNodeBetweenLayers":"50","elk.layered.spacing.edgeEdge":"20","elk.layered.spacing.edgeNode":"30","elk.padding":"[top=80,left=80,bottom=80,right=80]","elk.layered.nodePlacement.strategy":"BRANDES_KOEPF","elk.layered.nodePlacement.bk.fixedAlignment":"BALANCED","elk.layered.nodePlacement.bk.algorithm":"BRANDES_KOEPF","elk.layered.crossingMinimization.strategy":"INTERACTIVE","elk.layered.crossingMinimization.forceNo
1deModelOrder":"true","elk.edgeRouting":"ORTHOGONAL","elk.spacing.edgeNode":"30","elk.spacing.edgeEdge":"20","elk.portAlignment.basic":"JUSTIFIED","elk.portAlignment.direction":"AUTO","elk.layered.thoroughness":"10","elk.layered.cycleBreaking.strategy":"GREEDY","elk.layered.cycleBreaking.considerModelOrder":"true","elk.layered.compaction.postCompaction.strategy":"EDGE_LENGTH","elk.layered.compaction.postCompaction.constraints":"EDGE_LENGTH_AND_DIRECTION"},children:r,edges:t.map(e=>({id:e.id,sources:[e.source],targets:[e.target]}))},n=await a.layout(i);return e.map(e=>{var t;let a=null==(t=n.children)?void 0:t.find(t=>t.id===e.tableName);return a&&void 0!==a.x&&void 0!==a.y?{id:e.tableName,type:"tableNode",position:{x:a.x,y:a.y},data:e}:{id:e.tableName,type:"tableNode",position:{x:0,y:0},data:e}})}async function es(e,t){try{let a=await (0,ea.$E)(e,{backgroundColor:"#0A0A0A",quality:1,pixelRatio:2}),r=document.createElement("a");r.download=t,r.href=a,r.click()}catch(e){throw console.error("Failed to export to PNG:",e),e}}async function el(e,t){try{let a=await (0,ea.YI)(e,{backgroundColor:"#0A0A0A"}),r=document.createElement("a");r.download=t,r.href=a,r.click()}catch(e){throw console.error("Failed to export to SVG:",e),e}}function ei(e,t){let a=new Date().toISOString().slice(0,19).replace(/[:]/g,"-");return"".concat(e,"-schema-").concat(a,".").concat(t)}let en={tableNode:U};function eo(){let e=(0,s.c3)("public.database_explorer"),{session_id:t}=(0,l.useParams)(),{schemaGraph:a,currentDatabase:n,isLoadingSchema:o,isRefreshingSchema:c,error:m}=(0,d.kM)(["schemaGraph","currentDatabase","isLoadingSchema","isRefreshingSchema","error"]),{loadSchemaGraph:u,selectTable:h}=(0,d.KM)(),{handleDatabaseTabSelect:p}=(0,d.dv)(),{fitView:b}=(0,R.VH)(),[g,y,f]=(0,R.ck)([]),[j,N,v]=(0,R.fM)([]),[_,w]=(0,i.useState)(""),[k,z]=(0,i.useState)(!1),C=(0,i.useRef)(null),A=(0,i.useRef)(null);(0,i.useEffect)(()=>{!n||o||c?n||(A.current=null):A.current!==n&&(A.current=n,u())},[o,c,n,u]),(0,i.useEffect)(()=>{a.nodes.length>0&&(async()=>{let e=await er(a.nodes,a.relationships);if(n&&t){let a=function(e,t){let a="db-schema-layout-".concat(e,"-").concat(t);try{let e=localStorage.getItem(a);if(e)return JSON.parse(e)}catch(e){console.error("Failed to load layout from storage:",e)}return null}(t,n);a&&(e=e.map(e=>{let t=a[e.id];return t?{...e,position:t}:e}))}let r=a.relationships.map(e=>({id:e.id,source:e.source,target:e.target,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle,type:"bezier",animated:!0,label:e.label,style:{stroke:"#6b7280",strokeWidth:2,strokeDasharray:"5,5"},labelStyle:{fill:"#6b7280",fontSize:10,fontWeight:500},labelBgStyle:{fill:"#1a1a1a",fillOpacity:.9}}));y(e),N(r),setTimeout(()=>{b({padding:.2,duration:400})},100)})()},[a,n,t,y,N,b]);let S=(0,i.useMemo)(()=>(function(e,t){if(!t.trim())return e;let a=t.toLowerCase();return e.filter(e=>{let t=e.data;return!!t.tableName.toLowerCase().includes(a)||t.columns.some(e=>e.column_name.toLowerCase().includes(a))})})(g,_),[g,_]),T=(0,i.useMemo)(()=>new Set(S.map(e=>e.id)),[S]),E=(0,i.useMemo)(()=>j.filter(e=>T.has(e.source)&&T.has(e.target)),[j,T]),M=(0,i.useCallback)((e,a)=>{let r=a.id;p(t,"db:table:".concat(r),{tableName:r,viewType:"table"}),h(r)},[t,p,h]),q=(0,i.useCallback)(()=>{n&&t&&function(e,t,a){let r="db-schema-layout-".concat(e,"-").concat(t),s=a.reduce((e,t)=>(e[t.id]=t.position,e),{});try{localStorage.setItem(r,JSON.stringify(s))}catch(e){console.error("Failed to save layout to storage:",e)}}(t,n,g)},[n,t,g]),L=(0,i.useCallback)(async()=>{if(a.nodes.length>0){if(y(await er(a.nodes,a.relationships)),n&&t){let e="db-schema-layout-".concat(t,"-").concat(n);localStorage.removeItem(e)}setTimeout(()=>{b({padding:.2,duration:400})},100),O.oR.success(e("schema_visualizer.layout_reset"))}},[a,n,t,y,b,e]),P=(0,i.useCallback)(async()=>{if(C.current&&n){z(!0);try{let t=ei(n,"png");await es(C.current,t),O.oR.success(e("schema_visualizer.export_png_success"))}catch(t){console.error("Export to PNG failed:",t),O.oR.error(e("schema_visualizer.export_png_error"))}finally{z(!1)}}},[n,e]),G=(0,i.useCallback)(async()=>
1{if(C.current&&n){z(!0);try{let t=ei(n,"svg");await el(C.current,t),O.oR.success(e("schema_visualizer.export_svg_success"))}catch(t){console.error("Export to SVG failed:",t),O.oR.error(e("schema_visualizer.export_svg_error"))}finally{z(!1)}}},[n,e]),F=a.nodes.length>0;if(o&&!F)return(0,r.jsxs)("div",{className:"h-full flex items-center justify-center bg-midnight-950 relative overflow-hidden",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-gradient-to-br from-midnight-800/30 via-transparent to-purple-900/20 animate-pulse"}),(0,r.jsx)("div",{className:"absolute inset-0 opacity-20",children:(0,r.jsxs)("svg",{className:"w-full h-full",children:[(0,r.jsx)("line",{x1:"20%",y1:"30%",x2:"80%",y2:"70%",stroke:"currentColor",strokeWidth:"1",className:"text-midnight-400 animate-pulse",strokeDasharray:"5,5",children:(0,r.jsx)("animate",{attributeName:"stroke-dashoffset",from:"0",to:"10",dur:"1s",repeatCount:"indefinite"})}),(0,r.jsx)("line",{x1:"80%",y1:"30%",x2:"20%",y2:"70%",stroke:"currentColor",strokeWidth:"1",className:"text-purple-400 animate-pulse",strokeDasharray:"5,5",children:(0,r.jsx)("animate",{attributeName:"stroke-dashoffset",from:"0",to:"10",dur:"1.5s",repeatCount:"indefinite"})}),(0,r.jsx)("line",{x1:"50%",y1:"10%",x2:"50%",y2:"90%",stroke:"currentColor",strokeWidth:"1",className:"text-midnight-300 animate-pulse",strokeDasharray:"5,5",children:(0,r.jsx)("animate",{attributeName:"stroke-dashoffset",from:"0",to:"10",dur:"2s",repeatCount:"indefinite"})})]})}),(0,r.jsxs)("div",{className:"flex flex-col items-center gap-6 relative z-10",children:[(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("div",{className:"absolute inset-0 rounded-full bg-midnight-500/20 animate-ping"}),(0,r.jsx)("div",{className:"absolute inset-0 rounded-full bg-purple-400/20 animate-ping animation-delay-300"}),(0,r.jsxs)("div",{className:"relative bg-gradient-to-br from-midnight-500 to-purple-500 p-6 rounded-2xl shadow-2xl animate-bounce-slow",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-gradient-to-br from-midnight-400 to-purple-400 rounded-2xl blur-xl opacity-50 animate-pulse"}),(0,r.jsx)(D.A,{className:"relative w-12 h-12 text-white",strokeWidth:1.5})]}),(0,r.jsx)("div",{className:"absolute -top-2 -right-2 w-4 h-4 bg-midnight-400 rounded-full animate-orbit"}),(0,r.jsx)("div",{className:"absolute -bottom-2 -left-2 w-4 h-4 bg-purple-400 rounded-full animate-orbit-reverse"})]}),(0,r.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,r.jsx)("h3",{className:"text-lg font-semibold bg-gradient-to-r from-midnight-300 via-purple-300 to-midnight-200 bg-clip-text text-transparent animate-pulse",children:e("schema_visualizer.loading")}),(0,r.jsxs)("p",{className:"text-gray-400 text-sm flex items-center gap-2",children:[(0,r.jsx)("span",{className:"inline-block w-2 h-2 bg-midnight-400 rounded-full animate-pulse"}),(0,r.jsx)("span",{className:"inline-block w-2 h-2 bg-purple-400 rounded-full animate-pulse animation-delay-200"}),(0,r.jsx)("span",{className:"inline-block w-2 h-2 bg-midnight-300 rounded-full animate-pulse animation-delay-400"})]})]}),(0,r.jsx)("div",{className:"w-64 h-1 bg-midnight-900 rounded-full overflow-hidden",children:(0,r.jsx)("div",{className:"h-full bg-gradient-to-r from-midnight-500 via-purple-500 to-midnight-400 rounded-full animate-progress"})})]})]});if(m)return(0,r.jsx)("div",{className:"h-full flex items-center justify-center bg-[#0A0A0A]",children:(0,r.jsxs)("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[(0,r.jsx)(D.A,{size:48,className:"text-red-500"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-red-400 font-medium mb-2",children:e("schema_visualizer.error_title")}),(0,r.jsx)("p",{className:"text-gray-400 text-sm",children:m})]}),(0,r.jsx)("button",{type:"button",onClick:()=>u(),className:"px-4 py-2 bg-gray-700 hover:bg-gray-600 text-white text-sm rounded-lg transition",children:e("schema_visualizer.retry")})]})});let I=0===a.nodes.length;return(0,r.jsxs)("div",{ref:C,className:"size-full relative",children:[(0,r.jsxs)(R.Gc,{nodes:S,edges:E,onNodesChange:f,onEdgesChange:v,onNodeClick:M,onNodeDragStop:q,nodeTypes:en,fitView:!0,fitViewOptions:{padding:.2},minZoom:.1,maxZoom:2,defaultEdgeOptions:{type:"bezier",animated:!0,style:{stroke:"#6b7280",strokeWidth:2,strokeDasharray:"5,5"}},className:(0,x.cn)("schema-visualizer",k&&"exporting"),children:[(0,r.jsx)(R.VS,{variant:R._5.Dots,gap:16,size:1}),(0,r.jsx)(H,{onResetLayout:L}),(0,r.jsx)(Q,{onSearch:w,onExportPNG:P,onExportSVG:G,onResetLayout:L,isExporting:k})]}),c&&(0,r.jsxs)("div",{className:"absolute top-4 right-4 z-20 flex items-center gap-2 px-3 py-1.5 bg-midnight-900/90 border border-gray-700/50 rounded-full text-xs text-gray-400",children:[(0,r.jsx)("div",{className:"w-2 h-2 bg-purple-500 rounded-full animate-pulse"}),e("schema_visualizer.refreshing")]}),I&&!c&&(0,r.jsx)("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none z-10",children:(0,r.jsxs)("div",{className:"flex flex-col items-center gap-4 text-center bg-[#0A0A0A]/80 backdrop-blur-sm px-8 py-6 rounded-lg border border-gray-800/50 shadow-xl",children:[(0,r.jsx)(D.A,{size:48,className:"text-gray-600"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-gray-300 font-medium mb-2",children:e("schema_visualizer.empty_title")}),(0,r.jsx)("p",{className:"text-gray-500 text-sm",children:e("schema_visualizer.empty_description")})]})]})})]})}function ed(){return(0,r.jsx)(R.Ln,{children:(0,r.jsx)(eo,{})})}function ec(){let{session_id:e}=(0,l.useParams)(),t=(0,s.c3)("public.database_explorer"),{getTabMetadata:a,getActiveTabGroup:c}=(0,d.dv)(),{deleteRecord:m,selectTable:x}=(0,d.KM)(),{currentTable:h,isLoadingTableData:p}=(0,d.kM)(["currentTable","isLoadingTableData"]),[b,g]=(0,i.useState)(!1),[f,j]=(0,i.useState)("create"),[v,_]=(0,i.useState)({}),[k,C]=(0,i.useState)(!1),[A,S]=(0,i.useState)({}),[D,M]=(0,i.useState)(!1),[R,O]=(0,i.useState)(null),L=c(),P=(null==L?void 0:L.activeTab)||"",G=a(e,P),F=(0,i.useMemo)(()=>
1{if((null==G?void 0:G.type)==="database"&&G.databaseMeta)return{isDatabase:!0,viewType:G.databaseMeta.viewType,tableName:G.databaseMeta.tableName};if(P.startsWith("db:")){if(P.startsWith("db:table:"))return{isDatabase:!0,viewType:"table",tableName:P.replace("db:table:","")};if("db:query"===P)return{isDatabase:!0,viewType:"query",tableName:void 0};if("db:schema"===P)return{isDatabase:!0,viewType:"schema",tableName:void 0}}return{isDatabase:!1,viewType:void 0,tableName:void 0}},[P,G]);(0,i.useEffect)(()=>{F.isDatabase&&"table"===F.viewType&&F.tableName&&h!==F.tableName&&(console.log("DatabaseContent: Reloading table data for ".concat(F.tableName," (current: ").concat(h,")")),x(F.tableName))},[F,h,x]);let H=async()=>{M(!0),O(null);try{let e=Object.entries(A).map(e=>{let[t,a]=e;return null===a?"".concat(t," IS NULL"):"".concat(t," = '").concat(a,"'")}).join(" AND ");await m(e),C(!1),S({})}catch(e){O(e instanceof Error?e.message:t("errors.delete_record_failed")),console.error("Failed to delete record:",e)}finally{M(!1)}};return F.isDatabase?(console.log({databaseInfo:F,currentTable:h,isLoadingTableData:p}),p&&"table"===F.viewType)?(0,r.jsx)(n.EditorPlaceholder,{showPulse:!0}):"query"===F.viewType?(0,r.jsx)("div",{className:"h-full flex flex-col bg-midnight-950",children:(0,r.jsxs)(o.ResizablePanelGroup,{direction:"horizontal",className:"flex-1",children:[(0,r.jsx)(o.ResizablePanel,{defaultSize:75,minSize:50,children:(0,r.jsxs)(o.ResizablePanelGroup,{direction:"vertical",children:[(0,r.jsx)(o.ResizablePanel,{defaultSize:60,minSize:30,children:(0,r.jsx)(z,{})}),(0,r.jsx)(o.ResizableHandle,{className:"bg-gray-700 hover:bg-purple-600 transition-colors"}),(0,r.jsx)(o.ResizablePanel,{defaultSize:40,minSize:20,children:(0,r.jsx)(E,{})})]})}),(0,r.jsx)(o.ResizableHandle,{className:"bg-gray-700 hover:bg-purple-600 transition-colors"}),(0,r.jsx)(o.ResizablePanel,{defaultSize:25,minSize:15,maxSize:40,children:(0,r.jsx)("div",{className:"h-full overflow-y-auto scroll-y",children:(0,r.jsx)(T,{})})})]})}):"schema"===F.viewType?(0,r.jsx)("div",{className:"h-full w-full bg-midnight-950",children:(0,r.jsx)(ed,{})}):"table"===F.viewType?(0,r.jsxs)("div",{className:"h-full flex flex-col bg-midnight-950",children:[(0,r.jsx)(N,{onAddRecord:()=>{j("create"),_({}),g(!0)}}),(0,r.jsx)("div",{className:"flex-1 overflow-hidden p-4",children:(0,r.jsx)("div",{className:"h-full rounded-lg border border-gray-800 overflow-hidden",children:(0,r.jsx)(u,{onEditRecord:e=>{j("edit"),_(e),g(!0)},onDeleteRecord:e=>{S(e),O(null),C(!0)}})})}),(0,r.jsx)(w,{}),(0,r.jsx)(q,{isOpen:b,onClose:()=>g(!1),mode:f,initialData:v}),(0,r.jsx)(y,{isOpen:k,onClose:()=>C(!1),onConfirm:H,recordData:A,tableName:h||"",isDeleting:D,error:R})]}):null:null}}}]);

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