1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7031],{87031:(e,r,a)=>{a.r(r),a.d(r,{CodeModePanel:()=>i});var t=a(54568),l=a(13932),s=a(7620),n=a(46764);function d({value:e,onChange:r,height:a="calc(100vh - 400px)",className:l,placeholder:o}){let[i,c]=(0,s.useState)(!1),m=async()=>{e&&(await navigator.clipboard.writeText(e),c(!0),setTimeout(()=>c(!1),2e3))},x="number"==typeof a?`${a}px`:a;return(0,t.jsxs)("div",{className:(0,n.cn)("relative border border-gray-700 rounded-md overflow-hidden",l),children:[(0,t.jsxs)("div",{className:"flex items-center justify-between bg-gray-900 border-b border-gray-700 px-3 py-2",children:[(0,t.jsx)("span",{className:"text-xs text-gray-400 font-mono",children:"Python"}),(0,t.jsx)("button",{type:"button",onClick:()=>void m(),className:"text-xs text-gray-400 hover:text-gray-200 transition-colors",children:i?"Copied!":"Copy"})]}),(0,t.jsx)("textarea",{value:e,onChange:e=>r(e.target.value),placeholder:o,className:(0,n.cn)("w-full bg-gray-950 text-gray-100 font-mono text-sm","p-4 resize-none focus:outline-none","placeholder:text-gray-600"),style:{height:x,minHeight:"400px"},spellCheck:!1})]})}let o=[(e,r)=>{if(!e.includes("Invalid parameter")||!e.includes("for transform"))return null;let a=e.match(/Invalid parameter "([^"]+)" for transform "([^"]+)"/);return a?(0,t.jsxs)("div",{className:"mb-2",children:["Invalid parameter ",(0,t.jsx)("span",{className:"bg-red-500/30 text-red-200 px-1 py-0.5 rounded font-semibold",children:a[1]})," for transform ",(0,t.jsx)("span",{className:"bg-blue-500/30 text-blue-200 px-1 py-0.5 rounded font-semibold",children:a[2]}),"."]},r):null},(e,r)=>{if(!e.includes("Expected format:"))return null;let a=e.match(/Expected format: "([^"]+)"/);return a?(0,t.jsxs)("div",{className:"mb-2",children:["Expected format:"," ",(0,t.jsx)("span",{className:"bg-yellow-500/30 text-yellow-200 px-1 py-0.5 rounded font-mono",children:a[1]}),e.replace(/Expected format: "[^"]+"/,"")]},r):null},(e,r)=>{if(!e.includes("Invalid parameter format:")&&!e.includes("Invalid parameter name:"))return null;let a=e.match(/"([^"]+)"/);return a?(0,t.jsxs)("div",{className:"mb-2",children:[e.replace(/"[^"]+"/,""),(0,t.jsx)("span",{className:"bg-red-500/30 text-red-200 px-1 py-0.5 rounded font-mono",children:a[1]})]},r):null},(e,r)=>"Valid parameters are:"===e.trim()?(0,t.jsx)("div",{className:"text-yellow-300 font-medium mb-1 mt-2",children:e},r):null,(e,r,a)=>e.includes(",")&&0!==r&&a[r-1].includes("Valid parameters are:")?(0,t.jsx)("div",{className:"bg-gray-800/50 p-2 rounded border-l-2 border-green-500",children:(0,t.jsx)("div",{className:"text-green-300 font-mono text-xs",children:e.split(", ").map((e,r,a)=>(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"bg-green-500/20 text-green-200 px-1 py-0.5 rounded mr-1",children:e.trim()}),r<a.length-1&&" "]},r))})},r):null,(e,r)=>e.includes("parameter_name=value")||e.includes("=value")?(0,t.jsx)("div",{className:"bg-blue-900/30 p-2 rounded border-l-2 border-blue-400 mt-1",children:(0,t.jsx)("span",{className:"text-blue-300 font-mono text-xs",children:e})},r):null];function i({codeValue:e,codeValidationError:r,transformName:a,onCodeChange:s,onClearValidationError:n}){let c;return(0,t.jsxs)("div",{className:"space-y-2",children:[r&&(0,t.jsx)("div",{className:"p-3 rounded-md bg-red-900/20 border border-red-500/50",children:(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsx)("div",{className:"text-red-400 mt-0.5",children:"!"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-red-400 mb-1",children:"Code Validation Error"}),(0,t.jsx)("div",{className:"text-sm text-red-300 whitespace-pre-wrap font-mono leading-relaxed",children:(c=r.split("\n")).map((e,r)=>(function(e,r,a){for(let t of o){let l=t(e,r,a);if(l)return l}return e.trim()?(0,t.jsx)("div",{className:"mb-1",children:e},r):null})(e,r,c)).filter(Boolean)})]}),(0,t.jsx)("button",{type:"button",onClick:n,className:"text-red-400 hover:text-red-300 p-1","aria-label":"Close error message",children:(0,t.jsx)(l.A,{className:"w-4 h-4"})})]})}
1),(0,t.jsx)(d,{value:e,onChange:s,height:"calc(100dvh - 350px)",className:"w-full",placeholder:`# Example usage: 2 3${a}( 4 # Add your parameters here 5)`}),(0,t.jsx)("div",{className:"text-xs text-gray-400",children:"Edit the Python code above. Parameters will be parsed when you switch back to form view."})]})}}}]);
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.