{"ast":null,"code":"var _jsxFileName = \"D:\\\\Project\\\\UC_Trains_Voice\\\\react-demo\\\\src\\\\gavt\\\\CaliTable.jsx\",\n  _s = $RefreshSig$();\nimport React, { useState, useEffect } from 'react';\nimport { Table, Input, Form } from 'antd';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\nconst EditableCell = ({\n  editing,\n  dataIndex,\n  title,\n  inputType = 'number',\n  record,\n  index,\n  children,\n  ...restProps\n}) => {\n  const inputNode = inputType === 'number' ? /*#__PURE__*/_jsxDEV(Input, {\n    type: \"number\",\n    min: 0,\n    max: 4096\n  }, void 0, false, {\n    fileName: _jsxFileName,\n    lineNumber: 14,\n    columnNumber: 46\n  }, this) : /*#__PURE__*/_jsxDEV(Input, {}, void 0, false, {\n    fileName: _jsxFileName,\n    lineNumber: 14,\n    columnNumber: 91\n  }, this);\n  return /*#__PURE__*/_jsxDEV(\"td\", {\n    ...restProps,\n    children: editing ? /*#__PURE__*/_jsxDEV(Form.Item, {\n      name: dataIndex,\n      style: {\n        margin: 0\n      },\n      rules: [{\n        required: true,\n        message: `Please Input ${title}!`\n      }, {\n        type: 'number',\n        min: 0,\n        max: 4096,\n        message: 'Value must be between 0 and 4096'\n      }],\n      children: inputNode\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 18,\n      columnNumber: 9\n    }, this) : children\n  }, void 0, false, {\n    fileName: _jsxFileName,\n    lineNumber: 16,\n    columnNumber: 5\n  }, this);\n};\n_c = EditableCell;\nconst CaliTable = () => {\n  _s();\n  const [data, setData] = useState([]);\n  const [form] = Form.useForm();\n  const [editingKey, setEditingKey] = useState('');\n  useEffect(() => {\n    const fetchData = () => {\n      const caliBaselineRaw = localStorage.getItem('caliBaseline');\n      const customFrequenciesRaw = localStorage.getItem('customFrequencies');\n      if (!caliBaselineRaw) return;\n      const caliBaseline = JSON.parse(caliBaselineRaw);\n      const customFrequencies = customFrequenciesRaw ? JSON.parse(customFrequenciesRaw) : {};\n      const processedData = Object.keys(caliBaseline).map(key => {\n        const measuredValue = caliBaseline[key];\n        return {\n          key,\n          vowel: key,\n          measuredValue,\n          moderatelyDarker: Math.round(measuredValue * 0.92),\n          slightlyDarker: (measuredValue * 0.98).toFixed(2),\n          slightlyBrighter: (measuredValue * 1.02).toFixed(2),\n          moderatelyBrighter: (measuredValue * 1.08).toFixed(2),\n          customFrequency: customFrequencies[key] || ' '\n        };\n      });\n      setData(processedData);\n    };\n    fetchData();\n  }, []);\n  const columns = [{\n    title: 'Vowel',\n    dataIndex: 'vowel',\n    key: 'vowel',\n    editable: false\n  }, {\n    title: 'Calibrated Baseline',\n    dataIndex: 'measuredValue',\n    key: 'measuredValue',\n    editable: true\n  }, {\n    title: 'Moderately Darker',\n    dataIndex: 'moderatelyDarker',\n    key: 'moderatelyDarker',\n    editable: false\n  }, {\n    title: 'Slightly Darker',\n    dataIndex: 'slightlyDarker',\n    key: 'slightlyDarker',\n    editable: false\n  }, {\n    title: 'Slightly Brighter',\n    dataIndex: 'slightlyBrighter',\n    key: 'slightlyBrighter',\n    editable: false\n  }, {\n    title: 'Moderately Brighter',\n    dataIndex: 'moderatelyBrighter',\n    key: 'moderatelyBrighter',\n    editable: false\n  }, {\n    title: 'Custom Frequency',\n    dataIndex: 'customFrequency',\n    key: 'customFrequency',\n    editable: true\n  }].map(col => {\n    if (!col.editable) {\n      return col;\n    }\n    return {\n      ...col,\n      onCell: record => ({\n        record,\n        inputType: col.dataIndex === 'customFrequency' ? 'text' : 'number',\n        dataIndex: col.dataIndex,\n        title: col.title,\n        editing: isEditing(record)\n      })\n    };\n  });\n  const isEditing = record => record.key === editingKey;\n  const edit = record => {\n    form.setFieldsValue({\n      ...record\n    });\n    setEditingKey(record.key);\n  };\n  return /*#__PURE__*/_jsxDEV(Form, {\n    form: form,\n    component: false,\n    children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n      children: \"Resonance Frequency Analysis - F2\"\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 146,\n      columnNumber: 7\n    }, this), /*#__PURE__*/_jsxDEV(Table, {\n      components: {\n        body: {\n          cell: EditableCell\n        }\n      },\n      bordered: true,\n      dataSource: data,\n      columns: columns,\n      rowClassName: \"editable-row\",\n      pagination: false,\n      onRow: record => ({\n        onClick: () => {\n          if (record.key !== editingKey) edit(record);\n        }\n      })\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 147,\n      columnNumber: 7\n    }, this)]\n  }, void 0, true, {\n    fileName: _jsxFileName,\n    lineNumber: 145,\n    columnNumber: 5\n  }, this);\n};\n_s(CaliTable, \"vYzDYk4GuukEcBqxju+Gzxc5Obw=\", false, function () {\n  return [Form.useForm];\n});\n_c2 = CaliTable;\nexport default CaliTable;\nvar _c, _c2;\n$RefreshReg$(_c, \"EditableCell\");\n$RefreshReg$(_c2, \"CaliTable\");","map":{"version":3,"names":["React","useState","useEffect","Table","Input","Form","jsxDEV","_jsxDEV","EditableCell","editing","dataIndex","title","inputType","record","index","children","restProps","inputNode","type","min","max","fileName","_jsxFileName","lineNumber","columnNumber","Item","name","style","margin","rules","required","message","_c","CaliTable","_s","data","setData","form","useForm","editingKey","setEditingKey","fetchData","caliBaselineRaw","localStorage","getItem","customFrequenciesRaw","caliBaseline","JSON","parse","customFrequencies","processedData","Object","keys","map","key","measuredValue","vowel","moderatelyDarker","Math","round","slightlyDarker","toFixed","slightlyBrighter","moderatelyBrighter","customFrequency","columns","editable","col","onCell","isEditing","edit","setFieldsValue","component","components","body","cell","bordered","dataSource","rowClassName","pagination","onRow","onClick","_c2","$RefreshReg$"],"sources":["D:/Project/UC_Trains_Voice/react-demo/src/gavt/CaliTable.jsx"],"sourcesContent":["import React, { useState, useEffect } from 'react';\r\nimport { Table, Input, Form } from 'antd';\r\n\r\nconst EditableCell = ({\r\n  editing,\r\n  dataIndex,\r\n  title,\r\n  inputType = 'number',\r\n  record,\r\n  index,\r\n  children,\r\n  ...restProps\r\n}) => {\r\n  const inputNode = inputType === 'number' ? <Input type=\"number\" min={0} max={4096} /> : <Input />;\r\n  return (\r\n    <td {...restProps}>\r\n      {editing ? (\r\n        <Form.Item\r\n          name={dataIndex}\r\n          style={{ margin: 0 }}\r\n          rules={[\r\n            {\r\n              required: true,\r\n              message: `Please Input ${title}!`,\r\n            },\r\n            {\r\n              type: 'number',\r\n              min: 0,\r\n              max: 4096,\r\n              message: 'Value must be between 0 and 4096',\r\n            }\r\n          ]}\r\n        >\r\n          {inputNode}\r\n        </Form.Item>\r\n      ) : (\r\n        children\r\n      )}\r\n    </td>\r\n  );\r\n};\r\n\r\nconst CaliTable = () => {\r\n  const [data, setData] = useState([]);\r\n  const [form] = Form.useForm();\r\n  const [editingKey, setEditingKey] = useState('');\r\n\r\n  useEffect(() => {\r\n    const fetchData = () => {\r\n      const caliBaselineRaw = localStorage.getItem('caliBaseline');\r\n      const customFrequenciesRaw = localStorage.getItem('customFrequencies');\r\n\r\n      if (!caliBaselineRaw) return;\r\n\r\n      const caliBaseline = JSON.parse(caliBaselineRaw);\r\n      const customFrequencies = customFrequenciesRaw ? JSON.parse(customFrequenciesRaw) : {};\r\n\r\n      const processedData = Object.keys(caliBaseline).map(key => {\r\n        const measuredValue = caliBaseline[key];\r\n        return {\r\n          key,\r\n          vowel: key,\r\n          measuredValue,\r\n          moderatelyDarker: Math.round((measuredValue * 0.92)),\r\n          slightlyDarker: (measuredValue * 0.98).toFixed(2),\r\n          slightlyBrighter: (measuredValue * 1.02).toFixed(2),\r\n          moderatelyBrighter: (measuredValue * 1.08).toFixed(2),\r\n          customFrequency: customFrequencies[key] || ' '\r\n        };\r\n      });\r\n\r\n      setData(processedData);\r\n    };\r\n\r\n    fetchData();\r\n  }, []);\r\n\r\n  const columns = [\r\n    {\r\n      title: 'Vowel',\r\n      dataIndex: 'vowel',\r\n      key: 'vowel',\r\n      editable: false\r\n    },\r\n    {\r\n      title: 'Calibrated Baseline',\r\n      dataIndex: 'measuredValue',\r\n      key: 'measuredValue',\r\n      editable: true\r\n    },\r\n    {\r\n      title: 'Moderately Darker',\r\n      dataIndex: 'moderatelyDarker',\r\n      key: 'moderatelyDarker',\r\n      editable: false\r\n    },\r\n    {\r\n      title: 'Slightly Darker',\r\n      dataIndex: 'slightlyDarker',\r\n      key: 'slightlyDarker',\r\n      editable: false\r\n    },\r\n    {\r\n      title: 'Slightly Brighter',\r\n      dataIndex: 'slightlyBrighter',\r\n      key: 'slightlyBrighter',\r\n      editable: false\r\n    },\r\n    {\r\n      title: 'Moderately Brighter',\r\n      dataIndex: 'moderatelyBrighter',\r\n      key: 'moderatelyBrighter',\r\n      editable: false\r\n    },\r\n    {\r\n      title: 'Custom Frequency',\r\n      dataIndex: 'customFrequency',\r\n      key: 'customFrequency',\r\n      editable: true\r\n    }\r\n  ].map(col => {\r\n    if (!col.editable) {\r\n      return col;\r\n    }\r\n    return {\r\n      ...col,\r\n      onCell: (record) => ({\r\n        record,\r\n        inputType: col.dataIndex === 'customFrequency' ? 'text' : 'number',\r\n        dataIndex: col.dataIndex,\r\n        title: col.title,\r\n        editing: isEditing(record),\r\n      }),\r\n    };\r\n  });\r\n\r\n  const isEditing = (record) => record.key === editingKey;\r\n\r\n  const edit = (record) => {\r\n    form.setFieldsValue({ ...record });\r\n    setEditingKey(record.key);\r\n  };\r\n\r\n  return (\r\n    <Form form={form} component={false}>\r\n      <h2>Resonance Frequency Analysis - F2</h2>\r\n      <Table\r\n        components={{\r\n          body: {\r\n            cell: EditableCell,\r\n          },\r\n        }}\r\n        bordered\r\n        dataSource={data}\r\n        columns={columns}\r\n        rowClassName=\"editable-row\"\r\n        pagination={false}\r\n        onRow={(record) => ({\r\n          onClick: () => {\r\n            if (record.key !== editingKey) edit(record);\r\n          },\r\n        })}\r\n      />\r\n    </Form>\r\n  );\r\n};\r\n\r\nexport default CaliTable;\r\n"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AAClD,SAASC,KAAK,EAAEC,KAAK,EAAEC,IAAI,Q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