{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/oZ4chSESwErUWTnQlIGf/UKjZDE5ek7o5Xoy0TyRO/Fiber_Collimator_Calculator.js"],
  "sourcesContent": ["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect}from\"react\";import{addPropertyControls,ControlType}from\"framer\";export default function FiberCollimatorCalculator(props){// Input state variables\nconst[fiberCoreDiameterInput,setFiberCoreDiameterInput]=useState(\"25\");const[numericalApertureInput,setNumericalApertureInput]=useState(\"0.15\");const[collimatingFocalLengthInput,setCollimatingFocalLengthInput]=useState(\"30\");const[focusingFocalLengthInput,setFocusingFocalLengthInput]=useState(\"30\");const[errors,setErrors]=useState({});const[savedCalculations,setSavedCalculations]=useState([]);// Calculated results\nconst[focusedSpotRadius,setFocusedSpotRadius]=useState(null);useEffect(()=>{const parsedFiberCoreDiameter=parseFloat(fiberCoreDiameterInput);const parsedNumericalAperture=parseFloat(numericalApertureInput);const parsedCollimatingFocalLength=parseFloat(collimatingFocalLengthInput);const parsedFocusingFocalLength=parseFloat(focusingFocalLengthInput);let valid=true;let newErrors={};if(isNaN(parsedFiberCoreDiameter)||parsedFiberCoreDiameter<=0){valid=false;newErrors.fiberCoreDiameter=\"Value must be positive\";}if(isNaN(parsedNumericalAperture)||parsedNumericalAperture<=0){valid=false;newErrors.numericalAperture=\"Value must be positive\";}if(isNaN(parsedCollimatingFocalLength)||parsedCollimatingFocalLength<=0){valid=false;newErrors.collimatingFocalLength=\"Value must be positive\";}if(isNaN(parsedFocusingFocalLength)||parsedFocusingFocalLength<=0){valid=false;newErrors.focusingFocalLength=\"Value must be positive\";}setErrors(newErrors);if(valid){const spotRadius=parsedFiberCoreDiameter/2*(parsedFocusingFocalLength/parsedCollimatingFocalLength);setFocusedSpotRadius(spotRadius);}else{setFocusedSpotRadius(null);}},[fiberCoreDiameterInput,numericalApertureInput,collimatingFocalLengthInput,focusingFocalLengthInput]);const resetInputs=()=>{setFiberCoreDiameterInput(\"25\");setNumericalApertureInput(\"0.15\");setCollimatingFocalLengthInput(\"30\");setFocusingFocalLengthInput(\"30\");setErrors({});setFocusedSpotRadius(null);};const saveCalculation=()=>{setSavedCalculations(prev=>[...prev,{fiberCoreDiameterInput,numericalApertureInput,collimatingFocalLengthInput,focusingFocalLengthInput,focusedSpotRadius}]);};const inputStyle={width:\"100%\",padding:\"8px\",backgroundColor:props.inputBackgroundColor,color:props.textColor,border:\"none\",borderRadius:\"4px\",fontSize:\"14px\",marginTop:\"4px\"};const labelStyle={color:props.labelColor,fontSize:\"14px\",marginBottom:\"4px\"};const primaryButtonStyle={marginTop:\"10px\",padding:\"10px\",backgroundColor:props.primaryButtonColor,color:props.textColor,border:\"none\",borderRadius:\"4px\",cursor:\"pointer\",width:\"100%\",fontSize:\"16px\"};const secondaryButtonStyle={marginTop:\"10px\",padding:\"10px\",backgroundColor:props.secondaryButtonColor,color:props.textColor,border:\"none\",borderRadius:\"4px\",cursor:\"pointer\",width:\"100%\",fontSize:\"16px\"};return /*#__PURE__*/_jsxs(\"div\",{style:{fontFamily:\"Arial, sans-serif\",padding:\"20px\",backgroundColor:props.backgroundColor,color:props.textColor,borderRadius:`${props.borderRadius}px`,boxShadow:\"0 4px 6px rgba(0,0,0,0.1)\",width:\"100%\",maxWidth:\"400px\"},children:[/*#__PURE__*/_jsx(\"h2\",{style:{color:props.textColor,marginBottom:\"20px\"},children:props.title}),[{label:\"Fiber Core Diameter (\u03BCm):\",value:fiberCoreDiameterInput,onChange:setFiberCoreDiameterInput,error:errors.fiberCoreDiameter},{label:\"Numerical Aperture (NA):\",value:numericalApertureInput,onChange:setNumericalApertureInput,error:errors.numericalAperture},{label:\"Collimating Lens Focal Length (mm):\",value:collimatingFocalLengthInput,onChange:setCollimatingFocalLengthInput,error:errors.collimatingFocalLength},{label:\"Focusing Lens Focal Length (mm):\",value:focusingFocalLengthInput,onChange:setFocusingFocalLengthInput,error:errors.focusingFocalLength}].map((field,index)=>/*#__PURE__*/_jsxs(\"div\",{style:{marginBottom:\"10px\"},children:[/*#__PURE__*/_jsx(\"label\",{style:labelStyle,children:field.label}),/*#__PURE__*/_jsx(\"input\",{type:\"number\",value:field.value,onChange:e=>field.onChange(e.target.value),style:{...inputStyle,borderColor:field.error?\"red\":\"transparent\"}}),field.error&&/*#__PURE__*/_jsx(\"div\",{style:{color:\"red\",fontSize:\"12px\"},children:field.error})]},index)),/*#__PURE__*/_jsx(\"div\",{style:{marginTop:\"20px\",fontSize:\"18px\",fontWeight:\"bold\",backgroundColor:props.resultBackgroundColor,padding:\"10px\",borderRadius:\"4px\"},role:\"status\",\"aria-live\":\"polite\",children:focusedSpotRadius!==null?`Focused Spot Radius: ${focusedSpotRadius.toFixed(2)} \u03BCm`:\"Please enter valid inputs\"}),/*#__PURE__*/_jsx(\"button\",{onClick:resetInputs,style:secondaryButtonStyle,children:\"Reset\"}),/*#__PURE__*/_jsx(\"button\",{onClick:saveCalculation,style:primaryButtonStyle,children:\"Save Calculation\"}),savedCalculations.length>0&&/*#__PURE__*/_jsxs(\"div\",{style:{marginTop:\"20px\"},children:[/*#__PURE__*/_jsx(\"h3\",{style:{color:props.textColor},children:\"Saved Calculations\"}),savedCalculations.map((calc,index)=>/*#__PURE__*/_jsxs(\"div\",{style:{backgroundColor:props.inputBackgroundColor,padding:\"10px\",marginTop:\"5px\",borderRadius:\"4px\"},children:[\"Focused Spot Radius:\",\" \",calc.focusedSpotRadius.toFixed(2),\" \u03BCm\"]},index))]})]});}FiberCollimatorCalculator.displayName=\"Fiber Collimator Calculator\";addPropertyControls(FiberCollimatorCalculator,{title:{type:ControlType.String,title:\"Calculator Title\",defaultValue:\"Fiber Collimator Calculator\"},backgroundColor:{type:ControlType.Color,title:\"Background Color\",defaultValue:\"#1E1E2E\"},inputBackgroundColor:{type:ControlType.Color,title:\"Input Background\",defaultValue:\"#2D2B55\"},resultBackgroundColor:{type:ControlType.Color,title:\"Result Background\",defaultValue:\"#2D2B55\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#FFFFFF\"},labelColor:{type:ControlType.Color,title:\"Label Color\",defaultValue:\"#A6A6A6\"},primaryButtonColor:{type:ControlType.Color,title:\"Primary Button Color\",defaultValue:\"#7E57C2\"},secondaryButtonColor:{type:ControlType.Color,title:\"Secondary Button Color\",defaultValue:\"#4A4A4A\"},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:8,min:0,max:20,step:1}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"FiberCollimatorCalculator\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Fiber_Collimator_Calculator.map"],
  "mappings": "uJAAAA,IAAkK,SAARC,EAA2CC,EAAM,CAC3M,GAAK,CAACC,EAAuBC,CAAyB,EAAEC,EAAS,IAAI,EAAO,CAACC,EAAuBC,CAAyB,EAAEF,EAAS,MAAM,EAAO,CAACG,EAA4BC,CAA8B,EAAEJ,EAAS,IAAI,EAAO,CAACK,EAAyBC,CAA2B,EAAEN,EAAS,IAAI,EAAO,CAACO,EAAOC,CAAS,EAAER,EAAS,CAAC,CAAC,EAAO,CAACS,EAAkBC,CAAoB,EAAEV,EAAS,CAAC,CAAC,EACrY,CAACW,EAAkBC,CAAoB,EAAEZ,EAAS,IAAI,EAAEa,EAAU,IAAI,CAAC,IAAMC,EAAwB,WAAWhB,CAAsB,EAAQiB,EAAwB,WAAWd,CAAsB,EAAQe,EAA6B,WAAWb,CAA2B,EAAQc,EAA0B,WAAWZ,CAAwB,EAAMa,EAAM,GAASC,EAAU,CAAC,EAAgjB,IAA3iB,MAAML,CAAuB,GAAGA,GAAyB,KAAGI,EAAM,GAAMC,EAAU,kBAAkB,2BAA6B,MAAMJ,CAAuB,GAAGA,GAAyB,KAAGG,EAAM,GAAMC,EAAU,kBAAkB,2BAA6B,MAAMH,CAA4B,GAAGA,GAA8B,KAAGE,EAA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["init_ssg_sandbox_shims", "FiberCollimatorCalculator", "props", "fiberCoreDiameterInput", "setFiberCoreDiameterInput", "ye", "numericalApertureInput", "setNumericalApertureInput", "collimatingFocalLengthInput", "setCollimatingFocalLengthInput", "focusingFocalLengthInput", "setFocusingFocalLengthInput", "errors", "setErrors", "savedCalculations", "setSavedCalculations", "focusedSpotRadius", "setFocusedSpotRadius", "ue", "parsedFiberCoreDiameter", "parsedNumericalAperture", "parsedCollimatingFocalLength", "parsedFocusingFocalLength", "valid", "newErrors", "spotRadius", "resetInputs", "saveCalculation", "prev", "inputStyle", "labelStyle", "primaryButtonStyle", "secondaryButtonStyle", "u", "p", "field", "index", "e", "calc", "addPropertyControls", "ControlType"]
}
