{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/oe27Vhz45FxrfRcvtv2c/SYM5W8Z86QuEunnmW6Qn/Fiber_Loss_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 FiberLossCalculator(props){// Input state variables\nconst[fiberLengthInput,setFiberLengthInput]=useState(\"1\");const[fiberAttenuationInput,setFiberAttenuationInput]=useState(\"0.35\");const[connectorPairsInput,setConnectorPairsInput]=useState(\"2\");const[connectorLossInput,setConnectorLossInput]=useState(\"0.5\");const[splicesInput,setSplicesInput]=useState(\"0\");const[spliceLossInput,setSpliceLossInput]=useState(\"0.1\");const[safetyMarginInput,setSafetyMarginInput]=useState(\"3\");const[fiberType,setFiberType]=useState(\"singleMode\");const[errors,setErrors]=useState({});const[savedCalculations,setSavedCalculations]=useState([]);// Calculated total loss\nconst[totalLoss,setTotalLoss]=useState(null);const fiberTypes={singleMode:{defaultAttenuation:.35},multiMode:{defaultAttenuation:3}};useEffect(()=>{const parsedFiberLength=parseFloat(fiberLengthInput);const parsedFiberAttenuation=parseFloat(fiberAttenuationInput);const parsedConnectorPairs=parseFloat(connectorPairsInput);const parsedConnectorLoss=parseFloat(connectorLossInput);const parsedSplices=parseFloat(splicesInput);const parsedSpliceLoss=parseFloat(spliceLossInput);const parsedSafetyMargin=parseFloat(safetyMarginInput);let valid=true;let newErrors={};if(isNaN(parsedFiberLength)||parsedFiberLength<0){valid=false;newErrors.fiberLength=\"Value must be non-negative\";}if(isNaN(parsedFiberAttenuation)||parsedFiberAttenuation<0){valid=false;newErrors.fiberAttenuation=\"Value must be non-negative\";}if(isNaN(parsedConnectorPairs)||parsedConnectorPairs<0){valid=false;newErrors.connectorPairs=\"Value must be non-negative\";}if(isNaN(parsedConnectorLoss)||parsedConnectorLoss<0){valid=false;newErrors.connectorLoss=\"Value must be non-negative\";}if(isNaN(parsedSplices)||parsedSplices<0){valid=false;newErrors.splices=\"Value must be non-negative\";}if(isNaN(parsedSpliceLoss)||parsedSpliceLoss<0){valid=false;newErrors.spliceLoss=\"Value must be non-negative\";}if(isNaN(parsedSafetyMargin)||parsedSafetyMargin<0){valid=false;newErrors.safetyMargin=\"Value must be non-negative\";}setErrors(newErrors);if(valid){const fiberLoss=parsedFiberLength*parsedFiberAttenuation;const connectorLossTotal=parsedConnectorPairs*parsedConnectorLoss;const spliceLossTotal=parsedSplices*parsedSpliceLoss;const calculatedTotalLoss=fiberLoss+connectorLossTotal+spliceLossTotal+parsedSafetyMargin;setTotalLoss(calculatedTotalLoss);}else{setTotalLoss(null);}},[fiberLengthInput,fiberAttenuationInput,connectorPairsInput,connectorLossInput,splicesInput,spliceLossInput,safetyMarginInput]);const resetInputs=()=>{setFiberLengthInput(\"1\");setFiberAttenuationInput(fiberTypes[fiberType].defaultAttenuation.toString());setConnectorPairsInput(\"2\");setConnectorLossInput(\"0.5\");setSplicesInput(\"0\");setSpliceLossInput(\"0.1\");setSafetyMarginInput(\"3\");setErrors({});setTotalLoss(null);};const saveCalculation=()=>{setSavedCalculations(prev=>[...prev,{fiberLengthInput,fiberAttenuationInput,connectorPairsInput,connectorLossInput,splicesInput,spliceLossInput,safetyMarginInput,totalLoss}]);};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}),props.showFiberTypeSelector&&/*#__PURE__*/_jsxs(\"div\",{style:{marginBottom:\"15px\"},children:[/*#__PURE__*/_jsx(\"label\",{style:labelStyle,children:\"Fiber Type:\"}),/*#__PURE__*/_jsxs(\"select\",{value:fiberType,onChange:e=>{setFiberType(e.target.value);setFiberAttenuationInput(fiberTypes[e.target.value].defaultAttenuation.toString());},style:{...inputStyle,appearance:\"none\"},children:[/*#__PURE__*/_jsx(\"option\",{value:\"singleMode\",children:\"Single Mode\"}),/*#__PURE__*/_jsx(\"option\",{value:\"multiMode\",children:\"Multi Mode\"})]})]}),[{label:\"Fiber Length (km):\",value:fiberLengthInput,onChange:setFiberLengthInput,error:errors.fiberLength},{label:\"Fiber Attenuation (dB/km):\",value:fiberAttenuationInput,onChange:setFiberAttenuationInput,error:errors.fiberAttenuation},{label:\"Number of Connector Pairs:\",value:connectorPairsInput,onChange:setConnectorPairsInput,error:errors.connectorPairs},{label:\"Connector Loss (dB):\",value:connectorLossInput,onChange:setConnectorLossInput,error:errors.connectorLoss},{label:\"Number of Splices:\",value:splicesInput,onChange:setSplicesInput,error:errors.splices},{label:\"Splice Loss (dB):\",value:spliceLossInput,onChange:setSpliceLossInput,error:errors.spliceLoss},{label:\"Safety Margin (dB):\",value:safetyMarginInput,onChange:setSafetyMarginInput,error:errors.safetyMargin}].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:totalLoss!==null?`Total Loss: ${totalLoss.toFixed(2)} dB`:\"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:[\"Total Loss: \",calc.totalLoss.toFixed(2),\" dB\"]},index))]})]});}FiberLossCalculator.displayName=\"Fiber Loss Calculator\";addPropertyControls(FiberLossCalculator,{title:{type:ControlType.String,title:\"Calculator Title\",defaultValue:\"Fiber Loss Calculator\"},backgroundColor:{type:ControlType.Color,title:\"Background Color\",defaultValue:\"#1E1E2E\"},inputBackgroundColor:{type:ControlType.Color,title:\"Input 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\"},resultBackgroundColor:{type:ControlType.Color,title:\"Result Background\",defaultValue:\"#2D2B55\"},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:8,min:0,max:20,step:1},showFiberTypeSelector:{type:ControlType.Boolean,title:\"Show Fiber Type Selector\",defaultValue:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"FiberLossCalculator\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Fiber_Loss_Calculator.map"],
  "mappings": "uJAAAA,IAAkK,SAARC,EAAqCC,EAAM,CACrM,GAAK,CAACC,EAAiBC,CAAmB,EAAEC,EAAS,GAAG,EAAO,CAACC,EAAsBC,CAAwB,EAAEF,EAAS,MAAM,EAAO,CAACG,EAAoBC,CAAsB,EAAEJ,EAAS,GAAG,EAAO,CAACK,EAAmBC,CAAqB,EAAEN,EAAS,KAAK,EAAO,CAACO,EAAaC,CAAe,EAAER,EAAS,GAAG,EAAO,CAACS,EAAgBC,CAAkB,EAAEV,EAAS,KAAK,EAAO,CAACW,EAAkBC,CAAoB,EAAEZ,EAAS,GAAG,EAAO,CAACa,EAAUC,CAAY,EAAEd,EAAS,YAAY,EAAO,CAACe,EAAOC,CAAS,EAAEhB,EAAS,CAAC,CAAC,EAAO,CAACiB,EAAkBC,CAAoB,EAAElB,EAAS,CAAC,CAAC,EACvjB,CAACmB,EAAUC,CAAY,EAAEpB,EAAS,IAAI,EAAQqB,EAAW,CAAC,WAAW,CAAC,mBAAmB,GAAG,EAAE,UAAU,CAAC,mBAAmB,CAAC,CAAC,EAAEC,EAAU,IAAI,CAAC,IAAMC,EAAkB,WAAWzB,CAAgB,EAAQ0B,EAAuB,WAAWvB,CAAqB,EAAQwB,EAAqB,WAAWtB,CAAmB,EAAQuB,EAAoB,WAAWrB,CAAkB,EAAQsB,EAAc,WAAWpB,CAAY,EAAQqB,EAAiB,WAAWnB,CAAe,EAAQoB,EAAmB,WAAWlB,CAAiB,EAAMmB,EAAM,G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,aAAa,CAAC,KAAKA,EAAY,OAAO,MAAM,gBAAgB,aAAa,EAAE,IAAI,EAAE,IAAI,GAAG,KAAK,CAAC,EAAE,sBAAsB,CAAC,KAAKA,EAAY,QAAQ,MAAM,2BAA2B,aAAa,EAAI,CAAC,CAAC",
  "names": ["init_ssg_sandbox_shims", "FiberLossCalculator", "props", "fiberLengthInput", "setFiberLengthInput", "ye", "fiberAttenuationInput", "setFiberAttenuationInput", "connectorPairsInput", "setConnectorPairsInput", "connectorLossInput", "setConnectorLossInput", "splicesInput", "setSplicesInput", "spliceLossInput", "setSpliceLossInput", "safetyMarginInput", "setSafetyMarginInput", "fiberType", "setFiberType", "errors", "setErrors", "savedCalculations", "setSavedCalculations", "totalLoss", "setTotalLoss", "fiberTypes", "ue", "parsedFiberLength", "parsedFiberAttenuation", "parsedConnectorPairs", "parsedConnectorLoss", "parsedSplices", "parsedSpliceLoss", "parsedSafetyMargin", "valid", "newErrors", "fiberLoss", "connectorLossTotal", "spliceLossTotal", "calculatedTotalLoss", "resetInputs", "saveCalculation", "prev", "inputStyle", "labelStyle", "primaryButtonStyle", "secondaryButtonStyle", "p", "field", "index", "e", "calc", "addPropertyControls", "ControlType"]
}
