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.

0 lines
12 KiB

4 years ago
  1. {"ast":null,"code":"\"use strict\";\n\nvar _regeneratorRuntime = require(\"@babel/runtime/regenerator\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar url_1 = require(\"url\");\n/**\n * Utils\n */\n\n\nfunction execOnce(fn) {\n var used = false;\n var result;\n return function () {\n if (!used) {\n used = true;\n result = fn.apply(void 0, arguments);\n }\n\n return result;\n };\n}\n\nexports.execOnce = execOnce;\n\nfunction getLocationOrigin() {\n var _window$location = window.location,\n protocol = _window$location.protocol,\n hostname = _window$location.hostname,\n port = _window$location.port;\n return \"\".concat(protocol, \"//\").concat(hostname).concat(port ? ':' + port : '');\n}\n\nexports.getLocationOrigin = getLocationOrigin;\n\nfunction getURL() {\n var href = window.location.href;\n var 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\nfunction loadGetInitialProps(App, ctx) {\n var _a, message, res, props, _message;\n\n return _regeneratorRuntime.async(function loadGetInitialProps$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n if (!true) {\n _context.next = 4;\n break;\n }\n\n if (!((_a = App.prototype) === null || _a === void 0 ? void 0 : _a.getInitialProps)) {\n _context.next = 4;\n break;\n }\n\n message = \"\\\"\".concat(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 case 4:\n // when called from _app `ctx` is nested in `ctx`\n res = ctx.res || ctx.ctx && ctx.ctx.res;\n\n if (App.getInitialProps) {\n _context.next = 12;\n break;\n }\n\n if (!(ctx.ctx && ctx.Component)) {\n _context.next = 11;\n break;\n }\n\n _context.next = 9;\n return _regeneratorRuntime.awrap(loadGetInitialProps(ctx.Component, ctx.ctx));\n\n case 9:\n _context.t0 = _context.sent;\n return _context.abrupt(\"return\", {\n pageProps: _context.t0\n });\n\n case 11:\n return _context.abrupt(\"return\", {});\n\n case 12:\n _context.next = 14;\n return _regeneratorRuntime.awrap(App.getInitialProps(ctx));\n\n case 14:\n props = _context.sent;\n\n if (!(res && isResSent(res))) {\n _context.next = 17;\n break;\n }\n\n return _context.abrupt(\"return\", props);\n\n case 17:\n if (props) {\n _context.next = 20;\n break;\n }\n\n _message = \"\\\"\".concat(getDisplayName(App), \".getInitialProps()\\\" should resolve to an object. But found \\\"\").concat(props, \"\\\" instead.\");\n throw new Error(_message);\n\n case 20:\n if (true) {\n if (Object.keys(props).length === 0 && !ctx.ctx) {\n console.warn(\"\".concat(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 _context.abrupt(\"return\", props);\n\n case 22:\n case \"end\":\n return _context.stop();\n }\n }\n }, null, null, null, Promise);\n}\n\nexports.loadGetInitialProps = loadGetInitialProps;\nexports.urlObjectKeys = ['auth', 'hash', 'host', 'hostname', 'href', '