1import{r as b,j as e}from"./index-BzPuTbLk.js";import{S as k}from"./settings-CY-cGCxh.js";import{C as j}from"./calculator-D4I4NkRV.js";import{R as F}from"./rotate-ccw-BVEzCE6U.js";import{D as H}from"./download-djpbWvJa.js";import{C as I}from"./chevron-down-B1H8UU4h.js";import"./FooterTailwind-enAT_Y5V.js";import"./button-C52vHxr1.js";import"./anime.es-DjbxoOUh.js";const u=({label:r,unit:o,error:s,tooltip:l,className:i="",...n})=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-sm font-semibold text-[hsl(var(--foreground))]",children:r}),l&&e.jsxs("div",{className:"group relative",children:[e.jsx("div",{className:"h-4 w-4 rounded-full bg-muted text-xs flex items-center justify-center cursor-help",children:"?"}),e.jsx("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 hidden group-hover:block bg-[hsl(var(--foreground))] text-[hsl(var(--background))] text-xs rounded p-2 whitespace-nowrap z-10",children:l})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{className:`w-full px-4 py-3 bg-[hsl(var(--panel))] border border-border rounded-lg focus:outline-none focus:ring-2 focus:ring-[hsl(var(--primary))]/20 focus:border-[hsl(var(--primary))] placeholder:text-muted-foreground transition-all duration-300 ${s&&"border-red-500 focus:border-red-500"} ${i}`,...n}),o&&e.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground",children:o})]}),s&&e.jsx("p",{className:"text-sm text-red-500",children:s})]}),h=({label:r,options:o,error:s,tooltip:l,className:i="",...n})=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-sm font-semibold text-[hsl(var(--foreground))]",children:r}),l&&e.jsxs("div",{className:"group relative",children:[e.jsx("div",{className:"h-4 w-4 rounded-full bg-muted text-xs flex items-center justify-center cursor-help",children:"?"}),e.jsx("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 hidden group-hover:block bg-[hsl(var(--foreground))] text-[hsl(var(--background))] text-xs rounded p-2 whitespace-nowrap z-10",children:l})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx("select",{className:`w-full px-4 py-3 bg-[hsl(var(--panel))] border border-border rounded-lg appearance-none focus:outline-none focus:ring-2 focus:ring-[hsl(var(--primary))]/20 focus:border-[hsl(var(--primary))] transition-all duration-300 ${s&&"border-red-500 focus:border-red-500"} ${i}`,...n,children:o.map(d=>e.jsx("option",{value:d.value,children:d.label},d.value))}),e.jsx(I,{className:"absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"})]}),s&&e.jsx("p",{className:"text-sm text-red-500",children:s})]}),G=()=>{const[r,o]=b.useState({doorWeight:0,doorHeight:0,liftType:"standard",shaftDiameter:1,drumSize:12,springDiameter:2,wireSize:.25,numberOfSprings:2,units:"imperial"}),[s,l]=b.useState(null),[i,n]=b.useState({}),d=[{value:"standard",label:"Standard Lift"},{value:"high",label:"High Lift"},{value:"vertical",label:"Vertical Lift"}],N=[{value:"1.75",label:'1.75"'},{value:"2.0",label:'2.0"'},{value:"2.25",label:'2.25"'},{value:"2.5",label:'2.5"'}],y=[{value:"0.192",label:'0.192"'},{value:"0.207",label:'0.207"'},{value:"0.218",label:'0.218"'},{value:"0.225",label:'0.225"'},{value:"0.243",label:'0.243"'},{value:"0.25",label:'0.25"'},{value:"0.262",label:'0.262"'}],w=[{value:"1",label:"1 Spring"},{value:"2",label:"2 Springs (Pair)"}],S=()=>{const t={};return(r.doorWeight<=0||r.doorWeight>1500)&&(t.doorWeight="Door weight must be between 1 and 1500 lbs"),(r.doorHeight<=0||r.doorHeight>12)&&(t.doorHeight="Door height must be between 1 and 12 feet"),(r.shaftDiameter<=0||r.shaftDiameter>2)&&(t.shaftDiameter="Shaft diameter must be between 0.1 and 2 inches"),n(t),Object.keys(t).length===0},C=()=>{if(!S())return null;const g={standard:1,high:1.15,vertical:1.3}[r.liftType],m=r.doorWeight*r.drumSize*g/2/r.numberOfSprings,p=r.wireSize,f=r.springDiameter-p,x=115e5*Math.pow(p,4)/(8*Math.pow(f,3)),v=Math.ceil(m/x*12),T=r.doorHeight*4/(Math.PI*r.drumSize/12),M=8*m*f/(Math.PI*Math.pow(p,3)),O=Math.max(5e3,Math.min(5e4,1e5-M*50)),W=x*v/m;return{springLength:v,requiredTorque:m,numberOfTurns:Math.round(T*100)/100,estimatedCycles:Math.round(O),springConstant:Math.round(x*100)/100,safetyFactor:Math.round(W*100)/100}},D=()=>{const t=C();t&&l(t)},z=()=>{o({doorWeight:0,doorHeight:0,liftType:"standard",shaftDiameter:1,drumSize:12,springDiameter:2,wireSize:.25,numberOfSprings:2,units:"imperial"}),l(null),n({})},a=(t,g)=>{o(c=>({...c,[t]:g})),i[t]&&n(c=>({...c,[t]:""}))};return e.jsx("div",{className:"bg-[hsl(var(--background))]",children:e.jsx("div",{className:"container mx-auto px-4 py-8",children:e.jsxs("div",{className:"grid lg:grid-cols-2 gap-8 max-w-7xl mx-auto",children:[e.jsxs("div",{className:"bg-gradient-to-br from-[hsl(var(--panel))] to-muted/40 rounded-xl shadow-lg border-0 p-6",children:[e.jsx("div",{className:"mb-6",children:e.jsxs("h2",{className:"flex items-center gap-2 text-[hsl(var(--primary))] text-xl font-semibold",children:[e.jsx(k,{className:"h-5 w-5"}),"Door Specifications"]})}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-4 p-4 bg-muted rounded-lg",children:[e.jsx("span",{className:"text-sm font-medium",children:"Units:"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{className:`px-4 py-2 text-sm font-medium rounded-md transition-all duration-200 ${r.units==="imperial"?"bg-[hsl(var(--primary))] text-white shadow-md":"bg-white text-foreground border border-border hover:bg-muted/50"}`,onClick:()=>a("units","imperial"),children:"Imperial"}),e.jsx("button",{className:`px-4 py-2 text-sm font-medium rounded-md transition-all duration-200 ${r.units==="metric"?"bg-[hsl(var(--primary))] text-white shadow-md":"bg-white text-foreground border border-border hover:bg-muted/50"}`,onClick:()=>a("units","metric"),children:"Metric"})]})]}),e.jsxs("div",{className:"grid gap-6",children:[e.jsx(u,{label:"Door Weight",unit:r.units==="imperial"?"lbs":"kg",type:"number",value:r.doorWeight||"",onChange:t=>a("doorWeight",parseFloat(t.target.value)||0),placeholder:"Enter door weight",error:i.doorWeight,tooltip:"Total weight of the garage door including panels and hardware"}),e.jsx(u,{label:"Door Height",unit:r.units==="imperial"?"ft":"m",type:"number",step:"0.1",value:r.doorHeight||"",onChange:t=>a("doorHeight",parseFloat(t.target.value)||0),placeholder:"Enter door height",error:i.doorHeight,tooltip:"Height of the garage door from bottom to top"}
1),e.jsx(h,{label:"Lift Type",options:d,value:r.liftType,onChange:t=>a("liftType",t.target.value),tooltip:"Type of lift mechanism for the garage door"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(u,{label:"Shaft Diameter",unit:"in",type:"number",step:"0.1",value:r.shaftDiameter||"",onChange:t=>a("shaftDiameter",parseFloat(t.target.value)||0),placeholder:"1.0",error:i.shaftDiameter,tooltip:"Diameter of the torsion shaft"}),e.jsx(u,{label:"Drum Size",unit:"in",type:"number",value:r.drumSize||"",onChange:t=>a("drumSize",parseFloat(t.target.value)||0),placeholder:"12",tooltip:"Diameter of the cable drum"})]}),e.jsx(h,{label:"Spring Inside Diameter",options:N,value:r.springDiameter.toString(),onChange:t=>a("springDiameter",parseFloat(t.target.value)),tooltip:"Inside diameter of the torsion spring"}),e.jsx(h,{label:"Wire Size",options:y,value:r.wireSize.toString(),onChange:t=>a("wireSize",parseFloat(t.target.value)),tooltip:"Diameter of the spring wire"}),e.jsx(h,{label:"Number of Springs",options:w,value:r.numberOfSprings.toString(),onChange:t=>a("numberOfSprings",parseInt(t.target.value)),tooltip:"Single spring or pair of springs"})]}),e.jsxs("div",{className:"flex gap-3 pt-4",children:[e.jsxs("button",{onClick:D,className:"flex-1 bg-[hsl(var(--accent))] hover:bg-[hsl(var(--accent))]/90 text-[hsl(var(--foreground))] font-semibold py-3 px-6 rounded-lg transition-all duration-200 hover:transform hover:-translate-y-1 hover:shadow-lg flex items-center justify-center gap-2",children:[e.jsx(j,{className:"h-4 w-4"}),"Calculate Springs"]}),e.jsx("button",{onClick:z,className:"px-6 py-3 border border-border bg-white text-foreground rounded-lg hover:bg-muted/50 transition-all duration-200",children:e.jsx(F,{className:"h-4 w-4"})})]})]})]}),e.jsxs("div",{className:"bg-gradient-to-br from-[hsl(var(--panel))] to-muted/40 rounded-xl shadow-lg border-0 p-6",children:[e.jsx("div",{className:"mb-6",children:e.jsxs("h2",{className:"flex items-center gap-2 text-[hsl(var(--primary))] text-xl font-semibold",children:[e.jsx(H,{className:"h-5 w-5"}),"Calculation Results"]})}),e.jsx("div",{children:s?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"p-4 bg-gradient-to-r from-[hsl(var(--primary))]/10 to-[hsl(var(--primary))]/5 rounded-lg border border-[hsl(var(--primary))]/20",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Recommended Spring Length"}),e.jsx("span",{className:"px-2 py-1 text-xs bg-[hsl(var(--primary))]/10 text-[hsl(var(--primary))] rounded-full border border-[hsl(var(--primary))]/20",children:"Primary"})]}),e.jsx("div",{className:"text-2xl font-bold text-[hsl(var(--primary))] mt-1",children:s.springLength})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"p-4 bg-[hsl(var(--accent))]/10 rounded-lg border border-[hsl(var(--accent))]/20",children:[e.jsx("div",{className:"text-sm font-medium text-muted-foreground",children:"Required Torque"}),e.jsxs("div",{className:"text-xl font-bold text-[hsl(var(--foreground))] mt-1",children:[s.requiredTorque.toFixed(1)," in-lbs"]})]}),e.jsxs("div",{className:"p-4 bg-[hsl(var(--accent))]/10 rounded-lg border border-[hsl(var(--accent))]/20",children:[e.jsx("div",{className:"text-sm font-medium text-muted-foreground",children:"Number of Turns"}),e.jsx("div",{className:"text-xl font-bold text-[hsl(var(--foreground))] mt-1",children:s.numberOfTurns})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"p-4 bg-muted rounded-lg",children:[e.jsx("div",{className:"text-sm font-medium text-muted-foreground",children:"Estimated Cycles"}),e.jsx("div",{className:"text-lg font-semibold text-[hsl(var(--foreground))] mt-1",children:s.estimatedCycles.toLocaleString()})]}),e.jsxs("div",{className:"p-4 bg-muted rounded-lg",children:[e.jsx("div",{className:"text-sm font-medium text-muted-foreground",children:"Safety Factor"}),e.jsx("div",{className:"text-lg font-semibold text-[hsl(var(--foreground))] mt-1",children:s.safetyFactor})]})]}),e.jsxs("div",{className:"p-4 bg-muted/50 rounded-lg",children:[e.jsx("div",{className:"text-sm font-medium text-muted-foreground mb-2",children:"Spring Constant"}),e.jsxs("div",{className:"text-lg font-semibold text-[hsl(var(--foreground))]",children:[s.springConstant," in-lbs/turn"]})]})]}),e.jsxs("div",{className:"space-y-3",children:[s.estimatedCycles<1e4&&e.jsx("div",{className:"p-3 bg-red-50 border border-red-200 rounded-lg",children:e.jsx("p",{className:"text-sm text-red-600 font-medium",children:"â ï¸ Warning: Low cycle life expectancy. Consider using a larger wire size."})}),s.safetyFactor<1.2&&e.jsx("div",{className:"p-3 bg-red-50 border border-red-200 rounded-lg",children:e.jsx("p",{className:"text-sm text-red-600 font-medium",children:"â ï¸ Warning: Low safety factor. Spring may be undersized."})})]})]}):e.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[e.jsx(j,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{className:"text-lg font-medium mb-2",children:"Ready to Calculate"}),e.jsx("p",{className:"text-sm",children:'Enter door specifications and click "Calculate Springs" to see results'})]})})]})]})})})};export{G as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.