exports.id = 4298;
exports.ids = [4298];
exports.modules = {
/***/ 6495:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
var __webpack_unused_export__;
__webpack_unused_export__ = ({
value: true
});
exports.Z = _extends;
function _extends() {
return extends_.apply(this, arguments);
}
function extends_() {
extends_ = Object.assign || function(target) {
for(var i = 1; i < arguments.length; i++){
var source = arguments[i];
for(var key in source){
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return extends_.apply(this, arguments);
}
/***/ }),
/***/ 1598:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
var __webpack_unused_export__;
__webpack_unused_export__ = ({
value: true
});
exports.Z = _interopRequireWildcard;
function _interopRequireWildcard(obj, nodeInterop) {
if (!nodeInterop && obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return {
default: obj
};
}
var cache = _getRequireWildcardCache(nodeInterop);
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for(var key in obj){
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
function _getRequireWildcardCache(nodeInterop1) {
if (typeof WeakMap !== "function") return null;
var cacheBabelInterop = new WeakMap();
var cacheNodeInterop = new WeakMap();
return (_getRequireWildcardCache = function(nodeInterop) {
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
})(nodeInterop1);
}
/***/ }),
/***/ 7273:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
var __webpack_unused_export__;
__webpack_unused_export__ = ({
value: true
});
exports.Z = _objectWithoutPropertiesLoose;
function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for(i = 0; i < sourceKeys.length; i++){
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
/***/ }),
/***/ 6007:
/***/ ((module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = initHeadManager;
exports.isEqualNode = isEqualNode;
exports.DOMAttributeNames = void 0;
function initHeadManager() {
return {
mountedInstances: new Set(),
updateHead: (head)=>{
const tags = {};
head.forEach((h)=>{
if (// it won't be inlined. In this case revert to the original behavior
h.type === "link" && h.props["data-optimized-fonts"]) {
if (document.querySelector(`style[data-href="${h.props["data-href"]}"]`)) {
return;
} else {
h.props.href = h.props["data-href"];
h.props["data-href"] = undefined;
}
}
const components = tags[h.type] || [];
components.push(h);
tags[h.type] = components;
});
const titleComponent = tags.title ? tags.title[0] : null;
let title = "";
if (titleComponent) {
const { children } = titleComponent.props;
title = typeof children === "string" ? children : Array.isArray(children) ? children.join("") : "";
}
if (title !== document.title) document.title = title;
[
"meta",
"base",
"link",
"style",
"script"
].forEach((type)=>{
updateElements(type, tags[type] || []);
});
}
};
}
const DOMAttributeNames = {
acceptCharset: "accept-charset",
className: "class",
htmlFor: "for",
httpEquiv: "http-equiv",
noModule: "noModule"
};
exports.DOMAttributeNames = DOMAttributeNames;
function reactElementToDOM({ type , props }) {
const el = document.createElement(type);
for(const p in props){
if (!props.hasOwnProperty(p)) continue;
if (p === "children" || p === "dangerouslySetInnerHTML") continue;
// we don't render undefined props to the DOM
if (props[p] === undefined) continue;
const attr = DOMAttributeNames[p] || p.toLowerCase();
if (type === "script" && (attr === "async" || attr === "defer" || attr === "noModule")) {
el[attr] = !!props[p];
} else {
el.setAttribute(attr, props[p]);
}
}
const { children , dangerouslySetInnerHTML } = props;
if (dangerouslySetInnerHTML) {
el.innerHTML = dangerouslySetInnerHTML.__html || "";
} else if (children) {
el.textContent = typeof children === "string" ? children : Array.isArray(children) ? children.join("") : "";
}
return el;
}
function isEqualNode(oldTag, newTag) {
if (oldTag instanceof HTMLElement && newTag instanceof HTMLElement) {
const nonce = newTag.getAttribute("nonce");
// Only strip the nonce if `oldTag` has had it stripped. An element's nonce attribute will not
// be stripped if there is no content security policy response header that includes a nonce.
if (nonce && !oldTag.getAttribute("nonce")) {
const cloneTag = newTag.cloneNode(true);
cloneTag.setAttribute("nonce", "");
cloneTag.nonce = nonce;
return nonce === oldTag.nonce && oldTag.isEqualNode(cloneTag);
}
}
return oldTag.isEqualNode(newTag);
}
function updateElements(type, components) {
const headEl = document.getElementsByTagName("head")[0];
const headCountEl = headEl.querySelector("meta[name=next-head-count]");
if (false) {}
const headCount = Number(headCountEl.content);
const oldTags = [];
for(let i = 0, j = headCountEl.previousElementSibling; i < headCount; i++, j = (j == null ? void 0 : j.previousElementSibling) || null){
var ref;
if ((j == null ? void 0 : (ref = j.tagName) == null ? void 0 : ref.toLowerCase()) === type) {
oldTags.push(j);
}
}
const newTags = components.map(reactElementToDOM).filter((newTag)=>{
for(let k = 0, len = oldTags.length; k < len; k++){
const oldTag = oldTags[k];
if (isEqualNode(oldTag, newTag)) {
oldTags.splice(k, 1);
return false;
}
}
return true;
});
oldTags.forEach((t)=>{
var ref;
return (ref = t.parentNode) == null ? void 0 : ref.removeChild(t);
});
newTags.forEach((t)=>headEl.insertBefore(t, headCountEl));
headCountEl.content = (headCount - oldTags.length + newTags.length).toString();
}
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=head-manager.js.map
/***/ }),
/***/ 9311:
/***/ ((module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.cancelIdleCallback = exports.requestIdleCallback = void 0;
const requestIdleCallback = typeof self !== "undefined" && self.requestIdleCallback && self.requestIdleCallback.bind(window) || function(cb) {
let start = Date.now();
return setTimeout(function() {
cb({
didTimeout: false,
timeRemaining: function() {
return Math.max(0, 50 - (Date.now() - start));
}
});
}, 1);
};
exports.requestIdleCallback = requestIdleCallback;
const cancelIdleCallback = typeof self !== "undefined" && self.cancelIdleCallback && self.cancelIdleCallback.bind(window) || function(id) {
return clearTimeout(id);
};
exports.cancelIdleCallback = cancelIdleCallback;
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=request-idle-callback.js.map
/***/ }),
/***/ 699:
/***/ ((module, exports, __webpack_require__) => {
"use strict";
"client";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.handleClientScriptLoad = handleClientScriptLoad;
exports.initScriptLoader = initScriptLoader;
exports["default"] = void 0;
var _extends = (__webpack_require__(6495)/* ["default"] */ .Z);
var _interop_require_wildcard = (__webpack_require__(1598)/* ["default"] */ .Z);
var _object_without_properties_loose = (__webpack_require__(7273)/* ["default"] */ .Z);
var _react = _interop_require_wildcard(__webpack_require__(6689));
var _headManagerContext = __webpack_require__(2796);
var _headManager = __webpack_require__(6007);
var _requestIdleCallback = __webpack_require__(9311);
"client";
const ScriptCache = new Map();
const LoadCache = new Set();
const ignoreProps = [
"onLoad",
"onReady",
"dangerouslySetInnerHTML",
"children",
"onError",
"strategy",
];
const loadScript = (props)=>{
const { src , id , onLoad =()=>{} , onReady =null , dangerouslySetInnerHTML , children ="" , strategy ="afterInteractive" , onError , } = props;
const cacheKey = id || src;
// Script has already loaded
if (cacheKey && LoadCache.has(cacheKey)) {
return;
}
// Contents of this script are already loading/loaded
if (ScriptCache.has(src)) {
LoadCache.add(cacheKey);
// It is possible that multiple `next/script` components all have same "src", but has different "onLoad"
// This is to make sure the same remote script will only load once, but "onLoad" are executed in order
ScriptCache.get(src).then(onLoad, onError);
return;
}
/** Execute after the script first loaded */ const afterLoad = ()=>{
// Run onReady for the first time after load event
if (onReady) {
onReady();
}
// add cacheKey to LoadCache when load successfully
LoadCache.add(cacheKey);
};
const el = document.createElement("script");
const loadPromise = new Promise((resolve, reject)=>{
el.addEventListener("load", function(e) {
resolve();
if (onLoad) {
onLoad.call(this, e);
}
afterLoad();
});
el.addEventListener("error", function(e) {
reject(e);
});
}).catch(function(e) {
if (onError) {
onError(e);
}
});
if (dangerouslySetInnerHTML) {
el.innerHTML = dangerouslySetInnerHTML.__html || "";
afterLoad();
} else if (children) {
el.textContent = typeof children === "string" ? children : Array.isArray(children) ? children.join("") : "";
afterLoad();
} else if (src) {
el.src = src;
// do not add cacheKey into LoadCache for remote script here
// cacheKey will be added to LoadCache when it is actually loaded (see loadPromise above)
ScriptCache.set(src, loadPromise);
}
for (const [k, value] of Object.entries(props)){
if (value === undefined || ignoreProps.includes(k)) {
continue;
}
const attr = _headManager.DOMAttributeNames[k] || k.toLowerCase();
el.setAttribute(attr, value);
}
if (strategy === "worker") {
el.setAttribute("type", "text/partytown");
}
el.setAttribute("data-nscript", strategy);
document.body.appendChild(el);
};
function handleClientScriptLoad(props) {
const { strategy ="afterInteractive" } = props;
if (strategy === "lazyOnload") {
window.addEventListener("load", ()=>{
(0, _requestIdleCallback).requestIdleCallback(()=>loadScript(props));
});
} else {
loadScript(props);
}
}
function loadLazyScript(props) {
if (document.readyState === "complete") {
(0, _requestIdleCallback).requestIdleCallback(()=>loadScript(props));
} else {
window.addEventListener("load", ()=>{
(0, _requestIdleCallback).requestIdleCallback(()=>loadScript(props));
});
}
}
function addBeforeInteractiveToCache() {
const scripts = [
...document.querySelectorAll('[data-nscript="beforeInteractive"]'),
...document.querySelectorAll('[data-nscript="beforePageRender"]'),
];
scripts.forEach((script)=>{
const cacheKey = script.id || script.getAttribute("src");
LoadCache.add(cacheKey);
});
}
function initScriptLoader(scriptLoaderItems) {
scriptLoaderItems.forEach(handleClientScriptLoad);
addBeforeInteractiveToCache();
}
function Script(props) {
const { id , src ="" , onLoad =()=>{} , onReady =null , strategy ="afterInteractive" , onError } = props, restProps = _object_without_properties_loose(props, [
"id",
"src",
"onLoad",
"onReady",
"strategy",
"onError"
]);
// Context is available only during SSR
const { updateScripts , scripts , getIsSsr } = (0, _react).useContext(_headManagerContext.HeadManagerContext);
/**
* - First mount:
* 1. The useEffect for onReady executes
* 2. hasOnReadyEffectCalled.current is false, but the script hasn't loaded yet (not in LoadCache)
* onReady is skipped, set hasOnReadyEffectCalled.current to true
* 3. The useEffect for loadScript executes
* 4. hasLoadScriptEffectCalled.current is false, loadScript executes
* Once the script is loaded, the onLoad and onReady will be called by then
* [If strict mode is enabled / is wrapped in component]
* 5. The useEffect for onReady executes again
* 6. hasOnReadyEffectCalled.current is true, so entire effect is skipped
* 7. The useEffect for loadScript executes again
* 8. hasLoadScriptEffectCalled.current is true, so entire effect is skipped
*
* - Second mount:
* 1. The useEffect for onReady executes
* 2. hasOnReadyEffectCalled.current is false, but the script has already loaded (found in LoadCache)
* onReady is called, set hasOnReadyEffectCalled.current to true
* 3. The useEffect for loadScript executes
* 4. The script is already loaded, loadScript bails out
* [If strict mode is enabled / is wrapped in component]
* 5. The useEffect for onReady executes again
* 6. hasOnReadyEffectCalled.current is true, so entire effect is skipped
* 7. The useEffect for loadScript executes again
* 8. hasLoadScriptEffectCalled.current is true, so entire effect is skipped
*/ const hasOnReadyEffectCalled = (0, _react).useRef(false);
(0, _react).useEffect(()=>{
const cacheKey = id || src;
if (!hasOnReadyEffectCalled.current) {
// Run onReady if script has loaded before but component is re-mounted
if (onReady && cacheKey && LoadCache.has(cacheKey)) {
onReady();
}
hasOnReadyEffectCalled.current = true;
}
}, [
onReady,
id,
src
]);
const hasLoadScriptEffectCalled = (0, _react).useRef(false);
(0, _react).useEffect(()=>{
if (!hasLoadScriptEffectCalled.current) {
if (strategy === "afterInteractive") {
loadScript(props);
} else if (strategy === "lazyOnload") {
loadLazyScript(props);
}
hasLoadScriptEffectCalled.current = true;
}
}, [
props,
strategy
]);
if (strategy === "beforeInteractive" || strategy === "worker") {
if (updateScripts) {
scripts[strategy] = (scripts[strategy] || []).concat([
_extends({
id,
src,
onLoad,
onReady,
onError
}, restProps),
]);
updateScripts(scripts);
} else if (getIsSsr && getIsSsr()) {
// Script has already loaded during SSR
LoadCache.add(id || src);
} else if (getIsSsr && !getIsSsr()) {
loadScript(props);
}
}
return null;
}
Object.defineProperty(Script, "__nextScript", {
value: true
});
var _default = Script;
exports["default"] = _default;
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=script.js.map
/***/ }),
/***/ 4298:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
module.exports = __webpack_require__(699)
/***/ })
};
;