\n );\n}\n\nexport default Copyright;\n","import Button from \"@material-ui/core/Button\";\nimport Container from \"@material-ui/core/Container\";\nimport Typography from \"@material-ui/core/Typography\";\nimport Box from \"@material-ui/core/Box\";\n\nimport ProTip from \"../components/Protip\";\nimport RemoteControl from \"../components/RemoteControl\";\n\nimport AirConditioner from \"../features/ac/AirConditioner\";\nimport Toast from \"../features/toast/Toast\";\n\nimport { ThemeProvider } from \"../theme\";\n\nimport { useAppDispatch, useAppSelector } from \"../app/hooks\";\nimport { RootState } from \"../app/store\";\nimport Copyright from \"../layouts/Copyright\";\nimport {\n AcMode,\n acItemKey,\n setTemperature,\n setMode,\n setStatus,\n} from \"../features/ac/acSlice\";\nimport { useEffect } from \"react\";\n\nfunction Home() {\n const ac = useAppSelector((state: RootState) => state.ac);\n\n const dispatch = useAppDispatch();\n useEffect(() => {\n function onStorage(e: StorageEvent) {\n // 重复设置相同的键值不会触发该事件\n switch (e.key) {\n case acItemKey.status:\n dispatch(setStatus(e.newValue === \"true\"));\n break;\n case acItemKey.temperature:\n dispatch(setTemperature(parseInt(e.newValue || \"20\")));\n break;\n case acItemKey.mode:\n dispatch(setMode((e.newValue || \"cold\") as AcMode));\n break;\n default:\n break;\n }\n }\n window.addEventListener(\"storage\", onStorage);\n return () => {\n window.removeEventListener(\"storage\", onStorage);\n };\n }, [dispatch]);\n\n /**\n * 根据模式返回对应的色温\n * @returns\n */\n function getClassByMode() {\n if (ac.status) {\n return ac.mode === \"hot\" ? \"hot-color\" : \"cold-color\";\n } else {\n return \"\";\n }\n }\n\n return (\n \n \n \n \n 便携小空调\n \n \n \n
\n \n \n \n
\n \n \n \n \n \n \n );\n}\n\nexport default Home;\n","import RemoteControl from \"../components/RemoteControl\";\n\nexport default function Rc() {\n return ;\n}\n","import \"./App.scss\";\n\nimport { ThemeProvider } from \"./theme\";\nimport Container from \"@material-ui/core/Container\";\n\nimport { BrowserRouter as Router, Switch, Route } from \"react-router-dom\";\nimport Home from \"./pages/Home\";\nimport Rc from \"./pages/Rc\";\n\nfunction App() {\n return (\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n );\n}\n\nexport default App;\n","import { configureStore, ThunkAction, Action } from \"@reduxjs/toolkit\";\nimport acReducer from \"../features/ac/acSlice\";\nimport toastReducer from \"../features/toast/toastSlice\";\n\nexport const store = configureStore({\n reducer: {\n ac: acReducer,\n toast: toastReducer,\n },\n});\n\nexport type AppDispatch = typeof store.dispatch;\nexport type RootState = ReturnType;\nexport type AppThunk = ThunkAction<\n ReturnType,\n RootState,\n unknown,\n Action\n>;\n","// This optional code is used to register a service worker.\n// register() is not called by default.\n\n// This lets the app load faster on subsequent visits in production, and gives\n// it offline capabilities. However, it also means that developers (and users)\n// will only see deployed updates on subsequent visits to a page, after all the\n// existing tabs open on the page have been closed, since previously cached\n// resources are updated in the background.\n\n// To learn more about the benefits of this model and instructions on how to\n// opt-in, read https://cra.link/PWA\n\nconst isLocalhost = Boolean(\n window.location.hostname === \"localhost\" ||\n // [::1] is the IPv6 localhost address.\n window.location.hostname === \"[::1]\" ||\n // 127.0.0.0/8 are considered localhost for IPv4.\n window.location.hostname.match(\n /^127(?:\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/\n )\n);\n\ntype Config = {\n onSuccess?: (registration: ServiceWorkerRegistration) => void;\n onUpdate?: (registration: ServiceWorkerRegistration) => void;\n};\n\nexport function register(config?: Config) {\n if (process.env.NODE_ENV === \"production\" && \"serviceWorker\" in navigator) {\n // The URL constructor is available in all browsers that support SW.\n const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);\n if (publicUrl.origin !== window.location.origin) {\n // Our service worker won't work if PUBLIC_URL is on a different origin\n // from what our page is served on. This might happen if a CDN is used to\n // serve assets; see https://github.com/facebook/create-react-app/issues/2374\n return;\n }\n\n window.addEventListener(\"load\", () => {\n const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;\n\n if (isLocalhost) {\n // This is running on localhost. Let's check if a service worker still exists or not.\n checkValidServiceWorker(swUrl, config);\n\n // Add some additional logging to localhost, pointing developers to the\n // service worker/PWA documentation.\n navigator.serviceWorker.ready.then(() => {\n console.log(\n \"This web app is being served cache-first by a service \" +\n \"worker. To learn more, visit https://cra.link/PWA\"\n );\n });\n } else {\n // Is not localhost. Just register service worker\n registerValidSW(swUrl, config);\n }\n });\n }\n}\n\nfunction registerValidSW(swUrl: string, config?: Config) {\n navigator.serviceWorker\n .register(swUrl)\n .then((registration) => {\n registration.onupdatefound = () => {\n const installingWorker = registration.installing;\n if (installingWorker == null) {\n return;\n }\n installingWorker.onstatechange = () => {\n if (installingWorker.state === \"installed\") {\n if (navigator.serviceWorker.controller) {\n // At this point, the updated precached content has been fetched,\n // but the previous service worker will still serve the older\n // content until all client tabs are closed.\n console.log(\n \"New content is available and will be used when all \" +\n \"tabs for this page are closed. See https://cra.link/PWA.\"\n );\n\n // Execute callback\n if (config && config.onUpdate) {\n config.onUpdate(registration);\n }\n } else {\n // At this point, everything has been precached.\n // It's the perfect time to display a\n // \"Content is cached for offline use.\" message.\n console.log(\"Content is cached for offline use.\");\n\n // Execute callback\n if (config && config.onSuccess) {\n config.onSuccess(registration);\n }\n }\n }\n };\n };\n })\n .catch((error) => {\n console.error(\"Error during service worker registration:\", error);\n });\n}\n\nfunction checkValidServiceWorker(swUrl: string, config?: Config) {\n // Check if the service worker can be found. If it can't reload the page.\n fetch(swUrl, {\n headers: { \"Service-Worker\": \"script\" },\n })\n .then((response) => {\n // Ensure service worker exists, and that we really are getting a JS file.\n const contentType = response.headers.get(\"content-type\");\n if (\n response.status === 404 ||\n (contentType != null && contentType.indexOf(\"javascript\") === -1)\n ) {\n // No service worker found. Probably a different app. Reload the page.\n navigator.serviceWorker.ready.then((registration) => {\n registration.unregister().then(() => {\n window.location.reload();\n });\n });\n } else {\n // Service worker found. Proceed as normal.\n registerValidSW(swUrl, config);\n }\n })\n .catch(() => {\n console.log(\n \"No internet connection found. App is running in offline mode.\"\n );\n });\n}\n\nexport function unregister() {\n if (\"serviceWorker\" in navigator) {\n navigator.serviceWorker.ready\n .then((registration) => {\n registration.unregister();\n })\n .catch((error) => {\n console.error(error.message);\n });\n }\n}\n","import { ReportHandler } from \"web-vitals\";\n\nconst reportWebVitals = (onPerfEntry?: ReportHandler) => {\n if (onPerfEntry && onPerfEntry instanceof Function) {\n import(\"web-vitals\").then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {\n getCLS(onPerfEntry);\n getFID(onPerfEntry);\n getFCP(onPerfEntry);\n getLCP(onPerfEntry);\n getTTFB(onPerfEntry);\n });\n }\n};\n\nexport default reportWebVitals;\n","import React from \"react\";\nimport ReactDOM from \"react-dom\";\n\nimport \"./index.scss\";\nimport App from \"./App\";\nimport { store } from \"./app/store\";\nimport { Provider } from \"react-redux\";\nimport * as serviceWorkerRegistration from \"./serviceWorkerRegistration\";\nimport reportWebVitals from \"./reportWebVitals\";\n\n// import ReactGA from \"react-ga\";\n// ReactGA.initialize(\"UA-121354150-10\");\n// ReactGA.pageview(window.location.pathname + window.location.search);\n\nReactDOM.render(\n \n \n \n \n ,\n document.getElementById(\"root\")\n);\n\n// If you want your app to work offline and load faster, you can change\n// unregister() to register() below. Note this comes with some pitfalls.\n// Learn more about service workers: https://bit.ly/CRA-PWA\nserviceWorkerRegistration.register();\n\n// If you want to start measuring performance in your app, pass a function\n// to log results (for example: reportWebVitals(console.log))\n// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals\nreportWebVitals();\n"],"sourceRoot":""}