You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			203 lines
		
	
	
		
			5.8 KiB
		
	
	
	
		
			JavaScript
		
	
			
		
		
	
	
			203 lines
		
	
	
		
			5.8 KiB
		
	
	
	
		
			JavaScript
		
	
| "use strict";
 | |
| Object.defineProperty(exports, "__esModule", {
 | |
|     value: true
 | |
| });
 | |
| 0 && (module.exports = {
 | |
|     WEB_VITALS: null,
 | |
|     execOnce: null,
 | |
|     isAbsoluteUrl: null,
 | |
|     getLocationOrigin: null,
 | |
|     getURL: null,
 | |
|     getDisplayName: null,
 | |
|     isResSent: null,
 | |
|     normalizeRepeatedSlashes: null,
 | |
|     loadGetInitialProps: null,
 | |
|     SP: null,
 | |
|     ST: null,
 | |
|     DecodeError: null,
 | |
|     NormalizeError: null,
 | |
|     PageNotFoundError: null,
 | |
|     MissingStaticPage: null,
 | |
|     MiddlewareNotFoundError: null,
 | |
|     stringifyError: null
 | |
| });
 | |
| function _export(target, all) {
 | |
|     for(var name in all)Object.defineProperty(target, name, {
 | |
|         enumerable: true,
 | |
|         get: all[name]
 | |
|     });
 | |
| }
 | |
| _export(exports, {
 | |
|     WEB_VITALS: function() {
 | |
|         return WEB_VITALS;
 | |
|     },
 | |
|     execOnce: function() {
 | |
|         return execOnce;
 | |
|     },
 | |
|     isAbsoluteUrl: function() {
 | |
|         return isAbsoluteUrl;
 | |
|     },
 | |
|     getLocationOrigin: function() {
 | |
|         return getLocationOrigin;
 | |
|     },
 | |
|     getURL: function() {
 | |
|         return getURL;
 | |
|     },
 | |
|     getDisplayName: function() {
 | |
|         return getDisplayName;
 | |
|     },
 | |
|     isResSent: function() {
 | |
|         return isResSent;
 | |
|     },
 | |
|     normalizeRepeatedSlashes: function() {
 | |
|         return normalizeRepeatedSlashes;
 | |
|     },
 | |
|     loadGetInitialProps: function() {
 | |
|         return loadGetInitialProps;
 | |
|     },
 | |
|     SP: function() {
 | |
|         return SP;
 | |
|     },
 | |
|     ST: function() {
 | |
|         return ST;
 | |
|     },
 | |
|     DecodeError: function() {
 | |
|         return DecodeError;
 | |
|     },
 | |
|     NormalizeError: function() {
 | |
|         return NormalizeError;
 | |
|     },
 | |
|     PageNotFoundError: function() {
 | |
|         return PageNotFoundError;
 | |
|     },
 | |
|     MissingStaticPage: function() {
 | |
|         return MissingStaticPage;
 | |
|     },
 | |
|     MiddlewareNotFoundError: function() {
 | |
|         return MiddlewareNotFoundError;
 | |
|     },
 | |
|     stringifyError: function() {
 | |
|         return stringifyError;
 | |
|     }
 | |
| });
 | |
| const WEB_VITALS = [
 | |
|     "CLS",
 | |
|     "FCP",
 | |
|     "FID",
 | |
|     "INP",
 | |
|     "LCP",
 | |
|     "TTFB"
 | |
| ];
 | |
| function execOnce(fn) {
 | |
|     let used = false;
 | |
|     let result;
 | |
|     return function() {
 | |
|         for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
 | |
|             args[_key] = arguments[_key];
 | |
|         }
 | |
|         if (!used) {
 | |
|             used = true;
 | |
|             result = fn(...args);
 | |
|         }
 | |
|         return result;
 | |
|     };
 | |
| }
 | |
| // Scheme: https://tools.ietf.org/html/rfc3986#section-3.1
 | |
| // Absolute URL: https://tools.ietf.org/html/rfc3986#section-4.3
 | |
| const ABSOLUTE_URL_REGEX = /^[a-zA-Z][a-zA-Z\d+\-.]*?:/;
 | |
| const isAbsoluteUrl = (url)=>ABSOLUTE_URL_REGEX.test(url);
 | |
| function getLocationOrigin() {
 | |
|     const { protocol, hostname, port } = window.location;
 | |
|     return protocol + "//" + hostname + (port ? ":" + port : "");
 | |
| }
 | |
