| <!doctype html> |
| <html lang="vi"> |
| <head> |
| <meta charset="UTF-8" /> |
| <meta name="viewport" content="width=device-width,initial-scale=1" /> |
| <base href="./" /> |
|
|
| <title>CAD2MAP</title> |
| <meta name="description" content="CAD2MAP - Công cụ chuyển đổi CAD/DXF/DWG sang bản đồ" /> |
|
|
| |
| <link rel="icon" type="image/svg+xml" href="./cad2map-favicon.svg" /> |
| <link rel="stylesheet" href="./index-nLRMG7XC.css" /> |
| </head> |
|
|
| <body> |
| <div id="app"></div> |
| <noscript>Ứng dụng cần bật JavaScript để chạy.</noscript> |
|
|
| |
| |
| |
| |
| |
| <script> |
| (function () { |
| const LOG = "[CAD2MAP-FIX]"; |
| const nativeFetch = window.fetch ? window.fetch.bind(window) : null; |
| |
| |
| function isProvinces(url) { |
| try { |
| const u = new URL(url, location.href); |
| const p = u.pathname || ""; |
| return ( |
| p.endsWith("/provinces") || |
| p.endsWith("/api/provinces") || |
| p.includes("/provinces?") |
| ); |
| } catch { |
| return String(url || "").includes("provinces"); |
| } |
| } |
| |
| async function fetchProvincesFallback() { |
| |
| try { |
| const r = await nativeFetch("./provinces.json", { cache: "no-store" }); |
| if (r.ok) { |
| console.info(LOG, "provinces -> ./provinces.json"); |
| return r; |
| } |
| } catch (_) {} |
| |
| |
| try { |
| const r2 = await nativeFetch("https://cad2map.web.app/provinces.json", { cache: "no-store" }); |
| if (r2.ok) { |
| console.info(LOG, "provinces -> https://cad2map.web.app/provinces.json"); |
| return r2; |
| } |
| } catch (_) {} |
| |
| |
| throw new Error("Không tải được provinces (local provinces.json và fallback đều lỗi)."); |
| } |
| |
| if (nativeFetch) { |
| window.fetch = function (input, init) { |
| const url = typeof input === "string" ? input : (input && input.url) || ""; |
| if (isProvinces(url)) return fetchProvincesFallback(); |
| return nativeFetch(input, init); |
| }; |
| } |
| |
| |
| const NativeWorker = window.Worker; |
| |
| function rewriteToRoot(spec) { |
| let s = spec; |
| |
| |
| if (spec && typeof spec === "object" && "href" in spec) s = spec.href; |
| |
| s = String(s || ""); |
| |
| |
| |
| |
| |
| |
| s = s.replace(/^https?:\/\/[^/]+\/assets\//i, "./"); |
| s = s.replace(/^\/assets\//i, "./"); |
| s = s.replace(/^\.\/*assets\//i, "./"); |
| s = s.replace(/^assets\//i, "./"); |
| |
| return s; |
| } |
| |
| if (NativeWorker) { |
| window.Worker = function (spec, options) { |
| const rewritten = rewriteToRoot(spec); |
| return new NativeWorker(rewritten, options); |
| }; |
| window.Worker.prototype = NativeWorker.prototype; |
| } |
| |
| console.info(LOG, "installed (root-only, no subfolders)."); |
| })(); |
| </script> |
|
|
| |
| <script type="module" crossorigin src="./index-Cm1h4vpW.js"></script> |
| </body> |
| </html> |
|
|