@tscircuit/runframe 0.0.1620 → 0.0.1621

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1730,7 +1730,7 @@ var useErrorTelemetry = ({
1730
1730
  };
1731
1731
 
1732
1732
  // package.json
1733
- var version = "0.0.1619";
1733
+ var version = "0.0.1620";
1734
1734
  var package_default = {
1735
1735
  name: "@tscircuit/runframe",
1736
1736
  main: "dist/preview.js",
@@ -1805,7 +1805,7 @@ var package_default = {
1805
1805
  "circuit-json-to-kicad": "^0.0.72",
1806
1806
  "circuit-json-to-lbrn": "^0.0.4",
1807
1807
  "circuit-json-to-pnp-csv": "^0.0.7",
1808
- "circuit-json-to-step": "^0.0.16",
1808
+ "circuit-json-to-step": "^0.0.18",
1809
1809
  "class-variance-authority": "^0.7.1",
1810
1810
  clsx: "^2.1.1",
1811
1811
  cmdk: "^1.1.1",
@@ -1841,7 +1841,7 @@ var package_default = {
1841
1841
  "schematic-symbols": "^0.0.202",
1842
1842
  serve: "^14.2.4",
1843
1843
  "source-map-explorer": "^2.5.3",
1844
- stepts: "^0.0.2",
1844
+ stepts: "^0.0.3",
1845
1845
  "tailwind-merge": "^2.6.0",
1846
1846
  tailwindcss: "^3.4.17",
1847
1847
  "tailwindcss-animate": "^1.0.7",
package/dist/preview.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  linkify,
9
9
  useOrderDialog,
10
10
  useOrderDialogCli
11
- } from "./chunk-SCIYFLUR.js";
11
+ } from "./chunk-RZUU3CYA.js";
12
12
  export {
13
13
  BomTable,
14
14
  CadViewer,
package/dist/runner.js CHANGED
@@ -34,7 +34,7 @@ import {
34
34
  useRunFrameStore,
35
35
  useRunnerStore,
36
36
  useStyles
37
- } from "./chunk-SCIYFLUR.js";
37
+ } from "./chunk-RZUU3CYA.js";
38
38
 
39
39
  // lib/components/RunFrame/RunFrame.tsx
40
40
  import { createCircuitWebWorker } from "@tscircuit/eval/worker";
@@ -5682,7 +5682,7 @@ test("${g} should solve problem correctly", () => {
5682
5682
  // Add more specific assertions based on expected output
5683
5683
  // expect(solver.netLabelPlacementSolver!.netLabelPlacements).toMatchInlineSnapshot()
5684
5684
  })
5685
- `,I=new Blob([c],{type:"text/plain"}),l=URL.createObjectURL(I),B=document.createElement("a");B.href=l,B.download=`${g}.test.ts`,B.click(),URL.revokeObjectURL(l)}catch(a){alert(`Error generating test.ts for ${e.constructor.name}: ${a instanceof Error?a.message:String(a)}`)}i(!1)};return Z.jsxs("div",{className:`relative ${A}`,ref:n,children:[Z.jsx("button",{className:"px-2 py-1 rounded text-xs cursor-pointer",onClick:()=>i(!t),title:`Download options for ${e.constructor.name}`,children:e.constructor.name}),t&&Z.jsxs("div",{className:"absolute top-full left-0 mt-1 bg-white border border-gray-300 rounded shadow-lg z-10 min-w-[150px]",children:[Z.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:o,children:"Download JSON"}),Z.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:s,children:"Download page.tsx"}),Z.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:r,children:"Download test.ts"})]})]})},qgt=e=>e.activeSubSolver?[e,...qgt(e.activeSubSolver)]:[e],GWe=({solver:e})=>{const A=qgt(e);return Z.jsx("div",{className:"flex gap-1 items-center text-sm pt-1",children:A.map((t,i)=>Z.jsxs("div",{className:"flex items-center",children:[i>0&&Z.jsx("span",{className:"text-gray-400 mx-1",children:"→"}),Z.jsx(FWe,{solver:t})]},t.constructor.name))})},MWe=({solver:e,triggerRender:A,animationSpeed:t=25,onSolverStarted:i,onSolverCompleted:n})=>{const[o,s]=AA.useReducer(E=>!E,!1),r=AA.useRef(void 0),a=()=>{!e.solved&&!e.failed&&(e.step(),A())},g=()=>{!e.solved&&!e.failed&&(i&&i(e),e.solve(),A(),n&&n(e))},c=()=>{o?(r.current&&(clearInterval(r.current),r.current=void 0),s()):(s(),r.current=setInterval(()=>{if(e.solved||e.failed){r.current&&(clearInterval(r.current),r.current=void 0),s(),A(),n&&e.solved&&n(e);return}e.step(),A()},t))},I=()=>{const E=e;if(E.getCurrentPhase&&!e.solved&&!e.failed){const Q=E.getCurrentPhase();for(;E.getCurrentPhase()===Q&&!e.solved&&!e.failed;)e.step();A()}},l=()=>{if(e.solved||e.failed||o)return;const E=window.prompt("Step until which iteration?",`${e.iterations}`);if(E===null)return;const Q=Number(E);if(!Number.isFinite(Q)){window.alert("Please enter a valid number for the iteration");return}for(;e.iterations<Q&&!e.solved&&!e.failed;)e.step();A(),e.solved&&n&&n(e)};AA.useEffect(()=>()=>{r.current&&clearInterval(r.current)},[]),AA.useEffect(()=>{(e.solved||e.failed)&&o&&(r.current&&(clearInterval(r.current),r.current=void 0),s())},[e.solved,e.failed,o]);const B=e.getCurrentPhase!==void 0,C=B?e.getCurrentPhase():null;return Z.jsxs("div",{className:"space-y-2 p-2 border-b",children:[Z.jsx("div",{className:"flex items-center",children:Z.jsx(GWe,{solver:e})}),Z.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[Z.jsx("button",{onClick:a,disabled:e.solved||e.failed||o,className:"bg-blue-500 hover:bg-blue-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step"}),Z.jsx("button",{onClick:g,disabled:e.solved||e.failed||o,className:"bg-green-500 hover:bg-green-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Solve"}),Z.jsx("button",{onClick:c,disabled:e.solved||e.failed,className:`px-3 py-1 rounded text-white text-sm ${o?"bg-red-500 hover:bg-red-600":"bg-yellow-500 hover:bg-yellow-600"} disabled:bg-gray-300`,children:o?"Stop":"Animate"}),Z.jsx("button",{onClick:l,disabled:e.solved||e.failed||o,className:"bg-orange-500 hover:bg-orange-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step Until Iteration"}),B&&Z.jsx("button",{onClick:I,disabled:e.solved||e.failed||o,className:"bg-purple-500 hover:bg-purple-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Next Stage"}),Z.jsxs("div",{className:"text-sm text-gray-600",children:["Iterations: ",e.iterations]}),e.timeToSolve!==void 0&&Z.jsxs("div",{className:"text-sm text-gray-600",children:["Time: ",(e.timeToSolve/1e3).toFixed(3),"s"]}),C&&Z.jsxs("div",{className:"text-sm text-gray-600",children:["Phase: ",Z.jsx("span",{className:"font-medium",children:C})]}),e.solved&&Z.jsx("div",{className:"px-2 py-1 bg-green-100 text-green-800 rounded text-sm",children:"Solved"}),e.failed&&Z.jsx("div",{className:"px-2 py-1 bg-red-100 text-red-800 rounded text-sm",children:"Failed"})]}),e.error&&Z.jsxs("div",{className:"text-red-600 text-sm",children:["Error: ",e.error]})]})},RWe=(e,A,t)=>{const i=e.currentPipelineStepIndex;return A<i?"Completed":A===i&&e.activeSubSolver?e.activeSubSolver.failed?"Failed":"In Progress":"Not Started"},NWe=(e,A)=>{const i=e.pipelineDef[A].solverName,n=RWe(e,A),o=e[i],s=e.firstIterationOfPhase?.[i]??null,r=e.iterations;let a=0;if(n==="Completed"){const l=e.pipelineDef[A+1],B=l?e.firstIterationOfPhase?.[l.solverName]:void 0;B!==void 0&&s!==null?a=B-s:s!==null&&(a=r-s)}else n==="In Progress"&&s!==null&&(a=r-s);const g=e.timeSpentOnPhase?.[i]??0;let c=0;n==="Completed"?c=1:n==="In Progress"&&o&&(c=o.progress??0);const I=o?.stats??null;return{index:A,name:i,status:n,firstIteration:s,iterations:a,progress:c,timeSpent:g,stats:I&&Object.keys(I).length>0?I:null,solverInstance:o??null}},vWe=({status:e})=>{const A={"Not Started":"text-blue-600","In Progress":"text-yellow-600",Completed:"text-green-600",Failed:"text-red-600"};return Z.jsx("span",{className:`font-medium ${A[e]}`,children:e})},LWe=({progress:e})=>{if(e===0)return null;const A=Math.round(e*100);return Z.jsxs("div",{className:"flex items-center gap-2",children:[Z.jsx("div",{className:"w-20 h-2 bg-gray-200 rounded overflow-hidden",children:Z.jsx("div",{className:"h-full bg-blue-500 transition-all duration-200",style:{width:`${A}%`}})}),Z.jsxs("span",{className:"text-xs text-gray-500",children:[A,"%"]})]})},UWe=e=>Object.entries(e).map(([A,t])=>`${A}: ${t}`).join(", "),HWe=({stats:e})=>{if(!e||Object.keys(e).length===0)return Z.jsx("span",{children:"-"});const A=Object.entries(e),t=UWe(e);return Z.jsxs("details",{className:"cursor-pointer",children:[Z.jsx("summary",{className:"whitespace-nowrap overflow-hidden text-ellipsis max-w-[200px]",children:t}),Z.jsx("div",{className:"mt-1 text-xs",children:A.map(([i,n])=>Z.jsxs("div",{children:[i,": ",String(n)]},i))})]})},TpA=e=>{if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(TpA);const A={};for(const[t,i]of Object.entries(e))t.startsWith("_")||(A[t]=TpA(i));return A},YWe=(e,A)=>{try{if(typeof e.getConstructorParams!="function"){alert(`getConstructorParams() is not implemented for ${A}`);return}const t=TpA(e.getConstructorParams()),i=new Blob([JSON.stringify(t,null,2)],{type:"application/json"}),n=URL.createObjectURL(i),o=document.createElement("a");o.href=n,o.download=`${A}_input.json`,o.click(),URL.revokeObjectURL(n)}catch(t){alert(`Error downloading input for ${A}: ${t instanceof Error?t.message:String(t)}`)}},JWe=({solver:e,onStepUntilPhase:A,onDownloadInput:t})=>{const i=e.pipelineDef.map((r,a)=>NWe(e,a)),n=r=>{A?.(r)},o=r=>{r.solverInstance&&(t?t(r.solverInstance,r.name):YWe(r.solverInstance,r.name))},s=r=>`${(r/1e3).toFixed(2)}s`;return Z.jsxs("div",{className:"border-t border-gray-200",children:[Z.jsx("div",{className:"px-4 py-2 bg-gray-50 border-b border-gray-200",children:Z.jsx("h3",{className:"text-sm font-semibold text-gray-700",children:"Pipeline Steps"})}),Z.jsx("div",{className:"overflow-x-auto",children:Z.jsxs("table",{className:"w-full text-sm",children:[Z.jsx("thead",{children:Z.jsxs("tr",{className:"bg-gray-50 border-b border-gray-200",children:[Z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Step"}),Z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Status"}),Z.jsxs("th",{className:"px-4 py-2 text-center font-semibold text-gray-700",children:["i",Z.jsx("sub",{children:"0"})]}),Z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Iterations"}),Z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Progress"}),Z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Time"}),Z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Stats"}),Z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Input"})]})}),Z.jsx("tbody",{children:i.map(r=>Z.jsxs("tr",{className:`border-b border-gray-100 ${r.status==="In Progress"?"bg-yellow-50":""}`,children:[Z.jsx("td",{className:"px-4 py-2",children:Z.jsxs("div",{className:"flex items-center gap-2",children:[Z.jsx("span",{className:"text-gray-400 w-6",children:String(r.index+1).padStart(2,"0")}),Z.jsx("button",{onClick:()=>n(r.name),disabled:r.status==="Completed"||e.solved||e.failed,className:"text-blue-500 hover:text-blue-700 disabled:text-gray-300 disabled:cursor-not-allowed",title:`Step until ${r.name} completes`,children:Z.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:Z.jsx("path",{fillRule:"evenodd",d:"M4.5 5.653c0-1.426 1.529-2.33 2.779-1.643l11.54 6.348c1.295.712 1.295 2.573 0 3.285L7.28 19.991c-1.25.687-2.779-.217-2.779-1.643V5.653z",clipRule:"evenodd"})})}),Z.jsx("span",{className:"font-medium text-gray-900",children:r.name})]})}),Z.jsx("td",{className:"px-4 py-2",children:Z.jsx(vWe,{status:r.status})}),Z.jsx("td",{className:"px-4 py-2 text-center text-gray-600",children:r.firstIteration!==null?r.firstIteration:""}),Z.jsx("td",{className:"px-4 py-2 text-gray-600",children:r.iterations}),Z.jsx("td",{className:"px-4 py-2",children:Z.jsx(LWe,{progress:r.progress})}),Z.jsx("td",{className:"px-4 py-2 text-gray-600",children:s(r.timeSpent)}),Z.jsx("td",{className:"px-4 py-2 text-gray-500",children:Z.jsx(HWe,{stats:r.stats})}),Z.jsx("td",{className:"px-4 py-2",children:r.solverInstance?Z.jsxs("button",{onClick:()=>o(r),className:"flex items-center gap-1 text-blue-500 hover:text-blue-700",title:`Download input for ${r.name}`,children:[Z.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:Z.jsx("path",{fillRule:"evenodd",d:"M12 2.25a.75.75 0 01.75.75v11.69l3.22-3.22a.75.75 0 111.06 1.06l-4.5 4.5a.75.75 0 01-1.06 0l-4.5-4.5a.75.75 0 111.06-1.06l3.22 3.22V3a.75.75 0 01.75-.75zm-9 13.5a.75.75 0 01.75.75v2.25a1.5 1.5 0 001.5 1.5h13.5a1.5 1.5 0 001.5-1.5V16.5a.75.75 0 011.5 0v2.25a3 3 0 01-3 3H5.25a3 3 0 01-3-3V16.5a.75.75 0 01.75-.75z",clipRule:"evenodd"})}),Z.jsx("span",{children:"Input"})]}):null})]},r.name))})]})})]})},TWe=class extends en.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){console.error("InteractiveGraphics render error:",e)}render(){return this.state.hasError?this.props.fallback:this.props.children}};function KWe({graphics:e}){const A=e.points??[],t=e.lines??[],i=e.rects??[],n=e.circles??[],o=e.texts??[];let s=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,g=Number.NEGATIVE_INFINITY;const c=(Q,h)=>{typeof Q=="number"&&(Q<s&&(s=Q),Q>a&&(a=Q)),typeof h=="number"&&(h<r&&(r=h),h>g&&(g=h))};for(const Q of A)c(Q.x,Q.y);for(const Q of t){const h=Q.points??[];for(const u of h)c(u.x,u.y)}for(const Q of i){const h=Q.x??0,u=Q.y??0,d=Q.width??0,f=Q.height??0;c(h,u),c(h+d,u+f)}for(const Q of n){const h=Q.x??0,u=Q.y??0,d=Q.radius??1;c(h-d,u-d),c(h+d,u+d)}for(const Q of o)c(Q.x,Q.y);(!isFinite(s)||!isFinite(r)||!isFinite(a)||!isFinite(g))&&(s=-20,r=-20,a=20,g=20);const I=10,l=s-I,B=r-I,C=Math.max(1,a-s+2*I),E=Math.max(1,g-r+2*I);return Z.jsxs("svg",{className:"w-full h-[400px] bg-white",viewBox:`${l} ${B} ${C} ${E}`,role:"img","aria-label":"Graphics fallback",children:[i.map((Q,h)=>Z.jsx("rect",{x:Q.x??0,y:Q.y??0,width:Q.width??0,height:Q.height??0,fill:"none",stroke:Q.strokeColor??"black",strokeWidth:Q.strokeWidth??1},`rect-${h}`)),t.map((Q,h)=>Z.jsx("polyline",{fill:"none",stroke:Q.strokeColor??"black",strokeWidth:Q.strokeWidth??1,points:(Q.points??[]).map(u=>`${u.x??0},${u.y??0}`).join(" ")},`line-${h}`)),n.map((Q,h)=>Z.jsx("circle",{cx:Q.x??0,cy:Q.y??0,r:Q.radius??1.5,fill:Q.fillColor??"none",stroke:Q.strokeColor??"black",strokeWidth:Q.strokeWidth??1},`circle-${h}`)),A.map((Q,h)=>Z.jsx("circle",{cx:Q.x??0,cy:Q.y??0,r:Q.radius??1.5,fill:Q.color??"black"},`point-${h}`)),o.map((Q,h)=>Z.jsx("text",{x:Q.x??0,y:Q.y??0,fontSize:Q.fontSize??10,fill:Q.color??"black",children:Q.text??""},`text-${h}`))]})}var PWe=({solver:e,animationSpeed:A=25,onSolverStarted:t,onSolverCompleted:i})=>{const[n,o]=AA.useReducer(c=>c+1,0),s=AA.useMemo(()=>{try{return e.visualize()||{points:[],lines:[],rects:[],circles:[]}}catch(c){return console.error("Visualization error:",c),{points:[],lines:[],rects:[],circles:[]}}},[e,n]),r=AA.useMemo(()=>(s.rects?.length||0)===0&&(s.lines?.length||0)===0&&(s.points?.length||0)===0&&(s.circles?.length||0)===0,[s]);AA.useEffect(()=>{if(!(typeof document>"u")&&!document.querySelector('script[src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"]')){const c=document.createElement("script");c.src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4",document.head.appendChild(c)}},[]);const a=e.pipelineDef!==void 0,g=c=>{const I=e;if(!e.solved&&!e.failed){for(;!e.solved&&!e.failed&&I.currentPipelineStepIndex<=I.pipelineDef.findIndex(l=>l.solverName===c);)e.step();o()}};return Z.jsxs("div",{children:[Z.jsx(MWe,{solver:e,triggerRender:o,animationSpeed:A,onSolverStarted:t,onSolverCompleted:i}),r?Z.jsx("div",{className:"p-4 text-gray-500",children:"No Graphics Yet"}):Z.jsx(TWe,{fallback:Z.jsx(KWe,{graphics:s}),children:Z.jsx(kWe,{graphics:s})}),a&&Z.jsx(JWe,{solver:e,onStepUntilPhase:g})]})};const qWe=()=>{AA.useEffect(()=>{const e="tailwind-cdn-script";if(document.getElementById(e)||window.tailwind)return;const A=document.createElement("div");A.className="hidden",document.body.appendChild(A);const t=window.getComputedStyle(A).display==="none";if(document.body.removeChild(A),t)return;const i=document.createElement("script");i.id=e,i.src="https://cdn.tailwindcss.com",document.head.appendChild(i)},[])},OWe=e=>e.toLowerCase().includes("pack")?GFe:e.toLowerCase().includes("rout")?UFe:mFe,WWe=({solverEvents:e=[]})=>{const[A,t]=AA.useState(null);qWe();const i=AA.useMemo(()=>{const r=new Map;for(const a of e){const g=`${a.componentName}-${a.solverName}`;r.set(g,a)}return r},[e]),n=AA.useMemo(()=>Array.from(i.keys()),[i]),o=A?i.get(A):null,s=AA.useMemo(()=>{if(!o)return{instance:null,error:null,classFound:!1};const r=zsA[o.solverName];if(!r)return{instance:null,error:`Solver class "${o.solverName}" not found in SOLVERS registry. Available: ${Object.keys(zsA).join(", ")}`,classFound:!1};try{const a=o.solverParams,g=a?.input!==void 0?a.input:a;return{instance:new r(g),error:null,classFound:!0}}catch(a){const g=a instanceof Error?a.message:String(a);return console.error("Failed to reconstruct solver:",a),{instance:null,error:`Failed to instantiate solver: ${g}`,classFound:!0}}},[o]);return e.length===0?Z.jsx("div",{className:"rf-p-4",children:Z.jsx("div",{className:"rf-bg-gray-50 rf-rounded-md rf-border rf-border-gray-200",children:Z.jsxs("div",{className:"rf-p-4",children:[Z.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800 rf-mb-3",children:"No Solvers Detected"}),Z.jsx("p",{className:"rf-text-sm rf-text-gray-600",children:"Solvers will appear here when the circuit runs. Solvers are used for tasks like component packing and autorouting."})]})})}):Z.jsxs("div",{className:"rf-flex rf-h-full rf-overflow-hidden",children:[Z.jsxs("div",{className:"rf-w-64 rf-border-r rf-border-gray-200 rf-overflow-y-auto rf-flex-shrink-0",children:[Z.jsxs("div",{className:"rf-text-xs rf-font-semibold rf-text-gray-500 rf-px-3 rf-py-2 rf-bg-gray-50 rf-border-b rf-border-gray-200",children:[n.length," ",n.length===1?"Solver":"Solvers"]}),n.map(r=>{const a=i.get(r),g=A===r;return Z.jsx("div",{className:`rf-px-3 rf-py-2 rf-cursor-pointer rf-border-b rf-border-gray-100 ${g?"rf-bg-blue-50 rf-border-l-2 rf-border-l-blue-500":"hover:rf-bg-gray-50"}`,onClick:()=>t(r),children:(()=>{const c=OWe(a.solverName);return Z.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[Z.jsx(c,{className:"rf-w-4 rf-h-4 rf-text-blue-500 rf-flex-shrink-0"}),Z.jsxs("div",{className:"rf-flex-1 rf-min-w-0",children:[Z.jsx("div",{className:"rf-text-sm rf-font-medium rf-text-gray-800 rf-truncate",children:a.componentName}),Z.jsx("div",{className:"rf-text-xs rf-text-gray-500 rf-truncate",children:a.solverName})]})]})})()},r)})]}),Z.jsx("div",{className:"rf-flex-1 rf-overflow-hidden",children:o?s.instance?Z.jsx(uD,{fallback:Z.jsx("div",{className:"rf-p-4",children:Z.jsxs("div",{className:"rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200 rf-p-4",children:[Z.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-2",children:"Error Loading Solver Debugger"}),Z.jsxs("p",{className:"rf-text-sm rf-text-red-600",children:["Failed to render the solver debugger for"," ",o.solverName]})]})}),children:Z.jsx(PWe,{solver:s.instance})}):Z.jsxs("div",{className:"rf-p-4",children:[Z.jsxs("div",{className:"rf-mb-4",children:[Z.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800",children:o.solverName}),Z.jsxs("p",{className:"rf-text-sm rf-text-gray-500",children:["Component: ",o.componentName]})]}),s.error&&Z.jsx("div",{className:`rf-rounded-md rf-border rf-p-4 rf-mb-4 ${s.classFound?"rf-bg-red-50 rf-border-red-200":"rf-bg-yellow-50 rf-border-yellow-200"}`,children:Z.jsx("p",{className:`rf-text-sm ${s.classFound?"rf-text-red-700":"rf-text-yellow-700"}`,children:s.error})}),Z.jsxs("div",{className:"rf-border rf-border-gray-200 rf-rounded-md rf-overflow-hidden",children:[Z.jsx("div",{className:"rf-px-3 rf-py-2 rf-bg-gray-50",children:Z.jsx("span",{className:"rf-text-sm rf-font-medium rf-text-gray-700",children:"Solver Parameters"})}),Z.jsx("div",{className:"rf-p-3 rf-bg-white rf-border-t rf-border-gray-200",children:Z.jsx("pre",{className:"rf-text-xs rf-font-mono rf-text-gray-600 rf-whitespace-pre-wrap rf-overflow-x-auto",children:JSON.stringify(o.solverParams,null,2)})})]})]}):Z.jsx("div",{className:"rf-flex rf-items-center rf-justify-center rf-h-full",children:Z.jsx("p",{className:"rf-text-sm rf-text-gray-500",children:"Select a solver from the list to view details"})})})]})},Ogt=({errorMessage:e,errorStack:A,circuitJsonErrors:t})=>{AA.useEffect(()=>{if(e){const i=new Error(e);A&&(i.stack=A);try{RK.captureException(i)}catch{}}},[e,A]),AA.useEffect(()=>{if(t&&t.length>0)for(const i of t){const n=new Error(i.message||"Circuit JSON Error");i.stack&&(n.stack=i.stack);try{RK.captureException(n,{error_type:i.type})}catch{}}},[t])},Wgt="0.0.1619",ZWe={version:Wgt},KpA={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},PpA=new Map,n9=e=>{const A=PpA.get(e);return A?Object.fromEntries(Object.entries(A.stores).map(([t,i])=>[t,i.getState()])):{}},VWe=(e,A,t)=>{if(e===void 0)return{type:"untracked",connection:A.connect(t)};const i=PpA.get(t.name);if(i)return{type:"tracked",store:e,...i};const n={connection:A.connect(t),stores:{}};return PpA.set(t.name,n),{type:"tracked",store:e,...n}},Zgt=(e,A={})=>(t,i,n)=>{const{enabled:o,anonymousActionType:s,store:r,...a}=A;let g;try{g=(o??(KpA?"production":void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!g)return(KpA?"production":void 0)!=="production"&&o&&console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension"),e(t,i,n);const{connection:c,...I}=VWe(r,g,a);let l=!0;n.setState=(E,Q,h)=>{const u=t(E,Q);if(!l)return u;const d=h===void 0?{type:s||"anonymous"}:typeof h=="string"?{type:h}:h;return r===void 0?(c?.send(d,i()),u):(c?.send({...d,type:`${r}/${d.type}`},{...n9(a.name),[r]:n.getState()}),u)};const B=(...E)=>{const Q=l;l=!1,t(...E),l=Q},C=e(n.setState,i,n);if(I.type==="untracked"?c?.init(C):(I.stores[I.store]=n,c?.init(Object.fromEntries(Object.entries(I.stores).map(([E,Q])=>[E,E===I.store?C:Q.getState()])))),n.dispatchFromDevtools&&typeof n.dispatch=="function"){let E=!1;const Q=n.dispatch;n.dispatch=(...h)=>{(KpA?"production":void 0)!=="production"&&h[0].type==="__setState"&&!E&&(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),E=!0),Q(...h)}}return c.subscribe(E=>{var Q;switch(E.type){case"ACTION":if(typeof E.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return qpA(E.payload,h=>{if(h.type==="__setState"){if(r===void 0){B(h.state);return}Object.keys(h.state).length!==1&&console.error(`
5685
+ `,I=new Blob([c],{type:"text/plain"}),l=URL.createObjectURL(I),B=document.createElement("a");B.href=l,B.download=`${g}.test.ts`,B.click(),URL.revokeObjectURL(l)}catch(a){alert(`Error generating test.ts for ${e.constructor.name}: ${a instanceof Error?a.message:String(a)}`)}i(!1)};return Z.jsxs("div",{className:`relative ${A}`,ref:n,children:[Z.jsx("button",{className:"px-2 py-1 rounded text-xs cursor-pointer",onClick:()=>i(!t),title:`Download options for ${e.constructor.name}`,children:e.constructor.name}),t&&Z.jsxs("div",{className:"absolute top-full left-0 mt-1 bg-white border border-gray-300 rounded shadow-lg z-10 min-w-[150px]",children:[Z.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:o,children:"Download JSON"}),Z.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:s,children:"Download page.tsx"}),Z.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:r,children:"Download test.ts"})]})]})},qgt=e=>e.activeSubSolver?[e,...qgt(e.activeSubSolver)]:[e],GWe=({solver:e})=>{const A=qgt(e);return Z.jsx("div",{className:"flex gap-1 items-center text-sm pt-1",children:A.map((t,i)=>Z.jsxs("div",{className:"flex items-center",children:[i>0&&Z.jsx("span",{className:"text-gray-400 mx-1",children:"→"}),Z.jsx(FWe,{solver:t})]},t.constructor.name))})},MWe=({solver:e,triggerRender:A,animationSpeed:t=25,onSolverStarted:i,onSolverCompleted:n})=>{const[o,s]=AA.useReducer(E=>!E,!1),r=AA.useRef(void 0),a=()=>{!e.solved&&!e.failed&&(e.step(),A())},g=()=>{!e.solved&&!e.failed&&(i&&i(e),e.solve(),A(),n&&n(e))},c=()=>{o?(r.current&&(clearInterval(r.current),r.current=void 0),s()):(s(),r.current=setInterval(()=>{if(e.solved||e.failed){r.current&&(clearInterval(r.current),r.current=void 0),s(),A(),n&&e.solved&&n(e);return}e.step(),A()},t))},I=()=>{const E=e;if(E.getCurrentPhase&&!e.solved&&!e.failed){const Q=E.getCurrentPhase();for(;E.getCurrentPhase()===Q&&!e.solved&&!e.failed;)e.step();A()}},l=()=>{if(e.solved||e.failed||o)return;const E=window.prompt("Step until which iteration?",`${e.iterations}`);if(E===null)return;const Q=Number(E);if(!Number.isFinite(Q)){window.alert("Please enter a valid number for the iteration");return}for(;e.iterations<Q&&!e.solved&&!e.failed;)e.step();A(),e.solved&&n&&n(e)};AA.useEffect(()=>()=>{r.current&&clearInterval(r.current)},[]),AA.useEffect(()=>{(e.solved||e.failed)&&o&&(r.current&&(clearInterval(r.current),r.current=void 0),s())},[e.solved,e.failed,o]);const B=e.getCurrentPhase!==void 0,C=B?e.getCurrentPhase():null;return Z.jsxs("div",{className:"space-y-2 p-2 border-b",children:[Z.jsx("div",{className:"flex items-center",children:Z.jsx(GWe,{solver:e})}),Z.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[Z.jsx("button",{onClick:a,disabled:e.solved||e.failed||o,className:"bg-blue-500 hover:bg-blue-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step"}),Z.jsx("button",{onClick:g,disabled:e.solved||e.failed||o,className:"bg-green-500 hover:bg-green-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Solve"}),Z.jsx("button",{onClick:c,disabled:e.solved||e.failed,className:`px-3 py-1 rounded text-white text-sm ${o?"bg-red-500 hover:bg-red-600":"bg-yellow-500 hover:bg-yellow-600"} disabled:bg-gray-300`,children:o?"Stop":"Animate"}),Z.jsx("button",{onClick:l,disabled:e.solved||e.failed||o,className:"bg-orange-500 hover:bg-orange-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step Until Iteration"}),B&&Z.jsx("button",{onClick:I,disabled:e.solved||e.failed||o,className:"bg-purple-500 hover:bg-purple-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Next Stage"}),Z.jsxs("div",{className:"text-sm text-gray-600",children:["Iterations: ",e.iterations]}),e.timeToSolve!==void 0&&Z.jsxs("div",{className:"text-sm text-gray-600",children:["Time: ",(e.timeToSolve/1e3).toFixed(3),"s"]}),C&&Z.jsxs("div",{className:"text-sm text-gray-600",children:["Phase: ",Z.jsx("span",{className:"font-medium",children:C})]}),e.solved&&Z.jsx("div",{className:"px-2 py-1 bg-green-100 text-green-800 rounded text-sm",children:"Solved"}),e.failed&&Z.jsx("div",{className:"px-2 py-1 bg-red-100 text-red-800 rounded text-sm",children:"Failed"})]}),e.error&&Z.jsxs("div",{className:"text-red-600 text-sm",children:["Error: ",e.error]})]})},RWe=(e,A,t)=>{const i=e.currentPipelineStepIndex;return A<i?"Completed":A===i&&e.activeSubSolver?e.activeSubSolver.failed?"Failed":"In Progress":"Not Started"},NWe=(e,A)=>{const i=e.pipelineDef[A].solverName,n=RWe(e,A),o=e[i],s=e.firstIterationOfPhase?.[i]??null,r=e.iterations;let a=0;if(n==="Completed"){const l=e.pipelineDef[A+1],B=l?e.firstIterationOfPhase?.[l.solverName]:void 0;B!==void 0&&s!==null?a=B-s:s!==null&&(a=r-s)}else n==="In Progress"&&s!==null&&(a=r-s);const g=e.timeSpentOnPhase?.[i]??0;let c=0;n==="Completed"?c=1:n==="In Progress"&&o&&(c=o.progress??0);const I=o?.stats??null;return{index:A,name:i,status:n,firstIteration:s,iterations:a,progress:c,timeSpent:g,stats:I&&Object.keys(I).length>0?I:null,solverInstance:o??null}},vWe=({status:e})=>{const A={"Not Started":"text-blue-600","In Progress":"text-yellow-600",Completed:"text-green-600",Failed:"text-red-600"};return Z.jsx("span",{className:`font-medium ${A[e]}`,children:e})},LWe=({progress:e})=>{if(e===0)return null;const A=Math.round(e*100);return Z.jsxs("div",{className:"flex items-center gap-2",children:[Z.jsx("div",{className:"w-20 h-2 bg-gray-200 rounded overflow-hidden",children:Z.jsx("div",{className:"h-full bg-blue-500 transition-all duration-200",style:{width:`${A}%`}})}),Z.jsxs("span",{className:"text-xs text-gray-500",children:[A,"%"]})]})},UWe=e=>Object.entries(e).map(([A,t])=>`${A}: ${t}`).join(", "),HWe=({stats:e})=>{if(!e||Object.keys(e).length===0)return Z.jsx("span",{children:"-"});const A=Object.entries(e),t=UWe(e);return Z.jsxs("details",{className:"cursor-pointer",children:[Z.jsx("summary",{className:"whitespace-nowrap overflow-hidden text-ellipsis max-w-[200px]",children:t}),Z.jsx("div",{className:"mt-1 text-xs",children:A.map(([i,n])=>Z.jsxs("div",{children:[i,": ",String(n)]},i))})]})},TpA=e=>{if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(TpA);const A={};for(const[t,i]of Object.entries(e))t.startsWith("_")||(A[t]=TpA(i));return A},YWe=(e,A)=>{try{if(typeof e.getConstructorParams!="function"){alert(`getConstructorParams() is not implemented for ${A}`);return}const t=TpA(e.getConstructorParams()),i=new Blob([JSON.stringify(t,null,2)],{type:"application/json"}),n=URL.createObjectURL(i),o=document.createElement("a");o.href=n,o.download=`${A}_input.json`,o.click(),URL.revokeObjectURL(n)}catch(t){alert(`Error downloading input for ${A}: ${t instanceof Error?t.message:String(t)}`)}},JWe=({solver:e,onStepUntilPhase:A,onDownloadInput:t})=>{const i=e.pipelineDef.map((r,a)=>NWe(e,a)),n=r=>{A?.(r)},o=r=>{r.solverInstance&&(t?t(r.solverInstance,r.name):YWe(r.solverInstance,r.name))},s=r=>`${(r/1e3).toFixed(2)}s`;return Z.jsxs("div",{className:"border-t border-gray-200",children:[Z.jsx("div",{className:"px-4 py-2 bg-gray-50 border-b border-gray-200",children:Z.jsx("h3",{className:"text-sm font-semibold text-gray-700",children:"Pipeline Steps"})}),Z.jsx("div",{className:"overflow-x-auto",children:Z.jsxs("table",{className:"w-full text-sm",children:[Z.jsx("thead",{children:Z.jsxs("tr",{className:"bg-gray-50 border-b border-gray-200",children:[Z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Step"}),Z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Status"}),Z.jsxs("th",{className:"px-4 py-2 text-center font-semibold text-gray-700",children:["i",Z.jsx("sub",{children:"0"})]}),Z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Iterations"}),Z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Progress"}),Z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Time"}),Z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Stats"}),Z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Input"})]})}),Z.jsx("tbody",{children:i.map(r=>Z.jsxs("tr",{className:`border-b border-gray-100 ${r.status==="In Progress"?"bg-yellow-50":""}`,children:[Z.jsx("td",{className:"px-4 py-2",children:Z.jsxs("div",{className:"flex items-center gap-2",children:[Z.jsx("span",{className:"text-gray-400 w-6",children:String(r.index+1).padStart(2,"0")}),Z.jsx("button",{onClick:()=>n(r.name),disabled:r.status==="Completed"||e.solved||e.failed,className:"text-blue-500 hover:text-blue-700 disabled:text-gray-300 disabled:cursor-not-allowed",title:`Step until ${r.name} completes`,children:Z.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:Z.jsx("path",{fillRule:"evenodd",d:"M4.5 5.653c0-1.426 1.529-2.33 2.779-1.643l11.54 6.348c1.295.712 1.295 2.573 0 3.285L7.28 19.991c-1.25.687-2.779-.217-2.779-1.643V5.653z",clipRule:"evenodd"})})}),Z.jsx("span",{className:"font-medium text-gray-900",children:r.name})]})}),Z.jsx("td",{className:"px-4 py-2",children:Z.jsx(vWe,{status:r.status})}),Z.jsx("td",{className:"px-4 py-2 text-center text-gray-600",children:r.firstIteration!==null?r.firstIteration:""}),Z.jsx("td",{className:"px-4 py-2 text-gray-600",children:r.iterations}),Z.jsx("td",{className:"px-4 py-2",children:Z.jsx(LWe,{progress:r.progress})}),Z.jsx("td",{className:"px-4 py-2 text-gray-600",children:s(r.timeSpent)}),Z.jsx("td",{className:"px-4 py-2 text-gray-500",children:Z.jsx(HWe,{stats:r.stats})}),Z.jsx("td",{className:"px-4 py-2",children:r.solverInstance?Z.jsxs("button",{onClick:()=>o(r),className:"flex items-center gap-1 text-blue-500 hover:text-blue-700",title:`Download input for ${r.name}`,children:[Z.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:Z.jsx("path",{fillRule:"evenodd",d:"M12 2.25a.75.75 0 01.75.75v11.69l3.22-3.22a.75.75 0 111.06 1.06l-4.5 4.5a.75.75 0 01-1.06 0l-4.5-4.5a.75.75 0 111.06-1.06l3.22 3.22V3a.75.75 0 01.75-.75zm-9 13.5a.75.75 0 01.75.75v2.25a1.5 1.5 0 001.5 1.5h13.5a1.5 1.5 0 001.5-1.5V16.5a.75.75 0 011.5 0v2.25a3 3 0 01-3 3H5.25a3 3 0 01-3-3V16.5a.75.75 0 01.75-.75z",clipRule:"evenodd"})}),Z.jsx("span",{children:"Input"})]}):null})]},r.name))})]})})]})},TWe=class extends en.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){console.error("InteractiveGraphics render error:",e)}render(){return this.state.hasError?this.props.fallback:this.props.children}};function KWe({graphics:e}){const A=e.points??[],t=e.lines??[],i=e.rects??[],n=e.circles??[],o=e.texts??[];let s=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,g=Number.NEGATIVE_INFINITY;const c=(Q,h)=>{typeof Q=="number"&&(Q<s&&(s=Q),Q>a&&(a=Q)),typeof h=="number"&&(h<r&&(r=h),h>g&&(g=h))};for(const Q of A)c(Q.x,Q.y);for(const Q of t){const h=Q.points??[];for(const u of h)c(u.x,u.y)}for(const Q of i){const h=Q.x??0,u=Q.y??0,d=Q.width??0,f=Q.height??0;c(h,u),c(h+d,u+f)}for(const Q of n){const h=Q.x??0,u=Q.y??0,d=Q.radius??1;c(h-d,u-d),c(h+d,u+d)}for(const Q of o)c(Q.x,Q.y);(!isFinite(s)||!isFinite(r)||!isFinite(a)||!isFinite(g))&&(s=-20,r=-20,a=20,g=20);const I=10,l=s-I,B=r-I,C=Math.max(1,a-s+2*I),E=Math.max(1,g-r+2*I);return Z.jsxs("svg",{className:"w-full h-[400px] bg-white",viewBox:`${l} ${B} ${C} ${E}`,role:"img","aria-label":"Graphics fallback",children:[i.map((Q,h)=>Z.jsx("rect",{x:Q.x??0,y:Q.y??0,width:Q.width??0,height:Q.height??0,fill:"none",stroke:Q.strokeColor??"black",strokeWidth:Q.strokeWidth??1},`rect-${h}`)),t.map((Q,h)=>Z.jsx("polyline",{fill:"none",stroke:Q.strokeColor??"black",strokeWidth:Q.strokeWidth??1,points:(Q.points??[]).map(u=>`${u.x??0},${u.y??0}`).join(" ")},`line-${h}`)),n.map((Q,h)=>Z.jsx("circle",{cx:Q.x??0,cy:Q.y??0,r:Q.radius??1.5,fill:Q.fillColor??"none",stroke:Q.strokeColor??"black",strokeWidth:Q.strokeWidth??1},`circle-${h}`)),A.map((Q,h)=>Z.jsx("circle",{cx:Q.x??0,cy:Q.y??0,r:Q.radius??1.5,fill:Q.color??"black"},`point-${h}`)),o.map((Q,h)=>Z.jsx("text",{x:Q.x??0,y:Q.y??0,fontSize:Q.fontSize??10,fill:Q.color??"black",children:Q.text??""},`text-${h}`))]})}var PWe=({solver:e,animationSpeed:A=25,onSolverStarted:t,onSolverCompleted:i})=>{const[n,o]=AA.useReducer(c=>c+1,0),s=AA.useMemo(()=>{try{return e.visualize()||{points:[],lines:[],rects:[],circles:[]}}catch(c){return console.error("Visualization error:",c),{points:[],lines:[],rects:[],circles:[]}}},[e,n]),r=AA.useMemo(()=>(s.rects?.length||0)===0&&(s.lines?.length||0)===0&&(s.points?.length||0)===0&&(s.circles?.length||0)===0,[s]);AA.useEffect(()=>{if(!(typeof document>"u")&&!document.querySelector('script[src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"]')){const c=document.createElement("script");c.src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4",document.head.appendChild(c)}},[]);const a=e.pipelineDef!==void 0,g=c=>{const I=e;if(!e.solved&&!e.failed){for(;!e.solved&&!e.failed&&I.currentPipelineStepIndex<=I.pipelineDef.findIndex(l=>l.solverName===c);)e.step();o()}};return Z.jsxs("div",{children:[Z.jsx(MWe,{solver:e,triggerRender:o,animationSpeed:A,onSolverStarted:t,onSolverCompleted:i}),r?Z.jsx("div",{className:"p-4 text-gray-500",children:"No Graphics Yet"}):Z.jsx(TWe,{fallback:Z.jsx(KWe,{graphics:s}),children:Z.jsx(kWe,{graphics:s})}),a&&Z.jsx(JWe,{solver:e,onStepUntilPhase:g})]})};const qWe=()=>{AA.useEffect(()=>{const e="tailwind-cdn-script";if(document.getElementById(e)||window.tailwind)return;const A=document.createElement("div");A.className="hidden",document.body.appendChild(A);const t=window.getComputedStyle(A).display==="none";if(document.body.removeChild(A),t)return;const i=document.createElement("script");i.id=e,i.src="https://cdn.tailwindcss.com",document.head.appendChild(i)},[])},OWe=e=>e.toLowerCase().includes("pack")?GFe:e.toLowerCase().includes("rout")?UFe:mFe,WWe=({solverEvents:e=[]})=>{const[A,t]=AA.useState(null);qWe();const i=AA.useMemo(()=>{const r=new Map;for(const a of e){const g=`${a.componentName}-${a.solverName}`;r.set(g,a)}return r},[e]),n=AA.useMemo(()=>Array.from(i.keys()),[i]),o=A?i.get(A):null,s=AA.useMemo(()=>{if(!o)return{instance:null,error:null,classFound:!1};const r=zsA[o.solverName];if(!r)return{instance:null,error:`Solver class "${o.solverName}" not found in SOLVERS registry. Available: ${Object.keys(zsA).join(", ")}`,classFound:!1};try{const a=o.solverParams,g=a?.input!==void 0?a.input:a;return{instance:new r(g),error:null,classFound:!0}}catch(a){const g=a instanceof Error?a.message:String(a);return console.error("Failed to reconstruct solver:",a),{instance:null,error:`Failed to instantiate solver: ${g}`,classFound:!0}}},[o]);return e.length===0?Z.jsx("div",{className:"rf-p-4",children:Z.jsx("div",{className:"rf-bg-gray-50 rf-rounded-md rf-border rf-border-gray-200",children:Z.jsxs("div",{className:"rf-p-4",children:[Z.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800 rf-mb-3",children:"No Solvers Detected"}),Z.jsx("p",{className:"rf-text-sm rf-text-gray-600",children:"Solvers will appear here when the circuit runs. Solvers are used for tasks like component packing and autorouting."})]})})}):Z.jsxs("div",{className:"rf-flex rf-h-full rf-overflow-hidden",children:[Z.jsxs("div",{className:"rf-w-64 rf-border-r rf-border-gray-200 rf-overflow-y-auto rf-flex-shrink-0",children:[Z.jsxs("div",{className:"rf-text-xs rf-font-semibold rf-text-gray-500 rf-px-3 rf-py-2 rf-bg-gray-50 rf-border-b rf-border-gray-200",children:[n.length," ",n.length===1?"Solver":"Solvers"]}),n.map(r=>{const a=i.get(r),g=A===r;return Z.jsx("div",{className:`rf-px-3 rf-py-2 rf-cursor-pointer rf-border-b rf-border-gray-100 ${g?"rf-bg-blue-50 rf-border-l-2 rf-border-l-blue-500":"hover:rf-bg-gray-50"}`,onClick:()=>t(r),children:(()=>{const c=OWe(a.solverName);return Z.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[Z.jsx(c,{className:"rf-w-4 rf-h-4 rf-text-blue-500 rf-flex-shrink-0"}),Z.jsxs("div",{className:"rf-flex-1 rf-min-w-0",children:[Z.jsx("div",{className:"rf-text-sm rf-font-medium rf-text-gray-800 rf-truncate",children:a.componentName}),Z.jsx("div",{className:"rf-text-xs rf-text-gray-500 rf-truncate",children:a.solverName})]})]})})()},r)})]}),Z.jsx("div",{className:"rf-flex-1 rf-overflow-hidden",children:o?s.instance?Z.jsx(uD,{fallback:Z.jsx("div",{className:"rf-p-4",children:Z.jsxs("div",{className:"rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200 rf-p-4",children:[Z.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-2",children:"Error Loading Solver Debugger"}),Z.jsxs("p",{className:"rf-text-sm rf-text-red-600",children:["Failed to render the solver debugger for"," ",o.solverName]})]})}),children:Z.jsx(PWe,{solver:s.instance})}):Z.jsxs("div",{className:"rf-p-4",children:[Z.jsxs("div",{className:"rf-mb-4",children:[Z.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800",children:o.solverName}),Z.jsxs("p",{className:"rf-text-sm rf-text-gray-500",children:["Component: ",o.componentName]})]}),s.error&&Z.jsx("div",{className:`rf-rounded-md rf-border rf-p-4 rf-mb-4 ${s.classFound?"rf-bg-red-50 rf-border-red-200":"rf-bg-yellow-50 rf-border-yellow-200"}`,children:Z.jsx("p",{className:`rf-text-sm ${s.classFound?"rf-text-red-700":"rf-text-yellow-700"}`,children:s.error})}),Z.jsxs("div",{className:"rf-border rf-border-gray-200 rf-rounded-md rf-overflow-hidden",children:[Z.jsx("div",{className:"rf-px-3 rf-py-2 rf-bg-gray-50",children:Z.jsx("span",{className:"rf-text-sm rf-font-medium rf-text-gray-700",children:"Solver Parameters"})}),Z.jsx("div",{className:"rf-p-3 rf-bg-white rf-border-t rf-border-gray-200",children:Z.jsx("pre",{className:"rf-text-xs rf-font-mono rf-text-gray-600 rf-whitespace-pre-wrap rf-overflow-x-auto",children:JSON.stringify(o.solverParams,null,2)})})]})]}):Z.jsx("div",{className:"rf-flex rf-items-center rf-justify-center rf-h-full",children:Z.jsx("p",{className:"rf-text-sm rf-text-gray-500",children:"Select a solver from the list to view details"})})})]})},Ogt=({errorMessage:e,errorStack:A,circuitJsonErrors:t})=>{AA.useEffect(()=>{if(e){const i=new Error(e);A&&(i.stack=A);try{RK.captureException(i)}catch{}}},[e,A]),AA.useEffect(()=>{if(t&&t.length>0)for(const i of t){const n=new Error(i.message||"Circuit JSON Error");i.stack&&(n.stack=i.stack);try{RK.captureException(n,{error_type:i.type})}catch{}}},[t])},Wgt="0.0.1620",ZWe={version:Wgt},KpA={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},PpA=new Map,n9=e=>{const A=PpA.get(e);return A?Object.fromEntries(Object.entries(A.stores).map(([t,i])=>[t,i.getState()])):{}},VWe=(e,A,t)=>{if(e===void 0)return{type:"untracked",connection:A.connect(t)};const i=PpA.get(t.name);if(i)return{type:"tracked",store:e,...i};const n={connection:A.connect(t),stores:{}};return PpA.set(t.name,n),{type:"tracked",store:e,...n}},Zgt=(e,A={})=>(t,i,n)=>{const{enabled:o,anonymousActionType:s,store:r,...a}=A;let g;try{g=(o??(KpA?"production":void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!g)return(KpA?"production":void 0)!=="production"&&o&&console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension"),e(t,i,n);const{connection:c,...I}=VWe(r,g,a);let l=!0;n.setState=(E,Q,h)=>{const u=t(E,Q);if(!l)return u;const d=h===void 0?{type:s||"anonymous"}:typeof h=="string"?{type:h}:h;return r===void 0?(c?.send(d,i()),u):(c?.send({...d,type:`${r}/${d.type}`},{...n9(a.name),[r]:n.getState()}),u)};const B=(...E)=>{const Q=l;l=!1,t(...E),l=Q},C=e(n.setState,i,n);if(I.type==="untracked"?c?.init(C):(I.stores[I.store]=n,c?.init(Object.fromEntries(Object.entries(I.stores).map(([E,Q])=>[E,E===I.store?C:Q.getState()])))),n.dispatchFromDevtools&&typeof n.dispatch=="function"){let E=!1;const Q=n.dispatch;n.dispatch=(...h)=>{(KpA?"production":void 0)!=="production"&&h[0].type==="__setState"&&!E&&(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),E=!0),Q(...h)}}return c.subscribe(E=>{var Q;switch(E.type){case"ACTION":if(typeof E.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return qpA(E.payload,h=>{if(h.type==="__setState"){if(r===void 0){B(h.state);return}Object.keys(h.state).length!==1&&console.error(`
5686
5686
  [zustand devtools middleware] Unsupported __setState action format.
5687
5687
  When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),
5688
5688
  and value of this only key should be a state object. Example: { "type": "__setState", "state": { "abc123Store": { "foo": "bar" } } }
@@ -5833,7 +5833,7 @@ ${a.join(`
5833
5833
  (lib (name "${e}") (type "KiCad") (uri "\${KIPRJMOD}/${e}.kicad_sym") (options "") (descr "Generated by circuit-json-to-kicad"))
5834
5834
  )
5835
5835
  `}getOutput(){return this.ctx.libraryOutput}},vii=class{ctx;pipeline;currentStageIndex=0;finished=!1;get currentStage(){return this.pipeline[this.currentStageIndex]}constructor(e,A={}){this.ctx={db:_a(e),circuitJson:e,libraryName:A.libraryName??"tscircuit",fpLibraryName:A.footprintLibraryName??"tscircuit"},this.pipeline=[new Dii(e,this.ctx),new Sii(e,this.ctx),new Fii(e,this.ctx),new Rii(e,this.ctx),new Nii(e,this.ctx)]}step(){if(!this.currentStage){this.finished=!0;return}this.currentStage.step(),this.currentStage.finished&&this.currentStageIndex++}runUntilFinished(){for(;!this.finished;)this.step()}getOutput(){if(!this.ctx.libraryOutput)throw new Error("Converter has not been run yet");return this.ctx.libraryOutput}getSymbolLibraryString(){return this.getOutput().kicadSymString}getFootprints(){return this.getOutput().footprints}getFpLibTableString(){return this.getOutput().fpLibTableString}getSymLibTableString(){return this.getOutput().symLibTableString}getModel3dSourcePaths(){return this.getOutput().model3dSourcePaths}};const Lii=async({circuitJson:e,projectName:A})=>{const t=new zEt(e);t.runUntilFinished();const i=t.getOutputString(),n=new XEt(e);n.runUntilFinished();const o=n.getOutputString(),s=new wii(e,{projectName:A,schematicFilename:`${A}.kicad_sch`,pcbFilename:`${A}.kicad_pcb`});s.runUntilFinished();const r=s.getOutputString(),a=new ffA;return a.file(`${A}.kicad_sch`,i),a.file(`${A}.kicad_pcb`,o),a.file(`${A}.kicad_pro`,r),a},Uii=async({circuitJson:e,projectName:A})=>{const i=await(await Lii({circuitJson:e,projectName:A})).generateAsync({type:"blob"});ek(i,{fileName:`${A}_kicad_project.zip`})},Hii=async({circuitJson:e,libraryName:A})=>{const t=new vii(e,{libraryName:A,footprintLibraryName:A});t.runUntilFinished();const i=t.getOutput(),n=new ffA;n.file(`${A}.kicad_sym`,i.kicadSymString);for(const o of i.footprints){const s=n.folder(`${A}.pretty`);s&&s.file(`${o.footprintName}.kicad_mod`,`${o.kicadModString}
5836
- `)}if(i.model3dSourcePaths.length>0){const o=n.folder(`${A}.3dshapes`);if(o)for(const s of i.model3dSourcePaths)try{const r=s.split("/").pop()||s,a=await fetch(s);if(a.ok){const g=await a.arrayBuffer();o.file(r,g)}}catch{}}return n.file("fp-lib-table",i.fpLibTableString),n.file("sym-lib-table",i.symLibTableString),n},Yii=async({circuitJson:e,projectName:A})=>{const i=await(await Hii({circuitJson:e,libraryName:A})).generateAsync({type:"blob"});ek(i,{fileName:`${A}_kicad_library.zip`})};class Ko{static parse(A,t){throw new Error("not implemented")}}const MG=e=>e;class LJ{constructor(A){this.id=A}resolve(A){const t=A.get(this.id);if(!t)throw new Error(`Unresolved #${this.id}`);return t}toString(){return`#${this.id}`}}const qn=e=>`'${e.replace(/'/g,"''")}'`,NE=e=>Number.isInteger(e)?`${e}.`:`${e}`;class $Et{constructor(){this.map=new Map,this.order=[],this.schema="AP214",this.units={length:"MM",angle:"RAD",solidAngle:"SR"}}set(A,t){this.map.has(A)||this.order.push(A),this.map.set(A,t)}add(A){const t=MG(this.order.length?Math.max(...this.order)+1:1);return this.set(t,A),new LJ(t)}get(A){return this.map.get(A)}entries(){return this.order.map(A=>[A,this.map.get(A)])}toPartFile(A){const t=new Date().toISOString().slice(0,10).replace(/-/g,"-"),i=["ISO-10303-21;","HEADER;",`FILE_DESCRIPTION((${qn(A.name)}),'2;1');`,`FILE_NAME(${qn(A.name)},${qn(t)},(${qn(A.author??"tscircuit")}),(${qn(A.org??"tscircuit")}),${qn("generator")},${qn("")},${qn("")});`,`FILE_SCHEMA(('${this.schema==="AP214"?"AUTOMOTIVE_DESIGN { 1 0 10303 214 1 1 1 1 }":"AP242_MANAGED_MODEL_BASED_3D_ENGINEERING"}'));`,"ENDSEC;","DATA;"],n=this.entries().map(([s,r])=>`#${s} = ${r.toStep(this)};`),o=["ENDSEC;","END-ISO-10303-21;"];return[...i,...n,...o].join(`
5836
+ `)}if(i.model3dSourcePaths.length>0){const o=n.folder(`${A}.3dshapes`);if(o)for(const s of i.model3dSourcePaths)try{const r=s.split("/").pop()||s,a=await fetch(s);if(a.ok){const g=await a.arrayBuffer();o.file(r,g)}}catch{}}return n.file("fp-lib-table",i.fpLibTableString),n.file("sym-lib-table",i.symLibTableString),n},Yii=async({circuitJson:e,projectName:A})=>{const i=await(await Hii({circuitJson:e,libraryName:A})).generateAsync({type:"blob"});ek(i,{fileName:`${A}_kicad_library.zip`})};class Ko{static parse(A,t){throw new Error("not implemented")}}const MG=e=>e;class LJ{constructor(A){this.id=A}resolve(A){const t=A.get(this.id);if(!t)throw new Error(`Unresolved #${this.id}`);return t}toString(){return`#${this.id}`}}const qn=e=>`'${e.replace(/'/g,"''")}'`,NE=e=>Number.isInteger(e)?`${e}.`:`${e}`;class $Et{constructor(){this.map=new Map,this.order=[],this.maxId=0,this.schema="AP214",this.units={length:"MM",angle:"RAD",solidAngle:"SR"}}set(A,t){this.map.has(A)||(this.order.push(A),A>this.maxId&&(this.maxId=A)),this.map.set(A,t)}add(A){this.maxId++;const t=MG(this.maxId);return this.set(t,A),new LJ(t)}get(A){return this.map.get(A)}entries(){return this.order.map(A=>[A,this.map.get(A)])}toPartFile(A){const t=new Date().toISOString().slice(0,10).replace(/-/g,"-"),i=["ISO-10303-21;","HEADER;",`FILE_DESCRIPTION((${qn(A.name)}),'2;1');`,`FILE_NAME(${qn(A.name)},${qn(t)},(${qn(A.author??"tscircuit")}),(${qn(A.org??"tscircuit")}),${qn("generator")},${qn("")},${qn("")});`,`FILE_SCHEMA(('${this.schema==="AP214"?"AUTOMOTIVE_DESIGN { 1 0 10303 214 1 1 1 1 }":"AP242_MANAGED_MODEL_BASED_3D_ENGINEERING"}'));`,"ENDSEC;","DATA;"],n=this.entries().map(([s,r])=>`#${s} = ${r.toStep(this)};`),o=["ENDSEC;","END-ISO-10303-21;"];return[...i,...n,...o].join(`
5837
5837
  `)}}const Aht=new Map;function Xo(e,A){Aht.set(e,A)}function Jii(e){return Aht.get(e)}class vE extends Ko{constructor(A,t,i,n){super(),this.name=A,this.location=t,this.axis=i,this.refDirection=n,this.type="AXIS2_PLACEMENT_3D"}static parse(A,t){const i=t.parseString(A[0]),n=t.parseRef(A[1]),o=A[2]!=="$"?t.parseRef(A[2]):void 0,s=A[3]!=="$"?t.parseRef(A[3]):void 0;return new vE(i,n,o,s)}toStep(){const A=this.axis?this.axis.toString():"$",t=this.refDirection?this.refDirection.toString():"$";return`AXIS2_PLACEMENT_3D(${qn(this.name)},${this.location},${A},${t})`}}Xo("AXIS2_PLACEMENT_3D",vE.parse.bind(vE));class Lo extends Ko{constructor(A,t,i,n){super(),this.name=A,this.x=t,this.y=i,this.z=n,this.type="CARTESIAN_POINT"}static parse(A,t){const i=t.parseString(A[0]),n=A[1].replace(/^\(|\)$/g,"").split(",").map(t.parseNumber);return new Lo(i,n[0],n[1],n[2]??0)}toStep(){return`CARTESIAN_POINT(${qn(this.name)},(${NE(this.x)},${NE(this.y)},${NE(this.z)}))`}}Xo("CARTESIAN_POINT",Lo.parse.bind(Lo));class ow extends Ko{constructor(A,t,i){super(),this.name=A,this.placement=t,this.radius=i,this.type="CIRCLE"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=t.parseRef(A[1]),o=t.parseNumber(A[2]);return new ow(i,n,o)}toStep(){return`CIRCLE(${this.name?`'${this.name}'`:"''"},${this.placement},${NE(this.radius)})`}}Xo("CIRCLE",ow.parse.bind(ow));class y1 extends Ko{constructor(A,t,i){super(),this.name=A,this.position=t,this.radius=i,this.type="CYLINDRICAL_SURFACE"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=t.parseRef(A[1]),o=t.parseNumber(A[2]);return new y1(i,n,o)}toStep(){return`CYLINDRICAL_SURFACE(${qn(this.name)},${this.position},${NE(this.radius)})`}}Xo("CYLINDRICAL_SURFACE",y1.parse.bind(y1));class bg extends Ko{constructor(A,t,i,n){super(),this.name=A,this.dx=t,this.dy=i,this.dz=n,this.type="DIRECTION"}static parse(A,t){const i=t.parseString(A[0]),n=A[1].replace(/^\(|\)$/g,"").split(",").map(t.parseNumber);return new bg(i,n[0],n[1],n[2]??0)}toStep(){return`DIRECTION(${qn(this.name)},(${NE(this.dx)},${NE(this.dy)},${NE(this.dz)}))`}}Xo("DIRECTION",bg.parse.bind(bg));class qd extends Ko{constructor(A,t,i){super(),this.name=A,this.pnt=t,this.dir=i,this.type="LINE"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=t.parseRef(A[1]),o=A[2];if(o.startsWith("VECTOR("))throw new Error("Inline VECTOR in LINE is not supported - VECTOR should be a separate entity");const s=t.parseRef(o);return new qd(i,n,s)}toStep(){return`LINE(${this.name?`'${this.name}'`:"''"},${this.pnt},${this.dir})`}}Xo("LINE",qd.parse.bind(qd));class Fb extends Ko{constructor(A,t){super(),this.name=A,this.placement=t,this.type="PLANE"}static parse(A,t){return new Fb(t.parseString(A[0]),t.parseRef(A[1]))}toStep(){return`PLANE(${qn(this.name)},${this.placement})`}}Xo("PLANE",Fb.parse.bind(Fb));class Qj extends Ko{constructor(A,t,i,n){super(),this.name=A,this.position=t,this.majorRadius=i,this.minorRadius=n,this.type="TOROIDAL_SURFACE"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=t.parseRef(A[1]),o=t.parseNumber(A[2]),s=t.parseNumber(A[3]);return new Qj(i,n,o,s)}toStep(){return`TOROIDAL_SURFACE(${qn(this.name)},${this.position},${NE(this.majorRadius)},${NE(this.minorRadius)})`}}Xo("TOROIDAL_SURFACE",Qj.parse.bind(Qj));class Od extends Ko{constructor(A,t,i){super(),this.name=A,this.orientation=t,this.magnitude=i,this.type="VECTOR"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=t.parseRef(A[1]),o=t.parseNumber(A[2]);return new Od(i,n,o)}toStep(){return`VECTOR(${qn(this.name)},${this.orientation},${NE(this.magnitude)})`}}Xo("VECTOR",Od.parse.bind(Od));class Ej extends Ko{constructor(A,t,i,n){super(),this.name=A,this.placement=t,this.semiAxis1=i,this.semiAxis2=n,this.type="ELLIPSE"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=t.parseRef(A[1]),o=t.parseNumber(A[2]),s=t.parseNumber(A[3]);return new Ej(i,n,o,s)}toStep(){return`ELLIPSE(${qn(this.name)},${this.placement},${NE(this.semiAxis1)},${NE(this.semiAxis2)})`}}Xo("ELLIPSE",Ej.parse.bind(Ej));class hj extends Ko{constructor(A,t,i,n){super(),this.name=A,this.position=t,this.radius=i,this.semiAngle=n,this.type="CONICAL_SURFACE"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=t.parseRef(A[1]),o=t.parseNumber(A[2]),s=t.parseNumber(A[3]);return new hj(i,n,o,s)}toStep(){return`CONICAL_SURFACE(${qn(this.name)},${this.position},${NE(this.radius)},${NE(this.semiAngle)})`}}Xo("CONICAL_SURFACE",hj.parse.bind(hj));class uj extends Ko{constructor(A,t,i){super(),this.name=A,this.position=t,this.radius=i,this.type="SPHERICAL_SURFACE"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=t.parseRef(A[1]),o=t.parseNumber(A[2]);return new uj(i,n,o)}toStep(){return`SPHERICAL_SURFACE(${qn(this.name)},${this.position},${NE(this.radius)})`}}Xo("SPHERICAL_SURFACE",uj.parse.bind(uj));class dj extends Ko{constructor(A,t,i,n,o,s,r,a,g){super(),this.name=A,this.degree=t,this.controlPointsList=i,this.curveForm=n,this.closedCurve=o,this.selfIntersect=s,this.knotMultiplicities=r,this.knots=a,this.knotSpec=g,this.type="B_SPLINE_CURVE_WITH_KNOTS"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=t.parseNumber(A[1]),o=A[2].replace(/^\(|\)$/g,"").split(",").filter(Boolean).map(l=>t.parseRef(l.trim())),s=A[3].trim(),r=A[4].trim()===".T.",a=A[5].trim()===".T.",g=A[6].replace(/^\(|\)$/g,"").split(",").filter(Boolean).map(l=>t.parseNumber(l.trim())),c=A[7].replace(/^\(|\)$/g,"").split(",").filter(Boolean).map(l=>t.parseNumber(l.trim())),I=A[8].trim();return new dj(i,n,o,s,r,a,g,c,I)}toStep(){const A=`(${this.controlPointsList.join(",")})`,t=`(${this.knotMultiplicities.map(NE).join(",")})`,i=`(${this.knots.map(NE).join(",")})`,n=this.closedCurve?".T.":".F.",o=this.selfIntersect?".T.":".F.";return`B_SPLINE_CURVE_WITH_KNOTS(${qn(this.name)},${this.degree},${A},${this.curveForm},${n},${o},${t},${i},${this.knotSpec})`}}Xo("B_SPLINE_CURVE_WITH_KNOTS",dj.parse.bind(dj));class UJ extends Ko{constructor(A,t,i,n){super(),this.name=A,this.r=t,this.g=i,this.b=n,this.type="COLOUR_RGB"}static parse(A,t){return new UJ(t.parseString(A[0]),t.parseNumber(A[1]),t.parseNumber(A[2]),t.parseNumber(A[3]))}toStep(){return`COLOUR_RGB(${qn(this.name)},${this.r},${this.g},${this.b})`}}Xo("COLOUR_RGB",UJ.parse.bind(UJ));class HJ extends Ko{constructor(A,t){super(),this.name=A,this.items=t,this.type="FILL_AREA_STYLE"}static parse(A,t){const i=A[1].replace(/^\(|\)$/g,"").split(",").filter(Boolean).map(n=>t.parseRef(n));return new HJ(A[0]==="$"?"":t.parseString(A[0]),i)}toStep(){return`FILL_AREA_STYLE(${qn(this.name)},(${this.items.join(",")}))`}}Xo("FILL_AREA_STYLE",HJ.parse.bind(HJ));class YJ extends Ko{constructor(A,t){super(),this.name=A,this.colour=t,this.type="FILL_AREA_STYLE_COLOUR"}static parse(A,t){return new YJ(t.parseString(A[0]),t.parseRef(A[1]))}toStep(){return`FILL_AREA_STYLE_COLOUR(${qn(this.name)},${this.colour})`}}Xo("FILL_AREA_STYLE_COLOUR",YJ.parse.bind(YJ));class JJ extends Ko{constructor(A,t,i){super(),this.name=A,this.items=t,this.contextOfItems=i,this.type="MECHANICAL_DESIGN_GEOMETRIC_PRESENTATION_REPRESENTATION"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=A[1].replace(/^\(|\)$/g,"").split(",").filter(Boolean).map(s=>t.parseRef(s)),o=t.parseRef(A[2]);return new JJ(i,n,o)}toStep(){return`MECHANICAL_DESIGN_GEOMETRIC_PRESENTATION_REPRESENTATION(${qn(this.name)},(${this.items.join(",")}),${this.contextOfItems})`}}Xo("MECHANICAL_DESIGN_GEOMETRIC_PRESENTATION_REPRESENTATION",JJ.parse.bind(JJ));class TJ extends Ko{constructor(A){super(),this.items=A,this.type="PRESENTATION_STYLE_ASSIGNMENT"}static parse(A,t){const i=A[0].replace(/^\(|\)$/g,"").split(",").filter(Boolean).map(n=>t.parseRef(n));return new TJ(i)}toStep(){return`PRESENTATION_STYLE_ASSIGNMENT((${this.items.join(",")}))`}}Xo("PRESENTATION_STYLE_ASSIGNMENT",TJ.parse.bind(TJ));class KJ extends Ko{constructor(A,t,i){super(),this.name=A,this.styles=t,this.item=i,this.type="STYLED_ITEM"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=A[1].replace(/^\(|\)$/g,"").split(",").filter(Boolean).map(s=>t.parseRef(s)),o=t.parseRef(A[2]);return new KJ(i,n,o)}toStep(){return`STYLED_ITEM(${qn(this.name)},(${this.styles.join(",")}),${this.item})`}}Xo("STYLED_ITEM",KJ.parse.bind(KJ));class PJ extends Ko{constructor(A,t){super(),this.name=A,this.styles=t,this.type="SURFACE_SIDE_STYLE"}static parse(A,t){const i=A[1].replace(/^\(|\)$/g,"").split(",").filter(Boolean).map(n=>t.parseRef(n));return new PJ(A[0]==="$"?"":t.parseString(A[0]),i)}toStep(){return`SURFACE_SIDE_STYLE(${qn(this.name)},(${this.styles.join(",")}))`}}Xo("SURFACE_SIDE_STYLE",PJ.parse.bind(PJ));class qJ extends Ko{constructor(A){super(),this.style=A,this.type="SURFACE_STYLE_FILL_AREA"}static parse(A,t){return new qJ(t.parseRef(A[0]))}toStep(){return`SURFACE_STYLE_FILL_AREA(${this.style})`}}Xo("SURFACE_STYLE_FILL_AREA",qJ.parse.bind(qJ));class OJ extends Ko{constructor(A,t){super(),this.side=A,this.style=t,this.type="SURFACE_STYLE_USAGE"}static parse(A,t){return new OJ(A[0].trim(),t.parseRef(A[1]))}toStep(){return`SURFACE_STYLE_USAGE(${this.side},${this.style})`}}Xo("SURFACE_STYLE_USAGE",OJ.parse.bind(OJ));class WJ extends Ko{constructor(A,t,i){super(),this.name=A,this.items=t,this.context=i,this.type="ADVANCED_BREP_SHAPE_REPRESENTATION"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=A[1].replace(/^\(|\)$/g,"").split(",").filter(Boolean).map(s=>t.parseRef(s)),o=t.parseRef(A[2]);return new WJ(i,n,o)}toStep(){return`ADVANCED_BREP_SHAPE_REPRESENTATION(${qn(this.name)},(${this.items.join(",")}),${this.context})`}}Xo("ADVANCED_BREP_SHAPE_REPRESENTATION",WJ.parse.bind(WJ));class ZJ extends Ko{constructor(A){super(),this.application=A,this.type="APPLICATION_CONTEXT"}static parse(A,t){const i=t.parseString(A[0]);return new ZJ(i)}toStep(){return`APPLICATION_CONTEXT(${qn(this.application)})`}}Xo("APPLICATION_CONTEXT",ZJ.parse.bind(ZJ));class VJ extends Ko{constructor(A,t,i,n){super(),this.status=A,this.applicationInterpretedModelSchemaName=t,this.applicationProtocolYear=i,this.application=n,this.type="APPLICATION_PROTOCOL_DEFINITION"}static parse(A,t){const i=t.parseString(A[0]),n=t.parseString(A[1]),o=t.parseNumber(A[2]),s=t.parseRef(A[3]);return new VJ(i,n,o,s)}toStep(){return`APPLICATION_PROTOCOL_DEFINITION(${qn(this.status)},${qn(this.applicationInterpretedModelSchemaName)},${this.applicationProtocolYear},${this.application})`}}Xo("APPLICATION_PROTOCOL_DEFINITION",VJ.parse.bind(VJ));class pj extends Ko{constructor(A,t){super(),this.representationRelation=A,this.representedProductRelation=t,this.type="CONTEXT_DEPENDENT_SHAPE_REPRESENTATION"}static parse(A,t){const i=t.parseRef(A[0]),n=t.parseRef(A[1]);return new pj(i,n)}toStep(){return`CONTEXT_DEPENDENT_SHAPE_REPRESENTATION(${this.representationRelation},${this.representedProductRelation})`}}Xo("CONTEXT_DEPENDENT_SHAPE_REPRESENTATION",pj.parse.bind(pj));class fj extends Ko{constructor(A,t,i,n){super(),this.name=A,this.description=t,this.transformItem1=i,this.transformItem2=n,this.type="ITEM_DEFINED_TRANSFORMATION"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=A[1]==="$"?"":t.parseString(A[1]),o=t.parseRef(A[2]),s=t.parseRef(A[3]);return new fj(i,n,o,s)}toStep(){return`ITEM_DEFINED_TRANSFORMATION(${qn(this.name)},${qn(this.description)},${this.transformItem1},${this.transformItem2})`}}Xo("ITEM_DEFINED_TRANSFORMATION",fj.parse.bind(fj));class yj extends Ko{constructor(A,t,i,n,o,s){super(),this.id=A,this.name=t,this.description=i,this.relatingProductDefinition=n,this.relatedProductDefinition=o,this.referenceDesignator=s,this.type="NEXT_ASSEMBLY_USAGE_OCCURRENCE"}static parse(A,t){const i=t.parseString(A[0]),n=t.parseString(A[1]),o=A[2]==="$"?"":t.parseString(A[2]),s=t.parseRef(A[3]),r=t.parseRef(A[4]),a=A[5]==="$"?"":t.parseString(A[5]);return new yj(i,n,o,s,r,a)}toStep(){return`NEXT_ASSEMBLY_USAGE_OCCURRENCE(${qn(this.id)},${qn(this.name)},${this.description?qn(this.description):"$"},${this.relatingProductDefinition},${this.relatedProductDefinition},${this.referenceDesignator?qn(this.referenceDesignator):"$"})`}}Xo("NEXT_ASSEMBLY_USAGE_OCCURRENCE",yj.parse.bind(yj));class jJ extends Ko{constructor(A,t,i,n){super(),this.name=A,this.id=t,this.description=i,this.frameOfReference=n,this.type="PRODUCT"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=A[1]==="$"?"":t.parseString(A[1]),o=A[2]==="$"?"":t.parseString(A[2]),s=A[3].replace(/^\(|\)$/g,"").split(",").filter(Boolean).map(r=>t.parseRef(r.trim()));return new jJ(i,n,o,s)}toStep(){return`PRODUCT(${qn(this.name)},${qn(this.id)},${qn(this.description)},(${this.frameOfReference.join(",")}))`}}Xo("PRODUCT",jJ.parse.bind(jJ));class zJ extends Ko{constructor(A,t,i){super(),this.name=A,this.frameOfReference=t,this.disciplineType=i,this.type="PRODUCT_CONTEXT"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=t.parseRef(A[1]),o=t.parseString(A[2]);return new zJ(i,n,o)}toStep(){return`PRODUCT_CONTEXT(${qn(this.name)},${this.frameOfReference},${qn(this.disciplineType)})`}}Xo("PRODUCT_CONTEXT",zJ.parse.bind(zJ));class XJ extends Ko{constructor(A,t,i,n){super(),this.id=A,this.description=t,this.formation=i,this.frameOfReference=n,this.type="PRODUCT_DEFINITION"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=A[1]==="$"?"":t.parseString(A[1]),o=t.parseRef(A[2]),s=t.parseRef(A[3]);return new XJ(i,n,o,s)}toStep(){return`PRODUCT_DEFINITION(${qn(this.id)},${qn(this.description)},${this.formation},${this.frameOfReference})`}}Xo("PRODUCT_DEFINITION",XJ.parse.bind(XJ));class $J extends Ko{constructor(A,t,i){super(),this.name=A,this.frameOfReference=t,this.lifecycleStage=i,this.type="PRODUCT_DEFINITION_CONTEXT"}static parse(A,t){const i=t.parseString(A[0]),n=t.parseRef(A[1]),o=t.parseString(A[2]);return new $J(i,n,o)}toStep(){return`PRODUCT_DEFINITION_CONTEXT(${qn(this.name)},${this.frameOfReference},${qn(this.lifecycleStage)})`}}Xo("PRODUCT_DEFINITION_CONTEXT",$J.parse.bind($J));class AT extends Ko{constructor(A,t,i){super(),this.id=A,this.description=t,this.ofProduct=i,this.type="PRODUCT_DEFINITION_FORMATION"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=A[1]==="$"?"":t.parseString(A[1]),o=t.parseRef(A[2]);return new AT(i,n,o)}toStep(){return`PRODUCT_DEFINITION_FORMATION(${qn(this.id)},${qn(this.description)},${this.ofProduct})`}}Xo("PRODUCT_DEFINITION_FORMATION",AT.parse.bind(AT));class tT extends Ko{constructor(A,t,i){super(),this.name=A,this.description=t,this.definition=i,this.type="PRODUCT_DEFINITION_SHAPE"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=A[1]==="$"?"":t.parseString(A[1]),o=t.parseRef(A[2]);return new tT(i,n,o)}toStep(){return`PRODUCT_DEFINITION_SHAPE(${qn(this.name)},${qn(this.description)},${this.definition})`}}Xo("PRODUCT_DEFINITION_SHAPE",tT.parse.bind(tT));class mj extends Ko{constructor(A,t,i){super(),this.name=A,this.description=t,this.products=i,this.type="PRODUCT_RELATED_PRODUCT_CATEGORY"}static parse(A,t){const i=t.parseString(A[0]),n=A[1]==="$"?"":t.parseString(A[1]),o=A[2].replace(/^\(|\)$/g,"").split(",").filter(Boolean).map(s=>t.parseRef(s));return new mj(i,n,o)}toStep(){return`PRODUCT_RELATED_PRODUCT_CATEGORY(${qn(this.name)},${this.description?qn(this.description):"$"},(${this.products.join(",")}))`}}Xo("PRODUCT_RELATED_PRODUCT_CATEGORY",mj.parse.bind(mj));class eT extends Ko{constructor(A,t){super(),this.definition=A,this.usedRepresentation=t,this.type="SHAPE_DEFINITION_REPRESENTATION"}static parse(A,t){const i=t.parseRef(A[0]),n=t.parseRef(A[1]);return new eT(i,n)}toStep(){return`SHAPE_DEFINITION_REPRESENTATION(${this.definition},${this.usedRepresentation})`}}Xo("SHAPE_DEFINITION_REPRESENTATION",eT.parse.bind(eT));class wj extends Ko{constructor(A,t,i){super(),this.name=A,this.items=t,this.contextOfItems=i,this.type="SHAPE_REPRESENTATION"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=A[1].replace(/^\(|\)$/g,"").split(",").filter(Boolean).map(s=>t.parseRef(s)),o=t.parseRef(A[2]);return new wj(i,n,o)}toStep(){return`SHAPE_REPRESENTATION(${qn(this.name)},(${this.items.join(",")}),${this.contextOfItems})`}}Xo("SHAPE_REPRESENTATION",wj.parse.bind(wj));class sw extends Ko{constructor(A,t,i,n){super(),this.name=A,this.bounds=t,this.surface=i,this.sameSense=n,this.type="ADVANCED_FACE"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=A[1].replace(/^\(|\)$/g,"").split(",").filter(Boolean).map(r=>t.parseRef(r.trim())),o=t.parseRef(A[2]),s=A[3].trim()===".T.";return new sw(i,n,o,s)}toStep(){return`ADVANCED_FACE(${this.name?`'${this.name}'`:"''"},(${this.bounds.join(",")}),${this.surface},${this.sameSense?".T.":".F."})`}}Xo("ADVANCED_FACE",sw.parse.bind(sw));class m1 extends Ko{constructor(A,t){super(),this.name=A,this.faces=t,this.type="CLOSED_SHELL"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=A[1].replace(/^\(|\)$/g,"").split(",").filter(Boolean).map(o=>t.parseRef(o.trim()));return new m1(i,n)}toStep(){return`CLOSED_SHELL(${this.name?`'${this.name}'`:"''"},(${this.faces.join(",")}))`}}Xo("CLOSED_SHELL",m1.parse.bind(m1));class IB extends Ko{constructor(A,t,i,n,o){super(),this.name=A,this.start=t,this.end=i,this.curve=n,this.sameSense=o,this.type="EDGE_CURVE"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=t.parseRef(A[1]),o=t.parseRef(A[2]),s=t.parseRef(A[3]),r=A[4].trim()===".T.";return new IB(i,n,o,s,r)}toStep(){return`EDGE_CURVE(${this.name?`'${this.name}'`:"''"},${this.start},${this.end},${this.curve},${this.sameSense?".T.":".F."})`}}Xo("EDGE_CURVE",IB.parse.bind(IB));class mf extends Ko{constructor(A,t){super(),this.name=A,this.edges=t,this.type="EDGE_LOOP"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=A[1].replace(/^\(|\)$/g,"").split(",").filter(Boolean).map(o=>t.parseRef(o));return new mf(i,n)}toStep(){return`EDGE_LOOP(${qn(this.name)},(${this.edges.join(",")}))`}}Xo("EDGE_LOOP",mf.parse.bind(mf));class nk extends Ko{constructor(A,t,i){super(),this.name=A,this.bound=t,this.sameSense=i,this.type="FACE_BOUND"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]);return new nk(i,t.parseRef(A[1]),A[2].trim()===".T.")}toStep(){return`FACE_BOUND(${qn(this.name)},${this.bound},${this.sameSense?".T.":".F."})`}}Xo("FACE_BOUND",nk.parse.bind(nk));class rw extends Ko{constructor(A,t,i){super(),this.name=A,this.bound=t,this.sameSense=i,this.type="FACE_OUTER_BOUND"}static parse(A,t){return new rw(t.parseString(A[0]),t.parseRef(A[1]),A[2].trim()===".T.")}toStep(){return`FACE_OUTER_BOUND('${this.name}',${this.bound},${this.sameSense?".T.":".F."})`}}Xo("FACE_OUTER_BOUND",rw.parse.bind(rw));class RG extends Ko{constructor(A,t){super(),this.name=A,this.outer=t,this.type="MANIFOLD_SOLID_BREP"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]);return new RG(i,t.parseRef(A[1]))}toStep(){return`MANIFOLD_SOLID_BREP(${qn(this.name)},${this.outer})`}}Xo("MANIFOLD_SOLID_BREP",RG.parse.bind(RG));class zc extends Ko{constructor(A,t,i){super(),this.name=A,this.edge=t,this.orientation=i,this.type="ORIENTED_EDGE"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=t.parseRef(A[3]),o=A[4]?.trim?.()===".T."||A[2]?.trim?.()===".T.";return new zc(i,n,o)}toStep(){return`ORIENTED_EDGE(${qn(this.name)},*,*,${this.edge},${this.orientation?".T.":".F."})`}}Xo("ORIENTED_EDGE",zc.parse.bind(zc));class Mr extends Ko{constructor(A,t){super(),this.name=A,this.pnt=t,this.type="VERTEX_POINT"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]);return new Mr(i,t.parseRef(A[1]))}toStep(){return`VERTEX_POINT(${this.name?`'${this.name}'`:"''"},${this.pnt})`}}Xo("VERTEX_POINT",Mr.parse.bind(Mr));class ok extends Ko{constructor(A,t){super(),this.type=A,this.args=t}toStep(){return this.args.length===1&&this.args[0].startsWith("( ")?`(
5838
5838
  ${this.args[0].slice(2,-2).trim().split(/\s+(?=[A-Z_])/g).join(`
5839
5839
  `)}
@@ -5686,7 +5686,7 @@ test("${g} should solve problem correctly", () => {
5686
5686
  // Add more specific assertions based on expected output
5687
5687
  // expect(solver.netLabelPlacementSolver!.netLabelPlacements).toMatchInlineSnapshot()
5688
5688
  })
5689
- `,I=new Blob([c],{type:"text/plain"}),l=URL.createObjectURL(I),B=document.createElement("a");B.href=l,B.download=`${g}.test.ts`,B.click(),URL.revokeObjectURL(l)}catch(a){alert(`Error generating test.ts for ${e.constructor.name}: ${a instanceof Error?a.message:String(a)}`)}i(!1)};return W.jsxs("div",{className:`relative ${A}`,ref:n,children:[W.jsx("button",{className:"px-2 py-1 rounded text-xs cursor-pointer",onClick:()=>i(!t),title:`Download options for ${e.constructor.name}`,children:e.constructor.name}),t&&W.jsxs("div",{className:"absolute top-full left-0 mt-1 bg-white border border-gray-300 rounded shadow-lg z-10 min-w-[150px]",children:[W.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:o,children:"Download JSON"}),W.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:s,children:"Download page.tsx"}),W.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:r,children:"Download test.ts"})]})]})},lIt=e=>e.activeSubSolver?[e,...lIt(e.activeSubSolver)]:[e],_9e=({solver:e})=>{const A=lIt(e);return W.jsx("div",{className:"flex gap-1 items-center text-sm pt-1",children:A.map((t,i)=>W.jsxs("div",{className:"flex items-center",children:[i>0&&W.jsx("span",{className:"text-gray-400 mx-1",children:"→"}),W.jsx(x9e,{solver:t})]},t.constructor.name))})},k9e=({solver:e,triggerRender:A,animationSpeed:t=25,onSolverStarted:i,onSolverCompleted:n})=>{const[o,s]=V.useReducer(Q=>!Q,!1),r=V.useRef(void 0),a=()=>{!e.solved&&!e.failed&&(e.step(),A())},g=()=>{!e.solved&&!e.failed&&(i&&i(e),e.solve(),A(),n&&n(e))},c=()=>{o?(r.current&&(clearInterval(r.current),r.current=void 0),s()):(s(),r.current=setInterval(()=>{if(e.solved||e.failed){r.current&&(clearInterval(r.current),r.current=void 0),s(),A(),n&&e.solved&&n(e);return}e.step(),A()},t))},I=()=>{const Q=e;if(Q.getCurrentPhase&&!e.solved&&!e.failed){const h=Q.getCurrentPhase();for(;Q.getCurrentPhase()===h&&!e.solved&&!e.failed;)e.step();A()}},l=()=>{if(e.solved||e.failed||o)return;const Q=window.prompt("Step until which iteration?",`${e.iterations}`);if(Q===null)return;const h=Number(Q);if(!Number.isFinite(h)){window.alert("Please enter a valid number for the iteration");return}for(;e.iterations<h&&!e.solved&&!e.failed;)e.step();A(),e.solved&&n&&n(e)};V.useEffect(()=>()=>{r.current&&clearInterval(r.current)},[]),V.useEffect(()=>{(e.solved||e.failed)&&o&&(r.current&&(clearInterval(r.current),r.current=void 0),s())},[e.solved,e.failed,o]);const B=e.getCurrentPhase!==void 0,C=B?e.getCurrentPhase():null;return W.jsxs("div",{className:"space-y-2 p-2 border-b",children:[W.jsx("div",{className:"flex items-center",children:W.jsx(_9e,{solver:e})}),W.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[W.jsx("button",{onClick:a,disabled:e.solved||e.failed||o,className:"bg-blue-500 hover:bg-blue-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step"}),W.jsx("button",{onClick:g,disabled:e.solved||e.failed||o,className:"bg-green-500 hover:bg-green-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Solve"}),W.jsx("button",{onClick:c,disabled:e.solved||e.failed,className:`px-3 py-1 rounded text-white text-sm ${o?"bg-red-500 hover:bg-red-600":"bg-yellow-500 hover:bg-yellow-600"} disabled:bg-gray-300`,children:o?"Stop":"Animate"}),W.jsx("button",{onClick:l,disabled:e.solved||e.failed||o,className:"bg-orange-500 hover:bg-orange-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step Until Iteration"}),B&&W.jsx("button",{onClick:I,disabled:e.solved||e.failed||o,className:"bg-purple-500 hover:bg-purple-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Next Stage"}),W.jsxs("div",{className:"text-sm text-gray-600",children:["Iterations: ",e.iterations]}),e.timeToSolve!==void 0&&W.jsxs("div",{className:"text-sm text-gray-600",children:["Time: ",(e.timeToSolve/1e3).toFixed(3),"s"]}),C&&W.jsxs("div",{className:"text-sm text-gray-600",children:["Phase: ",W.jsx("span",{className:"font-medium",children:C})]}),e.solved&&W.jsx("div",{className:"px-2 py-1 bg-green-100 text-green-800 rounded text-sm",children:"Solved"}),e.failed&&W.jsx("div",{className:"px-2 py-1 bg-red-100 text-red-800 rounded text-sm",children:"Failed"})]}),e.error&&W.jsxs("div",{className:"text-red-600 text-sm",children:["Error: ",e.error]})]})},F9e=(e,A,t)=>{const i=e.currentPipelineStepIndex;return A<i?"Completed":A===i&&e.activeSubSolver?e.activeSubSolver.failed?"Failed":"In Progress":"Not Started"},G9e=(e,A)=>{const i=e.pipelineDef[A].solverName,n=F9e(e,A),o=e[i],s=e.firstIterationOfPhase?.[i]??null,r=e.iterations;let a=0;if(n==="Completed"){const l=e.pipelineDef[A+1],B=l?e.firstIterationOfPhase?.[l.solverName]:void 0;B!==void 0&&s!==null?a=B-s:s!==null&&(a=r-s)}else n==="In Progress"&&s!==null&&(a=r-s);const g=e.timeSpentOnPhase?.[i]??0;let c=0;n==="Completed"?c=1:n==="In Progress"&&o&&(c=o.progress??0);const I=o?.stats??null;return{index:A,name:i,status:n,firstIteration:s,iterations:a,progress:c,timeSpent:g,stats:I&&Object.keys(I).length>0?I:null,solverInstance:o??null}},R9e=({status:e})=>{const A={"Not Started":"text-blue-600","In Progress":"text-yellow-600",Completed:"text-green-600",Failed:"text-red-600"};return W.jsx("span",{className:`font-medium ${A[e]}`,children:e})},M9e=({progress:e})=>{if(e===0)return null;const A=Math.round(e*100);return W.jsxs("div",{className:"flex items-center gap-2",children:[W.jsx("div",{className:"w-20 h-2 bg-gray-200 rounded overflow-hidden",children:W.jsx("div",{className:"h-full bg-blue-500 transition-all duration-200",style:{width:`${A}%`}})}),W.jsxs("span",{className:"text-xs text-gray-500",children:[A,"%"]})]})},N9e=e=>Object.entries(e).map(([A,t])=>`${A}: ${t}`).join(", "),v9e=({stats:e})=>{if(!e||Object.keys(e).length===0)return W.jsx("span",{children:"-"});const A=Object.entries(e),t=N9e(e);return W.jsxs("details",{className:"cursor-pointer",children:[W.jsx("summary",{className:"whitespace-nowrap overflow-hidden text-ellipsis max-w-[200px]",children:t}),W.jsx("div",{className:"mt-1 text-xs",children:A.map(([i,n])=>W.jsxs("div",{children:[i,": ",String(n)]},i))})]})},WfA=e=>{if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(WfA);const A={};for(const[t,i]of Object.entries(e))t.startsWith("_")||(A[t]=WfA(i));return A},L9e=(e,A)=>{try{if(typeof e.getConstructorParams!="function"){alert(`getConstructorParams() is not implemented for ${A}`);return}const t=WfA(e.getConstructorParams()),i=new Blob([JSON.stringify(t,null,2)],{type:"application/json"}),n=URL.createObjectURL(i),o=document.createElement("a");o.href=n,o.download=`${A}_input.json`,o.click(),URL.revokeObjectURL(n)}catch(t){alert(`Error downloading input for ${A}: ${t instanceof Error?t.message:String(t)}`)}},U9e=({solver:e,onStepUntilPhase:A,onDownloadInput:t})=>{const i=e.pipelineDef.map((r,a)=>G9e(e,a)),n=r=>{A?.(r)},o=r=>{r.solverInstance&&(t?t(r.solverInstance,r.name):L9e(r.solverInstance,r.name))},s=r=>`${(r/1e3).toFixed(2)}s`;return W.jsxs("div",{className:"border-t border-gray-200",children:[W.jsx("div",{className:"px-4 py-2 bg-gray-50 border-b border-gray-200",children:W.jsx("h3",{className:"text-sm font-semibold text-gray-700",children:"Pipeline Steps"})}),W.jsx("div",{className:"overflow-x-auto",children:W.jsxs("table",{className:"w-full text-sm",children:[W.jsx("thead",{children:W.jsxs("tr",{className:"bg-gray-50 border-b border-gray-200",children:[W.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Step"}),W.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Status"}),W.jsxs("th",{className:"px-4 py-2 text-center font-semibold text-gray-700",children:["i",W.jsx("sub",{children:"0"})]}),W.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Iterations"}),W.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Progress"}),W.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Time"}),W.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Stats"}),W.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Input"})]})}),W.jsx("tbody",{children:i.map(r=>W.jsxs("tr",{className:`border-b border-gray-100 ${r.status==="In Progress"?"bg-yellow-50":""}`,children:[W.jsx("td",{className:"px-4 py-2",children:W.jsxs("div",{className:"flex items-center gap-2",children:[W.jsx("span",{className:"text-gray-400 w-6",children:String(r.index+1).padStart(2,"0")}),W.jsx("button",{onClick:()=>n(r.name),disabled:r.status==="Completed"||e.solved||e.failed,className:"text-blue-500 hover:text-blue-700 disabled:text-gray-300 disabled:cursor-not-allowed",title:`Step until ${r.name} completes`,children:W.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:W.jsx("path",{fillRule:"evenodd",d:"M4.5 5.653c0-1.426 1.529-2.33 2.779-1.643l11.54 6.348c1.295.712 1.295 2.573 0 3.285L7.28 19.991c-1.25.687-2.779-.217-2.779-1.643V5.653z",clipRule:"evenodd"})})}),W.jsx("span",{className:"font-medium text-gray-900",children:r.name})]})}),W.jsx("td",{className:"px-4 py-2",children:W.jsx(R9e,{status:r.status})}),W.jsx("td",{className:"px-4 py-2 text-center text-gray-600",children:r.firstIteration!==null?r.firstIteration:""}),W.jsx("td",{className:"px-4 py-2 text-gray-600",children:r.iterations}),W.jsx("td",{className:"px-4 py-2",children:W.jsx(M9e,{progress:r.progress})}),W.jsx("td",{className:"px-4 py-2 text-gray-600",children:s(r.timeSpent)}),W.jsx("td",{className:"px-4 py-2 text-gray-500",children:W.jsx(v9e,{stats:r.stats})}),W.jsx("td",{className:"px-4 py-2",children:r.solverInstance?W.jsxs("button",{onClick:()=>o(r),className:"flex items-center gap-1 text-blue-500 hover:text-blue-700",title:`Download input for ${r.name}`,children:[W.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:W.jsx("path",{fillRule:"evenodd",d:"M12 2.25a.75.75 0 01.75.75v11.69l3.22-3.22a.75.75 0 111.06 1.06l-4.5 4.5a.75.75 0 01-1.06 0l-4.5-4.5a.75.75 0 111.06-1.06l3.22 3.22V3a.75.75 0 01.75-.75zm-9 13.5a.75.75 0 01.75.75v2.25a1.5 1.5 0 001.5 1.5h13.5a1.5 1.5 0 001.5-1.5V16.5a.75.75 0 011.5 0v2.25a3 3 0 01-3 3H5.25a3 3 0 01-3-3V16.5a.75.75 0 01.75-.75z",clipRule:"evenodd"})}),W.jsx("span",{children:"Input"})]}):null})]},r.name))})]})})]})},H9e=class extends en.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){console.error("InteractiveGraphics render error:",e)}render(){return this.state.hasError?this.props.fallback:this.props.children}};function Y9e({graphics:e}){const A=e.points??[],t=e.lines??[],i=e.rects??[],n=e.circles??[],o=e.texts??[];let s=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,g=Number.NEGATIVE_INFINITY;const c=(h,E)=>{typeof h=="number"&&(h<s&&(s=h),h>a&&(a=h)),typeof E=="number"&&(E<r&&(r=E),E>g&&(g=E))};for(const h of A)c(h.x,h.y);for(const h of t){const E=h.points??[];for(const u of E)c(u.x,u.y)}for(const h of i){const E=h.x??0,u=h.y??0,d=h.width??0,p=h.height??0;c(E,u),c(E+d,u+p)}for(const h of n){const E=h.x??0,u=h.y??0,d=h.radius??1;c(E-d,u-d),c(E+d,u+d)}for(const h of o)c(h.x,h.y);(!isFinite(s)||!isFinite(r)||!isFinite(a)||!isFinite(g))&&(s=-20,r=-20,a=20,g=20);const I=10,l=s-I,B=r-I,C=Math.max(1,a-s+2*I),Q=Math.max(1,g-r+2*I);return W.jsxs("svg",{className:"w-full h-[400px] bg-white",viewBox:`${l} ${B} ${C} ${Q}`,role:"img","aria-label":"Graphics fallback",children:[i.map((h,E)=>W.jsx("rect",{x:h.x??0,y:h.y??0,width:h.width??0,height:h.height??0,fill:"none",stroke:h.strokeColor??"black",strokeWidth:h.strokeWidth??1},`rect-${E}`)),t.map((h,E)=>W.jsx("polyline",{fill:"none",stroke:h.strokeColor??"black",strokeWidth:h.strokeWidth??1,points:(h.points??[]).map(u=>`${u.x??0},${u.y??0}`).join(" ")},`line-${E}`)),n.map((h,E)=>W.jsx("circle",{cx:h.x??0,cy:h.y??0,r:h.radius??1.5,fill:h.fillColor??"none",stroke:h.strokeColor??"black",strokeWidth:h.strokeWidth??1},`circle-${E}`)),A.map((h,E)=>W.jsx("circle",{cx:h.x??0,cy:h.y??0,r:h.radius??1.5,fill:h.color??"black"},`point-${E}`)),o.map((h,E)=>W.jsx("text",{x:h.x??0,y:h.y??0,fontSize:h.fontSize??10,fill:h.color??"black",children:h.text??""},`text-${E}`))]})}var J9e=({solver:e,animationSpeed:A=25,onSolverStarted:t,onSolverCompleted:i})=>{const[n,o]=V.useReducer(c=>c+1,0),s=V.useMemo(()=>{try{return e.visualize()||{points:[],lines:[],rects:[],circles:[]}}catch(c){return console.error("Visualization error:",c),{points:[],lines:[],rects:[],circles:[]}}},[e,n]),r=V.useMemo(()=>(s.rects?.length||0)===0&&(s.lines?.length||0)===0&&(s.points?.length||0)===0&&(s.circles?.length||0)===0,[s]);V.useEffect(()=>{if(!(typeof document>"u")&&!document.querySelector('script[src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"]')){const c=document.createElement("script");c.src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4",document.head.appendChild(c)}},[]);const a=e.pipelineDef!==void 0,g=c=>{const I=e;if(!e.solved&&!e.failed){for(;!e.solved&&!e.failed&&I.currentPipelineStepIndex<=I.pipelineDef.findIndex(l=>l.solverName===c);)e.step();o()}};return W.jsxs("div",{children:[W.jsx(k9e,{solver:e,triggerRender:o,animationSpeed:A,onSolverStarted:t,onSolverCompleted:i}),r?W.jsx("div",{className:"p-4 text-gray-500",children:"No Graphics Yet"}):W.jsx(H9e,{fallback:W.jsx(Y9e,{graphics:s}),children:W.jsx(b9e,{graphics:s})}),a&&W.jsx(U9e,{solver:e,onStepUntilPhase:g})]})};const T9e=()=>{V.useEffect(()=>{const e="tailwind-cdn-script";if(document.getElementById(e)||window.tailwind)return;const A=document.createElement("div");A.className="hidden",document.body.appendChild(A);const t=window.getComputedStyle(A).display==="none";if(document.body.removeChild(A),t)return;const i=document.createElement("script");i.id=e,i.src="https://cdn.tailwindcss.com",document.head.appendChild(i)},[])},K9e=e=>e.toLowerCase().includes("pack")?TMe:e.toLowerCase().includes("rout")?WMe:bMe,P9e=({solverEvents:e=[]})=>{const[A,t]=V.useState(null);T9e();const i=V.useMemo(()=>{const r=new Map;for(const a of e){const g=`${a.componentName}-${a.solverName}`;r.set(g,a)}return r},[e]),n=V.useMemo(()=>Array.from(i.keys()),[i]),o=A?i.get(A):null,s=V.useMemo(()=>{if(!o)return{instance:null,error:null,classFound:!1};const r=ZnA[o.solverName];if(!r)return{instance:null,error:`Solver class "${o.solverName}" not found in SOLVERS registry. Available: ${Object.keys(ZnA).join(", ")}`,classFound:!1};try{const a=o.solverParams,g=a?.input!==void 0?a.input:a;return{instance:new r(g),error:null,classFound:!0}}catch(a){const g=a instanceof Error?a.message:String(a);return console.error("Failed to reconstruct solver:",a),{instance:null,error:`Failed to instantiate solver: ${g}`,classFound:!0}}},[o]);return e.length===0?W.jsx("div",{className:"rf-p-4",children:W.jsx("div",{className:"rf-bg-gray-50 rf-rounded-md rf-border rf-border-gray-200",children:W.jsxs("div",{className:"rf-p-4",children:[W.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800 rf-mb-3",children:"No Solvers Detected"}),W.jsx("p",{className:"rf-text-sm rf-text-gray-600",children:"Solvers will appear here when the circuit runs. Solvers are used for tasks like component packing and autorouting."})]})})}):W.jsxs("div",{className:"rf-flex rf-h-full rf-overflow-hidden",children:[W.jsxs("div",{className:"rf-w-64 rf-border-r rf-border-gray-200 rf-overflow-y-auto rf-flex-shrink-0",children:[W.jsxs("div",{className:"rf-text-xs rf-font-semibold rf-text-gray-500 rf-px-3 rf-py-2 rf-bg-gray-50 rf-border-b rf-border-gray-200",children:[n.length," ",n.length===1?"Solver":"Solvers"]}),n.map(r=>{const a=i.get(r),g=A===r;return W.jsx("div",{className:`rf-px-3 rf-py-2 rf-cursor-pointer rf-border-b rf-border-gray-100 ${g?"rf-bg-blue-50 rf-border-l-2 rf-border-l-blue-500":"hover:rf-bg-gray-50"}`,onClick:()=>t(r),children:(()=>{const c=K9e(a.solverName);return W.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[W.jsx(c,{className:"rf-w-4 rf-h-4 rf-text-blue-500 rf-flex-shrink-0"}),W.jsxs("div",{className:"rf-flex-1 rf-min-w-0",children:[W.jsx("div",{className:"rf-text-sm rf-font-medium rf-text-gray-800 rf-truncate",children:a.componentName}),W.jsx("div",{className:"rf-text-xs rf-text-gray-500 rf-truncate",children:a.solverName})]})]})})()},r)})]}),W.jsx("div",{className:"rf-flex-1 rf-overflow-hidden",children:o?s.instance?W.jsx(Ky,{fallback:W.jsx("div",{className:"rf-p-4",children:W.jsxs("div",{className:"rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200 rf-p-4",children:[W.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-2",children:"Error Loading Solver Debugger"}),W.jsxs("p",{className:"rf-text-sm rf-text-red-600",children:["Failed to render the solver debugger for"," ",o.solverName]})]})}),children:W.jsx(J9e,{solver:s.instance})}):W.jsxs("div",{className:"rf-p-4",children:[W.jsxs("div",{className:"rf-mb-4",children:[W.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800",children:o.solverName}),W.jsxs("p",{className:"rf-text-sm rf-text-gray-500",children:["Component: ",o.componentName]})]}),s.error&&W.jsx("div",{className:`rf-rounded-md rf-border rf-p-4 rf-mb-4 ${s.classFound?"rf-bg-red-50 rf-border-red-200":"rf-bg-yellow-50 rf-border-yellow-200"}`,children:W.jsx("p",{className:`rf-text-sm ${s.classFound?"rf-text-red-700":"rf-text-yellow-700"}`,children:s.error})}),W.jsxs("div",{className:"rf-border rf-border-gray-200 rf-rounded-md rf-overflow-hidden",children:[W.jsx("div",{className:"rf-px-3 rf-py-2 rf-bg-gray-50",children:W.jsx("span",{className:"rf-text-sm rf-font-medium rf-text-gray-700",children:"Solver Parameters"})}),W.jsx("div",{className:"rf-p-3 rf-bg-white rf-border-t rf-border-gray-200",children:W.jsx("pre",{className:"rf-text-xs rf-font-mono rf-text-gray-600 rf-whitespace-pre-wrap rf-overflow-x-auto",children:JSON.stringify(o.solverParams,null,2)})})]})]}):W.jsx("div",{className:"rf-flex rf-items-center rf-justify-center rf-h-full",children:W.jsx("p",{className:"rf-text-sm rf-text-gray-500",children:"Select a solver from the list to view details"})})})]})},BIt=({errorMessage:e,errorStack:A,circuitJsonErrors:t})=>{V.useEffect(()=>{if(e){const i=new Error(e);A&&(i.stack=A);try{L5.captureException(i)}catch{}}},[e,A]),V.useEffect(()=>{if(t&&t.length>0)for(const i of t){const n=new Error(i.message||"Circuit JSON Error");i.stack&&(n.stack=i.stack);try{L5.captureException(n,{error_type:i.type})}catch{}}},[t])},CIt="0.0.1619",q9e={version:CIt},q9=DYA()(SYA(e=>({lastRunEvalVersion:void 0,setLastRunEvalVersion:A=>{e({lastRunEvalVersion:A})}}),{name:"runframe-runner-store"})),O9e=e=>{const[A,t]=V.useState([]),[i,n]=V.useState(null),[o,s]=V.useState(""),[r,a]=a1("eval-version-selection",null),g=q9(B=>B.setLastRunEvalVersion),c=q9(B=>B.lastRunEvalVersion);return V.useEffect(()=>{e&&fetch("https://data.jsdelivr.com/v1/package/npm/@tscircuit/eval").then(B=>B.json()).then(B=>{if(Array.isArray(B?.versions)){let C=[...B.versions];B.tags?.latest&&(n(B.tags.latest),C=C.filter(Q=>Q!==B.tags.latest)),t(C)}}).catch(()=>{})},[e]),V.useEffect(()=>{e&&(r?(window.TSCIRCUIT_LATEST_EVAL_VERSION=r,g(r)):i&&(window.TSCIRCUIT_LATEST_EVAL_VERSION=i,g(i)))},[e,r,i]),{versions:V.useMemo(()=>A.filter(B=>B.includes(o)).slice(0,50),[A,o]),latestVersion:i,lastRunEvalVersion:c,search:o,setSearch:s,selectVersion:B=>{a(B),s("")}}},W9e=({snippetNames:e,onSelect:A,onCancel:t,isOpen:i})=>{const[n,o]=V.useState(""),[s,r]=V.useState("");if(!i)return null;const a=e.filter(I=>I.toLowerCase().includes(s.toLowerCase())),g=s&&!e.includes(s),c=I=>{I.key==="Enter"&&(a.length===1?o(a[0]):g&&o(s))};return W.jsx("div",{className:"rf-fixed rf-inset-0 rf-bg-black rf-bg-opacity-50 rf-flex rf-items-center rf-justify-center rf-z-[100]",children:W.jsxs("div",{className:"rf-bg-white rf-rounded-lg rf-p-6 rf-w-96",children:[W.jsx("h2",{className:"rf-text-lg rf-font-semibold rf-mb-4",children:"Select Snippet"}),W.jsx("input",{type:"text",className:"rf-w-full rf-px-4 rf-py-2 rf-border rf-rounded rf-mb-4",placeholder:"Search snippets or new snippet name...",value:s,onChange:I=>r(I.target.value),onKeyDown:c}),W.jsxs("div",{className:"rf-h-60 rf-overflow-y-auto",children:[a.map(I=>W.jsx("button",{type:"button",className:`w-full text-left px-4 py-2 rounded hover:bg-gray-100 ${n===I?"bg-blue-50":""}`,onClick:()=>o(I),children:I},I)),g&&W.jsxs("button",{type:"button",className:`w-full text-left px-4 py-2 rounded hover:bg-gray-100 text-blue-500 ${n===s?"bg-blue-50":""}`,onClick:()=>o(s),children:['Create new "',s,'"']})]}),W.jsxs("div",{className:"rf-mt-4 rf-flex rf-justify-end rf-gap-2",children:[W.jsx("button",{type:"button",className:"rf-px-4 rf-py-2 rf-text-gray-600 rf-hover:text-gray-800",onClick:t,children:"Cancel"}),W.jsx("button",{type:"button",className:"rf-px-4 rf-py-2 rf-bg-blue-500 rf-text-white rf-rounded rf-hover:bg-blue-600 rf-disabled:opacity-50",onClick:()=>n&&A(n),disabled:!n,children:n===s?`Create "${n}"`:`Save to ${n}`})]})]})})},Z9e=e=>{const A=V.useRef(null),t=ZI(i=>i.recentEvents);V.useEffect(()=>{if(t.length===0)return;const i=t[0];i.event_id!==A.current&&(e(i),A.current=i.event_id)},[t,e])};function V9e(e){const A=j9e(e),t=V.forwardRef((i,n)=>{const{children:o,...s}=i,r=V.Children.toArray(o),a=r.find(X9e);if(a){const g=a.props.children,c=r.map(I=>I===a?V.Children.count(g)>1?V.Children.only(null):V.isValidElement(g)?g.props.children:null:I);return W.jsx(A,{...s,ref:n,children:V.isValidElement(g)?V.cloneElement(g,void 0,c):null})}return W.jsx(A,{...s,ref:n,children:o})});return t.displayName=`${e}.Slot`,t}function j9e(e){const A=V.forwardRef((t,i)=>{const{children:n,...o}=t;if(V.isValidElement(n)){const s=Aje(n),r=$9e(o,n.props);return n.type!==V.Fragment&&(r.ref=i?gf(i,s):s),V.cloneElement(n,r)}return V.Children.count(n)>1?V.Children.only(null):null});return A.displayName=`${e}.SlotClone`,A}var z9e=Symbol("radix.slottable");function X9e(e){return V.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===z9e}function $9e(e,A){const t={...A};for(const i in A){const n=e[i],o=A[i];/^on[A-Z]/.test(i)?n&&o?t[i]=(...r)=>{const a=o(...r);return n(...r),a}:n&&(t[i]=n):i==="style"?t[i]={...n,...o}:i==="className"&&(t[i]=[n,o].filter(Boolean).join(" "))}return{...e,...t}}function Aje(e){let A=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,t=A&&"isReactWarning"in A&&A.isReactWarning;return t?e.ref:(A=Object.getOwnPropertyDescriptor(e,"ref")?.get,t=A&&"isReactWarning"in A&&A.isReactWarning,t?e.props.ref:e.props.ref||e.ref)}var O9="Dialog",[QIt,hIt]=Pm(O9),[tje,Ew]=QIt(O9),EIt=e=>{const{__scopeDialog:A,children:t,open:i,defaultOpen:n,onOpenChange:o,modal:s=!0}=e,r=V.useRef(null),a=V.useRef(null),[g,c]=qx({prop:i,defaultProp:n??!1,onChange:o,caller:O9});return W.jsx(tje,{scope:A,triggerRef:r,contentRef:a,contentId:xE(),titleId:xE(),descriptionId:xE(),open:g,onOpenChange:c,onOpenToggle:V.useCallback(()=>c(I=>!I),[c]),modal:s,children:t})};EIt.displayName=O9;var uIt="DialogTrigger",dIt=V.forwardRef((e,A)=>{const{__scopeDialog:t,...i}=e,n=Ew(uIt,t),o=pI(A,n.triggerRef);return W.jsx(Wa.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":jfA(n.open),...i,ref:o,onClick:Hn(e.onClick,n.onOpenToggle)})});dIt.displayName=uIt;var ZfA="DialogPortal",[eje,pIt]=QIt(ZfA,{forceMount:void 0}),fIt=e=>{const{__scopeDialog:A,forceMount:t,children:i,container:n}=e,o=Ew(ZfA,A);return W.jsx(eje,{scope:A,forceMount:t,children:V.Children.map(i,s=>W.jsx(f0,{present:t||o.open,children:W.jsx(JZ,{asChild:!0,container:n,children:s})}))})};fIt.displayName=ZfA;var W9="DialogOverlay",yIt=V.forwardRef((e,A)=>{const t=pIt(W9,e.__scopeDialog),{forceMount:i=t.forceMount,...n}=e,o=Ew(W9,e.__scopeDialog);return o.modal?W.jsx(f0,{present:i||o.open,children:W.jsx(nje,{...n,ref:A})}):null});yIt.displayName=W9;var ije=V9e("DialogOverlay.RemoveScroll"),nje=V.forwardRef((e,A)=>{const{__scopeDialog:t,...i}=e,n=Ew(W9,t);return W.jsx(VZ,{as:ije,allowPinchZoom:!0,shards:[n.contentRef],children:W.jsx(Wa.div,{"data-state":jfA(n.open),...i,ref:A,style:{pointerEvents:"auto",...i.style}})})}),HG="DialogContent",mIt=V.forwardRef((e,A)=>{const t=pIt(HG,e.__scopeDialog),{forceMount:i=t.forceMount,...n}=e,o=Ew(HG,e.__scopeDialog);return W.jsx(f0,{present:i||o.open,children:o.modal?W.jsx(oje,{...n,ref:A}):W.jsx(sje,{...n,ref:A})})});mIt.displayName=HG;var oje=V.forwardRef((e,A)=>{const t=Ew(HG,e.__scopeDialog),i=V.useRef(null),n=pI(A,t.contentRef,i);return V.useEffect(()=>{const o=i.current;if(o)return OuA(o)},[]),W.jsx(wIt,{...e,ref:n,trapFocus:t.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Hn(e.onCloseAutoFocus,o=>{o.preventDefault(),t.triggerRef.current?.focus()}),onPointerDownOutside:Hn(e.onPointerDownOutside,o=>{const s=o.detail.originalEvent,r=s.button===0&&s.ctrlKey===!0;(s.button===2||r)&&o.preventDefault()}),onFocusOutside:Hn(e.onFocusOutside,o=>o.preventDefault())})}),sje=V.forwardRef((e,A)=>{const t=Ew(HG,e.__scopeDialog),i=V.useRef(!1),n=V.useRef(!1);return W.jsx(wIt,{...e,ref:A,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{e.onCloseAutoFocus?.(o),o.defaultPrevented||(i.current||t.triggerRef.current?.focus(),o.preventDefault()),i.current=!1,n.current=!1},onInteractOutside:o=>{e.onInteractOutside?.(o),o.defaultPrevented||(i.current=!0,o.detail.originalEvent.type==="pointerdown"&&(n.current=!0));const s=o.target;t.triggerRef.current?.contains(s)&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&n.current&&o.preventDefault()}})}),wIt=V.forwardRef((e,A)=>{const{__scopeDialog:t,trapFocus:i,onOpenAutoFocus:n,onCloseAutoFocus:o,...s}=e,r=Ew(HG,t),a=V.useRef(null),g=pI(A,a);return buA(),W.jsxs(W.Fragment,{children:[W.jsx(xZ,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:n,onUnmountAutoFocus:o,children:W.jsx(nY,{role:"dialog",id:r.contentId,"aria-describedby":r.descriptionId,"aria-labelledby":r.titleId,"data-state":jfA(r.open),...s,ref:g,onDismiss:()=>r.onOpenChange(!1)})}),W.jsxs(W.Fragment,{children:[W.jsx(aje,{titleId:r.titleId}),W.jsx(cje,{contentRef:a,descriptionId:r.descriptionId})]})]})}),VfA="DialogTitle",DIt=V.forwardRef((e,A)=>{const{__scopeDialog:t,...i}=e,n=Ew(VfA,t);return W.jsx(Wa.h2,{id:n.titleId,...i,ref:A})});DIt.displayName=VfA;var SIt="DialogDescription",bIt=V.forwardRef((e,A)=>{const{__scopeDialog:t,...i}=e,n=Ew(SIt,t);return W.jsx(Wa.p,{id:n.descriptionId,...i,ref:A})});bIt.displayName=SIt;var xIt="DialogClose",_It=V.forwardRef((e,A)=>{const{__scopeDialog:t,...i}=e,n=Ew(xIt,t);return W.jsx(Wa.button,{type:"button",...i,ref:A,onClick:Hn(e.onClick,()=>n.onOpenChange(!1))})});_It.displayName=xIt;function jfA(e){return e?"open":"closed"}var kIt="DialogTitleWarning",[rje,FIt]=r6t(kIt,{contentName:HG,titleName:VfA,docsSlug:"dialog"}),aje=({titleId:e})=>{const A=FIt(kIt),t=`\`${A.contentName}\` requires a \`${A.titleName}\` for the component to be accessible for screen reader users.
5689
+ `,I=new Blob([c],{type:"text/plain"}),l=URL.createObjectURL(I),B=document.createElement("a");B.href=l,B.download=`${g}.test.ts`,B.click(),URL.revokeObjectURL(l)}catch(a){alert(`Error generating test.ts for ${e.constructor.name}: ${a instanceof Error?a.message:String(a)}`)}i(!1)};return W.jsxs("div",{className:`relative ${A}`,ref:n,children:[W.jsx("button",{className:"px-2 py-1 rounded text-xs cursor-pointer",onClick:()=>i(!t),title:`Download options for ${e.constructor.name}`,children:e.constructor.name}),t&&W.jsxs("div",{className:"absolute top-full left-0 mt-1 bg-white border border-gray-300 rounded shadow-lg z-10 min-w-[150px]",children:[W.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:o,children:"Download JSON"}),W.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:s,children:"Download page.tsx"}),W.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:r,children:"Download test.ts"})]})]})},lIt=e=>e.activeSubSolver?[e,...lIt(e.activeSubSolver)]:[e],_9e=({solver:e})=>{const A=lIt(e);return W.jsx("div",{className:"flex gap-1 items-center text-sm pt-1",children:A.map((t,i)=>W.jsxs("div",{className:"flex items-center",children:[i>0&&W.jsx("span",{className:"text-gray-400 mx-1",children:"→"}),W.jsx(x9e,{solver:t})]},t.constructor.name))})},k9e=({solver:e,triggerRender:A,animationSpeed:t=25,onSolverStarted:i,onSolverCompleted:n})=>{const[o,s]=V.useReducer(Q=>!Q,!1),r=V.useRef(void 0),a=()=>{!e.solved&&!e.failed&&(e.step(),A())},g=()=>{!e.solved&&!e.failed&&(i&&i(e),e.solve(),A(),n&&n(e))},c=()=>{o?(r.current&&(clearInterval(r.current),r.current=void 0),s()):(s(),r.current=setInterval(()=>{if(e.solved||e.failed){r.current&&(clearInterval(r.current),r.current=void 0),s(),A(),n&&e.solved&&n(e);return}e.step(),A()},t))},I=()=>{const Q=e;if(Q.getCurrentPhase&&!e.solved&&!e.failed){const h=Q.getCurrentPhase();for(;Q.getCurrentPhase()===h&&!e.solved&&!e.failed;)e.step();A()}},l=()=>{if(e.solved||e.failed||o)return;const Q=window.prompt("Step until which iteration?",`${e.iterations}`);if(Q===null)return;const h=Number(Q);if(!Number.isFinite(h)){window.alert("Please enter a valid number for the iteration");return}for(;e.iterations<h&&!e.solved&&!e.failed;)e.step();A(),e.solved&&n&&n(e)};V.useEffect(()=>()=>{r.current&&clearInterval(r.current)},[]),V.useEffect(()=>{(e.solved||e.failed)&&o&&(r.current&&(clearInterval(r.current),r.current=void 0),s())},[e.solved,e.failed,o]);const B=e.getCurrentPhase!==void 0,C=B?e.getCurrentPhase():null;return W.jsxs("div",{className:"space-y-2 p-2 border-b",children:[W.jsx("div",{className:"flex items-center",children:W.jsx(_9e,{solver:e})}),W.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[W.jsx("button",{onClick:a,disabled:e.solved||e.failed||o,className:"bg-blue-500 hover:bg-blue-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step"}),W.jsx("button",{onClick:g,disabled:e.solved||e.failed||o,className:"bg-green-500 hover:bg-green-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Solve"}),W.jsx("button",{onClick:c,disabled:e.solved||e.failed,className:`px-3 py-1 rounded text-white text-sm ${o?"bg-red-500 hover:bg-red-600":"bg-yellow-500 hover:bg-yellow-600"} disabled:bg-gray-300`,children:o?"Stop":"Animate"}),W.jsx("button",{onClick:l,disabled:e.solved||e.failed||o,className:"bg-orange-500 hover:bg-orange-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step Until Iteration"}),B&&W.jsx("button",{onClick:I,disabled:e.solved||e.failed||o,className:"bg-purple-500 hover:bg-purple-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Next Stage"}),W.jsxs("div",{className:"text-sm text-gray-600",children:["Iterations: ",e.iterations]}),e.timeToSolve!==void 0&&W.jsxs("div",{className:"text-sm text-gray-600",children:["Time: ",(e.timeToSolve/1e3).toFixed(3),"s"]}),C&&W.jsxs("div",{className:"text-sm text-gray-600",children:["Phase: ",W.jsx("span",{className:"font-medium",children:C})]}),e.solved&&W.jsx("div",{className:"px-2 py-1 bg-green-100 text-green-800 rounded text-sm",children:"Solved"}),e.failed&&W.jsx("div",{className:"px-2 py-1 bg-red-100 text-red-800 rounded text-sm",children:"Failed"})]}),e.error&&W.jsxs("div",{className:"text-red-600 text-sm",children:["Error: ",e.error]})]})},F9e=(e,A,t)=>{const i=e.currentPipelineStepIndex;return A<i?"Completed":A===i&&e.activeSubSolver?e.activeSubSolver.failed?"Failed":"In Progress":"Not Started"},G9e=(e,A)=>{const i=e.pipelineDef[A].solverName,n=F9e(e,A),o=e[i],s=e.firstIterationOfPhase?.[i]??null,r=e.iterations;let a=0;if(n==="Completed"){const l=e.pipelineDef[A+1],B=l?e.firstIterationOfPhase?.[l.solverName]:void 0;B!==void 0&&s!==null?a=B-s:s!==null&&(a=r-s)}else n==="In Progress"&&s!==null&&(a=r-s);const g=e.timeSpentOnPhase?.[i]??0;let c=0;n==="Completed"?c=1:n==="In Progress"&&o&&(c=o.progress??0);const I=o?.stats??null;return{index:A,name:i,status:n,firstIteration:s,iterations:a,progress:c,timeSpent:g,stats:I&&Object.keys(I).length>0?I:null,solverInstance:o??null}},R9e=({status:e})=>{const A={"Not Started":"text-blue-600","In Progress":"text-yellow-600",Completed:"text-green-600",Failed:"text-red-600"};return W.jsx("span",{className:`font-medium ${A[e]}`,children:e})},M9e=({progress:e})=>{if(e===0)return null;const A=Math.round(e*100);return W.jsxs("div",{className:"flex items-center gap-2",children:[W.jsx("div",{className:"w-20 h-2 bg-gray-200 rounded overflow-hidden",children:W.jsx("div",{className:"h-full bg-blue-500 transition-all duration-200",style:{width:`${A}%`}})}),W.jsxs("span",{className:"text-xs text-gray-500",children:[A,"%"]})]})},N9e=e=>Object.entries(e).map(([A,t])=>`${A}: ${t}`).join(", "),v9e=({stats:e})=>{if(!e||Object.keys(e).length===0)return W.jsx("span",{children:"-"});const A=Object.entries(e),t=N9e(e);return W.jsxs("details",{className:"cursor-pointer",children:[W.jsx("summary",{className:"whitespace-nowrap overflow-hidden text-ellipsis max-w-[200px]",children:t}),W.jsx("div",{className:"mt-1 text-xs",children:A.map(([i,n])=>W.jsxs("div",{children:[i,": ",String(n)]},i))})]})},WfA=e=>{if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(WfA);const A={};for(const[t,i]of Object.entries(e))t.startsWith("_")||(A[t]=WfA(i));return A},L9e=(e,A)=>{try{if(typeof e.getConstructorParams!="function"){alert(`getConstructorParams() is not implemented for ${A}`);return}const t=WfA(e.getConstructorParams()),i=new Blob([JSON.stringify(t,null,2)],{type:"application/json"}),n=URL.createObjectURL(i),o=document.createElement("a");o.href=n,o.download=`${A}_input.json`,o.click(),URL.revokeObjectURL(n)}catch(t){alert(`Error downloading input for ${A}: ${t instanceof Error?t.message:String(t)}`)}},U9e=({solver:e,onStepUntilPhase:A,onDownloadInput:t})=>{const i=e.pipelineDef.map((r,a)=>G9e(e,a)),n=r=>{A?.(r)},o=r=>{r.solverInstance&&(t?t(r.solverInstance,r.name):L9e(r.solverInstance,r.name))},s=r=>`${(r/1e3).toFixed(2)}s`;return W.jsxs("div",{className:"border-t border-gray-200",children:[W.jsx("div",{className:"px-4 py-2 bg-gray-50 border-b border-gray-200",children:W.jsx("h3",{className:"text-sm font-semibold text-gray-700",children:"Pipeline Steps"})}),W.jsx("div",{className:"overflow-x-auto",children:W.jsxs("table",{className:"w-full text-sm",children:[W.jsx("thead",{children:W.jsxs("tr",{className:"bg-gray-50 border-b border-gray-200",children:[W.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Step"}),W.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Status"}),W.jsxs("th",{className:"px-4 py-2 text-center font-semibold text-gray-700",children:["i",W.jsx("sub",{children:"0"})]}),W.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Iterations"}),W.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Progress"}),W.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Time"}),W.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Stats"}),W.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Input"})]})}),W.jsx("tbody",{children:i.map(r=>W.jsxs("tr",{className:`border-b border-gray-100 ${r.status==="In Progress"?"bg-yellow-50":""}`,children:[W.jsx("td",{className:"px-4 py-2",children:W.jsxs("div",{className:"flex items-center gap-2",children:[W.jsx("span",{className:"text-gray-400 w-6",children:String(r.index+1).padStart(2,"0")}),W.jsx("button",{onClick:()=>n(r.name),disabled:r.status==="Completed"||e.solved||e.failed,className:"text-blue-500 hover:text-blue-700 disabled:text-gray-300 disabled:cursor-not-allowed",title:`Step until ${r.name} completes`,children:W.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:W.jsx("path",{fillRule:"evenodd",d:"M4.5 5.653c0-1.426 1.529-2.33 2.779-1.643l11.54 6.348c1.295.712 1.295 2.573 0 3.285L7.28 19.991c-1.25.687-2.779-.217-2.779-1.643V5.653z",clipRule:"evenodd"})})}),W.jsx("span",{className:"font-medium text-gray-900",children:r.name})]})}),W.jsx("td",{className:"px-4 py-2",children:W.jsx(R9e,{status:r.status})}),W.jsx("td",{className:"px-4 py-2 text-center text-gray-600",children:r.firstIteration!==null?r.firstIteration:""}),W.jsx("td",{className:"px-4 py-2 text-gray-600",children:r.iterations}),W.jsx("td",{className:"px-4 py-2",children:W.jsx(M9e,{progress:r.progress})}),W.jsx("td",{className:"px-4 py-2 text-gray-600",children:s(r.timeSpent)}),W.jsx("td",{className:"px-4 py-2 text-gray-500",children:W.jsx(v9e,{stats:r.stats})}),W.jsx("td",{className:"px-4 py-2",children:r.solverInstance?W.jsxs("button",{onClick:()=>o(r),className:"flex items-center gap-1 text-blue-500 hover:text-blue-700",title:`Download input for ${r.name}`,children:[W.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:W.jsx("path",{fillRule:"evenodd",d:"M12 2.25a.75.75 0 01.75.75v11.69l3.22-3.22a.75.75 0 111.06 1.06l-4.5 4.5a.75.75 0 01-1.06 0l-4.5-4.5a.75.75 0 111.06-1.06l3.22 3.22V3a.75.75 0 01.75-.75zm-9 13.5a.75.75 0 01.75.75v2.25a1.5 1.5 0 001.5 1.5h13.5a1.5 1.5 0 001.5-1.5V16.5a.75.75 0 011.5 0v2.25a3 3 0 01-3 3H5.25a3 3 0 01-3-3V16.5a.75.75 0 01.75-.75z",clipRule:"evenodd"})}),W.jsx("span",{children:"Input"})]}):null})]},r.name))})]})})]})},H9e=class extends en.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){console.error("InteractiveGraphics render error:",e)}render(){return this.state.hasError?this.props.fallback:this.props.children}};function Y9e({graphics:e}){const A=e.points??[],t=e.lines??[],i=e.rects??[],n=e.circles??[],o=e.texts??[];let s=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,g=Number.NEGATIVE_INFINITY;const c=(h,E)=>{typeof h=="number"&&(h<s&&(s=h),h>a&&(a=h)),typeof E=="number"&&(E<r&&(r=E),E>g&&(g=E))};for(const h of A)c(h.x,h.y);for(const h of t){const E=h.points??[];for(const u of E)c(u.x,u.y)}for(const h of i){const E=h.x??0,u=h.y??0,d=h.width??0,p=h.height??0;c(E,u),c(E+d,u+p)}for(const h of n){const E=h.x??0,u=h.y??0,d=h.radius??1;c(E-d,u-d),c(E+d,u+d)}for(const h of o)c(h.x,h.y);(!isFinite(s)||!isFinite(r)||!isFinite(a)||!isFinite(g))&&(s=-20,r=-20,a=20,g=20);const I=10,l=s-I,B=r-I,C=Math.max(1,a-s+2*I),Q=Math.max(1,g-r+2*I);return W.jsxs("svg",{className:"w-full h-[400px] bg-white",viewBox:`${l} ${B} ${C} ${Q}`,role:"img","aria-label":"Graphics fallback",children:[i.map((h,E)=>W.jsx("rect",{x:h.x??0,y:h.y??0,width:h.width??0,height:h.height??0,fill:"none",stroke:h.strokeColor??"black",strokeWidth:h.strokeWidth??1},`rect-${E}`)),t.map((h,E)=>W.jsx("polyline",{fill:"none",stroke:h.strokeColor??"black",strokeWidth:h.strokeWidth??1,points:(h.points??[]).map(u=>`${u.x??0},${u.y??0}`).join(" ")},`line-${E}`)),n.map((h,E)=>W.jsx("circle",{cx:h.x??0,cy:h.y??0,r:h.radius??1.5,fill:h.fillColor??"none",stroke:h.strokeColor??"black",strokeWidth:h.strokeWidth??1},`circle-${E}`)),A.map((h,E)=>W.jsx("circle",{cx:h.x??0,cy:h.y??0,r:h.radius??1.5,fill:h.color??"black"},`point-${E}`)),o.map((h,E)=>W.jsx("text",{x:h.x??0,y:h.y??0,fontSize:h.fontSize??10,fill:h.color??"black",children:h.text??""},`text-${E}`))]})}var J9e=({solver:e,animationSpeed:A=25,onSolverStarted:t,onSolverCompleted:i})=>{const[n,o]=V.useReducer(c=>c+1,0),s=V.useMemo(()=>{try{return e.visualize()||{points:[],lines:[],rects:[],circles:[]}}catch(c){return console.error("Visualization error:",c),{points:[],lines:[],rects:[],circles:[]}}},[e,n]),r=V.useMemo(()=>(s.rects?.length||0)===0&&(s.lines?.length||0)===0&&(s.points?.length||0)===0&&(s.circles?.length||0)===0,[s]);V.useEffect(()=>{if(!(typeof document>"u")&&!document.querySelector('script[src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"]')){const c=document.createElement("script");c.src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4",document.head.appendChild(c)}},[]);const a=e.pipelineDef!==void 0,g=c=>{const I=e;if(!e.solved&&!e.failed){for(;!e.solved&&!e.failed&&I.currentPipelineStepIndex<=I.pipelineDef.findIndex(l=>l.solverName===c);)e.step();o()}};return W.jsxs("div",{children:[W.jsx(k9e,{solver:e,triggerRender:o,animationSpeed:A,onSolverStarted:t,onSolverCompleted:i}),r?W.jsx("div",{className:"p-4 text-gray-500",children:"No Graphics Yet"}):W.jsx(H9e,{fallback:W.jsx(Y9e,{graphics:s}),children:W.jsx(b9e,{graphics:s})}),a&&W.jsx(U9e,{solver:e,onStepUntilPhase:g})]})};const T9e=()=>{V.useEffect(()=>{const e="tailwind-cdn-script";if(document.getElementById(e)||window.tailwind)return;const A=document.createElement("div");A.className="hidden",document.body.appendChild(A);const t=window.getComputedStyle(A).display==="none";if(document.body.removeChild(A),t)return;const i=document.createElement("script");i.id=e,i.src="https://cdn.tailwindcss.com",document.head.appendChild(i)},[])},K9e=e=>e.toLowerCase().includes("pack")?TMe:e.toLowerCase().includes("rout")?WMe:bMe,P9e=({solverEvents:e=[]})=>{const[A,t]=V.useState(null);T9e();const i=V.useMemo(()=>{const r=new Map;for(const a of e){const g=`${a.componentName}-${a.solverName}`;r.set(g,a)}return r},[e]),n=V.useMemo(()=>Array.from(i.keys()),[i]),o=A?i.get(A):null,s=V.useMemo(()=>{if(!o)return{instance:null,error:null,classFound:!1};const r=ZnA[o.solverName];if(!r)return{instance:null,error:`Solver class "${o.solverName}" not found in SOLVERS registry. Available: ${Object.keys(ZnA).join(", ")}`,classFound:!1};try{const a=o.solverParams,g=a?.input!==void 0?a.input:a;return{instance:new r(g),error:null,classFound:!0}}catch(a){const g=a instanceof Error?a.message:String(a);return console.error("Failed to reconstruct solver:",a),{instance:null,error:`Failed to instantiate solver: ${g}`,classFound:!0}}},[o]);return e.length===0?W.jsx("div",{className:"rf-p-4",children:W.jsx("div",{className:"rf-bg-gray-50 rf-rounded-md rf-border rf-border-gray-200",children:W.jsxs("div",{className:"rf-p-4",children:[W.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800 rf-mb-3",children:"No Solvers Detected"}),W.jsx("p",{className:"rf-text-sm rf-text-gray-600",children:"Solvers will appear here when the circuit runs. Solvers are used for tasks like component packing and autorouting."})]})})}):W.jsxs("div",{className:"rf-flex rf-h-full rf-overflow-hidden",children:[W.jsxs("div",{className:"rf-w-64 rf-border-r rf-border-gray-200 rf-overflow-y-auto rf-flex-shrink-0",children:[W.jsxs("div",{className:"rf-text-xs rf-font-semibold rf-text-gray-500 rf-px-3 rf-py-2 rf-bg-gray-50 rf-border-b rf-border-gray-200",children:[n.length," ",n.length===1?"Solver":"Solvers"]}),n.map(r=>{const a=i.get(r),g=A===r;return W.jsx("div",{className:`rf-px-3 rf-py-2 rf-cursor-pointer rf-border-b rf-border-gray-100 ${g?"rf-bg-blue-50 rf-border-l-2 rf-border-l-blue-500":"hover:rf-bg-gray-50"}`,onClick:()=>t(r),children:(()=>{const c=K9e(a.solverName);return W.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[W.jsx(c,{className:"rf-w-4 rf-h-4 rf-text-blue-500 rf-flex-shrink-0"}),W.jsxs("div",{className:"rf-flex-1 rf-min-w-0",children:[W.jsx("div",{className:"rf-text-sm rf-font-medium rf-text-gray-800 rf-truncate",children:a.componentName}),W.jsx("div",{className:"rf-text-xs rf-text-gray-500 rf-truncate",children:a.solverName})]})]})})()},r)})]}),W.jsx("div",{className:"rf-flex-1 rf-overflow-hidden",children:o?s.instance?W.jsx(Ky,{fallback:W.jsx("div",{className:"rf-p-4",children:W.jsxs("div",{className:"rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200 rf-p-4",children:[W.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-2",children:"Error Loading Solver Debugger"}),W.jsxs("p",{className:"rf-text-sm rf-text-red-600",children:["Failed to render the solver debugger for"," ",o.solverName]})]})}),children:W.jsx(J9e,{solver:s.instance})}):W.jsxs("div",{className:"rf-p-4",children:[W.jsxs("div",{className:"rf-mb-4",children:[W.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800",children:o.solverName}),W.jsxs("p",{className:"rf-text-sm rf-text-gray-500",children:["Component: ",o.componentName]})]}),s.error&&W.jsx("div",{className:`rf-rounded-md rf-border rf-p-4 rf-mb-4 ${s.classFound?"rf-bg-red-50 rf-border-red-200":"rf-bg-yellow-50 rf-border-yellow-200"}`,children:W.jsx("p",{className:`rf-text-sm ${s.classFound?"rf-text-red-700":"rf-text-yellow-700"}`,children:s.error})}),W.jsxs("div",{className:"rf-border rf-border-gray-200 rf-rounded-md rf-overflow-hidden",children:[W.jsx("div",{className:"rf-px-3 rf-py-2 rf-bg-gray-50",children:W.jsx("span",{className:"rf-text-sm rf-font-medium rf-text-gray-700",children:"Solver Parameters"})}),W.jsx("div",{className:"rf-p-3 rf-bg-white rf-border-t rf-border-gray-200",children:W.jsx("pre",{className:"rf-text-xs rf-font-mono rf-text-gray-600 rf-whitespace-pre-wrap rf-overflow-x-auto",children:JSON.stringify(o.solverParams,null,2)})})]})]}):W.jsx("div",{className:"rf-flex rf-items-center rf-justify-center rf-h-full",children:W.jsx("p",{className:"rf-text-sm rf-text-gray-500",children:"Select a solver from the list to view details"})})})]})},BIt=({errorMessage:e,errorStack:A,circuitJsonErrors:t})=>{V.useEffect(()=>{if(e){const i=new Error(e);A&&(i.stack=A);try{L5.captureException(i)}catch{}}},[e,A]),V.useEffect(()=>{if(t&&t.length>0)for(const i of t){const n=new Error(i.message||"Circuit JSON Error");i.stack&&(n.stack=i.stack);try{L5.captureException(n,{error_type:i.type})}catch{}}},[t])},CIt="0.0.1620",q9e={version:CIt},q9=DYA()(SYA(e=>({lastRunEvalVersion:void 0,setLastRunEvalVersion:A=>{e({lastRunEvalVersion:A})}}),{name:"runframe-runner-store"})),O9e=e=>{const[A,t]=V.useState([]),[i,n]=V.useState(null),[o,s]=V.useState(""),[r,a]=a1("eval-version-selection",null),g=q9(B=>B.setLastRunEvalVersion),c=q9(B=>B.lastRunEvalVersion);return V.useEffect(()=>{e&&fetch("https://data.jsdelivr.com/v1/package/npm/@tscircuit/eval").then(B=>B.json()).then(B=>{if(Array.isArray(B?.versions)){let C=[...B.versions];B.tags?.latest&&(n(B.tags.latest),C=C.filter(Q=>Q!==B.tags.latest)),t(C)}}).catch(()=>{})},[e]),V.useEffect(()=>{e&&(r?(window.TSCIRCUIT_LATEST_EVAL_VERSION=r,g(r)):i&&(window.TSCIRCUIT_LATEST_EVAL_VERSION=i,g(i)))},[e,r,i]),{versions:V.useMemo(()=>A.filter(B=>B.includes(o)).slice(0,50),[A,o]),latestVersion:i,lastRunEvalVersion:c,search:o,setSearch:s,selectVersion:B=>{a(B),s("")}}},W9e=({snippetNames:e,onSelect:A,onCancel:t,isOpen:i})=>{const[n,o]=V.useState(""),[s,r]=V.useState("");if(!i)return null;const a=e.filter(I=>I.toLowerCase().includes(s.toLowerCase())),g=s&&!e.includes(s),c=I=>{I.key==="Enter"&&(a.length===1?o(a[0]):g&&o(s))};return W.jsx("div",{className:"rf-fixed rf-inset-0 rf-bg-black rf-bg-opacity-50 rf-flex rf-items-center rf-justify-center rf-z-[100]",children:W.jsxs("div",{className:"rf-bg-white rf-rounded-lg rf-p-6 rf-w-96",children:[W.jsx("h2",{className:"rf-text-lg rf-font-semibold rf-mb-4",children:"Select Snippet"}),W.jsx("input",{type:"text",className:"rf-w-full rf-px-4 rf-py-2 rf-border rf-rounded rf-mb-4",placeholder:"Search snippets or new snippet name...",value:s,onChange:I=>r(I.target.value),onKeyDown:c}),W.jsxs("div",{className:"rf-h-60 rf-overflow-y-auto",children:[a.map(I=>W.jsx("button",{type:"button",className:`w-full text-left px-4 py-2 rounded hover:bg-gray-100 ${n===I?"bg-blue-50":""}`,onClick:()=>o(I),children:I},I)),g&&W.jsxs("button",{type:"button",className:`w-full text-left px-4 py-2 rounded hover:bg-gray-100 text-blue-500 ${n===s?"bg-blue-50":""}`,onClick:()=>o(s),children:['Create new "',s,'"']})]}),W.jsxs("div",{className:"rf-mt-4 rf-flex rf-justify-end rf-gap-2",children:[W.jsx("button",{type:"button",className:"rf-px-4 rf-py-2 rf-text-gray-600 rf-hover:text-gray-800",onClick:t,children:"Cancel"}),W.jsx("button",{type:"button",className:"rf-px-4 rf-py-2 rf-bg-blue-500 rf-text-white rf-rounded rf-hover:bg-blue-600 rf-disabled:opacity-50",onClick:()=>n&&A(n),disabled:!n,children:n===s?`Create "${n}"`:`Save to ${n}`})]})]})})},Z9e=e=>{const A=V.useRef(null),t=ZI(i=>i.recentEvents);V.useEffect(()=>{if(t.length===0)return;const i=t[0];i.event_id!==A.current&&(e(i),A.current=i.event_id)},[t,e])};function V9e(e){const A=j9e(e),t=V.forwardRef((i,n)=>{const{children:o,...s}=i,r=V.Children.toArray(o),a=r.find(X9e);if(a){const g=a.props.children,c=r.map(I=>I===a?V.Children.count(g)>1?V.Children.only(null):V.isValidElement(g)?g.props.children:null:I);return W.jsx(A,{...s,ref:n,children:V.isValidElement(g)?V.cloneElement(g,void 0,c):null})}return W.jsx(A,{...s,ref:n,children:o})});return t.displayName=`${e}.Slot`,t}function j9e(e){const A=V.forwardRef((t,i)=>{const{children:n,...o}=t;if(V.isValidElement(n)){const s=Aje(n),r=$9e(o,n.props);return n.type!==V.Fragment&&(r.ref=i?gf(i,s):s),V.cloneElement(n,r)}return V.Children.count(n)>1?V.Children.only(null):null});return A.displayName=`${e}.SlotClone`,A}var z9e=Symbol("radix.slottable");function X9e(e){return V.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===z9e}function $9e(e,A){const t={...A};for(const i in A){const n=e[i],o=A[i];/^on[A-Z]/.test(i)?n&&o?t[i]=(...r)=>{const a=o(...r);return n(...r),a}:n&&(t[i]=n):i==="style"?t[i]={...n,...o}:i==="className"&&(t[i]=[n,o].filter(Boolean).join(" "))}return{...e,...t}}function Aje(e){let A=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,t=A&&"isReactWarning"in A&&A.isReactWarning;return t?e.ref:(A=Object.getOwnPropertyDescriptor(e,"ref")?.get,t=A&&"isReactWarning"in A&&A.isReactWarning,t?e.props.ref:e.props.ref||e.ref)}var O9="Dialog",[QIt,hIt]=Pm(O9),[tje,Ew]=QIt(O9),EIt=e=>{const{__scopeDialog:A,children:t,open:i,defaultOpen:n,onOpenChange:o,modal:s=!0}=e,r=V.useRef(null),a=V.useRef(null),[g,c]=qx({prop:i,defaultProp:n??!1,onChange:o,caller:O9});return W.jsx(tje,{scope:A,triggerRef:r,contentRef:a,contentId:xE(),titleId:xE(),descriptionId:xE(),open:g,onOpenChange:c,onOpenToggle:V.useCallback(()=>c(I=>!I),[c]),modal:s,children:t})};EIt.displayName=O9;var uIt="DialogTrigger",dIt=V.forwardRef((e,A)=>{const{__scopeDialog:t,...i}=e,n=Ew(uIt,t),o=pI(A,n.triggerRef);return W.jsx(Wa.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":jfA(n.open),...i,ref:o,onClick:Hn(e.onClick,n.onOpenToggle)})});dIt.displayName=uIt;var ZfA="DialogPortal",[eje,pIt]=QIt(ZfA,{forceMount:void 0}),fIt=e=>{const{__scopeDialog:A,forceMount:t,children:i,container:n}=e,o=Ew(ZfA,A);return W.jsx(eje,{scope:A,forceMount:t,children:V.Children.map(i,s=>W.jsx(f0,{present:t||o.open,children:W.jsx(JZ,{asChild:!0,container:n,children:s})}))})};fIt.displayName=ZfA;var W9="DialogOverlay",yIt=V.forwardRef((e,A)=>{const t=pIt(W9,e.__scopeDialog),{forceMount:i=t.forceMount,...n}=e,o=Ew(W9,e.__scopeDialog);return o.modal?W.jsx(f0,{present:i||o.open,children:W.jsx(nje,{...n,ref:A})}):null});yIt.displayName=W9;var ije=V9e("DialogOverlay.RemoveScroll"),nje=V.forwardRef((e,A)=>{const{__scopeDialog:t,...i}=e,n=Ew(W9,t);return W.jsx(VZ,{as:ije,allowPinchZoom:!0,shards:[n.contentRef],children:W.jsx(Wa.div,{"data-state":jfA(n.open),...i,ref:A,style:{pointerEvents:"auto",...i.style}})})}),HG="DialogContent",mIt=V.forwardRef((e,A)=>{const t=pIt(HG,e.__scopeDialog),{forceMount:i=t.forceMount,...n}=e,o=Ew(HG,e.__scopeDialog);return W.jsx(f0,{present:i||o.open,children:o.modal?W.jsx(oje,{...n,ref:A}):W.jsx(sje,{...n,ref:A})})});mIt.displayName=HG;var oje=V.forwardRef((e,A)=>{const t=Ew(HG,e.__scopeDialog),i=V.useRef(null),n=pI(A,t.contentRef,i);return V.useEffect(()=>{const o=i.current;if(o)return OuA(o)},[]),W.jsx(wIt,{...e,ref:n,trapFocus:t.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Hn(e.onCloseAutoFocus,o=>{o.preventDefault(),t.triggerRef.current?.focus()}),onPointerDownOutside:Hn(e.onPointerDownOutside,o=>{const s=o.detail.originalEvent,r=s.button===0&&s.ctrlKey===!0;(s.button===2||r)&&o.preventDefault()}),onFocusOutside:Hn(e.onFocusOutside,o=>o.preventDefault())})}),sje=V.forwardRef((e,A)=>{const t=Ew(HG,e.__scopeDialog),i=V.useRef(!1),n=V.useRef(!1);return W.jsx(wIt,{...e,ref:A,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{e.onCloseAutoFocus?.(o),o.defaultPrevented||(i.current||t.triggerRef.current?.focus(),o.preventDefault()),i.current=!1,n.current=!1},onInteractOutside:o=>{e.onInteractOutside?.(o),o.defaultPrevented||(i.current=!0,o.detail.originalEvent.type==="pointerdown"&&(n.current=!0));const s=o.target;t.triggerRef.current?.contains(s)&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&n.current&&o.preventDefault()}})}),wIt=V.forwardRef((e,A)=>{const{__scopeDialog:t,trapFocus:i,onOpenAutoFocus:n,onCloseAutoFocus:o,...s}=e,r=Ew(HG,t),a=V.useRef(null),g=pI(A,a);return buA(),W.jsxs(W.Fragment,{children:[W.jsx(xZ,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:n,onUnmountAutoFocus:o,children:W.jsx(nY,{role:"dialog",id:r.contentId,"aria-describedby":r.descriptionId,"aria-labelledby":r.titleId,"data-state":jfA(r.open),...s,ref:g,onDismiss:()=>r.onOpenChange(!1)})}),W.jsxs(W.Fragment,{children:[W.jsx(aje,{titleId:r.titleId}),W.jsx(cje,{contentRef:a,descriptionId:r.descriptionId})]})]})}),VfA="DialogTitle",DIt=V.forwardRef((e,A)=>{const{__scopeDialog:t,...i}=e,n=Ew(VfA,t);return W.jsx(Wa.h2,{id:n.titleId,...i,ref:A})});DIt.displayName=VfA;var SIt="DialogDescription",bIt=V.forwardRef((e,A)=>{const{__scopeDialog:t,...i}=e,n=Ew(SIt,t);return W.jsx(Wa.p,{id:n.descriptionId,...i,ref:A})});bIt.displayName=SIt;var xIt="DialogClose",_It=V.forwardRef((e,A)=>{const{__scopeDialog:t,...i}=e,n=Ew(xIt,t);return W.jsx(Wa.button,{type:"button",...i,ref:A,onClick:Hn(e.onClick,()=>n.onOpenChange(!1))})});_It.displayName=xIt;function jfA(e){return e?"open":"closed"}var kIt="DialogTitleWarning",[rje,FIt]=r6t(kIt,{contentName:HG,titleName:VfA,docsSlug:"dialog"}),aje=({titleId:e})=>{const A=FIt(kIt),t=`\`${A.contentName}\` requires a \`${A.titleName}\` for the component to be accessible for screen reader users.
5690
5690
 
5691
5691
  If you want to hide the \`${A.titleName}\`, you can wrap it with our VisuallyHidden component.
5692
5692
 
@@ -5833,7 +5833,7 @@ ${a.join(`
5833
5833
  (lib (name "${e}") (type "KiCad") (uri "\${KIPRJMOD}/${e}.kicad_sym") (options "") (descr "Generated by circuit-json-to-kicad"))
5834
5834
  )
5835
5835
  `}getOutput(){return this.ctx.libraryOutput}},xsi=class{ctx;pipeline;currentStageIndex=0;finished=!1;get currentStage(){return this.pipeline[this.currentStageIndex]}constructor(e,A={}){this.ctx={db:Ga(e),circuitJson:e,libraryName:A.libraryName??"tscircuit",fpLibraryName:A.footprintLibraryName??"tscircuit"},this.pipeline=[new Esi(e,this.ctx),new usi(e,this.ctx),new msi(e,this.ctx),new Ssi(e,this.ctx),new bsi(e,this.ctx)]}step(){if(!this.currentStage){this.finished=!0;return}this.currentStage.step(),this.currentStage.finished&&this.currentStageIndex++}runUntilFinished(){for(;!this.finished;)this.step()}getOutput(){if(!this.ctx.libraryOutput)throw new Error("Converter has not been run yet");return this.ctx.libraryOutput}getSymbolLibraryString(){return this.getOutput().kicadSymString}getFootprints(){return this.getOutput().footprints}getFpLibTableString(){return this.getOutput().fpLibTableString}getSymLibTableString(){return this.getOutput().symLibTableString}getModel3dSourcePaths(){return this.getOutput().model3dSourcePaths}};const _si=async({circuitJson:e,projectName:A})=>{const t=new But(e);t.runUntilFinished();const i=t.getOutputString(),n=new Cut(e);n.runUntilFinished();const o=n.getOutputString(),s=new hsi(e,{projectName:A,schematicFilename:`${A}.kicad_sch`,pcbFilename:`${A}.kicad_pcb`});s.runUntilFinished();const r=s.getOutputString(),a=new f0A;return a.file(`${A}.kicad_sch`,i),a.file(`${A}.kicad_pcb`,o),a.file(`${A}.kicad_pro`,r),a},ksi=async({circuitJson:e,projectName:A})=>{const i=await(await _si({circuitJson:e,projectName:A})).generateAsync({type:"blob"});gk(i,{fileName:`${A}_kicad_project.zip`})},Fsi=async({circuitJson:e,libraryName:A})=>{const t=new xsi(e,{libraryName:A,footprintLibraryName:A});t.runUntilFinished();const i=t.getOutput(),n=new f0A;n.file(`${A}.kicad_sym`,i.kicadSymString);for(const o of i.footprints){const s=n.folder(`${A}.pretty`);s&&s.file(`${o.footprintName}.kicad_mod`,`${o.kicadModString}
5836
- `)}if(i.model3dSourcePaths.length>0){const o=n.folder(`${A}.3dshapes`);if(o)for(const s of i.model3dSourcePaths)try{const r=s.split("/").pop()||s,a=await fetch(s);if(a.ok){const g=await a.arrayBuffer();o.file(r,g)}}catch{}}return n.file("fp-lib-table",i.fpLibTableString),n.file("sym-lib-table",i.symLibTableString),n},Gsi=async({circuitJson:e,projectName:A})=>{const i=await(await Fsi({circuitJson:e,libraryName:A})).generateAsync({type:"blob"});gk(i,{fileName:`${A}_kicad_library.zip`})};class Po{static parse(A,t){throw new Error("not implemented")}}const VG=e=>e;class iT{constructor(A){this.id=A}resolve(A){const t=A.get(this.id);if(!t)throw new Error(`Unresolved #${this.id}`);return t}toString(){return`#${this.id}`}}const Wn=e=>`'${e.replace(/'/g,"''")}'`,vh=e=>Number.isInteger(e)?`${e}.`:`${e}`;class Qut{constructor(){this.map=new Map,this.order=[],this.schema="AP214",this.units={length:"MM",angle:"RAD",solidAngle:"SR"}}set(A,t){this.map.has(A)||this.order.push(A),this.map.set(A,t)}add(A){const t=VG(this.order.length?Math.max(...this.order)+1:1);return this.set(t,A),new iT(t)}get(A){return this.map.get(A)}entries(){return this.order.map(A=>[A,this.map.get(A)])}toPartFile(A){const t=new Date().toISOString().slice(0,10).replace(/-/g,"-"),i=["ISO-10303-21;","HEADER;",`FILE_DESCRIPTION((${Wn(A.name)}),'2;1');`,`FILE_NAME(${Wn(A.name)},${Wn(t)},(${Wn(A.author??"tscircuit")}),(${Wn(A.org??"tscircuit")}),${Wn("generator")},${Wn("")},${Wn("")});`,`FILE_SCHEMA(('${this.schema==="AP214"?"AUTOMOTIVE_DESIGN { 1 0 10303 214 1 1 1 1 }":"AP242_MANAGED_MODEL_BASED_3D_ENGINEERING"}'));`,"ENDSEC;","DATA;"],n=this.entries().map(([s,r])=>`#${s} = ${r.toStep(this)};`),o=["ENDSEC;","END-ISO-10303-21;"];return[...i,...n,...o].join(`
5836
+ `)}if(i.model3dSourcePaths.length>0){const o=n.folder(`${A}.3dshapes`);if(o)for(const s of i.model3dSourcePaths)try{const r=s.split("/").pop()||s,a=await fetch(s);if(a.ok){const g=await a.arrayBuffer();o.file(r,g)}}catch{}}return n.file("fp-lib-table",i.fpLibTableString),n.file("sym-lib-table",i.symLibTableString),n},Gsi=async({circuitJson:e,projectName:A})=>{const i=await(await Fsi({circuitJson:e,libraryName:A})).generateAsync({type:"blob"});gk(i,{fileName:`${A}_kicad_library.zip`})};class Po{static parse(A,t){throw new Error("not implemented")}}const VG=e=>e;class iT{constructor(A){this.id=A}resolve(A){const t=A.get(this.id);if(!t)throw new Error(`Unresolved #${this.id}`);return t}toString(){return`#${this.id}`}}const Wn=e=>`'${e.replace(/'/g,"''")}'`,vh=e=>Number.isInteger(e)?`${e}.`:`${e}`;class Qut{constructor(){this.map=new Map,this.order=[],this.maxId=0,this.schema="AP214",this.units={length:"MM",angle:"RAD",solidAngle:"SR"}}set(A,t){this.map.has(A)||(this.order.push(A),A>this.maxId&&(this.maxId=A)),this.map.set(A,t)}add(A){this.maxId++;const t=VG(this.maxId);return this.set(t,A),new iT(t)}get(A){return this.map.get(A)}entries(){return this.order.map(A=>[A,this.map.get(A)])}toPartFile(A){const t=new Date().toISOString().slice(0,10).replace(/-/g,"-"),i=["ISO-10303-21;","HEADER;",`FILE_DESCRIPTION((${Wn(A.name)}),'2;1');`,`FILE_NAME(${Wn(A.name)},${Wn(t)},(${Wn(A.author??"tscircuit")}),(${Wn(A.org??"tscircuit")}),${Wn("generator")},${Wn("")},${Wn("")});`,`FILE_SCHEMA(('${this.schema==="AP214"?"AUTOMOTIVE_DESIGN { 1 0 10303 214 1 1 1 1 }":"AP242_MANAGED_MODEL_BASED_3D_ENGINEERING"}'));`,"ENDSEC;","DATA;"],n=this.entries().map(([s,r])=>`#${s} = ${r.toStep(this)};`),o=["ENDSEC;","END-ISO-10303-21;"];return[...i,...n,...o].join(`
5837
5837
  `)}}const hut=new Map;function $o(e,A){hut.set(e,A)}function Rsi(e){return hut.get(e)}class Lh extends Po{constructor(A,t,i,n){super(),this.name=A,this.location=t,this.axis=i,this.refDirection=n,this.type="AXIS2_PLACEMENT_3D"}static parse(A,t){const i=t.parseString(A[0]),n=t.parseRef(A[1]),o=A[2]!=="$"?t.parseRef(A[2]):void 0,s=A[3]!=="$"?t.parseRef(A[3]):void 0;return new Lh(i,n,o,s)}toStep(){const A=this.axis?this.axis.toString():"$",t=this.refDirection?this.refDirection.toString():"$";return`AXIS2_PLACEMENT_3D(${Wn(this.name)},${this.location},${A},${t})`}}$o("AXIS2_PLACEMENT_3D",Lh.parse.bind(Lh));class Uo extends Po{constructor(A,t,i,n){super(),this.name=A,this.x=t,this.y=i,this.z=n,this.type="CARTESIAN_POINT"}static parse(A,t){const i=t.parseString(A[0]),n=A[1].replace(/^\(|\)$/g,"").split(",").map(t.parseNumber);return new Uo(i,n[0],n[1],n[2]??0)}toStep(){return`CARTESIAN_POINT(${Wn(this.name)},(${vh(this.x)},${vh(this.y)},${vh(this.z)}))`}}$o("CARTESIAN_POINT",Uo.parse.bind(Uo));class uw extends Po{constructor(A,t,i){super(),this.name=A,this.placement=t,this.radius=i,this.type="CIRCLE"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=t.parseRef(A[1]),o=t.parseNumber(A[2]);return new uw(i,n,o)}toStep(){return`CIRCLE(${this.name?`'${this.name}'`:"''"},${this.placement},${vh(this.radius)})`}}$o("CIRCLE",uw.parse.bind(uw));class U1 extends Po{constructor(A,t,i){super(),this.name=A,this.position=t,this.radius=i,this.type="CYLINDRICAL_SURFACE"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=t.parseRef(A[1]),o=t.parseNumber(A[2]);return new U1(i,n,o)}toStep(){return`CYLINDRICAL_SURFACE(${Wn(this.name)},${this.position},${vh(this.radius)})`}}$o("CYLINDRICAL_SURFACE",U1.parse.bind(U1));class Fg extends Po{constructor(A,t,i,n){super(),this.name=A,this.dx=t,this.dy=i,this.dz=n,this.type="DIRECTION"}static parse(A,t){const i=t.parseString(A[0]),n=A[1].replace(/^\(|\)$/g,"").split(",").map(t.parseNumber);return new Fg(i,n[0],n[1],n[2]??0)}toStep(){return`DIRECTION(${Wn(this.name)},(${vh(this.dx)},${vh(this.dy)},${vh(this.dz)}))`}}$o("DIRECTION",Fg.parse.bind(Fg));class Zd extends Po{constructor(A,t,i){super(),this.name=A,this.pnt=t,this.dir=i,this.type="LINE"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=t.parseRef(A[1]),o=A[2];if(o.startsWith("VECTOR("))throw new Error("Inline VECTOR in LINE is not supported - VECTOR should be a separate entity");const s=t.parseRef(o);return new Zd(i,n,s)}toStep(){return`LINE(${this.name?`'${this.name}'`:"''"},${this.pnt},${this.dir})`}}$o("LINE",Zd.parse.bind(Zd));class Hb extends Po{constructor(A,t){super(),this.name=A,this.placement=t,this.type="PLANE"}static parse(A,t){return new Hb(t.parseString(A[0]),t.parseRef(A[1]))}toStep(){return`PLANE(${Wn(this.name)},${this.placement})`}}$o("PLANE",Hb.parse.bind(Hb));class nz extends Po{constructor(A,t,i,n){super(),this.name=A,this.position=t,this.majorRadius=i,this.minorRadius=n,this.type="TOROIDAL_SURFACE"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=t.parseRef(A[1]),o=t.parseNumber(A[2]),s=t.parseNumber(A[3]);return new nz(i,n,o,s)}toStep(){return`TOROIDAL_SURFACE(${Wn(this.name)},${this.position},${vh(this.majorRadius)},${vh(this.minorRadius)})`}}$o("TOROIDAL_SURFACE",nz.parse.bind(nz));class Vd extends Po{constructor(A,t,i){super(),this.name=A,this.orientation=t,this.magnitude=i,this.type="VECTOR"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=t.parseRef(A[1]),o=t.parseNumber(A[2]);return new Vd(i,n,o)}toStep(){return`VECTOR(${Wn(this.name)},${this.orientation},${vh(this.magnitude)})`}}$o("VECTOR",Vd.parse.bind(Vd));class oz extends Po{constructor(A,t,i,n){super(),this.name=A,this.placement=t,this.semiAxis1=i,this.semiAxis2=n,this.type="ELLIPSE"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=t.parseRef(A[1]),o=t.parseNumber(A[2]),s=t.parseNumber(A[3]);return new oz(i,n,o,s)}toStep(){return`ELLIPSE(${Wn(this.name)},${this.placement},${vh(this.semiAxis1)},${vh(this.semiAxis2)})`}}$o("ELLIPSE",oz.parse.bind(oz));class sz extends Po{constructor(A,t,i,n){super(),this.name=A,this.position=t,this.radius=i,this.semiAngle=n,this.type="CONICAL_SURFACE"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=t.parseRef(A[1]),o=t.parseNumber(A[2]),s=t.parseNumber(A[3]);return new sz(i,n,o,s)}toStep(){return`CONICAL_SURFACE(${Wn(this.name)},${this.position},${vh(this.radius)},${vh(this.semiAngle)})`}}$o("CONICAL_SURFACE",sz.parse.bind(sz));class rz extends Po{constructor(A,t,i){super(),this.name=A,this.position=t,this.radius=i,this.type="SPHERICAL_SURFACE"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=t.parseRef(A[1]),o=t.parseNumber(A[2]);return new rz(i,n,o)}toStep(){return`SPHERICAL_SURFACE(${Wn(this.name)},${this.position},${vh(this.radius)})`}}$o("SPHERICAL_SURFACE",rz.parse.bind(rz));class az extends Po{constructor(A,t,i,n,o,s,r,a,g){super(),this.name=A,this.degree=t,this.controlPointsList=i,this.curveForm=n,this.closedCurve=o,this.selfIntersect=s,this.knotMultiplicities=r,this.knots=a,this.knotSpec=g,this.type="B_SPLINE_CURVE_WITH_KNOTS"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=t.parseNumber(A[1]),o=A[2].replace(/^\(|\)$/g,"").split(",").filter(Boolean).map(l=>t.parseRef(l.trim())),s=A[3].trim(),r=A[4].trim()===".T.",a=A[5].trim()===".T.",g=A[6].replace(/^\(|\)$/g,"").split(",").filter(Boolean).map(l=>t.parseNumber(l.trim())),c=A[7].replace(/^\(|\)$/g,"").split(",").filter(Boolean).map(l=>t.parseNumber(l.trim())),I=A[8].trim();return new az(i,n,o,s,r,a,g,c,I)}toStep(){const A=`(${this.controlPointsList.join(",")})`,t=`(${this.knotMultiplicities.map(vh).join(",")})`,i=`(${this.knots.map(vh).join(",")})`,n=this.closedCurve?".T.":".F.",o=this.selfIntersect?".T.":".F.";return`B_SPLINE_CURVE_WITH_KNOTS(${Wn(this.name)},${this.degree},${A},${this.curveForm},${n},${o},${t},${i},${this.knotSpec})`}}$o("B_SPLINE_CURVE_WITH_KNOTS",az.parse.bind(az));class nT extends Po{constructor(A,t,i,n){super(),this.name=A,this.r=t,this.g=i,this.b=n,this.type="COLOUR_RGB"}static parse(A,t){return new nT(t.parseString(A[0]),t.parseNumber(A[1]),t.parseNumber(A[2]),t.parseNumber(A[3]))}toStep(){return`COLOUR_RGB(${Wn(this.name)},${this.r},${this.g},${this.b})`}}$o("COLOUR_RGB",nT.parse.bind(nT));class oT extends Po{constructor(A,t){super(),this.name=A,this.items=t,this.type="FILL_AREA_STYLE"}static parse(A,t){const i=A[1].replace(/^\(|\)$/g,"").split(",").filter(Boolean).map(n=>t.parseRef(n));return new oT(A[0]==="$"?"":t.parseString(A[0]),i)}toStep(){return`FILL_AREA_STYLE(${Wn(this.name)},(${this.items.join(",")}))`}}$o("FILL_AREA_STYLE",oT.parse.bind(oT));class sT extends Po{constructor(A,t){super(),this.name=A,this.colour=t,this.type="FILL_AREA_STYLE_COLOUR"}static parse(A,t){return new sT(t.parseString(A[0]),t.parseRef(A[1]))}toStep(){return`FILL_AREA_STYLE_COLOUR(${Wn(this.name)},${this.colour})`}}$o("FILL_AREA_STYLE_COLOUR",sT.parse.bind(sT));class rT extends Po{constructor(A,t,i){super(),this.name=A,this.items=t,this.contextOfItems=i,this.type="MECHANICAL_DESIGN_GEOMETRIC_PRESENTATION_REPRESENTATION"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=A[1].replace(/^\(|\)$/g,"").split(",").filter(Boolean).map(s=>t.parseRef(s)),o=t.parseRef(A[2]);return new rT(i,n,o)}toStep(){return`MECHANICAL_DESIGN_GEOMETRIC_PRESENTATION_REPRESENTATION(${Wn(this.name)},(${this.items.join(",")}),${this.contextOfItems})`}}$o("MECHANICAL_DESIGN_GEOMETRIC_PRESENTATION_REPRESENTATION",rT.parse.bind(rT));class aT extends Po{constructor(A){super(),this.items=A,this.type="PRESENTATION_STYLE_ASSIGNMENT"}static parse(A,t){const i=A[0].replace(/^\(|\)$/g,"").split(",").filter(Boolean).map(n=>t.parseRef(n));return new aT(i)}toStep(){return`PRESENTATION_STYLE_ASSIGNMENT((${this.items.join(",")}))`}}$o("PRESENTATION_STYLE_ASSIGNMENT",aT.parse.bind(aT));class gT extends Po{constructor(A,t,i){super(),this.name=A,this.styles=t,this.item=i,this.type="STYLED_ITEM"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=A[1].replace(/^\(|\)$/g,"").split(",").filter(Boolean).map(s=>t.parseRef(s)),o=t.parseRef(A[2]);return new gT(i,n,o)}toStep(){return`STYLED_ITEM(${Wn(this.name)},(${this.styles.join(",")}),${this.item})`}}$o("STYLED_ITEM",gT.parse.bind(gT));class cT extends Po{constructor(A,t){super(),this.name=A,this.styles=t,this.type="SURFACE_SIDE_STYLE"}static parse(A,t){const i=A[1].replace(/^\(|\)$/g,"").split(",").filter(Boolean).map(n=>t.parseRef(n));return new cT(A[0]==="$"?"":t.parseString(A[0]),i)}toStep(){return`SURFACE_SIDE_STYLE(${Wn(this.name)},(${this.styles.join(",")}))`}}$o("SURFACE_SIDE_STYLE",cT.parse.bind(cT));class IT extends Po{constructor(A){super(),this.style=A,this.type="SURFACE_STYLE_FILL_AREA"}static parse(A,t){return new IT(t.parseRef(A[0]))}toStep(){return`SURFACE_STYLE_FILL_AREA(${this.style})`}}$o("SURFACE_STYLE_FILL_AREA",IT.parse.bind(IT));class lT extends Po{constructor(A,t){super(),this.side=A,this.style=t,this.type="SURFACE_STYLE_USAGE"}static parse(A,t){return new lT(A[0].trim(),t.parseRef(A[1]))}toStep(){return`SURFACE_STYLE_USAGE(${this.side},${this.style})`}}$o("SURFACE_STYLE_USAGE",lT.parse.bind(lT));class BT extends Po{constructor(A,t,i){super(),this.name=A,this.items=t,this.context=i,this.type="ADVANCED_BREP_SHAPE_REPRESENTATION"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=A[1].replace(/^\(|\)$/g,"").split(",").filter(Boolean).map(s=>t.parseRef(s)),o=t.parseRef(A[2]);return new BT(i,n,o)}toStep(){return`ADVANCED_BREP_SHAPE_REPRESENTATION(${Wn(this.name)},(${this.items.join(",")}),${this.context})`}}$o("ADVANCED_BREP_SHAPE_REPRESENTATION",BT.parse.bind(BT));class CT extends Po{constructor(A){super(),this.application=A,this.type="APPLICATION_CONTEXT"}static parse(A,t){const i=t.parseString(A[0]);return new CT(i)}toStep(){return`APPLICATION_CONTEXT(${Wn(this.application)})`}}$o("APPLICATION_CONTEXT",CT.parse.bind(CT));class QT extends Po{constructor(A,t,i,n){super(),this.status=A,this.applicationInterpretedModelSchemaName=t,this.applicationProtocolYear=i,this.application=n,this.type="APPLICATION_PROTOCOL_DEFINITION"}static parse(A,t){const i=t.parseString(A[0]),n=t.parseString(A[1]),o=t.parseNumber(A[2]),s=t.parseRef(A[3]);return new QT(i,n,o,s)}toStep(){return`APPLICATION_PROTOCOL_DEFINITION(${Wn(this.status)},${Wn(this.applicationInterpretedModelSchemaName)},${this.applicationProtocolYear},${this.application})`}}$o("APPLICATION_PROTOCOL_DEFINITION",QT.parse.bind(QT));class gz extends Po{constructor(A,t){super(),this.representationRelation=A,this.representedProductRelation=t,this.type="CONTEXT_DEPENDENT_SHAPE_REPRESENTATION"}static parse(A,t){const i=t.parseRef(A[0]),n=t.parseRef(A[1]);return new gz(i,n)}toStep(){return`CONTEXT_DEPENDENT_SHAPE_REPRESENTATION(${this.representationRelation},${this.representedProductRelation})`}}$o("CONTEXT_DEPENDENT_SHAPE_REPRESENTATION",gz.parse.bind(gz));class cz extends Po{constructor(A,t,i,n){super(),this.name=A,this.description=t,this.transformItem1=i,this.transformItem2=n,this.type="ITEM_DEFINED_TRANSFORMATION"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=A[1]==="$"?"":t.parseString(A[1]),o=t.parseRef(A[2]),s=t.parseRef(A[3]);return new cz(i,n,o,s)}toStep(){return`ITEM_DEFINED_TRANSFORMATION(${Wn(this.name)},${Wn(this.description)},${this.transformItem1},${this.transformItem2})`}}$o("ITEM_DEFINED_TRANSFORMATION",cz.parse.bind(cz));class Iz extends Po{constructor(A,t,i,n,o,s){super(),this.id=A,this.name=t,this.description=i,this.relatingProductDefinition=n,this.relatedProductDefinition=o,this.referenceDesignator=s,this.type="NEXT_ASSEMBLY_USAGE_OCCURRENCE"}static parse(A,t){const i=t.parseString(A[0]),n=t.parseString(A[1]),o=A[2]==="$"?"":t.parseString(A[2]),s=t.parseRef(A[3]),r=t.parseRef(A[4]),a=A[5]==="$"?"":t.parseString(A[5]);return new Iz(i,n,o,s,r,a)}toStep(){return`NEXT_ASSEMBLY_USAGE_OCCURRENCE(${Wn(this.id)},${Wn(this.name)},${this.description?Wn(this.description):"$"},${this.relatingProductDefinition},${this.relatedProductDefinition},${this.referenceDesignator?Wn(this.referenceDesignator):"$"})`}}$o("NEXT_ASSEMBLY_USAGE_OCCURRENCE",Iz.parse.bind(Iz));class hT extends Po{constructor(A,t,i,n){super(),this.name=A,this.id=t,this.description=i,this.frameOfReference=n,this.type="PRODUCT"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=A[1]==="$"?"":t.parseString(A[1]),o=A[2]==="$"?"":t.parseString(A[2]),s=A[3].replace(/^\(|\)$/g,"").split(",").filter(Boolean).map(r=>t.parseRef(r.trim()));return new hT(i,n,o,s)}toStep(){return`PRODUCT(${Wn(this.name)},${Wn(this.id)},${Wn(this.description)},(${this.frameOfReference.join(",")}))`}}$o("PRODUCT",hT.parse.bind(hT));class ET extends Po{constructor(A,t,i){super(),this.name=A,this.frameOfReference=t,this.disciplineType=i,this.type="PRODUCT_CONTEXT"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=t.parseRef(A[1]),o=t.parseString(A[2]);return new ET(i,n,o)}toStep(){return`PRODUCT_CONTEXT(${Wn(this.name)},${this.frameOfReference},${Wn(this.disciplineType)})`}}$o("PRODUCT_CONTEXT",ET.parse.bind(ET));class uT extends Po{constructor(A,t,i,n){super(),this.id=A,this.description=t,this.formation=i,this.frameOfReference=n,this.type="PRODUCT_DEFINITION"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=A[1]==="$"?"":t.parseString(A[1]),o=t.parseRef(A[2]),s=t.parseRef(A[3]);return new uT(i,n,o,s)}toStep(){return`PRODUCT_DEFINITION(${Wn(this.id)},${Wn(this.description)},${this.formation},${this.frameOfReference})`}}$o("PRODUCT_DEFINITION",uT.parse.bind(uT));class dT extends Po{constructor(A,t,i){super(),this.name=A,this.frameOfReference=t,this.lifecycleStage=i,this.type="PRODUCT_DEFINITION_CONTEXT"}static parse(A,t){const i=t.parseString(A[0]),n=t.parseRef(A[1]),o=t.parseString(A[2]);return new dT(i,n,o)}toStep(){return`PRODUCT_DEFINITION_CONTEXT(${Wn(this.name)},${this.frameOfReference},${Wn(this.lifecycleStage)})`}}$o("PRODUCT_DEFINITION_CONTEXT",dT.parse.bind(dT));class pT extends Po{constructor(A,t,i){super(),this.id=A,this.description=t,this.ofProduct=i,this.type="PRODUCT_DEFINITION_FORMATION"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=A[1]==="$"?"":t.parseString(A[1]),o=t.parseRef(A[2]);return new pT(i,n,o)}toStep(){return`PRODUCT_DEFINITION_FORMATION(${Wn(this.id)},${Wn(this.description)},${this.ofProduct})`}}$o("PRODUCT_DEFINITION_FORMATION",pT.parse.bind(pT));class fT extends Po{constructor(A,t,i){super(),this.name=A,this.description=t,this.definition=i,this.type="PRODUCT_DEFINITION_SHAPE"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=A[1]==="$"?"":t.parseString(A[1]),o=t.parseRef(A[2]);return new fT(i,n,o)}toStep(){return`PRODUCT_DEFINITION_SHAPE(${Wn(this.name)},${Wn(this.description)},${this.definition})`}}$o("PRODUCT_DEFINITION_SHAPE",fT.parse.bind(fT));class lz extends Po{constructor(A,t,i){super(),this.name=A,this.description=t,this.products=i,this.type="PRODUCT_RELATED_PRODUCT_CATEGORY"}static parse(A,t){const i=t.parseString(A[0]),n=A[1]==="$"?"":t.parseString(A[1]),o=A[2].replace(/^\(|\)$/g,"").split(",").filter(Boolean).map(s=>t.parseRef(s));return new lz(i,n,o)}toStep(){return`PRODUCT_RELATED_PRODUCT_CATEGORY(${Wn(this.name)},${this.description?Wn(this.description):"$"},(${this.products.join(",")}))`}}$o("PRODUCT_RELATED_PRODUCT_CATEGORY",lz.parse.bind(lz));class yT extends Po{constructor(A,t){super(),this.definition=A,this.usedRepresentation=t,this.type="SHAPE_DEFINITION_REPRESENTATION"}static parse(A,t){const i=t.parseRef(A[0]),n=t.parseRef(A[1]);return new yT(i,n)}toStep(){return`SHAPE_DEFINITION_REPRESENTATION(${this.definition},${this.usedRepresentation})`}}$o("SHAPE_DEFINITION_REPRESENTATION",yT.parse.bind(yT));class Bz extends Po{constructor(A,t,i){super(),this.name=A,this.items=t,this.contextOfItems=i,this.type="SHAPE_REPRESENTATION"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=A[1].replace(/^\(|\)$/g,"").split(",").filter(Boolean).map(s=>t.parseRef(s)),o=t.parseRef(A[2]);return new Bz(i,n,o)}toStep(){return`SHAPE_REPRESENTATION(${Wn(this.name)},(${this.items.join(",")}),${this.contextOfItems})`}}$o("SHAPE_REPRESENTATION",Bz.parse.bind(Bz));class dw extends Po{constructor(A,t,i,n){super(),this.name=A,this.bounds=t,this.surface=i,this.sameSense=n,this.type="ADVANCED_FACE"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=A[1].replace(/^\(|\)$/g,"").split(",").filter(Boolean).map(r=>t.parseRef(r.trim())),o=t.parseRef(A[2]),s=A[3].trim()===".T.";return new dw(i,n,o,s)}toStep(){return`ADVANCED_FACE(${this.name?`'${this.name}'`:"''"},(${this.bounds.join(",")}),${this.surface},${this.sameSense?".T.":".F."})`}}$o("ADVANCED_FACE",dw.parse.bind(dw));class H1 extends Po{constructor(A,t){super(),this.name=A,this.faces=t,this.type="CLOSED_SHELL"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=A[1].replace(/^\(|\)$/g,"").split(",").filter(Boolean).map(o=>t.parseRef(o.trim()));return new H1(i,n)}toStep(){return`CLOSED_SHELL(${this.name?`'${this.name}'`:"''"},(${this.faces.join(",")}))`}}$o("CLOSED_SHELL",H1.parse.bind(H1));class BB extends Po{constructor(A,t,i,n,o){super(),this.name=A,this.start=t,this.end=i,this.curve=n,this.sameSense=o,this.type="EDGE_CURVE"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=t.parseRef(A[1]),o=t.parseRef(A[2]),s=t.parseRef(A[3]),r=A[4].trim()===".T.";return new BB(i,n,o,s,r)}toStep(){return`EDGE_CURVE(${this.name?`'${this.name}'`:"''"},${this.start},${this.end},${this.curve},${this.sameSense?".T.":".F."})`}}$o("EDGE_CURVE",BB.parse.bind(BB));class _f extends Po{constructor(A,t){super(),this.name=A,this.edges=t,this.type="EDGE_LOOP"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=A[1].replace(/^\(|\)$/g,"").split(",").filter(Boolean).map(o=>t.parseRef(o));return new _f(i,n)}toStep(){return`EDGE_LOOP(${Wn(this.name)},(${this.edges.join(",")}))`}}$o("EDGE_LOOP",_f.parse.bind(_f));class Ik extends Po{constructor(A,t,i){super(),this.name=A,this.bound=t,this.sameSense=i,this.type="FACE_BOUND"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]);return new Ik(i,t.parseRef(A[1]),A[2].trim()===".T.")}toStep(){return`FACE_BOUND(${Wn(this.name)},${this.bound},${this.sameSense?".T.":".F."})`}}$o("FACE_BOUND",Ik.parse.bind(Ik));class pw extends Po{constructor(A,t,i){super(),this.name=A,this.bound=t,this.sameSense=i,this.type="FACE_OUTER_BOUND"}static parse(A,t){return new pw(t.parseString(A[0]),t.parseRef(A[1]),A[2].trim()===".T.")}toStep(){return`FACE_OUTER_BOUND('${this.name}',${this.bound},${this.sameSense?".T.":".F."})`}}$o("FACE_OUTER_BOUND",pw.parse.bind(pw));class jG extends Po{constructor(A,t){super(),this.name=A,this.outer=t,this.type="MANIFOLD_SOLID_BREP"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]);return new jG(i,t.parseRef(A[1]))}toStep(){return`MANIFOLD_SOLID_BREP(${Wn(this.name)},${this.outer})`}}$o("MANIFOLD_SOLID_BREP",jG.parse.bind(jG));class Xc extends Po{constructor(A,t,i){super(),this.name=A,this.edge=t,this.orientation=i,this.type="ORIENTED_EDGE"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]),n=t.parseRef(A[3]),o=A[4]?.trim?.()===".T."||A[2]?.trim?.()===".T.";return new Xc(i,n,o)}toStep(){return`ORIENTED_EDGE(${Wn(this.name)},*,*,${this.edge},${this.orientation?".T.":".F."})`}}$o("ORIENTED_EDGE",Xc.parse.bind(Xc));class Rr extends Po{constructor(A,t){super(),this.name=A,this.pnt=t,this.type="VERTEX_POINT"}static parse(A,t){const i=A[0]==="$"?"":t.parseString(A[0]);return new Rr(i,t.parseRef(A[1]))}toStep(){return`VERTEX_POINT(${this.name?`'${this.name}'`:"''"},${this.pnt})`}}$o("VERTEX_POINT",Rr.parse.bind(Rr));class lk extends Po{constructor(A,t){super(),this.type=A,this.args=t}toStep(){return this.args.length===1&&this.args[0].startsWith("( ")?`(
5838
5838
  ${this.args[0].slice(2,-2).trim().split(/\s+(?=[A-Z_])/g).join(`
5839
5839
  `)}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@tscircuit/runframe",
3
3
  "main": "dist/preview.js",
4
4
  "type": "module",
5
- "version": "0.0.1620",
5
+ "version": "0.0.1621",
6
6
  "exports": {
7
7
  ".": "./dist/preview.js",
8
8
  "./preview": "./dist/preview.js",
@@ -72,7 +72,7 @@
72
72
  "circuit-json-to-kicad": "^0.0.72",
73
73
  "circuit-json-to-lbrn": "^0.0.4",
74
74
  "circuit-json-to-pnp-csv": "^0.0.7",
75
- "circuit-json-to-step": "^0.0.16",
75
+ "circuit-json-to-step": "^0.0.18",
76
76
  "class-variance-authority": "^0.7.1",
77
77
  "clsx": "^2.1.1",
78
78
  "cmdk": "^1.1.1",
@@ -108,7 +108,7 @@
108
108
  "schematic-symbols": "^0.0.202",
109
109
  "serve": "^14.2.4",
110
110
  "source-map-explorer": "^2.5.3",
111
- "stepts": "^0.0.2",
111
+ "stepts": "^0.0.3",
112
112
  "tailwind-merge": "^2.6.0",
113
113
  "tailwindcss": "^3.4.17",
114
114
  "tailwindcss-animate": "^1.0.7",