import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
import { px2remTransformer, StyleProvider } from '@ant-design/cssinjs';

const dpr = window.devicePixelRatio || 1;
// 用 UI 缩放因子抵消 Windows 显示缩放导致的“物理尺寸变大”。
// 例如：dpr=1.25 时 uiScale=0.8，rem 会整体变小 20%。
const uiScale = 1 / dpr;
document.documentElement.style.setProperty('--ui-scale', String(uiScale));

// antd cssinjs 内部 px->rem 转换的 rootValue：rootValue 越大，rem 越小。
const rootValue = 16 * dpr;

const root = ReactDOM.createRoot(
  document.getElementById('root') as HTMLElement
);
root.render(
  <StyleProvider >
    <App />
  </StyleProvider>
);

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
