@codefrydev/svg-engine 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/wc.js CHANGED
@@ -1 +1 @@
1
- import {forwardRef,useState,useEffect,useMemo,useImperativeHandle,useRef,useCallback,createRef}from'react';import {jsxs,Fragment,jsx}from'react/jsx-runtime';import {createRoot}from'react-dom/client';var Me={name:"Mechanics",elements:[{id:1,type:"wedge",x1:100,y1:400,x2:500,y2:100,label:"M",value:"",color:"#0f172a",strokeWidth:2},{id:2,type:"block",x1:220,y1:260,x2:300,y2:300,label:"m",value:"",color:"#0f172a",strokeWidth:2,rotation:-37},{id:3,type:"vector",x1:260,y1:280,x2:260,y2:400,label:"mg",value:"",color:"#0f172a",strokeWidth:2},{id:4,type:"vector",x1:260,y1:280,x2:212,y2:216,label:"N",value:"",color:"#0f172a",strokeWidth:2},{id:5,type:"vector",x1:260,y1:280,x2:180,y2:340,label:"f",value:"",color:"#0f172a",strokeWidth:2},{id:6,type:"arc",x1:100,y1:400,x2:260,y2:280,label:"\u03B8",value:"",color:"#0f172a",strokeWidth:2},{id:7,type:"dashed",x1:260,y1:280,x2:308,y2:344,label:"",value:"",color:"#0f172a",strokeWidth:2},{id:8,type:"dashed",x1:260,y1:280,x2:340,y2:220,label:"",value:"",color:"#0f172a",strokeWidth:2},{id:9,type:"dimension",x1:100,y1:440,x2:500,y2:440,label:"L",value:"",color:"#0f172a",strokeWidth:2},{id:10,type:"axes",x1:60,y1:100,x2:60,y2:100,label:"",value:"",color:"#0f172a",strokeWidth:2}],toolCategories:[{name:"Sketch and forces",tools:[{id:"select",name:"Select"},{id:"string",name:"String / Line"},{id:"spring",name:"Spring"},{id:"vector",name:"Force Vector"},{id:"dashed",name:"Dashed Line"},{id:"dimension",name:"Dimension"},{id:"surface",name:"Rigid Surface"}]},{name:"Rigid bodies",tools:[{id:"wedge",name:"Wedge / Incline"},{id:"axes",name:"Axes / Frame"},{id:"block",name:"Mass / Block"},{id:"cart",name:"Cart / Vehicle"},{id:"particle",name:"Point Mass"},{id:"disk",name:"Disk / Sphere"},{id:"rod",name:"Rod / Beam"},{id:"pulley",name:"Pulley"}]},{name:"Points and labels",tools:[{id:"pivot",name:"Pivot / Hinge"},{id:"com",name:"Center of Mass"},{id:"arc",name:"Angle / Arc"},{id:"text",name:"Label"}]}]};var Se={name:"Circuit",elements:[{id:1,type:"resistor",x1:200,y1:300,x2:400,y2:200,label:"R1",value:"60\u03A9"},{id:2,type:"resistor",x1:200,y1:300,x2:400,y2:400,label:"R3",value:"300\u03A9"},{id:3,type:"resistor",x1:400,y1:200,x2:600,y2:300,label:"R2",value:"100\u03A9"},{id:4,type:"resistor",x1:400,y1:400,x2:600,y2:300,label:"R4",value:"500\u03A9"},{id:5,type:"battery",x1:400,y1:400,x2:400,y2:200,label:"50V",value:""},{id:6,type:"wire",x1:200,y1:300,x2:200,y2:100,label:"",value:""},{id:7,type:"wire",x1:200,y1:100,x2:340,y2:100,label:"",value:""},{id:8,type:"meter_v",x1:340,y1:100,x2:460,y2:100,label:"",value:""},{id:9,type:"wire",x1:460,y1:100,x2:600,y2:100,label:"",value:""},{id:10,type:"wire",x1:600,y1:100,x2:600,y2:300,label:"",value:""},{id:11,type:"text",x1:180,y1:300,x2:180,y2:300,label:"S",value:"",fontFamily:"sans-serif",fontWeight:"bold",fontSize:18},{id:12,type:"text",x1:400,y1:180,x2:400,y2:180,label:"P",value:"",fontFamily:"sans-serif",fontWeight:"bold",fontSize:18},{id:13,type:"text",x1:400,y1:420,x2:400,y2:420,label:"Q",value:"",fontFamily:"sans-serif",fontWeight:"bold",fontSize:18},{id:14,type:"text",x1:620,y1:300,x2:620,y2:300,label:"T",value:"",fontFamily:"sans-serif",fontWeight:"bold",fontSize:18}],toolCategories:[{name:"Circuit",tools:[{id:"select",name:"Select / Move"},{id:"wire",name:"Wire"},{id:"resistor",name:"Resistor"},{id:"capacitor",name:"Capacitor"},{id:"inductor",name:"Inductor"},{id:"diode",name:"Diode"},{id:"battery",name:"Battery"},{id:"meter_v",name:"Voltmeter"},{id:"meter_a",name:"Ammeter"},{id:"ground",name:"Ground"},{id:"text",name:"Text Label"}]}]};var we={name:"Thermodynamics",elements:[{id:101,type:"text",x1:50,y1:40,x2:50,y2:40,label:"1. First Law (Piston/Cylinder)",fontSize:20,color:"#1e293b"},{id:1,type:"piston_cylinder",x1:80,y1:100,x2:240,y2:260,compression:.6,showHeat:true,color:"#0ea5e9",strokeWidth:2,label:"Gas Expansion"},{id:102,type:"text",x1:380,y1:40,x2:380,y2:40,label:"2. Heat Engine & 2nd Law",fontSize:20,color:"#1e293b"},{id:2,type:"heat_engine",x1:440,y1:80,x2:540,y2:260,engineType:"engine",efficiency:.4,color:"#10b981",strokeWidth:2,label:"Carnot Engine"},{id:103,type:"text",x1:700,y1:40,x2:700,y2:40,label:"3. P-V Diagrams",fontSize:20,color:"#1e293b"},{id:3,type:"pv_axes",x1:720,y1:260,x2:920,y2:80,color:"#1e293b",strokeWidth:2,label:"P vs V",xLabel:"V",yLabel:"P"},{id:4,type:"carnot_cycle",x1:760,y1:120,x2:880,y2:220,color:"#ec4899",strokeWidth:2},{id:104,type:"text",x1:50,y1:340,x2:50,y2:340,label:"4. Kinetic Theory & Speeds",fontSize:20,color:"#1e293b"},{id:5,type:"maxwell_boltzmann",x1:80,y1:520,x2:320,y2:380,t1:300,t2:600,color:"#8b5cf6",strokeWidth:2,label:"f(v) vs v"},{id:6,type:"diatomic_gas",x1:400,y1:440,x2:500,y2:440,color:"#f59e0b",strokeWidth:2,label:"Diatomic (5 DOF)",showRotations:true},{id:105,type:"text",x1:700,y1:340,x2:700,y2:340,label:"5. Thermal Conduction",fontSize:20,color:"#1e293b"},{id:7,type:"conduction_rod",x1:700,y1:420,x2:900,y2:460,color:"#3b82f6",strokeWidth:2,label:"L, k, A"}],toolCategories:[{name:"Basics",tools:[{id:"select",name:"Select"},{id:"point",name:"Node / Label"},{id:"line",name:"Line / Axis"},{id:"text",name:"Text Box"}]},{name:"Systems",tools:[{id:"piston_cylinder",name:"Piston & Gas"},{id:"heat_engine",name:"Heat Engine"},{id:"conduction_rod",name:"Thermal Rod"}]},{name:"PV Diagrams",tools:[{id:"pv_axes",name:"P-V Axes"},{id:"thermo_process",name:"Thermodynamic Path"},{id:"carnot_cycle",name:"Carnot Cycle"}]},{name:"KTG",tools:[{id:"maxwell_boltzmann",name:"Maxwell Dist."},{id:"diatomic_gas",name:"Diatomic DOF"},{id:"random_walk",name:"Random Walk"}]}]};var _e={name:"Optical",elements:[{id:1,type:"line",x1:50,y1:300,x2:750,y2:300,lineStyle:"dashed",color:"#94a3b8",strokeWidth:2},{id:2,type:"lens_convex",x1:400,y1:150,x2:400,y2:450,color:"#38bdf8",strokeWidth:2},{id:3,type:"point",x1:250,y1:300,x2:250,y2:300,label:"2F\u2081",color:"#64748b"},{id:4,type:"point",x1:325,y1:300,x2:325,y2:300,label:"F\u2081",color:"#64748b"},{id:5,type:"point",x1:475,y1:300,x2:475,y2:300,label:"F\u2082",color:"#64748b"},{id:6,type:"point",x1:550,y1:300,x2:550,y2:300,label:"2F\u2082",color:"#64748b"},{id:7,type:"vector",x1:250,y1:300,x2:250,y2:200,label:"O",color:"#10b981",strokeWidth:3},{id:8,type:"ray",x1:250,y1:200,x2:400,y2:200,color:"#ef4444",strokeWidth:2},{id:9,type:"ray",x1:400,y1:200,x2:625,y2:500,color:"#ef4444",strokeWidth:2},{id:10,type:"ray",x1:250,y1:200,x2:625,y2:450,color:"#ef4444",strokeWidth:2},{id:11,type:"vector",x1:550,y1:300,x2:550,y2:400,label:"I",color:"#f59e0b",strokeWidth:3,lineStyle:"dashed"},{id:12,type:"nucleus",x1:120,y1:500,x2:120,y2:500,label:"Atom",color:"#3b82f6",strokeWidth:2},{id:13,type:"photon",x1:160,y1:500,x2:280,y2:460,label:"\u03B3",color:"#8b5cf6",strokeWidth:2},{id:14,type:"slit_double",x1:600,y1:460,x2:600,y2:580,color:"#0f172a",strokeWidth:4},{id:15,type:"photon",x1:510,y1:520,x2:590,y2:520,label:"\u03BB",color:"#eab308",strokeWidth:2}],toolCategories:[{name:"Basics",tools:[{id:"select",name:"Select/Move"},{id:"point",name:"Point/Node"},{id:"line",name:"Solid Line"},{id:"vector",name:"Vector/Object"},{id:"text",name:"Text Label"}]},{name:"Optics",tools:[{id:"ray",name:"Light Ray"},{id:"lens_convex",name:"Convex Lens"},{id:"lens_concave",name:"Concave Lens"},{id:"mirror_plane",name:"Plane Mirror"},{id:"mirror_concave",name:"Concave Mirror"},{id:"mirror_convex",name:"Convex Mirror"},{id:"prism",name:"Glass Prism"},{id:"glass_slab",name:"Glass Slab"}]},{name:"Modern Physics",tools:[{id:"photon",name:"Photon (Wavy)"},{id:"slit_double",name:"Double Slit"},{id:"slit_single",name:"Single Slit"},{id:"energy_level",name:"Energy Level"},{id:"nucleus",name:"Atom/Nucleus"}]}]};var Ce={name:"Magnetism",elements:[{id:1,type:"pole_piece",x1:100,y1:80,x2:200,y2:300,label:"N",color:"#0f172a",strokeWidth:2},{id:2,type:"pole_piece",x1:500,y1:80,x2:600,y2:300,label:"S",color:"#0f172a",strokeWidth:2},{id:3,type:"b_field_line",x1:200,y1:120,x2:500,y2:120,label:"",color:"#10b981",strokeWidth:2},{id:4,type:"b_field_line",x1:200,y1:190,x2:500,y2:190,label:"B",color:"#10b981",strokeWidth:2,fontSize:18},{id:5,type:"b_field_line",x1:200,y1:260,x2:500,y2:260,label:"",color:"#10b981",strokeWidth:2},{id:6,type:"b_field_curve",x1:280,y1:80,x2:420,y2:80,curveHeight:50,label:"",color:"#10b981",strokeWidth:2},{id:7,type:"b_field_curve",x1:250,y1:80,x2:450,y2:80,curveHeight:110,label:"",color:"#10b981",strokeWidth:2},{id:8,type:"axes_3d",x1:200,y1:540,x2:300,y2:540,label:"",color:"#64748b",strokeWidth:2,fontSize:16},{id:9,type:"line",x1:200,y1:540,x2:200,y2:400,label:"",color:"#0ea5e9",strokeWidth:3},{id:10,type:"line",x1:200,y1:400,x2:320,y2:400,label:"i",color:"#0ea5e9",strokeWidth:3,fontSize:16},{id:11,type:"line",x1:320,y1:400,x2:320,y2:540,label:"",color:"#0ea5e9",strokeWidth:3},{id:12,type:"line",x1:320,y1:540,x2:200,y2:540,label:"",color:"#0ea5e9",strokeWidth:3},{id:13,type:"vector",x1:200,y1:540,x2:320,y2:620,label:"B",color:"#10b981",strokeWidth:2.5,fontSize:18}],toolCategories:[{name:"Basics",tools:[{id:"select",name:"Select/Move"},{id:"point",name:"Point/Node"},{id:"line",name:"Solid Line"},{id:"vector",name:"Vector/Force"},{id:"text",name:"Text Label"}]},{name:"Magnetism",tools:[{id:"axes_3d",name:"3D Axes (x,y,z)"},{id:"angle",name:"Angle/Arc"},{id:"b_field_line",name:"B-Line (Straight)"},{id:"b_field_curve",name:"B-Line (Curved)"},{id:"bezier",name:"Bezier Curve"},{id:"pole_piece",name:"Pole Piece (N/S)"},{id:"b_region_in",name:"B-Field (IN)"},{id:"b_region_out",name:"B-Field (OUT)"},{id:"current_wire",name:"Wire (with I)"}]},{name:"Magnets & circuits",tools:[{id:"bar_magnet",name:"Bar Magnet"},{id:"coil",name:"Coil/Inductor"},{id:"charge_plus",name:"+ Charge"},{id:"charge_minus",name:"- Charge"},{id:"resistor",name:"Resistor"},{id:"capacitor",name:"Capacitor"},{id:"ac_source",name:"AC Source"},{id:"meter",name:"Galvano/Meter"},{id:"ground",name:"Ground"}]},{name:"Drawing",tools:[{id:"circle",name:"Circle/Loop"},{id:"axes",name:"2D Axes"}]}]};var Zt=[{name:"Ch 34: Lens Combination (JEE Classic)",elements:[{id:1,type:"line",x1:50,y1:300,x2:850,y2:300,lineStyle:"dashed",color:"#94a3b8",strokeWidth:2},{id:2,type:"lens_convex",x1:300,y1:150,x2:300,y2:450,color:"#38bdf8",strokeWidth:2,label:"f\u2081 = +30cm"},{id:3,type:"lens_concave",x1:500,y1:150,x2:500,y2:450,color:"#38bdf8",strokeWidth:2,label:"f\u2082 = -10cm"},{id:4,type:"ray",x1:50,y1:200,x2:300,y2:200,color:"#ef4444",strokeWidth:2},{id:5,type:"ray",x1:50,y1:400,x2:300,y2:400,color:"#ef4444",strokeWidth:2},{id:6,type:"ray",x1:300,y1:200,x2:500,y2:266,color:"#ef4444",strokeWidth:2},{id:7,type:"ray",x1:300,y1:400,x2:500,y2:334,color:"#ef4444",strokeWidth:2},{id:8,type:"ray",x1:500,y1:266,x2:800,y2:266,color:"#ef4444",strokeWidth:2},{id:9,type:"ray",x1:500,y1:334,x2:800,y2:334,color:"#ef4444",strokeWidth:2},{id:10,type:"line",x1:500,y1:266,x2:600,y2:300,lineStyle:"dashed",color:"#ef4444",strokeWidth:2},{id:11,type:"line",x1:500,y1:334,x2:600,y2:300,lineStyle:"dashed",color:"#ef4444",strokeWidth:2},{id:12,type:"point",x1:600,y1:300,x2:600,y2:300,label:"Virtual Object",color:"#64748b"}]},{name:"Ch 34: Concave Mirror (Real Image)",elements:[{id:1,type:"line",x1:50,y1:300,x2:700,y2:300,lineStyle:"dashed",color:"#94a3b8",strokeWidth:2},{id:2,type:"mirror_concave",x1:600,y1:150,x2:600,y2:450,curveHeight:40,color:"#0f172a",strokeWidth:2},{id:3,type:"point",x1:400,y1:300,x2:400,y2:300,label:"C",color:"#64748b"},{id:4,type:"point",x1:500,y1:300,x2:500,y2:300,label:"F",color:"#64748b"},{id:5,type:"vector",x1:300,y1:300,x2:300,y2:200,label:"O",color:"#10b981",strokeWidth:3},{id:6,type:"ray",x1:300,y1:200,x2:600,y2:200,color:"#ef4444",strokeWidth:2},{id:7,type:"ray",x1:600,y1:200,x2:400,y2:400,color:"#ef4444",strokeWidth:2},{id:8,type:"ray",x1:300,y1:200,x2:400,y2:300,color:"#3b82f6",strokeWidth:2},{id:9,type:"ray",x1:400,y1:300,x2:600,y2:500,color:"#3b82f6",strokeWidth:2},{id:10,type:"ray",x1:600,y1:500,x2:450,y2:350,color:"#3b82f6",strokeWidth:2},{id:11,type:"vector",x1:450,y1:300,x2:450,y2:350,label:"I",color:"#f59e0b",strokeWidth:3}]},{name:"Ch 34: Apparent Depth (Refraction)",elements:[{id:1,type:"glass_slab",x1:50,y1:300,x2:850,y2:600,color:"#38bdf8",label:"Water (\u03BC = 4/3)",strokeWidth:2},{id:2,type:"point",x1:450,y1:500,x2:450,y2:500,label:"Real Object",color:"#0f172a"},{id:3,type:"ray",x1:450,y1:500,x2:450,y2:300,color:"#ef4444",strokeWidth:2},{id:4,type:"ray",x1:450,y1:300,x2:450,y2:100,color:"#ef4444",strokeWidth:2},{id:5,type:"ray",x1:450,y1:500,x2:550,y2:300,color:"#ef4444",strokeWidth:2},{id:6,type:"ray",x1:550,y1:300,x2:700,y2:150,color:"#ef4444",strokeWidth:2},{id:7,type:"line",x1:550,y1:300,x2:450,y2:400,lineStyle:"dashed",color:"#ef4444",strokeWidth:2},{id:8,type:"point",x1:450,y1:400,x2:450,y2:400,label:"Virtual Image",color:"#f59e0b"},{id:9,type:"line",x1:550,y1:200,x2:550,y2:400,lineStyle:"dashed",color:"#94a3b8",strokeWidth:1}]},{name:"Ch 35: Young's Double Slit (YDSE)",elements:[{id:1,type:"slit_double",x1:200,y1:200,x2:200,y2:400,color:"#0f172a",strokeWidth:4},{id:2,type:"line",x1:700,y1:100,x2:700,y2:500,color:"#0f172a",strokeWidth:4,label:"Screen"},{id:3,type:"line",x1:200,y1:300,x2:700,y2:300,lineStyle:"dashed",color:"#94a3b8",strokeWidth:2},{id:4,type:"point",x1:200,y1:250,x2:200,y2:250,label:"S\u2081",color:"#0f172a"},{id:5,type:"point",x1:200,y1:350,x2:200,y2:350,label:"S\u2082",color:"#0f172a"},{id:6,type:"point",x1:700,y1:150,x2:700,y2:150,label:"P (Maxima/Minima)",color:"#0f172a"},{id:7,type:"photon",x1:200,y1:250,x2:700,y2:150,color:"#eab308",strokeWidth:2},{id:8,type:"photon",x1:200,y1:350,x2:700,y2:150,color:"#eab308",strokeWidth:2},{id:9,type:"line",x1:200,y1:250,x2:240,y2:340,lineStyle:"dashed",color:"#ef4444",strokeWidth:2},{id:10,type:"text",x1:250,y1:370,x2:250,y2:370,label:"\u0394x = d sin \u03B8",color:"#ef4444",fontSize:18},{id:11,type:"text",x1:450,y1:280,x2:450,y2:280,label:"D",color:"#64748b",fontSize:20},{id:12,type:"line",x1:720,y1:300,x2:720,y2:150,lineStyle:"solid",color:"#64748b",strokeWidth:2},{id:13,type:"text",x1:740,y1:225,x2:740,y2:225,label:"y",color:"#64748b",fontSize:18}]},{name:"Ch 36: Single Slit Diffraction",elements:[{id:1,type:"slit_single",x1:300,y1:200,x2:300,y2:400,color:"#0f172a",strokeWidth:5,label:"Width a"},{id:2,type:"line",x1:700,y1:100,x2:700,y2:500,color:"#0f172a",strokeWidth:4},{id:3,type:"line",x1:100,y1:300,x2:700,y2:300,lineStyle:"dashed",color:"#94a3b8",strokeWidth:2},{id:4,type:"photon",x1:100,y1:220,x2:300,y2:220,color:"#8b5cf6",strokeWidth:2},{id:5,type:"photon",x1:100,y1:380,x2:300,y2:380,color:"#8b5cf6",strokeWidth:2},{id:6,type:"ray",x1:300,y1:220,x2:700,y2:300,color:"#ef4444",strokeWidth:2},{id:7,type:"ray",x1:300,y1:380,x2:700,y2:300,color:"#ef4444",strokeWidth:2},{id:8,type:"ray",x1:300,y1:220,x2:700,y2:150,color:"#3b82f6",strokeWidth:2},{id:9,type:"ray",x1:300,y1:380,x2:700,y2:150,color:"#3b82f6",strokeWidth:2},{id:10,type:"point",x1:700,y1:300,x2:700,y2:300,label:"Central Max",color:"#ef4444"},{id:11,type:"point",x1:700,y1:150,x2:700,y2:150,label:"1st Min (a sin \u03B8 = \u03BB)",color:"#3b82f6"}]}];var Le={name:"Light",elements:Zt[0].elements,toolCategories:[{name:"Basics",tools:[{id:"select",name:"Select/Move"},{id:"point",name:"Point/Node"},{id:"line",name:"Solid Line"},{id:"vector",name:"Vector/Object"},{id:"text",name:"Text Label"}]},{name:"Optics",tools:[{id:"ray",name:"Light Ray"},{id:"lens_convex",name:"Convex Lens"},{id:"lens_concave",name:"Concave Lens"},{id:"mirror_plane",name:"Plane Mirror"},{id:"mirror_concave",name:"Concave Mirror"},{id:"mirror_convex",name:"Convex Mirror"},{id:"prism",name:"Glass Prism"},{id:"glass_slab",name:"Glass Slab"}]},{name:"Modern Physics",tools:[{id:"photon",name:"Photon (Wavy)"},{id:"slit_double",name:"Double Slit"},{id:"slit_single",name:"Single Slit"},{id:"energy_level",name:"Energy Level"},{id:"nucleus",name:"Atom/Nucleus"}]}]};var ze={name:"Waves",elements:[{id:1,type:"line",x1:100,y1:300,x2:800,y2:300,color:"#64748b",strokeWidth:2},{id:2,type:"slit_double",x1:200,y1:200,x2:200,y2:400,color:"#0f172a",strokeWidth:4},{id:3,type:"photon",x1:200,y1:250,x2:700,y2:150,color:"#eab308",strokeWidth:2}],toolCategories:[{name:"Waves",tools:[{id:"select",name:"Select"},{id:"line",name:"Axis"},{id:"slit_double",name:"Double Slit"},{id:"photon",name:"Wave Ray"},{id:"text",name:"Text"}]}]};var De={name:"Oscillations & Waves",elements:[{id:101,type:"text",x1:50,y1:40,x2:50,y2:40,label:"1. SHM Kinematics & Freeze-Frames",fontSize:20,color:"#1e293b"},{id:1,type:"strobe_shm",x1:120,y1:80,x2:120,y2:280,amplitude:60,loops:1,color:"#f59e0b",strokeWidth:2,label:"Motion"},{id:2,type:"shm_graph",x1:260,y1:180,x2:460,y2:180,amplitude:60,loops:1,graphType:"all",color:"#1e293b",strokeWidth:2,label:"x(t), v(t), a(t)"},{id:102,type:"text",x1:540,y1:40,x2:540,y2:40,label:"2. Oscillators & Projections",fontSize:20,color:"#1e293b"},{id:3,type:"pendulum",x1:600,y1:80,x2:660,y2:220,label:"m",color:"#0ea5e9",strokeWidth:2,size:15,showForces:true},{id:4,type:"phasor",x1:800,y1:150,x2:860,y2:90,label:"\u03C9t",color:"#8b5cf6",strokeWidth:2,showProjection:true},{id:103,type:"text",x1:50,y1:340,x2:50,y2:340,label:"3. Energy & Damped Systems",fontSize:20,color:"#1e293b"},{id:5,type:"energy_graph",x1:80,y1:460,x2:280,y2:460,amplitude:80,domain:"time",color:"#1e293b",strokeWidth:2,label:"U(t) & K(t)"},{id:6,type:"vane_liquid",x1:400,y1:380,x2:480,y2:380,color:"#64748b",strokeWidth:2,label:"Damping (b)"},{id:7,type:"spring",x1:440,y1:260,x2:440,y2:380,color:"#3b82f6",strokeWidth:2,coils:6},{id:104,type:"text",x1:440,y1:240,x2:440,y2:240,label:"Rigid Support",fontSize:14,color:"#64748b"},{id:8,type:"torsion_pendulum",x1:640,y1:320,x2:640,y2:480,color:"#ec4899",strokeWidth:2,label:"Torsion Pendulum"}],toolCategories:[{name:"Basics",tools:[{id:"select",name:"Select"},{id:"point",name:"Point/Node"},{id:"line",name:"Line / Axis"},{id:"vector",name:"Vector"},{id:"text",name:"Text Label"}]},{name:"Oscillations",tools:[{id:"spring",name:"Spring"},{id:"mass_box",name:"Mass Block"},{id:"pendulum",name:"Pendulum"},{id:"torsion_pendulum",name:"Torsion Pendulum"},{id:"vane_liquid",name:"Damping Vane"},{id:"phasor",name:"Phasor"},{id:"damped_wave",name:"Damped SHM"}]},{name:"Graphs & Waves",tools:[{id:"sine_wave",name:"Sine Wave"},{id:"standing_wave",name:"Standing Wave"},{id:"wave_pulse",name:"Wave Pulse"},{id:"shm_graph",name:"SHM Kinematics"},{id:"energy_graph",name:"Energy (U/K)"},{id:"strobe_shm",name:"Strobe Motion"},{id:"wall",name:"Rigid Boundary"}]},{name:"Sound & Gases",tools:[{id:"speaker",name:"Speaker"},{id:"tuning_fork",name:"Tuning Fork"},{id:"wavefronts",name:"Wavefronts"},{id:"mach_cone",name:"Mach Cone"},{id:"beats_graph",name:"Beats Envelope"}]}]};var Ne={name:"Rotation",elements:[{id:101,type:"text",x1:60,y1:40,x2:60,y2:40,label:"1. Center of Mass & 2D Collision",fontSize:20,color:"#1e293b"},{id:1,type:"point_mass",x1:80,y1:140,x2:80,y2:140,size:25,color:"#ef4444",label:"m\u2081"},{id:2,type:"vector",x1:80,y1:140,x2:180,y2:140,color:"#ef4444",label:"u\u2081",strokeWidth:2},{id:3,type:"point_mass",x1:240,y1:100,x2:240,y2:100,size:15,color:"#3b82f6",label:"m\u2082"},{id:4,type:"dashed_path",x1:180,y1:140,x2:320,y2:80,color:"#ef4444",strokeWidth:1.5},{id:5,type:"dashed_path",x1:240,y1:100,x2:340,y2:180,color:"#3b82f6",strokeWidth:1.5},{id:6,type:"com_indicator",x1:160,y1:120,x2:160,y2:120,color:"#10b981",size:15,label:"COM"},{id:7,type:"system_boundary",x1:40,y1:60,x2:360,y2:220,color:"#94a3b8",strokeWidth:1.5},{id:102,type:"text",x1:560,y1:40,x2:560,y2:40,label:"2. Rigid Body Rotation & Torque",fontSize:20,color:"#1e293b"},{id:8,type:"pivot",x1:480,y1:140,x2:480,y2:140,color:"#64748b",size:25},{id:9,type:"uniform_rod",x1:480,y1:140,x2:740,y2:180,color:"#f59e0b",strokeWidth:12,label:"L, M"},{id:10,type:"vector",x1:740,y1:180,x2:740,y2:260,color:"#ef4444",label:"mg",strokeWidth:2},{id:11,type:"curve_arrow",x1:480,y1:140,x2:540,y2:200,color:"#8b5cf6",strokeWidth:2,label:"\u03B1"},{id:103,type:"text",x1:60,y1:300,x2:60,y2:300,label:"3. Rolling on Inclined Plane",fontSize:20,color:"#1e293b"},{id:12,type:"inclined_wedge",x1:60,y1:360,x2:360,y2:520,color:"#64748b",strokeWidth:2,label:"\u03B8"},{id:13,type:"rolling_body",x1:160,y1:390,x2:200,y2:390,color:"#3b82f6",strokeWidth:2,label:"M, R",showVelocity:true,showOmega:true},{id:14,type:"vector",x1:160,y1:410,x2:110,y2:385,color:"#ef4444",label:"f_s",strokeWidth:2},{id:104,type:"text",x1:560,y1:300,x2:560,y2:300,label:"4. Systems & Angular Momentum",fontSize:20,color:"#1e293b"},{id:15,type:"rocket",x1:500,y1:500,x2:500,y2:380,color:"#3b82f6",strokeWidth:2,label:"v(t)"},{id:16,type:"vector",x1:500,y1:500,x2:500,y2:560,color:"#f97316",strokeWidth:2,label:"u_rel dm/dt"},{id:17,type:"pulley",x1:720,y1:360,x2:760,y2:360,color:"#64748b",strokeWidth:2},{id:18,type:"block_mass",x1:660,y1:460,x2:700,y2:500,color:"#0ea5e9",label:"m\u2081"},{id:19,type:"block_mass",x1:740,y1:400,x2:780,y2:440,color:"#0ea5e9",label:"m\u2082"},{id:20,type:"line",x1:680,y1:460,x2:680,y2:360,color:"#1e293b",strokeWidth:1.5},{id:21,type:"line",x1:760,y1:400,x2:760,y2:360,color:"#1e293b",strokeWidth:1.5}],toolCategories:[{name:"Basics",tools:[{id:"select",name:"Select"},{id:"line",name:"Line / Axis"},{id:"vector",name:"Vector"},{id:"text",name:"Text Label"}]},{name:"Mass & Momentum",tools:[{id:"point_mass",name:"Point Mass"},{id:"block_mass",name:"Block/Mass"},{id:"com_indicator",name:"Center of Mass"},{id:"system_boundary",name:"System Bound"},{id:"dashed_path",name:"Trajectory"},{id:"rocket",name:"Rocket (Varying)"}]},{name:"Rigid Bodies",tools:[{id:"uniform_rod",name:"Uniform Rod"},{id:"solid_disk",name:"Solid Disk/Sphere"},{id:"hoop_ring",name:"Hoop/Ring"},{id:"rolling_body",name:"Rolling Object"}]},{name:"Mechanics",tools:[{id:"pivot",name:"Pivot / Hinge"},{id:"inclined_wedge",name:"Inclined Plane"},{id:"pulley",name:"Pulley System"},{id:"spring",name:"Spring"},{id:"curve_arrow",name:"Angular Vector (\u03C9/\u03C4)"}]}]};var yo=[{id:1,type:"capacitor",x1:260,y1:200,x2:460,y2:200,label:"C = 10\u03BCF",color:"#0f172a",strokeWidth:3,fontSize:18},{id:2,type:"line",x1:260,y1:200,x2:260,y2:400,color:"#0f172a",strokeWidth:2},{id:3,type:"line",x1:460,y1:200,x2:460,y2:400,color:"#0f172a",strokeWidth:2},{id:4,type:"capacitor",x1:260,y1:400,x2:460,y2:400,label:"V = 12V",color:"#0f172a",strokeWidth:3,fontSize:18},{id:5,type:"ground",x1:460,y1:400,x2:460,y2:460,label:"",color:"#0f172a",strokeWidth:2},{id:6,type:"charge_plus",x1:340,y1:180,x2:340,y2:180,label:"+Q",color:"#ef4444",strokeWidth:2,fontSize:16},{id:7,type:"charge_minus",x1:380,y1:180,x2:380,y2:180,label:"-Q",color:"#3b82f6",strokeWidth:2,fontSize:16},{id:8,type:"vector",x1:345,y1:190,x2:375,y2:190,label:"",color:"#ef4444",strokeWidth:1.5,lineStyle:"dashed"},{id:9,type:"vector",x1:345,y1:210,x2:375,y2:210,label:"",color:"#ef4444",strokeWidth:1.5,lineStyle:"dashed"},{id:10,type:"charge_plus",x1:600,y1:300,x2:600,y2:300,label:"+q",color:"#ef4444",strokeWidth:2,fontSize:18},{id:11,type:"charge_minus",x1:800,y1:300,x2:800,y2:300,label:"-q",color:"#3b82f6",strokeWidth:2,fontSize:18},{id:12,type:"vector",x1:620,y1:300,x2:780,y2:300,label:"E",color:"#94a3b8",strokeWidth:2,fontSize:18},{id:13,type:"circle",x1:600,y1:300,x2:660,y2:300,label:"",color:"#ef4444",strokeWidth:1.5,lineStyle:"dashed"}],Ee={name:"Graph",elements:yo,toolCategories:[{name:"Basic",tools:[{id:"select",name:"Select/Move"},{id:"point",name:"Point/Node"},{id:"line",name:"Solid Line"},{id:"dashed_line",name:"Dashed Line"},{id:"vector",name:"Vector/Arrow"},{id:"angle",name:"Angle/Vector"},{id:"axes",name:"X-Y Axes"},{id:"text",name:"Text Label"}]},{name:"Physics",tools:[{id:"charge_plus",name:"+ Charge"},{id:"charge_minus",name:"- Charge"},{id:"capacitor",name:"Capacitor"},{id:"ground",name:"Ground"}]},{name:"Shapes",tools:[{id:"rectangle",name:"Rectangle"},{id:"circle",name:"Circle"},{id:"ellipse",name:"Ellipse"}]},{name:"Curves",tools:[{id:"parabola_v",name:"Parabola (V)"},{id:"parabola_h",name:"Parabola (H)"},{id:"hyperbola",name:"Hyperbola"},{id:"modulus",name:"Modulus |x|"},{id:"step_function",name:"Step [x]"},{id:"shaded_area",name:"Area Graph"},{id:"exponential",name:"Exponential"},{id:"logarithmic",name:"Logarithmic"},{id:"sine_wave",name:"Sine Wave"}]},{name:"Mechanical",tools:[{id:"spring",name:"Spring"}]}]};var Ae={name:"Electrostatics",elements:[{id:1,type:"charge_pos",x1:160,y1:160,x2:160,y2:160,label:"+q",color:"#ef4444",strokeWidth:2,fontSize:18},{id:2,type:"gaussian_sphere",x1:160,y1:160,x2:260,y2:160,color:"#10b981",strokeWidth:2,label:"Gaussian Sphere"},{id:3,type:"vector",x1:160,y1:160,x2:280,y2:160,color:"#ef4444",strokeWidth:2,label:"E"},{id:4,type:"vector",x1:160,y1:160,x2:160,y2:40,color:"#ef4444",strokeWidth:2},{id:5,type:"vector",x1:160,y1:160,x2:40,y2:160,color:"#ef4444",strokeWidth:2},{id:6,type:"vector",x1:160,y1:160,x2:160,y2:280,color:"#ef4444",strokeWidth:2},{id:7,type:"text",x1:160,y1:320,x2:160,y2:320,label:"Point Charge Field",color:"#334155",fontSize:18},{id:8,type:"charged_plate_pos",x1:500,y1:60,x2:500,y2:360,color:"#ef4444",strokeWidth:2,label:"+\u03BB (Line Charge)"},{id:9,type:"gaussian_cylinder",x1:500,y1:120,x2:500,y2:300,color:"#10b981",strokeWidth:2,curveHeight:60,label:"Gaussian Cylinder"},{id:10,type:"vector",x1:500,y1:210,x2:620,y2:210,color:"#ef4444",strokeWidth:2,label:"E"},{id:11,type:"vector",x1:500,y1:210,x2:380,y2:210,color:"#ef4444",strokeWidth:2},{id:12,type:"text",x1:500,y1:400,x2:500,y2:400,label:"Cylindrical Symmetry",color:"#334155",fontSize:18},{id:13,type:"charged_plate_pos",x1:760,y1:100,x2:960,y2:100,color:"#ef4444",strokeWidth:2},{id:14,type:"charged_plate_neg",x1:760,y1:300,x2:960,y2:300,color:"#3b82f6",strokeWidth:2},{id:15,type:"vector",x1:800,y1:100,x2:800,y2:300,color:"#ef4444",strokeWidth:2},{id:16,type:"vector",x1:860,y1:100,x2:860,y2:300,color:"#ef4444",strokeWidth:2,label:"Uniform E-Field"},{id:17,type:"vector",x1:920,y1:100,x2:920,y2:300,color:"#ef4444",strokeWidth:2},{id:18,type:"text",x1:860,y1:340,x2:860,y2:340,label:"Parallel Plates",color:"#334155",fontSize:18},{id:19,type:"dipole",x1:100,y1:500,x2:260,y2:500,color:"#64748b",strokeWidth:2,label:"Electric Dipole (p)"},{id:20,type:"vector",x1:100,y1:500,x2:260,y2:500,color:"#f59e0b",strokeWidth:2,label:"p"}],toolCategories:[{name:"Basics",tools:[{id:"select",name:"Select/Move"},{id:"point",name:"Point"},{id:"line",name:"Line"},{id:"vector",name:"Vector"},{id:"text",name:"Text Label"}]},{name:"Electrostatics",tools:[{id:"charge_pos",name:"+ Charge"},{id:"charge_neg",name:"- Charge"},{id:"dipole",name:"Dipole"},{id:"charged_plate_pos",name:"+ Plate"},{id:"charged_plate_neg",name:"- Plate"},{id:"gaussian_sphere",name:"Gauss Sphere"},{id:"gaussian_cylinder",name:"Gauss Cyl"}]},{name:"Optics",tools:[{id:"ray",name:"Light Ray"},{id:"lens_convex",name:"Convex Lens"},{id:"lens_concave",name:"Concave Lens"},{id:"mirror_plane",name:"Plane Mirror"}]},{name:"Modern Phys",tools:[{id:"photon",name:"Photon"},{id:"slit_double",name:"Double Slit"},{id:"energy_level",name:"Energy Lvl"}]}]};var Pe={name:"Chemistry",elements:[{id:1,type:"benzene",x1:150,y1:210,x2:150,y2:210,label:"",value:""},{id:2,type:"text",x1:240,y1:210,x2:240,y2:210,label:"+",value:""},{id:3,type:"atom",x1:285,y1:210,x2:285,y2:210,label:"Cl",value:""},{id:4,type:"single_bond",x1:300,y1:210,x2:330,y2:210,label:"",value:""},{id:5,type:"atom",x1:345,y1:210,x2:345,y2:210,label:"Cl",value:""},{id:6,type:"reaction_arrow",x1:400,y1:210,x2:520,y2:210,label:"FeCl3",value:"Dark"},{id:7,type:"benzene",x1:600,y1:210,x2:600,y2:210,label:"",value:""},{id:8,type:"single_bond",x1:600,y1:180,x2:600,y2:120,label:"",value:""},{id:9,type:"atom",x1:600,y1:105,x2:600,y2:105,label:"Cl",value:""},{id:10,type:"text",x1:690,y1:210,x2:690,y2:210,label:"+",value:""},{id:11,type:"atom",x1:750,y1:210,x2:750,y2:210,label:"HCl",value:""}],toolCategories:[{name:"Chemistry",tools:[{id:"select",name:"Select/Move"},{id:"single_bond",name:"Single Bond"},{id:"double_bond",name:"Double Bond"},{id:"triple_bond",name:"Triple Bond"},{id:"wedge_bond",name:"Wedge (Up)"},{id:"dash_bond",name:"Dash (Down)"}]},{name:"Arrows",tools:[{id:"curved_arrow",name:"Mechanism"},{id:"reaction_arrow",name:"Reaction"},{id:"equilibrium_arrow",name:"Equilibrium"},{id:"resonance_arrow",name:"Resonance"}]},{name:"Rings",tools:[{id:"benzene",name:"Benzene"},{id:"cyclohexane",name:"Cyclohexane"},{id:"cyclopentane",name:"Cyclopentane"},{id:"cyclobutane",name:"Cyclobutane"},{id:"cyclopropane",name:"Cyclopropane"}]},{name:"Symbols",tools:[{id:"atom",name:"Atom/Group"},{id:"charge_plus",name:"Pos. Charge"},{id:"charge_minus",name:"Neg. Charge"},{id:"radical",name:"Radical"},{id:"lone_pair",name:"Lone Pair"},{id:"text",name:"Plain Text"}]}]};var Re={name:"Mechanical",elements:[{id:1,type:"wedge",x1:100,y1:400,x2:500,y2:100,label:"M"},{id:2,type:"block",x1:220,y1:260,x2:300,y2:300,label:"m"},{id:3,type:"arc",x1:100,y1:400,x2:260,y2:280,label:"\u03B8"}],toolCategories:[{name:"Mechanical",tools:[{id:"select",name:"Select"},{id:"wedge",name:"Wedge"},{id:"block",name:"Block"},{id:"vector",name:"Vector"},{id:"arc",name:"Arc"},{id:"dashed",name:"Dashed"},{id:"dimension",name:"Dimension"},{id:"axes",name:"Axes"}]}]};var St={mechanics:Me,circuit:Se,thermo:we,optical:_e,magnetism:Ce,light:Le,waves:ze,waveOscillation:De,rotation:Ne,graph:Ee,electrostatics:Ae,chemistry:Pe,mechanical:Re};var It=(t,e=20)=>Math.round(t/e)*e,W=(t,e,r,o)=>Math.hypot(r-t,o-e),C=(t,e,r,o)=>Math.atan2(o-e,r-t)*180/Math.PI,K=(t,e,r,o)=>{let n=Math.min(t,r),s=Math.min(e,o),a=Math.max(t,r),l=Math.max(e,o);return {minX:n,minY:s,maxX:a,maxY:l,width:Math.max(1,a-n),height:Math.max(1,l-s)}},oe=(t,e)=>{let r=t.getScreenCTM();return r?{x:(e.clientX-r.e)/r.a,y:(e.clientY-r.f)/r.d}:{x:0,y:0}};var Ye=new Map,c=(t,e)=>{Ye.set(t,e);},xe=t=>Ye.get(t);var wt=t=>t.color||"#0f172a",Xe=t=>t.strokeWidth||2,re=t=>t.fontSize||16;c("point",t=>jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("circle",{cx:"0",cy:"0",r:3,fill:wt(t)}),t.label&&jsx("text",{x:"8",y:"-8",fontSize:re(t),fill:wt(t),children:String(t.label)})]}));c("text",t=>jsx("text",{x:t.x1,y:t.y1,dominantBaseline:"central",textAnchor:"middle",fill:wt(t),fontSize:re(t),fontFamily:t.fontFamily||"serif",fontWeight:t.fontWeight||"normal",children:String(t.label||t.value||"")}));var Vt=(t,e=false)=>{let r=W(t.x1,t.y1,t.x2,t.y2),o=C(t.x1,t.y1,t.x2,t.y2),n=t.lineStyle==="dashed"||t.type==="dashed"||t.type==="dashed_line"?"6 6":t.lineStyle==="dotted"?"2 4":void 0;return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${o})`,children:[jsx("line",{x1:0,y1:0,x2:r,y2:0,stroke:wt(t),strokeWidth:Xe(t),strokeDasharray:n,strokeLinecap:"round"}),e&&jsx("polygon",{points:`${r},0 ${r-12},-6 ${r-12},6`,fill:wt(t)}),t.label&&jsx("text",{x:r/2,y:-10,fontSize:re(t),fill:wt(t),textAnchor:"middle",children:String(t.label)})]})};c("line",t=>Vt(t));c("dashed",t=>Vt({...t,lineStyle:"dashed"}));c("dashed_line",t=>Vt({...t,lineStyle:"dashed"}));c("vector",t=>Vt(t,true));c("ray",t=>Vt(t,true));c("wire",t=>Vt(t));c("table_edge",t=>{let e=Math.min(t.x1,t.x2),r=Math.max(t.x1,t.x2),o=Math.min(t.y1,t.y2),n=Math.max(t.y1,t.y2),s=Math.max(1,r-e),a=Math.max(1,n-o),l=[],d=Math.max(2,Math.floor(s/12)),x=Math.max(2,Math.floor(a/12));for(let y=0;y<=d;y++){let h=e+y/d*s;l.push(jsx("line",{x1:h,y1:o,x2:h-8,y2:o+10,stroke:wt(t),strokeWidth:1},`h-${y}`));}for(let y=0;y<=x;y++){let h=o+y/x*a;l.push(jsx("line",{x1:r,y1:h,x2:r-10,y2:h+8,stroke:wt(t),strokeWidth:1},`v-${y}`));}return jsxs("g",{children:[jsx("polyline",{points:`${e},${o} ${r},${o} ${r},${n}`,fill:"none",stroke:wt(t),strokeWidth:Xe(t)}),l,t.label&&jsx("text",{x:e+s/2,y:o-10,fill:wt(t),textAnchor:"middle",fontSize:re(t),children:String(t.label)})]})});var M=t=>t.color||"#0f172a",R=t=>t.strokeWidth||2,bt=t=>t.fillOpacity??.2;c("slab",t=>{let e=K(t.x1,t.y1,t.x2,t.y2),r=t.curveHeight??20;return jsxs("g",{children:[jsx("path",{d:`M ${e.minX} ${e.minY} L ${e.maxX} ${e.minY} L ${e.maxX} ${e.maxY} L ${e.minX} ${e.maxY} Z`,fill:M(t),fillOpacity:bt(t),stroke:M(t),strokeWidth:R(t)}),jsx("path",{d:`M ${e.minX} ${e.minY} L ${e.minX+r} ${e.minY-r} L ${e.maxX+r} ${e.minY-r} L ${e.maxX} ${e.minY} Z`,fill:M(t),fillOpacity:Math.max(0,bt(t)-.1),stroke:M(t),strokeWidth:R(t)}),jsx("path",{d:`M ${e.maxX} ${e.minY} L ${e.maxX+r} ${e.minY-r} L ${e.maxX+r} ${e.maxY-r} L ${e.maxX} ${e.maxY} Z`,fill:M(t),fillOpacity:Math.min(1,bt(t)+.1),stroke:M(t),strokeWidth:R(t)})]})});c("sphere",t=>{let e=Math.max(4,W(t.x1,t.y1,t.x2,t.y2));return jsx("circle",{cx:t.x1,cy:t.y1,r:e,fill:M(t),fillOpacity:bt(t),stroke:M(t),strokeWidth:R(t)})});c("shell",t=>{let e=Math.max(10,W(t.x1,t.y1,t.x2,t.y2)),r=t.curveHeight??10,o=Math.max(1,e-r);return jsx("path",{d:`M ${t.x1-e} ${t.y1} A ${e} ${e} 0 1 0 ${t.x1+e} ${t.y1} A ${e} ${e} 0 1 0 ${t.x1-e} ${t.y1} Z M ${t.x1-o} ${t.y1} A ${o} ${o} 0 1 1 ${t.x1+o} ${t.y1} A ${o} ${o} 0 1 1 ${t.x1-o} ${t.y1} Z`,fill:M(t),fillOpacity:bt(t),fillRule:"evenodd",stroke:M(t),strokeWidth:R(t)})});c("cylinder",t=>{let e=W(t.x1,t.y1,t.x2,t.y2),r=C(t.x1,t.y1,t.x2,t.y2),o=t.curveHeight??20;return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${r})`,children:[jsx("path",{d:`M 0 ${-o} L ${e} ${-o} A 10 ${o} 0 0 1 ${e} ${o} L 0 ${o} Z`,fill:M(t),fillOpacity:bt(t)}),jsx("path",{d:`M 0 ${-o} L ${e} ${-o} M 0 ${o} L ${e} ${o}`,fill:"none",stroke:M(t),strokeWidth:R(t)}),jsx("ellipse",{cx:e,cy:0,rx:10,ry:o,fill:M(t),fillOpacity:bt(t),stroke:M(t),strokeWidth:R(t)}),jsx("ellipse",{cx:0,cy:0,rx:10,ry:o,fill:"none",stroke:M(t),strokeWidth:R(t),strokeDasharray:"2 4"})]})});c("ladder",t=>{let e=W(t.x1,t.y1,t.x2,t.y2),r=C(t.x1,t.y1,t.x2,t.y2),o=t.curveHeight??10,n=[];for(let s=15;s<e-10;s+=15)n.push(jsx("line",{x1:s,y1:-o,x2:s,y2:o,stroke:M(t),strokeWidth:Math.max(1,R(t)-1)},s));return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${r})`,children:[jsx("line",{x1:0,y1:-o,x2:e,y2:-o,stroke:M(t),strokeWidth:R(t)}),jsx("line",{x1:0,y1:o,x2:e,y2:o,stroke:M(t),strokeWidth:R(t)}),n]})});c("spring",t=>{let e=W(t.x1,t.y1,t.x2,t.y2),r=C(t.x1,t.y1,t.x2,t.y2),o=Math.max(0,Math.floor(e/12)),n="M 0 0";for(let s=0;s<o;s++)n+=` L ${s*12+3} 8 L ${s*12+9} -8`;return n+=` L ${e} 0`,jsx("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${r})`,children:jsx("path",{d:n,fill:"none",stroke:M(t),strokeWidth:R(t),strokeLinejoin:"round"})})});c("rod",t=>{let e=W(t.x1,t.y1,t.x2,t.y2),r=C(t.x1,t.y1,t.x2,t.y2);return jsx("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${r})`,children:jsx("line",{x1:0,y1:0,x2:e,y2:0,stroke:M(t),strokeWidth:Math.max(4,R(t)),strokeLinecap:"round"})})});c("arc_arrow",t=>{let e=Math.max(8,W(t.x1,t.y1,t.x2,t.y2));return jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("path",{d:`M ${e} 0 A ${e} ${e} 0 0 0 ${-e} 0`,fill:"none",stroke:M(t),strokeWidth:R(t)}),jsx("polygon",{points:`${-e},2 ${-e-6},-10 ${-e+6},-10`,fill:M(t)})]})});c("lens_convex",t=>{let e=K(t.x1,t.y1,t.x2,t.y2),r=e.minX+e.width/2;return jsx("ellipse",{cx:r,cy:e.minY+e.height/2,rx:Math.max(6,e.width/2),ry:e.height/2,fill:M(t),fillOpacity:Math.max(.15,bt(t)),stroke:M(t),strokeWidth:R(t)})});c("lens_concave",t=>{let e=K(t.x1,t.y1,t.x2,t.y2),r=e.minX+e.width/2,o=Math.max(6,e.width/2),n=e.height/2;return jsx("path",{d:`M ${r-o} ${e.minY} Q ${r-o*.2} ${e.minY+n} ${r-o} ${e.maxY} M ${r+o} ${e.minY} Q ${r+o*.2} ${e.minY+n} ${r+o} ${e.maxY}`,fill:"none",stroke:M(t),strokeWidth:R(t)})});c("mirror_concave",t=>{let e=K(t.x1,t.y1,t.x2,t.y2),r=t.curveHeight??40;return jsx("path",{d:`M ${e.minX} ${e.minY} Q ${e.maxX+r} ${e.minY+e.height/2} ${e.minX} ${e.maxY}`,fill:"none",stroke:M(t),strokeWidth:R(t)})});c("mirror_convex",t=>{let e=K(t.x1,t.y1,t.x2,t.y2),r=t.curveHeight??40,o=e.minY+e.height/2;return jsx("path",{d:`M ${e.minX} ${e.minY} Q ${e.minX-r} ${o} ${e.minX} ${e.maxY}`,fill:"none",stroke:M(t),strokeWidth:R(t)})});c("prism",t=>{let e=W(t.x1,t.y1,t.x2,t.y2),r=C(t.x1,t.y1,t.x2,t.y2),o=-e*.866,n=t.fontSize||16;return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${r})`,children:[jsx("polygon",{points:`0,0 ${e},0 ${e/2},${o}`,fill:M(t),fillOpacity:Math.max(.15,bt(t)),stroke:M(t),strokeWidth:R(t),strokeLinejoin:"round"}),t.label&&jsx("text",{x:e/2,y:o-10,fontSize:n,fill:M(t),textAnchor:"middle",children:String(t.label)})]})});c("slit_single",t=>{let e=W(t.x1,t.y1,t.x2,t.y2),r=C(t.x1,t.y1,t.x2,t.y2),o=16,n=Math.max(4,R(t)),s=t.fontSize||16;return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${r})`,children:[jsx("line",{x1:0,y1:0,x2:e/2-o/2,y2:0,stroke:M(t),strokeWidth:n,strokeLinecap:"square"}),jsx("line",{x1:e/2+o/2,y1:0,x2:e,y2:0,stroke:M(t),strokeWidth:n,strokeLinecap:"square"}),t.label&&jsx("text",{x:e/2,y:-14,fontSize:s,fill:M(t),textAnchor:"middle",children:String(t.label)})]})});c("slit_double",t=>{let e=K(t.x1,t.y1,t.x2,t.y2),r=e.minX+e.width/2;return jsxs("g",{children:[jsx("line",{x1:r-6,y1:e.minY,x2:r-6,y2:e.maxY,stroke:M(t),strokeWidth:R(t)}),jsx("line",{x1:r+6,y1:e.minY,x2:r+6,y2:e.maxY,stroke:M(t),strokeWidth:R(t)})]})});c("photon",t=>{let e=W(t.x1,t.y1,t.x2,t.y2),r=C(t.x1,t.y1,t.x2,t.y2),o=6,n=Math.max(3,Math.floor(e/24)),s=e/(n*2),a="M 0 0 ";for(let l=0;l<n*2;l++){let d=(l+1)*s,x=l%2===0?-o:o;a+=`L ${d} ${x} `;}return a+=`L ${e} 0`,jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${r})`,children:[jsx("path",{d:a,fill:"none",stroke:M(t),strokeWidth:R(t)}),t.label&&jsx("text",{x:e/2,y:-12,textAnchor:"middle",fill:M(t),children:String(t.label)})]})});c("glass_slab",t=>{let e=K(t.x1,t.y1,t.x2,t.y2);return jsx("rect",{x:e.minX,y:e.minY,width:e.width,height:e.height,fill:M(t),fillOpacity:Math.max(.1,bt(t)),stroke:M(t),strokeWidth:R(t)})});c("pipe",t=>{let e=K(t.x1,t.y1,t.x2,t.y2),r=t.curveHeight??e.height*.35;return jsx("path",{d:`M ${e.minX} ${e.minY} C ${e.minX+e.width*.3} ${e.minY}, ${e.minX+e.width*.3} ${e.minY+r}, ${e.minX+e.width*.5} ${e.minY+r} C ${e.minX+e.width*.7} ${e.minY+r}, ${e.minX+e.width*.7} ${e.minY}, ${e.maxX} ${e.minY} L ${e.maxX} ${e.maxY} C ${e.minX+e.width*.7} ${e.maxY}, ${e.minX+e.width*.7} ${e.maxY-r}, ${e.minX+e.width*.5} ${e.maxY-r} C ${e.minX+e.width*.3} ${e.maxY-r}, ${e.minX+e.width*.3} ${e.maxY}, ${e.minX} ${e.maxY} Z`,fill:M(t),fillOpacity:bt(t),stroke:M(t),strokeWidth:R(t)})});c("liquid",t=>{let e=K(t.x1,t.y1,t.x2,t.y2);return jsxs("g",{children:[jsx("path",{d:`M ${e.minX} ${e.minY} Q ${e.minX+e.width/2} ${e.minY+10} ${e.maxX} ${e.minY} L ${e.maxX} ${e.maxY} L ${e.minX} ${e.maxY} Z`,fill:M(t),fillOpacity:Math.max(.2,bt(t))}),jsx("path",{d:`M ${e.minX} ${e.minY} Q ${e.minX+e.width/2} ${e.minY+10} ${e.maxX} ${e.minY}`,fill:"none",stroke:M(t),strokeWidth:2})]})});c("orbit",t=>{let e=K(t.x1,t.y1,t.x2,t.y2);return jsx("ellipse",{cx:e.minX+e.width/2,cy:e.minY+e.height/2,rx:e.width/2,ry:e.height/2,fill:"none",stroke:M(t),strokeWidth:R(t),strokeDasharray:"3 3"})});c("pole_piece",t=>{let e=K(t.x1,t.y1,t.x2,t.y2),r=String(t.label||"N"),n=r.toUpperCase().includes("N")?"#ef4444":"#3b82f6",s=Math.min(e.width,e.height)*.5+10;return jsxs("g",{children:[jsx("rect",{x:e.minX,y:e.minY,width:e.width,height:e.height,fill:n,fillOpacity:.2,stroke:M(t),strokeWidth:R(t),rx:"4"}),jsx("text",{x:e.minX+e.width/2,y:e.minY+e.height/2,textAnchor:"middle",dominantBaseline:"central",fill:M(t),fontWeight:"bold",fontSize:s,children:r})]})});c("b_field_line",t=>{let e=W(t.x1,t.y1,t.x2,t.y2),r=C(t.x1,t.y1,t.x2,t.y2),o=t.fontSize||18,n=e/2;return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${r})`,children:[jsx("line",{x1:0,y1:0,x2:e,y2:0,stroke:M(t),strokeWidth:R(t),strokeLinecap:"round"}),jsx("polygon",{points:`${n+6},0 ${n-6},-5 ${n-6},5`,fill:M(t)}),t.label?jsx("text",{x:n,y:-10,textAnchor:"middle",fill:M(t),fontSize:o,children:String(t.label)}):null]})});c("b_field_curve",t=>{let e=W(t.x1,t.y1,t.x2,t.y2),r=C(t.x1,t.y1,t.x2,t.y2),o=t.curveHeight!==void 0?t.curveHeight:e*.4,n=t.fontSize||18,s=-o;return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${r})`,children:[jsx("path",{d:`M 0 0 Q ${e/2} ${-o*2} ${e} 0`,fill:"none",stroke:M(t),strokeWidth:R(t),strokeLinecap:"round"}),jsx("polygon",{points:`${e/2+6},${s} ${e/2-6},${s-5} ${e/2-6},${s+5}`,fill:M(t)}),t.label?jsx("text",{x:e/2,y:s-15,textAnchor:"middle",fill:M(t),fontSize:n,children:String(t.label)}):null]})});c("axes_3d",t=>jsxs("g",{children:[jsx("line",{x1:t.x1,y1:t.y1,x2:t.x1+100,y2:t.y1,stroke:M(t),strokeWidth:R(t)}),jsx("line",{x1:t.x1,y1:t.y1,x2:t.x1,y2:t.y1-100,stroke:M(t),strokeWidth:R(t)}),jsx("line",{x1:t.x1,y1:t.y1,x2:t.x1+70,y2:t.y1+50,stroke:M(t),strokeWidth:R(t)})]}));c("wedge",t=>{let e=t.x2-t.x1,r=t.y2-t.y1;return jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("polygon",{points:`0,0 ${e},0 ${e},${r}`,fill:"#f1f5f9",stroke:M(t),strokeWidth:R(t),strokeLinejoin:"round"}),t.label?jsx("text",{x:e*.6,y:r*.3,dominantBaseline:"central",textAnchor:"middle",fill:M(t),fontSize:20,fontFamily:"serif",fontWeight:"bold",children:String(t.label)}):null]})});c("dimension",t=>{let e=W(t.x1,t.y1,t.x2,t.y2),r=C(t.x1,t.y1,t.x2,t.y2),o=Math.max(1,R(t)-.5);return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${r})`,children:[jsx("line",{x1:0,y1:0,x2:e,y2:0,stroke:M(t),strokeWidth:o,strokeDasharray:"4 4"}),jsx("polygon",{points:"0,0 10,-5 10,5",fill:M(t)}),jsx("polygon",{points:`${e},0 ${e-10},-5 ${e-10},5`,fill:M(t)}),t.label?jsx("text",{x:e/2,y:-10,textAnchor:"middle",fill:M(t),fontSize:18,fontFamily:"serif",fontStyle:"italic",fontWeight:"bold",children:String(t.label)}):null]})});c("arc",t=>{let e=t.x2-t.x1,r=t.y2-t.y1,o=Math.hypot(e,r),n=Math.atan2(r,e)*180/Math.PI,s=Math.min(o,40),a=r>0?1:0,l=s,d=0,x=s*Math.cos(n*Math.PI/180),y=s*Math.sin(n*Math.PI/180),h=n/2,v=s+15,b=v*Math.cos(h*Math.PI/180),$=v*Math.sin(h*Math.PI/180),w=Math.max(o,50);return jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("line",{x1:0,y1:0,x2:w,y2:0,stroke:M(t),strokeWidth:1.5,strokeDasharray:"4 4"}),jsx("path",{d:`M ${l} ${d} A ${s} ${s} 0 0 ${a} ${x} ${y}`,fill:"none",stroke:M(t),strokeWidth:R(t)}),t.label?jsx("text",{x:b,y:$,dominantBaseline:"central",textAnchor:"middle",fill:M(t),fontSize:16,fontFamily:"serif",fontStyle:"italic",fontWeight:"bold",children:String(t.label)}):null]})});c("nucleus",t=>{let e=t.fontSize||18,r=M(t),o=R(t);return jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("ellipse",{cx:0,cy:0,rx:24,ry:8,fill:"none",stroke:r,strokeWidth:o,transform:"rotate(30)"}),jsx("ellipse",{cx:0,cy:0,rx:24,ry:8,fill:"none",stroke:r,strokeWidth:o,transform:"rotate(-30)"}),jsx("ellipse",{cx:0,cy:0,rx:24,ry:8,fill:"none",stroke:r,strokeWidth:o,transform:"rotate(90)"}),jsx("circle",{cx:0,cy:0,r:6,fill:"#ef4444"}),t.label&&jsx("text",{x:0,y:36,fontSize:e,fill:r,textAnchor:"middle",children:String(t.label)})]})});["cone","curved_wedge","incline","container","hinge"].forEach(t=>c(t,e=>{let r=W(e.x1,e.y1,e.x2,e.y2),o=C(e.x1,e.y1,e.x2,e.y2);return jsx("g",{transform:`translate(${e.x1}, ${e.y1}) rotate(${o})`,children:jsx("line",{x1:0,y1:0,x2:r,y2:0,stroke:M(e),strokeWidth:R(e)})})}));["semicircle","quarter_circle","axes"].forEach(t=>c(t,e=>{let r=K(e.x1,e.y1,e.x2,e.y2);return jsx("rect",{x:r.minX,y:r.minY,width:r.width,height:r.height,fill:"none",stroke:M(e),strokeWidth:R(e)})}));var I=t=>t.color||"#0f172a",ut=t=>t.strokeWidth||2,Rt=t=>t.fontSize||18,Te=t=>t.lineStyle==="dashed"||t.type==="dashed_line"?"6 6":t.lineStyle==="dotted"?"2 4":void 0;c("b_region_in",t=>{let e=K(t.x1,t.y1,t.x2,t.y2),r=e.minX,o=e.maxX,n=e.minY,s=e.maxY,a=(r+o)/2,l=40,d=6,x=[];for(let y=r+l/2;y<=o;y+=l)for(let h=n+l/2;h<=s;h+=l)x.push(jsxs("g",{transform:`translate(${y}, ${h})`,children:[jsx("circle",{cx:0,cy:0,r:d,fill:"none",stroke:I(t),strokeWidth:ut(t)*.75}),jsx("line",{x1:-d*.7,y1:-d*.7,x2:d*.7,y2:d*.7,stroke:I(t),strokeWidth:ut(t)*.75}),jsx("line",{x1:d*.7,y1:-d*.7,x2:-d*.7,y2:d*.7,stroke:I(t),strokeWidth:ut(t)*.75})]},`${y}-${h}`));return jsxs("g",{children:[jsx("rect",{x:r,y:n,width:e.width,height:e.height,fill:I(t),stroke:I(t),strokeWidth:1,strokeDasharray:"4 4",opacity:.1}),x,t.label?jsx("text",{x:a,y:n-10,fontSize:Rt(t),fill:I(t),textAnchor:"middle",fontWeight:"bold",children:String(t.label)}):null]})});c("b_region_out",t=>{let e=K(t.x1,t.y1,t.x2,t.y2),r=e.minX,o=e.maxX,n=e.minY,s=e.maxY,a=(r+o)/2,l=40,d=6,x=[];for(let y=r+l/2;y<=o;y+=l)for(let h=n+l/2;h<=s;h+=l)x.push(jsxs("g",{transform:`translate(${y}, ${h})`,children:[jsx("circle",{cx:0,cy:0,r:d,fill:"none",stroke:I(t),strokeWidth:ut(t)*.75}),jsx("circle",{cx:0,cy:0,r:2,fill:I(t)})]},`${y}-${h}`));return jsxs("g",{children:[jsx("rect",{x:r,y:n,width:e.width,height:e.height,fill:I(t),stroke:I(t),strokeWidth:1,strokeDasharray:"4 4",opacity:.1}),x,t.label?jsx("text",{x:a,y:n-10,fontSize:Rt(t),fill:I(t),textAnchor:"middle",fontWeight:"bold",children:String(t.label)}):null]})});c("current_wire",t=>{let e=W(t.x1,t.y1,t.x2,t.y2),r=C(t.x1,t.y1,t.x2,t.y2),o=e/2,n=r>90||r<=-90;return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${r})`,children:[jsx("line",{x1:0,y1:0,x2:e,y2:0,stroke:I(t),strokeWidth:ut(t),strokeDasharray:Te(t),strokeLinecap:"round"}),jsx("polygon",{points:`${o+8},0 ${o-6},-7 ${o-6},7`,fill:I(t)}),t.label?jsx("text",{x:o,y:-15,fontSize:Rt(t),fill:I(t),textAnchor:"middle",fontStyle:"italic",transform:n?`rotate(180, ${o}, -15)`:void 0,children:String(t.label)}):null]})});c("bar_magnet",t=>{let e=W(t.x1,t.y1,t.x2,t.y2),r=C(t.x1,t.y1,t.x2,t.y2),o=Math.max(20,ut(t)*10),n=r>90||r<=-90;return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${r})`,children:[jsx("rect",{x:0,y:-o/2,width:e/2,height:o,fill:"#ef4444",stroke:I(t),strokeWidth:1}),jsx("rect",{x:e/2,y:-o/2,width:e/2,height:o,fill:"#3b82f6",stroke:I(t),strokeWidth:1}),jsx("text",{x:e/4,y:0,fill:"white",fontSize:o*.6,fontWeight:"bold",textAnchor:"middle",dominantBaseline:"central",transform:n?`rotate(180, ${e/4}, 0)`:void 0,children:"N"}),jsx("text",{x:e*.75,y:0,fill:"white",fontSize:o*.6,fontWeight:"bold",textAnchor:"middle",dominantBaseline:"central",transform:n?`rotate(180, ${e*.75}, 0)`:void 0,children:"S"}),t.label?jsx("text",{x:e/2,y:-o/2-10,fill:I(t),fontSize:Rt(t),textAnchor:"middle",transform:n?`rotate(180, ${e/2}, ${-o/2-10})`:void 0,children:String(t.label)}):null]})});c("coil",t=>{let e=W(t.x1,t.y1,t.x2,t.y2),r=C(t.x1,t.y1,t.x2,t.y2),o=Math.max(Math.floor(e/15),1),n="M 0 0 ";for(let a=1;a<=o;a++)n+=`C ${a*(e/o)-e/(o*2)} -15, ${a*(e/o)} 20, ${a*(e/o)} 0 `;let s=r>90||r<=-90;return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${r})`,children:[jsx("path",{d:n,fill:"none",stroke:I(t),strokeWidth:ut(t),strokeLinejoin:"round"}),t.label?jsx("text",{x:e/2,y:-20,fontSize:Rt(t),fill:I(t),textAnchor:"middle",transform:s?`rotate(180, ${e/2}, -20)`:void 0,children:String(t.label)}):null]})});c("meter",t=>{let e=Math.max(16,ut(t)*5),r=String(t.label||"G");return jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("circle",{cx:0,cy:0,r:e,fill:"white",stroke:I(t),strokeWidth:ut(t)}),jsx("text",{x:0,y:0,fontSize:Rt(t),fill:I(t),fontWeight:"bold",textAnchor:"middle",dominantBaseline:"central",children:r})]})});c("ac_source",t=>{let e=Math.max(16,ut(t)*5);return jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("circle",{cx:0,cy:0,r:e,fill:"white",stroke:I(t),strokeWidth:ut(t)}),jsx("path",{d:`M ${-e*.6} 0 Q ${-e*.3} ${-e*.6} 0 0 T ${e*.6} 0`,fill:"none",stroke:I(t),strokeWidth:ut(t)*.8}),t.label?jsx("text",{x:0,y:e+18,fontSize:Rt(t),fill:I(t),textAnchor:"middle",children:String(t.label)}):null]})});c("bezier",t=>{let{x1:e,y1:r,x2:o,y2:n}=t,a=(t.cps?.length?t.cps:[{x:(e+o)/2,y:Math.min(r,n)-50}])[0],l=`M ${e} ${r} Q ${a.x} ${a.y} ${o} ${n}`,d=.25*e+.5*a.x+.25*o,x=.25*r+.5*a.y+.25*n,y=Math.atan2(n-r,o-e),h=!!t.showArrow;return jsxs("g",{children:[jsx("path",{d:l,fill:"none",stroke:"transparent",strokeWidth:24,strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:l,fill:"none",stroke:I(t),strokeWidth:ut(t),strokeDasharray:Te(t),strokeLinecap:"round",strokeLinejoin:"round"}),h?jsx("g",{transform:`translate(${d}, ${x}) rotate(${y*180/Math.PI})`,children:jsx("polygon",{points:"6,0 -6,-5 -6,5",fill:I(t)})}):null,t.label?jsx("text",{x:d,y:x-14,fontSize:Rt(t),fill:I(t),textAnchor:"middle",children:String(t.label)}):null]})});var yt=t=>t.color||"#0f172a",ht=t=>t.strokeWidth||2,Oe=t=>t.fontSize||16,mt=t=>{if(t.lineStyle==="dashed"||t.type==="dashed_line"||t.type==="dashed")return "6 6";if(t.lineStyle==="dotted")return "2 4"},ct=t=>t?.isGhost?.5:1;c("axes",(t,e)=>{let r=Math.min(t.x1,t.x2),o=Math.max(t.x1,t.x2),n=Math.min(t.y1,t.y2),s=Math.max(t.y1,t.y2),a=(r+o)/2,l=(n+s)/2,d=Math.max(1,o-r),x=Math.max(1,s-n),y=yt(t),h=ht(t),v=mt(t);if(o-r<=1&&s-n<=1){let b=t.x1,$=t.y1,w=40,P=Oe(t);return jsxs("g",{opacity:ct(e),children:[jsx("line",{x1:b,y1:$,x2:b+w,y2:$,stroke:y,strokeWidth:h}),jsx("polygon",{points:`${b+w},${$} ${b+w-8},${$-5} ${b+w-8},${$+5}`,fill:y}),jsx("text",{x:b+w+10,y:$,dominantBaseline:"central",textAnchor:"middle",fill:y,fontSize:P,fontFamily:"serif",fontStyle:"italic",children:"x"}),jsx("line",{x1:b,y1:$,x2:b,y2:$-w,stroke:y,strokeWidth:h}),jsx("polygon",{points:`${b},${$-w} ${b-5},${$-w+8} ${b+5},${$-w+8}`,fill:y}),jsx("text",{x:b,y:$-w-12,dominantBaseline:"central",textAnchor:"middle",fill:y,fontSize:P,fontFamily:"serif",fontStyle:"italic",children:"y"}),jsx("circle",{cx:b,cy:$,r:2,fill:y})]})}return jsxs("g",{opacity:ct(e),children:[jsx("rect",{x:r,y:n,width:d,height:x,fill:"transparent"}),jsxs("g",{pointerEvents:"none",children:[jsx("line",{x1:a,y1:n,x2:a,y2:s,stroke:y,strokeWidth:h,strokeDasharray:v,opacity:.8}),jsx("line",{x1:r,y1:l,x2:o,y2:l,stroke:y,strokeWidth:h,strokeDasharray:v,opacity:.8}),jsx("polygon",{points:`${o},${l} ${o-10},${l-5} ${o-10},${l+5}`,fill:y,opacity:.8}),jsx("polygon",{points:`${a},${n} ${a-5},${n+10} ${a+5},${n+10}`,fill:y,opacity:.8})]})]})});c("circle",(t,e)=>{let r=W(t.x1,t.y1,t.x2,t.y2),o=yt(t),n=ht(t),s=mt(t);return jsxs("g",{opacity:ct(e),children:[jsx("circle",{cx:t.x1,cy:t.y1,r,fill:"none",stroke:o,strokeWidth:n,strokeDasharray:s,pointerEvents:"none"}),jsx("circle",{cx:t.x1,cy:t.y1,r,fill:"transparent",stroke:"transparent",strokeWidth:20})]})});c("ellipse",(t,e)=>{let r=Math.min(t.x1,t.x2),o=Math.max(t.x1,t.x2),n=Math.min(t.y1,t.y2),s=Math.max(t.y1,t.y2),a=(r+o)/2,l=(n+s)/2,d=Math.max(1,o-r),x=Math.max(1,s-n),y=yt(t),h=ht(t),v=mt(t);return jsxs("g",{opacity:ct(e),children:[jsx("rect",{x:r,y:n,width:d,height:x,fill:"transparent"}),jsx("ellipse",{cx:a,cy:l,rx:d/2,ry:x/2,fill:"none",stroke:y,strokeWidth:h,strokeDasharray:v,pointerEvents:"none"})]})});c("rectangle",(t,e)=>{let r=K(t.x1,t.y1,t.x2,t.y2),o=yt(t),n=ht(t),s=mt(t);return jsxs("g",{opacity:ct(e),children:[jsx("rect",{x:r.minX,y:r.minY,width:r.width,height:r.height,fill:"transparent"}),jsx("rect",{x:r.minX,y:r.minY,width:r.width,height:r.height,fill:"none",stroke:o,strokeWidth:n,strokeDasharray:s,strokeLinejoin:"round",pointerEvents:"none"})]})});c("angle",(t,e)=>{let{x1:r,y1:o,x2:n,y2:s}=t,a=n-r,l=s-o,d=Math.hypot(a,l),x=Math.min(r,n),y=Math.max(r,n),h=Math.min(o,s),v=Math.max(o,s),b=Math.max(1,y-x),$=Math.max(1,v-h),w=yt(t),P=ht(t),B=mt(t),V=Oe(t),H=Math.atan2(l,a),f=Math.min(d*.4,40),gt=(a>=0?1:-1)===1?0:Math.PI,at=H-gt;at=Math.atan2(Math.sin(at),Math.cos(at));let Tt=gt+at/2,Ot=at>0?1:0,Ft=r+f*Math.cos(gt),Z=o+f*Math.sin(gt),X=r+f*Math.cos(H),A=o+f*Math.sin(H),N=H*180/Math.PI;return jsxs("g",{opacity:ct(e),children:[jsx("rect",{x,y:h,width:b,height:$,fill:"transparent"}),jsxs("g",{pointerEvents:"none",children:[jsx("line",{x1:r,y1:o,x2:r+a,y2:o,stroke:w,strokeWidth:P,strokeDasharray:"4 4",opacity:.6}),jsx("line",{x1:r,y1:o,x2:n,y2:s,stroke:w,strokeWidth:P,strokeLinecap:"round",strokeDasharray:B}),jsx("g",{transform:`translate(${n}, ${s}) rotate(${N})`,children:jsx("polygon",{points:"0,0 -12,-6 -12,6",fill:w})}),d>20&&jsx("path",{d:`M ${Ft} ${Z} A ${f} ${f} 0 0 ${Ot} ${X} ${A}`,fill:"none",stroke:w,strokeWidth:P}),t.label&&jsx("text",{x:r+(f+16)*Math.cos(Tt),y:o+(f+16)*Math.sin(Tt),fontSize:V,fill:w,fontFamily:"serif",fontStyle:"italic",dominantBaseline:"central",textAnchor:"middle",children:String(t.label)})]})]})});c("parabola_v",(t,e)=>{let r=Math.min(t.x1,t.x2),o=Math.max(t.x1,t.x2),n=Math.min(t.y1,t.y2),s=Math.max(t.y1,t.y2),a=(r+o)/2,l=Math.max(1,o-r),d=Math.max(1,s-n),x=2*t.y1-t.y2,y=yt(t),h=ht(t),v=mt(t);return jsxs("g",{opacity:ct(e),children:[jsx("rect",{x:r,y:n,width:l,height:d,fill:"transparent"}),jsx("path",{d:`M ${r} ${t.y2} Q ${a} ${x} ${o} ${t.y2}`,fill:"none",stroke:y,strokeWidth:h,strokeDasharray:v,pointerEvents:"none"})]})});c("parabola_h",(t,e)=>{let r=Math.min(t.x1,t.x2),o=Math.max(t.x1,t.x2),n=Math.min(t.y1,t.y2),s=Math.max(t.y1,t.y2),a=(n+s)/2,l=Math.max(1,o-r),d=Math.max(1,s-n),x=2*t.x1-t.x2,y=yt(t),h=ht(t),v=mt(t);return jsxs("g",{opacity:ct(e),children:[jsx("rect",{x:r,y:n,width:l,height:d,fill:"transparent"}),jsx("path",{d:`M ${t.x2} ${n} Q ${x} ${a} ${t.x2} ${s}`,fill:"none",stroke:y,strokeWidth:h,strokeDasharray:v,pointerEvents:"none"})]})});c("hyperbola",(t,e)=>{let r=Math.min(t.x1,t.x2),o=Math.max(t.x1,t.x2),n=Math.min(t.y1,t.y2),s=Math.max(t.y1,t.y2),a=(r+o)/2,l=(n+s)/2,d=Math.max(1,o-r),x=Math.max(1,s-n),y=yt(t),h=ht(t),v=mt(t);return jsxs("g",{opacity:ct(e),children:[jsx("rect",{x:r,y:n,width:d,height:x,fill:"transparent"}),jsxs("g",{pointerEvents:"none",children:[jsx("path",{d:`M ${r} ${n} Q ${a} ${l} ${r} ${s}`,fill:"none",stroke:y,strokeWidth:h,strokeDasharray:v}),jsx("path",{d:`M ${o} ${n} Q ${a} ${l} ${o} ${s}`,fill:"none",stroke:y,strokeWidth:h,strokeDasharray:v})]})]})});c("modulus",(t,e)=>{let r=Math.min(t.x1,t.x2),o=Math.max(t.x1,t.x2),n=Math.min(t.y1,t.y2),s=Math.max(t.y1,t.y2),a=(r+o)/2,l=Math.max(1,o-r),d=Math.max(1,s-n),x=yt(t),y=ht(t),h=mt(t);return jsxs("g",{opacity:ct(e),children:[jsx("rect",{x:r,y:n,width:l,height:d,fill:"transparent"}),jsx("polyline",{points:`${r},${n} ${a},${s} ${o},${n}`,fill:"none",stroke:x,strokeWidth:y,strokeLinecap:"round",strokeLinejoin:"round",strokeDasharray:h,pointerEvents:"none"})]})});c("exponential",(t,e)=>{let r=Math.min(t.x1,t.x2),o=Math.max(t.x1,t.x2),n=Math.min(t.y1,t.y2),s=Math.max(t.y1,t.y2),a=(r+o)/2,l=Math.max(1,o-r),d=Math.max(1,s-n),x=yt(t),y=ht(t),h=mt(t);return jsxs("g",{opacity:ct(e),children:[jsx("rect",{x:r,y:n,width:l,height:d,fill:"transparent"}),jsx("path",{d:`M ${r} ${s} Q ${a+l*.2} ${s} ${o} ${n}`,fill:"none",stroke:x,strokeWidth:y,strokeDasharray:h,pointerEvents:"none"})]})});c("logarithmic",(t,e)=>{let r=Math.min(t.x1,t.x2),o=Math.max(t.x1,t.x2),n=Math.min(t.y1,t.y2),s=Math.max(t.y1,t.y2),a=(n+s)/2,l=Math.max(1,o-r),d=Math.max(1,s-n),x=yt(t),y=ht(t),h=mt(t);return jsxs("g",{opacity:ct(e),children:[jsx("rect",{x:r,y:n,width:l,height:d,fill:"transparent"}),jsx("path",{d:`M ${r} ${s} Q ${r} ${a-d*.2} ${o} ${n}`,fill:"none",stroke:x,strokeWidth:y,strokeDasharray:h,pointerEvents:"none"})]})});c("sine_wave",(t,e)=>{let r=Math.min(t.x1,t.x2),o=Math.max(t.x1,t.x2),n=Math.min(t.y1,t.y2),s=Math.max(t.y1,t.y2),l=(n+s)/2,d=Math.max(1,o-r),x=Math.max(1,s-n),y=d/4,h=yt(t),v=ht(t),b=mt(t);return jsxs("g",{opacity:ct(e),children:[jsx("rect",{x:r,y:n,width:d,height:x,fill:"transparent"}),jsx("path",{d:`M ${r} ${l} Q ${r+y/2} ${n}, ${r+y} ${l} T ${r+2*y} ${l} T ${r+3*y} ${l} T ${o} ${l}`,fill:"none",stroke:h,strokeWidth:v,strokeLinecap:"round",strokeLinejoin:"round",strokeDasharray:b,pointerEvents:"none"})]})});c("step_function",(t,e)=>{let r=Math.min(t.x1,t.x2),o=Math.max(t.x1,t.x2),n=Math.min(t.y1,t.y2),s=Math.max(t.y1,t.y2),a=Math.max(1,o-r),l=Math.max(1,s-n),d=yt(t),x=ht(t),y=mt(t),h=4,v=a/h,b=l/h,$=[];for(let w=0;w<h;w++){let P=r+w*v,B=s-w*b,V=P+v;$.push(jsxs("g",{children:[jsx("line",{x1:P,y1:B,x2:V,y2:B,stroke:d,strokeWidth:x,strokeDasharray:y}),jsx("circle",{cx:P,cy:B,r:x*1.5,fill:d}),jsx("circle",{cx:V,cy:B,r:x*1.5,fill:"white",stroke:d,strokeWidth:x*.75})]},w));}return jsxs("g",{opacity:ct(e),children:[jsx("rect",{x:r,y:n,width:a,height:l,fill:"transparent"}),jsx("g",{pointerEvents:"none",children:$})]})});c("shaded_area",(t,e)=>{let r=Math.min(t.x1,t.x2),o=Math.max(t.x1,t.x2),n=Math.min(t.y1,t.y2),s=Math.max(t.y1,t.y2),a=(r+o)/2,l=Math.max(1,o-r),d=Math.max(1,s-n),x=yt(t),y=ht(t),h=mt(t);return jsxs("g",{opacity:ct(e),children:[jsx("rect",{x:r,y:n,width:l,height:d,fill:"transparent"}),jsxs("g",{pointerEvents:"none",children:[jsx("path",{d:`M ${r} ${s} L ${r} ${n+d*.3} Q ${a} ${n} ${o} ${n+d*.3} L ${o} ${s} Z`,fill:x,opacity:.2}),jsx("path",{d:`M ${r} ${n+d*.3} Q ${a} ${n} ${o} ${n+d*.3}`,fill:"none",stroke:x,strokeWidth:y,strokeDasharray:h})]})]})});var tt=t=>t.color||"#0f172a",rt=t=>t.strokeWidth||2,et=t=>t.fontSize||18;c("mass_box",t=>{let e=t.size||30,r=tt(t),o=rt(t),n=et(t);return jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("rect",{x:-e/2,y:-e/2,width:e,height:e,fill:r,fillOpacity:.2,stroke:r,strokeWidth:o,rx:4}),t.label?jsx("text",{x:0,y:0,dominantBaseline:"central",textAnchor:"middle",fontSize:n,fill:r,fontWeight:"bold",children:String(t.label)}):null]})});c("tuning_fork",t=>{let e=tt(t),r=rt(t),o=et(t),n=Math.max(3,r);return jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("path",{d:"M -10 -20 L -10 0 Q -10 10 0 10 Q 10 10 10 0 L 10 -20",fill:"none",stroke:e,strokeWidth:n,strokeLinecap:"round"}),jsx("line",{x1:"0",y1:"10",x2:"0",y2:"30",stroke:e,strokeWidth:Math.max(4,r),strokeLinecap:"round"}),t.label?jsx("text",{x:0,y:45,fontSize:o,fill:e,textAnchor:"middle",children:String(t.label)}):null]})});c("speaker",t=>{let e=tt(t),r=et(t);return jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("polygon",{points:"-10,-15 5,-25 5,25 -10,15",fill:e}),jsx("rect",{x:"-20",y:"-15",width:"10",height:"30",fill:e}),jsx("path",{d:"M 12 -10 Q 18 0 12 10 M 18 -20 Q 28 0 18 20",fill:"none",stroke:e,strokeWidth:2,strokeLinecap:"round"}),t.label?jsx("text",{x:0,y:40,fontSize:r,fill:e,textAnchor:"middle",children:String(t.label)}):null]})});c("wavefronts",t=>{let e=t.rings||5,r=t.velocityRatio??0,o=tt(t),n=rt(t),s=et(t),a=[];for(let l=1;l<=e;l++){let d=l*20,x=r*d;a.push(jsx("circle",{cx:x,cy:0,r:d,fill:"none",stroke:o,strokeWidth:n,opacity:1-l/e*.5},l));}return jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("circle",{cx:0,cy:0,r:4,fill:o}),a,t.label?jsx("text",{x:0,y:e*20+20,fontSize:s,fill:o,textAnchor:"middle",children:String(t.label)}):null]})});c("pendulum",t=>{let e=t.size||15,r=tt(t),o=rt(t),n=et(t),s=Math.atan2(t.x2-t.x1,t.y2-t.y1),a=s*(180/Math.PI),l=Math.hypot(t.x2-t.x1,t.y2-t.y1),d=Math.min(40,l*.5),x=Math.sin(s)*d,y=Math.cos(s)*d,h=s>0?0:1,v=t.showForces;return jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("line",{x1:-20,y1:0,x2:20,y2:0,stroke:r,strokeWidth:2}),jsx("line",{x1:-15,y1:0,x2:-10,y2:-5,stroke:r}),jsx("line",{x1:0,y1:0,x2:5,y2:-5,stroke:r}),jsx("line",{x1:15,y1:0,x2:20,y2:-5,stroke:r}),jsx("line",{x1:0,y1:0,x2:0,y2:l+20,stroke:r,strokeWidth:1,strokeDasharray:"4 4",opacity:.5}),Math.abs(s)>.05?jsx("path",{d:`M 0 ${d} A ${d} ${d} 0 0 ${h} ${x} ${y}`,fill:"none",stroke:r,strokeWidth:1.5}):null,jsxs("g",{transform:`rotate(${-a})`,children:[jsx("line",{x1:0,y1:0,x2:0,y2:l,stroke:r,strokeWidth:o}),jsx("circle",{cx:0,cy:l,r:e,fill:r,stroke:"#fff",strokeWidth:2}),v?jsxs("g",{transform:`translate(0, ${l})`,children:[jsxs("g",{transform:`rotate(${a})`,children:[jsx("line",{x1:0,y1:0,x2:0,y2:40,stroke:"#ef4444",strokeWidth:2}),jsx("polygon",{points:"0,45 -4,37 4,37",fill:"#ef4444"}),jsx("text",{x:10,y:40,fontSize:12,fill:"#ef4444",children:"F_g"})]}),jsx("line",{x1:0,y1:0,x2:0,y2:-40,stroke:"#3b82f6",strokeWidth:2}),jsx("polygon",{points:"0,-45 -4,-37 4,-37",fill:"#3b82f6"}),jsx("text",{x:10,y:-35,fontSize:12,fill:"#3b82f6",children:"T"}),jsx("line",{x1:0,y1:0,x2:-35*Math.sin(s),y2:0,stroke:"#10b981",strokeWidth:2}),jsx("polygon",{points:`${ -40*Math.sin(s)},0 ${ -32*Math.sin(s)},-4 ${ -32*Math.sin(s)},4`,fill:"#10b981"}),jsx("text",{x:-45*Math.sin(s),y:-10,fontSize:12,fill:"#10b981",children:"F_g sin(\u03B8)"})]}):null,t.label?jsx("text",{x:0,y:l+e+15,fontSize:n,fill:r,textAnchor:"middle",children:String(t.label)}):null]})]})});c("phasor",t=>{let e=W(t.x1,t.y1,t.x2,t.y2),r=C(t.x1,t.y1,t.x2,t.y2),o=t.x2-t.x1,n=t.y2-t.y1,s=tt(t),a=rt(t),l=et(t),d=t.showProjection;return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${r})`,children:[jsx("circle",{cx:0,cy:0,r:e,fill:"none",stroke:s,strokeWidth:1,strokeDasharray:"4 4",opacity:.5}),jsx("line",{x1:-e-10,y1:0,x2:e+10,y2:0,stroke:s,strokeWidth:1,opacity:.3}),jsx("line",{x1:0,y1:-e-10,x2:0,y2:e+10,stroke:s,strokeWidth:1,opacity:.3}),jsx("line",{x1:0,y1:0,x2:e,y2:0,stroke:s,strokeWidth:a}),jsx("polygon",{points:`${e},0 ${e-12},-6 ${e-12},6`,fill:s}),d?jsxs("g",{transform:`rotate(${-r})`,children:[jsx("line",{x1:o,y1:n,x2:o,y2:0,stroke:"#ef4444",strokeWidth:1,strokeDasharray:"4 4"}),jsx("line",{x1:o,y1:n,x2:0,y2:n,stroke:"#3b82f6",strokeWidth:1,strokeDasharray:"4 4"}),jsx("line",{x1:0,y1:0,x2:o,y2:0,stroke:"#ef4444",strokeWidth:2}),jsx("polygon",{points:`${o},0 ${o>0?o-8:o+8},-4 ${o>0?o-8:o+8},4`,fill:"#ef4444"}),jsx("line",{x1:0,y1:0,x2:0,y2:n,stroke:"#3b82f6",strokeWidth:2}),jsx("polygon",{points:`0,${n} -4,${n>0?n-8:n+8} 4,${n>0?n-8:n+8}`,fill:"#3b82f6"})]}):null,jsx("path",{d:`M ${e*.3} 0 A ${e*.3} ${e*.3} 0 0 0 ${e*.3*Math.cos(-r*Math.PI/180)} ${e*.3*Math.sin(-r*Math.PI/180)}`,fill:"none",stroke:s,strokeWidth:1.5,transform:`rotate(${-r})`}),t.label?jsx("text",{x:e/2,y:-15,fontSize:l,fill:s,textAnchor:"middle",children:String(t.label)}):null]})});c("sine_wave",t=>{let e=W(t.x1,t.y1,t.x2,t.y2),r=C(t.x1,t.y1,t.x2,t.y2),o=t.amplitude||40,n=t.loops||2,s=e/(n/2),a=tt(t),l=rt(t),d=et(t),x="M 0 0",y=Math.max(1,e/100);for(let h=0;h<=e;h+=y)x+=` L ${h} ${-o*Math.sin(h/s*2*Math.PI)}`;return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${r})`,children:[jsx("line",{x1:0,y1:0,x2:e,y2:0,stroke:a,strokeWidth:1,strokeDasharray:"4 4",opacity:.5}),jsx("path",{d:x,fill:"none",stroke:a,strokeWidth:l,strokeLinejoin:"round"}),t.label?jsx("text",{x:e/2,y:-o-15,fontSize:d,fill:a,textAnchor:"middle",children:String(t.label)}):null]})});c("standing_wave",t=>{let e=W(t.x1,t.y1,t.x2,t.y2),r=C(t.x1,t.y1,t.x2,t.y2),o=t.amplitude||40,n=t.loops||3,s=e/(n/2),a=tt(t),l=rt(t),d=et(t),x="M 0 0",y="M 0 0",h=Math.max(1,e/100);for(let v=0;v<=e;v+=h){let b=o*Math.sin(v/s*2*Math.PI);x+=` L ${v} ${-b}`,y+=` L ${v} ${b}`;}return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${r})`,children:[jsx("line",{x1:0,y1:0,x2:e,y2:0,stroke:a,strokeWidth:1,opacity:.5}),jsx("path",{d:x,fill:a,fillOpacity:.1,stroke:a,strokeWidth:l,strokeLinejoin:"round"}),jsx("path",{d:y,fill:"none",stroke:a,strokeWidth:l,strokeDasharray:"4 4",strokeLinejoin:"round"}),t.label?jsx("text",{x:e/2,y:-o-15,fontSize:d,fill:a,textAnchor:"middle",children:String(t.label)}):null]})});c("shm_graph",t=>{let e=W(t.x1,t.y1,t.x2,t.y2),r=C(t.x1,t.y1,t.x2,t.y2),o=t.amplitude||40,n=t.loops||1,s=e/n,a=t.graphType||"x",l=tt(t),d=rt(t),x=et(t),y=`M 0 ${-o}`,h="M 0 0",v=`M 0 ${o}`,b=Math.max(1,e/100);for(let $=0;$<=e;$+=b){let w=$/s*2*Math.PI;y+=` L ${$} ${-o*Math.cos(w)}`,h+=` L ${$} ${-o*.8*-Math.sin(w)}`,v+=` L ${$} ${-o*.6*-Math.cos(w)}`;}return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${r})`,children:[jsx("line",{x1:0,y1:0,x2:e,y2:0,stroke:l,strokeWidth:1,opacity:.5}),jsx("line",{x1:0,y1:-o*1.2,x2:0,y2:o*1.2,stroke:l,strokeWidth:1,opacity:.5}),(a==="x"||a==="all")&&jsx("path",{d:y,fill:"none",stroke:"#3b82f6",strokeWidth:d,strokeLinejoin:"round"}),(a==="v"||a==="all")&&jsx("path",{d:h,fill:"none",stroke:"#ef4444",strokeWidth:d,strokeLinejoin:"round"}),(a==="a"||a==="all")&&jsx("path",{d:v,fill:"none",stroke:"#10b981",strokeWidth:d,strokeLinejoin:"round"}),t.label?jsx("text",{x:e/2,y:-o-15,fontSize:x,fill:l,textAnchor:"middle",children:String(t.label)}):null]})});c("energy_graph",t=>{let e=W(t.x1,t.y1,t.x2,t.y2),r=C(t.x1,t.y1,t.x2,t.y2),o=t.amplitude||50,n=t.loops||1,s=e/n,a=t.domain||"time",l=tt(t),d=rt(t),x=et(t),y="M 0 0",h=`M 0 ${-o}`,v=Math.max(1,e/100);if(a==="time"){y=`M 0 ${-o}`,h="M 0 0";for(let b=0;b<=e;b+=v){let $=b/s*2*Math.PI;y+=` L ${b} ${-o*Math.pow(Math.cos($),2)}`,h+=` L ${b} ${-o*Math.pow(Math.sin($),2)}`;}}else for(let b=0;b<=e;b+=v){let $=2*(b/e)-1,w=o*$*$;y+=` L ${b} ${-w}`,h+=` L ${b} ${-(o-w)}`;}return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${r})`,children:[jsx("line",{x1:0,y1:0,x2:e,y2:0,stroke:l,strokeWidth:1,opacity:.5}),jsx("line",{x1:0,y1:-o,x2:e,y2:-o,stroke:l,strokeWidth:1,strokeDasharray:"4 4",opacity:.5}),jsx("path",{d:y,fill:"none",stroke:"#10b981",strokeWidth:d,strokeLinejoin:"round"}),jsx("path",{d:h,fill:"none",stroke:"#ef4444",strokeWidth:d,strokeLinejoin:"round"}),t.label?jsx("text",{x:e/2,y:-o-15,fontSize:x,fill:l,textAnchor:"middle",children:String(t.label)}):null]})});c("strobe_shm",t=>{let e=W(t.x1,t.y1,t.x2,t.y2),r=C(t.x1,t.y1,t.x2,t.y2),o=t.amplitude||40,n=t.loops||1,s=tt(t),a=rt(t),l=et(t),d=10,x=[],y=[],h=[];for(let v=0;v<=d;v++){let b=v/d,$=o*Math.cos(b*2*Math.PI*n),w=b*e;x.push(`${$},${w}`),y.push(jsx("circle",{cx:$,cy:w,r:a*2,fill:s},`c${v}`)),h.push(jsx("line",{x1:-o-20,y1:w,x2:o+20,y2:w,stroke:s,strokeWidth:1,strokeDasharray:"4 4",opacity:.3},`l${v}`));}return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${r})`,children:[h,jsx("polyline",{points:x.join(" "),fill:"none",stroke:s,strokeWidth:1,opacity:.4}),jsx("line",{x1:0,y1:0,x2:0,y2:e,stroke:s,strokeWidth:1,opacity:.5}),y,t.label?jsx("text",{x:0,y:-15,fontSize:l,fill:s,textAnchor:"middle",children:String(t.label)}):null]})});c("torsion_pendulum",t=>{let e=W(t.x1,t.y1,t.x2,t.y2),r=C(t.x1,t.y1,t.x2,t.y2),o=tt(t),n=rt(t),s=et(t);return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${r})`,children:[jsx("line",{x1:0,y1:0,x2:e,y2:0,stroke:o,strokeWidth:n}),jsx("ellipse",{cx:e,cy:0,rx:40,ry:15,fill:o,fillOpacity:.2,stroke:o,strokeWidth:n}),jsx("line",{x1:e,y1:0,x2:e+40,y2:0,stroke:o,strokeWidth:n,strokeDasharray:"2 2"}),jsx("line",{x1:e,y1:0,x2:e+30,y2:20,stroke:"#ef4444",strokeWidth:n}),jsx("path",{d:`M ${e+20} 0 A 20 7.5 0 0 1 ${e+15} 10`,fill:"none",stroke:"#ef4444",strokeWidth:1.5}),t.label?jsx("text",{x:e/2,y:-15,fontSize:s,fill:o,textAnchor:"middle",children:String(t.label)}):null]})});c("vane_liquid",t=>{let e=W(t.x1,t.y1,t.x2,t.y2),r=C(t.x1,t.y1,t.x2,t.y2),o=tt(t),n=rt(t),s=et(t),a=Math.max(40,e*.4),l=Math.max(40,e*.5);return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${r})`,children:[jsx("line",{x1:0,y1:0,x2:e,y2:0,stroke:o,strokeWidth:n}),jsx("line",{x1:e,y1:-a*.3,x2:e,y2:a*.3,stroke:o,strokeWidth:n*1.5,strokeLinecap:"round"}),jsx("path",{d:`M ${e-l} ${-a/2} L ${e+10} ${-a/2} L ${e+10} ${a/2} L ${e-l} ${a/2}`,fill:"none",stroke:o,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),jsx("rect",{x:e-l+2,y:-a/2+2,width:l+8,height:a-4,fill:"#38bdf8",fillOpacity:.3}),t.label?jsx("text",{x:e/2,y:-a/2-15,fontSize:s,fill:o,textAnchor:"middle",children:String(t.label)}):null]})});c("wave_pulse",t=>{let e=W(t.x1,t.y1,t.x2,t.y2),r=C(t.x1,t.y1,t.x2,t.y2),o=t.amplitude||50,n=tt(t),s=rt(t),a=et(t),l=e/2,d=e/6,x="M 0 0",y=Math.max(1,e/50);for(let h=0;h<=e;h+=y){let v=o*Math.exp(-Math.pow(h-l,2)/(2*d*d));x+=` L ${h} ${-v}`;}return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${r})`,children:[jsx("line",{x1:0,y1:0,x2:e,y2:0,stroke:n,strokeWidth:s,strokeLinecap:"round"}),jsx("path",{d:x,fill:n,fillOpacity:.1,stroke:n,strokeWidth:s,strokeLinejoin:"round"}),t.label?jsx("text",{x:l,y:-o-15,fontSize:a,fill:n,textAnchor:"middle",children:String(t.label)}):null]})});c("damped_wave",t=>{let e=W(t.x1,t.y1,t.x2,t.y2),r=C(t.x1,t.y1,t.x2,t.y2),o=t.amplitude||50,n=t.damping||.015,s=t.frequency||10,a=tt(t),l=rt(t),d=et(t),x=`M 0 ${-o}`,y=`M 0 ${-o}`,h=`M 0 ${o}`,v=Math.max(1,e/200);for(let b=0;b<=e;b+=v){let $=o*Math.exp(-n*b),w=$*Math.cos(b/e*s*2*Math.PI);x+=` L ${b} ${-w}`,y+=` L ${b} ${-$}`,h+=` L ${b} ${$}`;}return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${r})`,children:[jsx("line",{x1:0,y1:0,x2:e,y2:0,stroke:a,strokeWidth:1,opacity:.3}),jsx("path",{d:y,fill:"none",stroke:a,strokeWidth:1,strokeDasharray:"4 4",opacity:.5}),jsx("path",{d:h,fill:"none",stroke:a,strokeWidth:1,strokeDasharray:"4 4",opacity:.5}),jsx("path",{d:x,fill:"none",stroke:a,strokeWidth:l,strokeLinejoin:"round"}),t.label?jsx("text",{x:e/2,y:-o-15,fontSize:d,fill:a,textAnchor:"middle",children:String(t.label)}):null]})});c("beats_graph",t=>{let e=W(t.x1,t.y1,t.x2,t.y2),r=C(t.x1,t.y1,t.x2,t.y2),o=t.amplitude||30,n=t.frequency||20,s=t.beatFreq||2,a=tt(t),l=rt(t),d=et(t),x="M 0 0",y="M 0 0",h="M 0 0",v=Math.max(1,e/200);for(let b=0;b<=e;b+=v){let $=o*Math.cos(b/e*s*Math.PI),w=$*Math.sin(b/e*n*2*Math.PI);x+=` L ${b} ${-w}`,y+=` L ${b} ${-Math.abs($)}`,h+=` L ${b} ${Math.abs($)}`;}return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${r})`,children:[jsx("line",{x1:0,y1:0,x2:e,y2:0,stroke:a,strokeWidth:1,opacity:.3}),jsx("path",{d:y,fill:"none",stroke:a,strokeWidth:1,strokeDasharray:"2 4",opacity:.5}),jsx("path",{d:h,fill:"none",stroke:a,strokeWidth:1,strokeDasharray:"2 4",opacity:.5}),jsx("path",{d:x,fill:"none",stroke:a,strokeWidth:l,strokeLinejoin:"round"}),t.label?jsx("text",{x:e/2,y:-o-20,fontSize:d,fill:a,textAnchor:"middle",children:String(t.label)}):null]})});c("mach_cone",t=>{let e=W(t.x1,t.y1,t.x2,t.y2),r=C(t.x1,t.y1,t.x2,t.y2),o=t.machNumber||2,n=Math.asin(1/Math.max(1.01,o)),s=e,a=s*Math.tan(n),l=tt(t),d=rt(t),x=et(t);return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${r})`,children:[jsx("line",{x1:0,y1:0,x2:s,y2:0,stroke:l,strokeWidth:1,strokeDasharray:"4 4"}),jsx("line",{x1:s,y1:0,x2:0,y2:-a,stroke:l,strokeWidth:d}),jsx("line",{x1:s,y1:0,x2:0,y2:a,stroke:l,strokeWidth:d}),jsx("circle",{cx:s,cy:0,r:4,fill:l}),[.2,.5,.8].map(y=>jsx("circle",{cx:s*y,cy:0,r:(1-y)*a,fill:"none",stroke:l,strokeWidth:1,opacity:.6},y)),t.label?jsx("text",{x:s/2,y:a+20,fontSize:x,fill:l,textAnchor:"middle",children:String(t.label)}):null]})});c("wall",t=>{let e=W(t.x1,t.y1,t.x2,t.y2),r=C(t.x1,t.y1,t.x2,t.y2),o=tt(t),n=rt(t),s=et(t),a=[],l=Math.max(2,Math.floor(e/10));for(let d=0;d<=l;d++){let x=d/l*e;a.push(jsx("line",{x1:x,y1:0,x2:x-8,y2:-12,stroke:o,strokeWidth:1},d));}return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${r})`,children:[jsx("line",{x1:0,y1:0,x2:e,y2:0,stroke:o,strokeWidth:n}),a,t.label?jsx("text",{x:e/2,y:20,fontSize:s,fill:o,textAnchor:"middle",children:String(t.label)}):null]})});var Q=t=>t.color||"#0f172a",$t=t=>t.strokeWidth||2,he=t=>t.fontSize||18;c("string",t=>{let e=W(t.x1,t.y1,t.x2,t.y2),r=C(t.x1,t.y1,t.x2,t.y2);return jsx("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${r})`,children:jsx("line",{x1:0,y1:0,x2:e,y2:0,stroke:Q(t),strokeWidth:$t(t),strokeLinecap:"round"})})});c("surface",t=>{let e=W(t.x1,t.y1,t.x2,t.y2),r=C(t.x1,t.y1,t.x2,t.y2),o=Math.max(0,Math.floor(e/12)),n=[];for(let s=0;s<=o;s++)n.push(jsx("line",{x1:s*12,y1:0,x2:s*12-8,y2:12,stroke:Q(t),strokeWidth:1.5},s));return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${r})`,children:[jsx("line",{x1:0,y1:0,x2:e,y2:0,stroke:Q(t),strokeWidth:$t(t)+.5,strokeLinecap:"round"}),n]})});var Ie=t=>t.rotation||0;c("block",t=>{let e=Math.abs(t.x2-t.x1),r=Math.abs(t.y2-t.y1),o=(t.x1+t.x2)/2,n=(t.y1+t.y2)/2,s=Ie(t);return jsxs("g",{transform:`translate(${o}, ${n}) rotate(${s})`,children:[jsx("rect",{x:-e/2,y:-r/2,width:e,height:r,fill:"#f1f5f9",stroke:Q(t),strokeWidth:$t(t)}),t.label?jsx("text",{x:0,y:t.value?-6:0,dominantBaseline:"central",textAnchor:"middle",fill:Q(t),fontSize:18,fontFamily:"serif",fontWeight:"bold",children:String(t.label)}):null,t.value?jsx("text",{x:0,y:t.label?10:0,dominantBaseline:"central",textAnchor:"middle",fill:"#4b5563",fontSize:14,fontFamily:"sans-serif",children:String(t.value)}):null]})});c("cart",t=>{let e=Math.abs(t.x2-t.x1),r=Math.abs(t.y2-t.y1),o=(t.x1+t.x2)/2,n=(t.y1+t.y2)/2,s=Ie(t),a=Math.min(e*.15,r*.25,12);return jsxs("g",{transform:`translate(${o}, ${n}) rotate(${s})`,children:[jsx("rect",{x:-e/2,y:-r/2,width:e,height:r-a,fill:"#f1f5f9",stroke:Q(t),strokeWidth:$t(t)}),jsx("circle",{cx:-e/2+a*1.5,cy:r/2-a,r:a,fill:"#cbd5e1",stroke:Q(t),strokeWidth:$t(t)}),jsx("circle",{cx:e/2-a*1.5,cy:r/2-a,r:a,fill:"#cbd5e1",stroke:Q(t),strokeWidth:$t(t)}),t.label?jsx("text",{x:0,y:t.value?-8:-2,dominantBaseline:"central",textAnchor:"middle",fill:Q(t),fontSize:18,fontFamily:"serif",fontWeight:"bold",children:String(t.label)}):null,t.value?jsx("text",{x:0,y:t.label?8:-2,dominantBaseline:"central",textAnchor:"middle",fill:"#4b5563",fontSize:14,fontFamily:"sans-serif",children:String(t.value)}):null]})});c("particle",t=>{let e=W(t.x1,t.y1,t.x2,t.y2),r=Math.max(5,e);return jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("circle",{cx:0,cy:0,r,fill:Q(t)}),t.label?jsx("text",{x:0,y:-r-12,dominantBaseline:"central",textAnchor:"middle",fill:Q(t),fontSize:he(t),fontFamily:"serif",fontWeight:"bold",children:String(t.label)}):null,t.value?jsx("text",{x:0,y:r+12,dominantBaseline:"central",textAnchor:"middle",fill:"#4b5563",fontSize:14,fontFamily:"sans-serif",children:String(t.value)}):null]})});c("disk",t=>{let e=W(t.x1,t.y1,t.x2,t.y2),r=Math.max(10,e);return jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("circle",{cx:0,cy:0,r,fill:"#e2e8f0",stroke:Q(t),strokeWidth:$t(t)}),jsx("line",{x1:0,y1:0,x2:r,y2:0,stroke:Q(t),strokeWidth:$t(t)}),jsx("circle",{cx:0,cy:0,r:3,fill:Q(t)}),t.label?jsx("text",{x:0,y:-r-12,dominantBaseline:"central",textAnchor:"middle",fill:Q(t),fontSize:he(t),fontFamily:"serif",fontWeight:"bold",children:String(t.label)}):null,t.value?jsx("text",{x:0,y:r+12,dominantBaseline:"central",textAnchor:"middle",fill:"#4b5563",fontSize:14,fontFamily:"sans-serif",children:String(t.value)}):null]})});c("com",t=>jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("circle",{cx:0,cy:0,r:10,fill:"none",stroke:Q(t),strokeWidth:$t(t)}),jsx("path",{d:"M 0 -10 A 10 10 0 0 1 10 0 L 0 0 Z",fill:Q(t)}),jsx("path",{d:"M 0 10 A 10 10 0 0 1 -10 0 L 0 0 Z",fill:Q(t)})]}));c("pivot",t=>jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("polygon",{points:"0,0 -12,20 12,20",fill:"#f8fafc",stroke:Q(t),strokeWidth:$t(t),strokeLinejoin:"round"}),jsx("line",{x1:-20,y1:20,x2:20,y2:20,stroke:Q(t),strokeWidth:$t(t),strokeLinecap:"round"}),jsx("circle",{cx:0,cy:0,r:3,fill:Q(t)})]}));c("pulley",t=>{let e=W(t.x1,t.y1,t.x2,t.y2),r=Math.max(10,e);return jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("circle",{cx:0,cy:0,r,fill:"#f8fafc",stroke:Q(t),strokeWidth:$t(t)}),jsx("circle",{cx:0,cy:0,r:4,fill:Q(t)}),t.label?jsx("text",{x:0,y:-r-12,dominantBaseline:"central",textAnchor:"middle",fill:Q(t),fontSize:he(t),fontFamily:"serif",fontWeight:"bold",children:String(t.label)}):null]})});var L=t=>t.color||"#0f172a",q=t=>t.strokeWidth||2,dt=t=>t.fontSize||18;function ho(t,e,r=20){let o=Math.max(3,e??Math.floor(t/20)),n=t/o,s=`M 0 0 L ${n*.2} 0 `;for(let a=0;a<o;a++){let l=a*n;a===o-1?s+=`L ${l+n*.25} ${-r/2} L ${l+n*.75} ${r/2} L ${t} 0 `:s+=`L ${l+n*.25} ${-r/2} L ${l+n*.75} ${r/2} L ${l+n} 0 `;}return s}c("point_mass",t=>{let e=t.size??15;return jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("circle",{cx:0,cy:0,r:e,fill:L(t),fillOpacity:.8,stroke:L(t),strokeWidth:2}),jsx("circle",{cx:0,cy:0,r:e*.3,fill:"#fff",fillOpacity:.5}),t.label?jsx("text",{x:0,y:e+15,fontSize:dt(t),fill:L(t),textAnchor:"middle",fontWeight:"bold",children:String(t.label)}):null]})});c("com_indicator",t=>{let e=t.size??15;return jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("circle",{cx:0,cy:0,r:e,fill:"none",stroke:L(t),strokeWidth:q(t)}),jsx("line",{x1:-e*1.3,y1:0,x2:e*1.3,y2:0,stroke:L(t),strokeWidth:q(t)}),jsx("line",{x1:0,y1:-e*1.3,x2:0,y2:e*1.3,stroke:L(t),strokeWidth:q(t)}),jsx("path",{d:`M 0 0 L ${e} 0 A ${e} ${e} 0 0 0 0 ${-e} Z`,fill:L(t),fillOpacity:.5}),jsx("path",{d:`M 0 0 L ${-e} 0 A ${e} ${e} 0 0 0 0 ${e} Z`,fill:L(t),fillOpacity:.5}),t.label?jsx("text",{x:0,y:e+15,fontSize:dt(t),fill:L(t),textAnchor:"middle",fontWeight:"bold",children:String(t.label)}):null]})});c("pivot",t=>{let e=t.size??20;return jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("polygon",{points:`0,0 ${-e},${e*1.5} ${e},${e*1.5}`,fill:"none",stroke:L(t),strokeWidth:q(t)}),jsx("line",{x1:-e*1.5,y1:e*1.5,x2:e*1.5,y2:e*1.5,stroke:L(t),strokeWidth:q(t)+1,strokeLinecap:"round"}),jsx("circle",{cx:0,cy:0,r:q(t)*1.5,fill:L(t)}),Array.from({length:5},(r,o)=>jsx("line",{x1:-e+o*e*.5,y1:e*1.5,x2:-e+o*e*.5-5,y2:e*1.5+8,stroke:L(t),strokeWidth:1},o)),t.label?jsx("text",{x:0,y:e*1.5+20,fontSize:dt(t),fill:L(t),textAnchor:"middle",children:String(t.label)}):null]})});c("block_mass",t=>{let e=Math.min(t.x1,t.x2),r=Math.min(t.y1,t.y2),o=Math.max(1,Math.abs(t.x2-t.x1)),n=Math.max(1,Math.abs(t.y2-t.y1));return jsxs("g",{transform:`translate(${e}, ${r})`,children:[jsx("rect",{x:0,y:0,width:o,height:n,fill:L(t),fillOpacity:.2,stroke:L(t),strokeWidth:q(t),rx:2}),t.label?jsx("text",{x:o/2,y:n/2,dominantBaseline:"central",textAnchor:"middle",fontSize:dt(t),fill:L(t),fontWeight:"bold",children:String(t.label)}):null]})});c("system_boundary",t=>{let e=Math.min(t.x1,t.x2),r=Math.min(t.y1,t.y2),o=Math.max(1,Math.abs(t.x2-t.x1)),n=Math.max(1,Math.abs(t.y2-t.y1));return jsxs("g",{transform:`translate(${e}, ${r})`,children:[jsx("rect",{x:0,y:0,width:o,height:n,fill:"none",stroke:L(t),strokeWidth:q(t),strokeDasharray:"8 6",rx:15}),t.label?jsx("text",{x:o/2,y:-10,fontSize:dt(t),fill:L(t),textAnchor:"middle",fontStyle:"italic",children:String(t.label)}):null]})});c("rocket",t=>{let e=t.x2-t.x1,r=t.y2-t.y1,o=Math.hypot(e,r),n=C(t.x1,t.y1,t.x2,t.y2),s=Math.min(t.x1,t.x2),a=Math.max(t.x1,t.x2);Math.min(t.y1,t.y2);Math.max(t.y1,t.y2);let x=Math.max(1,a-s);return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${n})`,children:[jsx("path",{d:`M 0 ${-x/4} L ${o*.7} ${-x/4} L ${o} 0 L ${o*.7} ${x/4} L 0 ${x/4} Z`,fill:"none",stroke:L(t),strokeWidth:q(t)}),jsx("polygon",{points:`0,${-x/4} ${o*.2},${-x/4} 0,${-x/2}`,fill:L(t),fillOpacity:.8}),jsx("polygon",{points:`0,${x/4} ${o*.2},${x/4} 0,${x/2}`,fill:L(t),fillOpacity:.8}),jsx("path",{d:`M 0 ${-x/6} Q ${-o*.3} 0 0 ${x/6}`,fill:"#f97316",fillOpacity:.8}),jsx("path",{d:`M 0 ${-x/8} Q ${-o*.5} 0 0 ${x/8}`,fill:"#ef4444",fillOpacity:.6}),t.label?jsx("text",{x:o/2,y:-x/2-10,fontSize:dt(t),fill:L(t),textAnchor:"middle",children:String(t.label)}):null]})});c("dashed_path",t=>{let e=W(t.x1,t.y1,t.x2,t.y2),r=C(t.x1,t.y1,t.x2,t.y2);return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${r})`,children:[jsx("line",{x1:0,y1:0,x2:e,y2:0,stroke:L(t),strokeWidth:q(t),strokeLinecap:"round",strokeDasharray:"8 6"}),t.label?jsx("text",{x:e/2,y:-10,fontSize:dt(t),fill:L(t),textAnchor:"middle",children:String(t.label)}):null]})});c("uniform_rod",t=>{let e=W(t.x1,t.y1,t.x2,t.y2),r=C(t.x1,t.y1,t.x2,t.y2),o=q(t);return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${r})`,children:[jsx("rect",{x:0,y:-o/2,width:e,height:o,fill:L(t),rx:o/4}),jsx("circle",{cx:e/2,cy:0,r:Math.max(2,o/4),fill:"#fff"}),t.label?jsx("text",{x:e/2,y:-o/2-10,fontSize:dt(t),fill:L(t),textAnchor:"middle",children:String(t.label)}):null]})});c("solid_disk",t=>{let e=t.x2-t.x1,r=t.y2-t.y1,o=Math.hypot(e,r);return jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("circle",{cx:0,cy:0,r:o,fill:L(t),fillOpacity:.4,stroke:L(t),strokeWidth:q(t)}),t.label?jsx("text",{x:0,y:o+20,fontSize:dt(t),fill:L(t),textAnchor:"middle",children:String(t.label)}):null]})});c("hoop_ring",t=>{let e=t.x2-t.x1,r=t.y2-t.y1,o=Math.hypot(e,r);return jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("circle",{cx:0,cy:0,r:o,fill:"none",stroke:L(t),strokeWidth:Math.max(4,q(t)*2)}),t.label?jsx("text",{x:0,y:o+20,fontSize:dt(t),fill:L(t),textAnchor:"middle",children:String(t.label)}):null]})});c("rolling_body",t=>{let e=t.x2-t.x1,r=t.y2-t.y1,o=Math.hypot(e,r);return jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("circle",{cx:0,cy:0,r:o,fill:L(t),fillOpacity:.1,stroke:L(t),strokeWidth:q(t)}),jsx("line",{x1:-o,y1:0,x2:o,y2:0,stroke:L(t),strokeWidth:1,strokeDasharray:"4 4"}),jsx("line",{x1:0,y1:-o,x2:0,y2:o,stroke:L(t),strokeWidth:1,strokeDasharray:"4 4"}),jsx("circle",{cx:0,cy:0,r:3,fill:L(t)}),t.showVelocity?jsxs("g",{children:[jsx("line",{x1:0,y1:0,x2:o*1.5,y2:0,stroke:"#ef4444",strokeWidth:2}),jsx("polygon",{points:`${o*1.5},0 ${o*1.5-8},-4 ${o*1.5-8},4`,fill:"#ef4444"}),jsx("text",{x:o*1.5+10,y:5,fill:"#ef4444",fontSize:14,fontStyle:"italic",children:"v"})]}):null,t.showOmega?jsxs("g",{transform:`translate(0, ${-o*1.2})`,children:[jsx("path",{d:`M ${-o*.4} 0 A ${o*.4} ${o*.4} 0 0 1 ${o*.4} 0`,fill:"none",stroke:"#10b981",strokeWidth:2}),jsx("polygon",{points:`${o*.4},0 ${o*.4-4},-6 ${o*.4+4},-6`,fill:"#10b981"}),jsx("text",{x:0,y:-10,fill:"#10b981",fontSize:14,fontStyle:"italic",textAnchor:"middle",children:"\u03C9"})]}):null,t.label?jsx("text",{x:0,y:o+20,fontSize:dt(t),fill:L(t),textAnchor:"middle",children:String(t.label)}):null]})});c("inclined_wedge",t=>{let{x1:e,y1:r,x2:o,y2:n}=t,s=o-e,a=n-r,l=Math.atan2(a,s)*(180/Math.PI);return jsxs("g",{children:[jsx("polygon",{points:`${e},${r} ${e},${n} ${o},${n}`,fill:L(t),fillOpacity:.1,stroke:L(t),strokeWidth:q(t),strokeLinejoin:"round"}),t.label?jsx("text",{x:(e+o)/2,y:n-10,fontSize:dt(t),fill:L(t),textAnchor:"middle",children:String(t.label)}):null,Math.abs(o-e)>20&&Math.abs(n-r)>20?jsx("path",{d:`M ${o>e?o-20:o+20} ${n} A 20 20 0 0 ${o>e?0:1} ${o>e?o-20*Math.cos(l*Math.PI/180):o+20*Math.cos(l*Math.PI/180)} ${n-20*Math.sin(Math.abs(l)*Math.PI/180)}`,fill:"none",stroke:L(t),strokeWidth:1}):null]})});c("pulley",t=>{let e=t.x2-t.x1,r=t.y2-t.y1,o=Math.hypot(e,r);return jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("path",{d:`M 0 0 L 0 ${-o*1.5}`,fill:"none",stroke:L(t),strokeWidth:q(t)}),jsx("line",{x1:-o*.8,y1:-o*1.5,x2:o*.8,y2:-o*1.5,stroke:L(t),strokeWidth:q(t)}),Array.from({length:5},(n,s)=>jsx("line",{x1:-o*.8+s*o*.4,y1:-o*1.5,x2:-o*.8+s*o*.4+5,y2:-o*1.5-5,stroke:L(t),strokeWidth:1},s)),jsx("circle",{cx:0,cy:0,r:o,fill:"#fff",stroke:L(t),strokeWidth:q(t)}),jsx("circle",{cx:0,cy:0,r:o*.8,fill:"none",stroke:L(t),strokeWidth:1,opacity:.3}),jsx("circle",{cx:0,cy:0,r:3,fill:L(t)}),t.label?jsx("text",{x:0,y:-o*1.5-15,fontSize:dt(t),fill:L(t),textAnchor:"middle",children:String(t.label)}):null]})});c("curve_arrow",t=>{let e=W(t.x1,t.y1,t.x2,t.y2),r=C(t.x1,t.y1,t.x2,t.y2);return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${r})`,children:[jsx("path",{d:`M 0 0 Q ${e/2} ${-e*.5} ${e} 0`,fill:"none",stroke:L(t),strokeWidth:q(t),strokeLinecap:"round"}),jsx("polygon",{points:`${e},0 ${e-8},-6 ${e-4},-1`,fill:L(t),transform:`rotate(20 ${e} 0)`}),t.label?jsx("text",{x:e/2,y:-e*.3,fontSize:dt(t),fill:L(t),textAnchor:"middle",children:String(t.label)}):null]})});c("spring",t=>{let e=W(t.x1,t.y1,t.x2,t.y2),r=C(t.x1,t.y1,t.x2,t.y2);return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${r})`,children:[jsx("path",{d:ho(e,t.coils),fill:"none",stroke:L(t),strokeWidth:q(t),strokeLinecap:"round",strokeLinejoin:"round"}),t.label?jsx("text",{x:e/2,y:-20,fontSize:dt(t),fill:L(t),textAnchor:"middle",children:String(t.label)}):null]})});var kt=(t,e)=>e?.isSelected?"#2563eb":t.color||"#111827",Lt=(t,e)=>e?.isSelected?2.5:t.strokeWidth||2;c("wire",(t,e)=>jsxs("g",{opacity:e?.isGhost?.5:1,children:[jsx("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:"transparent",strokeWidth:20,strokeLinecap:"round"}),jsx("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:kt(t,e),strokeWidth:Lt(t,e),strokeLinecap:"round",pointerEvents:"none"})]}));var Ht=(t,e,r)=>{let o=W(t.x1,t.y1,t.x2,t.y2),n=C(t.x1,t.y1,t.x2,t.y2),s=t.x2-t.x1,a=t.y2-t.y1,l=(t.x1+t.x2)/2,d=(t.y1+t.y2)/2,x=-a/(o||1),y=s/(o||1);y>0&&(x=-x,y=-y);let h=20;return jsxs("g",{opacity:r?.isGhost?.5:1,children:[jsx("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:"transparent",strokeWidth:20}),jsx("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${n})`,children:jsx("g",{children:e})}),t.label&&jsx("text",{x:l+x*h,y:d+y*h,dominantBaseline:"central",textAnchor:"middle",fill:kt(t,r),fontSize:"16",fontFamily:"serif",fontWeight:"bold",children:String(t.label)}),t.value&&jsx("text",{x:l-x*h,y:d-y*h,dominantBaseline:"central",textAnchor:"middle",fill:"#4b5563",fontSize:"14",fontFamily:"sans-serif",children:String(t.value)})]})};c("resistor",(t,e)=>{let r=W(t.x1,t.y1,t.x2,t.y2),o=r/2-15;return Ht(t,jsx("path",{d:`M 0 0 L ${o} 0 l 2.5 -8 l 5 16 l 5 -16 l 5 16 l 5 -16 l 5 16 l 2.5 -8 L ${r} 0`,fill:"none",stroke:kt(t,e),strokeWidth:Lt(t,e),strokeLinejoin:"bevel"}),e)});c("capacitor",(t,e)=>{let r=W(t.x1,t.y1,t.x2,t.y2),o=r/2;return Ht(t,jsx("path",{d:`M 0 0 L ${o-4} 0 M ${o-4} -12 L ${o-4} 12 M ${o+4} -12 L ${o+4} 12 M ${o+4} 0 L ${r} 0`,fill:"none",stroke:kt(t,e),strokeWidth:Lt(t,e)}),e)});c("inductor",(t,e)=>{let r=W(t.x1,t.y1,t.x2,t.y2),o=r/2-15;return Ht(t,jsx("path",{d:`M 0 0 L ${o} 0 A 5 5 0 0 0 ${o+10} 0 A 5 5 0 0 0 ${o+20} 0 A 5 5 0 0 0 ${o+30} 0 L ${r} 0`,fill:"none",stroke:kt(t,e),strokeWidth:Lt(t,e)}),e)});c("diode",(t,e)=>{let r=W(t.x1,t.y1,t.x2,t.y2),o=r/2;return Ht(t,jsx("path",{d:`M 0 0 L ${o-8} 0 M ${o-8} -8 L ${o-8} 8 L ${o+8} 0 Z M ${o+8} -8 L ${o+8} 8 M ${o+8} 0 L ${r} 0`,fill:"none",stroke:kt(t,e),strokeWidth:Lt(t,e)}),e)});c("battery",(t,e)=>{let r=W(t.x1,t.y1,t.x2,t.y2),o=r/2;return Ht(t,jsxs(Fragment,{children:[jsx("path",{d:`M 0 0 L ${o-4} 0 M ${o-4} -16 L ${o-4} 16 M ${o+4} -8 L ${o+4} 8 M ${o+4} 0 L ${r} 0`,fill:"none",stroke:kt(t,e),strokeWidth:Lt(t,e)}),jsx("line",{x1:o+4,y1:-8,x2:o+4,y2:8,stroke:kt(t,e),strokeWidth:Lt(t,e)+2}),jsx("text",{x:o-12,y:-12,fontSize:"12",fill:kt(t,e),textAnchor:"middle",children:"+"})]}),e)});["meter_v","meter_a"].forEach(t=>c(t,(e,r)=>{let o=W(e.x1,e.y1,e.x2,e.y2),n=o/2,s=t==="meter_v"?"V":"A";return Ht(e,jsxs(Fragment,{children:[jsx("path",{d:`M 0 0 L ${n-14} 0 M ${n+14} 0 L ${o} 0`,fill:"none",stroke:kt(e,r),strokeWidth:Lt(e,r)}),jsx("circle",{cx:n,cy:0,r:14,fill:"#f8f9fa",stroke:kt(e,r),strokeWidth:Lt(e,r)}),jsx("text",{x:n,y:0,textAnchor:"middle",dominantBaseline:"central",fill:kt(e,r),fontSize:"14",fontWeight:"bold",children:s})]}),r)}));c("ground",(t,e)=>jsx("g",{transform:`translate(${t.x1}, ${t.y1})`,opacity:e?.isGhost?.5:1,children:jsx("path",{d:"M 0 0 L 0 15 M -12 15 L 12 15 M -8 20 L 8 20 M -4 25 L 4 25",fill:"none",stroke:kt(t,e),strokeWidth:Lt(t,e)})}));var Qe=t=>{let e={};return t.forEach(r=>{if(r.type!=="wire")return;let o=`${r.x1},${r.y1}`,n=`${r.x2},${r.y2}`;e[o]=(e[o]||0)+1,e[n]=(e[n]||0)+1;}),Object.entries(e).filter(([,r])=>r>2).map(([r])=>r.split(",").map(Number))};var vt=t=>t.color||"#0f172a",Dt=t=>t.strokeWidth||2,Nt=t=>t.fontSize||18,ie=t=>{let e=Math.sin(t)*1e4;return e-Math.floor(e)},mo=t=>{if(t.lineStyle==="dashed")return "6 6";if(t.lineStyle==="dotted")return "2 4"};c("pv_axes",t=>{let e=Math.min(t.x1,t.x2),r=Math.min(t.y1,t.y2),o=Math.max(1,Math.abs(t.x2-t.x1)),n=Math.max(1,Math.abs(t.y2-t.y1)),s=String(t.yLabel??"P"),a=String(t.xLabel??"V"),l=vt(t),d=Dt(t),x=Nt(t);return jsxs("g",{transform:`translate(${e}, ${r})`,children:[jsx("line",{x1:0,y1:0,x2:0,y2:n,stroke:l,strokeWidth:d}),jsx("polygon",{points:"0,0 -5,10 5,10",fill:l}),jsx("text",{x:-15,y:10,fontSize:x,fill:l,fontWeight:"bold",children:s}),jsx("line",{x1:0,y1:n,x2:o,y2:n,stroke:l,strokeWidth:d}),jsx("polygon",{points:`${o},${n} ${o-10},${n-5} ${o-10},${n+5}`,fill:l}),jsx("text",{x:o-10,y:n+20,fontSize:x,fill:l,fontWeight:"bold",children:a}),jsx("text",{x:-10,y:n+15,fontSize:12,fill:l,children:"0"}),t.label?jsx("text",{x:o/2,y:-10,fontSize:x,fill:l,textAnchor:"middle",children:String(t.label)}):null]})});c("piston_cylinder",t=>{let e=Math.min(t.x1,t.x2),r=Math.min(t.y1,t.y2),o=Math.max(1,Math.abs(t.x2-t.x1)),n=Math.max(1,Math.abs(t.y2-t.y1)),s=t.compression??.5,a=n*s,l=vt(t),d=Dt(t),x=[],y=40;for(let h=0;h<y;h++){let v=ie(Number(t.id)+h)*(o-10)+5,b=a+10+ie(Number(t.id)+h*100)*(n-a-15);x.push(jsx("circle",{cx:v,cy:b,r:"2",fill:"#94a3b8"},h));}return jsxs("g",{transform:`translate(${e}, ${r})`,children:[jsx("polyline",{points:`0,0 0,${n} ${o},${n} ${o},0`,fill:"#f8fafc",stroke:l,strokeWidth:d,strokeLinecap:"square",strokeLinejoin:"miter"}),x,jsxs("g",{transform:`translate(0, ${a})`,children:[jsx("rect",{x:"2",y:"0",width:o-4,height:"12",fill:"#64748b",rx:"2"}),jsx("line",{x1:o/2,y1:"0",x2:o/2,y2:"-40",stroke:"#64748b",strokeWidth:"4"}),jsx("line",{x1:o/2-15,y1:"-40",x2:o/2+15,y2:"-40",stroke:"#64748b",strokeWidth:"6",strokeLinecap:"round"}),jsx("line",{x1:o/2,y1:"-50",x2:o/2,y2:"-42",stroke:"#ef4444",strokeWidth:"2"}),jsx("polygon",{points:`${o/2},-42 ${o/2-4},-46 ${o/2+4},-46`,fill:"#ef4444"})]}),t.showHeat?jsxs("g",{transform:`translate(${o/2}, ${n+15})`,children:[jsx("path",{d:"M-10,0 Q-15,-10 -5,-20 Q0,-10 10,-15 Q5,-5 10,0 Z",fill:"#ef4444",opacity:"0.8"}),jsx("path",{d:"M-5,0 Q-8,-6 0,-12 Q2,-5 5,0 Z",fill:"#f59e0b"}),jsx("text",{x:"25",y:"-5",fontSize:"14",fill:"#ef4444",fontWeight:"bold",children:"Q"})]}):null,t.label?jsx("text",{x:o/2,y:n+(t.showHeat?35:20),textAnchor:"middle",fill:l,fontSize:Nt(t),children:String(t.label)}):null]})});c("heat_engine",t=>{let e=Math.min(t.x1,t.x2),r=Math.min(t.y1,t.y2),o=Math.max(1,Math.abs(t.x2-t.x1)),n=Math.max(1,Math.abs(t.y2-t.y1)),s=t.engineType!=="refrigerator",a=Math.min(o*.3,n*.2),l=vt(t),d=Dt(t),x=Nt(t);return jsxs("g",{transform:`translate(${e}, ${r})`,children:[jsx("rect",{x:0,y:0,width:o,height:n*.2,fill:"#ef4444",rx:"4"}),jsx("text",{x:o/2,y:n*.1,fontSize:x,fill:"#fff",textAnchor:"middle",dominantBaseline:"central",children:"T_H"}),jsx("rect",{x:0,y:n*.8,width:o,height:n*.2,fill:"#3b82f6",rx:"4"}),jsx("text",{x:o/2,y:n*.9,fontSize:x,fill:"#fff",textAnchor:"middle",dominantBaseline:"central",children:"T_C"}),jsx("circle",{cx:o/2,cy:n/2,r:a,fill:"#fff",stroke:l,strokeWidth:d}),jsx("text",{x:o/2,y:n/2,fontSize:x*1.2,fill:l,textAnchor:"middle",dominantBaseline:"central",fontWeight:"bold",children:s?"E":"R"}),jsxs("g",{strokeWidth:2,stroke:l,children:[jsx("line",{x1:o/2,y1:n*.2,x2:o/2,y2:n*.5-a-5}),jsx("polygon",{points:s?`${o/2},${n*.5-a-2} ${o/2-5},${n*.5-a-10} ${o/2+5},${n*.5-a-10}`:`${o/2},${n*.2+2} ${o/2-5},${n*.2+10} ${o/2+5},${n*.2+10}`,fill:l}),jsx("text",{x:o/2+10,y:n*.35,fontSize:14,fill:l,dominantBaseline:"central",children:"Q_H"}),jsx("line",{x1:o/2,y1:n*.5+a+5,x2:o/2,y2:n*.8}),jsx("polygon",{points:s?`${o/2},${n*.8-2} ${o/2-5},${n*.8-10} ${o/2+5},${n*.8-10}`:`${o/2},${n*.5+a+2} ${o/2-5},${n*.5+a+10} ${o/2+5},${n*.5+a+10}`,fill:l}),jsx("text",{x:o/2+10,y:n*.65,fontSize:14,fill:l,dominantBaseline:"central",children:"Q_C"}),jsx("line",{x1:s?o/2+a+5:o,y1:n/2,x2:s?o:o/2+a+5,y2:n/2}),jsx("polygon",{points:s?`${o},${n/2} ${o-8},${n/2-5} ${o-8},${n/2+5}`:`${o/2+a+5},${n/2} ${o/2+a+13},${n/2-5} ${o/2+a+13},${n/2+5}`,fill:l}),jsx("text",{x:o*.8,y:n/2-15,fontSize:14,fill:l,textAnchor:"middle",children:"W"})]}),t.label?jsx("text",{x:o/2,y:n+20,fontSize:x,fill:l,textAnchor:"middle",children:String(t.label)}):null]})});c("conduction_rod",t=>{let e=W(t.x1,t.y1,t.x2,t.y2),r=C(t.x1,t.y1,t.x2,t.y2),o=`grad-rod-${t.id}`,n=vt(t),s=Dt(t),a=Nt(t);return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${r})`,children:[jsx("defs",{children:jsxs("linearGradient",{id:o,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[jsx("stop",{offset:"0%",stopColor:"#ef4444"}),jsx("stop",{offset:"100%",stopColor:"#3b82f6"})]})}),jsx("rect",{x:0,y:-20,width:e,height:40,fill:`url(#${o})`,stroke:n,strokeWidth:s,rx:"4"}),jsxs("g",{stroke:"#fff",strokeWidth:"2",opacity:.6,children:[jsx("line",{x1:e*.2,y1:0,x2:e*.4,y2:0}),jsx("polygon",{points:`${e*.4},0 ${e*.4-6},-4 ${e*.4-6},4`,fill:"#fff"}),jsx("line",{x1:e*.6,y1:0,x2:e*.8,y2:0}),jsx("polygon",{points:`${e*.8},0 ${e*.8-6},-4 ${e*.8-6},4`,fill:"#fff"})]}),jsx("text",{x:0,y:-30,fontSize:a,fill:"#ef4444",textAnchor:"middle",fontWeight:"bold",children:"T_H"}),jsx("text",{x:e,y:-30,fontSize:a,fill:"#3b82f6",textAnchor:"middle",fontWeight:"bold",children:"T_C"}),t.label?jsx("text",{x:e/2,y:35,fontSize:a,fill:n,textAnchor:"middle",children:String(t.label)}):null]})});c("thermo_process",t=>{let e=t.processType||"isotherm",r=t.x2-t.x1,o=t.y2-t.y1,n="";e==="isobaric"?n=`M 0 0 L ${r} 0`:e==="isochoric"?n=`M 0 0 L 0 ${o}`:e==="adiabatic"?n=`M 0 0 Q ${r*.1} ${o*.9} ${r} ${o}`:n=`M 0 0 Q ${r*.2} ${o*.8} ${r} ${o}`;let s=r/2,a=o/2;if(e==="isotherm"||e==="adiabatic"){let v=r*(e==="adiabatic"?.1:.2),b=o*(e==="adiabatic"?.9:.8);s=.25*0+.5*v+.25*r,a=.25*0+.5*b+.25*o;}let l=Math.atan2(o,r)*180/Math.PI,d=mo(t),x=vt(t),y=Dt(t),h=Nt(t);return jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("path",{d:n,fill:"none",stroke:x,strokeWidth:y,strokeDasharray:d}),jsx("g",{transform:`translate(${s}, ${a}) rotate(${l})`,children:jsx("polygon",{points:"0,0 -8,-5 -8,5",fill:x})}),t.label?jsx("text",{x:s+15,y:a-10,fontSize:h,fill:x,children:String(t.label)}):null]})});c("carnot_cycle",t=>{let e=Math.min(t.x1,t.x2),r=Math.min(t.y1,t.y2),o=Math.max(1,Math.abs(t.x2-t.x1)),n=Math.max(1,Math.abs(t.y2-t.y1)),s={x:o*.1,y:n*.1},a={x:o*.6,y:n*.3},l={x:o*.9,y:n*.9},d={x:o*.4,y:n*.7},x=`M ${s.x} ${s.y} Q ${o*.3} ${n*.15} ${a.x} ${a.y}`,y=`Q ${o*.7} ${n*.6} ${l.x} ${l.y}`,h=`Q ${o*.6} ${n*.85} ${d.x} ${d.y}`,v=`Q ${o*.2} ${n*.4} ${s.x} ${s.y}`,b=vt(t),$=Dt(t),w=Nt(t);return jsxs("g",{transform:`translate(${e}, ${r})`,children:[jsx("path",{d:`${x} ${y} ${h} ${v} Z`,fill:b,fillOpacity:.1}),jsx("path",{d:x,fill:"none",stroke:"#ef4444",strokeWidth:$}),jsx("path",{d:`M ${a.x} ${a.y} ${y}`,fill:"none",stroke:"#64748b",strokeWidth:$,strokeDasharray:"4 4"}),jsx("path",{d:`M ${l.x} ${l.y} ${h}`,fill:"none",stroke:"#3b82f6",strokeWidth:$}),jsx("path",{d:`M ${d.x} ${d.y} ${v}`,fill:"none",stroke:"#64748b",strokeWidth:$,strokeDasharray:"4 4"}),jsx("circle",{cx:s.x,cy:s.y,r:"3",fill:"#1e293b"}),jsx("circle",{cx:a.x,cy:a.y,r:"3",fill:"#1e293b"}),jsx("circle",{cx:l.x,cy:l.y,r:"3",fill:"#1e293b"}),jsx("circle",{cx:d.x,cy:d.y,r:"3",fill:"#1e293b"}),jsx("text",{x:o*.4,y:n*.15,fontSize:"14",fill:"#ef4444",fontWeight:"bold",children:"T_H"}),jsx("text",{x:o*.6,y:n*.95,fontSize:"14",fill:"#3b82f6",fontWeight:"bold",children:"T_C"}),jsx("text",{x:o/2,y:n/2+5,fontSize:16,fill:b,textAnchor:"middle",fontWeight:"bold",children:"W"}),t.label?jsx("text",{x:o/2,y:-15,fontSize:w,fill:b,textAnchor:"middle",children:String(t.label)}):null]})});c("maxwell_boltzmann",t=>{let e=Math.min(t.x1,t.x2),r=Math.min(t.y1,t.y2),o=Math.max(1,Math.abs(t.x2-t.x1)),n=Math.max(1,Math.abs(t.y2-t.y1)),s=t.t1||300,a=t.t2||600,l=Dt(t),d=Nt(t),x=vt(t),y=(h,v,b,$)=>{let w=`M 0 ${n}`,P=1/h,B=Math.sqrt(2/P),V=B*3.5;for(let H=0;H<=o;H+=2){let U=H/o*V,f=U*U*Math.exp(-P*U*U),G=B*B*Math.exp(-1),gt=n-f/G*v;w+=` L ${H} ${gt}`;}return jsx("path",{d:w,fill:"none",stroke:b,strokeWidth:l,strokeDasharray:$,strokeLinejoin:"round"})};return jsxs("g",{transform:`translate(${e}, ${r})`,children:[jsx("line",{x1:0,y1:0,x2:0,y2:n,stroke:"#1e293b",strokeWidth:"2"}),jsx("line",{x1:0,y1:n,x2:o,y2:n,stroke:"#1e293b",strokeWidth:"2"}),jsx("text",{x:-25,y:n/2,fontSize:14,fill:"#1e293b",transform:`rotate(-90, -25, ${n/2})`,textAnchor:"middle",children:"N(v)"}),jsx("text",{x:o/2,y:n+20,fontSize:14,fill:"#1e293b",textAnchor:"middle",children:"Speed (v)"}),y(s,n*.8,"#ef4444"),y(a,n*.5,"#3b82f6","4 4"),jsx("rect",{x:o-70,y:10,width:10,height:10,fill:"#ef4444"}),jsxs("text",{x:o-55,y:20,fontSize:12,fill:"#1e293b",children:["T\u2081 = ",s,"K"]}),jsx("rect",{x:o-70,y:30,width:10,height:10,fill:"#3b82f6"}),jsxs("text",{x:o-55,y:40,fontSize:12,fill:"#1e293b",children:["T\u2082 = ",a,"K"]}),t.label?jsx("text",{x:o/2,y:-15,fontSize:d,fill:x,textAnchor:"middle",children:String(t.label)}):null]})});c("diatomic_gas",t=>{let e=vt(t);Dt(t);let o=Nt(t),n=t.showRotations!==false;return jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("circle",{cx:-15,cy:0,r:8,fill:e,stroke:"#fff",strokeWidth:2}),jsx("circle",{cx:15,cy:0,r:8,fill:e,stroke:"#fff",strokeWidth:2}),jsx("line",{x1:-10,y1:0,x2:10,y2:0,stroke:e,strokeWidth:4}),n?jsxs("g",{stroke:"#94a3b8",strokeWidth:1.5,fill:"none",children:[jsx("path",{d:"M -10 -15 A 15 15 0 0 1 10 -15",strokeDasharray:"2 2"}),jsx("polygon",{points:"10,-15 6,-18 6,-12",fill:"#94a3b8"}),jsx("path",{d:"M -25 0 A 25 10 0 0 1 0 10 A 25 10 0 0 1 25 0",strokeDasharray:"2 2"})]}):null,t.label?jsx("text",{x:0,y:25,fontSize:o,fill:e,textAnchor:"middle",children:String(t.label)}):null]})});c("random_walk",t=>{let e=t.steps||5,r=Math.hypot(t.x2-t.x1,t.y2-t.y1),o="M 0 0",n=0,s=0,a=[jsx("circle",{cx:"0",cy:"0",r:"4",fill:"#22c55e"},"start")];for(let l=1;l<=e;l++){let d=ie(Number(t.id)+l*7)*Math.PI*2,x=r/e*(.5+ie(Number(t.id)+l*13));n+=Math.cos(d)*x,s+=Math.sin(d)*x,o+=` L ${n} ${s}`,a.push(jsx("circle",{cx:n,cy:s,r:l===e?4:2,fill:l===e?"#ef4444":vt(t)},l));}return jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("path",{d:o,fill:"none",stroke:vt(t),strokeWidth:Dt(t),strokeLinejoin:"round"}),a,t.label?jsx("text",{x:r/2,y:r/2,fontSize:Nt(t),fill:vt(t),textAnchor:"middle",children:String(t.label)}):null]})});var lt=(t,e)=>e?"#0d9488":t.color||"#111827",Wt=(t,e)=>{let r=t.strokeWidth||2;return e?Math.max(3,r):r},me=t=>t.fontSize||16,Jt=(t,e,r)=>Array.from({length:t}).map((o,n)=>{let s=(n*360/t+r)*(Math.PI/180);return `${e*Math.cos(s)},${e*Math.sin(s)}`}).join(" ");c("atom",(t,e)=>jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("rect",{x:"-20",y:"-15",width:"40",height:"30",fill:"white",rx:"6"}),jsx("text",{x:"0",y:"0",dominantBaseline:"central",textAnchor:"middle",fill:lt(t,e.isSelected),fontSize:Math.max(18,me(t)),fontFamily:"sans-serif",fontWeight:"bold",children:String(t.label||"C")})]}));c("charge_plus",(t,e)=>{let r=lt(t,e.isSelected),o=Wt(t,e.isSelected),n=t.strokeWidth||2,s=Math.max(12,n*4);return jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("circle",{cx:"0",cy:"0",r:s,fill:"white",stroke:r,strokeWidth:o}),jsx("line",{x1:-s/2,y1:"0",x2:s/2,y2:"0",stroke:r,strokeWidth:o}),jsx("line",{x1:"0",y1:-s/2,x2:"0",y2:s/2,stroke:r,strokeWidth:o}),t.label&&jsx("text",{x:"0",y:s+18,fontSize:me(t),fill:r,fontFamily:"sans-serif",fontWeight:"bold",textAnchor:"middle",children:String(t.label)})]})});c("charge_minus",(t,e)=>{let r=lt(t,e.isSelected),o=Wt(t,e.isSelected),n=t.strokeWidth||2,s=Math.max(12,n*4);return jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("circle",{cx:"0",cy:"0",r:s,fill:"white",stroke:r,strokeWidth:o}),jsx("line",{x1:-s/2,y1:"0",x2:s/2,y2:"0",stroke:r,strokeWidth:o}),t.label&&jsx("text",{x:"0",y:s+18,fontSize:me(t),fill:r,fontFamily:"sans-serif",fontWeight:"bold",textAnchor:"middle",children:String(t.label)})]})});c("radical",(t,e)=>jsx("circle",{cx:t.x1,cy:t.y1,r:"3.5",fill:lt(t,e.isSelected)}));c("lone_pair",(t,e)=>jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("circle",{cx:"-4",cy:"0",r:"2.5",fill:lt(t,e.isSelected)}),jsx("circle",{cx:"4",cy:"0",r:"2.5",fill:lt(t,e.isSelected)})]}));c("benzene",(t,e)=>{let o=lt(t,e.isSelected),n=Wt(t,e.isSelected);return jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("polygon",{points:Jt(6,30,-30),fill:"white",stroke:o,strokeWidth:n,strokeLinejoin:"round"}),jsx("circle",{cx:"0",cy:"0",r:20,fill:"none",stroke:o,strokeWidth:n})]})});c("cyclohexane",(t,e)=>jsx("g",{transform:`translate(${t.x1}, ${t.y1})`,children:jsx("polygon",{points:Jt(6,30,-30),fill:"white",stroke:lt(t,e.isSelected),strokeWidth:Wt(t,e.isSelected),strokeLinejoin:"round"})}));c("cyclopentane",(t,e)=>jsx("g",{transform:`translate(${t.x1}, ${t.y1})`,children:jsx("polygon",{points:Jt(5,30,-90),fill:"white",stroke:lt(t,e.isSelected),strokeWidth:Wt(t,e.isSelected),strokeLinejoin:"round"})}));c("cyclobutane",(t,e)=>jsx("g",{transform:`translate(${t.x1}, ${t.y1})`,children:jsx("polygon",{points:Jt(4,30,-45),fill:"white",stroke:lt(t,e.isSelected),strokeWidth:Wt(t,e.isSelected),strokeLinejoin:"round"})}));c("cyclopropane",(t,e)=>jsx("g",{transform:`translate(${t.x1}, ${t.y1})`,children:jsx("polygon",{points:Jt(3,30,-90),fill:"white",stroke:lt(t,e.isSelected),strokeWidth:Wt(t,e.isSelected),strokeLinejoin:"round"})}));var Ut=(t,e,r)=>{let o=W(t.x1,t.y1,t.x2,t.y2),n=C(t.x1,t.y1,t.x2,t.y2),s=lt(t,r),a=Wt(t,r);return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${n})`,children:[e==="single"&&jsx("line",{x1:"0",y1:"0",x2:o,y2:"0",stroke:s,strokeWidth:a,strokeLinecap:"round"}),e==="double"&&jsxs(Fragment,{children:[jsx("line",{x1:"0",y1:"-3.5",x2:o,y2:"-3.5",stroke:s,strokeWidth:a,strokeLinecap:"round"}),jsx("line",{x1:"0",y1:"3.5",x2:o,y2:"3.5",stroke:s,strokeWidth:a,strokeLinecap:"round"})]}),e==="triple"&&jsxs(Fragment,{children:[jsx("line",{x1:"0",y1:"-6",x2:o,y2:"-6",stroke:s,strokeWidth:a,strokeLinecap:"round"}),jsx("line",{x1:"0",y1:"0",x2:o,y2:"0",stroke:s,strokeWidth:a,strokeLinecap:"round"}),jsx("line",{x1:"0",y1:"6",x2:o,y2:"6",stroke:s,strokeWidth:a,strokeLinecap:"round"})]}),e==="wedge"&&jsx("polygon",{points:`0,0 ${o},-5 ${o},5`,fill:s}),e==="dash"&&jsx("line",{x1:"0",y1:"0",x2:o,y2:"0",stroke:s,strokeWidth:a+1,strokeDasharray:"5 5",strokeLinecap:"square"})]})};c("single_bond",(t,e)=>Ut(t,"single",e.isSelected));c("double_bond",(t,e)=>Ut(t,"double",e.isSelected));c("triple_bond",(t,e)=>Ut(t,"triple",e.isSelected));c("wedge_bond",(t,e)=>Ut(t,"wedge",e.isSelected));c("dash_bond",(t,e)=>Ut(t,"dash",e.isSelected));var Ve=t=>({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2});c("reaction_arrow",(t,e)=>{let r=W(t.x1,t.y1,t.x2,t.y2),o=C(t.x1,t.y1,t.x2,t.y2),n=lt(t,e.isSelected),s=Wt(t,e.isSelected),a=Ve(t);return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${o})`,children:[jsx("line",{x1:"0",y1:"0",x2:r,y2:"0",stroke:n,strokeWidth:s}),jsx("polygon",{points:`${r},0 ${r-12},-6 ${r-12},6`,fill:n})]}),t.label&&jsx("text",{x:a.x,y:a.y-18,textAnchor:"middle",fill:"#0f766e",fontSize:"14",fontFamily:"sans-serif",fontWeight:"bold",children:String(t.label)}),t.value&&jsx("text",{x:a.x,y:a.y+18,textAnchor:"middle",fill:"#4b5563",fontSize:"13",fontFamily:"sans-serif",children:String(t.value)})]})});c("equilibrium_arrow",(t,e)=>{let r=W(t.x1,t.y1,t.x2,t.y2),o=C(t.x1,t.y1,t.x2,t.y2),n=lt(t,e.isSelected),s=Wt(t,e.isSelected),a=Ve(t);return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${o})`,children:[jsx("line",{x1:"0",y1:"-4",x2:r,y2:"-4",stroke:n,strokeWidth:s}),jsx("polygon",{points:`${r},-4 ${r-10},-10 ${r-10},-4`,fill:n}),jsx("line",{x1:"0",y1:"4",x2:r,y2:"4",stroke:n,strokeWidth:s}),jsx("polygon",{points:"0,4 10,4 10,10",fill:n})]}),t.label&&jsx("text",{x:a.x,y:a.y-18,textAnchor:"middle",fill:"#0f766e",fontSize:"14",fontFamily:"sans-serif",fontWeight:"bold",children:String(t.label)}),t.value&&jsx("text",{x:a.x,y:a.y+18,textAnchor:"middle",fill:"#4b5563",fontSize:"13",fontFamily:"sans-serif",children:String(t.value)})]})});c("resonance_arrow",(t,e)=>{let r=W(t.x1,t.y1,t.x2,t.y2),o=C(t.x1,t.y1,t.x2,t.y2),n=lt(t,e.isSelected),s=Wt(t,e.isSelected);return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${o})`,children:[jsx("line",{x1:"0",y1:"0",x2:r,y2:"0",stroke:n,strokeWidth:s}),jsx("polygon",{points:"0,0 12,-6 12,6",fill:n}),jsx("polygon",{points:`${r},0 ${r-12},-6 ${r-12},6`,fill:n})]})});c("curved_arrow",(t,e)=>{let r=W(t.x1,t.y1,t.x2,t.y2),o=C(t.x1,t.y1,t.x2,t.y2),n=r/3,s=Math.atan2(n,r/2)*(180/Math.PI),a=lt(t,e.isSelected),l=Wt(t,e.isSelected);return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${o})`,children:[jsx("path",{d:`M 0 0 Q ${r/2} ${-n} ${r} 0`,fill:"none",stroke:a,strokeWidth:l}),jsx("g",{transform:`translate(${r}, 0) rotate(${s})`,children:jsx("polygon",{points:"0,0 -12,-6 -12,6",fill:a})})]})});var Bt=(t,e)=>e?"#2563eb":t.color||"#0f172a",Xt=(t,e)=>e?2.5:t.strokeWidth||2,He=(t,e,r)=>{let o=W(t.x1,t.y1,t.x2,t.y2),n=C(t.x1,t.y1,t.x2,t.y2),s=t.x2-t.x1,a=t.y2-t.y1,l=(t.x1+t.x2)/2,d=(t.y1+t.y2)/2,x=-a/(o||1),y=s/(o||1);y>0&&(x=-x,y=-y);let h=18,v=Bt(t,r);return jsxs("g",{children:[jsx("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${n})`,children:e}),t.label&&jsx("text",{x:l+x*h,y:d+y*h,dominantBaseline:"central",textAnchor:"middle",fill:v,fontSize:14,fontFamily:"sans-serif",children:String(t.label)})]})};c("charge_pos",(t,e)=>{let r=e.isSelected?"#2563eb":"#ef4444";return jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,opacity:e?.isGhost?.5:1,children:[jsx("circle",{cx:"0",cy:"0",r:"10",fill:"#fecaca",stroke:r,strokeWidth:Xt(t,e.isSelected)}),jsx("line",{x1:"0",y1:"-4",x2:"0",y2:"4",stroke:r,strokeWidth:2}),jsx("line",{x1:"-4",y1:"0",x2:"4",y2:"0",stroke:r,strokeWidth:2}),t.label&&jsx("text",{x:0,y:-16,textAnchor:"middle",fill:r,fontSize:t.fontSize||14,children:String(t.label)})]})});c("charge_neg",(t,e)=>{let r=e.isSelected?"#2563eb":"#3b82f6";return jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,opacity:e?.isGhost?.5:1,children:[jsx("circle",{cx:"0",cy:"0",r:"10",fill:"#bfdbfe",stroke:r,strokeWidth:Xt(t,e.isSelected)}),jsx("line",{x1:"-4",y1:"0",x2:"4",y2:"0",stroke:r,strokeWidth:2}),t.label&&jsx("text",{x:0,y:-16,textAnchor:"middle",fill:r,fontSize:t.fontSize||14,children:String(t.label)})]})});c("dipole",(t,e)=>{let r=Xt(t,e.isSelected);return jsxs("g",{opacity:e?.isGhost?.5:1,children:[jsx("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:"#64748b",strokeWidth:r,strokeDasharray:"4 4"}),jsx("circle",{cx:t.x1,cy:t.y1,r:"8",fill:"#fecaca",stroke:e.isSelected?"#2563eb":"#ef4444",strokeWidth:r}),jsx("circle",{cx:t.x2,cy:t.y2,r:"8",fill:"#bfdbfe",stroke:e.isSelected?"#2563eb":"#3b82f6",strokeWidth:r}),t.label&&jsx("text",{x:(t.x1+t.x2)/2,y:t.y1-16,textAnchor:"middle",fill:"#475569",fontSize:14,children:String(t.label)})]})});var Ge=(t,e)=>{let r=Math.max(2,Math.floor(t/25)),o=[];for(let n=0;n<=r;n++){let s=n/r*t;o.push(jsx("g",{transform:`translate(${s}, 0)`,children:e?jsx(Fragment,{children:jsx("path",{d:"M-4 0 h8 M0 -4 v8",stroke:"#ffffff",strokeWidth:"2",strokeLinecap:"round"})}):jsx("path",{d:"M-4 0 h8",stroke:"#ffffff",strokeWidth:"2",strokeLinecap:"round"})},n));}return o};c("charged_plate_pos",(t,e)=>{let r=e.isSelected?"#2563eb":"#ef4444",o=W(t.x1,t.y1,t.x2,t.y2),n=C(t.x1,t.y1,t.x2,t.y2),s=Math.max(12,t.strokeWidth*4||8);return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${n})`,opacity:e?.isGhost?.5:1,children:[jsx("line",{x1:0,y1:0,x2:o,y2:0,stroke:r,strokeWidth:s,strokeLinecap:"round"}),Ge(o,true)]})});c("charged_plate_neg",(t,e)=>{let r=e.isSelected?"#2563eb":"#3b82f6",o=W(t.x1,t.y1,t.x2,t.y2),n=C(t.x1,t.y1,t.x2,t.y2),s=Math.max(12,t.strokeWidth*4||8);return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${n})`,opacity:e?.isGhost?.5:1,children:[jsx("line",{x1:0,y1:0,x2:o,y2:0,stroke:r,strokeWidth:s,strokeLinecap:"round"}),Ge(o,false)]})});c("gaussian_sphere",(t,e)=>{let r=Math.max(10,W(t.x1,t.y1,t.x2,t.y2)),o=e.isSelected?"#2563eb":"#10b981";return jsxs("g",{opacity:e?.isGhost?.5:1,children:[jsx("circle",{cx:t.x1,cy:t.y1,r,fill:"#d1fae5",fillOpacity:.35,stroke:o,strokeWidth:Xt(t,e.isSelected),strokeDasharray:"5 5"}),t.label&&jsx("text",{x:t.x1,y:t.y1-r-12,textAnchor:"middle",fill:o,fontSize:13,children:String(t.label)})]})});c("gaussian_cylinder",(t,e)=>{let r=W(t.x1,t.y1,t.x2,t.y2),o=C(t.x1,t.y1,t.x2,t.y2),n=t.curveHeight??40,s=15,a=e.isSelected?"#2563eb":"#10b981",l=Xt(t,e.isSelected),d="6 6";return jsxs("g",{opacity:e?.isGhost?.5:1,children:[jsx("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:"transparent",strokeWidth:Math.max(24,n*2),strokeLinecap:"round"}),jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${o})`,children:[jsx("line",{x1:0,y1:-n,x2:r,y2:-n,stroke:a,strokeWidth:l,strokeDasharray:d}),jsx("line",{x1:0,y1:n,x2:r,y2:n,stroke:a,strokeWidth:l,strokeDasharray:d}),jsx("ellipse",{cx:0,cy:0,rx:s,ry:n,fill:a,fillOpacity:.05,stroke:a,strokeWidth:l,strokeDasharray:d}),jsx("ellipse",{cx:r,cy:0,rx:s,ry:n,fill:a,fillOpacity:.05,stroke:a,strokeWidth:l,strokeDasharray:d}),t.label&&jsx("text",{x:r/2,y:-n-10,textAnchor:"middle",fill:a,fontSize:t.fontSize||14,children:String(t.label)})]})]})});c("mirror_plane",(t,e)=>He(t,jsxs(Fragment,{children:[jsx("line",{x1:0,y1:-24,x2:0,y2:24,stroke:Bt(t,e.isSelected),strokeWidth:Xt(t,e.isSelected)}),jsx("line",{x1:0,y1:-18,x2:-8,y2:-12,stroke:Bt(t,e.isSelected),strokeWidth:1.5}),jsx("line",{x1:0,y1:-6,x2:-8,y2:0,stroke:Bt(t,e.isSelected),strokeWidth:1.5}),jsx("line",{x1:0,y1:6,x2:-8,y2:12,stroke:Bt(t,e.isSelected),strokeWidth:1.5}),jsx("line",{x1:0,y1:18,x2:-8,y2:24,stroke:Bt(t,e.isSelected),strokeWidth:1.5})]}),e.isSelected));c("energy_level",(t,e)=>{let r=Math.max(24,W(t.x1,t.y1,t.x2,t.y2)),o=Bt(t,e.isSelected),n=t.energy!=null?String(t.energy):"";return He(t,jsxs(Fragment,{children:[jsx("line",{x1:0,y1:-8,x2:r,y2:-8,stroke:o,strokeWidth:Xt(t,e.isSelected)}),jsx("line",{x1:0,y1:8,x2:r,y2:8,stroke:o,strokeWidth:Xt(t,e.isSelected)}),n&&jsx("text",{x:r/2,y:22,textAnchor:"middle",fontSize:10,fill:"#4b5563",children:n})]}),e.isSelected)});var uo=({x:t,y:e,type:r})=>jsxs("g",{children:[jsx("rect",{x:t-20,y:e-12,width:40,height:24,fill:"#fee2e2",stroke:"#ef4444"}),jsx("text",{x:t,y:e,textAnchor:"middle",dominantBaseline:"central",fontSize:10,fill:"#991b1b",children:r})]}),se=({elements:t,selectedId:e,drawing:r,viewMode:o=false,showGrid:n=true,gridSize:s=20,className:a,svgRef:l,onBackgroundMouseDown:d,onBackgroundMouseMove:x,onBackgroundMouseUp:y,onBackgroundMouseLeave:h,onElementMouseDown:v})=>{let b=useMemo(()=>Qe(t),[t]);return jsxs("svg",{ref:l,className:a,onMouseDown:d,onMouseMove:x,onMouseUp:y,onMouseLeave:h,children:[!o&&n&&jsxs(Fragment,{children:[jsx("defs",{children:jsx("pattern",{id:"svg-engine-grid",width:s,height:s,patternUnits:"userSpaceOnUse",children:jsx("path",{d:`M ${s} 0 L 0 0 0 ${s}`,fill:"none",stroke:"#e2e8f0",strokeWidth:"1"})})}),jsx("rect",{width:"100%",height:"100%",fill:"url(#svg-engine-grid)",pointerEvents:"none"})]}),t.map($=>{let w=xe(String($.type)),P=w?w($,{isSelected:e===$.id,viewMode:o}):jsx(uo,{x:$.x1,y:$.y1,type:String($.type)});return jsx("g",{onMouseDown:B=>v?.(B,$),cursor:o?"default":"move",children:P},String($.id))}),b.map(([$,w],P)=>jsx("circle",{cx:$,cy:w,r:4,fill:"#111827",pointerEvents:"none"},`junction-${P}`)),r&&(()=>{let $=xe(String(r.type));return $?jsx("g",{opacity:.5,children:$(r,{isGhost:true,viewMode:o})}):null})()]})};var bo=t=>{let e="#0f172a";["spring","sine_wave","wavefronts","shm_graph"].includes(t)&&(e="#3b82f6"),["standing_wave","wave_pulse","torsion_pendulum"].includes(t)&&(e="#ec4899"),["pendulum","phasor"].includes(t)&&(e="#8b5cf6"),["wall","vane_liquid"].includes(t)&&(e="#64748b"),t==="mass_box"&&(e="#ef4444");let r={color:e,strokeWidth:2,fontSize:18};switch(t){case "standing_wave":case "sine_wave":return {...r,amplitude:40,loops:2};case "damped_wave":return {...r,amplitude:50,damping:.015,frequency:10};case "shm_graph":return {...r,amplitude:40,loops:1,graphType:"all"};case "energy_graph":return {...r,amplitude:50,loops:1,domain:"time"};case "strobe_shm":return {...r,amplitude:40,loops:1};case "beats_graph":return {...r,amplitude:30,frequency:15,beatFreq:2};case "wavefronts":return {...r,velocityRatio:.5,rings:5};case "mach_cone":return {...r,machNumber:2};case "mass_box":return {...r,size:30};case "pendulum":return {...r,size:15,showForces:false};case "phasor":return {...r,showProjection:false};case "spring":return {...r,coils:8};case "text":return {...r,label:"Equation/Label"};default:return r}},qe=(t,e)=>{if(e==="waveOscillation")return bo(t);switch(t){case "charge_pos":return {color:"#ef4444",strokeWidth:2,fontSize:18};case "charge_neg":return {color:"#3b82f6",strokeWidth:2,fontSize:18};case "charge_plus":return {color:"#ef4444",strokeWidth:2,fontSize:16};case "charge_minus":return {color:"#3b82f6",strokeWidth:2,fontSize:16};case "dipole":return {color:"#64748b",strokeWidth:2};case "charged_plate_pos":return {color:"#ef4444",strokeWidth:2};case "charged_plate_neg":return {color:"#3b82f6",strokeWidth:2};case "gaussian_sphere":return {color:"#10b981",strokeWidth:2};case "gaussian_cylinder":return {color:"#10b981",strokeWidth:2,curveHeight:40};case "vector":case "ray":case "photon":return e==="graph"?{color:"#0f172a",strokeWidth:2}:e==="mechanics"||e==="mechanical"?{color:"#0f172a",strokeWidth:2}:e==="rotation"?{color:"#ef4444",strokeWidth:2}:e==="optical"&&(t==="ray"||t==="photon")?{color:"#ef4444",strokeWidth:2}:e==="optical"?{color:"#0f172a",strokeWidth:2}:{color:"#ef4444",strokeWidth:2};case "lens_convex":case "lens_concave":case "prism":case "glass_slab":return {color:"#38bdf8",strokeWidth:2};case "mirror_plane":case "mirror_concave":case "mirror_convex":return {color:"#0f172a",strokeWidth:2};case "slit_double":case "slit_single":return {color:"#0f172a",strokeWidth:4};case "nucleus":return e==="optical"?{color:"#3b82f6",strokeWidth:2,fontSize:18}:{color:"#0f172a",strokeWidth:2,fontSize:18};case "energy_level":return {color:"#0f172a",strokeWidth:2,label:"n=1",energy:"-13.6 eV"};case "dashed_line":return {color:"#0f172a",strokeWidth:2,lineStyle:"dashed"};case "point":return e==="graph"?{color:"#0f172a",strokeWidth:2,fontSize:16,label:"P"}:e==="light"||e==="optical"?{color:"#0f172a",strokeWidth:2,fontSize:18,label:"P"}:e==="thermo"?{color:"#0f172a",strokeWidth:2,fontSize:18,label:"P"}:{};case "text":return e==="graph"?{color:"#0f172a",strokeWidth:2,fontSize:18,label:"Label"}:e==="light"||e==="optical"?{color:"#0f172a",strokeWidth:2,fontSize:18,label:"Text"}:e==="mechanics"||e==="mechanical"?{color:"#0f172a",strokeWidth:2,fontSize:20,label:"Label"}:e==="rotation"?{color:"#1e293b",strokeWidth:2,fontSize:20,label:"Label"}:e==="thermo"?{color:"#1e293b",strokeWidth:2,fontSize:18,label:"Equation/Label"}:{};case "b_field_line":case "b_field_curve":return e==="magnetism"?{color:"#10b981",strokeWidth:2}:{};case "pole_piece":return e==="magnetism"?{color:"#0f172a",strokeWidth:2,label:"N"}:{};case "b_region_in":case "b_region_out":return e==="magnetism"?{color:"#94a3b8",strokeWidth:2}:{};case "current_wire":return e==="magnetism"?{color:"#ef4444",strokeWidth:2,label:"I"}:{};case "bar_magnet":return e==="magnetism"?{color:"#0f172a",strokeWidth:2,label:""}:{};case "coil":return e==="magnetism"?{color:"#0f172a",strokeWidth:2}:{};case "bezier":return e==="magnetism"?{color:"#0f172a",strokeWidth:2}:{};case "meter":return e==="magnetism"?{color:"#0f172a",strokeWidth:2,fontSize:24,label:"G"}:{};case "ac_source":return e==="magnetism"?{color:"#0f172a",strokeWidth:2,fontSize:18,label:"V_rms"}:{};case "spring":return e==="rotation"?{color:"#0f172a",strokeWidth:2,coils:6,lineStyle:"solid"}:e==="mechanics"||e==="mechanical"?{color:"#0f172a",strokeWidth:2}:{};case "pivot":return e==="rotation"?{color:"#64748b",strokeWidth:2,size:20,fontSize:18}:e==="mechanics"||e==="mechanical"?{color:"#0f172a",strokeWidth:2}:{};case "pulley":return e==="rotation"?{color:"#64748b",strokeWidth:2,fontSize:18}:e==="mechanics"||e==="mechanical"?{color:"#0f172a",strokeWidth:2}:{};case "point_mass":return {color:"#ef4444",strokeWidth:2,size:15,fontSize:18};case "block_mass":return {color:"#3b82f6",strokeWidth:2,fontSize:18};case "com_indicator":return {color:"#10b981",strokeWidth:2,size:15,fontSize:18};case "system_boundary":case "dashed_path":return {color:"#94a3b8",strokeWidth:e==="rotation"?1.5:2,fontSize:18};case "rocket":return {color:"#ef4444",strokeWidth:2,fontSize:18};case "uniform_rod":return {color:"#f59e0b",strokeWidth:10,fontSize:18};case "solid_disk":case "hoop_ring":return {color:"#3b82f6",strokeWidth:2,fontSize:18};case "rolling_body":return {color:"#3b82f6",strokeWidth:2,fontSize:18,showVelocity:true,showOmega:true};case "inclined_wedge":return {color:"#64748b",strokeWidth:2,fontSize:18};case "curve_arrow":return {color:"#10b981",strokeWidth:2,fontSize:18};case "line":return e==="rotation"?{color:"#1e293b",strokeWidth:1.5}:e==="thermo"?{color:"#1e293b",strokeWidth:2,lineStyle:"solid"}:{};case "piston_cylinder":return e!=="thermo"?{}:{color:"#1e293b",strokeWidth:2,fontSize:18,compression:.5,showHeat:false,lineStyle:"solid"};case "heat_engine":return e!=="thermo"?{}:{color:"#10b981",strokeWidth:2,fontSize:18,engineType:"engine",efficiency:.4,lineStyle:"solid"};case "conduction_rod":return e!=="thermo"?{}:{color:"#3b82f6",strokeWidth:2,fontSize:18,lineStyle:"solid"};case "pv_axes":return e!=="thermo"?{}:{color:"#1e293b",strokeWidth:2,fontSize:18,xLabel:"V",yLabel:"P",lineStyle:"solid"};case "thermo_process":return e!=="thermo"?{}:{color:"#ec4899",strokeWidth:2,fontSize:18,processType:"isotherm",lineStyle:"solid"};case "carnot_cycle":return e!=="thermo"?{}:{color:"#ec4899",strokeWidth:2,fontSize:18,lineStyle:"solid"};case "maxwell_boltzmann":return e!=="thermo"?{}:{color:"#1e293b",strokeWidth:2,fontSize:18,t1:300,t2:600,lineStyle:"solid"};case "diatomic_gas":return {color:"#f59e0b",strokeWidth:2,fontSize:18,showRotations:true};case "random_walk":return e!=="thermo"?{}:{color:"#8b5cf6",strokeWidth:2,fontSize:18,steps:5,lineStyle:"solid"};case "string":case "surface":case "dashed":case "dimension":case "rod":case "arc":case "wedge":case "axes":case "disk":case "particle":case "com":return e==="mechanics"||e==="mechanical"?{color:"#0f172a",strokeWidth:2}:{};case "block":case "cart":return e==="mechanics"||e==="mechanical"?{color:"#0f172a",strokeWidth:2,rotation:0}:{};default:return {}}},Ze=(t,e)=>{let[r,o]=useState(t),[n,s]=useState("select"),[a,l]=useState(null),[d,x]=useState(null),[y,h]=useState(false),[v,b]=useState(false),[$,w]=useState(""),[P,B]=useState(false),[V,H]=useState(null),U=useRef(null),f=useRef({x:0,y:0}),G=useRef(null);useEffect(()=>{o(t);},[t]),useEffect(()=>{let Z=X=>{(X.key==="Delete"||X.key==="Backspace")&&d&&(o(A=>A.filter(N=>N.id!==d)),x(null),B(false)),X.key==="Escape"&&(l(null),s("select"));};return window.addEventListener("keydown",Z),()=>window.removeEventListener("keydown",Z)},[d]);let gt=useMemo(()=>r.find(Z=>Z.id===d)||null,[r,d]);return {elements:r,setElements:o,tool:n,setTool:s,drawing:a,selectedId:d,setSelectedId:x,isViewMode:y,setIsViewMode:h,showJsonModal:v,setShowJsonModal:b,jsonText:$,setJsonText:w,showProperties:P,setShowProperties:B,selectedElement:gt,svgRef:U,onElementMouseDown:(Z,X)=>{if(n!=="select"||(Z.stopPropagation(),!U.current))return;let A=oe(U.current,Z);x(X.id),H(X.id),f.current=A,G.current={x1:X.x1,y1:X.y1,x2:X.x2,y2:X.y2};},handleMouseDown:Z=>{if(!U.current)return;if(n==="select"){x(null);return}let X=oe(U.current,Z),A=It(X.x),N=It(X.y),xt=(e==="mechanics"||e==="mechanical")&&["pivot","com","axes"].includes(n),pt=e==="rotation"&&["point_mass","com_indicator","pivot"].includes(n),ao=e==="waveOscillation"&&["tuning_fork","speaker","wavefronts","mass_box"].includes(n);if(xt||pt||ao||["point","text","diatomic_gas","benzene","cyclohexane","cyclopentane","cyclobutane","cyclopropane","atom","charge_plus","charge_minus","charge_pos","charge_neg","radical","lone_pair","nucleus","meter","ac_source"].includes(n)){let de=qe(n,e),co=n==="text"?"Text":n==="atom"?"C":n==="charge_pos"?"+q":n==="charge_neg"?"-q":n==="charge_plus"?"+q":n==="charge_minus"?"-q":n==="meter"?"G":n==="ac_source"?"V_rms":"",ve={id:Date.now(),type:n,x1:A,y1:N,x2:A,y2:N,...de,label:typeof de.label=="string"?de.label:co};o(xo=>[...xo,ve]),x(ve.id),s("select");return}let ee=qe(n,e),lo=(e==="mechanics"||e==="mechanical")&&(n==="block"||n==="cart")?{rotation:ee.rotation??0}:{};l({...ee,...lo,id:Date.now(),type:n,x1:A,y1:N,x2:A,y2:N,label:typeof ee.label=="string"?ee.label:""});},handleMouseMove:Z=>{if(!U.current)return;let X=oe(U.current,Z);if(V&&G.current){let A=It(X.x-f.current.x),N=It(X.y-f.current.y);o(xt=>xt.map(pt=>pt.id===V?{...pt,x1:G.current.x1+A,y1:G.current.y1+N,x2:G.current.x2+A,y2:G.current.y2+N}:pt));return}a&&l({...a,x2:It(X.x),y2:It(X.y)});},handleMouseUp:()=>{if(V){H(null);return}if(!a)return;if(a.x1===a.x2&&a.y1===a.y2){l(null),s("select");return}let Z=a.type==="bezier"?{...a,cps:[{x:(a.x1+a.x2)/2,y:Math.min(a.y1,a.y2)-60}]}:a;o(X=>[...X,Z]),x(a.id),l(null),s("select");}}};var ke={select:jsx("path",{d:"M 8 4 L 16 12 L 11 13 L 9 18 L 6 17 L 8 12 L 4 11 Z",fill:"currentColor",stroke:"currentColor",strokeWidth:"1.5"}),point:jsx("circle",{cx:"12",cy:"12",r:"3",fill:"currentColor"}),line:jsx("line",{x1:"4",y1:"20",x2:"20",y2:"4",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),string:jsx("line",{x1:"4",y1:"12",x2:"20",y2:"12",stroke:"currentColor",strokeWidth:"2"}),vector:jsxs(Fragment,{children:[jsx("line",{x1:"4",y1:"20",x2:"18",y2:"6",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),jsx("polygon",{points:"14,4 20,4 20,10",fill:"none",stroke:"currentColor",strokeWidth:"2.5"})]}),ray:jsxs(Fragment,{children:[jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12",stroke:"currentColor",strokeWidth:"2"}),jsx("polygon",{points:"10,8 16,12 10,16",fill:"currentColor"})]}),wire:jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12",stroke:"currentColor",strokeWidth:"2.8",strokeLinecap:"round"}),text:jsx("text",{x:"12",y:"18",fontSize:"18",textAnchor:"middle",fill:"currentColor",fontWeight:"bold",fontFamily:"serif",children:"T"}),block:jsx("rect",{x:"5",y:"6",width:"14",height:"12",fill:"none",stroke:"currentColor",strokeWidth:"2",rx:"1"}),wedge:jsx("polygon",{points:"2,20 22,20 22,6",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"}),pulley:jsxs(Fragment,{children:[jsx("circle",{cx:"12",cy:"10",r:"6",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"12",y1:"2",x2:"12",y2:"10",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"6",y1:"10",x2:"6",y2:"20",stroke:"currentColor",strokeWidth:"1.5"}),jsx("line",{x1:"18",y1:"10",x2:"18",y2:"18",stroke:"currentColor",strokeWidth:"1.5"})]}),point_mass:jsx("circle",{cx:"12",cy:"12",r:"8",fill:"currentColor",stroke:"currentColor",strokeWidth:"2"}),block_mass:jsx("rect",{x:"6",y:"6",width:"12",height:"12",fill:"none",stroke:"currentColor",strokeWidth:"2",rx:"1"}),com_indicator:jsxs(Fragment,{children:[jsx("circle",{cx:"12",cy:"12",r:"8",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"12",y1:"2",x2:"12",y2:"22",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12",stroke:"currentColor",strokeWidth:"2"}),jsx("path",{d:"M 12 12 L 17 7 A 7 7 0 0 1 17 17 Z M 12 12 L 7 17 A 7 7 0 0 1 7 7 Z",fill:"currentColor",opacity:"0.3"})]}),system_boundary:jsx("rect",{x:"4",y:"4",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"3 2",rx:"4"}),rocket:jsxs(Fragment,{children:[jsx("path",{d:"M12 2 L16 8 L16 16 L20 20 L4 20 L8 16 L8 8 Z",fill:"none",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M8 20 Q12 24 16 20",fill:"currentColor"})]}),dashed_path:jsx("path",{d:"M 4 20 Q 8 8 20 4",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeDasharray:"4 3"}),uniform_rod:jsx("rect",{x:"3",y:"10",width:"18",height:"4",fill:"currentColor",rx:"2",opacity:"0.8"}),solid_disk:jsxs(Fragment,{children:[jsx("circle",{cx:"12",cy:"12",r:"9",fill:"currentColor",opacity:"0.5",stroke:"currentColor",strokeWidth:"2"}),jsx("circle",{cx:"12",cy:"12",r:"1.5",fill:"currentColor"})]}),hoop_ring:jsxs(Fragment,{children:[jsx("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:"currentColor",strokeWidth:"2.5"}),jsx("circle",{cx:"12",cy:"12",r:"1.5",fill:"currentColor"})]}),rolling_body:jsxs(Fragment,{children:[jsx("circle",{cx:"12",cy:"12",r:"8",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"12",y1:"12",x2:"20",y2:"12",stroke:"currentColor",strokeWidth:"1.5"}),jsx("polygon",{points:"18,10 22,12 18,14",fill:"currentColor"}),jsx("path",{d:"M 16 6 A 8 8 0 0 1 20 10",fill:"none",stroke:"currentColor",strokeWidth:"1.5"}),jsx("polygon",{points:"19,11 22,9 18,8",fill:"currentColor"})]}),inclined_wedge:jsx("polygon",{points:"4,20 20,20 4,8",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"}),curve_arrow:jsxs(Fragment,{children:[jsx("path",{d:"M 6 18 A 9 9 0 0 1 18 6",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("polygon",{points:"16,5 20,4 19,8",fill:"currentColor"})]}),ladder:jsxs(Fragment,{children:[jsx("line",{x1:"7",y1:"4",x2:"4",y2:"20",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"17",y1:"4",x2:"14",y2:"20",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"6",y1:"8",x2:"16",y2:"8",stroke:"currentColor",strokeWidth:"1.6"}),jsx("line",{x1:"5",y1:"12",x2:"15",y2:"12",stroke:"currentColor",strokeWidth:"1.6"}),jsx("line",{x1:"4.5",y1:"16",x2:"14.5",y2:"16",stroke:"currentColor",strokeWidth:"1.6"})]}),spring:jsx("path",{d:"M 2 12 L 5 12 L 7 6 L 11 18 L 15 6 L 19 18 L 21 12 L 22 12",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"bevel"}),arc:jsx("path",{d:"M 22 12 A 10 10 0 0 0 12 2 L 12 12 Z",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"}),arc_arrow:jsxs(Fragment,{children:[jsx("path",{d:"M 4 16 A 8 8 0 0 1 18 8",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round"}),jsx("polygon",{points:"17,5 21,9 15,10",fill:"currentColor"})]}),dashed:jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12",stroke:"currentColor",strokeWidth:"2",strokeDasharray:"4,4"}),surface:jsx("path",{d:"M 4 10 L 20 10 M 6 10 L 2 16 M 12 10 L 8 16 M 18 10 L 14 16 M 24 10 L 20 16",fill:"none",stroke:"currentColor",strokeWidth:"2"}),dimension:jsxs(Fragment,{children:[jsx("line",{x1:"4",y1:"12",x2:"20",y2:"12",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"2 2"}),jsx("polygon",{points:"4,12 8,9 8,15",fill:"currentColor"}),jsx("polygon",{points:"20,12 16,9 16,15",fill:"currentColor"})]}),axes:jsxs(Fragment,{children:[jsx("line",{x1:"6",y1:"18",x2:"6",y2:"6",stroke:"currentColor",strokeWidth:"2"}),jsx("polygon",{points:"6,4 3,9 9,9",fill:"currentColor"}),jsx("line",{x1:"6",y1:"18",x2:"18",y2:"18",stroke:"currentColor",strokeWidth:"2"}),jsx("polygon",{points:"20,18 15,15 15,21",fill:"currentColor"})]}),cart:jsx("path",{d:"M 4 8 L 20 8 L 20 14 L 4 14 Z M 8 18 A 2 2 0 1 0 8 14 A 2 2 0 1 0 8 18 M 16 18 A 2 2 0 1 0 16 14 A 2 2 0 1 0 16 18",fill:"none",stroke:"currentColor",strokeWidth:"2"}),disk:jsxs(Fragment,{children:[jsx("circle",{cx:"12",cy:"12",r:"8",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"12",y1:"12",x2:"18",y2:"18",stroke:"currentColor",strokeWidth:"2"}),jsx("circle",{cx:"12",cy:"12",r:"2",fill:"currentColor"})]}),com:jsxs(Fragment,{children:[jsx("circle",{cx:"12",cy:"12",r:"8",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("path",{d:"M 12 4 A 8 8 0 0 1 20 12 L 12 12 Z M 12 20 A 8 8 0 0 1 4 12 L 12 12 Z",fill:"currentColor"})]}),particle:jsx("circle",{cx:"12",cy:"12",r:"5",fill:"currentColor"}),pivot:jsxs(Fragment,{children:[jsx("polygon",{points:"12,6 6,18 18,18",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"4",y1:"20",x2:"20",y2:"20",stroke:"currentColor",strokeWidth:"2"}),jsx("circle",{cx:"12",cy:"6",r:"2",fill:"currentColor"})]}),dashed_line:jsx("line",{x1:"4",y1:"20",x2:"20",y2:"4",stroke:"currentColor",strokeWidth:"2.5",strokeDasharray:"4 4",strokeLinecap:"round"}),angle:jsxs(Fragment,{children:[jsx("line",{x1:"4",y1:"20",x2:"20",y2:"20",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"4",y1:"20",x2:"16",y2:"4",stroke:"currentColor",strokeWidth:"2"}),jsx("path",{d:"M 14 20 A 10 10 0 0 0 10 12",fill:"none",stroke:"currentColor",strokeWidth:"2"})]}),rectangle:jsx("rect",{x:"4",y:"6",width:"16",height:"12",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"}),circle:jsx("circle",{cx:"12",cy:"12",r:"8",fill:"none",stroke:"currentColor",strokeWidth:"2.5"}),ellipse:jsx("ellipse",{cx:"12",cy:"12",rx:"10",ry:"5",fill:"none",stroke:"currentColor",strokeWidth:"2.5"}),parabola_v:jsx("path",{d:"M 4 4 Q 12 24 20 4",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),parabola_h:jsx("path",{d:"M 20 4 Q 0 12 20 20",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),hyperbola:jsxs(Fragment,{children:[jsx("path",{d:"M 6 2 Q 12 12 6 22",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("path",{d:"M 18 2 Q 12 12 18 22",fill:"none",stroke:"currentColor",strokeWidth:"2"})]}),sine_wave:jsx("path",{d:"M 2 12 Q 7 2 12 12 T 22 12",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),mass_box:jsx("rect",{x:"6",y:"6",width:"12",height:"12",fill:"none",stroke:"currentColor",strokeWidth:"2"}),pendulum:jsxs(Fragment,{children:[jsx("line",{x1:"12",y1:"2",x2:"18",y2:"16",stroke:"currentColor",strokeWidth:"2"}),jsx("circle",{cx:"18",cy:"18",r:"4",fill:"currentColor"}),jsx("line",{x1:"6",y1:"2",x2:"18",y2:"2",stroke:"currentColor",strokeWidth:"2"})]}),phasor:jsxs(Fragment,{children:[jsx("circle",{cx:"12",cy:"12",r:"10",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"12",y1:"12",x2:"18",y2:"6",stroke:"currentColor",strokeWidth:"2"}),jsx("polygon",{points:"15,5 19,5 19,9",fill:"currentColor"})]}),damped_wave:jsx("path",{d:"M 2 12 Q 5 2 8 12 T 14 12 T 18 12 T 22 12",fill:"none",stroke:"currentColor",strokeWidth:"2"}),vane_liquid:jsxs(Fragment,{children:[jsx("path",{d:"M 4 4 L 4 20 L 20 20 L 20 4",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("rect",{x:"4",y:"10",width:"16",height:"10",fill:"currentColor",opacity:"0.35"}),jsx("line",{x1:"12",y1:"2",x2:"12",y2:"16",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"8",y1:"16",x2:"16",y2:"16",stroke:"currentColor",strokeWidth:"2"})]}),torsion_pendulum:jsxs(Fragment,{children:[jsx("line",{x1:"12",y1:"2",x2:"12",y2:"16",stroke:"currentColor",strokeWidth:"2"}),jsx("ellipse",{cx:"12",cy:"16",rx:"8",ry:"3",fill:"currentColor"}),jsx("line",{x1:"12",y1:"16",x2:"18",y2:"18",stroke:"currentColor",strokeWidth:"1"})]}),standing_wave:jsxs(Fragment,{children:[jsx("path",{d:"M 2 12 Q 7 2 12 12 T 22 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M 2 12 Q 7 22 12 12 T 22 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"2 2"})]}),wave_pulse:jsx("path",{d:"M 2 16 L 8 16 Q 12 4 16 16 L 22 16",fill:"none",stroke:"currentColor",strokeWidth:"2"}),shm_graph:jsxs(Fragment,{children:[jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12",stroke:"currentColor",strokeWidth:"1",opacity:"0.5"}),jsx("path",{d:"M 2 12 Q 7 2 12 12 T 22 12",fill:"none",stroke:"#3b82f6",strokeWidth:"2"}),jsx("path",{d:"M 2 12 Q 7 22 12 12 T 22 12",fill:"none",stroke:"#ef4444",strokeWidth:"2",strokeDasharray:"2 2"})]}),energy_graph:jsxs(Fragment,{children:[jsx("line",{x1:"2",y1:"20",x2:"22",y2:"20",stroke:"currentColor",strokeWidth:"2"}),jsx("path",{d:"M 4 6 Q 12 24 20 6",fill:"none",stroke:"#ef4444",strokeWidth:"2"}),jsx("path",{d:"M 4 20 Q 12 2 20 20",fill:"none",stroke:"#10b981",strokeWidth:"2"})]}),strobe_shm:jsxs(Fragment,{children:[jsx("circle",{cx:"12",cy:"4",r:"2",fill:"currentColor"}),jsx("circle",{cx:"18",cy:"12",r:"2",fill:"currentColor"}),jsx("circle",{cx:"12",cy:"20",r:"2",fill:"currentColor"}),jsx("line",{x1:"6",y1:"4",x2:"18",y2:"4",stroke:"currentColor",strokeWidth:"0.5"}),jsx("line",{x1:"6",y1:"12",x2:"18",y2:"12",stroke:"currentColor",strokeWidth:"0.5"}),jsx("line",{x1:"6",y1:"20",x2:"18",y2:"20",stroke:"currentColor",strokeWidth:"0.5"})]}),wall:jsxs(Fragment,{children:[jsx("line",{x1:"12",y1:"2",x2:"12",y2:"22",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"12",y1:"4",x2:"16",y2:"0",stroke:"currentColor",strokeWidth:"1.5"}),jsx("line",{x1:"12",y1:"10",x2:"16",y2:"6",stroke:"currentColor",strokeWidth:"1.5"}),jsx("line",{x1:"12",y1:"16",x2:"16",y2:"12",stroke:"currentColor",strokeWidth:"1.5"}),jsx("line",{x1:"12",y1:"22",x2:"16",y2:"18",stroke:"currentColor",strokeWidth:"1.5"})]}),tuning_fork:jsxs(Fragment,{children:[jsx("path",{d:"M 8 4 L 8 14 Q 12 20 16 14 L 16 4",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"12",y1:"17",x2:"12",y2:"24",stroke:"currentColor",strokeWidth:"2"})]}),speaker:jsxs(Fragment,{children:[jsx("polygon",{points:"8,8 14,4 14,20 8,16",fill:"currentColor"}),jsx("rect",{x:"4",y:"8",width:"4",height:"8",fill:"currentColor"}),jsx("path",{d:"M 18 8 Q 20 12 18 16 M 21 5 Q 24 12 21 19",fill:"none",stroke:"currentColor",strokeWidth:"2"})]}),wavefronts:jsxs(Fragment,{children:[jsx("circle",{cx:"10",cy:"12",r:"4",fill:"none",stroke:"currentColor"}),jsx("circle",{cx:"11",cy:"12",r:"8",fill:"none",stroke:"currentColor"}),jsx("circle",{cx:"12",cy:"12",r:"12",fill:"none",stroke:"currentColor"})]}),mach_cone:jsxs(Fragment,{children:[jsx("circle",{cx:"18",cy:"12",r:"2",fill:"currentColor"}),jsx("line",{x1:"2",y1:"4",x2:"18",y2:"12",stroke:"currentColor",strokeWidth:"1.5"}),jsx("line",{x1:"2",y1:"20",x2:"18",y2:"12",stroke:"currentColor",strokeWidth:"1.5"})]}),beats_graph:jsx("path",{d:"M 2 12 Q 4 6 6 12 Q 8 18 10 12 Q 12 8 14 12 Q 16 16 18 12 Q 20 10 22 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5"}),step_function:jsxs(Fragment,{children:[jsx("path",{d:"M2 18 L8 18 M8 12 L14 12 M14 6 L20 6",stroke:"currentColor",strokeWidth:"2"}),jsx("circle",{cx:"2",cy:"18",r:"2",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"18",r:"2",fill:"none",stroke:"currentColor"}),jsx("circle",{cx:"8",cy:"12",r:"2",fill:"currentColor"}),jsx("circle",{cx:"14",cy:"12",r:"2",fill:"none",stroke:"currentColor"}),jsx("circle",{cx:"14",cy:"6",r:"2",fill:"currentColor"}),jsx("circle",{cx:"20",cy:"6",r:"2",fill:"none",stroke:"currentColor"})]}),shaded_area:jsxs(Fragment,{children:[jsx("path",{d:"M4 20 L4 10 Q12 2 20 10 L20 20 Z",fill:"currentColor",opacity:"0.3"}),jsx("path",{d:"M4 10 Q12 2 20 10",fill:"none",stroke:"currentColor",strokeWidth:"2"})]}),modulus:jsx("polyline",{points:"4,4 12,20 20,4",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"}),exponential:jsx("path",{d:"M4 20 Q14 20 20 4",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),logarithmic:jsx("path",{d:"M4 20 Q4 10 20 4",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),axes_3d:jsxs(Fragment,{children:[jsx("line",{x1:"8",y1:"16",x2:"8",y2:"2",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"8",y1:"16",x2:"22",y2:"16",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"8",y1:"16",x2:"2",y2:"22",stroke:"currentColor",strokeWidth:"2"})]}),rod:jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12",stroke:"currentColor",strokeWidth:"6",strokeLinecap:"round"}),hinge:jsxs(Fragment,{children:[jsx("circle",{cx:"12",cy:"12",r:"3.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("circle",{cx:"12",cy:"12",r:"1.5",fill:"currentColor"})]}),slit_double:jsxs(Fragment,{children:[jsx("line",{x1:"12",y1:"2",x2:"12",y2:"8",stroke:"currentColor",strokeWidth:"3"}),jsx("line",{x1:"12",y1:"11",x2:"12",y2:"13",stroke:"currentColor",strokeWidth:"3"}),jsx("line",{x1:"12",y1:"16",x2:"12",y2:"22",stroke:"currentColor",strokeWidth:"3"})]}),slit_single:jsxs(Fragment,{children:[jsx("line",{x1:"12",y1:"2",x2:"12",y2:"9",stroke:"currentColor",strokeWidth:"3"}),jsx("line",{x1:"12",y1:"15",x2:"12",y2:"22",stroke:"currentColor",strokeWidth:"3"})]}),photon:jsxs(Fragment,{children:[jsx("path",{d:"M 2 12 Q 5 6 8 12 T 14 12 T 20 12",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("polygon",{points:"18,8 22,12 18,16",fill:"currentColor"})]}),nucleus:jsxs(Fragment,{children:[jsx("ellipse",{cx:"12",cy:"12",rx:"10",ry:"4",fill:"none",stroke:"currentColor",transform:"rotate(45 12 12)"}),jsx("ellipse",{cx:"12",cy:"12",rx:"10",ry:"4",fill:"none",stroke:"currentColor",transform:"rotate(-45 12 12)"}),jsx("circle",{cx:"12",cy:"12",r:"3",fill:"#ef4444"})]}),orbit:jsx("ellipse",{cx:"12",cy:"12",rx:"8",ry:"4.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),resistor:jsx("path",{d:"M 2 12 L 6 12 L 8 6 L 12 18 L 16 6 L 18 12 L 22 12",fill:"none",stroke:"currentColor",strokeWidth:"2"}),capacitor:jsxs(Fragment,{children:[jsx("line",{x1:"3",y1:"12",x2:"9",y2:"12",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"9",y1:"6",x2:"9",y2:"18",stroke:"currentColor",strokeWidth:"2.2"}),jsx("line",{x1:"15",y1:"6",x2:"15",y2:"18",stroke:"currentColor",strokeWidth:"2.2"}),jsx("line",{x1:"15",y1:"12",x2:"21",y2:"12",stroke:"currentColor",strokeWidth:"2"})]}),inductor:jsx("path",{d:"M 3 12 C 5 8, 7 8, 9 12 C 11 8, 13 8, 15 12 C 17 8, 19 8, 21 12",fill:"none",stroke:"currentColor",strokeWidth:"2"}),diode:jsxs(Fragment,{children:[jsx("line",{x1:"3",y1:"12",x2:"8",y2:"12",stroke:"currentColor",strokeWidth:"2"}),jsx("polygon",{points:"8,7 8,17 14,12",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"15.5",y1:"7",x2:"15.5",y2:"17",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"15.5",y1:"12",x2:"21",y2:"12",stroke:"currentColor",strokeWidth:"2"})]}),battery:jsxs(Fragment,{children:[jsx("path",{d:"M 2 12 L 10 12 M 10 4 L 10 20 M 14 8 L 14 16 M 14 12 L 22 12",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"14",y1:"8",x2:"14",y2:"16",stroke:"currentColor",strokeWidth:"4"})]}),ground:jsx("path",{d:"M 12 4 L 12 12 M 6 12 L 18 12 M 8 16 L 16 16 M 10 20 L 14 20",fill:"none",stroke:"currentColor",strokeWidth:"2"}),meter_v:jsxs(Fragment,{children:[jsx("circle",{cx:"12",cy:"12",r:"7",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("text",{x:"12",y:"15",fontSize:"8",textAnchor:"middle",fill:"currentColor",children:"V"})]}),meter_a:jsxs(Fragment,{children:[jsx("circle",{cx:"12",cy:"12",r:"7",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("text",{x:"12",y:"15",fontSize:"8",textAnchor:"middle",fill:"currentColor",children:"A"})]}),piston_cylinder:jsxs(Fragment,{children:[jsx("path",{d:"M 4 4 L 4 20 L 20 20 L 20 4",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("rect",{x:"5",y:"10",width:"14",height:"4",fill:"currentColor"}),jsx("circle",{cx:"9",cy:"16",r:"1",fill:"currentColor"}),jsx("circle",{cx:"15",cy:"17",r:"1",fill:"currentColor"}),jsx("circle",{cx:"12",cy:"14",r:"1",fill:"currentColor"})]}),heat_engine:jsxs(Fragment,{children:[jsx("rect",{x:"6",y:"2",width:"12",height:"4",fill:"#ef4444"}),jsx("circle",{cx:"12",cy:"12",r:"4",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("rect",{x:"6",y:"18",width:"12",height:"4",fill:"#3b82f6"}),jsx("line",{x1:"12",y1:"6",x2:"12",y2:"8",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"12",y1:"16",x2:"12",y2:"18",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"16",y1:"12",x2:"20",y2:"12",stroke:"currentColor",strokeWidth:"2"})]}),conduction_rod:jsxs(Fragment,{children:[jsx("defs",{children:jsxs("linearGradient",{id:"thermo-conduction-icon-grad",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[jsx("stop",{offset:"0%",stopColor:"#ef4444"}),jsx("stop",{offset:"100%",stopColor:"#3b82f6"})]})}),jsx("rect",{x:"2",y:"8",width:"20",height:"8",fill:"url(#thermo-conduction-icon-grad)",stroke:"currentColor",strokeWidth:"1"})]}),pv_axes:jsxs(Fragment,{children:[jsx("line",{x1:"4",y1:"4",x2:"4",y2:"20",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"4",y1:"20",x2:"20",y2:"20",stroke:"currentColor",strokeWidth:"2"}),jsx("polygon",{points:"4,2 2,6 6,6",fill:"currentColor"}),jsx("polygon",{points:"22,20 18,18 18,22",fill:"currentColor"})]}),thermo_process:jsxs(Fragment,{children:[jsx("path",{d:"M 4 4 Q 8 16 20 20",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("polygon",{points:"12,12 8,10 10,14",fill:"currentColor"})]}),carnot_cycle:jsx("path",{d:"M 6 6 Q 12 8 16 12 Q 14 16 10 18 Q 6 14 6 6",fill:"none",stroke:"currentColor",strokeWidth:"2"}),maxwell_boltzmann:jsxs(Fragment,{children:[jsx("line",{x1:"2",y1:"20",x2:"22",y2:"20",stroke:"currentColor",strokeWidth:"2"}),jsx("path",{d:"M 2 20 Q 8 4 12 12 T 22 20",fill:"none",stroke:"#ef4444",strokeWidth:"2"}),jsx("path",{d:"M 2 20 Q 6 10 10 16 T 22 20",fill:"none",stroke:"#3b82f6",strokeWidth:"2",strokeDasharray:"2 2"})]}),diatomic_gas:jsxs(Fragment,{children:[jsx("circle",{cx:"6",cy:"12",r:"4",fill:"currentColor"}),jsx("circle",{cx:"18",cy:"12",r:"4",fill:"currentColor"}),jsx("line",{x1:"10",y1:"12",x2:"14",y2:"12",stroke:"currentColor",strokeWidth:"2"}),jsx("path",{d:"M 8 6 A 6 6 0 0 1 16 6",fill:"none",stroke:"currentColor",strokeWidth:"1"})]}),random_walk:jsxs(Fragment,{children:[jsx("polyline",{points:"2,18 8,12 14,16 20,6",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("circle",{cx:"2",cy:"18",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"20",cy:"6",r:"1.5",fill:"currentColor"})]}),lens_convex:jsx("path",{d:"M 12 2 Q 18 12 12 22 Q 6 12 12 2 Z",fill:"#38bdf8",fillOpacity:"0.4",stroke:"currentColor",strokeWidth:"2"}),lens_concave:jsx("path",{d:"M 8 2 L 16 2 Q 12 12 16 22 L 8 22 Q 12 12 8 2 Z",fill:"#38bdf8",fillOpacity:"0.4",stroke:"currentColor",strokeWidth:"2"}),mirror_concave:jsxs(Fragment,{children:[jsx("path",{d:"M 16 2 Q 8 12 16 22",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"11",y1:"6",x2:"6",y2:"8",stroke:"currentColor"}),jsx("line",{x1:"8",y1:"12",x2:"3",y2:"12",stroke:"currentColor"}),jsx("line",{x1:"11",y1:"18",x2:"6",y2:"16",stroke:"currentColor"})]}),mirror_convex:jsxs(Fragment,{children:[jsx("path",{d:"M 8 4 Q 16 12 8 20",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"13",y1:"6",x2:"18",y2:"8",stroke:"currentColor"}),jsx("line",{x1:"16",y1:"12",x2:"21",y2:"12",stroke:"currentColor"}),jsx("line",{x1:"13",y1:"18",x2:"18",y2:"16",stroke:"currentColor"})]}),prism:jsx("polygon",{points:"12,4 2,20 22,20",fill:"#38bdf8",fillOpacity:"0.4",stroke:"currentColor",strokeWidth:"2"}),glass_slab:jsx("rect",{x:"4",y:"6",width:"16",height:"12",fill:"#38bdf8",fillOpacity:"0.4",stroke:"currentColor",strokeWidth:"2"}),pole_piece:jsxs(Fragment,{children:[jsx("rect",{x:"4",y:"2",width:"16",height:"20",fill:"#93c5fd",fillOpacity:"0.4",stroke:"currentColor",strokeWidth:"2"}),jsx("text",{x:"12",y:"16",fontSize:"12",textAnchor:"middle",fill:"currentColor",fontWeight:"bold",children:"N"})]}),b_field_line:jsxs(Fragment,{children:[jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12",stroke:"currentColor",strokeWidth:"2"}),jsx("polygon",{points:"10,8 16,12 10,16",fill:"currentColor"})]}),b_field_curve:jsxs(Fragment,{children:[jsx("path",{d:"M 4 20 Q 12 2 20 20",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("polygon",{points:"10,8 14,11 10,14",fill:"currentColor",transform:"rotate(30 12 11)"})]}),bezier:jsxs(Fragment,{children:[jsx("path",{d:"M 4 20 Q 4 4 20 4",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("circle",{cx:"4",cy:"4",r:"2",fill:"currentColor"}),jsx("line",{x1:"4",y1:"20",x2:"4",y2:"4",stroke:"currentColor",strokeWidth:"1",strokeDasharray:"2 2"}),jsx("line",{x1:"20",y1:"4",x2:"4",y2:"4",stroke:"currentColor",strokeWidth:"1",strokeDasharray:"2 2"})]}),current_wire:jsxs(Fragment,{children:[jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),jsx("polygon",{points:"15,8 20,12 15,16",fill:"currentColor"})]}),b_region_in:jsxs(Fragment,{children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeDasharray:"2 2"}),jsx("path",{d:"M 8 8 L 16 16 M 16 8 L 8 16",stroke:"currentColor",strokeWidth:"2"})]}),b_region_out:jsxs(Fragment,{children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeDasharray:"2 2"}),jsx("circle",{cx:"12",cy:"12",r:"2",fill:"currentColor"})]}),bar_magnet:jsxs(Fragment,{children:[jsx("rect",{x:"2",y:"8",width:"20",height:"8",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"12",y1:"8",x2:"12",y2:"16",stroke:"currentColor",strokeWidth:"2"}),jsx("text",{x:"7",y:"15",fontSize:"7",fill:"currentColor",fontWeight:"bold",children:"N"}),jsx("text",{x:"17",y:"15",fontSize:"7",fill:"currentColor",fontWeight:"bold",children:"S"})]}),coil:jsx("path",{d:"M2 12 C 5 -2, 10 26, 12 12 C 14 -2, 19 26, 22 12",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"}),meter:jsxs(Fragment,{children:[jsx("circle",{cx:"12",cy:"12",r:"8",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("text",{x:"12",y:"16",fontSize:"10",fontWeight:"bold",textAnchor:"middle",fill:"currentColor",children:"G"})]}),ac_source:jsxs(Fragment,{children:[jsx("circle",{cx:"12",cy:"12",r:"8",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("path",{d:"M 7 12 Q 9.5 8 12 12 T 17 12",fill:"none",stroke:"currentColor",strokeWidth:"2"})]}),single_bond:jsx("line",{x1:"4",y1:"18",x2:"20",y2:"6",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),double_bond:jsxs(Fragment,{children:[jsx("line",{x1:"3",y1:"15",x2:"17",y2:"3",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),jsx("line",{x1:"7",y1:"21",x2:"21",y2:"9",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"})]}),triple_bond:jsxs(Fragment,{children:[jsx("line",{x1:"2",y1:"12",x2:"16",y2:"0",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"5",y1:"16",x2:"19",y2:"4",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"8",y1:"20",x2:"22",y2:"8",stroke:"currentColor",strokeWidth:"2"})]}),wedge_bond:jsx("polygon",{points:"4,18 20,4 22,8",fill:"currentColor"}),dash_bond:jsx("line",{x1:"4",y1:"18",x2:"20",y2:"6",stroke:"currentColor",strokeWidth:"2.5",strokeDasharray:"3 3"}),benzene:jsxs(Fragment,{children:[jsx("polygon",{points:"12,2 20.6,7 20.6,17 12,22 3.4,17 3.4,7",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("circle",{cx:"12",cy:"12",r:"5",fill:"none",stroke:"currentColor",strokeWidth:"1.5"})]}),cyclohexane:jsx("polygon",{points:"12,2 20.6,7 20.6,17 12,22 3.4,17 3.4,7",fill:"none",stroke:"currentColor",strokeWidth:"2"}),cyclopentane:jsx("polygon",{points:"12,2 22,9.5 18,21 6,21 2,9.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),cyclobutane:jsx("rect",{x:"5",y:"5",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2"}),cyclopropane:jsx("polygon",{points:"12,4 22,18 2,18",fill:"none",stroke:"currentColor",strokeWidth:"2"}),reaction_arrow:jsxs(Fragment,{children:[jsx("line",{x1:"2",y1:"12",x2:"20",y2:"12",stroke:"currentColor",strokeWidth:"2"}),jsx("polyline",{points:"14,6 22,12 14,18",fill:"none",stroke:"currentColor",strokeWidth:"2"})]}),equilibrium_arrow:jsxs(Fragment,{children:[jsx("line",{x1:"2",y1:"9",x2:"20",y2:"9",stroke:"currentColor",strokeWidth:"1.5"}),jsx("polyline",{points:"14,4 20,9",fill:"none",stroke:"currentColor",strokeWidth:"1.5"}),jsx("line",{x1:"4",y1:"15",x2:"22",y2:"15",stroke:"currentColor",strokeWidth:"1.5"}),jsx("polyline",{points:"10,20 4,15",fill:"none",stroke:"currentColor",strokeWidth:"1.5"})]}),curved_arrow:jsx("path",{d:"M 4 18 Q 12 4 20 18 L 16 16 M 20 18 L 22 14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),resonance_arrow:jsxs(Fragment,{children:[jsx("line",{x1:"4",y1:"12",x2:"20",y2:"12",stroke:"currentColor",strokeWidth:"2"}),jsx("polyline",{points:"8,6 2,12 8,18",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("polyline",{points:"16,6 22,12 16,18",fill:"none",stroke:"currentColor",strokeWidth:"2"})]}),atom:jsx("text",{x:"12",y:"18",fontSize:"18",textAnchor:"middle",fill:"currentColor",fontWeight:"bold",fontFamily:"sans-serif",children:"C"}),charge_plus:jsxs(Fragment,{children:[jsx("circle",{cx:"12",cy:"12",r:"8",fill:"none",stroke:"currentColor",strokeWidth:"1.5"}),jsx("line",{x1:"12",y1:"8",x2:"12",y2:"16",stroke:"currentColor",strokeWidth:"1.5"}),jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12",stroke:"currentColor",strokeWidth:"1.5"})]}),charge_minus:jsxs(Fragment,{children:[jsx("circle",{cx:"12",cy:"12",r:"8",fill:"none",stroke:"currentColor",strokeWidth:"1.5"}),jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12",stroke:"currentColor",strokeWidth:"1.5"})]}),radical:jsx("circle",{cx:"12",cy:"12",r:"2.5",fill:"currentColor"}),lone_pair:jsxs(Fragment,{children:[jsx("circle",{cx:"8",cy:"12",r:"2",fill:"currentColor"}),jsx("circle",{cx:"16",cy:"12",r:"2",fill:"currentColor"})]}),charge_pos:jsxs(Fragment,{children:[jsx("circle",{cx:"12",cy:"12",r:"8",fill:"#fecaca",stroke:"#ef4444",strokeWidth:"2"}),jsx("path",{d:"M12 8v8M8 12h8",stroke:"#ef4444",strokeWidth:"2",strokeLinecap:"round"})]}),charge_neg:jsxs(Fragment,{children:[jsx("circle",{cx:"12",cy:"12",r:"8",fill:"#bfdbfe",stroke:"#3b82f6",strokeWidth:"2"}),jsx("path",{d:"M8 12h8",stroke:"#3b82f6",strokeWidth:"2",strokeLinecap:"round"})]}),dipole:jsxs(Fragment,{children:[jsx("circle",{cx:"5",cy:"12",r:"4",fill:"#fecaca",stroke:"#ef4444"}),jsx("circle",{cx:"19",cy:"12",r:"4",fill:"#bfdbfe",stroke:"#3b82f6"}),jsx("line",{x1:"9",y1:"12",x2:"15",y2:"12",stroke:"currentColor",strokeDasharray:"2 2"})]}),charged_plate_pos:jsxs(Fragment,{children:[jsx("line",{x1:"12",y1:"2",x2:"12",y2:"22",stroke:"#ef4444",strokeWidth:"6"}),jsx("path",{d:"M9 6h6M12 3v6 M9 12h6M12 9v6 M9 18h6M12 15v6",stroke:"#fff",strokeWidth:"1"})]}),charged_plate_neg:jsxs(Fragment,{children:[jsx("line",{x1:"12",y1:"2",x2:"12",y2:"22",stroke:"#3b82f6",strokeWidth:"6"}),jsx("path",{d:"M9 6h6 M9 12h6 M9 18h6",stroke:"#fff",strokeWidth:"1"})]}),gaussian_sphere:jsx("circle",{cx:"12",cy:"12",r:"9",fill:"#d1fae5",fillOpacity:"0.4",stroke:"#10b981",strokeWidth:"2",strokeDasharray:"3 3"}),gaussian_cylinder:jsxs(Fragment,{children:[jsx("ellipse",{cx:"12",cy:"4",rx:"7",ry:"2",fill:"none",stroke:"#10b981",strokeWidth:"1.5",strokeDasharray:"2 2"}),jsx("ellipse",{cx:"12",cy:"20",rx:"7",ry:"2",fill:"none",stroke:"#10b981",strokeWidth:"1.5",strokeDasharray:"2 2"}),jsx("path",{d:"M5 4v16M19 4v16",stroke:"#10b981",strokeWidth:"1.5",strokeDasharray:"2 2"})]}),mirror_plane:jsxs(Fragment,{children:[jsx("line",{x1:"12",y1:"2",x2:"12",y2:"22",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"12",y1:"6",x2:"6",y2:"10",stroke:"currentColor"}),jsx("line",{x1:"12",y1:"12",x2:"6",y2:"16",stroke:"currentColor"}),jsx("line",{x1:"12",y1:"18",x2:"6",y2:"22",stroke:"currentColor"})]}),energy_level:jsxs(Fragment,{children:[jsx("line",{x1:"4",y1:"8",x2:"20",y2:"8",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"4",y1:"16",x2:"20",y2:"16",stroke:"currentColor",strokeWidth:"2"}),jsx("text",{x:"12",y:"13",fontSize:"6",fill:"currentColor",textAnchor:"middle",children:"n"})]})};var Ue=({categories:t,tool:e,onSelect:r})=>{let o=n=>["chemistry","arrows","rings","symbols"].includes(n.toLowerCase());return jsx("aside",{className:"w-[108px] border-r border-slate-200 bg-gradient-to-b from-slate-50 to-white flex flex-col items-center py-3 gap-4 overflow-y-auto shrink-0",children:t.map(n=>jsxs("section",{className:"flex flex-col items-center w-full px-2",children:[jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.20em] text-slate-400 mb-2 w-full text-center border-b border-slate-200 pb-1.5",children:n.name}),jsx("div",{className:"flex flex-col gap-1.5 w-full items-center",children:n.tools.map(s=>{let l=o(n.name)?"bg-teal-50 text-teal-700 border-teal-200 shadow-sm ring-1 ring-teal-100":"bg-blue-50 text-blue-700 border-blue-200 shadow-sm ring-1 ring-blue-100";return jsxs("button",{type:"button",onClick:()=>r(s.id),title:s.name,className:`p-2 rounded-xl border flex flex-col items-center gap-1 transition-all w-full ${e===s.id?l:"text-slate-600 border-transparent hover:bg-slate-100 hover:border-slate-200"}`,children:[jsx("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",children:ke[s.id]??ke.line}),jsx("span",{className:"text-[11px] font-medium tracking-tight leading-tight text-center",children:s.name})]},s.id)})})]},n.name))})};var $o=t=>["gaussian_cylinder","lens_convex","lens_concave","mirror_concave","mirror_convex","b_field_curve"].includes(t),Wo=t=>["text","point","charge_pos","charge_neg","point_mass","com_indicator","diatomic_gas","mass_box"].includes(t),vo=t=>["point_mass","com_indicator","pivot"].includes(t),Mo=t=>["pendulum","mass_box"].includes(t),So=t=>["sine_wave","standing_wave","wave_pulse","damped_wave","beats_graph","shm_graph","energy_graph","strobe_shm"].includes(t),wo=t=>["sine_wave","standing_wave","shm_graph","energy_graph","strobe_shm"].includes(t),_o=t=>t==="rolling_body",Co=t=>t==="spring",Lo=t=>["block","cart"].includes(t),Ke=({element:t,onChange:e,onDelete:r,onClose:o})=>t?jsxs("div",{id:"svg-engine-properties-panel",role:"region","aria-label":"Element properties",className:"absolute right-6 top-6 w-80 bg-white/95 backdrop-blur rounded-xl shadow-2xl border border-slate-200 flex flex-col p-5 z-30 max-h-[80vh] overflow-y-auto",children:[jsxs("div",{className:"flex justify-between items-center border-b border-slate-100 pb-3 mb-4 sticky top-0 bg-white z-10",children:[jsx("h3",{className:"text-[11px] font-semibold text-blue-700 uppercase tracking-[0.18em]",children:"Properties"}),jsx("button",{type:"button",onClick:o,className:"text-slate-400 hover:text-slate-800",children:"\u2715"})]}),jsxs("div",{className:"space-y-4",children:[jsx("input",{className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:String(t.label||""),onChange:n=>e("label",n.target.value),placeholder:"Label"}),jsx("input",{className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:String(t.value||""),onChange:n=>e("value",n.target.value),placeholder:"Value"}),jsxs("div",{className:"grid grid-cols-2 gap-3",children:[jsx("input",{type:"color",value:String(t.color||"#0f172a"),onChange:n=>e("color",n.target.value),className:"h-10 w-full rounded-lg border border-slate-200"}),jsx("input",{type:"number",className:"px-3 py-2 border border-slate-300 rounded-lg text-sm",value:Number(t.strokeWidth||2),onChange:n=>e("strokeWidth",Number(n.target.value))})]}),Lo(String(t.type))&&jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Rotation (degrees)"}),jsx("input",{type:"number",className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:Number(t.rotation??0),onChange:n=>e("rotation",Number(n.target.value))})]}),$o(String(t.type))&&jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:t.type==="gaussian_cylinder"?"Cylinder half-height (curveHeight)":"Curve height"}),jsx("input",{type:"number",className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:Number(t.curveHeight??(t.type==="b_field_curve"?50:t.type==="gaussian_cylinder"||t.type==="mirror_concave"||t.type==="mirror_convex"?40:20)),onChange:n=>e("curveHeight",Number(n.target.value))})]}),String(t.type)==="bezier"&&jsxs("label",{className:"flex items-center gap-2 text-sm text-slate-700",children:[jsx("input",{type:"checkbox",checked:!!t.showArrow,onChange:n=>e("showArrow",n.target.checked)}),jsx("span",{className:"text-xs font-medium text-slate-600",children:"Show arrow on curve"})]}),String(t.type)==="energy_level"&&jsx("input",{className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:String(t.energy??""),onChange:n=>e("energy",n.target.value),placeholder:"Energy (e.g. -13.6 eV)"}),Wo(String(t.type))&&jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Font size"}),jsx("input",{type:"number",className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:Number(t.fontSize??16),onChange:n=>e("fontSize",Number(n.target.value))})]}),vo(String(t.type))&&jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Size (radius / pivot scale)"}),jsx("input",{type:"number",className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:Number(t.size??15),onChange:n=>e("size",Number(n.target.value))})]}),Mo(String(t.type))&&jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:t.type==="mass_box"?"Block size":"Bob radius"}),jsx("input",{type:"number",className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:Number(t.size??(t.type==="mass_box"?30:15)),onChange:n=>e("size",Number(n.target.value))})]}),_o(String(t.type))&&jsxs("div",{className:"flex flex-col gap-2 text-sm text-slate-700",children:[jsxs("label",{className:"flex items-center gap-2",children:[jsx("input",{type:"checkbox",checked:!!t.showVelocity,onChange:n=>e("showVelocity",n.target.checked)}),jsx("span",{className:"text-xs font-medium text-slate-600",children:"Show velocity (v)"})]}),jsxs("label",{className:"flex items-center gap-2",children:[jsx("input",{type:"checkbox",checked:!!t.showOmega,onChange:n=>e("showOmega",n.target.checked)}),jsx("span",{className:"text-xs font-medium text-slate-600",children:"Show angular velocity (\u03C9)"})]})]}),Co(String(t.type))&&jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Coils"}),jsx("input",{type:"number",className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:Number(t.coils??6),onChange:n=>e("coils",Number(n.target.value))})]}),String(t.type)==="piston_cylinder"&&jsxs(Fragment,{children:[jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Compression (0.1\u20130.9)"}),jsx("input",{type:"range",min:.1,max:.9,step:.05,className:"w-full",value:Number(t.compression??.5),onChange:n=>e("compression",Number(n.target.value))})]}),jsxs("label",{className:"flex items-center gap-2 text-sm text-slate-700",children:[jsx("input",{type:"checkbox",checked:!!t.showHeat,onChange:n=>e("showHeat",n.target.checked)}),jsx("span",{className:"text-xs font-medium text-slate-600",children:"Show heat source (Q)"})]})]}),String(t.type)==="heat_engine"&&jsxs(Fragment,{children:[jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Machine type"}),jsxs("select",{className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm bg-white",value:String(t.engineType??"engine"),onChange:n=>e("engineType",n.target.value),children:[jsx("option",{value:"engine",children:"Heat engine"}),jsx("option",{value:"refrigerator",children:"Refrigerator / pump"})]})]}),jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Efficiency (display)"}),jsx("input",{type:"number",min:0,max:1,step:.05,className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:Number(t.efficiency??.4),onChange:n=>e("efficiency",Number(n.target.value))})]})]}),String(t.type)==="thermo_process"&&jsxs(Fragment,{children:[jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Process type"}),jsxs("select",{className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm bg-white",value:String(t.processType??"isotherm"),onChange:n=>e("processType",n.target.value),children:[jsx("option",{value:"isotherm",children:"Isothermal"}),jsx("option",{value:"adiabatic",children:"Adiabatic"}),jsx("option",{value:"isobaric",children:"Isobaric"}),jsx("option",{value:"isochoric",children:"Isochoric"})]})]}),jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Line style"}),jsxs("select",{className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm bg-white",value:String(t.lineStyle??"solid"),onChange:n=>e("lineStyle",n.target.value),children:[jsx("option",{value:"solid",children:"Solid"}),jsx("option",{value:"dashed",children:"Dashed"}),jsx("option",{value:"dotted",children:"Dotted"})]})]})]}),String(t.type)==="pv_axes"&&jsxs("div",{className:"grid grid-cols-2 gap-3",children:[jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"X label (V)"}),jsx("input",{className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:String(t.xLabel??"V"),onChange:n=>e("xLabel",n.target.value)})]}),jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Y label (P)"}),jsx("input",{className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:String(t.yLabel??"P"),onChange:n=>e("yLabel",n.target.value)})]})]}),String(t.type)==="maxwell_boltzmann"&&jsxs("div",{className:"grid grid-cols-2 gap-3",children:[jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"T\u2081 (K)"}),jsx("input",{type:"number",className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:Number(t.t1??300),onChange:n=>e("t1",Number(n.target.value))})]}),jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"T\u2082 (K)"}),jsx("input",{type:"number",className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:Number(t.t2??600),onChange:n=>e("t2",Number(n.target.value))})]})]}),String(t.type)==="diatomic_gas"&&jsxs("label",{className:"flex items-center gap-2 text-sm text-slate-700",children:[jsx("input",{type:"checkbox",checked:t.showRotations!==false,onChange:n=>e("showRotations",n.target.checked)}),jsx("span",{className:"text-xs font-medium text-slate-600",children:"Show rotation DOF"})]}),String(t.type)==="random_walk"&&jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Steps"}),jsx("input",{type:"number",min:2,max:30,className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:Number(t.steps??5),onChange:n=>e("steps",Number(n.target.value))})]}),So(String(t.type))&&jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Amplitude"}),jsx("input",{type:"number",min:1,max:200,step:1,className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:Number(t.amplitude??40),onChange:n=>e("amplitude",Number(n.target.value))})]}),wo(String(t.type))&&jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Loops / waves (n)"}),jsx("input",{type:"number",min:.5,max:20,step:.5,className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:Number(t.loops??2),onChange:n=>e("loops",Number(n.target.value))})]}),String(t.type)==="shm_graph"&&jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Graph function"}),jsxs("select",{className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm bg-white",value:String(t.graphType??"x"),onChange:n=>e("graphType",n.target.value),children:[jsx("option",{value:"x",children:"Position x(t)"}),jsx("option",{value:"v",children:"Velocity v(t)"}),jsx("option",{value:"a",children:"Acceleration a(t)"}),jsx("option",{value:"all",children:"Compare all three"})]})]}),String(t.type)==="energy_graph"&&jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Domain"}),jsxs("select",{className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm bg-white",value:String(t.domain??"time"),onChange:n=>e("domain",n.target.value),children:[jsx("option",{value:"time",children:"Versus time (t)"}),jsx("option",{value:"position",children:"Versus position (x)"})]})]}),String(t.type)==="pendulum"&&jsxs("label",{className:"flex items-center gap-2 text-sm text-slate-700",children:[jsx("input",{type:"checkbox",checked:!!t.showForces,onChange:n=>e("showForces",n.target.checked)}),jsx("span",{className:"text-xs font-medium text-slate-600",children:"Show force vectors"})]}),String(t.type)==="phasor"&&jsxs("label",{className:"flex items-center gap-2 text-sm text-slate-700",children:[jsx("input",{type:"checkbox",checked:!!t.showProjection,onChange:n=>e("showProjection",n.target.checked)}),jsx("span",{className:"text-xs font-medium text-slate-600",children:"Show axis projections"})]}),String(t.type)==="damped_wave"&&jsxs(Fragment,{children:[jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Damping (b/2m)"}),jsx("input",{type:"number",min:0,max:.1,step:.005,className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:Number(t.damping??.015),onChange:n=>e("damping",Number(n.target.value))})]}),jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Angular frequency (\u03C9)"}),jsx("input",{type:"number",min:1,max:50,step:1,className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:Number(t.frequency??10),onChange:n=>e("frequency",Number(n.target.value))})]})]}),String(t.type)==="beats_graph"&&jsxs(Fragment,{children:[jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Carrier frequency (avg f)"}),jsx("input",{type:"number",min:5,max:50,step:1,className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:Number(t.frequency??15),onChange:n=>e("frequency",Number(n.target.value))})]}),jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Beat frequency (\u0394f)"}),jsx("input",{type:"number",min:.1,max:10,step:.1,className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:Number(t.beatFreq??2),onChange:n=>e("beatFreq",Number(n.target.value))})]})]}),String(t.type)==="wavefronts"&&jsxs(Fragment,{children:[jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Velocity ratio (v_s / v)"}),jsx("input",{type:"number",min:0,max:.9,step:.1,className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:Number(t.velocityRatio??.5),onChange:n=>e("velocityRatio",Number(n.target.value))})]}),jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Rings"}),jsx("input",{type:"number",min:1,max:20,step:1,className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:Number(t.rings??5),onChange:n=>e("rings",Number(n.target.value))})]})]}),String(t.type)==="mach_cone"&&jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Mach number (M)"}),jsx("input",{type:"number",min:1.05,max:5,step:.1,className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:Number(t.machNumber??2),onChange:n=>e("machNumber",Number(n.target.value))})]}),jsx("button",{type:"button",onClick:r,className:"w-full py-2 bg-red-50 text-red-600 hover:bg-red-100 rounded-lg text-sm font-semibold transition",children:"Delete Element"})]})]}):null;var to=({open:t,jsonText:e,setJsonText:r,onClose:o,onLoad:n})=>t?jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:jsxs("div",{className:"bg-white rounded-lg shadow-xl w-full max-w-2xl flex flex-col max-h-full",children:[jsxs("div",{className:"px-6 py-4 border-b flex justify-between items-center",children:[jsx("h2",{className:"text-lg font-bold text-gray-800",children:"Diagram Data (JSON)"}),jsx("button",{onClick:o,className:"text-gray-500 hover:text-gray-800 font-bold",children:"\u2715"})]}),jsx("div",{className:"p-6 flex-1 overflow-hidden flex flex-col gap-4",children:jsx("textarea",{value:e,onChange:s=>r(s.target.value),className:"w-full flex-1 min-h-[300px] p-4 font-mono text-sm border border-gray-300 rounded-md",spellCheck:"false"})}),jsxs("div",{className:"px-6 py-4 border-t bg-gray-50 flex justify-end gap-3",children:[jsx("button",{onClick:o,className:"px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-200 rounded-md transition",children:"Cancel"}),jsx("button",{onClick:n,className:"px-4 py-2 text-sm font-medium bg-blue-600 text-white hover:bg-blue-700 rounded-md transition shadow-sm",children:"Load Diagram"})]})]})}):null;var Eo=St.mechanics,be=forwardRef(function({initialElements:e,toolCategories:r,preset:o,enablePresetSwitch:n=true,onPresetChange:s,onChange:a,viewMode:l,embedded:d=false,documentTitle:x,hideDocumentTitle:y=false,onExport:h},v){let[b,$]=useState(o??"mechanics"),w=o!==void 0&&typeof s=="function";useEffect(()=>{w&&o&&$(o);},[o,w]);let P=w?o??b:b,B=St[P]??Eo,[V,H]=useState(0);useEffect(()=>{H(0);},[P]);let U=useMemo(()=>e??(P==="light"?Zt[V].elements:B.elements),[e,P,V,B.elements]),f=Ze(U,P),G=P==="light"&&e==null;useEffect(()=>{a?.(f.elements);},[f.elements,a]),useEffect(()=>{typeof l=="boolean"&&f.setIsViewMode(l);},[l,f]),useEffect(()=>{f.selectedId||f.setShowProperties(false);},[f.selectedId,f.setShowProperties]);let gt=r??B.toolCategories;useImperativeHandle(v,()=>({getData:()=>f.elements,setData:A=>f.setElements(A),clear:()=>f.setElements([])}),[f.elements,f.setElements]);let at=x??`${B.name} Editor`,Tt=()=>{let A=JSON.stringify(f.elements,null,2);h?.({elements:f.elements,json:A}),typeof navigator<"u"&&navigator.clipboard?.writeText&&navigator.clipboard.writeText(A);},Ot=(A,N)=>{f.setElements(xt=>xt.map(pt=>pt.id===f.selectedId?{...pt,[A]:N}:pt));},Ft=()=>{f.selectedId&&(f.setElements(A=>A.filter(N=>N.id!==f.selectedId)),f.setSelectedId(null),f.setShowProperties(false));},Z=d?"flex flex-col h-full min-h-0 w-full bg-white text-gray-900 font-sans":"flex flex-col h-screen w-full bg-white text-gray-900 font-sans",X="text-xs md:text-sm px-2.5 md:px-3.5 py-2 rounded-lg font-medium transition border border-transparent";return jsxs("div",{className:Z,children:[jsxs("header",{className:"border-b border-slate-200 bg-white/95 backdrop-blur flex items-center justify-between px-3 md:px-6 py-2 shadow-sm z-20 shrink-0 gap-2 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2 md:gap-3 min-w-0",children:[n&&jsxs("div",{className:"relative shrink-0",children:[jsx("select",{value:P,onChange:A=>{let N=A.target.value;w||$(N),s?.(N);},className:"appearance-none text-xs md:text-sm pl-3 pr-8 py-2 rounded-full border border-slate-200 bg-slate-50 text-slate-700 shadow-sm hover:bg-slate-100 focus:outline-none focus:ring-2 focus:ring-blue-200",title:"Switch preset",children:Object.keys(St).map(A=>jsx("option",{value:A,children:St[A].name},A))}),jsx("span",{className:"pointer-events-none absolute inset-y-0 right-2 flex items-center text-slate-500 text-xs",children:"\u25BC"})]}),G&&jsxs("div",{className:"relative shrink-0 max-w-[min(100%,280px)]",children:[jsx("select",{value:V,onChange:A=>{let N=Number(A.target.value);H(N),f.setSelectedId(null),f.setShowProperties(false);},className:"w-full appearance-none text-xs md:text-sm pl-3 pr-8 py-2 rounded-full border border-slate-200 bg-sky-50 text-slate-800 shadow-sm hover:bg-sky-100 focus:outline-none focus:ring-2 focus:ring-sky-200 truncate",title:"Load JEE/NEET topic scene","aria-label":"Light syllabus topic",children:Zt.map((A,N)=>jsx("option",{value:N,children:A.name},A.name))}),jsx("span",{className:"pointer-events-none absolute inset-y-0 right-2 flex items-center text-slate-500 text-xs",children:"\u25BC"})]}),!y&&jsx("h1",{className:"text-lg md:text-2xl font-semibold tracking-tight text-slate-800 truncate min-w-0",children:at})]}),jsxs("div",{className:`flex gap-1.5 md:gap-3 items-center flex-wrap justify-end ${y?"ml-auto w-full":"ml-auto"}`,children:[jsx("button",{type:"button",onClick:Tt,className:`${X} text-slate-700 hover:bg-emerald-50 hover:text-emerald-700`,children:"Copy JSON"}),jsx("button",{type:"button",onClick:()=>{f.setJsonText(JSON.stringify(f.elements,null,2)),f.setShowJsonModal(true);},className:`${X} text-slate-700 hover:bg-blue-50 hover:text-blue-700`,children:"Export/Import"}),f.selectedId!=null&&!f.isViewMode&&jsxs("button",{type:"button",onClick:()=>f.setShowProperties(A=>!A),className:`${X} inline-flex items-center gap-1.5 ${f.showProperties?"bg-violet-100 text-violet-800 border-violet-200":"text-slate-700 hover:bg-violet-50 hover:text-violet-800"}`,title:f.showProperties?"Hide properties":"Edit properties","aria-expanded":f.showProperties,"aria-controls":"svg-engine-properties-panel",children:[jsx("svg",{className:"w-4 h-4 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":true,children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6V4m0 2a2 2 0 100 4m0-4a2 2 0 110 4m-6 8a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4m6 6v10m6-2a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4"})}),jsx("span",{className:"hidden sm:inline",children:"Properties"})]}),jsx("button",{type:"button",onClick:()=>{f.setIsViewMode(!f.isViewMode),f.setSelectedId(null),f.setTool("select");},className:`${X} ${f.isViewMode?"bg-blue-100 text-blue-800 border-blue-200":"text-slate-700 hover:bg-blue-50 hover:text-blue-700"}`,children:f.isViewMode?"Exit Preview":"Preview Mode"})]})]}),jsxs("div",{className:"flex flex-1 overflow-hidden min-h-0",children:[!f.isViewMode&&jsx(Ue,{categories:gt,tool:f.tool,onSelect:A=>{f.setTool(A),f.setSelectedId(null);}}),jsxs("div",{className:"flex-1 relative overflow-hidden bg-slate-50 min-h-0",children:[jsx(se,{svgRef:f.svgRef,className:"w-full h-full",elements:f.elements,drawing:f.drawing,selectedId:f.selectedId,viewMode:f.isViewMode,onBackgroundMouseDown:f.isViewMode?void 0:f.handleMouseDown,onBackgroundMouseMove:f.isViewMode?void 0:f.handleMouseMove,onBackgroundMouseUp:f.isViewMode?void 0:f.handleMouseUp,onBackgroundMouseLeave:f.isViewMode?void 0:f.handleMouseUp,onElementMouseDown:f.onElementMouseDown}),f.showProperties&&f.selectedId&&!f.isViewMode&&jsx(Ke,{element:f.selectedElement,onChange:Ot,onDelete:Ft,onClose:()=>f.setShowProperties(false)})]})]}),jsx(to,{open:f.showJsonModal,jsonText:f.jsonText,setJsonText:f.setJsonText,onClose:()=>f.setShowJsonModal(false),onLoad:()=>{try{f.setElements(JSON.parse(f.jsonText)),f.setShowJsonModal(!1);}catch{alert("Invalid JSON format");}}})]})});var Xo=t=>{switch(t){case "top-left":return {top:16,left:16};case "top-right":return {top:16,right:16};case "bottom-left":return {bottom:16,left:16};case "bottom-right":return {bottom:16,right:16};case "center":return {top:"50%",left:"50%",transform:"translate(-50%, -50%)"};default:return {top:16,right:16}}},oo=forwardRef(function({mode:e="floating",title:r="Diagram editor",startMinimized:o=false,position:n="top-right",width:s="min(960px, 92vw)",height:a="min(640px, 78vh)",onChange:l,onExport:d,onShellMinimize:x,onShellMaximize:y,onShellClose:h,documentTitle:v,...b},$){let w=useRef(null),[P,B]=useState(o),[V,H]=useState(false),[U,f]=useState(false),[G,gt]=useState({x:0,y:0}),at=useRef(null),Tt=useRef(null);useImperativeHandle($,()=>({getData:()=>w.current?.getData()??[],setData:N=>w.current?.setData(N),clear:()=>w.current?.clear(),minimize:()=>{B(true),H(false);},maximize:()=>{B(false),H(true);},restore:()=>{B(false),H(false);},close:()=>f(true),open:()=>f(false)}),[]);let Ot=useCallback(N=>{d?.(N);},[d]),Ft=N=>{e!=="floating"||V||(N.preventDefault(),at.current={startX:N.clientX,startY:N.clientY,ox:G.x,oy:G.y},N.currentTarget.setPointerCapture(N.pointerId));},Z=N=>{if(!at.current||e!=="floating"||V)return;let xt=N.clientX-at.current.startX,pt=N.clientY-at.current.startY;gt({x:at.current.ox+xt,y:at.current.oy+pt});},X=N=>{at.current=null;try{N.currentTarget.releasePointerCapture(N.pointerId);}catch{}},A=useMemo(()=>{if(e!=="floating")return {};let N=n==="center"?`translate(calc(-50% + ${G.x}px), calc(-50% + ${G.y}px))`:`translate(${G.x}px, ${G.y}px)`,xt={position:"fixed",zIndex:9999,display:U?"none":"flex",flexDirection:"column",background:"#fff",borderRadius:"12px",boxShadow:"0 25px 50px -12px rgb(0 0 0 / 0.25)",border:"1px solid #e2e8f0",overflow:"hidden",transform:N};if(V)return {...xt,inset:16,width:"auto",height:"auto",maxWidth:"none",maxHeight:"none",transform:`translate(${G.x}px, ${G.y}px)`};let pt=P?"auto":void 0;return {...xt,...Xo(n),width:s,height:P?pt:a,maxHeight:P?"none":"90vh",maxWidth:"96vw"}},[e,U,V,P,n,s,a,G]);return e==="inline"?jsx("div",{className:"flex flex-col bg-white rounded-lg border border-gray-200 overflow-hidden",style:{width:s,height:a},children:jsx(be,{ref:w,...b,embedded:true,documentTitle:v??r,onChange:l,onExport:Ot})}):jsxs("div",{ref:Tt,style:A,className:"font-sans text-gray-900",children:[jsxs("div",{className:"h-11 shrink-0 flex items-center justify-between px-3 border-b border-gray-100 bg-slate-50 cursor-grab active:cursor-grabbing select-none",onPointerDown:Ft,onPointerMove:Z,onPointerUp:X,onPointerCancel:X,children:[jsx("span",{className:"text-sm font-semibold text-slate-800 truncate pr-2",children:r}),jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[jsx("button",{type:"button",className:"p-1.5 rounded hover:bg-slate-200 text-slate-600",title:P?"Expand":"Minimize",onClick:N=>{N.stopPropagation(),B(xt=>!xt),P||H(false),x?.();},children:P?"\u25A2":"\u2212"}),jsx("button",{type:"button",className:"p-1.5 rounded hover:bg-slate-200 text-slate-600",title:V?"Restore":"Maximize",onClick:N=>{N.stopPropagation(),H(xt=>!xt),V||B(false),y?.();},children:"\u25A1"}),jsx("button",{type:"button",className:"p-1.5 rounded hover:bg-red-100 text-red-600",title:"Close",onClick:N=>{N.stopPropagation(),f(true),h?.();},children:"\xD7"})]})]}),jsx("div",{className:"flex-1 min-h-0 overflow-hidden flex flex-col",style:P?{maxHeight:0,opacity:0,overflow:"hidden",pointerEvents:"none"}:void 0,"aria-hidden":P,children:jsx(be,{ref:w,...b,embedded:true,hideDocumentTitle:true,documentTitle:v,onChange:l,onExport:Ot})}),P&&jsx("div",{className:"px-3 py-2 text-xs text-slate-500 border-t border-gray-100 bg-white",children:"Editor minimized \u2014 click \u25A2 on the bar to expand."})]})});function le(t,e){let r=createRoot(t);return r.render(e),r}function ce(t){t.unmount();}function Io(t){if(!(t==null||t===""))try{let e=JSON.parse(t);return Array.isArray(e)?e:void 0}catch{return}}function ro(t,e){return t===null||t===""?e:t==="true"||t===""}var jt=class extends HTMLElement{constructor(){super(...arguments);this.editorRef=createRef();this._elements=null;this._preset=null;this._mode=null;this._viewMode=null;this.committedInitial=null;this.pendingReseed=true;}connectedCallback(){this.render();}disconnectedCallback(){this.root&&(ce(this.root),this.root=void 0);}attributeChangedCallback(r){(r==="data"||r==="preset")&&(this._elements=null,this.pendingReseed=true),this.isConnected&&this.render();}get elements(){return this.editorRef.current?.getData()??this.committedInitial??[]}set elements(r){this._elements=r.slice(),this.pendingReseed=true,this.render();}get preset(){let r=this._preset??this.getAttribute("preset");return r&&St[r]?r:void 0}set preset(r){this._preset=r??null,this.pendingReseed=true,this.render();}get mode(){let r=this._mode??this.getAttribute("mode");return r==="inline"||r==="floating"?r:"floating"}set mode(r){this._mode=r,this.render();}get viewMode(){return this._viewMode??ro(this.getAttribute("view-mode"),false)}set viewMode(r){this._viewMode=r,this.render();}getData(){return this.editorRef.current?.getData()??this.committedInitial??[]}setData(r){this._elements=r.slice(),this.committedInitial=r.slice(),this.pendingReseed=false,this.editorRef.current?this.editorRef.current.setData(r):this.render();}toJSON(){return JSON.stringify(this.getData(),null,2)}clear(){this._elements=[],this.committedInitial=[],this.pendingReseed=false,this.editorRef.current?this.editorRef.current.clear():this.render();}minimize(){this.editorRef.current?.minimize();}maximize(){this.editorRef.current?.maximize();}restore(){this.editorRef.current?.restore();}close(){this.editorRef.current?.close();}readParsedInitial(){let r=Io(this.getAttribute("data")),o=this._preset??this.getAttribute("preset"),n=o&&St[o]?St[o]:St.mechanics;return this._elements?this._elements.slice():r?r.slice():n.elements.slice()}render(){(this.pendingReseed||this.committedInitial===null)&&(this.committedInitial=this.readParsedInitial(),this.pendingReseed=false);let r=this.mode,o=this.viewMode,n=this.getAttribute("title")??"Diagram editor",s=ro(this.getAttribute("start-minimized"),false),a=this.getAttribute("position")??"top-right",l=this.getAttribute("width"),d=this.getAttribute("height"),x=l===""?void 0:l??void 0,y=d===""?void 0:d??void 0,h=this.preset,v=this.committedInitial,b=jsx(oo,{ref:this.editorRef,mode:r,title:n,startMinimized:s,position:a,width:x,height:y,preset:h,initialElements:v,viewMode:o,onChange:$=>{this.dispatchEvent(new CustomEvent("change",{detail:{elements:$},bubbles:true,composed:true}));},onExport:$=>{this.dispatchEvent(new CustomEvent("export",{detail:{elements:$.elements,json:$.json},bubbles:true,composed:true}));},onShellMinimize:()=>{this.dispatchEvent(new CustomEvent("minimize",{bubbles:true,composed:true}));},onShellMaximize:()=>{this.dispatchEvent(new CustomEvent("maximize",{bubbles:true,composed:true}));},onShellClose:()=>{this.dispatchEvent(new CustomEvent("close",{bubbles:true,composed:true}));}});this.root?this.root.render(b):this.root=le(this,b);}};jt.observedAttributes=["mode","preset","data","view-mode","title","start-minimized","position","width","height"];function no(t){if(!(t==null||t===""))try{let e=JSON.parse(t);return Array.isArray(e)?e:void 0}catch{return}}function Fo(t,e){return t===null||t===""?e:t==="true"||t===""}var qt=class extends HTMLElement{constructor(){super(...arguments);this.svgRef=createRef();this._elements=null;this._showGrid=null;}connectedCallback(){this.render();}disconnectedCallback(){this.root&&(ce(this.root),this.root=void 0);}attributeChangedCallback(){this.isConnected&&this.render();}get elements(){return this._elements??no(this.getAttribute("data"))??[]}set elements(r){this._elements=r.slice(),this.render();}get showGrid(){return this._showGrid??Fo(this.getAttribute("show-grid"),false)}set showGrid(r){this._showGrid=r,this.render();}setData(r){this._elements=r.slice(),this.render();}toSvg(){return this.svgRef.current?.outerHTML??""}render(){let r=no(this.getAttribute("data")),o=this._elements??r??[],n=this.getAttribute("width")??"100%",s=this.getAttribute("height")??"100%",a=this.showGrid,l=jsx("div",{style:{width:n,height:s},className:"bg-white overflow-hidden",children:jsx(se,{elements:o,viewMode:true,showGrid:a,className:"w-full h-full block",svgRef:this.svgRef})});this.root?this.root.render(l):this.root=le(this,l);}};qt.observedAttributes=["data","width","height","show-grid"];function so(){typeof window>"u"||typeof customElements>"u"||(customElements.get("codefrydev-svg-engine")||customElements.define("codefrydev-svg-engine",jt),customElements.get("codefrydev-svg-engine-prev")||customElements.define("codefrydev-svg-engine-prev",qt));}so();export{jt as CodefrydevSvgEngine,qt as CodefrydevSvgEnginePrev,so as defineSvgEngineComponents};
1
+ import {forwardRef,useState,useEffect,useMemo,useImperativeHandle,useRef,useCallback,createRef}from'react';import {jsxs,Fragment,jsx}from'react/jsx-runtime';import {createRoot}from'react-dom/client';var Xo={name:"Classic incline FBD",elements:[{id:1,type:"wedge",x1:100,y1:400,x2:500,y2:100,label:"M",value:"",color:"#0f172a",strokeWidth:2},{id:2,type:"block",x1:220,y1:260,x2:300,y2:300,label:"m",value:"",color:"#0f172a",strokeWidth:2,rotation:-37},{id:3,type:"vector",x1:260,y1:280,x2:260,y2:400,label:"mg",value:"",color:"#0f172a",strokeWidth:2},{id:4,type:"vector",x1:260,y1:280,x2:212,y2:216,label:"N",value:"",color:"#0f172a",strokeWidth:2},{id:5,type:"vector",x1:260,y1:280,x2:180,y2:340,label:"f",value:"",color:"#0f172a",strokeWidth:2},{id:6,type:"arc",x1:100,y1:400,x2:260,y2:280,label:"\u03B8",value:"",color:"#0f172a",strokeWidth:2},{id:7,type:"dashed",x1:260,y1:280,x2:308,y2:344,label:"",value:"",color:"#0f172a",strokeWidth:2},{id:8,type:"dashed",x1:260,y1:280,x2:340,y2:220,label:"",value:"",color:"#0f172a",strokeWidth:2},{id:9,type:"dimension",x1:100,y1:440,x2:500,y2:440,label:"L",value:"",color:"#0f172a",strokeWidth:2},{id:10,type:"axes",x1:60,y1:100,x2:60,y2:100,label:"",value:"",color:"#0f172a",strokeWidth:2}]},To={name:"Rigid bodies & fluids showcase",elements:[{id:1,type:"text",x1:200,y1:40,x2:200,y2:40,label:"3D rigid bodies (moment of inertia)",color:"#64748b",fontSize:18},{id:2,type:"cylinder",x1:60,y1:140,x2:220,y2:180,color:"#38bdf8",strokeWidth:2,fillOpacity:.4,curveHeight:30,label:"M, R"},{id:3,type:"line",x1:20,y1:160,x2:280,y2:160,color:"#94a3b8",strokeWidth:2,lineStyle:"dashed"},{id:4,type:"arc_arrow",x1:260,y1:160,x2:300,y2:160,color:"#0f172a",strokeWidth:2,label:"\u03C9"},{id:5,type:"text",x1:140,y1:240,x2:140,y2:240,label:"I = MR\xB2/2",color:"#0f172a",fontSize:16},{id:6,type:"slab",x1:340,y1:120,x2:500,y2:180,color:"#38bdf8",strokeWidth:2,fillOpacity:.4,curveHeight:30,label:"M"},{id:7,type:"line",x1:420,y1:60,x2:420,y2:260,color:"#94a3b8",strokeWidth:2,lineStyle:"dashed",label:"z"},{id:8,type:"arc_arrow",x1:420,y1:80,x2:460,y2:80,color:"#0f172a",strokeWidth:2},{id:9,type:"text",x1:420,y1:240,x2:420,y2:240,label:"I = M(l\xB2+b\xB2)/12",color:"#0f172a",fontSize:16},{id:10,type:"text",x1:700,y1:40,x2:700,y2:40,label:"Fluids & gravitation",color:"#64748b",fontSize:18},{id:11,type:"pipe",x1:600,y1:80,x2:800,y2:140,color:"#3b82f6",strokeWidth:2,fillOpacity:.2,curveHeight:20},{id:12,type:"vector",x1:620,y1:110,x2:680,y2:110,color:"#0f172a",strokeWidth:2,label:"v\u2081"},{id:13,type:"vector",x1:720,y1:110,x2:780,y2:110,color:"#0f172a",strokeWidth:2,label:"v\u2082"},{id:14,type:"shell",x1:700,y1:240,x2:760,y2:240,color:"#8b5cf6",strokeWidth:2,fillOpacity:.3,curveHeight:15,label:"M"},{id:15,type:"point",x1:700,y1:240,x2:700,y2:240,color:"#0f172a",strokeWidth:2,label:"O"},{id:16,type:"point",x1:820,y1:240,x2:820,y2:240,color:"#0f172a",strokeWidth:2,label:"m"},{id:17,type:"vector",x1:820,y1:240,x2:780,y2:240,color:"#ef4444",strokeWidth:2,label:"F"},{id:18,type:"text",x1:220,y1:320,x2:220,y2:320,label:"Ladders & pulleys",color:"#64748b",fontSize:18},{id:19,type:"table_edge",x1:40,y1:420,x2:240,y2:560,color:"#475569",strokeWidth:2},{id:20,type:"block",x1:100,y1:380,x2:160,y2:420,color:"#38bdf8",strokeWidth:2,fillOpacity:.4,label:"m\u2081"},{id:21,type:"pulley",x1:240,y1:420,x2:260,y2:420,color:"#0f172a",strokeWidth:2,fillOpacity:.2},{id:22,type:"block",x1:240,y1:480,x2:280,y2:540,color:"#38bdf8",strokeWidth:2,fillOpacity:.4,label:"m\u2082"},{id:23,type:"line",x1:160,y1:400,x2:240,y2:400,color:"#0f172a",strokeWidth:2},{id:24,type:"line",x1:260,y1:420,x2:260,y2:480,color:"#0f172a",strokeWidth:2},{id:25,type:"table_edge",x1:400,y1:360,x2:560,y2:560,color:"#475569",strokeWidth:2},{id:26,type:"ladder",x1:460,y1:560,x2:560,y2:420,color:"#f59e0b",strokeWidth:2,curveHeight:12},{id:27,type:"vector",x1:460,y1:560,x2:460,y2:500,color:"#10b981",strokeWidth:2,label:"N\u2081"},{id:28,type:"vector",x1:560,y1:420,x2:500,y2:420,color:"#10b981",strokeWidth:2,label:"N\u2082"},{id:29,type:"vector",x1:510,y1:490,x2:510,y2:540,color:"#ef4444",strokeWidth:2,label:"Mg"}]},Io={name:"Vertical spring\u2013mass",elements:[{id:1,type:"text",x1:380,y1:40,x2:380,y2:40,label:"Equilibrium along a vertical spring",color:"#64748b",fontSize:18},{id:2,type:"line",x1:260,y1:100,x2:500,y2:100,color:"#475569",strokeWidth:3,label:"Ceiling"},{id:3,type:"spring",x1:380,y1:100,x2:380,y2:220,color:"#2563eb",strokeWidth:2,coils:8},{id:4,type:"block",x1:340,y1:220,x2:420,y2:280,color:"#38bdf8",strokeWidth:2,fillOpacity:.35,label:"m"},{id:5,type:"vector",x1:380,y1:280,x2:380,y2:380,color:"#ef4444",strokeWidth:2.5,label:"mg"},{id:6,type:"vector",x1:380,y1:250,x2:380,y2:150,color:"#10b981",strokeWidth:2.5,label:"F_s"},{id:7,type:"dashed",x1:380,y1:280,x2:460,y2:280,color:"#94a3b8",strokeWidth:1.5,label:"x = 0"},{id:8,type:"text",x1:480,y1:260,x2:480,y2:260,label:"mg = kx\u2080",color:"#0f172a",fontSize:16}]},Re=[Xo,To,Io],He={name:"Mechanics",elements:Re[0].elements,examples:Re,toolCategories:[{name:"Sketch and forces",tools:[{id:"select",name:"Select"},{id:"string",name:"String / Line"},{id:"spring",name:"Spring"},{id:"vector",name:"Force Vector"},{id:"dashed",name:"Dashed Line"},{id:"dimension",name:"Dimension"},{id:"surface",name:"Rigid Surface"}]},{name:"Rigid bodies",tools:[{id:"wedge",name:"Wedge / Incline"},{id:"axes",name:"Axes / Frame"},{id:"block",name:"Mass / Block"},{id:"cart",name:"Cart / Vehicle"},{id:"particle",name:"Point Mass"},{id:"disk",name:"Disk / Sphere"},{id:"rod",name:"Rod / Beam"},{id:"pulley",name:"Pulley"}]},{name:"Points and labels",tools:[{id:"pivot",name:"Pivot / Hinge"},{id:"com",name:"Center of Mass"},{id:"arc",name:"Angle / Arc"},{id:"text",name:"Label"}]}]};var Bo={name:"Wheatstone bridge",elements:[{id:1,type:"resistor",x1:200,y1:300,x2:400,y2:200,label:"R1",value:"60\u03A9",color:"#b45309",strokeWidth:2.5},{id:2,type:"resistor",x1:200,y1:300,x2:400,y2:400,label:"R3",value:"300\u03A9",color:"#b45309",strokeWidth:2.5},{id:3,type:"resistor",x1:400,y1:200,x2:600,y2:300,label:"R2",value:"100\u03A9",color:"#b45309",strokeWidth:2.5},{id:4,type:"resistor",x1:400,y1:400,x2:600,y2:300,label:"R4",value:"500\u03A9",color:"#b45309",strokeWidth:2.5},{id:5,type:"battery",x1:400,y1:400,x2:400,y2:200,label:"50V",value:"",color:"#1d4ed8",strokeWidth:2.5},{id:6,type:"wire",x1:200,y1:300,x2:200,y2:100,label:"",value:"",color:"#334155",strokeWidth:3},{id:7,type:"wire",x1:200,y1:100,x2:340,y2:100,label:"",value:"",color:"#334155",strokeWidth:3},{id:8,type:"meter_v",x1:340,y1:100,x2:460,y2:100,label:"",value:"",color:"#0369a1",strokeWidth:2.5},{id:9,type:"wire",x1:460,y1:100,x2:600,y2:100,label:"",value:"",color:"#334155",strokeWidth:3},{id:10,type:"wire",x1:600,y1:100,x2:600,y2:300,label:"",value:"",color:"#334155",strokeWidth:3},{id:11,type:"text",x1:180,y1:300,x2:180,y2:300,label:"S",value:"",fontFamily:"sans-serif",fontWeight:"bold",fontSize:18,color:"#0f172a"},{id:12,type:"text",x1:400,y1:180,x2:400,y2:180,label:"P",value:"",fontFamily:"sans-serif",fontWeight:"bold",fontSize:18,color:"#0f172a"},{id:13,type:"text",x1:400,y1:420,x2:400,y2:420,label:"Q",value:"",fontFamily:"sans-serif",fontWeight:"bold",fontSize:18,color:"#0f172a"},{id:14,type:"text",x1:620,y1:300,x2:620,y2:300,label:"T",value:"",fontFamily:"sans-serif",fontWeight:"bold",fontSize:18,color:"#0f172a"}]},Qo={name:"Series RC (charging)",elements:[{id:1,type:"text",x1:320,y1:40,x2:320,y2:40,label:"Single-loop RC after switch closes",color:"#475569",fontSize:16},{id:2,type:"battery",x1:120,y1:360,x2:120,y2:220,label:"\u03B5",value:"12 V",color:"#1d4ed8",strokeWidth:2.5},{id:3,type:"wire",x1:120,y1:220,x2:220,y2:220,color:"#334155",strokeWidth:3},{id:4,type:"resistor",x1:220,y1:220,x2:380,y2:220,label:"R",value:"2.2 k\u03A9",color:"#b45309",strokeWidth:2.5},{id:5,type:"wire",x1:380,y1:220,x2:480,y2:220,color:"#334155",strokeWidth:3},{id:6,type:"capacitor",x1:480,y1:220,x2:620,y2:220,label:"C",value:"47 \u03BCF",color:"#0f172a",strokeWidth:2.5},{id:7,type:"wire",x1:620,y1:220,x2:620,y2:360,color:"#334155",strokeWidth:3},{id:8,type:"wire",x1:620,y1:360,x2:120,y2:360,color:"#334155",strokeWidth:3},{id:9,type:"text",x1:360,y1:120,x2:360,y2:120,label:"\u03C4 = RC",color:"#0f172a",fontSize:18}]},Fo={name:"Parallel resistors",elements:[{id:1,type:"text",x1:300,y1:40,x2:300,y2:40,label:"Same voltage across each branch",color:"#475569",fontSize:16},{id:2,type:"battery",x1:120,y1:380,x2:120,y2:120,label:"V",value:"9 V",color:"#1d4ed8",strokeWidth:2.5},{id:3,type:"wire",x1:120,y1:120,x2:520,y2:120,color:"#334155",strokeWidth:3},{id:4,type:"resistor",x1:260,y1:120,x2:260,y2:300,label:"R\u2081",value:"300 \u03A9",color:"#b45309",strokeWidth:2.5},{id:5,type:"resistor",x1:400,y1:120,x2:400,y2:300,label:"R\u2082",value:"600 \u03A9",color:"#b45309",strokeWidth:2.5},{id:6,type:"wire",x1:260,y1:300,x2:400,y2:300,color:"#334155",strokeWidth:3},{id:7,type:"wire",x1:260,y1:300,x2:220,y2:300,color:"#334155",strokeWidth:3},{id:8,type:"meter_a",x1:220,y1:300,x2:120,y2:300,label:"I",value:"",color:"#b45309",strokeWidth:2.5},{id:9,type:"wire",x1:120,y1:300,x2:120,y2:380,color:"#334155",strokeWidth:3},{id:10,type:"text",x1:280,y1:340,x2:280,y2:340,label:"1/R_eq = 1/R\u2081 + 1/R\u2082",color:"#0f172a",fontSize:15}]},Oe=[Bo,Qo,Fo],Ye={name:"Circuit",elements:Oe[0].elements,examples:Oe,toolCategories:[{name:"Circuit",tools:[{id:"select",name:"Select / Move"},{id:"wire",name:"Wire"},{id:"resistor",name:"Resistor"},{id:"capacitor",name:"Capacitor"},{id:"inductor",name:"Inductor"},{id:"diode",name:"Diode"},{id:"battery",name:"Battery"},{id:"meter_v",name:"Voltmeter"},{id:"meter_a",name:"Ammeter"},{id:"ground",name:"Ground"},{id:"text",name:"Text Label"}]}]};var jo={name:"Piston, heat & first law",elements:[{id:1,type:"text",x1:120,y1:40,x2:120,y2:40,label:"Gas in a cylinder (work, heat, \u0394U)",color:"#475569",fontSize:18},{id:2,type:"piston_cylinder",x1:120,y1:120,x2:320,y2:320,compression:.55,showHeat:true,color:"#0ea5e9",strokeWidth:2,label:"Expansion stroke"},{id:3,type:"thermo_process",x1:400,y1:200,x2:560,y2:120,processType:"isobaric",color:"#f59e0b",strokeWidth:2,label:"Isobaric leg"},{id:4,type:"text",x1:400,y1:280,x2:400,y2:280,label:"Q = \u0394U + W",color:"#0f172a",fontSize:18}]},Vo={name:"Heat engine & P\u2013V cycle",elements:[{id:1,type:"text",x1:80,y1:40,x2:80,y2:40,label:"Carnot engine between two reservoirs",color:"#475569",fontSize:18},{id:2,type:"heat_engine",x1:120,y1:100,x2:260,y2:300,engineType:"engine",efficiency:.35,color:"#10b981",strokeWidth:2,label:"\u03B7 < 1"},{id:3,type:"pv_axes",x1:360,y1:300,x2:620,y2:100,color:"#1e293b",strokeWidth:2,label:"State space",xLabel:"V",yLabel:"P"},{id:4,type:"carnot_cycle",x1:400,y1:140,x2:560,y2:240,color:"#ec4899",strokeWidth:2},{id:5,type:"text",x1:640,y1:180,x2:640,y2:180,label:"Isotherms + adiabats",color:"#64748b",fontSize:15}]},Go={name:"Kinetic theory & conduction",elements:[{id:1,type:"text",x1:80,y1:40,x2:80,y2:40,label:"Speed distribution & thermal transport",color:"#475569",fontSize:18},{id:2,type:"maxwell_boltzmann",x1:80,y1:320,x2:340,y2:160,t1:300,t2:600,color:"#8b5cf6",strokeWidth:2,label:"f(v) at T\u2081, T\u2082"},{id:3,type:"diatomic_gas",x1:420,y1:220,x2:520,y2:220,color:"#f59e0b",strokeWidth:2,label:"5 DOF (trans + rot)",showRotations:true},{id:4,type:"conduction_rod",x1:420,y1:320,x2:720,y2:360,color:"#3b82f6",strokeWidth:2,label:"Q\u0307 = kA\u0394T/L"},{id:5,type:"random_walk",x1:600,y1:120,x2:720,y2:80,color:"#64748b",strokeWidth:2,label:"Diffusion"}]},Xe=[jo,Vo,Go],Te={name:"Thermodynamics",elements:Xe[0].elements,examples:Xe,toolCategories:[{name:"Basics",tools:[{id:"select",name:"Select"},{id:"point",name:"Node / Label"},{id:"line",name:"Line / Axis"},{id:"text",name:"Text Box"}]},{name:"Systems",tools:[{id:"piston_cylinder",name:"Piston & Gas"},{id:"heat_engine",name:"Heat Engine"},{id:"conduction_rod",name:"Thermal Rod"}]},{name:"PV Diagrams",tools:[{id:"pv_axes",name:"P-V Axes"},{id:"thermo_process",name:"Thermodynamic Path"},{id:"carnot_cycle",name:"Carnot Cycle"}]},{name:"KTG",tools:[{id:"maxwell_boltzmann",name:"Maxwell Dist."},{id:"diatomic_gas",name:"Diatomic DOF"},{id:"random_walk",name:"Random Walk"}]}]};var qo={name:"Electromagnet & uniform gap",elements:[{id:1,type:"text",x1:280,y1:36,x2:280,y2:36,label:"Iron pole pieces + straight B in the gap",color:"#475569",fontSize:16},{id:2,type:"pole_piece",x1:100,y1:80,x2:200,y2:300,label:"N",color:"#0f172a",strokeWidth:2},{id:3,type:"pole_piece",x1:500,y1:80,x2:600,y2:300,label:"S",color:"#0f172a",strokeWidth:2},{id:4,type:"b_field_line",x1:200,y1:120,x2:500,y2:120,label:"",color:"#10b981",strokeWidth:2},{id:5,type:"b_field_line",x1:200,y1:190,x2:500,y2:190,label:"B",color:"#10b981",strokeWidth:2,fontSize:18},{id:6,type:"b_field_line",x1:200,y1:260,x2:500,y2:260,label:"",color:"#10b981",strokeWidth:2},{id:7,type:"b_field_curve",x1:280,y1:80,x2:420,y2:80,curveHeight:50,label:"",color:"#10b981",strokeWidth:2},{id:8,type:"b_field_curve",x1:250,y1:80,x2:450,y2:80,curveHeight:110,label:"",color:"#10b981",strokeWidth:2},{id:9,type:"axes_3d",x1:200,y1:540,x2:300,y2:540,label:"",color:"#64748b",strokeWidth:2,fontSize:16},{id:10,type:"line",x1:200,y1:540,x2:200,y2:400,label:"",color:"#0ea5e9",strokeWidth:3},{id:11,type:"line",x1:200,y1:400,x2:320,y2:400,label:"i",color:"#0ea5e9",strokeWidth:3,fontSize:16},{id:12,type:"line",x1:320,y1:400,x2:320,y2:540,label:"",color:"#0ea5e9",strokeWidth:3},{id:13,type:"line",x1:320,y1:540,x2:200,y2:540,label:"",color:"#0ea5e9",strokeWidth:3},{id:14,type:"vector",x1:200,y1:540,x2:320,y2:620,label:"B",color:"#10b981",strokeWidth:2.5,fontSize:18}]},Zo={name:"Bar magnet & field lines",elements:[{id:1,type:"text",x1:260,y1:36,x2:260,y2:36,label:"Dipole field outside the magnet",color:"#475569",fontSize:16},{id:2,type:"bar_magnet",x1:200,y1:260,x2:520,y2:260,label:"Permanent magnet",color:"#0f172a",strokeWidth:2},{id:3,type:"b_field_curve",x1:220,y1:120,x2:480,y2:120,curveHeight:80,color:"#10b981",strokeWidth:2},{id:4,type:"b_field_curve",x1:200,y1:400,x2:500,y2:400,curveHeight:-90,color:"#10b981",strokeWidth:2},{id:5,type:"b_field_line",x1:360,y1:140,x2:360,y2:220,color:"#10b981",strokeWidth:2},{id:6,type:"b_field_line",x1:360,y1:300,x2:360,y2:380,color:"#10b981",strokeWidth:2},{id:7,type:"text",x1:600,y1:240,x2:600,y2:240,label:"N \u2192 S outside",color:"#0f172a",fontSize:15}]},Jo={name:"Long straight wire (Amp\xE8re)",elements:[{id:1,type:"text",x1:240,y1:36,x2:240,y2:36,label:"Current into page \u2297 \u2014 circular B around the wire",color:"#475569",fontSize:15},{id:2,type:"current_wire",x1:400,y1:120,x2:400,y2:420,label:"I",color:"#dc2626",strokeWidth:3},{id:3,type:"b_field_curve",x1:520,y1:200,x2:280,y2:200,curveHeight:120,color:"#10b981",strokeWidth:2},{id:4,type:"b_field_curve",x1:540,y1:280,x2:260,y2:280,curveHeight:140,color:"#10b981",strokeWidth:2},{id:5,type:"b_field_curve",x1:500,y1:360,x2:300,y2:360,curveHeight:100,color:"#10b981",strokeWidth:2},{id:6,type:"b_region_in",x1:360,y1:240,x2:440,y2:320,color:"#6366f1",strokeWidth:1.5},{id:7,type:"text",x1:400,y1:460,x2:400,y2:460,label:"\u222E B\xB7dl = \u03BC\u2080I",color:"#0f172a",fontSize:17}]},Ie=[qo,Zo,Jo],Be={name:"Magnetism",elements:Ie[0].elements,examples:Ie,toolCategories:[{name:"Basics",tools:[{id:"select",name:"Select/Move"},{id:"point",name:"Point/Node"},{id:"line",name:"Solid Line"},{id:"vector",name:"Vector/Force"},{id:"text",name:"Text Label"}]},{name:"Magnetism",tools:[{id:"axes_3d",name:"3D Axes (x,y,z)"},{id:"angle",name:"Angle/Arc"},{id:"b_field_line",name:"B-Line (Straight)"},{id:"b_field_curve",name:"B-Line (Curved)"},{id:"bezier",name:"Bezier Curve"},{id:"pole_piece",name:"Pole Piece (N/S)"},{id:"b_region_in",name:"B-Field (IN)"},{id:"b_region_out",name:"B-Field (OUT)"},{id:"current_wire",name:"Wire (with I)"}]},{name:"Magnets & circuits",tools:[{id:"bar_magnet",name:"Bar Magnet"},{id:"coil",name:"Coil/Inductor"},{id:"charge_plus",name:"+ Charge"},{id:"charge_minus",name:"- Charge"},{id:"resistor",name:"Resistor"},{id:"capacitor",name:"Capacitor"},{id:"ac_source",name:"AC Source"},{id:"meter",name:"Galvano/Meter"},{id:"ground",name:"Ground"}]},{name:"Drawing",tools:[{id:"circle",name:"Circle/Loop"},{id:"axes",name:"2D Axes"}]}]};var Qe=[{name:"Lens combination",elements:[{id:1,type:"line",x1:50,y1:300,x2:850,y2:300,lineStyle:"dashed",color:"#94a3b8",strokeWidth:2},{id:2,type:"lens_convex",x1:300,y1:150,x2:300,y2:450,color:"#38bdf8",strokeWidth:2,label:"f\u2081 = +30cm"},{id:3,type:"lens_concave",x1:500,y1:150,x2:500,y2:450,color:"#38bdf8",strokeWidth:2,label:"f\u2082 = -10cm"},{id:4,type:"ray",x1:50,y1:200,x2:300,y2:200,color:"#ef4444",strokeWidth:2},{id:5,type:"ray",x1:50,y1:400,x2:300,y2:400,color:"#ef4444",strokeWidth:2},{id:6,type:"ray",x1:300,y1:200,x2:500,y2:266,color:"#ef4444",strokeWidth:2},{id:7,type:"ray",x1:300,y1:400,x2:500,y2:334,color:"#ef4444",strokeWidth:2},{id:8,type:"ray",x1:500,y1:266,x2:800,y2:266,color:"#ef4444",strokeWidth:2},{id:9,type:"ray",x1:500,y1:334,x2:800,y2:334,color:"#ef4444",strokeWidth:2},{id:10,type:"line",x1:500,y1:266,x2:600,y2:300,lineStyle:"dashed",color:"#ef4444",strokeWidth:2},{id:11,type:"line",x1:500,y1:334,x2:600,y2:300,lineStyle:"dashed",color:"#ef4444",strokeWidth:2},{id:12,type:"point",x1:600,y1:300,x2:600,y2:300,label:"Virtual object",color:"#64748b"}]},{name:"Concave mirror (real image)",elements:[{id:1,type:"line",x1:50,y1:300,x2:700,y2:300,lineStyle:"dashed",color:"#94a3b8",strokeWidth:2},{id:2,type:"mirror_concave",x1:600,y1:150,x2:600,y2:450,curveHeight:40,color:"#0f172a",strokeWidth:2},{id:3,type:"point",x1:400,y1:300,x2:400,y2:300,label:"C",color:"#64748b"},{id:4,type:"point",x1:500,y1:300,x2:500,y2:300,label:"F",color:"#64748b"},{id:5,type:"vector",x1:300,y1:300,x2:300,y2:200,label:"O",color:"#10b981",strokeWidth:3},{id:6,type:"ray",x1:300,y1:200,x2:600,y2:200,color:"#ef4444",strokeWidth:2},{id:7,type:"ray",x1:600,y1:200,x2:400,y2:400,color:"#ef4444",strokeWidth:2},{id:8,type:"ray",x1:300,y1:200,x2:400,y2:300,color:"#3b82f6",strokeWidth:2},{id:9,type:"ray",x1:400,y1:300,x2:600,y2:500,color:"#3b82f6",strokeWidth:2},{id:10,type:"ray",x1:600,y1:500,x2:450,y2:350,color:"#3b82f6",strokeWidth:2},{id:11,type:"vector",x1:450,y1:300,x2:450,y2:350,label:"I",color:"#f59e0b",strokeWidth:3}]},{name:"Apparent depth (refraction)",elements:[{id:1,type:"glass_slab",x1:50,y1:300,x2:850,y2:600,color:"#38bdf8",label:"Water (\u03BC = 4/3)",strokeWidth:2},{id:2,type:"point",x1:450,y1:500,x2:450,y2:500,label:"Real object",color:"#0f172a"},{id:3,type:"ray",x1:450,y1:500,x2:450,y2:300,color:"#ef4444",strokeWidth:2},{id:4,type:"ray",x1:450,y1:300,x2:450,y2:100,color:"#ef4444",strokeWidth:2},{id:5,type:"ray",x1:450,y1:500,x2:550,y2:300,color:"#ef4444",strokeWidth:2},{id:6,type:"ray",x1:550,y1:300,x2:700,y2:150,color:"#ef4444",strokeWidth:2},{id:7,type:"line",x1:550,y1:300,x2:450,y2:400,lineStyle:"dashed",color:"#ef4444",strokeWidth:2},{id:8,type:"point",x1:450,y1:400,x2:450,y2:400,label:"Virtual image",color:"#f59e0b"},{id:9,type:"line",x1:550,y1:200,x2:550,y2:400,lineStyle:"dashed",color:"#94a3b8",strokeWidth:1}]},{name:"Double-slit interference",elements:[{id:1,type:"slit_double",x1:200,y1:200,x2:200,y2:400,color:"#0f172a",strokeWidth:4},{id:2,type:"line",x1:700,y1:100,x2:700,y2:500,color:"#0f172a",strokeWidth:4,label:"Screen"},{id:3,type:"line",x1:200,y1:300,x2:700,y2:300,lineStyle:"dashed",color:"#94a3b8",strokeWidth:2},{id:4,type:"point",x1:200,y1:250,x2:200,y2:250,label:"S\u2081",color:"#0f172a"},{id:5,type:"point",x1:200,y1:350,x2:200,y2:350,label:"S\u2082",color:"#0f172a"},{id:6,type:"point",x1:700,y1:150,x2:700,y2:150,label:"P (max/min)",color:"#0f172a"},{id:7,type:"photon",x1:200,y1:250,x2:700,y2:150,color:"#eab308",strokeWidth:2},{id:8,type:"photon",x1:200,y1:350,x2:700,y2:150,color:"#eab308",strokeWidth:2},{id:9,type:"line",x1:200,y1:250,x2:240,y2:340,lineStyle:"dashed",color:"#ef4444",strokeWidth:2},{id:10,type:"text",x1:250,y1:370,x2:250,y2:370,label:"\u0394x = d sin \u03B8",color:"#ef4444",fontSize:18},{id:11,type:"text",x1:450,y1:280,x2:450,y2:280,label:"D",color:"#64748b",fontSize:20},{id:12,type:"line",x1:720,y1:300,x2:720,y2:150,lineStyle:"solid",color:"#64748b",strokeWidth:2},{id:13,type:"text",x1:740,y1:225,x2:740,y2:225,label:"y",color:"#64748b",fontSize:18}]},{name:"Single-slit diffraction",elements:[{id:1,type:"slit_single",x1:300,y1:200,x2:300,y2:400,color:"#0f172a",strokeWidth:5,label:"Width a"},{id:2,type:"line",x1:700,y1:100,x2:700,y2:500,color:"#0f172a",strokeWidth:4},{id:3,type:"line",x1:100,y1:300,x2:700,y2:300,lineStyle:"dashed",color:"#94a3b8",strokeWidth:2},{id:4,type:"photon",x1:100,y1:220,x2:300,y2:220,color:"#8b5cf6",strokeWidth:2},{id:5,type:"photon",x1:100,y1:380,x2:300,y2:380,color:"#8b5cf6",strokeWidth:2},{id:6,type:"ray",x1:300,y1:220,x2:700,y2:300,color:"#ef4444",strokeWidth:2},{id:7,type:"ray",x1:300,y1:380,x2:700,y2:300,color:"#ef4444",strokeWidth:2},{id:8,type:"ray",x1:300,y1:220,x2:700,y2:150,color:"#3b82f6",strokeWidth:2},{id:9,type:"ray",x1:300,y1:380,x2:700,y2:150,color:"#3b82f6",strokeWidth:2},{id:10,type:"point",x1:700,y1:300,x2:700,y2:300,label:"Central max",color:"#ef4444"},{id:11,type:"point",x1:700,y1:150,x2:700,y2:150,label:"1st min (a sin \u03B8 = \u03BB)",color:"#3b82f6"}]}],Fe={name:"Light & optics",elements:Qe[0].elements,examples:Qe,toolCategories:[{name:"Basics",tools:[{id:"select",name:"Select/Move"},{id:"point",name:"Point/Node"},{id:"line",name:"Solid line"},{id:"vector",name:"Vector/Object"},{id:"text",name:"Text label"}]},{name:"Optics",tools:[{id:"ray",name:"Light ray"},{id:"lens_convex",name:"Convex lens"},{id:"lens_concave",name:"Concave lens"},{id:"mirror_plane",name:"Plane mirror"},{id:"mirror_concave",name:"Concave mirror"},{id:"mirror_convex",name:"Convex mirror"},{id:"prism",name:"Glass prism"},{id:"glass_slab",name:"Glass slab"}]},{name:"Modern physics",tools:[{id:"photon",name:"Photon (wavy)"},{id:"slit_double",name:"Double slit"},{id:"slit_single",name:"Single slit"},{id:"energy_level",name:"Energy level"},{id:"nucleus",name:"Atom/Nucleus"}]}]};var Uo={name:"SHM kinematics",elements:[{id:1,type:"text",x1:120,y1:36,x2:120,y2:36,label:"Motion along x vs time graphs (x, v, a)",color:"#475569",fontSize:17},{id:2,type:"strobe_shm",x1:120,y1:100,x2:120,y2:300,amplitude:60,loops:1,color:"#f59e0b",strokeWidth:2,label:"Mass on spring"},{id:3,type:"shm_graph",x1:260,y1:200,x2:460,y2:200,amplitude:60,loops:1,graphType:"all",color:"#1e293b",strokeWidth:2,label:"x(t), v(t), a(t)"},{id:4,type:"text",x1:520,y1:200,x2:520,y2:200,label:"\u03C9\xB2 = k/m",color:"#0f172a",fontSize:16}]},Ko={name:"Pendulum & phasor",elements:[{id:1,type:"text",x1:140,y1:36,x2:140,y2:36,label:"Small oscillations + rotating phasor picture",color:"#475569",fontSize:17},{id:2,type:"pendulum",x1:200,y1:100,x2:260,y2:240,label:"m",color:"#0ea5e9",strokeWidth:2,size:15,showForces:true},{id:3,type:"phasor",x1:420,y1:170,x2:500,y2:90,label:"\u03C9t",color:"#8b5cf6",strokeWidth:2,showProjection:true},{id:4,type:"spring",x1:620,y1:120,x2:620,y2:240,color:"#3b82f6",strokeWidth:2,coils:7},{id:5,type:"mass_box",x1:600,y1:240,x2:640,y2:280,color:"#ef4444",strokeWidth:2,label:"m"},{id:6,type:"text",x1:620,y1:320,x2:620,y2:320,label:"Same \u03C9 for linear & torsional SHM",color:"#64748b",fontSize:14}]},tr={name:"Damping & energy",elements:[{id:1,type:"text",x1:120,y1:36,x2:120,y2:36,label:"Lossy oscillator: energy swap + torsion mode",color:"#475569",fontSize:17},{id:2,type:"energy_graph",x1:100,y1:280,x2:300,y2:280,amplitude:80,domain:"time",color:"#1e293b",strokeWidth:2,label:"U(t), K(t)"},{id:3,type:"vane_liquid",x1:380,y1:200,x2:460,y2:200,color:"#64748b",strokeWidth:2,label:"Drag \u221D v"},{id:4,type:"spring",x1:420,y1:80,x2:420,y2:200,color:"#3b82f6",strokeWidth:2,coils:6},{id:5,type:"damped_wave",x1:520,y1:240,x2:720,y2:240,amplitude:45,damping:.02,frequency:12,color:"#ec4899",strokeWidth:2,label:"x(t) envelope"},{id:6,type:"torsion_pendulum",x1:320,y1:380,x2:320,y2:520,color:"#ec4899",strokeWidth:2,size:44,rotation:22,label:"Disk + fiber"}]},je=[Uo,Ko,tr],Ve={name:"Oscillations & Waves",elements:je[0].elements,examples:je,toolCategories:[{name:"Basics",tools:[{id:"select",name:"Select"},{id:"point",name:"Point/Node"},{id:"line",name:"Line / Axis"},{id:"vector",name:"Vector"},{id:"text",name:"Text Label"}]},{name:"Oscillations",tools:[{id:"spring",name:"Spring"},{id:"mass_box",name:"Mass Block"},{id:"pendulum",name:"Pendulum"},{id:"torsion_pendulum",name:"Torsion Pendulum"},{id:"vane_liquid",name:"Damping Vane"},{id:"phasor",name:"Phasor"},{id:"damped_wave",name:"Damped SHM"}]},{name:"Graphs & Waves",tools:[{id:"sine_wave",name:"Sine Wave"},{id:"standing_wave",name:"Standing Wave"},{id:"wave_pulse",name:"Wave Pulse"},{id:"shm_graph",name:"SHM Kinematics"},{id:"energy_graph",name:"Energy (U/K)"},{id:"strobe_shm",name:"Strobe Motion"},{id:"wall",name:"Rigid Boundary"}]},{name:"Sound & Gases",tools:[{id:"speaker",name:"Speaker"},{id:"tuning_fork",name:"Tuning Fork"},{id:"wavefronts",name:"Wavefronts"},{id:"mach_cone",name:"Mach Cone"},{id:"beats_graph",name:"Beats Envelope"}]}]};var er={name:"Collision & center of mass",elements:[{id:1,type:"text",x1:120,y1:36,x2:120,y2:36,label:"Two bodies before/after contact \u2014 COM frame",color:"#475569",fontSize:17},{id:2,type:"point_mass",x1:80,y1:140,x2:80,y2:140,size:25,color:"#ef4444",label:"m\u2081"},{id:3,type:"vector",x1:80,y1:140,x2:180,y2:140,color:"#ef4444",label:"u\u2081",strokeWidth:2},{id:4,type:"point_mass",x1:240,y1:100,x2:240,y2:100,size:15,color:"#3b82f6",label:"m\u2082"},{id:5,type:"dashed_path",x1:180,y1:140,x2:320,y2:80,color:"#ef4444",strokeWidth:1.5},{id:6,type:"dashed_path",x1:240,y1:100,x2:340,y2:180,color:"#3b82f6",strokeWidth:1.5},{id:7,type:"com_indicator",x1:160,y1:120,x2:160,y2:120,color:"#10b981",size:15,label:"COM"},{id:8,type:"system_boundary",x1:40,y1:60,x2:360,y2:220,color:"#94a3b8",strokeWidth:1.5}]},or={name:"Rigid rod & torque",elements:[{id:1,type:"text",x1:140,y1:36,x2:140,y2:36,label:"Hinged rod: weight, pivot reaction, angular accel",color:"#475569",fontSize:17},{id:2,type:"pivot",x1:120,y1:160,x2:120,y2:160,color:"#64748b",size:25},{id:3,type:"uniform_rod",x1:120,y1:160,x2:420,y2:200,color:"#f59e0b",strokeWidth:12,label:"L, M"},{id:4,type:"vector",x1:420,y1:200,x2:420,y2:300,color:"#ef4444",label:"mg",strokeWidth:2},{id:5,type:"curve_arrow",x1:120,y1:160,x2:200,y2:240,color:"#8b5cf6",strokeWidth:2,label:"\u03B1"},{id:6,type:"text",x1:480,y1:200,x2:480,y2:200,label:"\u03C4 = I\u03B1 about pivot",color:"#0f172a",fontSize:15}]},rr={name:"Rolling, pulleys & rocket",elements:[{id:1,type:"text",x1:100,y1:36,x2:100,y2:36,label:"Rolling on incline \xB7 Atwood \xB7 variable-mass rocket",color:"#475569",fontSize:16},{id:2,type:"inclined_wedge",x1:60,y1:200,x2:360,y2:360,color:"#64748b",strokeWidth:2,label:"\u03B8"},{id:3,type:"rolling_body",x1:160,y1:230,x2:200,y2:230,color:"#3b82f6",strokeWidth:2,label:"M, R",showVelocity:true,showOmega:true},{id:4,type:"vector",x1:160,y1:250,x2:110,y2:225,color:"#ef4444",label:"f_s",strokeWidth:2},{id:5,type:"pulley",x1:420,y1:200,x2:460,y2:200,color:"#64748b",strokeWidth:2},{id:6,type:"block_mass",x1:360,y1:300,x2:400,y2:340,color:"#0ea5e9",label:"m\u2081"},{id:7,type:"block_mass",x1:500,y1:240,x2:540,y2:280,color:"#0ea5e9",label:"m\u2082"},{id:8,type:"line",x1:380,y1:300,x2:380,y2:200,color:"#1e293b",strokeWidth:1.5},{id:9,type:"line",x1:520,y1:260,x2:520,y2:200,color:"#1e293b",strokeWidth:1.5},{id:10,type:"rocket",x1:620,y1:340,x2:620,y2:220,color:"#3b82f6",strokeWidth:2,label:"v(t)"},{id:11,type:"vector",x1:620,y1:340,x2:620,y2:400,color:"#f97316",strokeWidth:2,label:"u_rel dm/dt"}]},Ge=[er,or,rr],qe={name:"Rotation",elements:Ge[0].elements,examples:Ge,toolCategories:[{name:"Basics",tools:[{id:"select",name:"Select"},{id:"line",name:"Line / Axis"},{id:"vector",name:"Vector"},{id:"text",name:"Text Label"}]},{name:"Mass & Momentum",tools:[{id:"point_mass",name:"Point Mass"},{id:"block_mass",name:"Block/Mass"},{id:"com_indicator",name:"Center of Mass"},{id:"system_boundary",name:"System Bound"},{id:"dashed_path",name:"Trajectory"},{id:"rocket",name:"Rocket (Varying)"}]},{name:"Rigid Bodies",tools:[{id:"uniform_rod",name:"Uniform Rod"},{id:"solid_disk",name:"Solid Disk/Sphere"},{id:"hoop_ring",name:"Hoop/Ring"},{id:"rolling_body",name:"Rolling Object"}]},{name:"Mechanics",tools:[{id:"pivot",name:"Pivot / Hinge"},{id:"inclined_wedge",name:"Inclined Plane"},{id:"pulley",name:"Pulley System"},{id:"spring",name:"Spring"},{id:"curve_arrow",name:"Angular Vector (\u03C9/\u03C4)"}]}]};var nr={name:"Charges, capacitor & field",elements:[{id:1,type:"text",x1:320,y1:24,x2:320,y2:24,label:"RC branch + point charges in an external E",color:"#475569",fontSize:16},{id:2,type:"capacitor",x1:260,y1:200,x2:460,y2:200,label:"C = 10\u03BCF",color:"#0f172a",strokeWidth:3,fontSize:18},{id:3,type:"line",x1:260,y1:200,x2:260,y2:400,color:"#0f172a",strokeWidth:2},{id:4,type:"line",x1:460,y1:200,x2:460,y2:400,color:"#0f172a",strokeWidth:2},{id:5,type:"capacitor",x1:260,y1:400,x2:460,y2:400,label:"V = 12V",color:"#0f172a",strokeWidth:3,fontSize:18},{id:6,type:"ground",x1:460,y1:400,x2:460,y2:460,label:"",color:"#0f172a",strokeWidth:2},{id:7,type:"charge_plus",x1:340,y1:180,x2:340,y2:180,label:"+Q",color:"#ef4444",strokeWidth:2,fontSize:16},{id:8,type:"charge_minus",x1:380,y1:180,x2:380,y2:180,label:"-Q",color:"#3b82f6",strokeWidth:2,fontSize:16},{id:9,type:"vector",x1:345,y1:190,x2:375,y2:190,label:"",color:"#ef4444",strokeWidth:1.5,lineStyle:"dashed"},{id:10,type:"vector",x1:345,y1:210,x2:375,y2:210,label:"",color:"#ef4444",strokeWidth:1.5,lineStyle:"dashed"},{id:11,type:"charge_plus",x1:600,y1:300,x2:600,y2:300,label:"+q",color:"#ef4444",strokeWidth:2,fontSize:18},{id:12,type:"charge_minus",x1:800,y1:300,x2:800,y2:300,label:"-q",color:"#3b82f6",strokeWidth:2,fontSize:18},{id:13,type:"vector",x1:620,y1:300,x2:780,y2:300,label:"E",color:"#94a3b8",strokeWidth:2,fontSize:18},{id:14,type:"circle",x1:600,y1:300,x2:660,y2:300,label:"",color:"#ef4444",strokeWidth:1.5,lineStyle:"dashed"}]},ir={name:"Coordinate plane: parabola & sine",elements:[{id:1,type:"text",x1:280,y1:24,x2:280,y2:24,label:"Standard graphs in x\u2013y",color:"#475569",fontSize:16},{id:2,type:"axes",x1:120,y1:380,x2:520,y2:80,color:"#0f172a",strokeWidth:2},{id:3,type:"parabola_v",x1:200,y1:200,x2:440,y2:340,color:"#2563eb",strokeWidth:2.5,label:"y \u221D x\xB2"},{id:4,type:"sine_wave",x1:140,y1:260,x2:500,y2:260,color:"#db2777",strokeWidth:2.5,label:"sin x",amplitude:40,loops:2},{id:5,type:"text",x1:560,y1:120,x2:560,y2:120,label:"Use axes bbox for domain",color:"#64748b",fontSize:14}]},sr={name:"Hyperbola & modulus",elements:[{id:1,type:"text",x1:260,y1:24,x2:260,y2:24,label:"Rational-style curves & piecewise linear",color:"#475569",fontSize:16},{id:2,type:"axes",x1:100,y1:400,x2:540,y2:60,color:"#0f172a",strokeWidth:2},{id:3,type:"hyperbola",x1:320,y1:100,x2:480,y2:360,color:"#7c3aed",strokeWidth:2.5,label:"xy = const"},{id:4,type:"modulus",x1:160,y1:320,x2:280,y2:180,color:"#ea580c",strokeWidth:2.5,label:"|x - a|"},{id:5,type:"text",x1:560,y1:280,x2:560,y2:280,label:"Asymptotes & kinks",color:"#64748b",fontSize:14}]},Ze=[nr,ir,sr],Je={name:"Graph",elements:Ze[0].elements,examples:Ze,toolCategories:[{name:"Basic",tools:[{id:"select",name:"Select/Move"},{id:"point",name:"Point/Node"},{id:"line",name:"Solid Line"},{id:"dashed_line",name:"Dashed Line"},{id:"vector",name:"Vector/Arrow"},{id:"angle",name:"Angle/Vector"},{id:"axes",name:"X-Y Axes"},{id:"text",name:"Text Label"}]},{name:"Physics",tools:[{id:"charge_plus",name:"+ Charge"},{id:"charge_minus",name:"- Charge"},{id:"capacitor",name:"Capacitor"},{id:"ground",name:"Ground"}]},{name:"Shapes",tools:[{id:"rectangle",name:"Rectangle"},{id:"circle",name:"Circle"},{id:"ellipse",name:"Ellipse"}]},{name:"Curves",tools:[{id:"parabola_v",name:"Parabola (V)"},{id:"parabola_h",name:"Parabola (H)"},{id:"hyperbola",name:"Hyperbola"},{id:"modulus",name:"Modulus |x|"},{id:"step_function",name:"Step [x]"},{id:"shaded_area",name:"Area Graph"},{id:"exponential",name:"Exponential"},{id:"logarithmic",name:"Logarithmic"},{id:"sine_wave",name:"Sine Wave"}]},{name:"Mechanical",tools:[{id:"spring",name:"Spring"}]}]};var ar={name:"Point charge & Gaussian sphere",elements:[{id:1,type:"text",x1:160,y1:36,x2:160,y2:36,label:"Spherical symmetry: E \u221D 1/r\xB2 outside",color:"#475569",fontSize:16},{id:2,type:"charge_pos",x1:160,y1:180,x2:160,y2:180,label:"+q",color:"#ef4444",strokeWidth:2,fontSize:18},{id:3,type:"gaussian_sphere",x1:160,y1:180,x2:280,y2:180,color:"#10b981",strokeWidth:2,label:"Gaussian surface"},{id:4,type:"vector",x1:160,y1:180,x2:300,y2:180,color:"#ef4444",strokeWidth:2,label:"E"},{id:5,type:"vector",x1:160,y1:180,x2:160,y2:60,color:"#ef4444",strokeWidth:2},{id:6,type:"vector",x1:160,y1:180,x2:40,y2:180,color:"#ef4444",strokeWidth:2},{id:7,type:"vector",x1:160,y1:180,x2:160,y2:300,color:"#ef4444",strokeWidth:2},{id:8,type:"text",x1:160,y1:340,x2:160,y2:340,label:"\u222E E\xB7dA = Q/\u03B5\u2080",color:"#0f172a",fontSize:17}]},lr={name:"Line charge & Gaussian cylinder",elements:[{id:1,type:"text",x1:500,y1:36,x2:500,y2:36,label:"Infinite line \u03BB \u2014 use a coaxial cylinder",color:"#475569",fontSize:15},{id:2,type:"charged_plate_pos",x1:480,y1:80,x2:480,y2:360,color:"#ef4444",strokeWidth:2,label:"+\u03BB"},{id:3,type:"gaussian_cylinder",x1:480,y1:140,x2:480,y2:300,color:"#10b981",strokeWidth:2,curveHeight:60,label:"Coaxial S"},{id:4,type:"vector",x1:480,y1:210,x2:600,y2:210,color:"#ef4444",strokeWidth:2,label:"E"},{id:5,type:"vector",x1:480,y1:210,x2:360,y2:210,color:"#ef4444",strokeWidth:2},{id:6,type:"text",x1:480,y1:400,x2:480,y2:400,label:"E = \u03BB / (2\u03C0\u03B5\u2080r)",color:"#0f172a",fontSize:16}]},cr={name:"Parallel plates & dipole",elements:[{id:1,type:"text",x1:720,y1:36,x2:720,y2:36,label:"Uniform field + torque on p in E",color:"#475569",fontSize:15},{id:2,type:"charged_plate_pos",x1:600,y1:100,x2:820,y2:100,color:"#ef4444",strokeWidth:2},{id:3,type:"charged_plate_neg",x1:600,y1:300,x2:820,y2:300,color:"#3b82f6",strokeWidth:2},{id:4,type:"vector",x1:640,y1:100,x2:640,y2:300,color:"#ef4444",strokeWidth:2},{id:5,type:"vector",x1:700,y1:100,x2:700,y2:300,color:"#ef4444",strokeWidth:2},{id:6,type:"vector",x1:780,y1:100,x2:780,y2:300,color:"#ef4444",strokeWidth:2,label:"E"},{id:7,type:"text",x1:720,y1:340,x2:720,y2:340,label:"\u0394V = E d (parallel)",color:"#0f172a",fontSize:15},{id:8,type:"dipole",x1:120,y1:480,x2:280,y2:480,color:"#64748b",strokeWidth:2,label:"p"},{id:9,type:"vector",x1:120,y1:480,x2:280,y2:480,color:"#f59e0b",strokeWidth:2,label:"p"},{id:10,type:"text",x1:320,y1:480,x2:320,y2:480,label:"\u03C4 = p \xD7 E",color:"#0f172a",fontSize:16}]},Ue=[ar,lr,cr],Ke={name:"Electrostatics",elements:Ue[0].elements,examples:Ue,toolCategories:[{name:"Basics",tools:[{id:"select",name:"Select/Move"},{id:"point",name:"Point"},{id:"line",name:"Line"},{id:"vector",name:"Vector"},{id:"text",name:"Text Label"}]},{name:"Electrostatics",tools:[{id:"charge_pos",name:"+ Charge"},{id:"charge_neg",name:"- Charge"},{id:"dipole",name:"Dipole"},{id:"charged_plate_pos",name:"+ Plate"},{id:"charged_plate_neg",name:"- Plate"},{id:"gaussian_sphere",name:"Gauss Sphere"},{id:"gaussian_cylinder",name:"Gauss Cyl"}]},{name:"Optics",tools:[{id:"ray",name:"Light Ray"},{id:"lens_convex",name:"Convex Lens"},{id:"lens_concave",name:"Concave Lens"},{id:"mirror_plane",name:"Plane Mirror"}]},{name:"Modern Phys",tools:[{id:"photon",name:"Photon"},{id:"slit_double",name:"Double Slit"},{id:"energy_level",name:"Energy Lvl"}]}]};var dr={name:"Aromatic halogenation",elements:[{id:1,type:"text",x1:420,y1:40,x2:420,y2:40,label:"Lewis acid catalyzed chlorination (schematic)",color:"#64748b",fontSize:15},{id:2,type:"benzene",x1:150,y1:210,x2:150,y2:210,label:"",value:""},{id:3,type:"text",x1:240,y1:210,x2:240,y2:210,label:"+",value:""},{id:4,type:"atom",x1:285,y1:210,x2:285,y2:210,label:"Cl",value:""},{id:5,type:"single_bond",x1:300,y1:210,x2:330,y2:210,label:"",value:""},{id:6,type:"atom",x1:345,y1:210,x2:345,y2:210,label:"Cl",value:""},{id:7,type:"reaction_arrow",x1:400,y1:210,x2:520,y2:210,label:"FeCl\u2083",value:"cat."},{id:8,type:"benzene",x1:600,y1:210,x2:600,y2:210,label:"",value:""},{id:9,type:"single_bond",x1:600,y1:180,x2:600,y2:120,label:"",value:""},{id:10,type:"atom",x1:600,y1:105,x2:600,y2:105,label:"Cl",value:""},{id:11,type:"text",x1:690,y1:210,x2:690,y2:210,label:"+",value:""},{id:12,type:"atom",x1:750,y1:210,x2:750,y2:210,label:"HCl",value:""}]},xr={name:"Ring conformers",elements:[{id:1,type:"text",x1:400,y1:50,x2:400,y2:50,label:"Six-membered ring: two low-energy chairs",color:"#64748b",fontSize:15},{id:2,type:"cyclohexane",x1:220,y1:240,x2:220,y2:240,label:"",value:""},{id:3,type:"equilibrium_arrow",x1:300,y1:240,x2:420,y2:240,label:"",value:""},{id:4,type:"cyclohexane",x1:520,y1:240,x2:520,y2:240,label:"",value:""},{id:5,type:"text",x1:400,y1:360,x2:400,y2:360,label:"Flip interconverts axial / equatorial substituents",color:"#334155",fontSize:14},{id:6,type:"wedge_bond",x1:220,y1:200,x2:200,y2:170,label:"",value:""},{id:7,type:"atom",x1:188,y1:158,x2:188,y2:158,label:"R",value:""}]},yr={name:"Benzene resonance",elements:[{id:1,type:"text",x1:400,y1:50,x2:400,y2:50,label:"\u03C0 system: two major Kekul\xE9 contributors",color:"#64748b",fontSize:15},{id:2,type:"benzene",x1:200,y1:220,x2:200,y2:220,label:"",value:""},{id:3,type:"resonance_arrow",x1:280,y1:220,x2:360,y2:220,label:"",value:""},{id:4,type:"benzene",x1:440,y1:220,x2:440,y2:220,label:"",value:""},{id:5,type:"double_bond",x1:440,y1:200,x2:470,y2:180,label:"",value:""},{id:6,type:"text",x1:400,y1:340,x2:400,y2:340,label:"Real molecule = hybrid (D\u2086h symmetry)",color:"#334155",fontSize:14}]},to=[dr,xr,yr],eo={name:"Chemistry",elements:to[0].elements,examples:to,toolCategories:[{name:"Chemistry",tools:[{id:"select",name:"Select/Move"},{id:"single_bond",name:"Single Bond"},{id:"double_bond",name:"Double Bond"},{id:"triple_bond",name:"Triple Bond"},{id:"wedge_bond",name:"Wedge (Up)"},{id:"dash_bond",name:"Dash (Down)"}]},{name:"Arrows",tools:[{id:"curved_arrow",name:"Mechanism"},{id:"reaction_arrow",name:"Reaction"},{id:"equilibrium_arrow",name:"Equilibrium"},{id:"resonance_arrow",name:"Resonance"}]},{name:"Rings",tools:[{id:"benzene",name:"Benzene"},{id:"cyclohexane",name:"Cyclohexane"},{id:"cyclopentane",name:"Cyclopentane"},{id:"cyclobutane",name:"Cyclobutane"},{id:"cyclopropane",name:"Cyclopropane"}]},{name:"Symbols",tools:[{id:"atom",name:"Atom/Group"},{id:"charge_plus",name:"Pos. Charge"},{id:"charge_minus",name:"Neg. Charge"},{id:"radical",name:"Radical"},{id:"lone_pair",name:"Lone Pair"},{id:"text",name:"Plain Text"}]}]};var Ct={mechanics:He,circuit:Ye,thermo:Te,magnetism:Be,light:Fe,waveOscillation:Ve,rotation:qe,graph:Je,electrostatics:Ke,chemistry:eo};var Ft=(t,e=20)=>Math.round(t/e)*e,C=(t,e,o,n)=>Math.hypot(o-t,n-e),L=(t,e,o,n)=>Math.atan2(n-e,o-t)*180/Math.PI,et=(t,e,o,n)=>{let r=Math.min(t,o),i=Math.min(e,n),l=Math.max(t,o),a=Math.max(e,n);return {minX:r,minY:i,maxX:l,maxY:a,width:Math.max(1,l-r),height:Math.max(1,a-i)}};function oe(t,e,o,n){let r=C(t,e,o,n);if(r>=1)return r;let i=et(t,e,o,n);return Math.max(12,i.width,i.height)}var re=(t,e)=>{let o=t.getScreenCTM();return o?{x:(e.clientX-o.e)/o.a,y:(e.clientY-o.f)/o.d}:{x:0,y:0}};function Jt(t,e,o,n,r,i=18){let l=C(t,e,o,n),a=Math.atan2(n-e,o-t),c=l/2,d=-r*2,y=t+c*Math.cos(a)-d*Math.sin(a),h=e+c*Math.sin(a)+d*Math.cos(a),f=[t,o,y],$=[e,n,h],w=Math.min(...f),W=Math.min(...$),P=Math.max(...f),Q=Math.max(...$);return hr(w,W,P,Q,i)}function hr(t,e,o,n,r){return {x:t-r,y:e-r,width:o-t+2*r,height:n-e+2*r}}var oo=new Map,x=(t,e)=>{oo.set(t,e);},$e=t=>oo.get(t);var io="#2563eb",ro="#ef4444",no="#10b981",mr="#3b82f6";function Dt(t,e,o,n){return jsx("rect",{x:t,y:e,width:o,height:n,fill:"none",stroke:io,strokeWidth:1,strokeDasharray:"4 4",pointerEvents:"none"})}function pr(t,e=15,o=20){let n=et(t.x1,t.y1,t.x2,t.y2);return Dt(n.minX-e,n.minY-o,n.width+2*e,n.height+2*o)}function fr(t,e=24){return jsx("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:"transparent",strokeWidth:e,strokeLinecap:"round"})}function Nt(t,e){return !e.isSelected||e.viewMode||e.isGhost||!e.onHandlePointerDown?null:jsxs(Fragment,{children:[jsx("circle",{cx:t.x1,cy:t.y1,r:5,fill:ro,cursor:"grab",onMouseDown:o=>e.onHandlePointerDown(o,"start")}),jsx("circle",{cx:t.x2,cy:t.y2,r:5,fill:ro,cursor:"grab",onMouseDown:o=>e.onHandlePointerDown(o,"end")})]})}function k({el:t,ctx:e,padX:o=15,padY:n=20,hitWidth:r=24}){return jsxs(Fragment,{children:[fr(t,r),e.isSelected&&!e.viewMode&&!e.isGhost?pr(t,o,n):null,Nt(t,e)]})}function q({dPath:t,strokeWidth:e=24,strokeLinecap:o="round",strokeLinejoin:n}){return jsx("path",{d:t,fill:"none",stroke:"transparent",strokeWidth:e,strokeLinecap:o,strokeLinejoin:n})}function I({ctx:t,hitHalfSize:e,selectionHalfSize:o,children:n}){let r=o??e+10;return jsxs(Fragment,{children:[t.isSelected&&!t.viewMode&&!t.isGhost?jsx("rect",{x:-r,y:-r,width:2*r,height:2*r,fill:"none",stroke:io,strokeWidth:1,strokeDasharray:"4 4",pointerEvents:"none"}):null,jsx("rect",{x:-e,y:-e,width:2*e,height:2*e,fill:"transparent"}),n]})}function V(t,e,o,n,r,i=10){return !r.isSelected||r.viewMode||r.isGhost?null:Dt(t-i,e-i,o+2*i,n+2*i)}function jt({minX:t,minY:e,width:o,height:n,ctx:r,inset:i=10,includeHitFill:l=true}){return jsxs(Fragment,{children:[l?jsx("rect",{x:t,y:e,width:o,height:n,fill:"transparent"}):null,V(t,e,o,n,r,i)]})}function so({x1:t,y1:e,x2:o,y2:n,cp0:r,ctx:i,pts:l,pad:a=10}){if(!(i.isSelected&&!i.viewMode&&!i.isGhost&&i.onHandlePointerDown))return null;let d=Math.min(...l.map($=>$.x)),y=Math.max(...l.map($=>$.x)),h=Math.min(...l.map($=>$.y)),f=Math.max(...l.map($=>$.y));return jsxs(Fragment,{children:[Dt(d-a,h-a,y-d+2*a,f-h+2*a),jsx("polyline",{points:l.map($=>`${$.x},${$.y}`).join(" "),fill:"none",stroke:"#94a3b8",strokeDasharray:"4 4",strokeWidth:1,pointerEvents:"none"}),jsx("circle",{cx:t,cy:e,r:6,fill:no,cursor:"grab",onMouseDown:$=>i.onHandlePointerDown($,"start")}),jsx("circle",{cx:o,cy:n,r:6,fill:no,cursor:"grab",onMouseDown:$=>i.onHandlePointerDown($,"end")}),jsx("circle",{cx:r.x,cy:r.y,r:6,fill:mr,cursor:"grab",onMouseDown:$=>i.onHandlePointerDown($,"cp",0)})]})}var Et=t=>t.color||"#0f172a",ao=t=>t.strokeWidth||2,he=t=>t.fontSize||16;x("point",(t,e)=>jsx("g",{transform:`translate(${t.x1}, ${t.y1})`,children:jsxs(I,{ctx:e,hitHalfSize:28,selectionHalfSize:32,children:[jsx("circle",{cx:"0",cy:"0",r:3,fill:Et(t)}),t.label?jsx("text",{x:"8",y:"-8",fontSize:he(t),fill:Et(t),children:String(t.label)}):null]})}));x("text",(t,e)=>jsx("g",{transform:`translate(${t.x1}, ${t.y1})`,children:jsx(I,{ctx:e,hitHalfSize:Math.max(40,(t.label||t.value||"").length*4),selectionHalfSize:void 0,children:jsx("text",{x:0,y:0,dominantBaseline:"central",textAnchor:"middle",fill:Et(t),fontSize:he(t),fontFamily:t.fontFamily||"serif",fontWeight:t.fontWeight||"normal",children:String(t.label||t.value||"")})})}));var Ut=(t,e,o=false)=>{let n=C(t.x1,t.y1,t.x2,t.y2),r=L(t.x1,t.y1,t.x2,t.y2),i=t.lineStyle==="dashed"||t.type==="dashed"||t.type==="dashed_line"?"6 6":t.lineStyle==="dotted"?"2 4":void 0;return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${r})`,children:[jsx("line",{x1:0,y1:0,x2:n,y2:0,stroke:Et(t),strokeWidth:ao(t),strokeDasharray:i,strokeLinecap:"round"}),o?jsx("polygon",{points:`${n},0 ${n-12},-6 ${n-12},6`,fill:Et(t)}):null,t.label?jsx("text",{x:n/2,y:-10,fontSize:he(t),fill:Et(t),textAnchor:"middle",children:String(t.label)}):null]}),jsx(k,{el:t,ctx:e})]})};x("line",(t,e)=>Ut(t,e));x("dashed",(t,e)=>Ut({...t,lineStyle:"dashed"},e));x("dashed_line",(t,e)=>Ut({...t,lineStyle:"dashed"},e));x("vector",(t,e)=>Ut(t,e,true));x("ray",(t,e)=>Ut(t,e,true));x("wire",(t,e)=>Ut(t,e));x("table_edge",(t,e)=>{let o=Math.min(t.x1,t.x2),n=Math.max(t.x1,t.x2),r=Math.min(t.y1,t.y2),i=Math.max(t.y1,t.y2),l=Math.max(1,n-o),a=Math.max(1,i-r),c=[],d=Math.max(2,Math.floor(l/12)),y=Math.max(2,Math.floor(a/12));for(let h=0;h<=d;h++){let f=o+h/d*l;c.push(jsx("line",{x1:f,y1:r,x2:f-8,y2:r+10,stroke:Et(t),strokeWidth:1},`h-${h}`));}for(let h=0;h<=y;h++){let f=r+h/y*a;c.push(jsx("line",{x1:n,y1:f,x2:n-10,y2:f+8,stroke:Et(t),strokeWidth:1},`v-${h}`));}return jsxs("g",{children:[jsx("polyline",{points:`${o},${r} ${n},${r} ${n},${i}`,fill:"none",stroke:Et(t),strokeWidth:ao(t)}),c,t.label?jsx("text",{x:o+l/2,y:r-10,fill:Et(t),textAnchor:"middle",fontSize:he(t),children:String(t.label)}):null,jsx(jt,{minX:o,minY:r,width:l,height:a,ctx:e,inset:12}),Nt(t,e)]})});var g=t=>t.color||"#0f172a",R=t=>t.strokeWidth||2,vt=t=>t.fillOpacity??.2,Se=t=>t.fontSize||18,lo=t=>t.rotation||0;x("slab",t=>{let e=et(t.x1,t.y1,t.x2,t.y2),o=t.curveHeight??20;return jsxs("g",{children:[jsx("path",{d:`M ${e.minX} ${e.minY} L ${e.maxX} ${e.minY} L ${e.maxX} ${e.maxY} L ${e.minX} ${e.maxY} Z`,fill:g(t),fillOpacity:vt(t),stroke:g(t),strokeWidth:R(t)}),jsx("path",{d:`M ${e.minX} ${e.minY} L ${e.minX+o} ${e.minY-o} L ${e.maxX+o} ${e.minY-o} L ${e.maxX} ${e.minY} Z`,fill:g(t),fillOpacity:Math.max(0,vt(t)-.1),stroke:g(t),strokeWidth:R(t)}),jsx("path",{d:`M ${e.maxX} ${e.minY} L ${e.maxX+o} ${e.minY-o} L ${e.maxX+o} ${e.maxY-o} L ${e.maxX} ${e.maxY} Z`,fill:g(t),fillOpacity:Math.min(1,vt(t)+.1),stroke:g(t),strokeWidth:R(t)})]})});x("sphere",t=>{let e=Math.max(4,C(t.x1,t.y1,t.x2,t.y2));return jsx("circle",{cx:t.x1,cy:t.y1,r:e,fill:g(t),fillOpacity:vt(t),stroke:g(t),strokeWidth:R(t)})});x("shell",t=>{let e=Math.max(10,C(t.x1,t.y1,t.x2,t.y2)),o=t.curveHeight??10,n=Math.max(1,e-o);return jsx("path",{d:`M ${t.x1-e} ${t.y1} A ${e} ${e} 0 1 0 ${t.x1+e} ${t.y1} A ${e} ${e} 0 1 0 ${t.x1-e} ${t.y1} Z M ${t.x1-n} ${t.y1} A ${n} ${n} 0 1 1 ${t.x1+n} ${t.y1} A ${n} ${n} 0 1 1 ${t.x1-n} ${t.y1} Z`,fill:g(t),fillOpacity:vt(t),fillRule:"evenodd",stroke:g(t),strokeWidth:R(t)})});x("cylinder",t=>{let e=C(t.x1,t.y1,t.x2,t.y2),o=L(t.x1,t.y1,t.x2,t.y2),n=t.curveHeight??20;return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${o})`,children:[jsx("path",{d:`M 0 ${-n} L ${e} ${-n} A 10 ${n} 0 0 1 ${e} ${n} L 0 ${n} Z`,fill:g(t),fillOpacity:vt(t)}),jsx("path",{d:`M 0 ${-n} L ${e} ${-n} M 0 ${n} L ${e} ${n}`,fill:"none",stroke:g(t),strokeWidth:R(t)}),jsx("ellipse",{cx:e,cy:0,rx:10,ry:n,fill:g(t),fillOpacity:vt(t),stroke:g(t),strokeWidth:R(t)}),jsx("ellipse",{cx:0,cy:0,rx:10,ry:n,fill:"none",stroke:g(t),strokeWidth:R(t),strokeDasharray:"2 4"})]})});x("ladder",t=>{let e=C(t.x1,t.y1,t.x2,t.y2),o=L(t.x1,t.y1,t.x2,t.y2),n=t.curveHeight??10,r=[];for(let i=15;i<e-10;i+=15)r.push(jsx("line",{x1:i,y1:-n,x2:i,y2:n,stroke:g(t),strokeWidth:Math.max(1,R(t)-1)},i));return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${o})`,children:[jsx("line",{x1:0,y1:-n,x2:e,y2:-n,stroke:g(t),strokeWidth:R(t)}),jsx("line",{x1:0,y1:n,x2:e,y2:n,stroke:g(t),strokeWidth:R(t)}),r]})});x("spring",t=>{let e=C(t.x1,t.y1,t.x2,t.y2),o=L(t.x1,t.y1,t.x2,t.y2),n=Math.max(0,Math.floor(e/12)),r="M 0 0";for(let i=0;i<n;i++)r+=` L ${i*12+3} 8 L ${i*12+9} -8`;return r+=` L ${e} 0`,jsx("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${o})`,children:jsx("path",{d:r,fill:"none",stroke:g(t),strokeWidth:R(t),strokeLinejoin:"round"})})});x("rod",t=>{let e=C(t.x1,t.y1,t.x2,t.y2),o=L(t.x1,t.y1,t.x2,t.y2);return jsx("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${o})`,children:jsx("line",{x1:0,y1:0,x2:e,y2:0,stroke:g(t),strokeWidth:Math.max(4,R(t)),strokeLinecap:"round"})})});x("arc_arrow",t=>{let e=Math.max(8,C(t.x1,t.y1,t.x2,t.y2));return jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("path",{d:`M ${e} 0 A ${e} ${e} 0 0 0 ${-e} 0`,fill:"none",stroke:g(t),strokeWidth:R(t)}),jsx("polygon",{points:`${-e},2 ${-e-6},-10 ${-e+6},-10`,fill:g(t)})]})});x("lens_convex",(t,e)=>{let o=oe(t.x1,t.y1,t.x2,t.y2),n=L(t.x1,t.y1,t.x2,t.y2),r=t.curveHeight!==void 0?Number(t.curveHeight):o*.15,i=t.fontSize||16,l=`M 0 0 Q ${o/2} ${-r*2} ${o} 0 Q ${o/2} ${r*2} 0 0 Z`,a=Math.ceil(2*r)+Math.ceil(i+14);return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${n})`,children:[jsx("path",{d:l,fill:g(t),fillOpacity:Math.max(.15,vt(t)),stroke:g(t),strokeWidth:R(t)}),t.label?jsx("text",{x:o/2,y:-r-10,fontSize:i,fill:g(t),textAnchor:"middle",children:String(t.label)}):null,jsx(q,{dPath:l,strokeWidth:28,strokeLinejoin:"round"})]}),jsx(k,{el:t,ctx:e,padX:15+a,padY:20+a})]})});x("lens_concave",(t,e)=>{let o=oe(t.x1,t.y1,t.x2,t.y2),n=L(t.x1,t.y1,t.x2,t.y2),r=t.curveHeight!==void 0?Number(t.curveHeight):Math.max(10,o*.04),i=Math.max(15,o*.05),l=t.fontSize||16,a=`M 0 ${-i} L 0 ${i} Q ${o/2} ${i-r*2} ${o} ${i} L ${o} ${-i} Q ${o/2} ${-i+r*2} 0 ${-i} Z`,c=Math.ceil(i+2*r)+Math.ceil(l+14);return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${n})`,children:[jsx("path",{d:a,fill:g(t),fillOpacity:Math.max(.15,vt(t)),stroke:g(t),strokeWidth:R(t)}),t.label?jsx("text",{x:o/2,y:-i-10,fontSize:l,fill:g(t),textAnchor:"middle",children:String(t.label)}):null,jsx(q,{dPath:a,strokeWidth:28,strokeLinejoin:"round"})]}),jsx(k,{el:t,ctx:e,padX:15+c,padY:20+c})]})});x("mirror_concave",(t,e)=>{let o=oe(t.x1,t.y1,t.x2,t.y2),n=L(t.x1,t.y1,t.x2,t.y2),r=t.curveHeight!==void 0?Number(t.curveHeight):o*.2,i=t.fontSize||16,l=`M 0 0 Q ${o/2} ${r*2} ${o} 0`,a=Math.ceil(2*r)+24;return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${n})`,children:[jsx("path",{d:l,fill:"none",stroke:g(t),strokeWidth:R(t)}),t.label?jsx("text",{x:o/2,y:-15,fontSize:i,fill:g(t),textAnchor:"middle",children:String(t.label)}):null,jsx(q,{dPath:l,strokeWidth:28,strokeLinecap:"round"})]}),jsx(k,{el:t,ctx:e,padX:15+a,padY:20+a})]})});x("mirror_convex",(t,e)=>{let o=oe(t.x1,t.y1,t.x2,t.y2),n=L(t.x1,t.y1,t.x2,t.y2),r=t.curveHeight!==void 0?Number(t.curveHeight):o*.2,i=t.fontSize||16,l=`M 0 0 Q ${o/2} ${-r*2} ${o} 0`,a=Math.ceil(2*r)+24;return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${n})`,children:[jsx("path",{d:l,fill:"none",stroke:g(t),strokeWidth:R(t)}),t.label?jsx("text",{x:o/2,y:-15,fontSize:i,fill:g(t),textAnchor:"middle",children:String(t.label)}):null,jsx(q,{dPath:l,strokeWidth:28,strokeLinecap:"round"})]}),jsx(k,{el:t,ctx:e,padX:15+a,padY:20+a})]})});x("prism",t=>{let e=C(t.x1,t.y1,t.x2,t.y2),o=L(t.x1,t.y1,t.x2,t.y2),n=-e*.866,r=t.fontSize||16;return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${o})`,children:[jsx("polygon",{points:`0,0 ${e},0 ${e/2},${n}`,fill:g(t),fillOpacity:Math.max(.15,vt(t)),stroke:g(t),strokeWidth:R(t),strokeLinejoin:"round"}),t.label&&jsx("text",{x:e/2,y:n-10,fontSize:r,fill:g(t),textAnchor:"middle",children:String(t.label)})]})});x("slit_single",t=>{let e=C(t.x1,t.y1,t.x2,t.y2),o=L(t.x1,t.y1,t.x2,t.y2),n=16,r=Math.max(4,R(t)),i=t.fontSize||16;return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${o})`,children:[jsx("line",{x1:0,y1:0,x2:e/2-n/2,y2:0,stroke:g(t),strokeWidth:r,strokeLinecap:"square"}),jsx("line",{x1:e/2+n/2,y1:0,x2:e,y2:0,stroke:g(t),strokeWidth:r,strokeLinecap:"square"}),t.label&&jsx("text",{x:e/2,y:-14,fontSize:i,fill:g(t),textAnchor:"middle",children:String(t.label)})]})});x("slit_double",t=>{let e=et(t.x1,t.y1,t.x2,t.y2),o=e.minX+e.width/2;return jsxs("g",{children:[jsx("line",{x1:o-6,y1:e.minY,x2:o-6,y2:e.maxY,stroke:g(t),strokeWidth:R(t)}),jsx("line",{x1:o+6,y1:e.minY,x2:o+6,y2:e.maxY,stroke:g(t),strokeWidth:R(t)})]})});x("photon",t=>{let e=C(t.x1,t.y1,t.x2,t.y2),o=L(t.x1,t.y1,t.x2,t.y2),n=6,r=Math.max(3,Math.floor(e/24)),i=e/(r*2),l="M 0 0 ";for(let a=0;a<r*2;a++){let c=(a+1)*i,d=a%2===0?-n:n;l+=`L ${c} ${d} `;}return l+=`L ${e} 0`,jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${o})`,children:[jsx("path",{d:l,fill:"none",stroke:g(t),strokeWidth:R(t)}),t.label&&jsx("text",{x:e/2,y:-12,textAnchor:"middle",fill:g(t),children:String(t.label)})]})});x("glass_slab",t=>{let e=et(t.x1,t.y1,t.x2,t.y2);return jsx("rect",{x:e.minX,y:e.minY,width:e.width,height:e.height,fill:g(t),fillOpacity:Math.max(.1,vt(t)),stroke:g(t),strokeWidth:R(t)})});x("pipe",t=>{let e=et(t.x1,t.y1,t.x2,t.y2),o=t.curveHeight??e.height*.35;return jsx("path",{d:`M ${e.minX} ${e.minY} C ${e.minX+e.width*.3} ${e.minY}, ${e.minX+e.width*.3} ${e.minY+o}, ${e.minX+e.width*.5} ${e.minY+o} C ${e.minX+e.width*.7} ${e.minY+o}, ${e.minX+e.width*.7} ${e.minY}, ${e.maxX} ${e.minY} L ${e.maxX} ${e.maxY} C ${e.minX+e.width*.7} ${e.maxY}, ${e.minX+e.width*.7} ${e.maxY-o}, ${e.minX+e.width*.5} ${e.maxY-o} C ${e.minX+e.width*.3} ${e.maxY-o}, ${e.minX+e.width*.3} ${e.maxY}, ${e.minX} ${e.maxY} Z`,fill:g(t),fillOpacity:vt(t),stroke:g(t),strokeWidth:R(t)})});x("liquid",t=>{let e=et(t.x1,t.y1,t.x2,t.y2);return jsxs("g",{children:[jsx("path",{d:`M ${e.minX} ${e.minY} Q ${e.minX+e.width/2} ${e.minY+10} ${e.maxX} ${e.minY} L ${e.maxX} ${e.maxY} L ${e.minX} ${e.maxY} Z`,fill:g(t),fillOpacity:Math.max(.2,vt(t))}),jsx("path",{d:`M ${e.minX} ${e.minY} Q ${e.minX+e.width/2} ${e.minY+10} ${e.maxX} ${e.minY}`,fill:"none",stroke:g(t),strokeWidth:2})]})});x("orbit",t=>{let e=et(t.x1,t.y1,t.x2,t.y2);return jsx("ellipse",{cx:e.minX+e.width/2,cy:e.minY+e.height/2,rx:e.width/2,ry:e.height/2,fill:"none",stroke:g(t),strokeWidth:R(t),strokeDasharray:"3 3"})});x("pole_piece",(t,e)=>{let o=et(t.x1,t.y1,t.x2,t.y2),n=String(t.label||"N"),i=n.toUpperCase().includes("N")?"#ef4444":"#3b82f6",l=Math.min(o.width,o.height)*.5+10;return jsxs("g",{children:[jsx("rect",{x:o.minX,y:o.minY,width:o.width,height:o.height,fill:i,fillOpacity:.2,stroke:g(t),strokeWidth:R(t),rx:"4"}),jsx("text",{x:o.minX+o.width/2,y:o.minY+o.height/2,textAnchor:"middle",dominantBaseline:"central",fill:g(t),fontWeight:"bold",fontSize:l,children:n}),V(o.minX,o.minY,o.width,o.height,e)]})});x("b_field_line",(t,e)=>{let o=C(t.x1,t.y1,t.x2,t.y2),n=L(t.x1,t.y1,t.x2,t.y2),r=t.fontSize||18,i=o/2;return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${n})`,children:[jsx("line",{x1:0,y1:0,x2:o,y2:0,stroke:g(t),strokeWidth:R(t),strokeLinecap:"round"}),jsx("polygon",{points:`${i+6},0 ${i-6},-5 ${i-6},5`,fill:g(t)}),t.label?jsx("text",{x:i,y:-10,textAnchor:"middle",fill:g(t),fontSize:r,children:String(t.label)}):null]}),jsx(k,{el:t,ctx:e})]})});x("b_field_curve",(t,e)=>{let o=C(t.x1,t.y1,t.x2,t.y2),n=L(t.x1,t.y1,t.x2,t.y2),r=t.curveHeight!==void 0?t.curveHeight:o*.4,i=t.fontSize||18,l=-r,a=Jt(t.x1,t.y1,t.x2,t.y2,r),c=`M 0 0 Q ${o/2} ${-r*2} ${o} 0`;return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${n})`,children:[jsx("path",{d:c,fill:"none",stroke:g(t),strokeWidth:R(t),strokeLinecap:"round"}),jsx("polygon",{points:`${o/2+6},${l} ${o/2-6},${l-5} ${o/2-6},${l+5}`,fill:g(t)}),t.label?jsx("text",{x:o/2,y:l-15,textAnchor:"middle",fill:g(t),fontSize:i,children:String(t.label)}):null,jsx(q,{dPath:c,strokeWidth:24,strokeLinecap:"round"})]}),e.isSelected&&!e.viewMode&&!e.isGhost?Dt(a.x,a.y,a.width,a.height):null,Nt(t,e)]})});x("axes_3d",t=>jsxs("g",{children:[jsx("line",{x1:t.x1,y1:t.y1,x2:t.x1+100,y2:t.y1,stroke:g(t),strokeWidth:R(t)}),jsx("line",{x1:t.x1,y1:t.y1,x2:t.x1,y2:t.y1-100,stroke:g(t),strokeWidth:R(t)}),jsx("line",{x1:t.x1,y1:t.y1,x2:t.x1+70,y2:t.y1+50,stroke:g(t),strokeWidth:R(t)})]}));x("string",(t,e)=>{let o=C(t.x1,t.y1,t.x2,t.y2),n=L(t.x1,t.y1,t.x2,t.y2);return jsxs("g",{children:[jsx("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${n})`,children:jsx("line",{x1:0,y1:0,x2:o,y2:0,stroke:g(t),strokeWidth:R(t),strokeLinecap:"round"})}),jsx(k,{el:t,ctx:e})]})});x("surface",(t,e)=>{let o=C(t.x1,t.y1,t.x2,t.y2),n=L(t.x1,t.y1,t.x2,t.y2),r=Math.max(0,Math.floor(o/12)),i=[];for(let l=0;l<=r;l++)i.push(jsx("line",{x1:l*12,y1:0,x2:l*12-8,y2:12,stroke:g(t),strokeWidth:1.5},l));return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${n})`,children:[jsx("line",{x1:0,y1:0,x2:o,y2:0,stroke:g(t),strokeWidth:R(t)+.5,strokeLinecap:"round"}),i]}),jsx(k,{el:t,ctx:e})]})});x("block",(t,e)=>{let o=Math.abs(t.x2-t.x1),n=Math.abs(t.y2-t.y1),r=(t.x1+t.x2)/2,i=(t.y1+t.y2)/2,l=lo(t),a=et(t.x1,t.y1,t.x2,t.y2);return jsxs("g",{children:[jsxs("g",{transform:`translate(${r}, ${i}) rotate(${l})`,children:[jsx("rect",{x:-o/2,y:-n/2,width:o,height:n,fill:"#f1f5f9",stroke:g(t),strokeWidth:R(t)}),t.label?jsx("text",{x:0,y:t.value?-6:0,dominantBaseline:"central",textAnchor:"middle",fill:g(t),fontSize:18,fontFamily:"serif",fontWeight:"bold",children:String(t.label)}):null,t.value?jsx("text",{x:0,y:t.label?10:0,dominantBaseline:"central",textAnchor:"middle",fill:"#4b5563",fontSize:14,fontFamily:"sans-serif",children:String(t.value)}):null]}),V(a.minX,a.minY,a.width,a.height,e),jsx(k,{el:t,ctx:e})]})});x("cart",(t,e)=>{let o=Math.abs(t.x2-t.x1),n=Math.abs(t.y2-t.y1),r=(t.x1+t.x2)/2,i=(t.y1+t.y2)/2,l=lo(t),a=Math.min(o*.15,n*.25,12),c=et(t.x1,t.y1,t.x2,t.y2);return jsxs("g",{children:[jsxs("g",{transform:`translate(${r}, ${i}) rotate(${l})`,children:[jsx("rect",{x:-o/2,y:-n/2,width:o,height:n-a,fill:"#f1f5f9",stroke:g(t),strokeWidth:R(t)}),jsx("circle",{cx:-o/2+a*1.5,cy:n/2-a,r:a,fill:"#cbd5e1",stroke:g(t),strokeWidth:R(t)}),jsx("circle",{cx:o/2-a*1.5,cy:n/2-a,r:a,fill:"#cbd5e1",stroke:g(t),strokeWidth:R(t)}),t.label?jsx("text",{x:0,y:t.value?-8:-2,dominantBaseline:"central",textAnchor:"middle",fill:g(t),fontSize:18,fontFamily:"serif",fontWeight:"bold",children:String(t.label)}):null,t.value?jsx("text",{x:0,y:t.label?8:-2,dominantBaseline:"central",textAnchor:"middle",fill:"#4b5563",fontSize:14,fontFamily:"sans-serif",children:String(t.value)}):null]}),V(c.minX,c.minY,c.width,c.height,e),jsx(k,{el:t,ctx:e})]})});x("particle",(t,e)=>{let o=C(t.x1,t.y1,t.x2,t.y2),n=Math.max(5,o);return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("circle",{cx:0,cy:0,r:n,fill:g(t)}),t.label?jsx("text",{x:0,y:-n-12,dominantBaseline:"central",textAnchor:"middle",fill:g(t),fontSize:Se(t),fontFamily:"serif",fontWeight:"bold",children:String(t.label)}):null,t.value?jsx("text",{x:0,y:n+12,dominantBaseline:"central",textAnchor:"middle",fill:"#4b5563",fontSize:14,fontFamily:"sans-serif",children:String(t.value)}):null]}),jsx(k,{el:t,ctx:e})]})});x("disk",(t,e)=>{let o=C(t.x1,t.y1,t.x2,t.y2),n=Math.max(10,o);return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("circle",{cx:0,cy:0,r:n,fill:"#e2e8f0",stroke:g(t),strokeWidth:R(t)}),jsx("line",{x1:0,y1:0,x2:n,y2:0,stroke:g(t),strokeWidth:R(t)}),jsx("circle",{cx:0,cy:0,r:3,fill:g(t)}),t.label?jsx("text",{x:0,y:-n-12,dominantBaseline:"central",textAnchor:"middle",fill:g(t),fontSize:Se(t),fontFamily:"serif",fontWeight:"bold",children:String(t.label)}):null,t.value?jsx("text",{x:0,y:n+12,dominantBaseline:"central",textAnchor:"middle",fill:"#4b5563",fontSize:14,fontFamily:"sans-serif",children:String(t.value)}):null]}),jsx(k,{el:t,ctx:e})]})});x("com",(t,e)=>jsx("g",{transform:`translate(${t.x1}, ${t.y1})`,children:jsxs(I,{ctx:e,hitHalfSize:22,selectionHalfSize:28,children:[jsx("circle",{cx:0,cy:0,r:10,fill:"none",stroke:g(t),strokeWidth:R(t)}),jsx("path",{d:"M 0 -10 A 10 10 0 0 1 10 0 L 0 0 Z",fill:g(t)}),jsx("path",{d:"M 0 10 A 10 10 0 0 1 -10 0 L 0 0 Z",fill:g(t)})]})}));x("pivot",(t,e)=>jsx("g",{transform:`translate(${t.x1}, ${t.y1})`,children:jsxs(I,{ctx:e,hitHalfSize:24,selectionHalfSize:32,children:[jsx("polygon",{points:"0,0 -12,20 12,20",fill:"#f8fafc",stroke:g(t),strokeWidth:R(t),strokeLinejoin:"round"}),jsx("line",{x1:-20,y1:20,x2:20,y2:20,stroke:g(t),strokeWidth:R(t),strokeLinecap:"round"}),jsx("circle",{cx:0,cy:0,r:3,fill:g(t)})]})}));x("pulley",(t,e)=>{let o=C(t.x1,t.y1,t.x2,t.y2),n=Math.max(10,o);return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("circle",{cx:0,cy:0,r:n,fill:"#f8fafc",stroke:g(t),strokeWidth:R(t)}),jsx("circle",{cx:0,cy:0,r:4,fill:g(t)}),t.label?jsx("text",{x:0,y:-n-12,dominantBaseline:"central",textAnchor:"middle",fill:g(t),fontSize:Se(t),fontFamily:"serif",fontWeight:"bold",children:String(t.label)}):null]}),jsx(k,{el:t,ctx:e})]})});x("wedge",t=>{let e=t.x2-t.x1,o=t.y2-t.y1;return jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("polygon",{points:`0,0 ${e},0 ${e},${o}`,fill:"#f1f5f9",stroke:g(t),strokeWidth:R(t),strokeLinejoin:"round"}),t.label?jsx("text",{x:e*.6,y:o*.3,dominantBaseline:"central",textAnchor:"middle",fill:g(t),fontSize:20,fontFamily:"serif",fontWeight:"bold",children:String(t.label)}):null]})});x("dimension",t=>{let e=C(t.x1,t.y1,t.x2,t.y2),o=L(t.x1,t.y1,t.x2,t.y2),n=Math.max(1,R(t)-.5);return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${o})`,children:[jsx("line",{x1:0,y1:0,x2:e,y2:0,stroke:g(t),strokeWidth:n,strokeDasharray:"4 4"}),jsx("polygon",{points:"0,0 10,-5 10,5",fill:g(t)}),jsx("polygon",{points:`${e},0 ${e-10},-5 ${e-10},5`,fill:g(t)}),t.label?jsx("text",{x:e/2,y:-10,textAnchor:"middle",fill:g(t),fontSize:18,fontFamily:"serif",fontStyle:"italic",fontWeight:"bold",children:String(t.label)}):null]})});x("arc",t=>{let e=t.x2-t.x1,o=t.y2-t.y1,n=Math.hypot(e,o),r=Math.atan2(o,e)*180/Math.PI,i=Math.min(n,40),l=o>0?1:0,a=i,c=0,d=i*Math.cos(r*Math.PI/180),y=i*Math.sin(r*Math.PI/180),h=r/2,f=i+15,$=f*Math.cos(h*Math.PI/180),w=f*Math.sin(h*Math.PI/180),W=Math.max(n,50);return jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("line",{x1:0,y1:0,x2:W,y2:0,stroke:g(t),strokeWidth:1.5,strokeDasharray:"4 4"}),jsx("path",{d:`M ${a} ${c} A ${i} ${i} 0 0 ${l} ${d} ${y}`,fill:"none",stroke:g(t),strokeWidth:R(t)}),t.label?jsx("text",{x:$,y:w,dominantBaseline:"central",textAnchor:"middle",fill:g(t),fontSize:16,fontFamily:"serif",fontStyle:"italic",fontWeight:"bold",children:String(t.label)}):null]})});x("nucleus",t=>{let e=t.fontSize||18,o=g(t),n=R(t);return jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("ellipse",{cx:0,cy:0,rx:24,ry:8,fill:"none",stroke:o,strokeWidth:n,transform:"rotate(30)"}),jsx("ellipse",{cx:0,cy:0,rx:24,ry:8,fill:"none",stroke:o,strokeWidth:n,transform:"rotate(-30)"}),jsx("ellipse",{cx:0,cy:0,rx:24,ry:8,fill:"none",stroke:o,strokeWidth:n,transform:"rotate(90)"}),jsx("circle",{cx:0,cy:0,r:6,fill:"#ef4444"}),t.label&&jsx("text",{x:0,y:36,fontSize:e,fill:o,textAnchor:"middle",children:String(t.label)})]})});["cone","curved_wedge","incline","container","hinge"].forEach(t=>x(t,e=>{let o=C(e.x1,e.y1,e.x2,e.y2),n=L(e.x1,e.y1,e.x2,e.y2);return jsx("g",{transform:`translate(${e.x1}, ${e.y1}) rotate(${n})`,children:jsx("line",{x1:0,y1:0,x2:o,y2:0,stroke:g(e),strokeWidth:R(e)})})}));["semicircle","quarter_circle","axes"].forEach(t=>x(t,e=>{let o=et(e.x1,e.y1,e.x2,e.y2);return jsx("rect",{x:o.minX,y:o.minY,width:o.width,height:o.height,fill:"none",stroke:g(e),strokeWidth:R(e)})}));var J=t=>t.color||"#0f172a",Wt=t=>t.strokeWidth||2,Yt=t=>t.fontSize||18,co=t=>t.lineStyle==="dashed"||t.type==="dashed_line"?"6 6":t.lineStyle==="dotted"?"2 4":void 0;x("b_region_in",(t,e)=>{let o=et(t.x1,t.y1,t.x2,t.y2),n=o.minX,r=o.maxX,i=o.minY,l=o.maxY,a=(n+r)/2,c=40,d=6,y=[];for(let h=n+c/2;h<=r;h+=c)for(let f=i+c/2;f<=l;f+=c)y.push(jsxs("g",{transform:`translate(${h}, ${f})`,children:[jsx("circle",{cx:0,cy:0,r:d,fill:"none",stroke:J(t),strokeWidth:Wt(t)*.75}),jsx("line",{x1:-d*.7,y1:-d*.7,x2:d*.7,y2:d*.7,stroke:J(t),strokeWidth:Wt(t)*.75}),jsx("line",{x1:d*.7,y1:-d*.7,x2:-d*.7,y2:d*.7,stroke:J(t),strokeWidth:Wt(t)*.75})]},`${h}-${f}`));return jsxs("g",{children:[jsx("rect",{x:n,y:i,width:o.width,height:o.height,fill:J(t),stroke:J(t),strokeWidth:1,strokeDasharray:"4 4",opacity:.1}),y,t.label?jsx("text",{x:a,y:i-10,fontSize:Yt(t),fill:J(t),textAnchor:"middle",fontWeight:"bold",children:String(t.label)}):null,V(n,i,o.width,o.height,e)]})});x("b_region_out",(t,e)=>{let o=et(t.x1,t.y1,t.x2,t.y2),n=o.minX,r=o.maxX,i=o.minY,l=o.maxY,a=(n+r)/2,c=40,d=6,y=[];for(let h=n+c/2;h<=r;h+=c)for(let f=i+c/2;f<=l;f+=c)y.push(jsxs("g",{transform:`translate(${h}, ${f})`,children:[jsx("circle",{cx:0,cy:0,r:d,fill:"none",stroke:J(t),strokeWidth:Wt(t)*.75}),jsx("circle",{cx:0,cy:0,r:2,fill:J(t)})]},`${h}-${f}`));return jsxs("g",{children:[jsx("rect",{x:n,y:i,width:o.width,height:o.height,fill:J(t),stroke:J(t),strokeWidth:1,strokeDasharray:"4 4",opacity:.1}),y,t.label?jsx("text",{x:a,y:i-10,fontSize:Yt(t),fill:J(t),textAnchor:"middle",fontWeight:"bold",children:String(t.label)}):null,V(n,i,o.width,o.height,e)]})});x("current_wire",(t,e)=>{let o=C(t.x1,t.y1,t.x2,t.y2),n=L(t.x1,t.y1,t.x2,t.y2),r=o/2,i=n>90||n<=-90;return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${n})`,children:[jsx("line",{x1:0,y1:0,x2:o,y2:0,stroke:J(t),strokeWidth:Wt(t),strokeDasharray:co(t),strokeLinecap:"round"}),jsx("polygon",{points:`${r+8},0 ${r-6},-7 ${r-6},7`,fill:J(t)}),t.label?jsx("text",{x:r,y:-15,fontSize:Yt(t),fill:J(t),textAnchor:"middle",fontStyle:"italic",transform:i?`rotate(180, ${r}, -15)`:void 0,children:String(t.label)}):null]}),jsx(k,{el:t,ctx:e})]})});x("bar_magnet",(t,e)=>{let o=C(t.x1,t.y1,t.x2,t.y2),n=L(t.x1,t.y1,t.x2,t.y2),r=Math.max(20,Wt(t)*10),i=n>90||n<=-90;return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${n})`,children:[jsx("rect",{x:0,y:-r/2,width:o/2,height:r,fill:"#ef4444",stroke:J(t),strokeWidth:1}),jsx("rect",{x:o/2,y:-r/2,width:o/2,height:r,fill:"#3b82f6",stroke:J(t),strokeWidth:1}),jsx("text",{x:o/4,y:0,fill:"white",fontSize:r*.6,fontWeight:"bold",textAnchor:"middle",dominantBaseline:"central",transform:i?`rotate(180, ${o/4}, 0)`:void 0,children:"N"}),jsx("text",{x:o*.75,y:0,fill:"white",fontSize:r*.6,fontWeight:"bold",textAnchor:"middle",dominantBaseline:"central",transform:i?`rotate(180, ${o*.75}, 0)`:void 0,children:"S"}),t.label?jsx("text",{x:o/2,y:-r/2-10,fill:J(t),fontSize:Yt(t),textAnchor:"middle",transform:i?`rotate(180, ${o/2}, ${-r/2-10})`:void 0,children:String(t.label)}):null]}),jsx(k,{el:t,ctx:e})]})});x("coil",(t,e)=>{let o=C(t.x1,t.y1,t.x2,t.y2),n=L(t.x1,t.y1,t.x2,t.y2),r=Math.max(Math.floor(o/15),1),i="M 0 0 ";for(let a=1;a<=r;a++)i+=`C ${a*(o/r)-o/(r*2)} -15, ${a*(o/r)} 20, ${a*(o/r)} 0 `;let l=n>90||n<=-90;return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${n})`,children:[jsx("path",{d:i,fill:"none",stroke:J(t),strokeWidth:Wt(t),strokeLinejoin:"round"}),t.label?jsx("text",{x:o/2,y:-20,fontSize:Yt(t),fill:J(t),textAnchor:"middle",transform:l?`rotate(180, ${o/2}, -20)`:void 0,children:String(t.label)}):null,jsx(q,{dPath:i,strokeWidth:24,strokeLinejoin:"round"})]}),jsx(k,{el:t,ctx:e})]})});x("meter",(t,e)=>{let o=Math.max(16,Wt(t)*5),n=String(t.label||"G");return jsx("g",{transform:`translate(${t.x1}, ${t.y1})`,children:jsxs(I,{ctx:e,hitHalfSize:20,selectionHalfSize:30,children:[jsx("circle",{cx:0,cy:0,r:o,fill:"white",stroke:J(t),strokeWidth:Wt(t)}),jsx("text",{x:0,y:0,fontSize:Yt(t),fill:J(t),fontWeight:"bold",textAnchor:"middle",dominantBaseline:"central",children:n})]})})});x("ac_source",(t,e)=>{let o=Math.max(16,Wt(t)*5);return jsx("g",{transform:`translate(${t.x1}, ${t.y1})`,children:jsxs(I,{ctx:e,hitHalfSize:22,selectionHalfSize:30,children:[jsx("circle",{cx:0,cy:0,r:o,fill:"white",stroke:J(t),strokeWidth:Wt(t)}),jsx("path",{d:`M ${-o*.6} 0 Q ${-o*.3} ${-o*.6} 0 0 T ${o*.6} 0`,fill:"none",stroke:J(t),strokeWidth:Wt(t)*.8}),t.label?jsx("text",{x:0,y:o+18,fontSize:Yt(t),fill:J(t),textAnchor:"middle",children:String(t.label)}):null]})})});x("bezier",(t,e)=>{let{x1:o,y1:n,x2:r,y2:i}=t,a=(t.cps?.length?t.cps:[{x:(o+r)/2,y:Math.min(n,i)-50}])[0],c=`M ${o} ${n} Q ${a.x} ${a.y} ${r} ${i}`,d=[{x:o,y:n},a,{x:r,y:i}],y=.25*o+.5*a.x+.25*r,h=.25*n+.5*a.y+.25*i,f=Math.atan2(i-n,r-o),$=!!t.showArrow;return jsxs("g",{children:[jsx("path",{d:c,fill:"none",stroke:"transparent",strokeWidth:24,strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:c,fill:"none",stroke:J(t),strokeWidth:Wt(t),strokeDasharray:co(t),strokeLinecap:"round",strokeLinejoin:"round"}),$?jsx("g",{transform:`translate(${y}, ${h}) rotate(${f*180/Math.PI})`,children:jsx("polygon",{points:"6,0 -6,-5 -6,5",fill:J(t)})}):null,t.label?jsx("text",{x:y,y:h-14,fontSize:Yt(t),fill:J(t),textAnchor:"middle",children:String(t.label)}):null,jsx(so,{x1:o,y1:n,x2:r,y2:i,cp0:a,ctx:e,pts:d})]})});var gt=t=>t.color||"#0f172a",bt=t=>t.strokeWidth||2,xo=t=>t.fontSize||16,kt=t=>{if(t.lineStyle==="dashed"||t.type==="dashed_line"||t.type==="dashed")return "6 6";if(t.lineStyle==="dotted")return "2 4"},mt=t=>t?.isGhost?.5:1;x("axes",(t,e)=>{let o=Math.min(t.x1,t.x2),n=Math.max(t.x1,t.x2),r=Math.min(t.y1,t.y2),i=Math.max(t.y1,t.y2),l=(o+n)/2,a=(r+i)/2,c=Math.max(1,n-o),d=Math.max(1,i-r),y=gt(t),h=bt(t),f=kt(t);if(n-o<=1&&i-r<=1){let $=t.x1,w=t.y1,W=40,P=xo(t);return jsx("g",{opacity:mt(e),transform:`translate(${$}, ${w})`,children:jsxs(I,{ctx:e,hitHalfSize:52,selectionHalfSize:58,children:[jsx("line",{x1:0,y1:0,x2:W,y2:0,stroke:y,strokeWidth:h}),jsx("polygon",{points:`${W},0 ${W-8},-5 ${W-8},5`,fill:y}),jsx("text",{x:W+10,y:0,dominantBaseline:"central",textAnchor:"middle",fill:y,fontSize:P,fontFamily:"serif",fontStyle:"italic",children:"x"}),jsx("line",{x1:0,y1:0,x2:0,y2:-W,stroke:y,strokeWidth:h}),jsx("polygon",{points:`0,${-W} -5,${-W+8} 5,${-W+8}`,fill:y}),jsx("text",{x:0,y:-W-12,dominantBaseline:"central",textAnchor:"middle",fill:y,fontSize:P,fontFamily:"serif",fontStyle:"italic",children:"y"}),jsx("circle",{cx:0,cy:0,r:2,fill:y})]})})}return jsxs("g",{opacity:mt(e),children:[jsx("rect",{x:o,y:r,width:c,height:d,fill:"transparent"}),V(o,r,c,d,e),jsxs("g",{pointerEvents:"none",children:[jsx("line",{x1:l,y1:r,x2:l,y2:i,stroke:y,strokeWidth:h,strokeDasharray:f,opacity:.8}),jsx("line",{x1:o,y1:a,x2:n,y2:a,stroke:y,strokeWidth:h,strokeDasharray:f,opacity:.8}),jsx("polygon",{points:`${n},${a} ${n-10},${a-5} ${n-10},${a+5}`,fill:y,opacity:.8}),jsx("polygon",{points:`${l},${r} ${l-5},${r+10} ${l+5},${r+10}`,fill:y,opacity:.8})]}),jsx(k,{el:t,ctx:e})]})});x("circle",(t,e)=>{let o=C(t.x1,t.y1,t.x2,t.y2),n=gt(t),r=bt(t),i=kt(t);return jsxs("g",{opacity:mt(e),children:[jsx("circle",{cx:t.x1,cy:t.y1,r:o,fill:"none",stroke:n,strokeWidth:r,strokeDasharray:i,pointerEvents:"none"}),jsx(k,{el:t,ctx:e})]})});x("ellipse",(t,e)=>{let o=Math.min(t.x1,t.x2),n=Math.max(t.x1,t.x2),r=Math.min(t.y1,t.y2),i=Math.max(t.y1,t.y2),l=(o+n)/2,a=(r+i)/2,c=Math.max(1,n-o),d=Math.max(1,i-r),y=gt(t),h=bt(t),f=kt(t);return jsxs("g",{opacity:mt(e),children:[jsx("rect",{x:o,y:r,width:c,height:d,fill:"transparent"}),V(o,r,c,d,e),jsx("ellipse",{cx:l,cy:a,rx:c/2,ry:d/2,fill:"none",stroke:y,strokeWidth:h,strokeDasharray:f,pointerEvents:"none"}),jsx(k,{el:t,ctx:e})]})});x("rectangle",(t,e)=>{let o=et(t.x1,t.y1,t.x2,t.y2),n=gt(t),r=bt(t),i=kt(t);return jsxs("g",{opacity:mt(e),children:[jsx("rect",{x:o.minX,y:o.minY,width:o.width,height:o.height,fill:"transparent"}),V(o.minX,o.minY,o.width,o.height,e),jsx("rect",{x:o.minX,y:o.minY,width:o.width,height:o.height,fill:"none",stroke:n,strokeWidth:r,strokeDasharray:i,strokeLinejoin:"round",pointerEvents:"none"}),jsx(k,{el:t,ctx:e})]})});x("angle",(t,e)=>{let{x1:o,y1:n,x2:r,y2:i}=t,l=r-o,a=i-n,c=Math.hypot(l,a),d=Math.min(o,r),y=Math.max(o,r),h=Math.min(n,i),f=Math.max(n,i),$=Math.max(1,y-d),w=Math.max(1,f-h),W=gt(t),P=bt(t),Q=kt(t),j=xo(t),F=Math.atan2(a,l),u=Math.min(c*.4,40),yt=(l>=0?1:-1)===1?0:Math.PI,st=F-yt;st=Math.atan2(Math.sin(st),Math.cos(st));let It=yt+st/2,Bt=st>0?1:0,Zt=o+u*Math.cos(yt),Pt=n+u*Math.sin(yt),H=o+u*Math.cos(F),D=n+u*Math.sin(F),O=F*180/Math.PI;return jsxs("g",{opacity:mt(e),children:[jsx("rect",{x:d,y:h,width:$,height:w,fill:"transparent"}),V(d,h,$,w,e),jsxs("g",{pointerEvents:"none",children:[jsx("line",{x1:o,y1:n,x2:o+l,y2:n,stroke:W,strokeWidth:P,strokeDasharray:"4 4",opacity:.6}),jsx("line",{x1:o,y1:n,x2:r,y2:i,stroke:W,strokeWidth:P,strokeLinecap:"round",strokeDasharray:Q}),jsx("g",{transform:`translate(${r}, ${i}) rotate(${O})`,children:jsx("polygon",{points:"0,0 -12,-6 -12,6",fill:W})}),c>20&&jsx("path",{d:`M ${Zt} ${Pt} A ${u} ${u} 0 0 ${Bt} ${H} ${D}`,fill:"none",stroke:W,strokeWidth:P}),t.label&&jsx("text",{x:o+(u+16)*Math.cos(It),y:n+(u+16)*Math.sin(It),fontSize:j,fill:W,fontFamily:"serif",fontStyle:"italic",dominantBaseline:"central",textAnchor:"middle",children:String(t.label)})]}),jsx(k,{el:t,ctx:e})]})});x("parabola_v",(t,e)=>{let o=Math.min(t.x1,t.x2),n=Math.max(t.x1,t.x2),r=Math.min(t.y1,t.y2),i=Math.max(t.y1,t.y2),l=(o+n)/2,a=Math.max(1,n-o),c=Math.max(1,i-r),d=2*t.y1-t.y2,y=gt(t),h=bt(t),f=kt(t);return jsxs("g",{opacity:mt(e),children:[jsx("rect",{x:o,y:r,width:a,height:c,fill:"transparent"}),V(o,r,a,c,e),jsx("path",{d:`M ${o} ${t.y2} Q ${l} ${d} ${n} ${t.y2}`,fill:"none",stroke:y,strokeWidth:h,strokeDasharray:f,pointerEvents:"none"}),jsx(k,{el:t,ctx:e})]})});x("parabola_h",(t,e)=>{let o=Math.min(t.x1,t.x2),n=Math.max(t.x1,t.x2),r=Math.min(t.y1,t.y2),i=Math.max(t.y1,t.y2),l=(r+i)/2,a=Math.max(1,n-o),c=Math.max(1,i-r),d=2*t.x1-t.x2,y=gt(t),h=bt(t),f=kt(t);return jsxs("g",{opacity:mt(e),children:[jsx("rect",{x:o,y:r,width:a,height:c,fill:"transparent"}),V(o,r,a,c,e),jsx("path",{d:`M ${t.x2} ${r} Q ${d} ${l} ${t.x2} ${i}`,fill:"none",stroke:y,strokeWidth:h,strokeDasharray:f,pointerEvents:"none"}),jsx(k,{el:t,ctx:e})]})});x("hyperbola",(t,e)=>{let o=Math.min(t.x1,t.x2),n=Math.max(t.x1,t.x2),r=Math.min(t.y1,t.y2),i=Math.max(t.y1,t.y2),l=(o+n)/2,a=(r+i)/2,c=Math.max(1,n-o),d=Math.max(1,i-r),y=gt(t),h=bt(t),f=kt(t);return jsxs("g",{opacity:mt(e),children:[jsx("rect",{x:o,y:r,width:c,height:d,fill:"transparent"}),V(o,r,c,d,e),jsxs("g",{pointerEvents:"none",children:[jsx("path",{d:`M ${o} ${r} Q ${l} ${a} ${o} ${i}`,fill:"none",stroke:y,strokeWidth:h,strokeDasharray:f}),jsx("path",{d:`M ${n} ${r} Q ${l} ${a} ${n} ${i}`,fill:"none",stroke:y,strokeWidth:h,strokeDasharray:f})]}),jsx(k,{el:t,ctx:e})]})});x("modulus",(t,e)=>{let o=Math.min(t.x1,t.x2),n=Math.max(t.x1,t.x2),r=Math.min(t.y1,t.y2),i=Math.max(t.y1,t.y2),l=(o+n)/2,a=Math.max(1,n-o),c=Math.max(1,i-r),d=gt(t),y=bt(t),h=kt(t);return jsxs("g",{opacity:mt(e),children:[jsx("rect",{x:o,y:r,width:a,height:c,fill:"transparent"}),V(o,r,a,c,e),jsx("polyline",{points:`${o},${r} ${l},${i} ${n},${r}`,fill:"none",stroke:d,strokeWidth:y,strokeLinecap:"round",strokeLinejoin:"round",strokeDasharray:h,pointerEvents:"none"}),jsx(k,{el:t,ctx:e})]})});x("exponential",(t,e)=>{let o=Math.min(t.x1,t.x2),n=Math.max(t.x1,t.x2),r=Math.min(t.y1,t.y2),i=Math.max(t.y1,t.y2),l=(o+n)/2,a=Math.max(1,n-o),c=Math.max(1,i-r),d=gt(t),y=bt(t),h=kt(t);return jsxs("g",{opacity:mt(e),children:[jsx("rect",{x:o,y:r,width:a,height:c,fill:"transparent"}),V(o,r,a,c,e),jsx("path",{d:`M ${o} ${i} Q ${l+a*.2} ${i} ${n} ${r}`,fill:"none",stroke:d,strokeWidth:y,strokeDasharray:h,pointerEvents:"none"}),jsx(k,{el:t,ctx:e})]})});x("logarithmic",(t,e)=>{let o=Math.min(t.x1,t.x2),n=Math.max(t.x1,t.x2),r=Math.min(t.y1,t.y2),i=Math.max(t.y1,t.y2),l=(r+i)/2,a=Math.max(1,n-o),c=Math.max(1,i-r),d=gt(t),y=bt(t),h=kt(t);return jsxs("g",{opacity:mt(e),children:[jsx("rect",{x:o,y:r,width:a,height:c,fill:"transparent"}),V(o,r,a,c,e),jsx("path",{d:`M ${o} ${i} Q ${o} ${l-c*.2} ${n} ${r}`,fill:"none",stroke:d,strokeWidth:y,strokeDasharray:h,pointerEvents:"none"}),jsx(k,{el:t,ctx:e})]})});x("sine_wave",(t,e)=>{let o=Math.min(t.x1,t.x2),n=Math.max(t.x1,t.x2),r=Math.min(t.y1,t.y2),i=Math.max(t.y1,t.y2),l=(r+i)/2,a=Math.max(1,n-o),c=Math.max(1,i-r),d=a/4,y=gt(t),h=bt(t),f=kt(t);return jsxs("g",{opacity:mt(e),children:[jsx("rect",{x:o,y:r,width:a,height:c,fill:"transparent"}),V(o,r,a,c,e),jsx("path",{d:`M ${o} ${l} Q ${o+d/2} ${r}, ${o+d} ${l} T ${o+2*d} ${l} T ${o+3*d} ${l} T ${n} ${l}`,fill:"none",stroke:y,strokeWidth:h,strokeLinecap:"round",strokeLinejoin:"round",strokeDasharray:f,pointerEvents:"none"}),jsx(k,{el:t,ctx:e})]})});x("step_function",(t,e)=>{let o=Math.min(t.x1,t.x2),n=Math.max(t.x1,t.x2),r=Math.min(t.y1,t.y2),i=Math.max(t.y1,t.y2),l=Math.max(1,n-o),a=Math.max(1,i-r),c=gt(t),d=bt(t),y=kt(t),h=4,f=l/h,$=a/h,w=[];for(let W=0;W<h;W++){let P=o+W*f,Q=i-W*$,j=P+f;w.push(jsxs("g",{children:[jsx("line",{x1:P,y1:Q,x2:j,y2:Q,stroke:c,strokeWidth:d,strokeDasharray:y}),jsx("circle",{cx:P,cy:Q,r:d*1.5,fill:c}),jsx("circle",{cx:j,cy:Q,r:d*1.5,fill:"white",stroke:c,strokeWidth:d*.75})]},W));}return jsxs("g",{opacity:mt(e),children:[jsx("rect",{x:o,y:r,width:l,height:a,fill:"transparent"}),V(o,r,l,a,e),jsx("g",{pointerEvents:"none",children:w}),jsx(k,{el:t,ctx:e})]})});x("shaded_area",(t,e)=>{let o=Math.min(t.x1,t.x2),n=Math.max(t.x1,t.x2),r=Math.min(t.y1,t.y2),i=Math.max(t.y1,t.y2),l=(o+n)/2,a=Math.max(1,n-o),c=Math.max(1,i-r),d=gt(t),y=bt(t),h=kt(t);return jsxs("g",{opacity:mt(e),children:[jsx("rect",{x:o,y:r,width:a,height:c,fill:"transparent"}),V(o,r,a,c,e),jsxs("g",{pointerEvents:"none",children:[jsx("path",{d:`M ${o} ${i} L ${o} ${r+c*.3} Q ${l} ${r} ${n} ${r+c*.3} L ${n} ${i} Z`,fill:d,opacity:.2}),jsx("path",{d:`M ${o} ${r+c*.3} Q ${l} ${r} ${n} ${r+c*.3}`,fill:"none",stroke:d,strokeWidth:y,strokeDasharray:h})]}),jsx(k,{el:t,ctx:e})]})});var at=t=>t.color||"#0f172a",ct=t=>t.strokeWidth||2,lt=t=>t.fontSize||18;x("mass_box",(t,e)=>{let o=t.size||30,n=at(t),r=ct(t),i=lt(t),l=Math.max(36,o/2+24);return jsx("g",{transform:`translate(${t.x1}, ${t.y1})`,children:jsxs(I,{ctx:e,hitHalfSize:l,selectionHalfSize:l+8,children:[jsx("rect",{x:-o/2,y:-o/2,width:o,height:o,fill:n,fillOpacity:.2,stroke:n,strokeWidth:r,rx:4,pointerEvents:"none"}),t.label?jsx("text",{x:0,y:0,dominantBaseline:"central",textAnchor:"middle",fontSize:i,fill:n,fontWeight:"bold",pointerEvents:"none",children:String(t.label)}):null]})})});x("tuning_fork",(t,e)=>{let o=at(t),n=ct(t),r=lt(t),i=Math.max(3,n);return jsx("g",{transform:`translate(${t.x1}, ${t.y1})`,children:jsxs(I,{ctx:e,hitHalfSize:38,selectionHalfSize:46,children:[jsx("path",{d:"M -10 -20 L -10 0 Q -10 10 0 10 Q 10 10 10 0 L 10 -20",fill:"none",stroke:o,strokeWidth:i,strokeLinecap:"round",pointerEvents:"none"}),jsx("line",{x1:"0",y1:"10",x2:"0",y2:"30",stroke:o,strokeWidth:Math.max(4,n),strokeLinecap:"round",pointerEvents:"none"}),t.label?jsx("text",{x:0,y:45,fontSize:r,fill:o,textAnchor:"middle",pointerEvents:"none",children:String(t.label)}):null]})})});x("speaker",(t,e)=>{let o=at(t),n=lt(t);return jsx("g",{transform:`translate(${t.x1}, ${t.y1})`,children:jsxs(I,{ctx:e,hitHalfSize:36,selectionHalfSize:44,children:[jsx("polygon",{points:"-10,-15 5,-25 5,25 -10,15",fill:o,pointerEvents:"none"}),jsx("rect",{x:"-20",y:"-15",width:"10",height:"30",fill:o,pointerEvents:"none"}),jsx("path",{d:"M 12 -10 Q 18 0 12 10 M 18 -20 Q 28 0 18 20",fill:"none",stroke:o,strokeWidth:2,strokeLinecap:"round",pointerEvents:"none"}),t.label?jsx("text",{x:0,y:40,fontSize:n,fill:o,textAnchor:"middle",pointerEvents:"none",children:String(t.label)}):null]})})});x("wavefronts",(t,e)=>{let o=t.rings||5,n=t.velocityRatio??0,r=at(t),i=ct(t),l=lt(t),a=[];for(let d=1;d<=o;d++){let y=d*20,h=n*y;a.push(jsx("circle",{cx:h,cy:0,r:y,fill:"none",stroke:r,strokeWidth:i,opacity:1-d/o*.5,pointerEvents:"none"},d));}let c=o*20+Math.abs(n)*o*20+30;return jsx("g",{transform:`translate(${t.x1}, ${t.y1})`,children:jsxs(I,{ctx:e,hitHalfSize:c,selectionHalfSize:c+10,children:[jsx("circle",{cx:0,cy:0,r:4,fill:r,pointerEvents:"none"}),a,t.label?jsx("text",{x:0,y:o*20+20,fontSize:l,fill:r,textAnchor:"middle",pointerEvents:"none",children:String(t.label)}):null]})})});x("pendulum",(t,e)=>{let o=t.size||15,n=at(t),r=ct(t),i=lt(t),l=Math.atan2(t.x2-t.x1,t.y2-t.y1),a=l*(180/Math.PI),c=Math.hypot(t.x2-t.x1,t.y2-t.y1),d=Math.min(40,c*.5),y=Math.sin(l)*d,h=Math.cos(l)*d,f=l>0?0:1,$=t.showForces;return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("line",{x1:-20,y1:0,x2:20,y2:0,stroke:n,strokeWidth:2}),jsx("line",{x1:-15,y1:0,x2:-10,y2:-5,stroke:n}),jsx("line",{x1:0,y1:0,x2:5,y2:-5,stroke:n}),jsx("line",{x1:15,y1:0,x2:20,y2:-5,stroke:n}),jsx("line",{x1:0,y1:0,x2:0,y2:c+20,stroke:n,strokeWidth:1,strokeDasharray:"4 4",opacity:.5}),Math.abs(l)>.05?jsx("path",{d:`M 0 ${d} A ${d} ${d} 0 0 ${f} ${y} ${h}`,fill:"none",stroke:n,strokeWidth:1.5}):null,jsxs("g",{transform:`rotate(${-a})`,children:[jsx("line",{x1:0,y1:0,x2:0,y2:c,stroke:n,strokeWidth:r}),jsx("circle",{cx:0,cy:c,r:o,fill:n,stroke:"#fff",strokeWidth:2}),$?jsxs("g",{transform:`translate(0, ${c})`,children:[jsxs("g",{transform:`rotate(${a})`,children:[jsx("line",{x1:0,y1:0,x2:0,y2:40,stroke:"#ef4444",strokeWidth:2}),jsx("polygon",{points:"0,45 -4,37 4,37",fill:"#ef4444"}),jsx("text",{x:10,y:40,fontSize:12,fill:"#ef4444",children:"F_g"})]}),jsx("line",{x1:0,y1:0,x2:0,y2:-40,stroke:"#3b82f6",strokeWidth:2}),jsx("polygon",{points:"0,-45 -4,-37 4,-37",fill:"#3b82f6"}),jsx("text",{x:10,y:-35,fontSize:12,fill:"#3b82f6",children:"T"}),jsx("line",{x1:0,y1:0,x2:-35*Math.sin(l),y2:0,stroke:"#10b981",strokeWidth:2}),jsx("polygon",{points:`${ -40*Math.sin(l)},0 ${ -32*Math.sin(l)},-4 ${ -32*Math.sin(l)},4`,fill:"#10b981"}),jsx("text",{x:-45*Math.sin(l),y:-10,fontSize:12,fill:"#10b981",children:"F_g sin(\u03B8)"})]}):null,t.label?jsx("text",{x:0,y:c+o+15,fontSize:i,fill:n,textAnchor:"middle",children:String(t.label)}):null]})]}),jsx(k,{el:t,ctx:e,padX:Math.max(80,c+o+30),padY:Math.max(80,c+o+30)})]})});x("phasor",(t,e)=>{let o=C(t.x1,t.y1,t.x2,t.y2),n=L(t.x1,t.y1,t.x2,t.y2),r=t.x2-t.x1,i=t.y2-t.y1,l=at(t),a=ct(t),c=lt(t),d=t.showProjection;return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${n})`,children:[jsx("circle",{cx:0,cy:0,r:o,fill:"none",stroke:l,strokeWidth:1,strokeDasharray:"4 4",opacity:.5,pointerEvents:"none"}),jsx("line",{x1:-o-10,y1:0,x2:o+10,y2:0,stroke:l,strokeWidth:1,opacity:.3,pointerEvents:"none"}),jsx("line",{x1:0,y1:-o-10,x2:0,y2:o+10,stroke:l,strokeWidth:1,opacity:.3,pointerEvents:"none"}),jsx("line",{x1:0,y1:0,x2:o,y2:0,stroke:l,strokeWidth:a,pointerEvents:"none"}),jsx("polygon",{points:`${o},0 ${o-12},-6 ${o-12},6`,fill:l,pointerEvents:"none"}),d?jsxs("g",{transform:`rotate(${-n})`,children:[jsx("line",{x1:r,y1:i,x2:r,y2:0,stroke:"#ef4444",strokeWidth:1,strokeDasharray:"4 4"}),jsx("line",{x1:r,y1:i,x2:0,y2:i,stroke:"#3b82f6",strokeWidth:1,strokeDasharray:"4 4"}),jsx("line",{x1:0,y1:0,x2:r,y2:0,stroke:"#ef4444",strokeWidth:2}),jsx("polygon",{points:`${r},0 ${r>0?r-8:r+8},-4 ${r>0?r-8:r+8},4`,fill:"#ef4444"}),jsx("line",{x1:0,y1:0,x2:0,y2:i,stroke:"#3b82f6",strokeWidth:2}),jsx("polygon",{points:`0,${i} -4,${i>0?i-8:i+8} 4,${i>0?i-8:i+8}`,fill:"#3b82f6"})]}):null,jsx("path",{d:`M ${o*.3} 0 A ${o*.3} ${o*.3} 0 0 0 ${o*.3*Math.cos(-n*Math.PI/180)} ${o*.3*Math.sin(-n*Math.PI/180)}`,fill:"none",stroke:l,strokeWidth:1.5,transform:`rotate(${-n})`}),t.label?jsx("text",{x:o/2,y:-15,fontSize:c,fill:l,textAnchor:"middle",pointerEvents:"none",children:String(t.label)}):null]}),jsx(k,{el:t,ctx:e,padX:o+28,padY:o+28})]})});x("sine_wave",(t,e)=>{let o=C(t.x1,t.y1,t.x2,t.y2),n=L(t.x1,t.y1,t.x2,t.y2),r=t.amplitude||40,i=t.loops||2,l=o/(i/2),a=at(t),c=ct(t),d=lt(t),y="M 0 0",h=Math.max(1,o/100);for(let f=0;f<=o;f+=h)y+=` L ${f} ${-r*Math.sin(f/l*2*Math.PI)}`;return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${n})`,children:[jsx("line",{x1:0,y1:0,x2:o,y2:0,stroke:a,strokeWidth:1,strokeDasharray:"4 4",opacity:.5,pointerEvents:"none"}),jsx(q,{dPath:y,strokeWidth:22,strokeLinejoin:"round"}),jsx("path",{d:y,fill:"none",stroke:a,strokeWidth:c,strokeLinejoin:"round",pointerEvents:"none"}),t.label?jsx("text",{x:o/2,y:-r-15,fontSize:d,fill:a,textAnchor:"middle",pointerEvents:"none",children:String(t.label)}):null]}),jsx(k,{el:t,ctx:e,padY:r+28})]})});x("standing_wave",(t,e)=>{let o=C(t.x1,t.y1,t.x2,t.y2),n=L(t.x1,t.y1,t.x2,t.y2),r=t.amplitude||40,i=t.loops||3,l=o/(i/2),a=at(t),c=ct(t),d=lt(t),y="M 0 0",h="M 0 0",f=Math.max(1,o/100);for(let $=0;$<=o;$+=f){let w=r*Math.sin($/l*2*Math.PI);y+=` L ${$} ${-w}`,h+=` L ${$} ${w}`;}return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${n})`,children:[jsx("line",{x1:0,y1:0,x2:o,y2:0,stroke:a,strokeWidth:1,opacity:.5,pointerEvents:"none"}),jsx(q,{dPath:y,strokeWidth:22,strokeLinejoin:"round"}),jsx(q,{dPath:h,strokeWidth:22,strokeLinejoin:"round"}),jsx("path",{d:y,fill:a,fillOpacity:.1,stroke:a,strokeWidth:c,strokeLinejoin:"round",pointerEvents:"none"}),jsx("path",{d:h,fill:"none",stroke:a,strokeWidth:c,strokeDasharray:"4 4",strokeLinejoin:"round",pointerEvents:"none"}),t.label?jsx("text",{x:o/2,y:-r-15,fontSize:d,fill:a,textAnchor:"middle",pointerEvents:"none",children:String(t.label)}):null]}),jsx(k,{el:t,ctx:e,padY:r+28})]})});x("shm_graph",(t,e)=>{let o=C(t.x1,t.y1,t.x2,t.y2),n=L(t.x1,t.y1,t.x2,t.y2),r=t.amplitude||40,i=t.loops||1,l=o/i,a=t.graphType||"x",c=at(t),d=ct(t),y=lt(t),h=`M 0 ${-r}`,f="M 0 0",$=`M 0 ${r}`,w=Math.max(1,o/100);for(let W=0;W<=o;W+=w){let P=W/l*2*Math.PI;h+=` L ${W} ${-r*Math.cos(P)}`,f+=` L ${W} ${-r*.8*-Math.sin(P)}`,$+=` L ${W} ${-r*.6*-Math.cos(P)}`;}return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${n})`,children:[jsx("line",{x1:0,y1:0,x2:o,y2:0,stroke:c,strokeWidth:1,opacity:.5,pointerEvents:"none"}),jsx("line",{x1:0,y1:-r*1.2,x2:0,y2:r*1.2,stroke:c,strokeWidth:1,opacity:.5,pointerEvents:"none"}),a==="x"||a==="all"?jsxs(Fragment,{children:[jsx(q,{dPath:h,strokeWidth:20,strokeLinejoin:"round"}),jsx("path",{d:h,fill:"none",stroke:"#3b82f6",strokeWidth:d,strokeLinejoin:"round",pointerEvents:"none"})]}):null,a==="v"||a==="all"?jsxs(Fragment,{children:[jsx(q,{dPath:f,strokeWidth:20,strokeLinejoin:"round"}),jsx("path",{d:f,fill:"none",stroke:"#ef4444",strokeWidth:d,strokeLinejoin:"round",pointerEvents:"none"})]}):null,a==="a"||a==="all"?jsxs(Fragment,{children:[jsx(q,{dPath:$,strokeWidth:20,strokeLinejoin:"round"}),jsx("path",{d:$,fill:"none",stroke:"#10b981",strokeWidth:d,strokeLinejoin:"round",pointerEvents:"none"})]}):null,t.label?jsx("text",{x:o/2,y:-r-15,fontSize:y,fill:c,textAnchor:"middle",pointerEvents:"none",children:String(t.label)}):null]}),jsx(k,{el:t,ctx:e,padY:r*1.2+28})]})});x("energy_graph",(t,e)=>{let o=C(t.x1,t.y1,t.x2,t.y2),n=L(t.x1,t.y1,t.x2,t.y2),r=t.amplitude||50,i=t.loops||1,l=o/i,a=t.domain||"time",c=at(t),d=ct(t),y=lt(t),h="M 0 0",f=`M 0 ${-r}`,$=Math.max(1,o/100);if(a==="time"){h=`M 0 ${-r}`,f="M 0 0";for(let w=0;w<=o;w+=$){let W=w/l*2*Math.PI;h+=` L ${w} ${-r*Math.pow(Math.cos(W),2)}`,f+=` L ${w} ${-r*Math.pow(Math.sin(W),2)}`;}}else for(let w=0;w<=o;w+=$){let W=2*(w/o)-1,P=r*W*W;h+=` L ${w} ${-P}`,f+=` L ${w} ${-(r-P)}`;}return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${n})`,children:[jsx("line",{x1:0,y1:0,x2:o,y2:0,stroke:c,strokeWidth:1,opacity:.5,pointerEvents:"none"}),jsx("line",{x1:0,y1:-r,x2:o,y2:-r,stroke:c,strokeWidth:1,strokeDasharray:"4 4",opacity:.5,pointerEvents:"none"}),jsx(q,{dPath:h,strokeWidth:20,strokeLinejoin:"round"}),jsx(q,{dPath:f,strokeWidth:20,strokeLinejoin:"round"}),jsx("path",{d:h,fill:"none",stroke:"#10b981",strokeWidth:d,strokeLinejoin:"round",pointerEvents:"none"}),jsx("path",{d:f,fill:"none",stroke:"#ef4444",strokeWidth:d,strokeLinejoin:"round",pointerEvents:"none"}),t.label?jsx("text",{x:o/2,y:-r-15,fontSize:y,fill:c,textAnchor:"middle",pointerEvents:"none",children:String(t.label)}):null]}),jsx(k,{el:t,ctx:e,padY:r+28})]})});x("strobe_shm",(t,e)=>{let o=C(t.x1,t.y1,t.x2,t.y2),n=L(t.x1,t.y1,t.x2,t.y2),r=t.amplitude||40,i=t.loops||1,l=at(t),a=ct(t),c=lt(t),d=10,y=[],h=[],f=[];for(let $=0;$<=d;$++){let w=$/d,W=r*Math.cos(w*2*Math.PI*i),P=w*o;y.push(`${W},${P}`),h.push(jsx("circle",{cx:W,cy:P,r:a*2,fill:l,pointerEvents:"none"},`c${$}`)),f.push(jsx("line",{x1:-r-20,y1:P,x2:r+20,y2:P,stroke:l,strokeWidth:1,strokeDasharray:"4 4",opacity:.3},`l${$}`));}return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${n})`,children:[f,jsx("polyline",{points:y.join(" "),fill:"none",stroke:l,strokeWidth:1,opacity:.4,pointerEvents:"none"}),jsx("line",{x1:0,y1:0,x2:0,y2:o,stroke:l,strokeWidth:1,opacity:.5,pointerEvents:"none"}),h,t.label?jsx("text",{x:0,y:-15,fontSize:c,fill:l,textAnchor:"middle",pointerEvents:"none",children:String(t.label)}):null]}),jsx(k,{el:t,ctx:e,padX:r+35,padY:o+35})]})});x("torsion_pendulum",(t,e)=>{let o=C(t.x1,t.y1,t.x2,t.y2),n=L(t.x1,t.y1,t.x2,t.y2),r=at(t),i=ct(t),l=lt(t),a=Math.max(18,Math.min(58,t.size||26+o*.2)),c=Math.max(5,Math.min(11,a*.14)),d=Math.max(-45,Math.min(45,t.rotation??16)),y=d*Math.PI/180,h=Math.min(14,a*.35),f=h*Math.sin(y),$=-h*Math.cos(y),w=4,W=Math.max(w+8,o-c),P=[],Q=Math.min(2.8,c*.35),j=24;for(let G=0;G<=j;G++){let u=G/j,U=w+u*(W-w),yt=Q*Math.sin(u*Math.PI*5);P.push(G===0?`M ${U} ${yt}`:` L ${U} ${yt}`);}let F=Math.max(a+c+28,o*.35+40);return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${n})`,children:[jsx("rect",{x:-28,y:-14,width:56,height:10,rx:2,fill:"#e2e8f0",stroke:r,strokeWidth:1.25,pointerEvents:"none"}),jsx("rect",{x:-8,y:-4,width:16,height:8,rx:1,fill:"#94a3b8",stroke:r,strokeWidth:1,pointerEvents:"none"}),jsx("line",{x1:-22,y1:-9,x2:22,y2:-9,stroke:"#64748b",strokeWidth:1,pointerEvents:"none"}),jsx("path",{d:P.join(""),fill:"none",stroke:r,strokeWidth:1,strokeLinecap:"round",opacity:.35,pointerEvents:"none"}),jsx("line",{x1:w,y1:0,x2:W,y2:0,stroke:"#64748b",strokeWidth:Math.max(1,i*.45),strokeLinecap:"round",pointerEvents:"none"}),jsx("rect",{x:o-c,y:-a,width:2*c,height:2*a,rx:c-.5,fill:"#f8fafc",stroke:r,strokeWidth:i,pointerEvents:"none"}),jsx("line",{x1:o-c+1,y1:0,x2:o+c-1,y2:0,stroke:"#cbd5e1",strokeWidth:1,pointerEvents:"none"}),jsx("circle",{cx:o,cy:0,r:Math.min(5,c-1),fill:"#94a3b8",stroke:r,strokeWidth:1,pointerEvents:"none"}),jsx("line",{x1:o,y1:0,x2:o,y2:-(a-6),stroke:"#94a3b8",strokeWidth:1.25,strokeDasharray:"3 3",opacity:.65,pointerEvents:"none"}),jsx("g",{transform:`translate(${o},0) rotate(${d})`,children:jsx("line",{x1:0,y1:0,x2:0,y2:-(a-5),stroke:"#dc2626",strokeWidth:Math.max(1.5,i*.75),strokeLinecap:"round",pointerEvents:"none"})}),Math.abs(d)>=2?jsx("g",{transform:`translate(${o},0)`,children:jsx("path",{d:`M 0 ${-h} A ${h} ${h} 0 0 ${d>=0?1:0} ${f} ${$}`,fill:"none",stroke:"#dc2626",strokeWidth:1.25,pointerEvents:"none"})}):null,t.label?jsx("text",{x:o,y:a+22,fontSize:l,fill:r,textAnchor:"middle",pointerEvents:"none",children:String(t.label)}):null]}),jsx(k,{el:t,ctx:e,padX:F,padY:F})]})});x("vane_liquid",(t,e)=>{let o=C(t.x1,t.y1,t.x2,t.y2),n=L(t.x1,t.y1,t.x2,t.y2),r=at(t),i=ct(t),l=lt(t),a=Math.max(40,o*.4),c=Math.max(40,o*.5);return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${n})`,children:[jsx("line",{x1:0,y1:0,x2:o,y2:0,stroke:r,strokeWidth:i,pointerEvents:"none"}),jsx("line",{x1:o,y1:-a*.3,x2:o,y2:a*.3,stroke:r,strokeWidth:i*1.5,strokeLinecap:"round",pointerEvents:"none"}),jsx("path",{d:`M ${o-c} ${-a/2} L ${o+10} ${-a/2} L ${o+10} ${a/2} L ${o-c} ${a/2}`,fill:"none",stroke:r,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",pointerEvents:"none"}),jsx("rect",{x:o-c+2,y:-a/2+2,width:c+8,height:a-4,fill:"#38bdf8",fillOpacity:.3,pointerEvents:"none"}),t.label?jsx("text",{x:o/2,y:-a/2-15,fontSize:l,fill:r,textAnchor:"middle",pointerEvents:"none",children:String(t.label)}):null]}),jsx(k,{el:t,ctx:e,padX:c+40,padY:a+40})]})});x("wave_pulse",(t,e)=>{let o=C(t.x1,t.y1,t.x2,t.y2),n=L(t.x1,t.y1,t.x2,t.y2),r=t.amplitude||50,i=at(t),l=ct(t),a=lt(t),c=o/2,d=o/6,y="M 0 0",h=Math.max(1,o/50);for(let f=0;f<=o;f+=h){let $=r*Math.exp(-Math.pow(f-c,2)/(2*d*d));y+=` L ${f} ${-$}`;}return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${n})`,children:[jsx("line",{x1:0,y1:0,x2:o,y2:0,stroke:i,strokeWidth:l,strokeLinecap:"round",pointerEvents:"none"}),jsx(q,{dPath:y,strokeWidth:22,strokeLinejoin:"round"}),jsx("path",{d:y,fill:i,fillOpacity:.1,stroke:i,strokeWidth:l,strokeLinejoin:"round",pointerEvents:"none"}),t.label?jsx("text",{x:c,y:-r-15,fontSize:a,fill:i,textAnchor:"middle",pointerEvents:"none",children:String(t.label)}):null]}),jsx(k,{el:t,ctx:e,padY:r+28})]})});x("damped_wave",(t,e)=>{let o=C(t.x1,t.y1,t.x2,t.y2),n=L(t.x1,t.y1,t.x2,t.y2),r=t.amplitude||50,i=t.damping||.015,l=t.frequency||10,a=at(t),c=ct(t),d=lt(t),y=`M 0 ${-r}`,h=`M 0 ${-r}`,f=`M 0 ${r}`,$=Math.max(1,o/200);for(let w=0;w<=o;w+=$){let W=r*Math.exp(-i*w),P=W*Math.cos(w/o*l*2*Math.PI);y+=` L ${w} ${-P}`,h+=` L ${w} ${-W}`,f+=` L ${w} ${W}`;}return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${n})`,children:[jsx("line",{x1:0,y1:0,x2:o,y2:0,stroke:a,strokeWidth:1,opacity:.3,pointerEvents:"none"}),jsx("path",{d:h,fill:"none",stroke:a,strokeWidth:1,strokeDasharray:"4 4",opacity:.5,pointerEvents:"none"}),jsx("path",{d:f,fill:"none",stroke:a,strokeWidth:1,strokeDasharray:"4 4",opacity:.5,pointerEvents:"none"}),jsx(q,{dPath:y,strokeWidth:22,strokeLinejoin:"round"}),jsx("path",{d:y,fill:"none",stroke:a,strokeWidth:c,strokeLinejoin:"round",pointerEvents:"none"}),t.label?jsx("text",{x:o/2,y:-r-15,fontSize:d,fill:a,textAnchor:"middle",pointerEvents:"none",children:String(t.label)}):null]}),jsx(k,{el:t,ctx:e,padY:r+28})]})});x("beats_graph",(t,e)=>{let o=C(t.x1,t.y1,t.x2,t.y2),n=L(t.x1,t.y1,t.x2,t.y2),r=t.amplitude||30,i=t.frequency||20,l=t.beatFreq||2,a=at(t),c=ct(t),d=lt(t),y="M 0 0",h="M 0 0",f="M 0 0",$=Math.max(1,o/200);for(let w=0;w<=o;w+=$){let W=r*Math.cos(w/o*l*Math.PI),P=W*Math.sin(w/o*i*2*Math.PI);y+=` L ${w} ${-P}`,h+=` L ${w} ${-Math.abs(W)}`,f+=` L ${w} ${Math.abs(W)}`;}return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${n})`,children:[jsx("line",{x1:0,y1:0,x2:o,y2:0,stroke:a,strokeWidth:1,opacity:.3,pointerEvents:"none"}),jsx("path",{d:h,fill:"none",stroke:a,strokeWidth:1,strokeDasharray:"2 4",opacity:.5,pointerEvents:"none"}),jsx("path",{d:f,fill:"none",stroke:a,strokeWidth:1,strokeDasharray:"2 4",opacity:.5,pointerEvents:"none"}),jsx(q,{dPath:y,strokeWidth:22,strokeLinejoin:"round"}),jsx("path",{d:y,fill:"none",stroke:a,strokeWidth:c,strokeLinejoin:"round",pointerEvents:"none"}),t.label?jsx("text",{x:o/2,y:-r-20,fontSize:d,fill:a,textAnchor:"middle",pointerEvents:"none",children:String(t.label)}):null]}),jsx(k,{el:t,ctx:e,padY:r+28})]})});x("mach_cone",(t,e)=>{let o=C(t.x1,t.y1,t.x2,t.y2),n=L(t.x1,t.y1,t.x2,t.y2),r=t.machNumber||2,i=Math.asin(1/Math.max(1.01,r)),l=o,a=l*Math.tan(i),c=at(t),d=ct(t),y=lt(t);return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${n})`,children:[jsx("line",{x1:0,y1:0,x2:l,y2:0,stroke:c,strokeWidth:1,strokeDasharray:"4 4",pointerEvents:"none"}),jsx("line",{x1:l,y1:0,x2:0,y2:-a,stroke:c,strokeWidth:d,pointerEvents:"none"}),jsx("line",{x1:l,y1:0,x2:0,y2:a,stroke:c,strokeWidth:d,pointerEvents:"none"}),jsx("circle",{cx:l,cy:0,r:4,fill:c,pointerEvents:"none"}),[.2,.5,.8].map(h=>jsx("circle",{cx:l*h,cy:0,r:(1-h)*a,fill:"none",stroke:c,strokeWidth:1,opacity:.6,pointerEvents:"none"},h)),t.label?jsx("text",{x:l/2,y:a+20,fontSize:y,fill:c,textAnchor:"middle",pointerEvents:"none",children:String(t.label)}):null]}),jsx(k,{el:t,ctx:e,padY:a+35})]})});x("wall",(t,e)=>{let o=C(t.x1,t.y1,t.x2,t.y2),n=L(t.x1,t.y1,t.x2,t.y2),r=at(t),i=ct(t),l=lt(t),a=[],c=Math.max(2,Math.floor(o/10));for(let d=0;d<=c;d++){let y=d/c*o;a.push(jsx("line",{x1:y,y1:0,x2:y-8,y2:-12,stroke:r,strokeWidth:1,pointerEvents:"none"},d));}return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${n})`,children:[jsx("line",{x1:0,y1:0,x2:o,y2:0,stroke:r,strokeWidth:i,pointerEvents:"none"}),a,t.label?jsx("text",{x:o/2,y:20,fontSize:l,fill:r,textAnchor:"middle",pointerEvents:"none",children:String(t.label)}):null]}),jsx(k,{el:t,ctx:e,padY:35})]})});var N=t=>t.color||"#0f172a",nt=t=>t.strokeWidth||2,pt=t=>t.fontSize||18;function ur(t,e,o=20){let n=Math.max(3,e??Math.floor(t/20)),r=t/n,i=`M 0 0 L ${r*.2} 0 `;for(let l=0;l<n;l++){let a=l*r;l===n-1?i+=`L ${a+r*.25} ${-o/2} L ${a+r*.75} ${o/2} L ${t} 0 `:i+=`L ${a+r*.25} ${-o/2} L ${a+r*.75} ${o/2} L ${a+r} 0 `;}return i}x("point_mass",(t,e)=>{let o=t.size??15,n=Math.max(36,o+22);return jsx("g",{transform:`translate(${t.x1}, ${t.y1})`,children:jsxs(I,{ctx:e,hitHalfSize:n/2,selectionHalfSize:n/2+8,children:[jsx("circle",{cx:0,cy:0,r:o,fill:N(t),fillOpacity:.8,stroke:N(t),strokeWidth:2}),jsx("circle",{cx:0,cy:0,r:o*.3,fill:"#fff",fillOpacity:.5}),t.label?jsx("text",{x:0,y:o+15,fontSize:pt(t),fill:N(t),textAnchor:"middle",fontWeight:"bold",pointerEvents:"none",children:String(t.label)}):null]})})});x("com_indicator",(t,e)=>{let o=t.size??15,n=Math.max(40,o*2+12);return jsx("g",{transform:`translate(${t.x1}, ${t.y1})`,children:jsxs(I,{ctx:e,hitHalfSize:n/2,selectionHalfSize:n/2+10,children:[jsx("circle",{cx:0,cy:0,r:o,fill:"none",stroke:N(t),strokeWidth:nt(t)}),jsx("line",{x1:-o*1.3,y1:0,x2:o*1.3,y2:0,stroke:N(t),strokeWidth:nt(t),pointerEvents:"none"}),jsx("line",{x1:0,y1:-o*1.3,x2:0,y2:o*1.3,stroke:N(t),strokeWidth:nt(t),pointerEvents:"none"}),jsx("path",{d:`M 0 0 L ${o} 0 A ${o} ${o} 0 0 0 0 ${-o} Z`,fill:N(t),fillOpacity:.5,pointerEvents:"none"}),jsx("path",{d:`M 0 0 L ${-o} 0 A ${o} ${o} 0 0 0 0 ${o} Z`,fill:N(t),fillOpacity:.5,pointerEvents:"none"}),t.label?jsx("text",{x:0,y:o+15,fontSize:pt(t),fill:N(t),textAnchor:"middle",fontWeight:"bold",pointerEvents:"none",children:String(t.label)}):null]})})});x("pivot",(t,e)=>{let o=t.size??20,n=Math.max(44,o*2+24);return jsx("g",{transform:`translate(${t.x1}, ${t.y1})`,children:jsxs(I,{ctx:e,hitHalfSize:n/2,selectionHalfSize:n/2+10,children:[jsx("polygon",{points:`0,0 ${-o},${o*1.5} ${o},${o*1.5}`,fill:"none",stroke:N(t),strokeWidth:nt(t),pointerEvents:"none"}),jsx("line",{x1:-o*1.5,y1:o*1.5,x2:o*1.5,y2:o*1.5,stroke:N(t),strokeWidth:nt(t)+1,strokeLinecap:"round",pointerEvents:"none"}),jsx("circle",{cx:0,cy:0,r:nt(t)*1.5,fill:N(t),pointerEvents:"none"}),Array.from({length:5},(r,i)=>jsx("line",{x1:-o+i*o*.5,y1:o*1.5,x2:-o+i*o*.5-5,y2:o*1.5+8,stroke:N(t),strokeWidth:1,pointerEvents:"none"},i)),t.label?jsx("text",{x:0,y:o*1.5+20,fontSize:pt(t),fill:N(t),textAnchor:"middle",pointerEvents:"none",children:String(t.label)}):null]})})});x("block_mass",(t,e)=>{let o=Math.min(t.x1,t.x2),n=Math.min(t.y1,t.y2),r=Math.max(1,Math.abs(t.x2-t.x1)),i=Math.max(1,Math.abs(t.y2-t.y1));return jsxs("g",{children:[jsxs("g",{transform:`translate(${o}, ${n})`,children:[jsx("rect",{x:0,y:0,width:r,height:i,fill:N(t),fillOpacity:.2,stroke:N(t),strokeWidth:nt(t),rx:2}),t.label?jsx("text",{x:r/2,y:i/2,dominantBaseline:"central",textAnchor:"middle",fontSize:pt(t),fill:N(t),fontWeight:"bold",pointerEvents:"none",children:String(t.label)}):null]}),V(o,n,r,i,e),jsx(k,{el:t,ctx:e})]})});x("system_boundary",(t,e)=>{let o=Math.min(t.x1,t.x2),n=Math.min(t.y1,t.y2),r=Math.max(1,Math.abs(t.x2-t.x1)),i=Math.max(1,Math.abs(t.y2-t.y1));return jsxs("g",{children:[jsxs("g",{transform:`translate(${o}, ${n})`,children:[jsx("rect",{x:0,y:0,width:r,height:i,fill:"none",stroke:N(t),strokeWidth:nt(t),strokeDasharray:"8 6",rx:15}),t.label?jsx("text",{x:r/2,y:-10,fontSize:pt(t),fill:N(t),textAnchor:"middle",fontStyle:"italic",pointerEvents:"none",children:String(t.label)}):null]}),V(o,n,r,i,e),jsx(k,{el:t,ctx:e})]})});x("rocket",(t,e)=>{let o=t.x2-t.x1,n=t.y2-t.y1,r=Math.hypot(o,n),i=L(t.x1,t.y1,t.x2,t.y2),l=Math.min(t.x1,t.x2),a=Math.max(t.x1,t.x2),c=Math.max(1,a-l);return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${i})`,children:[jsx("path",{d:`M 0 ${-c/4} L ${r*.7} ${-c/4} L ${r} 0 L ${r*.7} ${c/4} L 0 ${c/4} Z`,fill:"none",stroke:N(t),strokeWidth:nt(t),pointerEvents:"none"}),jsx("polygon",{points:`0,${-c/4} ${r*.2},${-c/4} 0,${-c/2}`,fill:N(t),fillOpacity:.8,pointerEvents:"none"}),jsx("polygon",{points:`0,${c/4} ${r*.2},${c/4} 0,${c/2}`,fill:N(t),fillOpacity:.8,pointerEvents:"none"}),jsx("path",{d:`M 0 ${-c/6} Q ${-r*.3} 0 0 ${c/6}`,fill:"#f97316",fillOpacity:.8,pointerEvents:"none"}),jsx("path",{d:`M 0 ${-c/8} Q ${-r*.5} 0 0 ${c/8}`,fill:"#ef4444",fillOpacity:.6,pointerEvents:"none"}),t.label?jsx("text",{x:r/2,y:-c/2-10,fontSize:pt(t),fill:N(t),textAnchor:"middle",pointerEvents:"none",children:String(t.label)}):null]}),jsx(k,{el:t,ctx:e})]})});x("dashed_path",(t,e)=>{let o=C(t.x1,t.y1,t.x2,t.y2),n=L(t.x1,t.y1,t.x2,t.y2);return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${n})`,children:[jsx("line",{x1:0,y1:0,x2:o,y2:0,stroke:N(t),strokeWidth:nt(t),strokeLinecap:"round",strokeDasharray:"8 6",pointerEvents:"none"}),t.label?jsx("text",{x:o/2,y:-10,fontSize:pt(t),fill:N(t),textAnchor:"middle",pointerEvents:"none",children:String(t.label)}):null]}),jsx(k,{el:t,ctx:e})]})});x("uniform_rod",(t,e)=>{let o=C(t.x1,t.y1,t.x2,t.y2),n=L(t.x1,t.y1,t.x2,t.y2),r=nt(t);return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${n})`,children:[jsx("rect",{x:0,y:-r/2,width:o,height:r,fill:N(t),rx:r/4,pointerEvents:"none"}),jsx("circle",{cx:o/2,cy:0,r:Math.max(2,r/4),fill:"#fff",pointerEvents:"none"}),t.label?jsx("text",{x:o/2,y:-r/2-10,fontSize:pt(t),fill:N(t),textAnchor:"middle",pointerEvents:"none",children:String(t.label)}):null]}),jsx(k,{el:t,ctx:e})]})});x("solid_disk",(t,e)=>{let o=t.x2-t.x1,n=t.y2-t.y1,r=Math.hypot(o,n);return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("circle",{cx:0,cy:0,r,fill:N(t),fillOpacity:.4,stroke:N(t),strokeWidth:nt(t),pointerEvents:"none"}),t.label?jsx("text",{x:0,y:r+20,fontSize:pt(t),fill:N(t),textAnchor:"middle",pointerEvents:"none",children:String(t.label)}):null]}),jsx(k,{el:t,ctx:e})]})});x("hoop_ring",(t,e)=>{let o=t.x2-t.x1,n=t.y2-t.y1,r=Math.hypot(o,n);return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("circle",{cx:0,cy:0,r,fill:"none",stroke:N(t),strokeWidth:Math.max(4,nt(t)*2),pointerEvents:"none"}),t.label?jsx("text",{x:0,y:r+20,fontSize:pt(t),fill:N(t),textAnchor:"middle",pointerEvents:"none",children:String(t.label)}):null]}),jsx(k,{el:t,ctx:e})]})});x("rolling_body",(t,e)=>{let o=t.x2-t.x1,n=t.y2-t.y1,r=Math.hypot(o,n);return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("circle",{cx:0,cy:0,r,fill:N(t),fillOpacity:.1,stroke:N(t),strokeWidth:nt(t),pointerEvents:"none"}),jsx("line",{x1:-r,y1:0,x2:r,y2:0,stroke:N(t),strokeWidth:1,strokeDasharray:"4 4",pointerEvents:"none"}),jsx("line",{x1:0,y1:-r,x2:0,y2:r,stroke:N(t),strokeWidth:1,strokeDasharray:"4 4",pointerEvents:"none"}),jsx("circle",{cx:0,cy:0,r:3,fill:N(t),pointerEvents:"none"}),t.showVelocity?jsxs("g",{pointerEvents:"none",children:[jsx("line",{x1:0,y1:0,x2:r*1.5,y2:0,stroke:"#ef4444",strokeWidth:2}),jsx("polygon",{points:`${r*1.5},0 ${r*1.5-8},-4 ${r*1.5-8},4`,fill:"#ef4444"}),jsx("text",{x:r*1.5+10,y:5,fill:"#ef4444",fontSize:14,fontStyle:"italic",children:"v"})]}):null,t.showOmega?jsxs("g",{transform:`translate(0, ${-r*1.2})`,pointerEvents:"none",children:[jsx("path",{d:`M ${-r*.4} 0 A ${r*.4} ${r*.4} 0 0 1 ${r*.4} 0`,fill:"none",stroke:"#10b981",strokeWidth:2}),jsx("polygon",{points:`${r*.4},0 ${r*.4-4},-6 ${r*.4+4},-6`,fill:"#10b981"}),jsx("text",{x:0,y:-10,fill:"#10b981",fontSize:14,fontStyle:"italic",textAnchor:"middle",children:"\u03C9"})]}):null,t.label?jsx("text",{x:0,y:r+20,fontSize:pt(t),fill:N(t),textAnchor:"middle",pointerEvents:"none",children:String(t.label)}):null]}),jsx(k,{el:t,ctx:e})]})});x("inclined_wedge",(t,e)=>{let{x1:o,y1:n,x2:r,y2:i}=t,l=r-o,a=i-n,c=Math.atan2(a,l)*(180/Math.PI),d=et(o,n,r,i),y=Math.min(o,r),h=Math.min(n,i),f=d.width,$=d.height;return jsxs("g",{children:[jsx("polygon",{points:`${o},${n} ${o},${i} ${r},${i}`,fill:N(t),fillOpacity:.1,stroke:N(t),strokeWidth:nt(t),strokeLinejoin:"round",pointerEvents:"none"}),t.label?jsx("text",{x:(o+r)/2,y:i-10,fontSize:pt(t),fill:N(t),textAnchor:"middle",pointerEvents:"none",children:String(t.label)}):null,Math.abs(r-o)>20&&Math.abs(i-n)>20?jsx("path",{d:`M ${r>o?r-20:r+20} ${i} A 20 20 0 0 ${r>o?0:1} ${r>o?r-20*Math.cos(c*Math.PI/180):r+20*Math.cos(c*Math.PI/180)} ${i-20*Math.sin(Math.abs(c)*Math.PI/180)}`,fill:"none",stroke:N(t),strokeWidth:1,pointerEvents:"none"}):null,jsx(jt,{minX:y,minY:h,width:f,height:$,ctx:e}),jsx(k,{el:t,ctx:e})]})});x("pulley",(t,e)=>{let o=t.x2-t.x1,n=t.y2-t.y1,r=Math.hypot(o,n);return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx("path",{d:`M 0 0 L 0 ${-r*1.5}`,fill:"none",stroke:N(t),strokeWidth:nt(t),pointerEvents:"none"}),jsx("line",{x1:-r*.8,y1:-r*1.5,x2:r*.8,y2:-r*1.5,stroke:N(t),strokeWidth:nt(t),pointerEvents:"none"}),Array.from({length:5},(i,l)=>jsx("line",{x1:-r*.8+l*r*.4,y1:-r*1.5,x2:-r*.8+l*r*.4+5,y2:-r*1.5-5,stroke:N(t),strokeWidth:1,pointerEvents:"none"},l)),jsx("circle",{cx:0,cy:0,r,fill:"#fff",stroke:N(t),strokeWidth:nt(t),pointerEvents:"none"}),jsx("circle",{cx:0,cy:0,r:r*.8,fill:"none",stroke:N(t),strokeWidth:1,opacity:.3,pointerEvents:"none"}),jsx("circle",{cx:0,cy:0,r:3,fill:N(t),pointerEvents:"none"}),t.label?jsx("text",{x:0,y:-r*1.5-15,fontSize:pt(t),fill:N(t),textAnchor:"middle",pointerEvents:"none",children:String(t.label)}):null]}),jsx(k,{el:t,ctx:e})]})});x("curve_arrow",(t,e)=>{let o=C(t.x1,t.y1,t.x2,t.y2),n=L(t.x1,t.y1,t.x2,t.y2),r=`M 0 0 Q ${o/2} ${-o*.5} ${o} 0`,i=Jt(t.x1,t.y1,t.x2,t.y2,o/4);return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${n})`,children:[jsx("path",{d:r,fill:"none",stroke:N(t),strokeWidth:nt(t),strokeLinecap:"round",pointerEvents:"none"}),jsx(q,{dPath:r,strokeWidth:24,strokeLinecap:"round"}),jsx("polygon",{points:`${o},0 ${o-8},-6 ${o-4},-1`,fill:N(t),transform:`rotate(20 ${o} 0)`,pointerEvents:"none"}),t.label?jsx("text",{x:o/2,y:-o*.3,fontSize:pt(t),fill:N(t),textAnchor:"middle",pointerEvents:"none",children:String(t.label)}):null]}),e.isSelected&&!e.viewMode&&!e.isGhost?Dt(i.x,i.y,i.width,i.height):null,Nt(t,e)]})});x("spring",(t,e)=>{let o=C(t.x1,t.y1,t.x2,t.y2),n=L(t.x1,t.y1,t.x2,t.y2),r=ur(o,t.coils);return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${n})`,children:[jsx(q,{dPath:r,strokeWidth:26,strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:r,fill:"none",stroke:N(t),strokeWidth:nt(t),strokeLinecap:"round",strokeLinejoin:"round",pointerEvents:"none"}),t.label?jsx("text",{x:o/2,y:-20,fontSize:pt(t),fill:N(t),textAnchor:"middle",pointerEvents:"none",children:String(t.label)}):null]}),jsx(k,{el:t,ctx:e})]})});var St=(t,e)=>e?.isSelected?"#2563eb":t.color||"#111827",zt=(t,e)=>e?.isSelected?2.5:t.strokeWidth||2;x("wire",(t,e)=>jsxs("g",{opacity:e?.isGhost?.5:1,children:[jsx("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:St(t,e),strokeWidth:zt(t,e),strokeLinecap:"round",pointerEvents:"none"}),jsx(k,{el:t,ctx:e,hitWidth:20})]}));var Kt=(t,e,o)=>{let n=C(t.x1,t.y1,t.x2,t.y2),r=L(t.x1,t.y1,t.x2,t.y2),i=t.x2-t.x1,l=t.y2-t.y1,a=(t.x1+t.x2)/2,c=(t.y1+t.y2)/2,d=-l/(n||1),y=i/(n||1);y>0&&(d=-d,y=-y);let h=20;return jsxs("g",{opacity:o?.isGhost?.5:1,children:[jsx("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${r})`,children:jsx("g",{children:e})}),t.label?jsx("text",{x:a+d*h,y:c+y*h,dominantBaseline:"central",textAnchor:"middle",fill:St(t,o),fontSize:"16",fontFamily:"serif",fontWeight:"bold",pointerEvents:"none",children:String(t.label)}):null,t.value?jsx("text",{x:a-d*h,y:c-y*h,dominantBaseline:"central",textAnchor:"middle",fill:"#4b5563",fontSize:"14",fontFamily:"sans-serif",pointerEvents:"none",children:String(t.value)}):null,jsx(k,{el:t,ctx:o,hitWidth:20})]})};x("resistor",(t,e)=>{let o=C(t.x1,t.y1,t.x2,t.y2),n=o/2-15;return Kt(t,jsx("path",{d:`M 0 0 L ${n} 0 l 2.5 -8 l 5 16 l 5 -16 l 5 16 l 5 -16 l 5 16 l 2.5 -8 L ${o} 0`,fill:"none",stroke:St(t,e),strokeWidth:zt(t,e),strokeLinejoin:"bevel"}),e)});x("capacitor",(t,e)=>{let o=C(t.x1,t.y1,t.x2,t.y2),n=o/2;return Kt(t,jsx("path",{d:`M 0 0 L ${n-4} 0 M ${n-4} -12 L ${n-4} 12 M ${n+4} -12 L ${n+4} 12 M ${n+4} 0 L ${o} 0`,fill:"none",stroke:St(t,e),strokeWidth:zt(t,e)}),e)});x("inductor",(t,e)=>{let o=C(t.x1,t.y1,t.x2,t.y2),n=o/2-15;return Kt(t,jsx("path",{d:`M 0 0 L ${n} 0 A 5 5 0 0 0 ${n+10} 0 A 5 5 0 0 0 ${n+20} 0 A 5 5 0 0 0 ${n+30} 0 L ${o} 0`,fill:"none",stroke:St(t,e),strokeWidth:zt(t,e)}),e)});x("diode",(t,e)=>{let o=C(t.x1,t.y1,t.x2,t.y2),n=o/2;return Kt(t,jsx("path",{d:`M 0 0 L ${n-8} 0 M ${n-8} -8 L ${n-8} 8 L ${n+8} 0 Z M ${n+8} -8 L ${n+8} 8 M ${n+8} 0 L ${o} 0`,fill:"none",stroke:St(t,e),strokeWidth:zt(t,e)}),e)});x("battery",(t,e)=>{let o=C(t.x1,t.y1,t.x2,t.y2),n=o/2;return Kt(t,jsxs(Fragment,{children:[jsx("path",{d:`M 0 0 L ${n-4} 0 M ${n-4} -16 L ${n-4} 16 M ${n+4} -8 L ${n+4} 8 M ${n+4} 0 L ${o} 0`,fill:"none",stroke:St(t,e),strokeWidth:zt(t,e)}),jsx("line",{x1:n+4,y1:-8,x2:n+4,y2:8,stroke:St(t,e),strokeWidth:zt(t,e)+2}),jsx("text",{x:n-12,y:-12,fontSize:"12",fill:St(t,e),textAnchor:"middle",children:"+"})]}),e)});["meter_v","meter_a"].forEach(t=>x(t,(e,o)=>{let n=C(e.x1,e.y1,e.x2,e.y2),r=n/2,i=t==="meter_v"?"V":"A";return Kt(e,jsxs(Fragment,{children:[jsx("path",{d:`M 0 0 L ${r-14} 0 M ${r+14} 0 L ${n} 0`,fill:"none",stroke:St(e,o),strokeWidth:zt(e,o)}),jsx("circle",{cx:r,cy:0,r:14,fill:"#f8f9fa",stroke:St(e,o),strokeWidth:zt(e,o)}),jsx("text",{x:r,y:0,textAnchor:"middle",dominantBaseline:"central",fill:St(e,o),fontSize:"14",fontWeight:"bold",children:i})]}),o)}));x("ground",(t,e)=>jsx("g",{transform:`translate(${t.x1}, ${t.y1})`,opacity:e?.isGhost?.5:1,children:jsx(I,{ctx:e,hitHalfSize:28,selectionHalfSize:34,children:jsx("path",{d:"M 0 0 L 0 15 M -12 15 L 12 15 M -8 20 L 8 20 M -4 25 L 4 25",fill:"none",stroke:St(t,e),strokeWidth:zt(t,e)})})}));var ho=t=>{let e={};return t.forEach(o=>{if(o.type!=="wire")return;let n=`${o.x1},${o.y1}`,r=`${o.x2},${o.y2}`;e[n]=(e[n]||0)+1,e[r]=(e[r]||0)+1;}),Object.entries(e).filter(([,o])=>o>2).map(([o])=>o.split(",").map(Number))};var _t=t=>t.color||"#0f172a",Xt=t=>t.strokeWidth||2,At=t=>t.fontSize||18,pe=t=>{let e=Math.sin(t)*1e4;return e-Math.floor(e)},gr=t=>{if(t.lineStyle==="dashed")return "6 6";if(t.lineStyle==="dotted")return "2 4"};x("pv_axes",(t,e)=>{let o=Math.min(t.x1,t.x2),n=Math.min(t.y1,t.y2),r=Math.max(1,Math.abs(t.x2-t.x1)),i=Math.max(1,Math.abs(t.y2-t.y1)),l=String(t.yLabel??"P"),a=String(t.xLabel??"V"),c=_t(t),d=Xt(t),y=At(t);return jsxs("g",{children:[jsxs("g",{transform:`translate(${o}, ${n})`,children:[jsx("line",{x1:0,y1:0,x2:0,y2:i,stroke:c,strokeWidth:d}),jsx("polygon",{points:"0,0 -5,10 5,10",fill:c}),jsx("text",{x:-15,y:10,fontSize:y,fill:c,fontWeight:"bold",children:l}),jsx("line",{x1:0,y1:i,x2:r,y2:i,stroke:c,strokeWidth:d}),jsx("polygon",{points:`${r},${i} ${r-10},${i-5} ${r-10},${i+5}`,fill:c}),jsx("text",{x:r-10,y:i+20,fontSize:y,fill:c,fontWeight:"bold",children:a}),jsx("text",{x:-10,y:i+15,fontSize:12,fill:c,children:"0"}),t.label?jsx("text",{x:r/2,y:-10,fontSize:y,fill:c,textAnchor:"middle",pointerEvents:"none",children:String(t.label)}):null]}),jsx(jt,{minX:o,minY:n,width:r,height:i,ctx:e}),jsx(k,{el:t,ctx:e})]})});x("piston_cylinder",(t,e)=>{let o=Math.min(t.x1,t.x2),n=Math.min(t.y1,t.y2),r=Math.max(1,Math.abs(t.x2-t.x1)),i=Math.max(1,Math.abs(t.y2-t.y1)),l=t.compression??.5,a=i*l,c=_t(t),d=Xt(t),y=[],h=40;for(let f=0;f<h;f++){let $=pe(Number(t.id)+f)*(r-10)+5,w=a+10+pe(Number(t.id)+f*100)*(i-a-15);y.push(jsx("circle",{cx:$,cy:w,r:"2",fill:"#94a3b8"},f));}return jsxs("g",{children:[jsxs("g",{transform:`translate(${o}, ${n})`,children:[jsx("polyline",{points:`0,0 0,${i} ${r},${i} ${r},0`,fill:"#f8fafc",stroke:c,strokeWidth:d,strokeLinecap:"square",strokeLinejoin:"miter",pointerEvents:"none"}),y,jsxs("g",{transform:`translate(0, ${a})`,children:[jsx("rect",{x:"2",y:"0",width:r-4,height:"12",fill:"#64748b",rx:"2"}),jsx("line",{x1:r/2,y1:"0",x2:r/2,y2:"-40",stroke:"#64748b",strokeWidth:"4"}),jsx("line",{x1:r/2-15,y1:"-40",x2:r/2+15,y2:"-40",stroke:"#64748b",strokeWidth:"6",strokeLinecap:"round"}),jsx("line",{x1:r/2,y1:"-50",x2:r/2,y2:"-42",stroke:"#ef4444",strokeWidth:"2"}),jsx("polygon",{points:`${r/2},-42 ${r/2-4},-46 ${r/2+4},-46`,fill:"#ef4444"})]}),t.showHeat?jsxs("g",{transform:`translate(${r/2}, ${i+15})`,children:[jsx("path",{d:"M-10,0 Q-15,-10 -5,-20 Q0,-10 10,-15 Q5,-5 10,0 Z",fill:"#ef4444",opacity:"0.8"}),jsx("path",{d:"M-5,0 Q-8,-6 0,-12 Q2,-5 5,0 Z",fill:"#f59e0b"}),jsx("text",{x:"25",y:"-5",fontSize:"14",fill:"#ef4444",fontWeight:"bold",children:"Q"})]}):null,t.label?jsx("text",{x:r/2,y:i+(t.showHeat?35:20),textAnchor:"middle",fill:c,fontSize:At(t),pointerEvents:"none",children:String(t.label)}):null]}),V(o,n,r,i,e),jsx(k,{el:t,ctx:e})]})});x("heat_engine",(t,e)=>{let o=Math.min(t.x1,t.x2),n=Math.min(t.y1,t.y2),r=Math.max(1,Math.abs(t.x2-t.x1)),i=Math.max(1,Math.abs(t.y2-t.y1)),l=t.engineType!=="refrigerator",a=Math.min(r*.3,i*.2),c=_t(t),d=Xt(t),y=At(t);return jsxs("g",{children:[jsxs("g",{transform:`translate(${o}, ${n})`,children:[jsx("rect",{x:0,y:0,width:r,height:i*.2,fill:"#ef4444",rx:"4",pointerEvents:"none"}),jsx("text",{x:r/2,y:i*.1,fontSize:y,fill:"#fff",textAnchor:"middle",dominantBaseline:"central",children:"T_H"}),jsx("rect",{x:0,y:i*.8,width:r,height:i*.2,fill:"#3b82f6",rx:"4"}),jsx("text",{x:r/2,y:i*.9,fontSize:y,fill:"#fff",textAnchor:"middle",dominantBaseline:"central",children:"T_C"}),jsx("circle",{cx:r/2,cy:i/2,r:a,fill:"#fff",stroke:c,strokeWidth:d}),jsx("text",{x:r/2,y:i/2,fontSize:y*1.2,fill:c,textAnchor:"middle",dominantBaseline:"central",fontWeight:"bold",children:l?"E":"R"}),jsxs("g",{strokeWidth:2,stroke:c,children:[jsx("line",{x1:r/2,y1:i*.2,x2:r/2,y2:i*.5-a-5}),jsx("polygon",{points:l?`${r/2},${i*.5-a-2} ${r/2-5},${i*.5-a-10} ${r/2+5},${i*.5-a-10}`:`${r/2},${i*.2+2} ${r/2-5},${i*.2+10} ${r/2+5},${i*.2+10}`,fill:c}),jsx("text",{x:r/2+10,y:i*.35,fontSize:14,fill:c,dominantBaseline:"central",children:"Q_H"}),jsx("line",{x1:r/2,y1:i*.5+a+5,x2:r/2,y2:i*.8}),jsx("polygon",{points:l?`${r/2},${i*.8-2} ${r/2-5},${i*.8-10} ${r/2+5},${i*.8-10}`:`${r/2},${i*.5+a+2} ${r/2-5},${i*.5+a+10} ${r/2+5},${i*.5+a+10}`,fill:c}),jsx("text",{x:r/2+10,y:i*.65,fontSize:14,fill:c,dominantBaseline:"central",children:"Q_C"}),jsx("line",{x1:l?r/2+a+5:r,y1:i/2,x2:l?r:r/2+a+5,y2:i/2}),jsx("polygon",{points:l?`${r},${i/2} ${r-8},${i/2-5} ${r-8},${i/2+5}`:`${r/2+a+5},${i/2} ${r/2+a+13},${i/2-5} ${r/2+a+13},${i/2+5}`,fill:c}),jsx("text",{x:r*.8,y:i/2-15,fontSize:14,fill:c,textAnchor:"middle",children:"W"})]}),t.label?jsx("text",{x:r/2,y:i+20,fontSize:y,fill:c,textAnchor:"middle",pointerEvents:"none",children:String(t.label)}):null]}),V(o,n,r,i,e),jsx(k,{el:t,ctx:e})]})});x("conduction_rod",(t,e)=>{let o=C(t.x1,t.y1,t.x2,t.y2),n=L(t.x1,t.y1,t.x2,t.y2),r=`grad-rod-${t.id}`,i=_t(t),l=Xt(t),a=At(t);return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${n})`,children:[jsx("defs",{children:jsxs("linearGradient",{id:r,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[jsx("stop",{offset:"0%",stopColor:"#ef4444"}),jsx("stop",{offset:"100%",stopColor:"#3b82f6"})]})}),jsx("rect",{x:0,y:-20,width:o,height:40,fill:`url(#${r})`,stroke:i,strokeWidth:l,rx:"4",pointerEvents:"none"}),jsxs("g",{stroke:"#fff",strokeWidth:"2",opacity:.6,children:[jsx("line",{x1:o*.2,y1:0,x2:o*.4,y2:0}),jsx("polygon",{points:`${o*.4},0 ${o*.4-6},-4 ${o*.4-6},4`,fill:"#fff"}),jsx("line",{x1:o*.6,y1:0,x2:o*.8,y2:0}),jsx("polygon",{points:`${o*.8},0 ${o*.8-6},-4 ${o*.8-6},4`,fill:"#fff"})]}),jsx("text",{x:0,y:-30,fontSize:a,fill:"#ef4444",textAnchor:"middle",fontWeight:"bold",children:"T_H"}),jsx("text",{x:o,y:-30,fontSize:a,fill:"#3b82f6",textAnchor:"middle",fontWeight:"bold",children:"T_C"}),t.label?jsx("text",{x:o/2,y:35,fontSize:a,fill:i,textAnchor:"middle",pointerEvents:"none",children:String(t.label)}):null]}),jsx(k,{el:t,ctx:e,padY:48})]})});x("thermo_process",(t,e)=>{let o=t.processType||"isotherm",n=t.x2-t.x1,r=t.y2-t.y1,i=o==="isobaric"?`M 0 0 L ${n} 0`:o==="isochoric"?`M 0 0 L 0 ${r}`:o==="adiabatic"?`M 0 0 Q ${n*.1} ${r*.9} ${n} ${r}`:`M 0 0 Q ${n*.2} ${r*.8} ${n} ${r}`,l=n/2,a=r/2;if(o==="isotherm"||o==="adiabatic"){let $=n*(o==="adiabatic"?.1:.2),w=r*(o==="adiabatic"?.9:.8);l=.25*0+.5*$+.25*n,a=.25*0+.5*w+.25*r;}let c=Math.atan2(r,n)*180/Math.PI,d=gr(t),y=_t(t),h=Xt(t),f=At(t);return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx(q,{dPath:i,strokeWidth:22,strokeLinejoin:"round",strokeLinecap:"round"}),jsx("path",{d:i,fill:"none",stroke:y,strokeWidth:h,strokeDasharray:d,pointerEvents:"none"}),jsx("g",{transform:`translate(${l}, ${a}) rotate(${c})`,children:jsx("polygon",{points:"0,0 -8,-5 -8,5",fill:y,pointerEvents:"none"})}),t.label?jsx("text",{x:l+15,y:a-10,fontSize:f,fill:y,pointerEvents:"none",children:String(t.label)}):null]}),jsx(k,{el:t,ctx:e})]})});x("carnot_cycle",(t,e)=>{let o=Math.min(t.x1,t.x2),n=Math.min(t.y1,t.y2),r=Math.max(1,Math.abs(t.x2-t.x1)),i=Math.max(1,Math.abs(t.y2-t.y1)),l={x:r*.1,y:i*.1},a={x:r*.6,y:i*.3},c={x:r*.9,y:i*.9},d={x:r*.4,y:i*.7},y=`M ${l.x} ${l.y} Q ${r*.3} ${i*.15} ${a.x} ${a.y}`,h=`Q ${r*.7} ${i*.6} ${c.x} ${c.y}`,f=`Q ${r*.6} ${i*.85} ${d.x} ${d.y}`,$=`Q ${r*.2} ${i*.4} ${l.x} ${l.y}`,w=_t(t),W=Xt(t),P=At(t);return jsxs("g",{children:[jsxs("g",{transform:`translate(${o}, ${n})`,children:[jsx("path",{d:`${y} ${h} ${f} ${$} Z`,fill:w,fillOpacity:.1,pointerEvents:"none"}),jsx("path",{d:y,fill:"none",stroke:"#ef4444",strokeWidth:W,pointerEvents:"none"}),jsx("path",{d:`M ${a.x} ${a.y} ${h}`,fill:"none",stroke:"#64748b",strokeWidth:W,strokeDasharray:"4 4",pointerEvents:"none"}),jsx("path",{d:`M ${c.x} ${c.y} ${f}`,fill:"none",stroke:"#3b82f6",strokeWidth:W,pointerEvents:"none"}),jsx("path",{d:`M ${d.x} ${d.y} ${$}`,fill:"none",stroke:"#64748b",strokeWidth:W,strokeDasharray:"4 4",pointerEvents:"none"}),jsx("circle",{cx:l.x,cy:l.y,r:"3",fill:"#1e293b",pointerEvents:"none"}),jsx("circle",{cx:a.x,cy:a.y,r:"3",fill:"#1e293b",pointerEvents:"none"}),jsx("circle",{cx:c.x,cy:c.y,r:"3",fill:"#1e293b",pointerEvents:"none"}),jsx("circle",{cx:d.x,cy:d.y,r:"3",fill:"#1e293b",pointerEvents:"none"}),jsx("text",{x:r*.4,y:i*.15,fontSize:"14",fill:"#ef4444",fontWeight:"bold",children:"T_H"}),jsx("text",{x:r*.6,y:i*.95,fontSize:"14",fill:"#3b82f6",fontWeight:"bold",children:"T_C"}),jsx("text",{x:r/2,y:i/2+5,fontSize:16,fill:w,textAnchor:"middle",fontWeight:"bold",children:"W"}),t.label?jsx("text",{x:r/2,y:-15,fontSize:P,fill:w,textAnchor:"middle",pointerEvents:"none",children:String(t.label)}):null]}),V(o,n,r,i,e),jsx(k,{el:t,ctx:e})]})});x("maxwell_boltzmann",(t,e)=>{let o=Math.min(t.x1,t.x2),n=Math.min(t.y1,t.y2),r=Math.max(1,Math.abs(t.x2-t.x1)),i=Math.max(1,Math.abs(t.y2-t.y1)),l=t.t1||300,a=t.t2||600,c=Xt(t),d=At(t),y=_t(t),h=(f,$,w,W)=>{let P=`M 0 ${i}`,Q=1/f,j=Math.sqrt(2/Q),F=j*3.5;for(let G=0;G<=r;G+=2){let u=G/r*F,U=u*u*Math.exp(-Q*u*u),yt=j*j*Math.exp(-1),st=i-U/yt*$;P+=` L ${G} ${st}`;}return jsx("path",{d:P,fill:"none",stroke:w,strokeWidth:c,strokeDasharray:W,strokeLinejoin:"round",pointerEvents:"none"})};return jsxs("g",{children:[jsxs("g",{transform:`translate(${o}, ${n})`,children:[jsx("line",{x1:0,y1:0,x2:0,y2:i,stroke:"#1e293b",strokeWidth:"2"}),jsx("line",{x1:0,y1:i,x2:r,y2:i,stroke:"#1e293b",strokeWidth:"2"}),jsx("text",{x:-25,y:i/2,fontSize:14,fill:"#1e293b",transform:`rotate(-90, -25, ${i/2})`,textAnchor:"middle",children:"N(v)"}),jsx("text",{x:r/2,y:i+20,fontSize:14,fill:"#1e293b",textAnchor:"middle",children:"Speed (v)"}),h(l,i*.8,"#ef4444"),h(a,i*.5,"#3b82f6","4 4"),jsx("rect",{x:r-70,y:10,width:10,height:10,fill:"#ef4444"}),jsxs("text",{x:r-55,y:20,fontSize:12,fill:"#1e293b",children:["T\u2081 = ",l,"K"]}),jsx("rect",{x:r-70,y:30,width:10,height:10,fill:"#3b82f6"}),jsxs("text",{x:r-55,y:40,fontSize:12,fill:"#1e293b",children:["T\u2082 = ",a,"K"]}),t.label?jsx("text",{x:r/2,y:-15,fontSize:d,fill:y,textAnchor:"middle",pointerEvents:"none",children:String(t.label)}):null]}),jsx(jt,{minX:o,minY:n,width:r,height:i,ctx:e}),jsx(k,{el:t,ctx:e})]})});x("diatomic_gas",(t,e)=>{let o=_t(t),n=At(t),r=t.showRotations!==false;return jsx("g",{transform:`translate(${t.x1}, ${t.y1})`,children:jsxs(I,{ctx:e,hitHalfSize:38,selectionHalfSize:46,children:[jsx("circle",{cx:-15,cy:0,r:8,fill:o,stroke:"#fff",strokeWidth:2,pointerEvents:"none"}),jsx("circle",{cx:15,cy:0,r:8,fill:o,stroke:"#fff",strokeWidth:2,pointerEvents:"none"}),jsx("line",{x1:-10,y1:0,x2:10,y2:0,stroke:o,strokeWidth:4,pointerEvents:"none"}),r?jsxs("g",{stroke:"#94a3b8",strokeWidth:1.5,fill:"none",pointerEvents:"none",children:[jsx("path",{d:"M -10 -15 A 15 15 0 0 1 10 -15",strokeDasharray:"2 2"}),jsx("polygon",{points:"10,-15 6,-18 6,-12",fill:"#94a3b8"}),jsx("path",{d:"M -25 0 A 25 10 0 0 1 0 10 A 25 10 0 0 1 25 0",strokeDasharray:"2 2"})]}):null,t.label?jsx("text",{x:0,y:25,fontSize:n,fill:o,textAnchor:"middle",pointerEvents:"none",children:String(t.label)}):null]})})});x("random_walk",(t,e)=>{let o=t.steps||5,n=Math.hypot(t.x2-t.x1,t.y2-t.y1),r="M 0 0",i=0,l=0,a=[jsx("circle",{cx:"0",cy:"0",r:"4",fill:"#22c55e",pointerEvents:"none"},"start")];for(let c=1;c<=o;c++){let d=pe(Number(t.id)+c*7)*Math.PI*2,y=n/o*(.5+pe(Number(t.id)+c*13));i+=Math.cos(d)*y,l+=Math.sin(d)*y,r+=` L ${i} ${l}`,a.push(jsx("circle",{cx:i,cy:l,r:c===o?4:2,fill:c===o?"#ef4444":_t(t),pointerEvents:"none"},c));}return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1})`,children:[jsx(q,{dPath:r,strokeWidth:20,strokeLinejoin:"round"}),jsx("path",{d:r,fill:"none",stroke:_t(t),strokeWidth:Xt(t),strokeLinejoin:"round",pointerEvents:"none"}),a,t.label?jsx("text",{x:n/2,y:n/2,fontSize:At(t),fill:_t(t),textAnchor:"middle",pointerEvents:"none",children:String(t.label)}):null]}),jsx(k,{el:t,ctx:e,padX:Math.max(40,n),padY:Math.max(40,n)})]})});var xt=(t,e)=>e?"#0d9488":t.color||"#111827",wt=(t,e)=>{let o=t.strokeWidth||2;return e?Math.max(3,o):o},we=t=>t.fontSize||16,se=(t,e,o)=>Array.from({length:t}).map((n,r)=>{let i=(r*360/t+o)*(Math.PI/180);return `${e*Math.cos(i)},${e*Math.sin(i)}`}).join(" ");x("atom",(t,e)=>jsx("g",{transform:`translate(${t.x1}, ${t.y1})`,children:jsxs(I,{ctx:e,hitHalfSize:22,selectionHalfSize:30,children:[jsx("rect",{x:"-20",y:"-15",width:"40",height:"30",fill:"white",rx:"6"}),jsx("text",{x:"0",y:"0",dominantBaseline:"central",textAnchor:"middle",fill:xt(t,e.isSelected),fontSize:Math.max(18,we(t)),fontFamily:"sans-serif",fontWeight:"bold",children:String(t.label||"C")})]})}));x("charge_plus",(t,e)=>{let o=xt(t,e.isSelected),n=wt(t,e.isSelected),r=t.strokeWidth||2,i=Math.max(12,r*4),l=Math.max(28,i+(t.label?26:8));return jsx("g",{transform:`translate(${t.x1}, ${t.y1})`,children:jsxs(I,{ctx:e,hitHalfSize:l,selectionHalfSize:l+10,children:[jsx("circle",{cx:"0",cy:"0",r:i,fill:"white",stroke:o,strokeWidth:n}),jsx("line",{x1:-i/2,y1:"0",x2:i/2,y2:"0",stroke:o,strokeWidth:n}),jsx("line",{x1:"0",y1:-i/2,x2:"0",y2:i/2,stroke:o,strokeWidth:n}),t.label?jsx("text",{x:"0",y:i+18,fontSize:we(t),fill:o,fontFamily:"sans-serif",fontWeight:"bold",textAnchor:"middle",children:String(t.label)}):null]})})});x("charge_minus",(t,e)=>{let o=xt(t,e.isSelected),n=wt(t,e.isSelected),r=t.strokeWidth||2,i=Math.max(12,r*4),l=Math.max(28,i+(t.label?26:8));return jsx("g",{transform:`translate(${t.x1}, ${t.y1})`,children:jsxs(I,{ctx:e,hitHalfSize:l,selectionHalfSize:l+10,children:[jsx("circle",{cx:"0",cy:"0",r:i,fill:"white",stroke:o,strokeWidth:n}),jsx("line",{x1:-i/2,y1:"0",x2:i/2,y2:"0",stroke:o,strokeWidth:n}),t.label?jsx("text",{x:"0",y:i+18,fontSize:we(t),fill:o,fontFamily:"sans-serif",fontWeight:"bold",textAnchor:"middle",children:String(t.label)}):null]})})});x("radical",(t,e)=>jsx("g",{transform:`translate(${t.x1}, ${t.y1})`,children:jsx(I,{ctx:e,hitHalfSize:14,selectionHalfSize:22,children:jsx("circle",{cx:"0",cy:"0",r:"3.5",fill:xt(t,e.isSelected)})})}));x("lone_pair",(t,e)=>jsx("g",{transform:`translate(${t.x1}, ${t.y1})`,children:jsxs(I,{ctx:e,hitHalfSize:16,selectionHalfSize:24,children:[jsx("circle",{cx:"-4",cy:"0",r:"2.5",fill:xt(t,e.isSelected)}),jsx("circle",{cx:"4",cy:"0",r:"2.5",fill:xt(t,e.isSelected)})]})}));x("benzene",(t,e)=>{let n=xt(t,e.isSelected),r=wt(t,e.isSelected);return jsx("g",{transform:`translate(${t.x1}, ${t.y1})`,children:jsxs(I,{ctx:e,hitHalfSize:36,selectionHalfSize:44,children:[jsx("polygon",{points:se(6,30,-30),fill:"white",stroke:n,strokeWidth:r,strokeLinejoin:"round"}),jsx("circle",{cx:"0",cy:"0",r:20,fill:"none",stroke:n,strokeWidth:r})]})})});x("cyclohexane",(t,e)=>jsx("g",{transform:`translate(${t.x1}, ${t.y1})`,children:jsx(I,{ctx:e,hitHalfSize:36,selectionHalfSize:44,children:jsx("polygon",{points:se(6,30,-30),fill:"white",stroke:xt(t,e.isSelected),strokeWidth:wt(t,e.isSelected),strokeLinejoin:"round"})})}));x("cyclopentane",(t,e)=>jsx("g",{transform:`translate(${t.x1}, ${t.y1})`,children:jsx(I,{ctx:e,hitHalfSize:36,selectionHalfSize:44,children:jsx("polygon",{points:se(5,30,-90),fill:"white",stroke:xt(t,e.isSelected),strokeWidth:wt(t,e.isSelected),strokeLinejoin:"round"})})}));x("cyclobutane",(t,e)=>jsx("g",{transform:`translate(${t.x1}, ${t.y1})`,children:jsx(I,{ctx:e,hitHalfSize:36,selectionHalfSize:44,children:jsx("polygon",{points:se(4,30,-45),fill:"white",stroke:xt(t,e.isSelected),strokeWidth:wt(t,e.isSelected),strokeLinejoin:"round"})})}));x("cyclopropane",(t,e)=>jsx("g",{transform:`translate(${t.x1}, ${t.y1})`,children:jsx(I,{ctx:e,hitHalfSize:36,selectionHalfSize:44,children:jsx("polygon",{points:se(3,30,-90),fill:"white",stroke:xt(t,e.isSelected),strokeWidth:wt(t,e.isSelected),strokeLinejoin:"round"})})}));var ae=(t,e,o)=>{let n=C(t.x1,t.y1,t.x2,t.y2),r=L(t.x1,t.y1,t.x2,t.y2),i=xt(t,o),l=wt(t,o);return jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${r})`,children:[e==="single"&&jsx("line",{x1:"0",y1:"0",x2:n,y2:"0",stroke:i,strokeWidth:l,strokeLinecap:"round"}),e==="double"&&jsxs(Fragment,{children:[jsx("line",{x1:"0",y1:"-3.5",x2:n,y2:"-3.5",stroke:i,strokeWidth:l,strokeLinecap:"round"}),jsx("line",{x1:"0",y1:"3.5",x2:n,y2:"3.5",stroke:i,strokeWidth:l,strokeLinecap:"round"})]}),e==="triple"&&jsxs(Fragment,{children:[jsx("line",{x1:"0",y1:"-6",x2:n,y2:"-6",stroke:i,strokeWidth:l,strokeLinecap:"round"}),jsx("line",{x1:"0",y1:"0",x2:n,y2:"0",stroke:i,strokeWidth:l,strokeLinecap:"round"}),jsx("line",{x1:"0",y1:"6",x2:n,y2:"6",stroke:i,strokeWidth:l,strokeLinecap:"round"})]}),e==="wedge"&&jsx("polygon",{points:`0,0 ${n},-5 ${n},5`,fill:i}),e==="dash"&&jsx("line",{x1:"0",y1:"0",x2:n,y2:"0",stroke:i,strokeWidth:l+1,strokeDasharray:"5 5",strokeLinecap:"square"})]})};x("single_bond",(t,e)=>jsxs("g",{children:[ae(t,"single",e.isSelected),jsx(k,{el:t,ctx:e})]}));x("double_bond",(t,e)=>jsxs("g",{children:[ae(t,"double",e.isSelected),jsx(k,{el:t,ctx:e})]}));x("triple_bond",(t,e)=>jsxs("g",{children:[ae(t,"triple",e.isSelected),jsx(k,{el:t,ctx:e})]}));x("wedge_bond",(t,e)=>jsxs("g",{children:[ae(t,"wedge",e.isSelected),jsx(k,{el:t,ctx:e})]}));x("dash_bond",(t,e)=>jsxs("g",{children:[ae(t,"dash",e.isSelected),jsx(k,{el:t,ctx:e})]}));var po=t=>({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2});x("reaction_arrow",(t,e)=>{let o=C(t.x1,t.y1,t.x2,t.y2),n=L(t.x1,t.y1,t.x2,t.y2),r=xt(t,e.isSelected),i=wt(t,e.isSelected),l=po(t);return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${n})`,children:[jsx("line",{x1:"0",y1:"0",x2:o,y2:"0",stroke:r,strokeWidth:i}),jsx("polygon",{points:`${o},0 ${o-12},-6 ${o-12},6`,fill:r})]}),jsx(k,{el:t,ctx:e}),t.label?jsx("text",{x:l.x,y:l.y-18,textAnchor:"middle",fill:"#0f766e",fontSize:"14",fontFamily:"sans-serif",fontWeight:"bold",pointerEvents:"none",children:String(t.label)}):null,t.value?jsx("text",{x:l.x,y:l.y+18,textAnchor:"middle",fill:"#4b5563",fontSize:"13",fontFamily:"sans-serif",pointerEvents:"none",children:String(t.value)}):null]})});x("equilibrium_arrow",(t,e)=>{let o=C(t.x1,t.y1,t.x2,t.y2),n=L(t.x1,t.y1,t.x2,t.y2),r=xt(t,e.isSelected),i=wt(t,e.isSelected),l=po(t);return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${n})`,children:[jsx("line",{x1:"0",y1:"-4",x2:o,y2:"-4",stroke:r,strokeWidth:i}),jsx("polygon",{points:`${o},-4 ${o-10},-10 ${o-10},-4`,fill:r}),jsx("line",{x1:"0",y1:"4",x2:o,y2:"4",stroke:r,strokeWidth:i}),jsx("polygon",{points:"0,4 10,4 10,10",fill:r})]}),jsx(k,{el:t,ctx:e}),t.label?jsx("text",{x:l.x,y:l.y-18,textAnchor:"middle",fill:"#0f766e",fontSize:"14",fontFamily:"sans-serif",fontWeight:"bold",pointerEvents:"none",children:String(t.label)}):null,t.value?jsx("text",{x:l.x,y:l.y+18,textAnchor:"middle",fill:"#4b5563",fontSize:"13",fontFamily:"sans-serif",pointerEvents:"none",children:String(t.value)}):null]})});x("resonance_arrow",(t,e)=>{let o=C(t.x1,t.y1,t.x2,t.y2),n=L(t.x1,t.y1,t.x2,t.y2),r=xt(t,e.isSelected),i=wt(t,e.isSelected);return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${n})`,children:[jsx("line",{x1:"0",y1:"0",x2:o,y2:"0",stroke:r,strokeWidth:i}),jsx("polygon",{points:"0,0 12,-6 12,6",fill:r}),jsx("polygon",{points:`${o},0 ${o-12},-6 ${o-12},6`,fill:r})]}),jsx(k,{el:t,ctx:e})]})});x("curved_arrow",(t,e)=>{let o=C(t.x1,t.y1,t.x2,t.y2),n=L(t.x1,t.y1,t.x2,t.y2),r=o/3,i=Math.atan2(r,o/2)*(180/Math.PI),l=xt(t,e.isSelected),a=wt(t,e.isSelected),c=`M 0 0 Q ${o/2} ${-r} ${o} 0`,d=Jt(t.x1,t.y1,t.x2,t.y2,r/2);return jsxs("g",{children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${n})`,children:[jsx("path",{d:c,fill:"none",stroke:l,strokeWidth:a}),jsx(q,{dPath:c,strokeWidth:24,strokeLinecap:"round"}),jsx("g",{transform:`translate(${o}, 0) rotate(${i})`,children:jsx("polygon",{points:"0,0 -12,-6 -12,6",fill:l})})]}),e.isSelected&&!e.viewMode&&!e.isGhost?Dt(d.x,d.y,d.width,d.height):null,Nt(t,e)]})});var Vt=(t,e)=>e?"#2563eb":t.color||"#0f172a",Tt=(t,e)=>e?2.5:t.strokeWidth||2,fo=(t,e,o)=>{let n=C(t.x1,t.y1,t.x2,t.y2),r=L(t.x1,t.y1,t.x2,t.y2),i=t.x2-t.x1,l=t.y2-t.y1,a=(t.x1+t.x2)/2,c=(t.y1+t.y2)/2,d=-l/(n||1),y=i/(n||1);y>0&&(d=-d,y=-y);let h=18,f=Vt(t,o);return jsxs("g",{children:[jsx("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${r})`,children:e}),t.label&&jsx("text",{x:a+d*h,y:c+y*h,dominantBaseline:"central",textAnchor:"middle",fill:f,fontSize:14,fontFamily:"sans-serif",children:String(t.label)})]})};x("charge_pos",(t,e)=>{let o=e.isSelected?"#2563eb":"#ef4444";return jsx("g",{transform:`translate(${t.x1}, ${t.y1})`,opacity:e?.isGhost?.5:1,children:jsxs(I,{ctx:e,hitHalfSize:22,selectionHalfSize:28,children:[jsx("circle",{cx:"0",cy:"0",r:"10",fill:"#fecaca",stroke:o,strokeWidth:Tt(t,e.isSelected)}),jsx("line",{x1:"0",y1:"-4",x2:"0",y2:"4",stroke:o,strokeWidth:2}),jsx("line",{x1:"-4",y1:"0",x2:"4",y2:"0",stroke:o,strokeWidth:2}),t.label?jsx("text",{x:0,y:-16,textAnchor:"middle",fill:o,fontSize:t.fontSize||14,children:String(t.label)}):null]})})});x("charge_neg",(t,e)=>{let o=e.isSelected?"#2563eb":"#3b82f6";return jsx("g",{transform:`translate(${t.x1}, ${t.y1})`,opacity:e?.isGhost?.5:1,children:jsxs(I,{ctx:e,hitHalfSize:22,selectionHalfSize:28,children:[jsx("circle",{cx:"0",cy:"0",r:"10",fill:"#bfdbfe",stroke:o,strokeWidth:Tt(t,e.isSelected)}),jsx("line",{x1:"-4",y1:"0",x2:"4",y2:"0",stroke:o,strokeWidth:2}),t.label?jsx("text",{x:0,y:-16,textAnchor:"middle",fill:o,fontSize:t.fontSize||14,children:String(t.label)}):null]})})});x("dipole",(t,e)=>{let o=Tt(t,e.isSelected);return jsxs("g",{opacity:e?.isGhost?.5:1,children:[jsx("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:"#64748b",strokeWidth:o,strokeDasharray:"4 4"}),jsx("circle",{cx:t.x1,cy:t.y1,r:"8",fill:"#fecaca",stroke:e.isSelected?"#2563eb":"#ef4444",strokeWidth:o}),jsx("circle",{cx:t.x2,cy:t.y2,r:"8",fill:"#bfdbfe",stroke:e.isSelected?"#2563eb":"#3b82f6",strokeWidth:o}),t.label?jsx("text",{x:(t.x1+t.x2)/2,y:t.y1-16,textAnchor:"middle",fill:"#475569",fontSize:14,children:String(t.label)}):null,jsx(k,{el:t,ctx:e})]})});var uo=(t,e)=>{let o=Math.max(2,Math.floor(t/25)),n=[];for(let r=0;r<=o;r++){let i=r/o*t;n.push(jsx("g",{transform:`translate(${i}, 0)`,children:e?jsx(Fragment,{children:jsx("path",{d:"M-4 0 h8 M0 -4 v8",stroke:"#ffffff",strokeWidth:"2",strokeLinecap:"round"})}):jsx("path",{d:"M-4 0 h8",stroke:"#ffffff",strokeWidth:"2",strokeLinecap:"round"})},r));}return n};x("charged_plate_pos",(t,e)=>{let o=e.isSelected?"#2563eb":"#ef4444",n=C(t.x1,t.y1,t.x2,t.y2),r=L(t.x1,t.y1,t.x2,t.y2),i=Math.max(12,t.strokeWidth*4||8);return jsxs("g",{opacity:e?.isGhost?.5:1,children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${r})`,children:[jsx("line",{x1:0,y1:0,x2:n,y2:0,stroke:o,strokeWidth:i,strokeLinecap:"round"}),uo(n,true)]}),jsx(k,{el:t,ctx:e})]})});x("charged_plate_neg",(t,e)=>{let o=e.isSelected?"#2563eb":"#3b82f6",n=C(t.x1,t.y1,t.x2,t.y2),r=L(t.x1,t.y1,t.x2,t.y2),i=Math.max(12,t.strokeWidth*4||8);return jsxs("g",{opacity:e?.isGhost?.5:1,children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${r})`,children:[jsx("line",{x1:0,y1:0,x2:n,y2:0,stroke:o,strokeWidth:i,strokeLinecap:"round"}),uo(n,false)]}),jsx(k,{el:t,ctx:e})]})});x("gaussian_sphere",(t,e)=>{let o=Math.max(10,C(t.x1,t.y1,t.x2,t.y2)),n=e.isSelected?"#2563eb":"#10b981";return jsxs("g",{opacity:e?.isGhost?.5:1,children:[jsx("circle",{cx:t.x1,cy:t.y1,r:o,fill:"#d1fae5",fillOpacity:.35,stroke:n,strokeWidth:Tt(t,e.isSelected),strokeDasharray:"5 5"}),t.label?jsx("text",{x:t.x1,y:t.y1-o-12,textAnchor:"middle",fill:n,fontSize:13,children:String(t.label)}):null,jsx(k,{el:t,ctx:e})]})});x("gaussian_cylinder",(t,e)=>{let o=C(t.x1,t.y1,t.x2,t.y2),n=L(t.x1,t.y1,t.x2,t.y2),r=t.curveHeight??40,i=15,l=e.isSelected?"#2563eb":"#10b981",a=Tt(t,e.isSelected),c="6 6";return jsxs("g",{opacity:e?.isGhost?.5:1,children:[jsxs("g",{transform:`translate(${t.x1}, ${t.y1}) rotate(${n})`,children:[jsx("line",{x1:0,y1:-r,x2:o,y2:-r,stroke:l,strokeWidth:a,strokeDasharray:c}),jsx("line",{x1:0,y1:r,x2:o,y2:r,stroke:l,strokeWidth:a,strokeDasharray:c}),jsx("ellipse",{cx:0,cy:0,rx:i,ry:r,fill:l,fillOpacity:.05,stroke:l,strokeWidth:a,strokeDasharray:c}),jsx("ellipse",{cx:o,cy:0,rx:i,ry:r,fill:l,fillOpacity:.05,stroke:l,strokeWidth:a,strokeDasharray:c}),t.label?jsx("text",{x:o/2,y:-r-10,textAnchor:"middle",fill:l,fontSize:t.fontSize||14,children:String(t.label)}):null]}),jsx(k,{el:t,ctx:e})]})});x("mirror_plane",(t,e)=>jsxs("g",{children:[fo(t,jsxs(Fragment,{children:[jsx("line",{x1:0,y1:-24,x2:0,y2:24,stroke:Vt(t,e.isSelected),strokeWidth:Tt(t,e.isSelected)}),jsx("line",{x1:0,y1:-18,x2:-8,y2:-12,stroke:Vt(t,e.isSelected),strokeWidth:1.5}),jsx("line",{x1:0,y1:-6,x2:-8,y2:0,stroke:Vt(t,e.isSelected),strokeWidth:1.5}),jsx("line",{x1:0,y1:6,x2:-8,y2:12,stroke:Vt(t,e.isSelected),strokeWidth:1.5}),jsx("line",{x1:0,y1:18,x2:-8,y2:24,stroke:Vt(t,e.isSelected),strokeWidth:1.5})]}),e.isSelected),jsx(k,{el:t,ctx:e})]}));x("energy_level",(t,e)=>{let o=Math.max(24,C(t.x1,t.y1,t.x2,t.y2)),n=Vt(t,e.isSelected),r=t.energy!=null?String(t.energy):"";return jsxs("g",{children:[fo(t,jsxs(Fragment,{children:[jsx("line",{x1:0,y1:-8,x2:o,y2:-8,stroke:n,strokeWidth:Tt(t,e.isSelected)}),jsx("line",{x1:0,y1:8,x2:o,y2:8,stroke:n,strokeWidth:Tt(t,e.isSelected)}),r?jsx("text",{x:o/2,y:22,textAnchor:"middle",fontSize:10,fill:"#4b5563",children:r}):null]}),e.isSelected),jsx(k,{el:t,ctx:e})]})});var vr=({x:t,y:e,type:o})=>jsxs("g",{children:[jsx("rect",{x:t-20,y:e-12,width:40,height:24,fill:"#fee2e2",stroke:"#ef4444"}),jsx("text",{x:t,y:e,textAnchor:"middle",dominantBaseline:"central",fontSize:10,fill:"#991b1b",children:o})]}),fe=({elements:t,selectedId:e,drawing:o,viewMode:n=false,showGrid:r=true,gridSize:i=20,className:l,svgRef:a,onBackgroundMouseDown:c,onBackgroundMouseMove:d,onBackgroundMouseUp:y,onBackgroundMouseLeave:h,onElementMouseDown:f,onHandlePointerDown:$})=>{let w=useMemo(()=>ho(t),[t]);return jsxs("svg",{ref:a,className:l,onMouseDown:c,onMouseMove:d,onMouseUp:y,onMouseLeave:h,children:[!n&&r&&jsxs(Fragment,{children:[jsx("defs",{children:jsx("pattern",{id:"svg-engine-grid",width:i,height:i,patternUnits:"userSpaceOnUse",children:jsx("path",{d:`M ${i} 0 L 0 0 0 ${i}`,fill:"none",stroke:"#e2e8f0",strokeWidth:"1"})})}),jsx("rect",{width:"100%",height:"100%",fill:"url(#svg-engine-grid)",pointerEvents:"none"})]}),t.map(W=>{let P=$e(String(W.type)),Q={isSelected:e===W.id,viewMode:n,onHandlePointerDown:!n&&$?(F,G,u)=>$(F,W,G,u):void 0},j=P?P(W,Q):jsx(vr,{x:W.x1,y:W.y1,type:String(W.type)});return jsx("g",{onMouseDown:F=>f?.(F,W),cursor:n?"default":"move",children:j},String(W.id))}),w.map(([W,P],Q)=>jsx("circle",{cx:W,cy:P,r:4,fill:"#111827",pointerEvents:"none"},`junction-${Q}`)),o&&(()=>{let W=$e(String(o.type));return W?jsx("g",{opacity:.5,children:W(o,{isGhost:true,viewMode:n,onHandlePointerDown:void 0})}):null})()]})};var bo=10,Sr=t=>{let e={x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2},o=t.cps;return o?.length?{...e,cps:o.map(n=>({x:n.x,y:n.y}))}:e},Mr=(t,e,o,n,r)=>{let i=String(e);if(i.endsWith("-start")){let a=i.slice(0,-6);return t.map(c=>String(c.id)===a?{...c,x1:r.x1+o,y1:r.y1+n}:c)}if(i.endsWith("-end")){let a=i.slice(0,-4);return t.map(c=>String(c.id)===a?{...c,x2:r.x2+o,y2:r.y2+n}:c)}let l=i.match(/^(.*)-cp-(\d+)$/);if(l&&r.cps){let a=l[1],c=Number(l[2]);return t.map(d=>{if(String(d.id)!==a)return d;let y=r.cps.map((h,f)=>f===c?{x:h.x+o,y:h.y+n}:{...h});return {...d,cps:y}})}return t.map(a=>a.id===e||String(a.id)===i?{...a,x1:r.x1+o,y1:r.y1+n,x2:r.x2+o,y2:r.y2+n,...r.cps?{cps:r.cps.map(c=>({x:c.x+o,y:c.y+n}))}:{}}:a)},wr=t=>{let e="#0f172a";["spring","sine_wave","wavefronts","shm_graph"].includes(t)&&(e="#3b82f6"),["standing_wave","wave_pulse","torsion_pendulum"].includes(t)&&(e="#ec4899"),["pendulum","phasor"].includes(t)&&(e="#8b5cf6"),["wall","vane_liquid"].includes(t)&&(e="#64748b"),t==="mass_box"&&(e="#ef4444");let o={color:e,strokeWidth:2,fontSize:18};switch(t){case "standing_wave":case "sine_wave":return {...o,amplitude:40,loops:2};case "damped_wave":return {...o,amplitude:50,damping:.015,frequency:10};case "shm_graph":return {...o,amplitude:40,loops:1,graphType:"all"};case "energy_graph":return {...o,amplitude:50,loops:1,domain:"time"};case "strobe_shm":return {...o,amplitude:40,loops:1};case "beats_graph":return {...o,amplitude:30,frequency:15,beatFreq:2};case "wavefronts":return {...o,velocityRatio:.5,rings:5};case "mach_cone":return {...o,machNumber:2};case "mass_box":return {...o,size:30};case "pendulum":return {...o,size:15,showForces:false};case "phasor":return {...o,showProjection:false};case "spring":return {...o,coils:8};case "text":return {...o,label:"Equation/Label"};default:return o}},ko=(t,e)=>{if(e==="waveOscillation")return wr(t);switch(t){case "charge_pos":return {color:"#ef4444",strokeWidth:2,fontSize:18};case "charge_neg":return {color:"#3b82f6",strokeWidth:2,fontSize:18};case "charge_plus":return {color:"#ef4444",strokeWidth:2,fontSize:16};case "charge_minus":return {color:"#3b82f6",strokeWidth:2,fontSize:16};case "dipole":return {color:"#64748b",strokeWidth:2};case "charged_plate_pos":return {color:"#ef4444",strokeWidth:2};case "charged_plate_neg":return {color:"#3b82f6",strokeWidth:2};case "gaussian_sphere":return {color:"#10b981",strokeWidth:2};case "gaussian_cylinder":return {color:"#10b981",strokeWidth:2,curveHeight:40};case "vector":case "ray":case "photon":return e==="graph"?{color:"#0f172a",strokeWidth:2}:e==="mechanics"?{color:"#0f172a",strokeWidth:2}:e==="rotation"?{color:"#ef4444",strokeWidth:2}:e==="light"&&(t==="ray"||t==="photon")?{color:"#ef4444",strokeWidth:2}:e==="light"?{color:"#0f172a",strokeWidth:2}:{color:"#ef4444",strokeWidth:2};case "lens_convex":case "lens_concave":case "prism":case "glass_slab":return {color:"#38bdf8",strokeWidth:2};case "mirror_plane":case "mirror_concave":case "mirror_convex":return {color:"#0f172a",strokeWidth:2};case "slit_double":case "slit_single":return {color:"#0f172a",strokeWidth:4};case "nucleus":return e==="light"?{color:"#3b82f6",strokeWidth:2,fontSize:18}:{color:"#0f172a",strokeWidth:2,fontSize:18};case "energy_level":return {color:"#0f172a",strokeWidth:2,label:"n=1",energy:"-13.6 eV"};case "dashed_line":return {color:"#0f172a",strokeWidth:2,lineStyle:"dashed"};case "point":return e==="graph"?{color:"#0f172a",strokeWidth:2,fontSize:16,label:"P"}:e==="light"?{color:"#0f172a",strokeWidth:2,fontSize:18,label:"P"}:e==="thermo"?{color:"#0f172a",strokeWidth:2,fontSize:18,label:"P"}:{};case "text":return e==="graph"?{color:"#0f172a",strokeWidth:2,fontSize:18,label:"Label"}:e==="light"?{color:"#0f172a",strokeWidth:2,fontSize:18,label:"Text"}:e==="mechanics"?{color:"#0f172a",strokeWidth:2,fontSize:20,label:"Label"}:e==="rotation"?{color:"#1e293b",strokeWidth:2,fontSize:20,label:"Label"}:e==="thermo"?{color:"#1e293b",strokeWidth:2,fontSize:18,label:"Equation/Label"}:{};case "b_field_line":case "b_field_curve":return e==="magnetism"?{color:"#10b981",strokeWidth:2}:{};case "pole_piece":return e==="magnetism"?{color:"#0f172a",strokeWidth:2,label:"N"}:{};case "b_region_in":case "b_region_out":return e==="magnetism"?{color:"#94a3b8",strokeWidth:2}:{};case "current_wire":return e==="magnetism"?{color:"#ef4444",strokeWidth:2,label:"I"}:{};case "bar_magnet":return e==="magnetism"?{color:"#0f172a",strokeWidth:2,label:""}:{};case "coil":return e==="magnetism"?{color:"#0f172a",strokeWidth:2}:{};case "bezier":return e==="magnetism"?{color:"#0f172a",strokeWidth:2}:{};case "meter":return e==="magnetism"?{color:"#0f172a",strokeWidth:2,fontSize:24,label:"G"}:{};case "ac_source":return e==="magnetism"?{color:"#0f172a",strokeWidth:2,fontSize:18,label:"V_rms"}:{};case "spring":return e==="rotation"?{color:"#0f172a",strokeWidth:2,coils:6,lineStyle:"solid"}:e==="mechanics"?{color:"#0f172a",strokeWidth:2}:{};case "pivot":return e==="rotation"?{color:"#64748b",strokeWidth:2,size:20,fontSize:18}:e==="mechanics"?{color:"#0f172a",strokeWidth:2}:{};case "pulley":return e==="rotation"?{color:"#64748b",strokeWidth:2,fontSize:18}:e==="mechanics"?{color:"#0f172a",strokeWidth:2}:{};case "point_mass":return {color:"#ef4444",strokeWidth:2,size:15,fontSize:18};case "block_mass":return {color:"#3b82f6",strokeWidth:2,fontSize:18};case "com_indicator":return {color:"#10b981",strokeWidth:2,size:15,fontSize:18};case "system_boundary":case "dashed_path":return {color:"#94a3b8",strokeWidth:e==="rotation"?1.5:2,fontSize:18};case "rocket":return {color:"#ef4444",strokeWidth:2,fontSize:18};case "uniform_rod":return {color:"#f59e0b",strokeWidth:10,fontSize:18};case "solid_disk":case "hoop_ring":return {color:"#3b82f6",strokeWidth:2,fontSize:18};case "rolling_body":return {color:"#3b82f6",strokeWidth:2,fontSize:18,showVelocity:true,showOmega:true};case "inclined_wedge":return {color:"#64748b",strokeWidth:2,fontSize:18};case "curve_arrow":return {color:"#10b981",strokeWidth:2,fontSize:18};case "line":return e==="rotation"?{color:"#1e293b",strokeWidth:1.5}:e==="thermo"?{color:"#1e293b",strokeWidth:2,lineStyle:"solid"}:{};case "piston_cylinder":return e!=="thermo"?{}:{color:"#1e293b",strokeWidth:2,fontSize:18,compression:.5,showHeat:false,lineStyle:"solid"};case "heat_engine":return e!=="thermo"?{}:{color:"#10b981",strokeWidth:2,fontSize:18,engineType:"engine",efficiency:.4,lineStyle:"solid"};case "conduction_rod":return e!=="thermo"?{}:{color:"#3b82f6",strokeWidth:2,fontSize:18,lineStyle:"solid"};case "pv_axes":return e!=="thermo"?{}:{color:"#1e293b",strokeWidth:2,fontSize:18,xLabel:"V",yLabel:"P",lineStyle:"solid"};case "thermo_process":return e!=="thermo"?{}:{color:"#ec4899",strokeWidth:2,fontSize:18,processType:"isotherm",lineStyle:"solid"};case "carnot_cycle":return e!=="thermo"?{}:{color:"#ec4899",strokeWidth:2,fontSize:18,lineStyle:"solid"};case "maxwell_boltzmann":return e!=="thermo"?{}:{color:"#1e293b",strokeWidth:2,fontSize:18,t1:300,t2:600,lineStyle:"solid"};case "diatomic_gas":return {color:"#f59e0b",strokeWidth:2,fontSize:18,showRotations:true};case "random_walk":return e!=="thermo"?{}:{color:"#8b5cf6",strokeWidth:2,fontSize:18,steps:5,lineStyle:"solid"};case "string":case "surface":case "dashed":case "dimension":case "rod":case "arc":case "wedge":case "axes":case "disk":case "particle":case "com":return e==="mechanics"?{color:"#0f172a",strokeWidth:2}:{};case "block":case "cart":return e==="mechanics"?{color:"#0f172a",strokeWidth:2,rotation:0}:{};default:return {}}},vo=(t,e)=>{let[o,n]=useState(t),[r,i]=useState("select"),[l,a]=useState(null),[c,d]=useState(null),[y,h]=useState(false),[f,$]=useState(false),[w,W]=useState(""),[P,Q]=useState(false),[j,F]=useState(null),G=useRef(null),u=useRef({x:0,y:0}),U=useRef(null);useEffect(()=>{n(t),d(null),Q(false),a(null);},[t]),useEffect(()=>{let H=D=>{let O=D.target;O&&(O.tagName==="INPUT"||O.tagName==="TEXTAREA"||O.isContentEditable)||((D.key==="Delete"||D.key==="Backspace")&&c&&(n(K=>K.filter(ut=>ut.id!==c)),d(null),Q(false)),D.key==="Escape"&&(a(null),i("select"),Q(false)));};return window.addEventListener("keydown",H),()=>window.removeEventListener("keydown",H)},[c]);let yt=useMemo(()=>o.find(H=>H.id===c)||null,[o,c]);return {elements:o,setElements:n,tool:r,setTool:i,drawing:l,selectedId:c,setSelectedId:d,isViewMode:y,setIsViewMode:h,showJsonModal:f,setShowJsonModal:$,jsonText:w,setJsonText:W,showProperties:P,setShowProperties:Q,selectedElement:yt,svgRef:G,onElementMouseDown:(H,D)=>{if(r!=="select"||(H.stopPropagation(),!G.current))return;let O=re(G.current,H);d(D.id),F(D.id),u.current=O,U.current=Sr(D);},onHandlePointerDown:(H,D,O,K)=>{if(r!=="select"||(H.stopPropagation(),!G.current))return;let ut=re(G.current,H);if(d(D.id),u.current=ut,O==="start"){F(`${D.id}-start`),U.current={x1:D.x1,y1:D.y1,x2:D.x2,y2:D.y2};return}if(O==="end"){F(`${D.id}-end`),U.current={x1:D.x1,y1:D.y1,x2:D.x2,y2:D.y2};return}if(O==="cp"&&K!==void 0){let Qt=D.cps,ke=Qt?.length&&Qt.length>0?Qt.map(ve=>({x:ve.x,y:ve.y})):[{x:(D.x1+D.x2)/2,y:Math.min(D.y1,D.y2)-50}];F(`${D.id}-cp-${K}`),U.current={x1:D.x1,y1:D.y1,x2:D.x2,y2:D.y2,cps:ke};}},handleMouseDown:H=>{if(!G.current)return;if(r==="select"){H.target===G.current&&(d(null),Q(false));return}let D=re(G.current,H),O=Ft(D.x),K=Ft(D.y),ut=e==="mechanics"&&["pivot","com","axes"].includes(r),Qt=e==="rotation"&&["point_mass","com_indicator","pivot"].includes(r),ke=e==="waveOscillation"&&["tuning_fork","speaker","wavefronts","mass_box"].includes(r);if(ut||Qt||ke||["point","text","diatomic_gas","benzene","cyclohexane","cyclopentane","cyclobutane","cyclopropane","atom","charge_plus","charge_minus","charge_pos","charge_neg","radical","lone_pair","nucleus","meter","ac_source"].includes(r)){let We=ko(r,e),Oo=r==="text"?"Text":r==="atom"?"C":r==="charge_pos"?"+q":r==="charge_neg"?"-q":r==="charge_plus"?"+q":r==="charge_minus"?"-q":r==="meter"?"G":r==="ac_source"?"V_rms":"",Ae={id:Date.now(),type:r,x1:O,y1:K,x2:O,y2:K,...We,label:typeof We.label=="string"?We.label:Oo};n(Yo=>[...Yo,Ae]),d(Ae.id),i("select");return}let xe=ko(r,e),Ho=e==="mechanics"&&(r==="block"||r==="cart")?{rotation:xe.rotation??0}:{};a({...xe,...Ho,id:Date.now(),type:r,x1:O,y1:K,x2:O,y2:K,label:typeof xe.label=="string"?xe.label:""});},handleMouseMove:H=>{if(!G.current)return;let D=re(G.current,H);if(j!=null&&U.current){let O=Ft(D.x-u.current.x),K=Ft(D.y-u.current.y),ut=U.current;n(Qt=>Mr(Qt,j,O,K,ut));return}l&&a({...l,x2:Ft(D.x),y2:Ft(D.y)});},handleMouseUp:()=>{if(j!=null){F(null),U.current=null;return}if(!l)return;if(Math.abs(l.x1-l.x2)<=bo&&Math.abs(l.y1-l.y2)<=bo){a(null),i("select");return}let H=l.type==="bezier"?{...l,cps:[{x:(l.x1+l.x2)/2,y:Math.min(l.y1,l.y2)-60}]}:l;n(D=>[...D,H]),d(l.id),a(null),i("select");}}};var ze={select:jsx("path",{d:"M 8 4 L 16 12 L 11 13 L 9 18 L 6 17 L 8 12 L 4 11 Z",fill:"currentColor",stroke:"currentColor",strokeWidth:"1.5"}),point:jsx("circle",{cx:"12",cy:"12",r:"3",fill:"currentColor"}),line:jsx("line",{x1:"4",y1:"20",x2:"20",y2:"4",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),string:jsx("line",{x1:"4",y1:"12",x2:"20",y2:"12",stroke:"currentColor",strokeWidth:"2"}),vector:jsxs(Fragment,{children:[jsx("line",{x1:"4",y1:"20",x2:"18",y2:"6",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),jsx("polygon",{points:"14,4 20,4 20,10",fill:"none",stroke:"currentColor",strokeWidth:"2.5"})]}),ray:jsxs(Fragment,{children:[jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12",stroke:"currentColor",strokeWidth:"2"}),jsx("polygon",{points:"10,8 16,12 10,16",fill:"currentColor"})]}),wire:jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12",stroke:"currentColor",strokeWidth:"2.8",strokeLinecap:"round"}),text:jsx("text",{x:"12",y:"18",fontSize:"18",textAnchor:"middle",fill:"currentColor",fontWeight:"bold",fontFamily:"serif",children:"T"}),block:jsx("rect",{x:"5",y:"6",width:"14",height:"12",fill:"none",stroke:"currentColor",strokeWidth:"2",rx:"1"}),wedge:jsx("polygon",{points:"2,20 22,20 22,6",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"}),pulley:jsxs(Fragment,{children:[jsx("circle",{cx:"12",cy:"10",r:"6",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"12",y1:"2",x2:"12",y2:"10",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"6",y1:"10",x2:"6",y2:"20",stroke:"currentColor",strokeWidth:"1.5"}),jsx("line",{x1:"18",y1:"10",x2:"18",y2:"18",stroke:"currentColor",strokeWidth:"1.5"})]}),point_mass:jsx("circle",{cx:"12",cy:"12",r:"8",fill:"currentColor",stroke:"currentColor",strokeWidth:"2"}),block_mass:jsx("rect",{x:"6",y:"6",width:"12",height:"12",fill:"none",stroke:"currentColor",strokeWidth:"2",rx:"1"}),com_indicator:jsxs(Fragment,{children:[jsx("circle",{cx:"12",cy:"12",r:"8",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"12",y1:"2",x2:"12",y2:"22",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12",stroke:"currentColor",strokeWidth:"2"}),jsx("path",{d:"M 12 12 L 17 7 A 7 7 0 0 1 17 17 Z M 12 12 L 7 17 A 7 7 0 0 1 7 7 Z",fill:"currentColor",opacity:"0.3"})]}),system_boundary:jsx("rect",{x:"4",y:"4",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"3 2",rx:"4"}),rocket:jsxs(Fragment,{children:[jsx("path",{d:"M12 2 L16 8 L16 16 L20 20 L4 20 L8 16 L8 8 Z",fill:"none",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M8 20 Q12 24 16 20",fill:"currentColor"})]}),dashed_path:jsx("path",{d:"M 4 20 Q 8 8 20 4",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeDasharray:"4 3"}),uniform_rod:jsx("rect",{x:"3",y:"10",width:"18",height:"4",fill:"currentColor",rx:"2",opacity:"0.8"}),solid_disk:jsxs(Fragment,{children:[jsx("circle",{cx:"12",cy:"12",r:"9",fill:"currentColor",opacity:"0.5",stroke:"currentColor",strokeWidth:"2"}),jsx("circle",{cx:"12",cy:"12",r:"1.5",fill:"currentColor"})]}),hoop_ring:jsxs(Fragment,{children:[jsx("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:"currentColor",strokeWidth:"2.5"}),jsx("circle",{cx:"12",cy:"12",r:"1.5",fill:"currentColor"})]}),rolling_body:jsxs(Fragment,{children:[jsx("circle",{cx:"12",cy:"12",r:"8",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"12",y1:"12",x2:"20",y2:"12",stroke:"currentColor",strokeWidth:"1.5"}),jsx("polygon",{points:"18,10 22,12 18,14",fill:"currentColor"}),jsx("path",{d:"M 16 6 A 8 8 0 0 1 20 10",fill:"none",stroke:"currentColor",strokeWidth:"1.5"}),jsx("polygon",{points:"19,11 22,9 18,8",fill:"currentColor"})]}),inclined_wedge:jsx("polygon",{points:"4,20 20,20 4,8",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"}),curve_arrow:jsxs(Fragment,{children:[jsx("path",{d:"M 6 18 A 9 9 0 0 1 18 6",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("polygon",{points:"16,5 20,4 19,8",fill:"currentColor"})]}),ladder:jsxs(Fragment,{children:[jsx("line",{x1:"7",y1:"4",x2:"4",y2:"20",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"17",y1:"4",x2:"14",y2:"20",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"6",y1:"8",x2:"16",y2:"8",stroke:"currentColor",strokeWidth:"1.6"}),jsx("line",{x1:"5",y1:"12",x2:"15",y2:"12",stroke:"currentColor",strokeWidth:"1.6"}),jsx("line",{x1:"4.5",y1:"16",x2:"14.5",y2:"16",stroke:"currentColor",strokeWidth:"1.6"})]}),spring:jsx("path",{d:"M 2 12 L 5 12 L 7 6 L 11 18 L 15 6 L 19 18 L 21 12 L 22 12",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"bevel"}),arc:jsx("path",{d:"M 22 12 A 10 10 0 0 0 12 2 L 12 12 Z",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"}),arc_arrow:jsxs(Fragment,{children:[jsx("path",{d:"M 4 16 A 8 8 0 0 1 18 8",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round"}),jsx("polygon",{points:"17,5 21,9 15,10",fill:"currentColor"})]}),dashed:jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12",stroke:"currentColor",strokeWidth:"2",strokeDasharray:"4,4"}),surface:jsx("path",{d:"M 4 10 L 20 10 M 6 10 L 2 16 M 12 10 L 8 16 M 18 10 L 14 16 M 24 10 L 20 16",fill:"none",stroke:"currentColor",strokeWidth:"2"}),dimension:jsxs(Fragment,{children:[jsx("line",{x1:"4",y1:"12",x2:"20",y2:"12",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"2 2"}),jsx("polygon",{points:"4,12 8,9 8,15",fill:"currentColor"}),jsx("polygon",{points:"20,12 16,9 16,15",fill:"currentColor"})]}),axes:jsxs(Fragment,{children:[jsx("line",{x1:"6",y1:"18",x2:"6",y2:"6",stroke:"currentColor",strokeWidth:"2"}),jsx("polygon",{points:"6,4 3,9 9,9",fill:"currentColor"}),jsx("line",{x1:"6",y1:"18",x2:"18",y2:"18",stroke:"currentColor",strokeWidth:"2"}),jsx("polygon",{points:"20,18 15,15 15,21",fill:"currentColor"})]}),cart:jsx("path",{d:"M 4 8 L 20 8 L 20 14 L 4 14 Z M 8 18 A 2 2 0 1 0 8 14 A 2 2 0 1 0 8 18 M 16 18 A 2 2 0 1 0 16 14 A 2 2 0 1 0 16 18",fill:"none",stroke:"currentColor",strokeWidth:"2"}),disk:jsxs(Fragment,{children:[jsx("circle",{cx:"12",cy:"12",r:"8",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"12",y1:"12",x2:"18",y2:"18",stroke:"currentColor",strokeWidth:"2"}),jsx("circle",{cx:"12",cy:"12",r:"2",fill:"currentColor"})]}),com:jsxs(Fragment,{children:[jsx("circle",{cx:"12",cy:"12",r:"8",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("path",{d:"M 12 4 A 8 8 0 0 1 20 12 L 12 12 Z M 12 20 A 8 8 0 0 1 4 12 L 12 12 Z",fill:"currentColor"})]}),particle:jsx("circle",{cx:"12",cy:"12",r:"5",fill:"currentColor"}),pivot:jsxs(Fragment,{children:[jsx("polygon",{points:"12,6 6,18 18,18",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"4",y1:"20",x2:"20",y2:"20",stroke:"currentColor",strokeWidth:"2"}),jsx("circle",{cx:"12",cy:"6",r:"2",fill:"currentColor"})]}),dashed_line:jsx("line",{x1:"4",y1:"20",x2:"20",y2:"4",stroke:"currentColor",strokeWidth:"2.5",strokeDasharray:"4 4",strokeLinecap:"round"}),angle:jsxs(Fragment,{children:[jsx("line",{x1:"4",y1:"20",x2:"20",y2:"20",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"4",y1:"20",x2:"16",y2:"4",stroke:"currentColor",strokeWidth:"2"}),jsx("path",{d:"M 14 20 A 10 10 0 0 0 10 12",fill:"none",stroke:"currentColor",strokeWidth:"2"})]}),rectangle:jsx("rect",{x:"4",y:"6",width:"16",height:"12",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"}),circle:jsx("circle",{cx:"12",cy:"12",r:"8",fill:"none",stroke:"currentColor",strokeWidth:"2.5"}),ellipse:jsx("ellipse",{cx:"12",cy:"12",rx:"10",ry:"5",fill:"none",stroke:"currentColor",strokeWidth:"2.5"}),parabola_v:jsx("path",{d:"M 4 4 Q 12 24 20 4",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),parabola_h:jsx("path",{d:"M 20 4 Q 0 12 20 20",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),hyperbola:jsxs(Fragment,{children:[jsx("path",{d:"M 6 2 Q 12 12 6 22",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("path",{d:"M 18 2 Q 12 12 18 22",fill:"none",stroke:"currentColor",strokeWidth:"2"})]}),sine_wave:jsx("path",{d:"M 2 12 Q 7 2 12 12 T 22 12",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),mass_box:jsx("rect",{x:"6",y:"6",width:"12",height:"12",fill:"none",stroke:"currentColor",strokeWidth:"2"}),pendulum:jsxs(Fragment,{children:[jsx("line",{x1:"12",y1:"2",x2:"18",y2:"16",stroke:"currentColor",strokeWidth:"2"}),jsx("circle",{cx:"18",cy:"18",r:"4",fill:"currentColor"}),jsx("line",{x1:"6",y1:"2",x2:"18",y2:"2",stroke:"currentColor",strokeWidth:"2"})]}),phasor:jsxs(Fragment,{children:[jsx("circle",{cx:"12",cy:"12",r:"10",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"12",y1:"12",x2:"18",y2:"6",stroke:"currentColor",strokeWidth:"2"}),jsx("polygon",{points:"15,5 19,5 19,9",fill:"currentColor"})]}),damped_wave:jsx("path",{d:"M 2 12 Q 5 2 8 12 T 14 12 T 18 12 T 22 12",fill:"none",stroke:"currentColor",strokeWidth:"2"}),vane_liquid:jsxs(Fragment,{children:[jsx("path",{d:"M 4 4 L 4 20 L 20 20 L 20 4",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("rect",{x:"4",y:"10",width:"16",height:"10",fill:"currentColor",opacity:"0.35"}),jsx("line",{x1:"12",y1:"2",x2:"12",y2:"16",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"8",y1:"16",x2:"16",y2:"16",stroke:"currentColor",strokeWidth:"2"})]}),torsion_pendulum:jsxs(Fragment,{children:[jsx("rect",{x:"5",y:"2",width:"14",height:"4",rx:"1",fill:"currentColor",opacity:"0.35"}),jsx("line",{x1:"12",y1:"6",x2:"12",y2:"15",stroke:"currentColor",strokeWidth:"1.5"}),jsx("rect",{x:"8",y:"15",width:"8",height:"6",rx:"2",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"12",y1:"15",x2:"14",y2:"13",stroke:"currentColor",strokeWidth:"1.2"})]}),standing_wave:jsxs(Fragment,{children:[jsx("path",{d:"M 2 12 Q 7 2 12 12 T 22 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M 2 12 Q 7 22 12 12 T 22 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"2 2"})]}),wave_pulse:jsx("path",{d:"M 2 16 L 8 16 Q 12 4 16 16 L 22 16",fill:"none",stroke:"currentColor",strokeWidth:"2"}),shm_graph:jsxs(Fragment,{children:[jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12",stroke:"currentColor",strokeWidth:"1",opacity:"0.5"}),jsx("path",{d:"M 2 12 Q 7 2 12 12 T 22 12",fill:"none",stroke:"#3b82f6",strokeWidth:"2"}),jsx("path",{d:"M 2 12 Q 7 22 12 12 T 22 12",fill:"none",stroke:"#ef4444",strokeWidth:"2",strokeDasharray:"2 2"})]}),energy_graph:jsxs(Fragment,{children:[jsx("line",{x1:"2",y1:"20",x2:"22",y2:"20",stroke:"currentColor",strokeWidth:"2"}),jsx("path",{d:"M 4 6 Q 12 24 20 6",fill:"none",stroke:"#ef4444",strokeWidth:"2"}),jsx("path",{d:"M 4 20 Q 12 2 20 20",fill:"none",stroke:"#10b981",strokeWidth:"2"})]}),strobe_shm:jsxs(Fragment,{children:[jsx("circle",{cx:"12",cy:"4",r:"2",fill:"currentColor"}),jsx("circle",{cx:"18",cy:"12",r:"2",fill:"currentColor"}),jsx("circle",{cx:"12",cy:"20",r:"2",fill:"currentColor"}),jsx("line",{x1:"6",y1:"4",x2:"18",y2:"4",stroke:"currentColor",strokeWidth:"0.5"}),jsx("line",{x1:"6",y1:"12",x2:"18",y2:"12",stroke:"currentColor",strokeWidth:"0.5"}),jsx("line",{x1:"6",y1:"20",x2:"18",y2:"20",stroke:"currentColor",strokeWidth:"0.5"})]}),wall:jsxs(Fragment,{children:[jsx("line",{x1:"12",y1:"2",x2:"12",y2:"22",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"12",y1:"4",x2:"16",y2:"0",stroke:"currentColor",strokeWidth:"1.5"}),jsx("line",{x1:"12",y1:"10",x2:"16",y2:"6",stroke:"currentColor",strokeWidth:"1.5"}),jsx("line",{x1:"12",y1:"16",x2:"16",y2:"12",stroke:"currentColor",strokeWidth:"1.5"}),jsx("line",{x1:"12",y1:"22",x2:"16",y2:"18",stroke:"currentColor",strokeWidth:"1.5"})]}),tuning_fork:jsxs(Fragment,{children:[jsx("path",{d:"M 8 4 L 8 14 Q 12 20 16 14 L 16 4",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"12",y1:"17",x2:"12",y2:"24",stroke:"currentColor",strokeWidth:"2"})]}),speaker:jsxs(Fragment,{children:[jsx("polygon",{points:"8,8 14,4 14,20 8,16",fill:"currentColor"}),jsx("rect",{x:"4",y:"8",width:"4",height:"8",fill:"currentColor"}),jsx("path",{d:"M 18 8 Q 20 12 18 16 M 21 5 Q 24 12 21 19",fill:"none",stroke:"currentColor",strokeWidth:"2"})]}),wavefronts:jsxs(Fragment,{children:[jsx("circle",{cx:"10",cy:"12",r:"4",fill:"none",stroke:"currentColor"}),jsx("circle",{cx:"11",cy:"12",r:"8",fill:"none",stroke:"currentColor"}),jsx("circle",{cx:"12",cy:"12",r:"12",fill:"none",stroke:"currentColor"})]}),mach_cone:jsxs(Fragment,{children:[jsx("circle",{cx:"18",cy:"12",r:"2",fill:"currentColor"}),jsx("line",{x1:"2",y1:"4",x2:"18",y2:"12",stroke:"currentColor",strokeWidth:"1.5"}),jsx("line",{x1:"2",y1:"20",x2:"18",y2:"12",stroke:"currentColor",strokeWidth:"1.5"})]}),beats_graph:jsx("path",{d:"M 2 12 Q 4 6 6 12 Q 8 18 10 12 Q 12 8 14 12 Q 16 16 18 12 Q 20 10 22 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5"}),step_function:jsxs(Fragment,{children:[jsx("path",{d:"M2 18 L8 18 M8 12 L14 12 M14 6 L20 6",stroke:"currentColor",strokeWidth:"2"}),jsx("circle",{cx:"2",cy:"18",r:"2",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"18",r:"2",fill:"none",stroke:"currentColor"}),jsx("circle",{cx:"8",cy:"12",r:"2",fill:"currentColor"}),jsx("circle",{cx:"14",cy:"12",r:"2",fill:"none",stroke:"currentColor"}),jsx("circle",{cx:"14",cy:"6",r:"2",fill:"currentColor"}),jsx("circle",{cx:"20",cy:"6",r:"2",fill:"none",stroke:"currentColor"})]}),shaded_area:jsxs(Fragment,{children:[jsx("path",{d:"M4 20 L4 10 Q12 2 20 10 L20 20 Z",fill:"currentColor",opacity:"0.3"}),jsx("path",{d:"M4 10 Q12 2 20 10",fill:"none",stroke:"currentColor",strokeWidth:"2"})]}),modulus:jsx("polyline",{points:"4,4 12,20 20,4",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"}),exponential:jsx("path",{d:"M4 20 Q14 20 20 4",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),logarithmic:jsx("path",{d:"M4 20 Q4 10 20 4",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),axes_3d:jsxs(Fragment,{children:[jsx("line",{x1:"8",y1:"16",x2:"8",y2:"2",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"8",y1:"16",x2:"22",y2:"16",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"8",y1:"16",x2:"2",y2:"22",stroke:"currentColor",strokeWidth:"2"})]}),rod:jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12",stroke:"currentColor",strokeWidth:"6",strokeLinecap:"round"}),hinge:jsxs(Fragment,{children:[jsx("circle",{cx:"12",cy:"12",r:"3.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("circle",{cx:"12",cy:"12",r:"1.5",fill:"currentColor"})]}),slit_double:jsxs(Fragment,{children:[jsx("line",{x1:"12",y1:"2",x2:"12",y2:"8",stroke:"currentColor",strokeWidth:"3"}),jsx("line",{x1:"12",y1:"11",x2:"12",y2:"13",stroke:"currentColor",strokeWidth:"3"}),jsx("line",{x1:"12",y1:"16",x2:"12",y2:"22",stroke:"currentColor",strokeWidth:"3"})]}),slit_single:jsxs(Fragment,{children:[jsx("line",{x1:"12",y1:"2",x2:"12",y2:"9",stroke:"currentColor",strokeWidth:"3"}),jsx("line",{x1:"12",y1:"15",x2:"12",y2:"22",stroke:"currentColor",strokeWidth:"3"})]}),photon:jsxs(Fragment,{children:[jsx("path",{d:"M 2 12 Q 5 6 8 12 T 14 12 T 20 12",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("polygon",{points:"18,8 22,12 18,16",fill:"currentColor"})]}),nucleus:jsxs(Fragment,{children:[jsx("ellipse",{cx:"12",cy:"12",rx:"10",ry:"4",fill:"none",stroke:"currentColor",transform:"rotate(45 12 12)"}),jsx("ellipse",{cx:"12",cy:"12",rx:"10",ry:"4",fill:"none",stroke:"currentColor",transform:"rotate(-45 12 12)"}),jsx("circle",{cx:"12",cy:"12",r:"3",fill:"#ef4444"})]}),orbit:jsx("ellipse",{cx:"12",cy:"12",rx:"8",ry:"4.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),resistor:jsx("path",{d:"M 2 12 L 6 12 L 8 6 L 12 18 L 16 6 L 18 12 L 22 12",fill:"none",stroke:"#b45309",strokeWidth:"2.2",strokeLinejoin:"round"}),capacitor:jsxs(Fragment,{children:[jsx("line",{x1:"3",y1:"12",x2:"9",y2:"12",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"9",y1:"6",x2:"9",y2:"18",stroke:"currentColor",strokeWidth:"2.2"}),jsx("line",{x1:"15",y1:"6",x2:"15",y2:"18",stroke:"currentColor",strokeWidth:"2.2"}),jsx("line",{x1:"15",y1:"12",x2:"21",y2:"12",stroke:"currentColor",strokeWidth:"2"})]}),inductor:jsx("path",{d:"M 3 12 C 5 8, 7 8, 9 12 C 11 8, 13 8, 15 12 C 17 8, 19 8, 21 12",fill:"none",stroke:"currentColor",strokeWidth:"2"}),diode:jsxs(Fragment,{children:[jsx("line",{x1:"3",y1:"12",x2:"8",y2:"12",stroke:"currentColor",strokeWidth:"2"}),jsx("polygon",{points:"8,7 8,17 14,12",fill:"#fcd34d",fillOpacity:"0.85",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"15.5",y1:"7",x2:"15.5",y2:"17",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"15.5",y1:"12",x2:"21",y2:"12",stroke:"currentColor",strokeWidth:"2"})]}),battery:jsxs(Fragment,{children:[jsx("path",{d:"M 2 12 L 7 12",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),jsx("rect",{x:"7",y:"4",width:"5",height:"16",rx:"0.5",fill:"#dc2626",stroke:"currentColor",strokeWidth:"1"}),jsx("rect",{x:"12",y:"7",width:"5",height:"10",rx:"0.5",fill:"#2563eb",stroke:"currentColor",strokeWidth:"1"}),jsx("path",{d:"M 17 12 L 22 12",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]}),ground:jsx("path",{d:"M 12 4 L 12 12 M 6 12 L 18 12 M 8 16 L 16 16 M 10 20 L 14 20",fill:"none",stroke:"currentColor",strokeWidth:"2"}),meter_v:jsxs(Fragment,{children:[jsx("circle",{cx:"12",cy:"12",r:"8",fill:"#e0f2fe",stroke:"#0369a1",strokeWidth:"2"}),jsx("text",{x:"12",y:"15",fontSize:"9",textAnchor:"middle",fill:"#0369a1",fontWeight:"bold",children:"V"})]}),meter_a:jsxs(Fragment,{children:[jsx("circle",{cx:"12",cy:"12",r:"8",fill:"#fef3c7",stroke:"#b45309",strokeWidth:"2"}),jsx("text",{x:"12",y:"15",fontSize:"9",textAnchor:"middle",fill:"#b45309",fontWeight:"bold",children:"A"})]}),piston_cylinder:jsxs(Fragment,{children:[jsx("path",{d:"M 4 4 L 4 20 L 20 20 L 20 4",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("rect",{x:"5",y:"10",width:"14",height:"4",fill:"currentColor"}),jsx("circle",{cx:"9",cy:"16",r:"1",fill:"currentColor"}),jsx("circle",{cx:"15",cy:"17",r:"1",fill:"currentColor"}),jsx("circle",{cx:"12",cy:"14",r:"1",fill:"currentColor"})]}),heat_engine:jsxs(Fragment,{children:[jsx("rect",{x:"6",y:"2",width:"12",height:"4",fill:"#ef4444"}),jsx("circle",{cx:"12",cy:"12",r:"4",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("rect",{x:"6",y:"18",width:"12",height:"4",fill:"#3b82f6"}),jsx("line",{x1:"12",y1:"6",x2:"12",y2:"8",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"12",y1:"16",x2:"12",y2:"18",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"16",y1:"12",x2:"20",y2:"12",stroke:"currentColor",strokeWidth:"2"})]}),conduction_rod:jsxs(Fragment,{children:[jsx("defs",{children:jsxs("linearGradient",{id:"thermo-conduction-icon-grad",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[jsx("stop",{offset:"0%",stopColor:"#ef4444"}),jsx("stop",{offset:"100%",stopColor:"#3b82f6"})]})}),jsx("rect",{x:"2",y:"8",width:"20",height:"8",fill:"url(#thermo-conduction-icon-grad)",stroke:"currentColor",strokeWidth:"1"})]}),pv_axes:jsxs(Fragment,{children:[jsx("line",{x1:"4",y1:"4",x2:"4",y2:"20",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"4",y1:"20",x2:"20",y2:"20",stroke:"currentColor",strokeWidth:"2"}),jsx("polygon",{points:"4,2 2,6 6,6",fill:"currentColor"}),jsx("polygon",{points:"22,20 18,18 18,22",fill:"currentColor"})]}),thermo_process:jsxs(Fragment,{children:[jsx("path",{d:"M 4 4 Q 8 16 20 20",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("polygon",{points:"12,12 8,10 10,14",fill:"currentColor"})]}),carnot_cycle:jsx("path",{d:"M 6 6 Q 12 8 16 12 Q 14 16 10 18 Q 6 14 6 6",fill:"none",stroke:"currentColor",strokeWidth:"2"}),maxwell_boltzmann:jsxs(Fragment,{children:[jsx("line",{x1:"2",y1:"20",x2:"22",y2:"20",stroke:"currentColor",strokeWidth:"2"}),jsx("path",{d:"M 2 20 Q 8 4 12 12 T 22 20",fill:"none",stroke:"#ef4444",strokeWidth:"2"}),jsx("path",{d:"M 2 20 Q 6 10 10 16 T 22 20",fill:"none",stroke:"#3b82f6",strokeWidth:"2",strokeDasharray:"2 2"})]}),diatomic_gas:jsxs(Fragment,{children:[jsx("circle",{cx:"6",cy:"12",r:"4",fill:"currentColor"}),jsx("circle",{cx:"18",cy:"12",r:"4",fill:"currentColor"}),jsx("line",{x1:"10",y1:"12",x2:"14",y2:"12",stroke:"currentColor",strokeWidth:"2"}),jsx("path",{d:"M 8 6 A 6 6 0 0 1 16 6",fill:"none",stroke:"currentColor",strokeWidth:"1"})]}),random_walk:jsxs(Fragment,{children:[jsx("polyline",{points:"2,18 8,12 14,16 20,6",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("circle",{cx:"2",cy:"18",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"20",cy:"6",r:"1.5",fill:"currentColor"})]}),lens_convex:jsx("path",{d:"M 4 12 Q 12 4 20 12 Q 12 20 4 12 Z",fill:"#38bdf8",fillOpacity:"0.4",stroke:"currentColor",strokeWidth:"2"}),lens_concave:jsx("path",{d:"M 4 8 L 4 16 Q 12 14 20 16 L 20 8 Q 12 10 4 8 Z",fill:"#38bdf8",fillOpacity:"0.4",stroke:"currentColor",strokeWidth:"2"}),mirror_concave:jsxs(Fragment,{children:[jsx("path",{d:"M 4 12 Q 12 18 20 12",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"8",y1:"14",x2:"5",y2:"17",stroke:"currentColor"}),jsx("line",{x1:"12",y1:"15",x2:"9",y2:"18",stroke:"currentColor"}),jsx("line",{x1:"16",y1:"14",x2:"13",y2:"17",stroke:"currentColor"})]}),mirror_convex:jsxs(Fragment,{children:[jsx("path",{d:"M 4 12 Q 12 6 20 12",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"8",y1:"10",x2:"5",y2:"7",stroke:"currentColor"}),jsx("line",{x1:"12",y1:"9",x2:"9",y2:"6",stroke:"currentColor"}),jsx("line",{x1:"16",y1:"10",x2:"13",y2:"7",stroke:"currentColor"})]}),prism:jsx("polygon",{points:"12,4 2,20 22,20",fill:"#38bdf8",fillOpacity:"0.4",stroke:"currentColor",strokeWidth:"2"}),glass_slab:jsx("rect",{x:"4",y:"6",width:"16",height:"12",fill:"#38bdf8",fillOpacity:"0.4",stroke:"currentColor",strokeWidth:"2"}),pole_piece:jsxs(Fragment,{children:[jsx("rect",{x:"4",y:"2",width:"16",height:"20",fill:"#93c5fd",fillOpacity:"0.4",stroke:"currentColor",strokeWidth:"2"}),jsx("text",{x:"12",y:"16",fontSize:"12",textAnchor:"middle",fill:"currentColor",fontWeight:"bold",children:"N"})]}),b_field_line:jsxs(Fragment,{children:[jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12",stroke:"currentColor",strokeWidth:"2"}),jsx("polygon",{points:"10,8 16,12 10,16",fill:"currentColor"})]}),b_field_curve:jsxs(Fragment,{children:[jsx("path",{d:"M 4 20 Q 12 2 20 20",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("polygon",{points:"10,8 14,11 10,14",fill:"currentColor",transform:"rotate(30 12 11)"})]}),bezier:jsxs(Fragment,{children:[jsx("path",{d:"M 4 20 Q 4 4 20 4",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("circle",{cx:"4",cy:"4",r:"2",fill:"currentColor"}),jsx("line",{x1:"4",y1:"20",x2:"4",y2:"4",stroke:"currentColor",strokeWidth:"1",strokeDasharray:"2 2"}),jsx("line",{x1:"20",y1:"4",x2:"4",y2:"4",stroke:"currentColor",strokeWidth:"1",strokeDasharray:"2 2"})]}),current_wire:jsxs(Fragment,{children:[jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),jsx("polygon",{points:"15,8 20,12 15,16",fill:"currentColor"})]}),b_region_in:jsxs(Fragment,{children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeDasharray:"2 2"}),jsx("path",{d:"M 8 8 L 16 16 M 16 8 L 8 16",stroke:"currentColor",strokeWidth:"2"})]}),b_region_out:jsxs(Fragment,{children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeDasharray:"2 2"}),jsx("circle",{cx:"12",cy:"12",r:"2",fill:"currentColor"})]}),bar_magnet:jsxs(Fragment,{children:[jsx("rect",{x:"2",y:"8",width:"20",height:"8",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"12",y1:"8",x2:"12",y2:"16",stroke:"currentColor",strokeWidth:"2"}),jsx("text",{x:"7",y:"15",fontSize:"7",fill:"currentColor",fontWeight:"bold",children:"N"}),jsx("text",{x:"17",y:"15",fontSize:"7",fill:"currentColor",fontWeight:"bold",children:"S"})]}),coil:jsx("path",{d:"M2 12 C 5 -2, 10 26, 12 12 C 14 -2, 19 26, 22 12",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"}),meter:jsxs(Fragment,{children:[jsx("circle",{cx:"12",cy:"12",r:"8",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("text",{x:"12",y:"16",fontSize:"10",fontWeight:"bold",textAnchor:"middle",fill:"currentColor",children:"G"})]}),ac_source:jsxs(Fragment,{children:[jsx("circle",{cx:"12",cy:"12",r:"8",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("path",{d:"M 7 12 Q 9.5 8 12 12 T 17 12",fill:"none",stroke:"currentColor",strokeWidth:"2"})]}),single_bond:jsx("line",{x1:"4",y1:"18",x2:"20",y2:"6",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),double_bond:jsxs(Fragment,{children:[jsx("line",{x1:"3",y1:"15",x2:"17",y2:"3",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),jsx("line",{x1:"7",y1:"21",x2:"21",y2:"9",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"})]}),triple_bond:jsxs(Fragment,{children:[jsx("line",{x1:"2",y1:"12",x2:"16",y2:"0",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"5",y1:"16",x2:"19",y2:"4",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"8",y1:"20",x2:"22",y2:"8",stroke:"currentColor",strokeWidth:"2"})]}),wedge_bond:jsx("polygon",{points:"4,18 20,4 22,8",fill:"currentColor"}),dash_bond:jsx("line",{x1:"4",y1:"18",x2:"20",y2:"6",stroke:"currentColor",strokeWidth:"2.5",strokeDasharray:"3 3"}),benzene:jsxs(Fragment,{children:[jsx("polygon",{points:"12,2 20.6,7 20.6,17 12,22 3.4,17 3.4,7",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("circle",{cx:"12",cy:"12",r:"5",fill:"none",stroke:"currentColor",strokeWidth:"1.5"})]}),cyclohexane:jsx("polygon",{points:"12,2 20.6,7 20.6,17 12,22 3.4,17 3.4,7",fill:"none",stroke:"currentColor",strokeWidth:"2"}),cyclopentane:jsx("polygon",{points:"12,2 22,9.5 18,21 6,21 2,9.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),cyclobutane:jsx("rect",{x:"5",y:"5",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2"}),cyclopropane:jsx("polygon",{points:"12,4 22,18 2,18",fill:"none",stroke:"currentColor",strokeWidth:"2"}),reaction_arrow:jsxs(Fragment,{children:[jsx("line",{x1:"2",y1:"12",x2:"20",y2:"12",stroke:"currentColor",strokeWidth:"2"}),jsx("polyline",{points:"14,6 22,12 14,18",fill:"none",stroke:"currentColor",strokeWidth:"2"})]}),equilibrium_arrow:jsxs(Fragment,{children:[jsx("line",{x1:"2",y1:"9",x2:"20",y2:"9",stroke:"currentColor",strokeWidth:"1.5"}),jsx("polyline",{points:"14,4 20,9",fill:"none",stroke:"currentColor",strokeWidth:"1.5"}),jsx("line",{x1:"4",y1:"15",x2:"22",y2:"15",stroke:"currentColor",strokeWidth:"1.5"}),jsx("polyline",{points:"10,20 4,15",fill:"none",stroke:"currentColor",strokeWidth:"1.5"})]}),curved_arrow:jsx("path",{d:"M 4 18 Q 12 4 20 18 L 16 16 M 20 18 L 22 14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),resonance_arrow:jsxs(Fragment,{children:[jsx("line",{x1:"4",y1:"12",x2:"20",y2:"12",stroke:"currentColor",strokeWidth:"2"}),jsx("polyline",{points:"8,6 2,12 8,18",fill:"none",stroke:"currentColor",strokeWidth:"2"}),jsx("polyline",{points:"16,6 22,12 16,18",fill:"none",stroke:"currentColor",strokeWidth:"2"})]}),atom:jsx("text",{x:"12",y:"18",fontSize:"18",textAnchor:"middle",fill:"currentColor",fontWeight:"bold",fontFamily:"sans-serif",children:"C"}),charge_plus:jsxs(Fragment,{children:[jsx("circle",{cx:"12",cy:"12",r:"8",fill:"none",stroke:"currentColor",strokeWidth:"1.5"}),jsx("line",{x1:"12",y1:"8",x2:"12",y2:"16",stroke:"currentColor",strokeWidth:"1.5"}),jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12",stroke:"currentColor",strokeWidth:"1.5"})]}),charge_minus:jsxs(Fragment,{children:[jsx("circle",{cx:"12",cy:"12",r:"8",fill:"none",stroke:"currentColor",strokeWidth:"1.5"}),jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12",stroke:"currentColor",strokeWidth:"1.5"})]}),radical:jsx("circle",{cx:"12",cy:"12",r:"2.5",fill:"currentColor"}),lone_pair:jsxs(Fragment,{children:[jsx("circle",{cx:"8",cy:"12",r:"2",fill:"currentColor"}),jsx("circle",{cx:"16",cy:"12",r:"2",fill:"currentColor"})]}),charge_pos:jsxs(Fragment,{children:[jsx("circle",{cx:"12",cy:"12",r:"8",fill:"#fecaca",stroke:"#ef4444",strokeWidth:"2"}),jsx("path",{d:"M12 8v8M8 12h8",stroke:"#ef4444",strokeWidth:"2",strokeLinecap:"round"})]}),charge_neg:jsxs(Fragment,{children:[jsx("circle",{cx:"12",cy:"12",r:"8",fill:"#bfdbfe",stroke:"#3b82f6",strokeWidth:"2"}),jsx("path",{d:"M8 12h8",stroke:"#3b82f6",strokeWidth:"2",strokeLinecap:"round"})]}),dipole:jsxs(Fragment,{children:[jsx("circle",{cx:"5",cy:"12",r:"4",fill:"#fecaca",stroke:"#ef4444"}),jsx("circle",{cx:"19",cy:"12",r:"4",fill:"#bfdbfe",stroke:"#3b82f6"}),jsx("line",{x1:"9",y1:"12",x2:"15",y2:"12",stroke:"currentColor",strokeDasharray:"2 2"})]}),charged_plate_pos:jsxs(Fragment,{children:[jsx("line",{x1:"12",y1:"2",x2:"12",y2:"22",stroke:"#ef4444",strokeWidth:"6"}),jsx("path",{d:"M9 6h6M12 3v6 M9 12h6M12 9v6 M9 18h6M12 15v6",stroke:"#fff",strokeWidth:"1"})]}),charged_plate_neg:jsxs(Fragment,{children:[jsx("line",{x1:"12",y1:"2",x2:"12",y2:"22",stroke:"#3b82f6",strokeWidth:"6"}),jsx("path",{d:"M9 6h6 M9 12h6 M9 18h6",stroke:"#fff",strokeWidth:"1"})]}),gaussian_sphere:jsx("circle",{cx:"12",cy:"12",r:"9",fill:"#d1fae5",fillOpacity:"0.4",stroke:"#10b981",strokeWidth:"2",strokeDasharray:"3 3"}),gaussian_cylinder:jsxs(Fragment,{children:[jsx("ellipse",{cx:"12",cy:"4",rx:"7",ry:"2",fill:"none",stroke:"#10b981",strokeWidth:"1.5",strokeDasharray:"2 2"}),jsx("ellipse",{cx:"12",cy:"20",rx:"7",ry:"2",fill:"none",stroke:"#10b981",strokeWidth:"1.5",strokeDasharray:"2 2"}),jsx("path",{d:"M5 4v16M19 4v16",stroke:"#10b981",strokeWidth:"1.5",strokeDasharray:"2 2"})]}),mirror_plane:jsxs(Fragment,{children:[jsx("line",{x1:"12",y1:"2",x2:"12",y2:"22",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"12",y1:"6",x2:"6",y2:"10",stroke:"currentColor"}),jsx("line",{x1:"12",y1:"12",x2:"6",y2:"16",stroke:"currentColor"}),jsx("line",{x1:"12",y1:"18",x2:"6",y2:"22",stroke:"currentColor"})]}),energy_level:jsxs(Fragment,{children:[jsx("line",{x1:"4",y1:"8",x2:"20",y2:"8",stroke:"currentColor",strokeWidth:"2"}),jsx("line",{x1:"4",y1:"16",x2:"20",y2:"16",stroke:"currentColor",strokeWidth:"2"}),jsx("text",{x:"12",y:"13",fontSize:"6",fill:"currentColor",textAnchor:"middle",children:"n"})]})};var Wo={teal:{idle:"text-teal-600 border-transparent hover:bg-teal-50 hover:border-teal-200",active:"bg-teal-50 text-teal-700 border-teal-200 shadow-sm ring-1 ring-teal-100"},indigo:{idle:"text-indigo-600 border-transparent hover:bg-indigo-50 hover:border-indigo-200",active:"bg-indigo-50 text-indigo-700 border-indigo-200 shadow-sm ring-1 ring-indigo-100"},violet:{idle:"text-violet-600 border-transparent hover:bg-violet-50 hover:border-violet-200",active:"bg-violet-50 text-violet-700 border-violet-200 shadow-sm ring-1 ring-violet-100"},purple:{idle:"text-purple-600 border-transparent hover:bg-purple-50 hover:border-purple-200",active:"bg-purple-50 text-purple-700 border-purple-200 shadow-sm ring-1 ring-purple-100"},amber:{idle:"text-amber-600 border-transparent hover:bg-amber-50 hover:border-amber-200",active:"bg-amber-50 text-amber-700 border-amber-200 shadow-sm ring-1 ring-amber-100"},orange:{idle:"text-orange-600 border-transparent hover:bg-orange-50 hover:border-orange-200",active:"bg-orange-50 text-orange-700 border-orange-200 shadow-sm ring-1 ring-orange-100"},rose:{idle:"text-rose-600 border-transparent hover:bg-rose-50 hover:border-rose-200",active:"bg-rose-50 text-rose-700 border-rose-200 shadow-sm ring-1 ring-rose-100"},sky:{idle:"text-sky-600 border-transparent hover:bg-sky-50 hover:border-sky-200",active:"bg-sky-50 text-sky-700 border-sky-200 shadow-sm ring-1 ring-sky-100"},cyan:{idle:"text-cyan-600 border-transparent hover:bg-cyan-50 hover:border-cyan-200",active:"bg-cyan-50 text-cyan-700 border-cyan-200 shadow-sm ring-1 ring-cyan-100"},fuchsia:{idle:"text-fuchsia-600 border-transparent hover:bg-fuchsia-50 hover:border-fuchsia-200",active:"bg-fuchsia-50 text-fuchsia-700 border-fuchsia-200 shadow-sm ring-1 ring-fuchsia-100"},emerald:{idle:"text-emerald-600 border-transparent hover:bg-emerald-50 hover:border-emerald-200",active:"bg-emerald-50 text-emerald-700 border-emerald-200 shadow-sm ring-1 ring-emerald-100"},lime:{idle:"text-lime-600 border-transparent hover:bg-lime-50 hover:border-lime-200",active:"bg-lime-50 text-lime-700 border-lime-200 shadow-sm ring-1 ring-lime-100"},green:{idle:"text-green-600 border-transparent hover:bg-green-50 hover:border-green-200",active:"bg-green-50 text-green-700 border-green-200 shadow-sm ring-1 ring-green-100"},blue:{idle:"text-blue-600 border-transparent hover:bg-blue-50 hover:border-blue-200",active:"bg-blue-50 text-blue-700 border-blue-200 shadow-sm ring-1 ring-blue-100"},pink:{idle:"text-pink-600 border-transparent hover:bg-pink-50 hover:border-pink-200",active:"bg-pink-50 text-pink-700 border-pink-200 shadow-sm ring-1 ring-pink-100"},slate:{idle:"text-slate-600 border-transparent hover:bg-slate-100 hover:border-slate-200",active:"bg-slate-100 text-slate-800 border-slate-300 shadow-sm ring-1 ring-slate-200"},red:{idle:"text-red-600 border-transparent hover:bg-red-50 hover:border-red-200",active:"bg-red-50 text-red-700 border-red-200 shadow-sm ring-1 ring-red-100"},yellow:{idle:"text-yellow-600 border-transparent hover:bg-yellow-50 hover:border-yellow-200",active:"bg-yellow-50 text-yellow-800 border-yellow-200 shadow-sm ring-1 ring-yellow-100"},stone:{idle:"text-stone-600 border-transparent hover:bg-stone-50 hover:border-stone-200",active:"bg-stone-50 text-stone-800 border-stone-200 shadow-sm ring-1 ring-stone-100"}},$o=["indigo","violet","purple","amber","orange"],So=["rose","sky","cyan","fuchsia"],Mo=["indigo","sky","violet","emerald","rose","amber","cyan","fuchsia","lime","orange","blue","pink"];function le(t){let e=2166136261;for(let o=0;o<t.length;o++)e^=t.charCodeAt(o),e=Math.imul(e,16777619);return Math.abs(e)}var _r={select:"teal",single_bond:"indigo",double_bond:"violet",triple_bond:"purple",wedge_bond:"amber",dash_bond:"orange",curved_arrow:"rose",reaction_arrow:"sky",equilibrium_arrow:"cyan",resonance_arrow:"fuchsia",benzene:"emerald",cyclohexane:"lime",cyclopentane:"green",cyclobutane:"teal",cyclopropane:"cyan",atom:"indigo",charge_plus:"rose",charge_minus:"sky",charge_pos:"rose",charge_neg:"sky",radical:"orange",lone_pair:"violet",text:"slate",point:"blue",line:"indigo",string:"indigo",dashed:"stone",dashed_line:"stone",vector:"sky",ray:"amber",axes:"slate",axes_3d:"slate",angle:"violet",arc:"violet",curve_arrow:"fuchsia",wire:"slate",resistor:"amber",capacitor:"blue",inductor:"violet",diode:"purple",battery:"green",meter_v:"cyan",meter_a:"cyan",meter:"cyan",ground:"stone",ac_source:"orange",spring:"lime",block:"amber",wedge:"amber",cart:"orange",particle:"blue",disk:"violet",rod:"stone",pulley:"slate",pivot:"red",com:"pink",surface:"stone",dimension:"cyan",point_mass:"blue",block_mass:"amber",com_indicator:"pink",system_boundary:"fuchsia",dashed_path:"stone",rocket:"orange",uniform_rod:"lime",solid_disk:"violet",hoop_ring:"purple",rolling_body:"rose",inclined_wedge:"amber",rectangle:"indigo",circle:"blue",ellipse:"violet",parabola_v:"emerald",parabola_h:"emerald",hyperbola:"purple",modulus:"orange",step_function:"stone",shaded_area:"cyan",exponential:"green",logarithmic:"teal",sine_wave:"sky",standing_wave:"cyan",wave_pulse:"blue",shm_graph:"violet",energy_graph:"amber",strobe_shm:"fuchsia",wall:"slate",speaker:"orange",tuning_fork:"amber",wavefronts:"sky",mach_cone:"purple",beats_graph:"pink",mass_box:"amber",pendulum:"indigo",torsion_pendulum:"violet",vane_liquid:"cyan",phasor:"fuchsia",damped_wave:"rose",dipole:"fuchsia",charged_plate_pos:"rose",charged_plate_neg:"sky",gaussian_sphere:"stone",gaussian_cylinder:"slate",lens_convex:"amber",lens_concave:"orange",mirror_plane:"sky",mirror_concave:"cyan",mirror_convex:"teal",prism:"violet",glass_slab:"blue",photon:"yellow",slit_double:"pink",slit_single:"rose",energy_level:"emerald",nucleus:"orange",b_field_line:"blue",b_field_curve:"indigo",bezier:"violet",pole_piece:"amber",b_region_in:"sky",b_region_out:"cyan",current_wire:"orange",bar_magnet:"red",coil:"purple",piston_cylinder:"sky",heat_engine:"orange",conduction_rod:"amber",pv_axes:"indigo",thermo_process:"violet",carnot_cycle:"fuchsia",maxwell_boltzmann:"emerald",diatomic_gas:"lime",random_walk:"stone"},Cr=new Set(["wire","resistor","capacitor","inductor","diode","battery","meter_v","meter_a","meter","ground","ac_source"]);function Er(t){let e=_r[t];if(e)return e;if(t.endsWith("_bond"))return $o[le(t)%$o.length];if(t.endsWith("_arrow"))return So[le(t)%So.length];let o=t.toLowerCase();if(o.includes("charge")&&(o.includes("pos")||o.includes("plus")||o.includes("_p")||o.endsWith("pos")))return "rose";if(o.includes("charge")&&(o.includes("neg")||o.includes("minus")))return "sky";if(t.startsWith("meter_"))return "violet";if(Cr.has(t)){let n=["slate","amber","blue","violet","green"];return n[le(t)%n.length]}if(o.includes("lens")||o.includes("mirror")||o==="ray"||o.includes("photon")){let n=["amber","sky","cyan","violet","yellow"];return n[le(t)%n.length]}return Mo[le(t)%Mo.length]}function wo(t,e){let o=Er(t);return e?Wo[o].active:Wo[o].idle}var Co=({categories:t,tool:e,onSelect:o})=>jsx("aside",{className:"w-[108px] border-r border-slate-200 bg-gradient-to-b from-slate-50 to-white flex flex-col items-center py-3 gap-4 overflow-y-auto shrink-0",children:t.map(n=>jsxs("section",{className:"flex flex-col items-center w-full px-2",children:[jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.20em] text-slate-400 mb-2 w-full text-center border-b border-slate-200 pb-1.5",children:n.name}),jsx("div",{className:"flex flex-col gap-1.5 w-full items-center",children:n.tools.map(r=>{let i=wo(r.id,e===r.id);return jsxs("button",{type:"button",onClick:()=>o(r.id),title:r.name,className:`p-2 rounded-xl border flex flex-col items-center gap-1 transition-all w-full ${i}`,children:[jsx("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",children:ze[r.id]??ze.line}),jsx("span",{className:"text-[11px] font-medium tracking-tight leading-tight text-center",children:r.name})]},r.id)})})]},n.name))});var zr=t=>["gaussian_cylinder","lens_convex","lens_concave","mirror_concave","mirror_convex","b_field_curve"].includes(t),Lr=t=>["lens_convex","lens_concave","mirror_concave","mirror_convex"].includes(t),Pr=t=>["text","point","charge_pos","charge_neg","point_mass","com_indicator","diatomic_gas","mass_box"].includes(t),Dr=t=>["point_mass","com_indicator","pivot"].includes(t),Nr=t=>["pendulum","mass_box"].includes(t),Ar=t=>["sine_wave","standing_wave","wave_pulse","damped_wave","beats_graph","shm_graph","energy_graph","strobe_shm"].includes(t),Rr=t=>["sine_wave","standing_wave","shm_graph","energy_graph","strobe_shm"].includes(t),Hr=t=>t==="rolling_body",Or=t=>t==="spring",Yr=t=>["block","cart"].includes(t),Eo=({element:t,onChange:e,onDelete:o,onClose:n})=>t?jsxs("div",{id:"svg-engine-properties-panel",role:"region","aria-label":"Element properties",className:"absolute right-6 top-6 w-80 bg-white/95 backdrop-blur rounded-xl shadow-2xl border border-slate-200 flex flex-col p-5 z-30 max-h-[80vh] overflow-y-auto",children:[jsxs("div",{className:"flex justify-between items-center border-b border-slate-100 pb-3 mb-4 sticky top-0 bg-white z-10",children:[jsx("h3",{className:"text-[11px] font-semibold text-blue-700 uppercase tracking-[0.18em]",children:"Properties"}),jsx("button",{type:"button",onClick:n,className:"text-slate-400 hover:text-slate-800",children:"\u2715"})]}),jsxs("div",{className:"space-y-4",children:[jsx("input",{className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:String(t.label||""),onChange:r=>e("label",r.target.value),placeholder:"Label"}),jsx("input",{className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:String(t.value||""),onChange:r=>e("value",r.target.value),placeholder:"Value"}),jsxs("div",{className:"grid grid-cols-2 gap-3",children:[jsx("input",{type:"color",value:String(t.color||"#0f172a"),onChange:r=>e("color",r.target.value),className:"h-10 w-full rounded-lg border border-slate-200"}),jsx("input",{type:"number",className:"px-3 py-2 border border-slate-300 rounded-lg text-sm",value:Number(t.strokeWidth||2),onChange:r=>e("strokeWidth",Number(r.target.value))})]}),Yr(String(t.type))&&jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Rotation (degrees)"}),jsx("input",{type:"number",className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:Number(t.rotation??0),onChange:r=>e("rotation",Number(r.target.value))})]}),zr(String(t.type))&&jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:t.type==="gaussian_cylinder"?"Cylinder half-height (curveHeight)":"Curve height"}),Lr(String(t.type))?jsxs(Fragment,{children:[jsx("input",{type:"number",className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",placeholder:"Auto",value:t.curveHeight===void 0||t.curveHeight===null?"":Number(t.curveHeight),onChange:r=>{let i=r.target.value;if(i==="")e("curveHeight",void 0);else {let l=Number(i);e("curveHeight",Number.isFinite(l)?l:void 0);}}}),jsx("p",{className:"text-[11px] text-slate-500 leading-snug",children:"Empty = auto (scales with chord length: lenses ~15% / 4% sagitta, mirrors ~20%)."})]}):jsx("input",{type:"number",className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:Number(t.curveHeight??(t.type==="b_field_curve"?50:t.type==="gaussian_cylinder"?40:20)),onChange:r=>e("curveHeight",Number(r.target.value))})]}),String(t.type)==="bezier"&&jsxs("label",{className:"flex items-center gap-2 text-sm text-slate-700",children:[jsx("input",{type:"checkbox",checked:!!t.showArrow,onChange:r=>e("showArrow",r.target.checked)}),jsx("span",{className:"text-xs font-medium text-slate-600",children:"Show arrow on curve"})]}),String(t.type)==="energy_level"&&jsx("input",{className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:String(t.energy??""),onChange:r=>e("energy",r.target.value),placeholder:"Energy (e.g. -13.6 eV)"}),Pr(String(t.type))&&jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Font size"}),jsx("input",{type:"number",className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:Number(t.fontSize??16),onChange:r=>e("fontSize",Number(r.target.value))})]}),Dr(String(t.type))&&jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Size (radius / pivot scale)"}),jsx("input",{type:"number",className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:Number(t.size??15),onChange:r=>e("size",Number(r.target.value))})]}),Nr(String(t.type))&&jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:t.type==="mass_box"?"Block size":"Bob radius"}),jsx("input",{type:"number",className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:Number(t.size??(t.type==="mass_box"?30:15)),onChange:r=>e("size",Number(r.target.value))})]}),Hr(String(t.type))&&jsxs("div",{className:"flex flex-col gap-2 text-sm text-slate-700",children:[jsxs("label",{className:"flex items-center gap-2",children:[jsx("input",{type:"checkbox",checked:!!t.showVelocity,onChange:r=>e("showVelocity",r.target.checked)}),jsx("span",{className:"text-xs font-medium text-slate-600",children:"Show velocity (v)"})]}),jsxs("label",{className:"flex items-center gap-2",children:[jsx("input",{type:"checkbox",checked:!!t.showOmega,onChange:r=>e("showOmega",r.target.checked)}),jsx("span",{className:"text-xs font-medium text-slate-600",children:"Show angular velocity (\u03C9)"})]})]}),Or(String(t.type))&&jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Coils"}),jsx("input",{type:"number",className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:Number(t.coils??6),onChange:r=>e("coils",Number(r.target.value))})]}),String(t.type)==="piston_cylinder"&&jsxs(Fragment,{children:[jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Compression (0.1\u20130.9)"}),jsx("input",{type:"range",min:.1,max:.9,step:.05,className:"w-full",value:Number(t.compression??.5),onChange:r=>e("compression",Number(r.target.value))})]}),jsxs("label",{className:"flex items-center gap-2 text-sm text-slate-700",children:[jsx("input",{type:"checkbox",checked:!!t.showHeat,onChange:r=>e("showHeat",r.target.checked)}),jsx("span",{className:"text-xs font-medium text-slate-600",children:"Show heat source (Q)"})]})]}),String(t.type)==="heat_engine"&&jsxs(Fragment,{children:[jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Machine type"}),jsxs("select",{className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm bg-white",value:String(t.engineType??"engine"),onChange:r=>e("engineType",r.target.value),children:[jsx("option",{value:"engine",children:"Heat engine"}),jsx("option",{value:"refrigerator",children:"Refrigerator / pump"})]})]}),jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Efficiency (display)"}),jsx("input",{type:"number",min:0,max:1,step:.05,className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:Number(t.efficiency??.4),onChange:r=>e("efficiency",Number(r.target.value))})]})]}),String(t.type)==="thermo_process"&&jsxs(Fragment,{children:[jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Process type"}),jsxs("select",{className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm bg-white",value:String(t.processType??"isotherm"),onChange:r=>e("processType",r.target.value),children:[jsx("option",{value:"isotherm",children:"Isothermal"}),jsx("option",{value:"adiabatic",children:"Adiabatic"}),jsx("option",{value:"isobaric",children:"Isobaric"}),jsx("option",{value:"isochoric",children:"Isochoric"})]})]}),jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Line style"}),jsxs("select",{className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm bg-white",value:String(t.lineStyle??"solid"),onChange:r=>e("lineStyle",r.target.value),children:[jsx("option",{value:"solid",children:"Solid"}),jsx("option",{value:"dashed",children:"Dashed"}),jsx("option",{value:"dotted",children:"Dotted"})]})]})]}),String(t.type)==="pv_axes"&&jsxs("div",{className:"grid grid-cols-2 gap-3",children:[jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"X label (V)"}),jsx("input",{className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:String(t.xLabel??"V"),onChange:r=>e("xLabel",r.target.value)})]}),jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Y label (P)"}),jsx("input",{className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:String(t.yLabel??"P"),onChange:r=>e("yLabel",r.target.value)})]})]}),String(t.type)==="maxwell_boltzmann"&&jsxs("div",{className:"grid grid-cols-2 gap-3",children:[jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"T\u2081 (K)"}),jsx("input",{type:"number",className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:Number(t.t1??300),onChange:r=>e("t1",Number(r.target.value))})]}),jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"T\u2082 (K)"}),jsx("input",{type:"number",className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:Number(t.t2??600),onChange:r=>e("t2",Number(r.target.value))})]})]}),String(t.type)==="diatomic_gas"&&jsxs("label",{className:"flex items-center gap-2 text-sm text-slate-700",children:[jsx("input",{type:"checkbox",checked:t.showRotations!==false,onChange:r=>e("showRotations",r.target.checked)}),jsx("span",{className:"text-xs font-medium text-slate-600",children:"Show rotation DOF"})]}),String(t.type)==="random_walk"&&jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Steps"}),jsx("input",{type:"number",min:2,max:30,className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:Number(t.steps??5),onChange:r=>e("steps",Number(r.target.value))})]}),Ar(String(t.type))&&jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Amplitude"}),jsx("input",{type:"number",min:1,max:200,step:1,className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:Number(t.amplitude??40),onChange:r=>e("amplitude",Number(r.target.value))})]}),Rr(String(t.type))&&jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Loops / waves (n)"}),jsx("input",{type:"number",min:.5,max:20,step:.5,className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:Number(t.loops??2),onChange:r=>e("loops",Number(r.target.value))})]}),String(t.type)==="shm_graph"&&jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Graph function"}),jsxs("select",{className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm bg-white",value:String(t.graphType??"x"),onChange:r=>e("graphType",r.target.value),children:[jsx("option",{value:"x",children:"Position x(t)"}),jsx("option",{value:"v",children:"Velocity v(t)"}),jsx("option",{value:"a",children:"Acceleration a(t)"}),jsx("option",{value:"all",children:"Compare all three"})]})]}),String(t.type)==="energy_graph"&&jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Domain"}),jsxs("select",{className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm bg-white",value:String(t.domain??"time"),onChange:r=>e("domain",r.target.value),children:[jsx("option",{value:"time",children:"Versus time (t)"}),jsx("option",{value:"position",children:"Versus position (x)"})]})]}),String(t.type)==="pendulum"&&jsxs("label",{className:"flex items-center gap-2 text-sm text-slate-700",children:[jsx("input",{type:"checkbox",checked:!!t.showForces,onChange:r=>e("showForces",r.target.checked)}),jsx("span",{className:"text-xs font-medium text-slate-600",children:"Show force vectors"})]}),String(t.type)==="phasor"&&jsxs("label",{className:"flex items-center gap-2 text-sm text-slate-700",children:[jsx("input",{type:"checkbox",checked:!!t.showProjection,onChange:r=>e("showProjection",r.target.checked)}),jsx("span",{className:"text-xs font-medium text-slate-600",children:"Show axis projections"})]}),String(t.type)==="damped_wave"&&jsxs(Fragment,{children:[jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Damping (b/2m)"}),jsx("input",{type:"number",min:0,max:.1,step:.005,className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:Number(t.damping??.015),onChange:r=>e("damping",Number(r.target.value))})]}),jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Angular frequency (\u03C9)"}),jsx("input",{type:"number",min:1,max:50,step:1,className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:Number(t.frequency??10),onChange:r=>e("frequency",Number(r.target.value))})]})]}),String(t.type)==="beats_graph"&&jsxs(Fragment,{children:[jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Carrier frequency (avg f)"}),jsx("input",{type:"number",min:5,max:50,step:1,className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:Number(t.frequency??15),onChange:r=>e("frequency",Number(r.target.value))})]}),jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Beat frequency (\u0394f)"}),jsx("input",{type:"number",min:.1,max:10,step:.1,className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:Number(t.beatFreq??2),onChange:r=>e("beatFreq",Number(r.target.value))})]})]}),String(t.type)==="wavefronts"&&jsxs(Fragment,{children:[jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Velocity ratio (v_s / v)"}),jsx("input",{type:"number",min:0,max:.9,step:.1,className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:Number(t.velocityRatio??.5),onChange:r=>e("velocityRatio",Number(r.target.value))})]}),jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Rings"}),jsx("input",{type:"number",min:1,max:20,step:1,className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:Number(t.rings??5),onChange:r=>e("rings",Number(r.target.value))})]})]}),String(t.type)==="mach_cone"&&jsxs("label",{className:"block space-y-1",children:[jsx("span",{className:"text-xs font-medium text-slate-600",children:"Mach number (M)"}),jsx("input",{type:"number",min:1.05,max:5,step:.1,className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm",value:Number(t.machNumber??2),onChange:r=>e("machNumber",Number(r.target.value))})]}),jsx("button",{type:"button",onClick:o,className:"w-full py-2 bg-red-50 text-red-600 hover:bg-red-100 rounded-lg text-sm font-semibold transition",children:"Delete Element"})]})]}):null;var zo=({open:t,jsonText:e,setJsonText:o,onClose:n,onLoad:r})=>t?jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:jsxs("div",{className:"bg-white rounded-lg shadow-xl w-full max-w-2xl flex flex-col max-h-full",children:[jsxs("div",{className:"px-6 py-4 border-b flex justify-between items-center",children:[jsx("h2",{className:"text-lg font-bold text-gray-800",children:"Diagram Data (JSON)"}),jsx("button",{onClick:n,className:"text-gray-500 hover:text-gray-800 font-bold",children:"\u2715"})]}),jsx("div",{className:"p-6 flex-1 overflow-hidden flex flex-col gap-4",children:jsx("textarea",{value:e,onChange:i=>o(i.target.value),className:"w-full flex-1 min-h-[300px] p-4 font-mono text-sm border border-gray-300 rounded-md",spellCheck:"false"})}),jsxs("div",{className:"px-6 py-4 border-t bg-gray-50 flex justify-end gap-3",children:[jsx("button",{onClick:n,className:"px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-200 rounded-md transition",children:"Cancel"}),jsx("button",{onClick:r,className:"px-4 py-2 text-sm font-medium bg-blue-600 text-white hover:bg-blue-700 rounded-md transition shadow-sm",children:"Load Diagram"})]})]})}):null;var Br=Ct.mechanics,Pe=forwardRef(function({initialElements:e,toolCategories:o,preset:n,enablePresetSwitch:r=true,onPresetChange:i,onChange:l,viewMode:a,embedded:c=false,documentTitle:d,hideDocumentTitle:y=false,onExport:h},f){let[$,w]=useState(n??"mechanics"),[W,P]=useState(0),Q=n!==void 0&&typeof i=="function";useEffect(()=>{Q&&n&&w(n);},[n,Q]);let j=Q?n??$:$,F=Ct[j]??Br;useEffect(()=>{P(0);},[j]);let G=useMemo(()=>e??(F.examples?.[W]?.elements??F.elements).slice(),[e,F,W]),u=vo(G,j);useEffect(()=>{l?.(u.elements);},[u.elements,l]),useEffect(()=>{typeof a=="boolean"&&u.setIsViewMode(a);},[a,u.setIsViewMode]),useEffect(()=>{u.selectedId||u.setShowProperties(false);},[u.selectedId,u.setShowProperties]);let U=o??F.toolCategories;useImperativeHandle(f,()=>({getData:()=>u.elements,setData:H=>u.setElements(H),clear:()=>u.setElements([])}),[u.elements,u.setElements]);let yt=d??`${F.name} Editor`,st=()=>{let H=JSON.stringify(u.elements,null,2);h?.({elements:u.elements,json:H}),typeof navigator<"u"&&navigator.clipboard?.writeText&&navigator.clipboard.writeText(H);},It=(H,D)=>{u.setElements(O=>O.map(K=>{if(K.id!==u.selectedId)return K;if(D===void 0){let ut={...K};return delete ut[H],ut}return {...K,[H]:D}}));},Bt=()=>{u.selectedId&&(u.setElements(H=>H.filter(D=>D.id!==u.selectedId)),u.setSelectedId(null),u.setShowProperties(false));},Zt=c?"flex flex-col h-full min-h-0 w-full bg-white text-gray-900 font-sans":"flex flex-col h-screen w-full bg-white text-gray-900 font-sans",Pt="text-xs md:text-sm px-2.5 md:px-3.5 py-2 rounded-lg font-medium transition border border-transparent";return jsxs("div",{className:Zt,children:[jsxs("header",{className:"border-b border-slate-200 bg-white/95 backdrop-blur flex items-center justify-between px-3 md:px-6 py-2 shadow-sm z-20 shrink-0 gap-2 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2 md:gap-3 min-w-0",children:[r&&jsxs("div",{className:"relative shrink-0",children:[jsx("select",{value:j,onChange:H=>{let D=H.target.value;Q||w(D),i?.(D);},className:"appearance-none text-xs md:text-sm pl-3 pr-8 py-2 rounded-full border border-slate-200 bg-slate-50 text-slate-700 shadow-sm hover:bg-slate-100 focus:outline-none focus:ring-2 focus:ring-blue-200",title:"Switch preset",children:Object.keys(Ct).map(H=>jsx("option",{value:H,children:Ct[H].name},H))}),jsx("span",{className:"pointer-events-none absolute inset-y-0 right-2 flex items-center text-slate-500 text-xs",children:"\u25BC"})]}),e==null&&F.examples&&F.examples.length>0&&jsxs("div",{className:"relative shrink-0 max-w-[min(280px,46vw)]",children:[jsx("select",{value:W,onChange:H=>P(Number(H.target.value)),className:"appearance-none w-full text-xs md:text-sm pl-3 pr-8 py-2 rounded-full border border-violet-200 bg-violet-50/90 text-violet-900 shadow-sm hover:bg-violet-100 focus:outline-none focus:ring-2 focus:ring-violet-200 truncate",title:"Load example scene",children:F.examples.map((H,D)=>jsx("option",{value:D,children:H.name},H.name))}),jsx("span",{className:"pointer-events-none absolute inset-y-0 right-2 flex items-center text-violet-600 text-xs",children:"\u25BC"})]}),!y&&jsx("h1",{className:"text-lg md:text-2xl font-semibold tracking-tight text-slate-800 truncate min-w-0",children:yt})]}),jsxs("div",{className:`flex gap-1.5 md:gap-3 items-center flex-wrap justify-end ${y?"ml-auto w-full":"ml-auto"}`,children:[jsx("button",{type:"button",onClick:st,className:`${Pt} text-slate-700 hover:bg-emerald-50 hover:text-emerald-700`,children:"Copy JSON"}),jsx("button",{type:"button",onClick:()=>{u.setJsonText(JSON.stringify(u.elements,null,2)),u.setShowJsonModal(true);},className:`${Pt} text-slate-700 hover:bg-blue-50 hover:text-blue-700`,children:"Export/Import"}),u.selectedId!=null&&!u.isViewMode&&jsxs("button",{type:"button",onClick:()=>u.setShowProperties(H=>!H),className:`${Pt} inline-flex items-center gap-1.5 ${u.showProperties?"bg-violet-100 text-violet-800 border-violet-200":"text-slate-700 hover:bg-violet-50 hover:text-violet-800"}`,title:u.showProperties?"Hide properties":"Edit properties","aria-expanded":u.showProperties,"aria-controls":"svg-engine-properties-panel",children:[jsx("svg",{className:"w-4 h-4 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":true,children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6V4m0 2a2 2 0 100 4m0-4a2 2 0 110 4m-6 8a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4m6 6v10m6-2a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4"})}),jsx("span",{className:"hidden sm:inline",children:"Properties"})]}),jsx("button",{type:"button",onClick:()=>{u.setIsViewMode(!u.isViewMode),u.setSelectedId(null),u.setTool("select");},className:`${Pt} ${u.isViewMode?"bg-blue-100 text-blue-800 border-blue-200":"text-slate-700 hover:bg-blue-50 hover:text-blue-700"}`,children:u.isViewMode?"Exit Preview":"Preview Mode"})]})]}),jsxs("div",{className:"flex flex-1 overflow-hidden min-h-0",children:[!u.isViewMode&&jsx(Co,{categories:U,tool:u.tool,onSelect:H=>{u.setTool(H),u.setSelectedId(null);}}),jsxs("div",{className:"flex-1 relative overflow-hidden bg-slate-50 min-h-0",children:[jsx(fe,{svgRef:u.svgRef,className:"w-full h-full",elements:u.elements,drawing:u.drawing,selectedId:u.selectedId,viewMode:u.isViewMode,onBackgroundMouseDown:u.isViewMode?void 0:u.handleMouseDown,onBackgroundMouseMove:u.isViewMode?void 0:u.handleMouseMove,onBackgroundMouseUp:u.isViewMode?void 0:u.handleMouseUp,onBackgroundMouseLeave:u.isViewMode?void 0:u.handleMouseUp,onElementMouseDown:u.onElementMouseDown,onHandlePointerDown:u.isViewMode?void 0:u.onHandlePointerDown}),u.showProperties&&u.selectedId&&!u.isViewMode&&jsx(Eo,{element:u.selectedElement,onChange:It,onDelete:Bt,onClose:()=>u.setShowProperties(false)})]})]}),jsx(zo,{open:u.showJsonModal,jsonText:u.jsonText,setJsonText:u.setJsonText,onClose:()=>u.setShowJsonModal(false),onLoad:()=>{try{u.setElements(JSON.parse(u.jsonText)),u.setShowJsonModal(!1);}catch{alert("Invalid JSON format");}}})]})});var Gr=t=>{switch(t){case "top-left":return {top:16,left:16};case "top-right":return {top:16,right:16};case "bottom-left":return {bottom:16,left:16};case "bottom-right":return {bottom:16,right:16};case "center":return {top:"50%",left:"50%",transform:"translate(-50%, -50%)"};default:return {top:16,right:16}}},Po=forwardRef(function({mode:e="floating",title:o="Diagram editor",startMinimized:n=false,position:r="top-right",width:i="min(960px, 92vw)",height:l="min(640px, 78vh)",onChange:a,onExport:c,onShellMinimize:d,onShellMaximize:y,onShellClose:h,documentTitle:f,...$},w){let W=useRef(null),[P,Q]=useState(n),[j,F]=useState(false),[G,u]=useState(false),[U,yt]=useState({x:0,y:0}),st=useRef(null),It=useRef(null);useImperativeHandle(w,()=>({getData:()=>W.current?.getData()??[],setData:O=>W.current?.setData(O),clear:()=>W.current?.clear(),minimize:()=>{Q(true),F(false);},maximize:()=>{Q(false),F(true);},restore:()=>{Q(false),F(false);},close:()=>u(true),open:()=>u(false)}),[]);let Bt=useCallback(O=>{c?.(O);},[c]),Zt=O=>{e!=="floating"||j||(O.preventDefault(),st.current={startX:O.clientX,startY:O.clientY,ox:U.x,oy:U.y},O.currentTarget.setPointerCapture(O.pointerId));},Pt=O=>{if(!st.current||e!=="floating"||j)return;let K=O.clientX-st.current.startX,ut=O.clientY-st.current.startY;yt({x:st.current.ox+K,y:st.current.oy+ut});},H=O=>{st.current=null;try{O.currentTarget.releasePointerCapture(O.pointerId);}catch{}},D=useMemo(()=>{if(e!=="floating")return {};let O=r==="center"?`translate(calc(-50% + ${U.x}px), calc(-50% + ${U.y}px))`:`translate(${U.x}px, ${U.y}px)`,K={position:"fixed",zIndex:9999,display:G?"none":"flex",flexDirection:"column",background:"#fff",borderRadius:"12px",boxShadow:"0 25px 50px -12px rgb(0 0 0 / 0.25)",border:"1px solid #e2e8f0",overflow:"hidden",transform:O};if(j)return {...K,inset:16,width:"auto",height:"auto",maxWidth:"none",maxHeight:"none",transform:`translate(${U.x}px, ${U.y}px)`};let ut=P?"auto":void 0;return {...K,...Gr(r),width:i,height:P?ut:l,maxHeight:P?"none":"90vh",maxWidth:"96vw"}},[e,G,j,P,r,i,l,U]);return e==="inline"?jsx("div",{className:"flex flex-col bg-white rounded-lg border border-gray-200 overflow-hidden",style:{width:i,height:l},children:jsx(Pe,{ref:W,...$,embedded:true,documentTitle:f??o,onChange:a,onExport:Bt})}):jsxs("div",{ref:It,style:D,className:"font-sans text-gray-900",children:[jsxs("div",{className:"h-11 shrink-0 flex items-center justify-between px-3 border-b border-gray-100 bg-slate-50 cursor-grab active:cursor-grabbing select-none",onPointerDown:Zt,onPointerMove:Pt,onPointerUp:H,onPointerCancel:H,children:[jsx("span",{className:"text-sm font-semibold text-slate-800 truncate pr-2",children:o}),jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[jsx("button",{type:"button",className:"p-1.5 rounded hover:bg-slate-200 text-slate-600",title:P?"Expand":"Minimize",onClick:O=>{O.stopPropagation(),Q(K=>!K),P||F(false),d?.();},children:P?"\u25A2":"\u2212"}),jsx("button",{type:"button",className:"p-1.5 rounded hover:bg-slate-200 text-slate-600",title:j?"Restore":"Maximize",onClick:O=>{O.stopPropagation(),F(K=>!K),j||Q(false),y?.();},children:"\u25A1"}),jsx("button",{type:"button",className:"p-1.5 rounded hover:bg-red-100 text-red-600",title:"Close",onClick:O=>{O.stopPropagation(),u(true),h?.();},children:"\xD7"})]})]}),jsx("div",{className:"flex-1 min-h-0 overflow-hidden flex flex-col",style:P?{maxHeight:0,opacity:0,overflow:"hidden",pointerEvents:"none"}:void 0,"aria-hidden":P,children:jsx(Pe,{ref:W,...$,embedded:true,hideDocumentTitle:true,documentTitle:f,onChange:a,onExport:Bt})}),P&&jsx("div",{className:"px-3 py-2 text-xs text-slate-500 border-t border-gray-100 bg-white",children:"Editor minimized \u2014 click \u25A2 on the bar to expand."})]})});function ge(t,e){let o=createRoot(t);return o.render(e),o}function be(t){t.unmount();}function Jr(t){if(!(t==null||t===""))try{let e=JSON.parse(t);return Array.isArray(e)?e:void 0}catch{return}}function Do(t,e){return t===null||t===""?e:t==="true"||t===""}var te=class extends HTMLElement{constructor(){super(...arguments);this.editorRef=createRef();this._elements=null;this._preset=null;this._mode=null;this._viewMode=null;this.committedInitial=null;this.pendingReseed=true;}connectedCallback(){this.style.display||(this.style.display="block"),this.render();}disconnectedCallback(){this.root&&(be(this.root),this.root=void 0);}attributeChangedCallback(o){(o==="data"||o==="preset")&&(this._elements=null,this.pendingReseed=true),this.isConnected&&this.render();}get elements(){return this.editorRef.current?.getData()??this.committedInitial??[]}set elements(o){this._elements=o.slice(),this.pendingReseed=true,this.render();}get preset(){let o=this._preset??this.getAttribute("preset");return o&&Ct[o]?o:void 0}set preset(o){this._preset=o??null,this.pendingReseed=true,this.render();}get mode(){let o=this._mode??this.getAttribute("mode");return o==="inline"||o==="floating"?o:"floating"}set mode(o){this._mode=o,this.render();}get viewMode(){return this._viewMode??Do(this.getAttribute("view-mode"),false)}set viewMode(o){this._viewMode=o,this.render();}getData(){return this.editorRef.current?.getData()??this.committedInitial??[]}setData(o){this._elements=o.slice(),this.committedInitial=o.slice(),this.pendingReseed=false,this.editorRef.current?this.editorRef.current.setData(o):this.render();}toJSON(){return JSON.stringify(this.getData(),null,2)}clear(){this._elements=[],this.committedInitial=[],this.pendingReseed=false,this.editorRef.current?this.editorRef.current.clear():this.render();}minimize(){this.editorRef.current?.minimize();}maximize(){this.editorRef.current?.maximize();}restore(){this.editorRef.current?.restore();}close(){this.editorRef.current?.close();}readParsedInitial(){let o=Jr(this.getAttribute("data")),n=this._preset??this.getAttribute("preset"),r=n&&Ct[n]?Ct[n]:Ct.mechanics;return this._elements?this._elements.slice():o?o.slice():r.elements.slice()}render(){(this.pendingReseed||this.committedInitial===null)&&(this.committedInitial=this.readParsedInitial(),this.pendingReseed=false);let o=this.mode,n=this.viewMode,r=this.getAttribute("title")??"Diagram editor",i=Do(this.getAttribute("start-minimized"),false),l=this.getAttribute("position")??"top-right",a=this.getAttribute("width"),c=this.getAttribute("height"),d=a===""?void 0:a??void 0,y=c===""?void 0:c??void 0,h=this.preset,f=this.committedInitial,$=jsx(Po,{ref:this.editorRef,mode:o,title:r,startMinimized:i,position:l,width:d,height:y,preset:h,initialElements:f,viewMode:n,onChange:w=>{this.dispatchEvent(new CustomEvent("change",{detail:{elements:w},bubbles:true,composed:true}));},onExport:w=>{this.dispatchEvent(new CustomEvent("export",{detail:{elements:w.elements,json:w.json},bubbles:true,composed:true}));},onShellMinimize:()=>{this.dispatchEvent(new CustomEvent("minimize",{bubbles:true,composed:true}));},onShellMaximize:()=>{this.dispatchEvent(new CustomEvent("maximize",{bubbles:true,composed:true}));},onShellClose:()=>{this.dispatchEvent(new CustomEvent("close",{bubbles:true,composed:true}));}});this.root?this.root.render($):this.root=ge(this,$);}};te.observedAttributes=["mode","preset","data","view-mode","title","start-minimized","position","width","height"];function No(t){if(!(t==null||t===""))try{let e=JSON.parse(t);return Array.isArray(e)?e:void 0}catch{return}}function tn(t,e){return t===null||t===""?e:t==="true"||t===""}var ee=class extends HTMLElement{constructor(){super(...arguments);this.svgRef=createRef();this._elements=null;this._showGrid=null;}connectedCallback(){this.style.display||(this.style.display="block"),this.render();}disconnectedCallback(){this.root&&(be(this.root),this.root=void 0);}attributeChangedCallback(){this.isConnected&&this.render();}get elements(){return this._elements??No(this.getAttribute("data"))??[]}set elements(o){this._elements=o.slice(),this.render();}get showGrid(){return this._showGrid??tn(this.getAttribute("show-grid"),false)}set showGrid(o){this._showGrid=o,this.render();}setData(o){this._elements=o.slice(),this.render();}toSvg(){return this.svgRef.current?.outerHTML??""}render(){let o=No(this.getAttribute("data")),n=this._elements??o??[],r=this.getAttribute("width")??"100%",i=this.getAttribute("height")??"100%",l=this.showGrid,a=jsx("div",{style:{width:r,height:i},className:"bg-white overflow-hidden",children:jsx(fe,{elements:n,viewMode:true,showGrid:l,className:"w-full h-full block",svgRef:this.svgRef})});this.root?this.root.render(a):this.root=ge(this,a);}};ee.observedAttributes=["data","width","height","show-grid"];function Ro(){typeof window>"u"||typeof customElements>"u"||(customElements.get("codefrydev-svg-engine")||customElements.define("codefrydev-svg-engine",te),customElements.get("codefrydev-svg-engine-prev")||customElements.define("codefrydev-svg-engine-prev",ee));}Ro();export{te as CodefrydevSvgEngine,ee as CodefrydevSvgEnginePrev,Ro as defineSvgEngineComponents};