-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
index.js
71 lines (71 loc) · 2.81 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import e from "@swc/helpers/src/_async_to_generator.mjs";
import t from "@swc/helpers/src/_ts_generator.mjs";
import { displayContent as a } from "./fouc";
import r from "./on-demand-entries-client";
import { addMessageListener as n, connectHMR as c } from "./error-overlay/websocket";
var o = JSON.parse(document.getElementById("__NEXT_DATA__").textContent);
window.__NEXT_DATA__ = o;
var s = o.assetPrefix, i = o.page;
s = s || "";
var _ = null, u = __webpack_hash__, d = s + (s.endsWith("/") ? "" : "/") + "_next/static/webpack/";
function p() {
return (p = e(function() {
var e, a, r, n, c;
return t(this, function(e) {
switch(e.label){
case 0:
if (!(_ !== __webpack_hash__) || "idle" !== module.hot.status()) return [
2
];
e.label = 1;
case 1:
return e.trys.push([
1,
4,
,
5
]), [
4,
fetch("undefined" != typeof __webpack_runtime_id__ ? "".concat(d).concat(u, ".").concat(__webpack_runtime_id__, ".hot-update.json") : "".concat(d).concat(u, ".hot-update.json"))
];
case 2:
return [
4,
e.sent().json()
];
case 3:
return a = e.sent(), r = "/" === i ? "index" : i, (Array.isArray(a.c) ? a.c : Object.keys(a.c)).some(function(e) {
return -1 !== e.indexOf("pages".concat(r.startsWith("/") ? r : "/".concat(r))) || -1 !== e.indexOf("pages".concat(r.startsWith("/") ? r : "/".concat(r)).replace(/\//g, "\\"));
}) ? document.location.reload(!0) : u = _, [
3,
5
];
case 4:
return console.error("Error occurred checking for update", e.sent()), document.location.reload(!0), [
3,
5
];
case 5:
return [
2
];
}
});
})).apply(this, arguments);
}
n(function(e) {
if ("\uD83D\uDC93" !== e.data) try {
var t = JSON.parse(e.data);
if ("sync" === t.action || "built" === t.action) {
if (!t.hash) return;
_ = t.hash, function() {
p.apply(this, arguments);
}();
} else "reloadPage" === t.action && document.location.reload(!0);
} catch (a) {
console.warn("Invalid HMR message: " + e.data + "\n" + a);
}
}), c({
assetPrefix: s,
path: "/_next/webpack-hmr"
}), a(), r(o.page);