1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,31713,e=>{"use strict";var r=e.i(43476),a=e.i(71645),t=e.i(70703);function o({onFilesLoaded:e}){let[t,l]=(0,a.useState)(!1),[s,n]=(0,a.useState)([]),c=(0,a.useRef)(null),i=(0,a.useCallback)(async r=>{let a=Array.from(r);if(0===a.length)return;let t=[],o=[];for(let e of a){let r=await e.text();t.push(e.name),o.push(`-- âââ FILE: ${e.name} âââ 2${r}`)}n(t),e(o.join("\n\n"),t)},[e]),d=(0,a.useCallback)(e=>{e.preventDefault(),l(!1),e.dataTransfer.files.length>0&&i(e.dataTransfer.files)},[i]),x=(0,a.useCallback)(e=>{e.target.files&&e.target.files.length>0&&i(e.target.files)},[i]);return(0,r.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,r.jsxs)("div",{className:`drop-zone rounded-lg p-3 flex items-center justify-center cursor-pointer transition-all duration-200 ${t?"active border-[var(--color-accent-blue)] bg-[rgba(79,141,255,0.05)]":"border-[var(--color-border-primary)] hover:border-[var(--color-border-glow)]"}`,onDragOver:e=>{e.preventDefault(),l(!0)},onDragLeave:()=>l(!1),onDrop:d,onClick:()=>c.current?.click(),children:[(0,r.jsx)("input",{ref:c,type:"file",accept:".sql,.pls,.prc,.fnc,.trg,.pkb,.pks,.ddl,.txt",multiple:!0,onChange:x,className:"hidden"}),(0,r.jsxs)("div",{className:"flex items-center gap-2 text-[var(--color-text-secondary)] text-xs",children:[(0,r.jsx)("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"})}),(0,r.jsx)("span",{children:t?"Drop files here...":"Drop .sql files or click to upload (batch)"})]})]}),s.length>0&&(0,r.jsxs)("div",{className:"flex flex-wrap gap-1.5 animate-fade-in",children:[s.map((e,a)=>(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[0.65rem] font-medium bg-[var(--color-bg-elevated)] text-[var(--color-accent-blue)] border border-[var(--color-accent-blue-dim)]",children:["ð ",e]},a)),(0,r.jsx)("button",{onClick:e=>{e.stopPropagation(),n([])},className:"text-[0.65rem] text-[var(--color-text-dim)] hover:text-[var(--color-accent-red)] transition-colors",children:"â Clear"})]})]})}function l({score:e}){let a=2*Math.PI*20,t=e.overall/100*a,o=`${t} ${a-t}`,{ring:s,glow:n,text:c}={green:{ring:"#34d399",glow:"rgba(52,211,153,0.35)",text:"var(--color-accent-green)"},amber:{ring:"#fbbf24",glow:"rgba(251,191,36,0.35)",text:"var(--color-accent-amber)"},red:{ring:"#f87171",glow:"rgba(248,113,113,0.35)",text:"var(--color-accent-red)"}}[e.color],i=[`Block success: ${e.breakdown.blockSuccess}% (\xd70.40)`,`Syntax clean: ${e.breakdown.syntaxClean}% (\xd70.30)`,`No stubs: ${e.breakdown.noStubs}% (\xd70.20)`,`Types resolved: ${e.breakdown.typesResolved}% (\xd70.10)`],d=e.issues.length>0?`Quality Score: ${e.overall}/100 (${e.grade}) 3 4${i.join("\n")} 5 6Issues: 7${e.issues.map(e=>`⢠${e}`).join("\n")}`:`Quality Score: ${e.overall}/100 (${e.grade}) 8 9${i.join("\n")} 10 11â No issues detected`;return(0,r.jsxs)("div",{className:"flex items-center gap-2 select-none",title:d,style:{cursor:"help"},children:[(0,r.jsxs)("div",{style:{position:"relative",width:44,height:44},children:[(0,r.jsxs)("svg",{width:44,height:44,style:{transform:"rotate(-90deg)"},children:[(0,r.jsx)("circle",{cx:22,cy:22,r:20,fill:"none",stroke:"rgba(255,255,255,0.08)",strokeWidth:4}),(0,r.jsx)("circle",{cx:22,cy:22,r:20,fill:"none",stroke:s,strokeWidth:4,strokeDasharray:o,strokeLinecap:"round",style:{filter:`drop-shadow(0 0 4px ${n})`,transition:"stroke-dasharray 0.6s ease"}})]}),(0,r.jsxs)("div",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",lineHeight:1},children:[(0,r.jsx)("span",{style:{fontSize:"0.65rem",fontWeight:800,color:c},children:e.overall}),(0,r.jsx)("span",{style:{fontSize:"0.45rem",color:c,opacity:.8},children:e.grade})]})]}),(0,r.jsxs)("div",{style:{lineHeight:1.3},children:[(0,r.jsx)("div",{style:{fontSize:"0.6rem",fontWeight:700,color:c,textTransform:"uppercase",letterSpacing:"0.05em"},children:"Quality"}),(0,r.jsx)("div",{style:{fontSize:"0.55rem",color:"var(--color-text-dim)"},children:"green"===e.color?"Excellent":"amber"===e.color?"Needs review":"Manual work needed"})]})]})}function s({stats:e,constructs:a,mode:t,validationReport:o,conversionScore:n}){if(!e)return null;
11let c=[{icon:"ð¦",label:"Blocks",value:e.totalBlocks,color:"var(--color-accent-blue)",bgColor:"rgba(79,141,255,0.08)",borderColor:"rgba(79,141,255,0.2)"},{icon:"âï¸",label:"SQLines",value:e.sqlinesSuccess,color:"var(--color-accent-cyan)",bgColor:"rgba(34,211,238,0.08)",borderColor:"rgba(34,211,238,0.2)"},{icon:"ð¤",label:"LLM",value:e.llmSuccess,color:"var(--color-accent-purple)",bgColor:"rgba(167,139,250,0.08)",borderColor:"rgba(167,139,250,0.2)"},{icon:"ð¾",label:"Cache",value:e.cacheHits,color:"var(--color-accent-green)",bgColor:"rgba(52,211,153,0.08)",borderColor:"rgba(52,211,153,0.2)"},{icon:"â",label:"Fails",value:e.hardFails,color:e.hardFails>0?"var(--color-accent-red)":"var(--color-text-dim)",bgColor:e.hardFails>0?"rgba(248,113,113,0.08)":"rgba(74,85,120,0.08)",borderColor:e.hardFails>0?"rgba(248,113,113,0.2)":"rgba(74,85,120,0.2)"},...e.retriedBlocks&&e.retriedBlocks>0?[{icon:"ð",label:"Retried",value:e.retriedBlocks,color:"var(--color-accent-amber)",bgColor:"rgba(251,191,36,0.08)",borderColor:"rgba(251,191,36,0.2)"}]:[],...e.packagesSplit&&e.packagesSplit>0?[{icon:"ð",label:"Packages",value:e.packagesSplit,color:"var(--color-accent-cyan)",bgColor:"rgba(34,211,238,0.08)",borderColor:"rgba(34,211,238,0.2)"}]:[]];return(0,r.jsx)("div",{className:"border-t border-[var(--color-border-primary)] bg-[var(--color-bg-secondary)] px-4 py-2.5 animate-slide-up",children:(0,r.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[n&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(l,{score:n}),(0,r.jsx)("div",{className:"w-px h-5 bg-[var(--color-border-primary)]"})]}),(0,r.jsx)("span",{className:"text-[0.65rem] font-bold px-2.5 py-1 rounded-md uppercase tracking-wider",style:{color:"full"===t?"var(--color-accent-green)":"llm_only"===t?"var(--color-accent-purple)":"var(--color-accent-amber)",background:"full"===t?"rgba(52,211,153,0.1)":"llm_only"===t?"rgba(167,139,250,0.1)":"rgba(251,191,36,0.1)",border:`1px solid ${"full"===t?"rgba(52,211,153,0.25)":"llm_only"===t?"rgba(167,139,250,0.25)":"rgba(251,191,36,0.25)"}`},children:"full"===t?"Full Pipeline":"llm_only"===t?"LLM Only":"sqlines_only"===t?"SQLines Only":"Stub Mode"}),c.map(e=>(0,r.jsxs)("div",{className:"stat-pill",style:{color:e.color,background:e.bgColor,borderColor:e.borderColor},children:[(0,r.jsx)("span",{children:e.icon}),(0,r.jsx)("span",{className:"font-bold",children:e.value}),(0,r.jsx)("span",{style:{opacity:.7},children:e.label})]},e.label)),o&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"w-px h-5 bg-[var(--color-border-primary)]"}),(0,r.jsxs)("span",{className:"text-[0.65rem] font-bold px-2.5 py-1 rounded-md uppercase tracking-wider",style:{color:o.valid?"var(--color-accent-green)":"var(--color-accent-red)",background:o.valid?"rgba(52,211,153,0.1)":"rgba(248,113,113,0.1)",border:`1px solid ${o.valid?"rgba(52,211,153,0.25)":"rgba(248,113,113,0.25)"}`},title:o.errorCount>0?`${o.errorCount} error(s), ${o.limitationCount} pg-mem limitation(s)`:o.limitationCount>0?`${o.limitationCount} pg-mem limitation(s) â warnings only`:`All ${o.statementCount} statements valid`,children:[o.valid?"â Valid":`â ${o.errorCount} error(s)`,o.limitationCount>0&&(0,r.jsxs)("span",{style:{opacity:.7},children:[" · ",o.limitationCount," warn"]})]})]}),a.length>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"w-px h-5 bg-[var(--color-border-primary)]"}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-1",children:[a.slice(0,8).map(e=>(0,r.jsx)("span",{className:"text-[0.6rem] px-1.5 py-0.5 rounded bg-[var(--color-bg-elevated)] text-[var(--color-accent-blue)] border border-[var(--color-accent-blue-dim)]",children:e},e)),a.length>8&&(0,r.jsxs)("span",{className:"text-[0.6rem] text-[var(--color-text-dim)]",children:["+",a.length-8," more"]})]})]})]})})}function n({blockId:e,cacheKey:t,method:o,onFeedback:l}){let[s,c]=(0,a.useState)(null),[i,d]=(0,a.useState)(!1);if("llm"!==o)return null;let x=async e=>{if(!s&&!i){d(!0);try{l(t,e),c(e)}finally{d(!1)}}};return(0,r.jsx)("div",{className:"inline-flex items-center gap-1 ml-2","data-block-id":e,children:s?(0,r.jsx)("span",{className:"text-[0.65rem] font-medium px-2 py-0.5 rounded",style:{color:"up"===s?"var(--color-accent-green)":"var(--color-accent-red)",background:"up"===s?"rgba(52,211,153,0.1)":"rgba(248,113,113,0.1)"},children:"up"===s?"â Approved":"â Rejected â will re-convert"}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{onClick:()=>x("up"),disabled:i,className:"text-sm px-1.5 py-0.5 rounded transition-all duration-150 hover:bg-[rgba(52,211,153,0.15)] hover:scale-110 disabled:opacity-30",title:"Ap
11prove this LLM conversion",children:"ð"}),(0,r.jsx)("button",{onClick:()=>x("down"),disabled:i,className:"text-sm px-1.5 py-0.5 rounded transition-all duration-150 hover:bg-[rgba(248,113,113,0.15)] hover:scale-110 disabled:opacity-30",title:"Reject â evicts cache entry",children:"ð"})]})})}let c=[{value:"openai",label:"OpenAI",icon:"ð¢"},{value:"azure-openai",label:"Azure OpenAI",icon:"ðµ"},{value:"anthropic",label:"Anthropic",icon:"ð£"}],i=[{value:"gpt-4o",label:"GPT-4o"},{value:"gpt-4o-mini",label:"GPT-4o Mini"},{value:"gpt-4-turbo",label:"GPT-4 Turbo"},{value:"gpt-4.1",label:"GPT-4.1"},{value:"gpt-4.1-mini",label:"GPT-4.1 Mini"},{value:"o3",label:"o3"},{value:"o4-mini",label:"o4-mini"}],d=[{value:"claude-opus-4-7",label:"Claude Opus 4.7 (most capable)"},{value:"claude-sonnet-4-6",label:"Claude Sonnet 4.6 (balanced)"},{value:"claude-haiku-4-5-20251001",label:"Claude Haiku 4.5 (fastest)"}],x=[{value:"2025-01-01-preview",label:"2025-01-01-preview (latest)"},{value:"2024-12-01-preview",label:"2024-12-01-preview"},{value:"2024-10-01-preview",label:"2024-10-01-preview"},{value:"2024-08-01-preview",label:"2024-08-01-preview"}];function m({isOpen:e,onClose:t,onSave:o,initialSettings:l}){let[s,n]=(0,a.useState)(l.provider),[u,v]=(0,a.useState)(l.apiKey),[g,h]=(0,a.useState)(l.model),[f,y]=(0,a.useState)(l.azureEndpoint),[j,N]=(0,a.useState)(l.azureDeployment),[w,k]=(0,a.useState)(l.azureApiVersion||"2025-01-01-preview"),[S,C]=(0,a.useState)(l.sqlinesPath),[L,E]=(0,a.useState)(!1),[A,_]=(0,a.useState)(null),R=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/settings");e.ok&&_(await e.json())}catch{}},[]);(0,a.useEffect)(()=>{e&&(R(),n(l.provider),v(l.apiKey),h(l.model),y(l.azureEndpoint),N(l.azureDeployment),k(l.azureApiVersion||"2025-01-01-preview"),C(l.sqlinesPath))},[e,R,l]);let O=async()=>{E(!0);try{await fetch("/api/settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({llmProvider:s,apiKey:u,model:g,azureEndpoint:f,azureDeployment:j,azureApiVersion:w,sqlinesPath:S})}),o({provider:s,apiKey:u,model:g,azureEndpoint:f,azureDeployment:j,azureApiVersion:w,sqlinesPath:S}),await R()}finally{E(!1)}};if(!e)return null;let P="azure-openai"===s,M="openai"===s,T="anthropic"===s;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-40 animate-fade-in",onClick:t}),(0,r.jsxs)("div",{className:"fixed right-0 top-0 bottom-0 w-[460px] max-w-full z-50 bg-[var(--color-bg-secondary)] border-l border-[var(--color-border-primary)] flex flex-col shadow-2xl",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-5 py-4 border-b border-[var(--color-border-primary)]",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h2",{className:"text-sm font-bold text-[var(--color-text-primary)]",children:"âï¸ Settings"}),(0,r.jsx)("p",{className:"text-[0.65rem] text-[var(--color-text-dim)] mt-0.5",children:"Configure conversion engines"})]}),(0,r.jsx)("button",{onClick:t,className:"w-7 h-7 rounded-md flex items-center justify-center text-[var(--color-text-dim)] hover:text-[var(--color-text-primary)] hover:bg-[var(--color-bg-surface)] transition-all",children:"â"})]}),(0,r.jsxs)("div",{className:"flex-1 overflow-y-auto p-5 space-y-5",children:[A&&(0,r.jsxs)("div",{className:"space-y-2 p-3 rounded-lg bg-[var(--color-bg-surface)] border border-[var(--color-border-primary)]",children:[(0,r.jsx)("div",{className:"text-[0.65rem] font-bold uppercase tracking-wider text-[var(--color-text-dim)] mb-2",children:"System Status"}),(0,r.jsx)(p,{label:"LLM API Key",ok:A.hasApiKey}),(0,r.jsx)(p,{label:"SQLines Binary",ok:A.sqlinesAvailable}),(0,r.jsx)(p,{label:`Cache: ${A.cacheMode}`,ok:"sqlite"===A.cacheMode}),(0,r.jsxs)("div",{className:"flex items-center gap-2 mt-2 pt-2 border-t border-[var(--color-border-primary)]",children:[(0,r.jsx)(b,{mode:A.capabilities.mode}),(0,r.jsxs)("span",{className:"text-[0.6rem] text-[var(--color-text-dim)] ml-auto",children:["Provider: ",A.capabilities.provider??"openai"]})]})]}),(0,r.jsxs)("div",{className:"space-y-1.5",children:[(0,r.jsx)("label",{className:"text-[0.7rem] font-semibold text-[var(--color-text-secondary)] uppercase tracking-wider",children:"LLM Provider"}),(0,r.jsx)("div",{className:"grid grid-cols-3 gap-2",children:c.map(e=>(0,r.jsxs)("button",{onClick:()=>{var r;n(r=e.value),"openai"===r&&h("gpt-4o"),"anthropic"===r&&h("claude-sonnet-4-6")},className:`px-3 py-2.5 rounded-lg text-xs font-medium border transition-all text-left ${s===e.value?"border-[var(--color-accent-blue)] bg-[rgba(79,141,255,0.1)] text-[var(--color-accent-blue)]":"border-[var(--color-border-primary)] text-[var(--color-text-dim)] hover:border-[var(--color-border-glow)] hover:text-[var(--color-text-secondary)]"}`,children:[(0,r.jsx)("span",{className:"block text-base mb-0.5",children:e.icon}),e.label]},e.value))})]}),(0,r.jsxs)("div",{className:"space-y-1.5",children:[(0,r.jsx)("label",{className:"text-[0.7rem] font-semibold text-[var(--color-text-secondary)] uppercase tracking-wider",children:P?"Azure API Key":T?"Anthropic API Key":"OpenAI API Key"}),(0,r.jsx)("input",{type:"password",value:u,onChange:e=>v(e.target.value),placeholder:T?"sk-ant-...":P?"Your Azure resource key":"sk-...",className:"w-full px-3 py-2 rounded-lg text-sm font-mono bg-[var(--color-bg-primary)] border border-[var(--color-border-primary)] text-[var(--color-text-primary)] placeholder:text-[var(--color-text-dim)] focus:border-[var(--color-accent-blue)] focu
11s:outline-none transition-colors"}),(0,r.jsx)("p",{className:"text-[0.6rem] text-[var(--color-text-dim)]",children:"Session-only â never persisted to disk."})]}),P&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"space-y-1.5",children:[(0,r.jsx)("label",{className:"text-[0.7rem] font-semibold text-[var(--color-text-secondary)] uppercase tracking-wider",children:"Azure Endpoint"}),(0,r.jsx)("input",{type:"text",value:f,onChange:e=>y(e.target.value),placeholder:"https://your-resource.openai.azure.com",className:"w-full px-3 py-2 rounded-lg text-sm font-mono bg-[var(--color-bg-primary)] border border-[var(--color-border-primary)] text-[var(--color-text-primary)] placeholder:text-[var(--color-text-dim)] focus:border-[var(--color-accent-blue)] focus:outline-none transition-colors"})]}),(0,r.jsxs)("div",{className:"space-y-1.5",children:[(0,r.jsx)("label",{className:"text-[0.7rem] font-semibold text-[var(--color-text-secondary)] uppercase tracking-wider",children:"Deployment Name"}),(0,r.jsx)("input",{type:"text",value:j,onChange:e=>N(e.target.value),placeholder:"gpt-5-4, my-gpt4o-deployment, â¦",className:"w-full px-3 py-2 rounded-lg text-sm font-mono bg-[var(--color-bg-primary)] border border-[var(--color-border-primary)] text-[var(--color-text-primary)] placeholder:text-[var(--color-text-dim)] focus:border-[var(--color-accent-blue)] focus:outline-none transition-colors"}),(0,r.jsxs)("p",{className:"text-[0.6rem] text-[var(--color-text-dim)]",children:["The deployment name in your Azure OpenAI resource (e.g. ",(0,r.jsx)("code",{children:"gpt-5-4"}),")."]})]}),(0,r.jsxs)("div",{className:"space-y-1.5",children:[(0,r.jsx)("label",{className:"text-[0.7rem] font-semibold text-[var(--color-text-secondary)] uppercase tracking-wider",children:"API Version"}),(0,r.jsx)("select",{value:w,onChange:e=>k(e.target.value),className:"w-full px-3 py-2 rounded-lg text-sm bg-[var(--color-bg-primary)] border border-[var(--color-border-primary)] text-[var(--color-text-primary)] focus:border-[var(--color-accent-blue)] focus:outline-none transition-colors cursor-pointer",children:x.map(e=>(0,r.jsx)("option",{value:e.value,children:e.label},e.value))})]})]}),(M||T)&&(0,r.jsxs)("div",{className:"space-y-1.5",children:[(0,r.jsx)("label",{className:"text-[0.7rem] font-semibold text-[var(--color-text-secondary)] uppercase tracking-wider",children:"Model"}),(0,r.jsx)("select",{value:g,onChange:e=>h(e.target.value),className:"w-full px-3 py-2 rounded-lg text-sm bg-[var(--color-bg-primary)] border border-[var(--color-border-primary)] text-[var(--color-text-primary)] focus:border-[var(--color-accent-blue)] focus:outline-none transition-colors cursor-pointer",children:(T?d:i).map(e=>(0,r.jsx)("option",{value:e.value,children:e.label},e.value))}),T&&(0,r.jsx)("p",{className:"text-[0.6rem] text-[var(--color-text-dim)]",children:"Opus 4.7 = most capable · Sonnet 4.6 = best price/performance · Haiku 4.5 = fastest"})]}),(0,r.jsxs)("div",{className:"space-y-1.5",children:[(0,r.jsx)("label",{className:"text-[0.7rem] font-semibold text-[var(--color-text-secondary)] uppercase tracking-wider",children:"SQLines Master Folder"}),(0,r.jsx)("input",{type:"text",value:S,onChange:e=>C(e.target.value),placeholder:"C:\\path\\to\\sqlines-master (leave empty to auto-detect)",className:"w-full px-3 py-2 rounded-lg text-sm font-mono bg-[var(--color-bg-primary)] border border-[var(--color-border-primary)] text-[var(--color-text-primary)] placeholder:text-[var(--color-text-dim)] focus:border-[var(--color-accent-blue)] focus:outline-none transition-colors"}),(0,r.jsxs)("p",{className:"text-[0.6rem] text-[var(--color-text-dim)]",children:["Path containing the ",(0,r.jsx)("code",{children:"bin/"})," directory. WSL required on Windows."]})]}),(0,r.jsxs)("div",{className:"p-3 rounded-lg bg-[var(--color-bg-surface)] border border-[var(--color-border-primary)] space-y-1",children:[(0,r.jsx)("p",{className:"text-[0.65rem] font-bold text-[var(--color-text-dim)] uppercase tracking-wider mb-1",children:"Quick start"}),P&&(0,r.jsxs)("p",{className:"text-[0.65rem] text-[var(--color-text-dim)]",children:["Set ",(0,r.jsx)("code",{className:"text-[var(--color-accent-blue)]",children:"LLM_PROVIDER=azure-openai"}),","," ",(0,r.jsx)("code",{className:"text-[var(--color-accent-blue)]",children:"LLM_AZURE_ENDPOINT"}),","," ",(0,r.jsx)("code",{className:"text-[var(--color-accent-blue)]",children:"LLM_AZURE_DEPLOYMENT"})," in"," ",(0,r.jsx)("code",{children:".env.local"})," for persistent config."]}),T&&(0,r.jsxs)("p",{className:"text-[0.65rem] text-[var(--color-text-dim)]",children:["Set ",(0,r.jsx)("code",{className:"text-[var(--color-accent-blue)]",children:"LLM_PROVIDER=anthropic"})," and"," ",(0,r.jsx)("code",{className:"text-[var(--color-accent-blue)]",children:"LLM_API_KEY=sk-ant-..."})," in"," ",(0,r.jsx)("code",{children:".env.local"})," for persistent config."]}),M&&(0,r.jsxs)("p",{className:"text-[0.65rem] text-[var(--color-text-dim)]",children:["Set ",(0,r.jsx)("code",{className:"text-[var(--color-accent-blue)]",children:"LLM_API_KEY=sk-..."})," in"," ",(0,r.jsx)("code",{children:".env.local"})," for persistent config."]})]})]}),(0,r.jsxs)("div",{className:"px-5 py-3 border-t border-[var(--color-border-primary)] flex gap-2",children:[(0,r.jsx)("button",{onClick:O,disabled:L,className:"flex-1 px-4 py-2 rounded-lg text-sm font-semibold bg-[var(--color-accent-blue)] text-[var(--color-bg-primary)] hover:brightness-110 transition-all disabled:opacity-50",children:L?"Savingâ¦":"Save Settings"}),(0,r.jsx)("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-medium border border-[var(--color-border-primary)] text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-surface)] transition-all",children:"Cancel"})]})]})]})}function p({label:e,ok:a}){return(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("div",{className:"w-2 h-2 rounded-full transition-colors",style:{background:a?"var(--color-accent-green)":"var(--color-accent-red)",boxShadow:a?"0 0 8px rgba(52,211,153,0.4)":"0 0 8px rgba(248,113,113,0.4)"}}),(0,r.jsx)("span",{className:"text-[0.7rem] text-[var(--color-text-secondary)]",children:e}),(0,r.jsx)("span",{className:"text-[0.6rem] ml-auto",style:{color:a?"var(--color-accent-green)":"var(--color-accent-red)"},children:a?"Ready":"Not configured"})]})}function b({mode:e}){let a="full"===e?"var(--color-accent-green)":"stub"===e?"var(--color-accent-amber)":"var(--color-accent-blue)",t="full"===e?"rgba(52,211,153,0.1)":"stub"===e?"rgba(251,191,36,0.1)":"rgba(79,141,255,0.1)";return(0,r.jsxs)("span",{className:"text-[0.65rem] font-bold uppercase tracking-wider px-2 py-0.5 rounded",style:{color:a,background:t},children:["Mode: ",e.replace("_"," ")]})}let u=`-- Sample Oracle SQL â click â¶ Run to execute (auto-converted to PostgreSQL) 12 13SELECT e.emp_id, 14 e.first_name || ' ' || e.last_name AS full_name, 15 d.dept_name, 16 e.salary, 17 NVL(e.job_title, 'Unknown') AS job_title 18FROM employees e 19JOIN departments d ON d.dept_id = e.dept_id 20WHERE e.salary > 5000 21ORDER BY e.salary DESC; 22`,v=`-- Sample PostgreSQL SQL â click â¶ Run to execute directly 23 24SELECT e.emp_id, 25 e.first_name || ' ' || e.last_name AS full_name, 26 d.dept_name, 27 e.salary, 28 COALESCE(e.job_title, 'Unknown') AS job_title 29FROM employees e 30JOIN departments d ON d.dept_id = e.dept_id 31WHERE e.salary > 5000 32ORDER BY e.salary DESC; 33`,g=(0,t.default)(()=>e.A(53096).then(e=>e.default),{loadableGenerated:{modules:[67211]},ssr:!1}),h={running:!1,results:[],error:null,notice:null,elapsed:null,ranSelection:!1};function f({initialOracleSQL:e,initialPgSQL:t}){let[o,l]=(0,a.useState)(e||u),[s,n]=(0,a.useState)(t||v),[c,i]=(0,a.useState)(h),[d,x]=(0,a.useState)(h),m=(0,a.useRef)("u">typeof crypto?crypto.randomUUID():Math.random().toString(36).slice(2)),p=(0,a.useRef)("u">typeof crypto?crypto.randomUUID():Math.random().toString(36).slice(2)),b=(0,a.useCallback)(async(e,r,a,t,o)=>{t(e=>({...e,running:!0,error:null,notice:null,elapsed:null,ranSelection:o}));let l=performance.now();try{let o=await fetch("/api/ide",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sql:e,side:r,sessionId:a})}),s=await o.json(),n=Math.round(performance.now()-l);t(s.error?e=>({...e,running:!1,results:[],error:s.error,notice:null,elapsed:n}):e=>({...e,running:!1,results:s.results??[],error:null,notice:s.notice??null,elapsed:n}))}catch(e){t(r=>({...r,running:!1,results:[],error:e instanceof Error?e.message:"Network error",notice:null,elapsed:Math.round(performance.now()-l)}))}},[]),g=(0,a.useCallback)(e=>{let r="u">typeof crypto?crypto.randomUUID():Math.random().toString(36).slice(2);"oracle"===e?(m.current=r,i(h)):(p.current=r,x(h))},[]);return(0,r.jsxs)("div",{className:"flex flex-col h-full min-h-0",children:[(0,r.jsxs)("div",{className:"flex-shrink-0 flex items-center gap-3 px-4 py-1.5 bg-[var(--color-bg-surface)] border-b border-[var(--color-border-primary)] text-[0.6rem] text-[var(--color-text-dim)]",children:[(0,r.jsx)("span",{className:"font-bold uppercase tracking-widest text-[var(--color-accent-amber)]",children:"Sample DB"}),["departments (6)","employees (18)","products (10)","orders (10)","job_history (6)"].map(e=>(0,r.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-[var(--color-bg-elevated)] border border-[var(--color-border-primary)]",children:e},e)),(0,r.jsx)("span",{className:"ml-auto opacity-60",children:"Schema persists within session · highlight text to run only that block · Reset clears the schema"})]}),(0,r.jsxs)("div",{className:"flex-1 grid grid-cols-2 min-h-0 overflow-hidden",children:[(0,r.jsx)(y,{title:"Oracle SQL",accentColor:"var(--color-accent-amber)",side:"oracle",sql:o,onSQLChange:l,exec:c,onRun:(e,r)=>b(e,"oracle",m.current,i,r),onReset:()=>g("oracle"),hint:"Converts to PostgreSQL first, then executes"}),(0,r.jsx)(y,{title:"PostgreSQL SQL",accentColor:"var(--color-accent-green)",side:"pg",sql:s,onSQLChange:n,exec:d,onRun:(e,r)=>b(e,"pg",p.current,x,r),onReset:()=>g("pg"),hint:"Executes directly against the database",borderLeft:!0})]})]})}function y({title:e,accentColor:t,side:o,sql:l,onSQLChange:s,exec:n,onRun:c,onReset:i,hint:d,borderLeft:x}){let m=(0,a.useRef)(null),p=n.results.length>0,b=n.results.reduce((e,r)=>e+r.rowCount,0),u=(0,a.useCallback)(()=>{let e=m.current;if(e){let r=e.getSelection();if(r&&!r.isEmpty()){let a=e.getModel()?.getValueInRange(r)??"";if(a.trim())return void c(a.trim(),!0)}}c(l,!1)},[l,c]);return(0,r.jsxs)("div",{className:`flex flex-col min-h-0 ${x?"border-l border-[var(--color-border-primary)]":""}`,children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 bg-[var(--color-bg-secondary)] border-b border-[var(--color-border-primary)] flex-shrink-0",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"text-[0.6rem] font-bold uppercase tracking-widest",style:{color:t},children:e}),n.ranSelection&&null!==n.elapsed&&(0,r.jsx)("span",{className:"text-[0.55rem] px-1.5 py-0.5 rounded bg-[rgba(99,102,241,0.15)] text-[var(--color-accent-blue)] border border-[rgba(99,102,241,0.3)]",children:"selection"}),null!==n.elapsed&&(0,r.jsxs)("span",{className:"text-[0.55rem] text-[var(--color-text-dim)] px-1.5 py-0.5 rounded bg-[var(--color-bg-surface)]",children:[n.elapsed,"ms"]}),p&&(0,r.jsxs)("span",{className:"text-[0.55rem] text-[var(--color-text-dim)] px-1.5 py-0.5 rounded bg-[var(--color-bg-surface)]",children:[b," row",1!==b?"s":""]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,r.jsx)("button",{onClick:i,title:"Reset session â drops all tables created this session and starts fresh",className:"px-2 py-1.5 rounded-lg text-[0.6rem] font-bold transition-all text-[var(--color-text-dim)] hover:text-[var(--color-text-primary)] hover:bg-[var(--color-bg-elevated)]",children:"⺠Reset"}),(0,r.jsx)("button",{onClick:u,disabled:n.running,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-bold transition-all disabled:opacity-50",style:{background:t,color:"var(--color-bg-primary)"},children:n.running?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"w-3 h-3 border-2 border-current border-t-transparent roun
33ded-full animate-spin"}),"Runningâ¦"]}):(0,r.jsx)(r.Fragment,{children:"â¶ Run"})})]})]}),(0,r.jsx)("div",{className:"flex-1 min-h-0 relative",style:{minHeight:"35%"},children:(0,r.jsx)(g,{height:"100%",value:l,onChange:e=>s(e??""),language:"sql",theme:"vs-dark",onMount:e=>{m.current=e,requestAnimationFrame(()=>e.layout())},options:{minimap:{enabled:!1},fontSize:13,fontFamily:"'JetBrains Mono', monospace",lineHeight:20,scrollBeyondLastLine:!1,wordWrap:"on",padding:{top:10,bottom:10},smoothScrolling:!0,selectionHighlight:!0,renderLineHighlight:"gutter"}})}),(0,r.jsxs)("div",{className:"flex-shrink-0 border-t border-[var(--color-border-primary)] overflow-auto bg-[var(--color-bg-primary)]",style:{height:"42%"},children:[n.notice&&(0,r.jsxs)("div",{className:"px-3 py-1.5 text-[0.65rem] bg-[rgba(251,191,36,0.06)] border-b border-[rgba(251,191,36,0.15)] text-[var(--color-accent-amber)]",children:["â ",n.notice]}),n.error&&(0,r.jsx)("div",{className:"p-3",children:(0,r.jsxs)("div",{className:"p-3 rounded-lg bg-[rgba(248,113,113,0.06)] border border-[rgba(248,113,113,0.2)]",children:[(0,r.jsx)("p",{className:"text-[0.65rem] font-bold text-[var(--color-accent-red)] mb-1",children:"oracle"===o?"Execution error (after OracleâPG conversion)":"Execution error"}),(0,r.jsx)("pre",{className:"text-[0.65rem] text-[var(--color-accent-red)] whitespace-pre-wrap font-mono",children:n.error})]})}),!n.running&&!n.error&&0===n.results.length&&null===n.elapsed&&(0,r.jsx)("div",{className:"h-full flex items-center justify-center text-[0.65rem] text-[var(--color-text-dim)]",children:(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("div",{className:"text-2xl mb-2 opacity-40",children:"â¶"}),(0,r.jsxs)("div",{children:["Click ",(0,r.jsx)("strong",{children:"Run"})," to execute the full script"," · ","highlight a block and click ",(0,r.jsx)("strong",{children:"Run"})," to execute only that"]}),(0,r.jsx)("div",{className:"mt-1 opacity-60",children:d})]})}),n.results.map((e,a)=>(0,r.jsx)(j,{result:e,index:a,total:n.results.length},a))]})]})}function j({result:e,index:a,total:t}){return 0===e.columns.length?null:(0,r.jsxs)("div",{className:"p-2",children:[t>1&&(0,r.jsxs)("div",{className:"text-[0.55rem] font-bold uppercase tracking-wider text-[var(--color-text-dim)] mb-1 px-1",children:["Statement ",a+1," â ",e.rowCount," row",1!==e.rowCount?"s":""]}),(0,r.jsx)("div",{className:"overflow-x-auto rounded-lg border border-[var(--color-border-primary)]",children:(0,r.jsxs)("table",{className:"w-full text-[0.7rem] font-mono",children:[(0,r.jsx)("thead",{children:(0,r.jsx)("tr",{className:"bg-[var(--color-bg-surface)]",children:e.columns.map(e=>(0,r.jsx)("th",{className:"px-3 py-1.5 text-left text-[0.65rem] font-bold uppercase tracking-wider text-[var(--color-accent-blue)] border-b border-[var(--color-border-primary)] whitespace-nowrap",children:e},e))})}),(0,r.jsx)("tbody",{children:e.rows.map((a,t)=>(0,r.jsx)("tr",{className:"border-b border-[var(--color-border-primary)] last:border-0 hover:bg-[var(--color-bg-surface)] transition-colors",children:e.columns.map(e=>{let t=a[e],o=null==t?(0,r.jsx)("span",{className:"text-[var(--color-text-dim)] italic",children:"NULL"}):String(t);return(0,r.jsx)("td",{className:"px-3 py-1.5 text-[var(--color-text-secondary)] whitespace-nowrap max-w-[300px] overflow-hidden text-ellipsis",children:o},e)})},t))})]})}),e.rowCount>e.rows.length&&(0,r.jsxs)("p",{className:"text-[0.6rem] text-[var(--color-text-dim)] mt-1 px-1",children:["Showing first ",e.rows.length," of ",e.rowCount," rows"]})]})}let N=(0,t.default)(()=>e.A(35403),{loadableGenerated:{modules:[45397]},ssr:!1}),w=(0,t.default)(()=>e.A(53096).then(e=>e.default),{loadableGenerated:{modules:[67211]},ssr:!1}),k=`-- Paste Oracle SQL here, or upload .sql files above 34-- Example: 35 36CREATE OR REPLACE PROCEDURE get_employee_info( 37 p_emp_id IN NUMBER, 38 p_name OUT VARCHAR2, 39 p_salary OUT NUMBER 40) IS 41BEGIN 42 SELECT first_name || ' ' || last_name, salary 43 INTO p_name, p_salary 44 FROM employees 45 WHERE employee_id = p_emp_id; 46EXCEPTION 47 WHEN NO_DATA_FOUND THEN 48 p_name := 'Unknown';
49 p_salary := 0; 50END get_employee_info; 51/ 52 53SELECT DECODE(department_id, 10, 'Administration', 20, 'Marketing', 'Other') AS dept_name, 54 NVL(commission_pct, 0) AS commission, 55 SYSDATE AS run_date 56 FROM employees 57 WHERE hire_date > ADD_MONTHS(SYSDATE, -12);`;function S({isConverting:e}){return(0,r.jsx)("div",{className:"h-full flex items-center justify-center bg-[var(--color-bg-secondary)]",children:(0,r.jsx)("div",{className:"text-center space-y-3 animate-fade-in",children:e?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"w-10 h-10 mx-auto border-2 border-[var(--color-border-glow)] border-t-[var(--color-accent-blue)] rounded-full animate-spin-slow"}),(0,r.jsx)("p",{className:"text-sm text-[var(--color-text-dim)]",children:"Processing pipeline..."}),(0,r.jsx)("p",{className:"text-[0.65rem] text-[var(--color-text-dim)] opacity-60",children:"AST Chunking â Cache Check â SQLines â LLM Fallback â Guardrails"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"text-4xl opacity-20",children:"ð"}),(0,r.jsx)("p",{className:"text-sm text-[var(--color-text-dim)]",children:"PostgreSQL output appears here"}),(0,r.jsxs)("p",{className:"text-[0.65rem] text-[var(--color-text-dim)] opacity-60",children:["Paste Oracle SQL on the left, then click"," ",(0,r.jsx)("span",{className:"text-[var(--color-accent-blue)]",children:"â¡ Convert"})]})]})})})}function C({blocks:e,onFeedback:a}){return(0,r.jsx)("div",{className:"h-full overflow-y-auto p-3 space-y-3 bg-[var(--color-bg-secondary)]",children:e.map((e,t)=>(0,r.jsxs)("div",{className:"rounded-lg border border-[var(--color-border-primary)] overflow-hidden animate-slide-up",style:{animationDelay:`${50*t}ms`},children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 bg-[var(--color-bg-surface)]",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsxs)("span",{className:"text-[0.6rem] font-bold uppercase tracking-wider text-[var(--color-text-dim)]",children:["Block ",t+1]}),(0,r.jsx)("span",{className:"text-[0.6rem] px-1.5 py-0.5 rounded bg-[var(--color-bg-elevated)] text-[var(--color-accent-blue)] border border-[var(--color-accent-blue-dim)]",children:e.type}),(0,r.jsx)(L,{method:e.method})]}),"llm"===e.method&&(0,r.jsx)(n,{blockId:e.id,cacheKey:e.cacheKey,method:e.method,onFeedback:a})]}),e.llmError&&(0,r.jsx)("div",{className:"px-3 py-1.5 bg-[rgba(248,113,113,0.05)] border-b border-[rgba(248,113,113,0.15)]",children:(0,r.jsxs)("p",{className:"text-[0.65rem] text-[var(--color-accent-red)]",children:["ð´ LLM error: ",e.llmError]})}),e.guardrailViolations.length>0&&(0,r.jsx)("div",{className:"px-3 py-1.5 bg-[rgba(248,113,113,0.05)] border-b border-[rgba(248,113,113,0.15)]",children:e.guardrailViolations.map((e,a)=>(0,r.jsxs)("p",{className:"text-[0.65rem] text-[var(--color-accent-red)]",children:["â ",e]},a))}),(0,r.jsx)("pre",{className:"p-3 text-[0.75rem] font-mono leading-relaxed text-[var(--color-text-primary)] overflow-x-auto bg-[var(--color-bg-primary)]",children:e.targetText})]},e.id))})}function L({method:e}){let a={sqlines:{color:"var(--color-accent-cyan)",bg:"rgba(34,211,238,0.08)",border:"rgba(34,211,238,0.2)",label:"â SQLines"},llm:{color:"var(--color-accent-purple)",bg:"rgba(167,139,250,0.08)",border:"rgba(167,139,250,0.2)",label:"ð¤ LLM"},cache:{color:"var(--color-accent-green)",bg:"rgba(52,211,153,0.08)",border:"rgba(52,211,153,0.2)",label:"ð¾ Cached"},hard_fail:{color:"var(--color-accent-red)",bg:"rgba(248,113,113,0.08)",border:"rgba(248,113,113,0.2)",label:"â Failed"}},t=a[e]||a.hard_fail;return(0,r.jsx)("span",{className:"text-[0.6rem] font-semibold px-1.5 py-0.5 rounded",style:{color:t.color,background:t.bg,border:`1px solid ${t.border}`},children:t.label})}e.s(["default",0,function(){let[e,t]=(0,a.useState)(""),[l,n]=(0,a.useState)(null),[c,i]=(0,a.useState)(!1),[d,x]=(0,a.useState)("diff"),[p,b]=(0,a.useState)("converter"),[u,v]=(0,a.useState)(!1),[g,h]=(0,a.useState)([]),[y,j]=(0,a.useState)({provider:"openai",apiKey:"",model:"gpt-4o",azureEndpoint:"",azureDeployment:"",azureApiVersion:"2025-01-01-preview",sqlinesPath:""}),L=(0,a.useRef)(0),E=(0,a.useCallback)((e,r="info")=>{let a=++L.current;h(t=>[...t,{id:a,message:e,type:r}]),setTimeout(()=>{h(e=>e.filter(e=>e.id!==a))},4e3)},[]);(0,a.useEffect)(()=>{let e=e=>{(e.ctrlKey||e.metaKey)&&"Enter"===e.key&&(e.preventDefault(),A())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[e,y]);let A=async()=>
57{if(!e.trim())return void E("Paste Oracle SQL or upload a file first","error");i(!0),n(null);try{let r=await fetch("/api/convert",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceSQL:e,settings:{provider:y.provider,apiKey:y.apiKey,model:y.model,azureEndpoint:y.azureEndpoint,azureDeployment:y.azureDeployment,azureApiVersion:y.azureApiVersion,sqlinesPath:y.sqlinesPath}})}),a=await r.json();if(a.error)return void E(a.error,"error");n(a);let{totalBlocks:t,sqlinesSuccess:o,llmSuccess:l,cacheHits:s,hardFails:c}=a.stats;if(c>0&&0===l){let e=a.blocks.find(e=>e.llmError)?.llmError;E(e?`LLM error: ${e}`:`${c}/${t} block(s) failed â check Settings (provider, API key, endpoint)`,"error")}else E(`Converted ${t} block(s) â ${o} SQLines, ${l} LLM, ${s} cached`,"success")}catch(e){E(e instanceof Error?e.message:"Conversion failed","error")}finally{i(!1)}},_=async(e,r)=>{try{let a=await fetch("/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cacheKey:e,vote:r})}),t=await a.json();E("down"===r?"Cache entry evicted â block will be re-converted":"Feedback recorded â","down"===r?"info":"success"),a.ok||E(t.error||"Feedback failed","error")}catch{E("Failed to send feedback","error")}},R=(0,a.useCallback)(e=>{t(e),E("Files loaded â","success")},[E]),O=(0,a.useCallback)(()=>{l?.finalSQL&&(navigator.clipboard.writeText(l.finalSQL),E("Copied to clipboard â","success"))},[l,E]),P=(0,a.useCallback)(()=>{if(l?.finalSQL){let e=new Blob([l.finalSQL],{type:"text/plain"}),r=URL.createObjectURL(e),a=document.createElement("a");a.href=r,a.download="converted_postgresql.sql",a.click(),URL.revokeObjectURL(r),E("Downloaded â","success")}},[l,E]);return(0,r.jsxs)("div",{className:"h-screen flex flex-col overflow-hidden bg-[var(--color-bg-primary)]",children:[(0,r.jsxs)("header",{className:"flex items-center justify-between px-5 py-3 border-b border-[var(--color-border-primary)] bg-gradient-to-r from-[#060a14] via-[#0a1025] to-[#060a14] gradient-border flex-shrink-0",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"w-8 h-8 rounded-lg bg-gradient-to-br from-[var(--color-accent-blue)] to-[var(--color-accent-purple)] flex items-center justify-center text-white font-bold text-sm shadow-lg",children:"â¡"}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("h1",{className:"text-sm font-bold tracking-tight",children:["Oracle"," ",(0,r.jsx)("span",{className:"text-[var(--color-text-dim)]",children:"â"})," ",(0,r.jsx)("span",{className:"bg-gradient-to-r from-[var(--color-accent-blue)] to-[var(--color-accent-purple)] bg-clip-text text-transparent",children:"PostgreSQL"})]}),(0,r.jsx)("p",{className:"text-[0.6rem] text-[var(--color-text-dim)]",children:"AST Chunker · SQLines · LLM Fallback · Guardrails"})]})]}),(0,r.jsx)("div",{className:"flex rounded-lg border border-[var(--color-border-primary)] overflow-hidden",children:["converter","ide"].map(e=>(0,r.jsx)("button",{onClick:()=>b(e),className:`px-4 py-1.5 text-xs font-semibold transition-all capitalize ${p===e?"bg-[var(--color-accent-blue)] text-white":"text-[var(--color-text-dim)] hover:text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-surface)]"}`,children:"ide"===e?"SQL IDE":"Converter"},e))}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1.5 mr-2",children:[(0,r.jsx)("div",{className:"w-2 h-2 rounded-full",style:{background:y.apiKey?"var(--color-accent-green)":"var(--color-accent-red)",boxShadow:y.apiKey?"0 0 8px rgba(52,211,153,0.5)":"0 0 8px rgba(248,113,113,0.5)"}}),(0,r.jsx)("span",{className:"text-[0.65rem] text-[var(--color-text-dim)]",children:y.apiKey?`${"azure-openai"===y.provider?"Azure":"anthropic"===y.provider?"Anthropic":"OpenAI"} Ready`:"No API Key"})]}),(0,r.jsx)("button",{onClick:()=>v(!0),className:"px-3 py-1.5 rounded-lg text-xs font-medium border border-[var(--color-border-primary)] text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-surface)] hover:border-[var(--color-border-glow)] transition-all duration-200",children:"âï¸ Settings"})]})]}),"ide"===p&&(0,r.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:(0,r.jsx)(f,{initialOracleSQL:e||void 0,initialPgSQL:l?.finalSQL||void 0})}),(0,r.jsxs)("div",{className:`flex-1 grid grid-cols-2 min-h-0 overflow-hidden ${"converter"!==p?"hidden":""}`,children:[(0,r.jsxs)("div",{className:"flex flex-col border-r border-[var(--color-border-primary)] min-h-0",children:[(0,r.jsx)("div",{className:"flex items-center justify-between px-4 py-2.5 bg-[var(--color-bg-secondary)] border-b border-[var(--color-border-primary)] flex-shrink-0",children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"text-[0.6rem] font-bold uppercase tracking-widest text-[var(--color-accent-amber)]",children:"Oracle Input"}),(0,r.jsxs)("span",{className:"text-[0.55rem] text-[var(--color-text-dim)] px-1.5 py-0.5 rounded bg-[var(--color-bg-surface)]",children:[e.split("\n").length," lines"]})]})}),(0,r.jsx)("div",{className:"px-3 py-2 border-b border-[var(--color-border-primary)] bg-[var(--color-bg-secondary)] flex-shrink-0",children:(0,r.jsx)(o,{onFilesLoaded:R})}),(0,r.jsx)("div",{style:{flex:1,minHeight:0,position:"relative"},children:(0,r.jsx)(w,{height:"100%",value:e,defaultValue:k,onChange:e=>t(e||""),language:"sql",theme:"vs-dark",options:{minimap:{enabled:!1},fontSize:13,fontFamily:"'JetBrains Mono', monospace",lineHeight:20,scrollBeyondLastLine:!1,wordWrap:"on",padding:{top:12,bottom:12},smoothScrolling:!0,placeholder:k}})}),(0,r.jsxs)("div",{className:"flex items-center gap-2 px-4 py-2.5 bg-[var(--color-bg-secondary)] border-t border-[var(--color-border-primary)] flex-shrink-0",children:[(0,r.jsx)("button",{onClick:A,disabled:c||!e.trim(),className:"px-4 py-2 rounded-lg text-sm font-bold bg-gradient-to-r from-[var(--color-accent-blue)] to-[#6366f1] text-white hover:brightness-110 transition-all duration-200 disabled:opacity-40 disabled:cursor-not-allowed flex items-center gap-2 shadow-lg shadow-blue-500/20",children:c?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"w-3.5 h-3.5 border-2 border-white/30 border-t-white rounded-full animate-spin-slow"}
57),"Converting..."]}):(0,r.jsx)(r.Fragment,{children:"â¡ Convert"})}),(0,r.jsx)("button",{onClick:()=>{t(""),n(null)},className:"px-3 py-2 rounded-lg text-xs font-medium border border-[var(--color-border-primary)] text-[var(--color-text-dim)] hover:text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-surface)] transition-all",children:"â Clear"}),(0,r.jsx)("button",{onClick:()=>t(k),className:"px-3 py-2 rounded-lg text-xs font-medium border border-[var(--color-border-primary)] text-[var(--color-text-dim)] hover:text-[var(--color-accent-blue)] hover:border-[var(--color-accent-blue-dim)] transition-all",children:"ð Load Example"}),(0,r.jsx)("span",{className:"ml-auto text-[0.6rem] text-[var(--color-text-dim)]",children:"Ctrl+Enter to convert"})]})]}),(0,r.jsxs)("div",{className:"flex flex-col min-h-0",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 py-2.5 bg-[var(--color-bg-secondary)] border-b border-[var(--color-border-primary)] flex-shrink-0",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"text-[0.6rem] font-bold uppercase tracking-widest text-[var(--color-accent-green)]",children:"PostgreSQL Output"}),l&&(0,r.jsxs)("span",{className:"text-[0.55rem] text-[var(--color-text-dim)] px-1.5 py-0.5 rounded bg-[var(--color-bg-surface)]",children:[l.finalSQL.split("\n").length," lines"]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,r.jsxs)("div",{className:"flex rounded-md border border-[var(--color-border-primary)] overflow-hidden",children:[(0,r.jsx)("button",{onClick:()=>x("diff"),className:`px-2.5 py-1 text-[0.65rem] font-medium transition-all ${"diff"===d?"bg-[var(--color-bg-elevated)] text-[var(--color-accent-blue)]":"text-[var(--color-text-dim)] hover:text-[var(--color-text-secondary)]"}`,children:"Diff"}),(0,r.jsx)("button",{onClick:()=>x("blocks"),className:`px-2.5 py-1 text-[0.65rem] font-medium transition-all border-l border-[var(--color-border-primary)] ${"blocks"===d?"bg-[var(--color-bg-elevated)] text-[var(--color-accent-purple)]":"text-[var(--color-text-dim)] hover:text-[var(--color-text-secondary)]"}`,children:"Blocks"})]}),l&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{onClick:O,className:"px-2 py-1 rounded text-[0.65rem] text-[var(--color-text-dim)] hover:text-[var(--color-text-primary)] hover:bg-[var(--color-bg-surface)] transition-all",children:"ð Copy"}),(0,r.jsx)("button",{onClick:P,className:"px-2 py-1 rounded text-[0.65rem] text-[var(--color-text-dim)] hover:text-[var(--color-text-primary)] hover:bg-[var(--color-bg-surface)] transition-all",children:"⬠Save"})]})]})]}),(0,r.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",style:{position:"relative"},children:l?"diff"===d?(0,r.jsx)(N,{original:e,modified:l.finalSQL}):(0,r.jsx)(C,{blocks:l.blocks,onFeedback:_}):(0,r.jsx)(S,{isConverting:c})})]})]}),l&&(0,r.jsx)(s,{stats:l.stats,constructs:l.constructs,mode:l.mode,validationReport:l.validationReport,conversionScore:l.conversionScore}),(0,r.jsx)(m,{isOpen:u,onClose:()=>v(!1),onSave:e=>{j(e),v(!1),E("Settings saved â","success")},initialSettings:y}),(0,r.jsx)("div",{className:"fixed bottom-4 right-4 z-50 flex flex-col gap-2",children:g.map(e=>(0,r.jsx)("div",{className:`toast-enter px-4 py-2.5 rounded-lg text-sm font-medium shadow-xl max-w-sm ${"success"===e.type?"bg-[#071a10] text-[var(--color-accent-green)] border border-[rgba(52,211,153,0.25)] glow-green":"error"===e.type?"bg-[#1a0707] text-[var(--color-accent-red)] border border-[rgba(248,113,113,0.25)] glow-red":"bg-[#070e1a] text-[var(--color-accent-blue)] border border-[rgba(79,141,255,0.25)] glow-blue"}`,children:e.message},e.id))})]})}],31713)}]);
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.