| function getURL() {
 | |
|     const { href } = window.location;
 | |
|     const origin = getLocationOrigin();
 | |
|     return href.substring(origin.length);
 | |
| }
 | |
| function getDisplayName(Component) {
 | |
|     return typeof Component === "string" ? Component : Component.displayName || Component.name || "Unknown";
 | |
| }
 | |
| function isResSent(res) {
 | |
|     return res.finished || res.headersSent;
 | |
| }
 | |
| function normalizeRepeatedSlashes(url) {
 | |
|     const urlParts = url.split("?");
 | |
|     const urlNoQuery = urlParts[0];
 | |
|     return urlNoQuery// first we replace any non-encoded backslashes with forward
 | |
|     // then normalize repeated forward slashes
 | |
|     .replace(/\\/g, "/").replace(/\/\/+/g, "/") + (urlParts[1] ? "?" + urlParts.slice(1).join("?") : "");
 | |
| }
 | |
| async function loadGetInitialProps(App, ctx) {
 | |
|     if (process.env.NODE_ENV !== "production") {
 | |
|         var _App_prototype;
 | |
|         if ((_App_prototype = App.prototype) == null ? void 0 : _App_prototype.getInitialProps) {
 | |
|             const message = '"' + getDisplayName(App) + '.getInitialProps()" is defined as an instance method - visit https://nextjs.org/docs/messages/get-initial-props-as-an-instance-method for more information.';
 | |
|             throw new Error(message);
 | |
|         }
 | |
|     }
 | |
|     // when called from _app `ctx` is nested in `ctx`
 | |
|     const res = ctx.res || ctx.ctx && ctx.ctx.res;
 | |
|     if (!App.getInitialProps) {
 | |
|         if (ctx.ctx && ctx.Component) {
 | |
|             // @ts-ignore pageProps default
 | |
|             return {
 | |
|                 pageProps: await loadGetInitialProps(ctx.Component, ctx.ctx)
 | |
|             };
 | |
|         }
 | |
|         return {};
 | |
|     }
 | |
|     const props = await App.getInitialProps(ctx);
 | |
|     if (res && isResSent(res)) {
 | |
|         return props;
 | |
|     }
 | |
|     if (!props) {
 | |
|         const message = '"' + getDisplayName(App) + '.getInitialProps()" should resolve to an object. But found "' + props + '" instead.';
 | |
|         throw new Error(message);
 | |
|     }
 | |
|     if (process.env.NODE_ENV !== "production") {
 | |
|         if (Object.keys(props).length === 0 && !ctx.ctx) {
 | |
|             console.warn("" + getDisplayName(App) + " returned an empty object from `getInitialProps`. This de-optimizes and prevents automatic static optimization. https://nextjs.org/docs/messages/empty-object-getInitialProps");
 | |
|         }
 | |
|     }
 | |
|     return props;
 | |
| }
 | |
| const SP = typeof performance !== "undefined";
 | |
| const ST = SP && [
 | |
|     "mark",
 | |
|     "measure",
 | |
|     "getEntriesByName"
 | |
| ].every((method)=>typeof performance[method] === "function");
 | |
| class DecodeError extends Error {
 | |
| }
 | |
| class NormalizeError extends Error {
 | |
| }
 | |
| class PageNotFoundError extends Error {
 | |
|     constructor(page){
 | |
|         super();
 | |
|         this.code = "ENOENT";
 | |
|         this.name = "PageNotFoundError";
 | |
|         this.message = "Cannot find module for page: " + page;
 | |
|     }
 | |
| }
 | |
| class MissingStaticPage extends Error {
 | |
|     constructor(page, message){
 | |
|         super();
 | |
|         this.message = "Failed to load static file for page: " + page + " " + message;
 | |
|     }
 | |
| }
 | |
| class MiddlewareNotFoundError extends Error {
 | |
|     constructor(){
 | |
|         super();
 | |
|         this.code = "ENOENT";
 | |
|         this.message = "Cannot find the middleware module";
 | |
|     }
 | |
| }
 | |
| function stringifyError(error) {
 | |
|     return JSON.stringify({
 | |
|         message: error.message,
 | |
|         stack: error.stack
 | |
|     });
 | |
| }
 | |
| 
 | |
| //# sourceMappingURL=utils.js.map
 |