67 lines
2.1 KiB
JavaScript
67 lines
2.1 KiB
JavaScript
|
/**
|
||
|
* Before starting the Next.js runtime and requiring any module, we need to make
|
||
|
* sure the following scripts are executed in the correct order:
|
||
|
* - Polyfills
|
||
|
* - next/script with `beforeInteractive` strategy
|
||
|
*/ "use strict";
|
||
|
Object.defineProperty(exports, "__esModule", {
|
||
|
value: true
|
||
|
});
|
||
|
Object.defineProperty(exports, "appBootstrap", {
|
||
|
enumerable: true,
|
||
|
get: function() {
|
||
|
return appBootstrap;
|
||
|
}
|
||
|
});
|
||
|
const version = "13.5.6";
|
||
|
window.next = {
|
||
|
version,
|
||
|
appDir: true
|
||
|
};
|
||
|
function loadScriptsInSequence(scripts, hydrate) {
|
||
|
if (!scripts || !scripts.length) {
|
||
|
return hydrate();
|
||
|
}
|
||
|
return scripts.reduce((promise, param)=>{
|
||
|
let [src, props] = param;
|
||
|
return promise.then(()=>{
|
||
|
return new Promise((resolve, reject)=>{
|
||
|
const el = document.createElement("script");
|
||
|
if (props) {
|
||
|
for(const key in props){
|
||
|
if (key !== "children") {
|
||
|
el.setAttribute(key, props[key]);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
if (src) {
|
||
|
el.src = src;
|
||
|
el.onload = ()=>resolve();
|
||
|
el.onerror = reject;
|
||
|
} else if (props) {
|
||
|
el.innerHTML = props.children;
|
||
|
setTimeout(resolve);
|
||
|
}
|
||
|
document.head.appendChild(el);
|
||
|
});
|
||
|
});
|
||
|
}, Promise.resolve()).catch((err)=>{
|
||
|
console.error(err);
|
||
|
// Still try to hydrate even if there's an error.
|
||
|
}).then(()=>{
|
||
|
hydrate();
|
||
|
});
|
||
|
}
|
||
|
function appBootstrap(callback) {
|
||
|
loadScriptsInSequence(self.__next_s, ()=>{
|
||
|
callback();
|
||
|
});
|
||
|
}
|
||
|
|
||
|
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||
|
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||
|
Object.assign(exports.default, exports);
|
||
|
module.exports = exports.default;
|
||
|
}
|
||
|
|
||
|
//# sourceMappingURL=app-bootstrap.js.map
|