Second frontend, written in Next.JS + Typescript.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1 lines
3.2 KiB

{"ast":null,"code":"\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nconst url_1 = require(\"url\");\n/**\n * Utils\n */\n\n\nfunction execOnce(fn) {\n let used = false;\n let result;\n return (...args) => {\n if (!used) {\n used = true;\n result = fn(...args);\n }\n\n return result;\n };\n}\n\nexports.execOnce = execOnce;\n\nfunction getLocationOrigin() {\n const {\n protocol,\n hostname,\n port\n } = window.location;\n return `${protocol}//${hostname}${port ? ':' + port : ''}`;\n}\n\nexports.getLocationOrigin = getLocationOrigin;\n\nfunction getURL() {\n const {\n href\n } = window.location;\n const origin = getLocationOrigin();\n return href.substring(origin.length);\n}\n\nexports.getURL = getURL;\n\nfunction getDisplayName(Component) {\n return typeof Component === 'string' ? Component : Component.displayName || Component.name || 'Unknown';\n}\n\nexports.getDisplayName = getDisplayName;\n\nfunction isResSent(res) {\n return res.finished || res.headersSent;\n}\n\nexports.isResSent = isResSent;\n\nasync function loadGetInitialProps(App, ctx) {\n var _a;\n\n if (false) {\n if ((_a = App.prototype) === null || _a === void 0 ? void 0 : _a.getInitialProps) {\n const message = `\"${getDisplayName(App)}.getInitialProps()\" is defined as an instance method - visit https://err.sh/zeit/next.js/get-initial-props-as-an-instance-method for more information.`;\n throw new Error(message);\n }\n } // when called from _app `ctx` is nested in `ctx`\n\n\n const res = ctx.res || ctx.ctx && ctx.ctx.res;\n\n if (!App.getInitialProps) {\n if (ctx.ctx && ctx.Component) {\n // @ts-ignore pageProps default\n return {\n pageProps: await loadGetInitialProps(ctx.Component, ctx.ctx)\n };\n }\n\n return {};\n }\n\n const props = await App.getInitialProps(ctx);\n\n if (res && isResSent(res)) {\n return props;\n }\n\n if (!props) {\n const message = `\"${getDisplayName(App)}.getInitialProps()\" should resolve to an object. But found \"${props}\" instead.`;\n throw new Error(message);\n }\n\n if (false) {\n if (Object.keys(props).length === 0 && !ctx.ctx) {\n console.warn(`${getDisplayName(App)} returned an empty object from \\`getInitialProps\\`. This de-optimizes and prevents automatic static optimization. https://err.sh/zeit/next.js/empty-object-getInitialProps`);\n }\n }\n\n return props;\n}\n\nexports.loadGetInitialProps = loadGetInitialProps;\nexports.urlObjectKeys = ['auth', 'hash', 'host', 'hostname', 'href', 'path', 'pathname', 'port', 'protocol', 'query', 'search', 'slashes'];\n\nfunction formatWithValidation(url, options) {\n if (false) {\n if (url !== null && typeof url === 'object') {\n Object.keys(url).forEach(key => {\n if (exports.urlObjectKeys.indexOf(key) === -1) {\n console.warn(`Unknown key passed via urlObject into url.format: ${key}`);\n }\n });\n }\n }\n\n return url_1.format(url, options);\n}\n\nexports.formatWithValidation = formatWithValidation;\nexports.SP = typeof performance !== 'undefined';\nexports.ST = exports.SP && typeof performance.mark === 'function' && typeof performance.measure === 'function';","map":null,"metadata":{},"sourceType":"script"}