UNPKG

create-dan

Version:

Dan frameworks

1,487 lines (1,146 loc) 65.5 kB
module.exports = /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = require('../../../ssr-module-cache.js'); /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ var threw = true; /******/ try { /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ threw = false; /******/ } finally { /******/ if(threw) delete installedModules[moduleId]; /******/ } /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 0); /******/ }) /************************************************************************/ /******/ ({ /***/ "./node_modules/@babel/runtime-corejs2/core-js/object/assign.js": /*!**********************************************************************!*\ !*** ./node_modules/@babel/runtime-corejs2/core-js/object/assign.js ***! \**********************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(/*! core-js/library/fn/object/assign */ "core-js/library/fn/object/assign"); /***/ }), /***/ "./node_modules/@babel/runtime-corejs2/core-js/object/create.js": /*!**********************************************************************!*\ !*** ./node_modules/@babel/runtime-corejs2/core-js/object/create.js ***! \**********************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(/*! core-js/library/fn/object/create */ "core-js/library/fn/object/create"); /***/ }), /***/ "./node_modules/@babel/runtime-corejs2/core-js/object/define-property.js": /*!*******************************************************************************!*\ !*** ./node_modules/@babel/runtime-corejs2/core-js/object/define-property.js ***! \*******************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(/*! core-js/library/fn/object/define-property */ "core-js/library/fn/object/define-property"); /***/ }), /***/ "./node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptor.js": /*!*******************************************************************************************!*\ !*** ./node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptor.js ***! \*******************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(/*! core-js/library/fn/object/get-own-property-descriptor */ "core-js/library/fn/object/get-own-property-descriptor"); /***/ }), /***/ "./node_modules/@babel/runtime-corejs2/core-js/object/keys.js": /*!********************************************************************!*\ !*** ./node_modules/@babel/runtime-corejs2/core-js/object/keys.js ***! \********************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(/*! core-js/library/fn/object/keys */ "core-js/library/fn/object/keys"); /***/ }), /***/ "./node_modules/@babel/runtime-corejs2/core-js/promise.js": /*!****************************************************************!*\ !*** ./node_modules/@babel/runtime-corejs2/core-js/promise.js ***! \****************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(/*! core-js/library/fn/promise */ "core-js/library/fn/promise"); /***/ }), /***/ "./node_modules/@babel/runtime-corejs2/core-js/symbol.js": /*!***************************************************************!*\ !*** ./node_modules/@babel/runtime-corejs2/core-js/symbol.js ***! \***************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(/*! core-js/library/fn/symbol */ "core-js/library/fn/symbol"); /***/ }), /***/ "./node_modules/@babel/runtime-corejs2/core-js/symbol/iterator.js": /*!************************************************************************!*\ !*** ./node_modules/@babel/runtime-corejs2/core-js/symbol/iterator.js ***! \************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(/*! core-js/library/fn/symbol/iterator */ "core-js/library/fn/symbol/iterator"); /***/ }), /***/ "./node_modules/@babel/runtime-corejs2/core-js/weak-map.js": /*!*****************************************************************!*\ !*** ./node_modules/@babel/runtime-corejs2/core-js/weak-map.js ***! \*****************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(/*! core-js/library/fn/weak-map */ "core-js/library/fn/weak-map"); /***/ }), /***/ "./node_modules/@babel/runtime-corejs2/helpers/asyncToGenerator.js": /*!*************************************************************************!*\ !*** ./node_modules/@babel/runtime-corejs2/helpers/asyncToGenerator.js ***! \*************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { var _Promise = __webpack_require__(/*! ../core-js/promise */ "./node_modules/@babel/runtime-corejs2/core-js/promise.js"); function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { _Promise.resolve(value).then(_next, _throw); } } function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new _Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } module.exports = _asyncToGenerator; /***/ }), /***/ "./node_modules/@babel/runtime-corejs2/helpers/esm/extends.js": /*!********************************************************************!*\ !*** ./node_modules/@babel/runtime-corejs2/helpers/esm/extends.js ***! \********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _extends; }); /* harmony import */ var _core_js_object_assign__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../core-js/object/assign */ "./node_modules/@babel/runtime-corejs2/core-js/object/assign.js"); /* harmony import */ var _core_js_object_assign__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_core_js_object_assign__WEBPACK_IMPORTED_MODULE_0__); function _extends() { _extends = _core_js_object_assign__WEBPACK_IMPORTED_MODULE_0___default.a || 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); } /***/ }), /***/ "./node_modules/@babel/runtime-corejs2/helpers/extends.js": /*!****************************************************************!*\ !*** ./node_modules/@babel/runtime-corejs2/helpers/extends.js ***! \****************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { var _Object$assign = __webpack_require__(/*! ../core-js/object/assign */ "./node_modules/@babel/runtime-corejs2/core-js/object/assign.js"); function _extends() { module.exports = _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); } module.exports = _extends; /***/ }), /***/ "./node_modules/@babel/runtime-corejs2/helpers/interopRequireDefault.js": /*!******************************************************************************!*\ !*** ./node_modules/@babel/runtime-corejs2/helpers/interopRequireDefault.js ***! \******************************************************************************/ /*! no static exports found */ /***/ (function(module, exports) { function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } module.exports = _interopRequireDefault; /***/ }), /***/ "./node_modules/@babel/runtime-corejs2/helpers/interopRequireWildcard.js": /*!*******************************************************************************!*\ !*** ./node_modules/@babel/runtime-corejs2/helpers/interopRequireWildcard.js ***! \*******************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { var _Object$getOwnPropertyDescriptor = __webpack_require__(/*! ../core-js/object/get-own-property-descriptor */ "./node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptor.js"); var _Object$defineProperty = __webpack_require__(/*! ../core-js/object/define-property */ "./node_modules/@babel/runtime-corejs2/core-js/object/define-property.js"); var _typeof = __webpack_require__(/*! ../helpers/typeof */ "./node_modules/@babel/runtime-corejs2/helpers/typeof.js"); var _WeakMap = __webpack_require__(/*! ../core-js/weak-map */ "./node_modules/@babel/runtime-corejs2/core-js/weak-map.js"); function _getRequireWildcardCache() { if (typeof _WeakMap !== "function") return null; var cache = new _WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (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; } module.exports = _interopRequireWildcard; /***/ }), /***/ "./node_modules/@babel/runtime-corejs2/helpers/typeof.js": /*!***************************************************************!*\ !*** ./node_modules/@babel/runtime-corejs2/helpers/typeof.js ***! \***************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { var _Symbol$iterator = __webpack_require__(/*! ../core-js/symbol/iterator */ "./node_modules/@babel/runtime-corejs2/core-js/symbol/iterator.js"); var _Symbol = __webpack_require__(/*! ../core-js/symbol */ "./node_modules/@babel/runtime-corejs2/core-js/symbol.js"); function _typeof2(obj) { if (typeof _Symbol === "function" && typeof _Symbol$iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof _Symbol === "function" && obj.constructor === _Symbol && obj !== _Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); } function _typeof(obj) { if (typeof _Symbol === "function" && _typeof2(_Symbol$iterator) === "symbol") { module.exports = _typeof = function _typeof(obj) { return _typeof2(obj); }; } else { module.exports = _typeof = function _typeof(obj) { return obj && typeof _Symbol === "function" && obj.constructor === _Symbol && obj !== _Symbol.prototype ? "symbol" : _typeof2(obj); }; } return _typeof(obj); } module.exports = _typeof; /***/ }), /***/ "./node_modules/next/app.js": /*!**********************************!*\ !*** ./node_modules/next/app.js ***! \**********************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(/*! ./dist/pages/_app */ "./node_modules/next/dist/pages/_app.js") /***/ }), /***/ "./node_modules/next/dist/client/router.js": /*!*************************************************!*\ !*** ./node_modules/next/dist/client/router.js ***! \*************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _interopRequireWildcard = __webpack_require__(/*! @babel/runtime-corejs2/helpers/interopRequireWildcard */ "./node_modules/@babel/runtime-corejs2/helpers/interopRequireWildcard.js"); var _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs2/helpers/interopRequireDefault */ "./node_modules/@babel/runtime-corejs2/helpers/interopRequireDefault.js"); exports.__esModule = true; exports.useRouter = useRouter; exports.makePublicRouterInstance = makePublicRouterInstance; exports.createRouter = exports.withRouter = exports.default = void 0; var _extends2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/extends */ "./node_modules/@babel/runtime-corejs2/helpers/extends.js")); var _defineProperty = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-property */ "./node_modules/@babel/runtime-corejs2/core-js/object/define-property.js")); var _react = _interopRequireDefault(__webpack_require__(/*! react */ "react")); var _router2 = _interopRequireWildcard(__webpack_require__(/*! ../next-server/lib/router/router */ "./node_modules/next/dist/next-server/lib/router/router.js")); exports.Router = _router2.default; exports.NextRouter = _router2.NextRouter; var _routerContext = __webpack_require__(/*! ../next-server/lib/router-context */ "./node_modules/next/dist/next-server/lib/router-context.js"); var _withRouter = _interopRequireDefault(__webpack_require__(/*! ./with-router */ "./node_modules/next/dist/client/with-router.js")); exports.withRouter = _withRouter.default; /* global window */ var singletonRouter = { router: null, // holds the actual router instance readyCallbacks: [], ready(cb) { if (this.router) return cb(); if (false) {} } }; // Create public properties and methods of the router in the singletonRouter var urlPropertyFields = ['pathname', 'route', 'query', 'asPath', 'components']; var routerEvents = ['routeChangeStart', 'beforeHistoryChange', 'routeChangeComplete', 'routeChangeError', 'hashChangeStart', 'hashChangeComplete']; var coreMethodFields = ['push', 'replace', 'reload', 'back', 'prefetch', 'beforePopState']; // Events is a static property on the router, the router doesn't have to be initialized to use it (0, _defineProperty.default)(singletonRouter, 'events', { get() { return _router2.default.events; } }); urlPropertyFields.forEach(field => { // Here we need to use Object.defineProperty because, we need to return // the property assigned to the actual router // The value might get changed as we change routes and this is the // proper way to access it (0, _defineProperty.default)(singletonRouter, field, { get() { var router = getRouter(); return router[field]; } }); }); coreMethodFields.forEach(field => { // We don't really know the types here, so we add them later instead ; singletonRouter[field] = function () { var router = getRouter(); return router[field](...arguments); }; }); routerEvents.forEach(event => { singletonRouter.ready(() => { _router2.default.events.on(event, function () { var eventField = "on" + event.charAt(0).toUpperCase() + event.substring(1); var _singletonRouter = singletonRouter; if (_singletonRouter[eventField]) { try { _singletonRouter[eventField](...arguments); } catch (err) { // tslint:disable-next-line:no-console console.error("Error when running the Router event: " + eventField); // tslint:disable-next-line:no-console console.error(err.message + "\n" + err.stack); } } }); }); }); function getRouter() { if (!singletonRouter.router) { var message = 'No router instance found.\n' + 'You should only use "next/router" inside the client side of your app.\n'; throw new Error(message); } return singletonRouter.router; } // Export the singletonRouter and this is the public API. var _default = singletonRouter; // Reexport the withRoute HOC exports.default = _default; function useRouter() { return _react.default.useContext(_routerContext.RouterContext); } // INTERNAL APIS // ------------- // (do not use following exports inside the app) // Create a router and assign it as the singleton instance. // This is used in client side when we are initilizing the app. // This should **not** use inside the server. var createRouter = function createRouter() { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } singletonRouter.router = new _router2.default(...args); singletonRouter.readyCallbacks.forEach(cb => cb()); singletonRouter.readyCallbacks = []; return singletonRouter.router; }; // This function is used to create the `withRouter` router instance exports.createRouter = createRouter; function makePublicRouterInstance(router) { var _router = router; var instance = {}; for (var property of urlPropertyFields) { if (typeof _router[property] === 'object') { instance[property] = (0, _extends2.default)({}, _router[property]); // makes sure query is not stateful continue; } instance[property] = _router[property]; } // Events is a static property on the router, the router doesn't have to be initialized to use it instance.events = _router2.default.events; coreMethodFields.forEach(field => { instance[field] = function () { return _router[field](...arguments); }; }); return instance; } /***/ }), /***/ "./node_modules/next/dist/client/with-router.js": /*!******************************************************!*\ !*** ./node_modules/next/dist/client/with-router.js ***! \******************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs2/helpers/interopRequireDefault */ "./node_modules/@babel/runtime-corejs2/helpers/interopRequireDefault.js"); exports.__esModule = true; exports.default = withRouter; var _extends2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/extends */ "./node_modules/@babel/runtime-corejs2/helpers/extends.js")); var _react = _interopRequireDefault(__webpack_require__(/*! react */ "react")); var _router = __webpack_require__(/*! ./router */ "./node_modules/next/dist/client/router.js"); function withRouter(ComposedComponent) { function WithRouterWrapper(props) { return _react.default.createElement(ComposedComponent, (0, _extends2.default)({ router: (0, _router.useRouter)() }, props)); } WithRouterWrapper.getInitialProps = ComposedComponent.getInitialProps // This is needed to allow checking for custom getInitialProps in _app ; WithRouterWrapper.origGetInitialProps = ComposedComponent.origGetInitialProps; if (true) { var name = ComposedComponent.displayName || ComposedComponent.name || 'Unknown'; WithRouterWrapper.displayName = "withRouter(" + name + ")"; } return WithRouterWrapper; } /***/ }), /***/ "./node_modules/next/dist/next-server/lib/mitt.js": /*!********************************************************!*\ !*** ./node_modules/next/dist/next-server/lib/mitt.js ***! \********************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* MIT License Copyright (c) Jason Miller (https://jasonformat.com/) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ var _Object$create = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/create */ "./node_modules/@babel/runtime-corejs2/core-js/object/create.js"); var _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-property */ "./node_modules/@babel/runtime-corejs2/core-js/object/define-property.js"); _Object$defineProperty(exports, "__esModule", { value: true }); function mitt() { const all = _Object$create(null); return { on(type, handler) { ; (all[type] || (all[type] = [])).push(handler); }, off(type, handler) { if (all[type]) { // tslint:disable-next-line:no-bitwise all[type].splice(all[type].indexOf(handler) >>> 0, 1); } }, emit(type, ...evts) { // eslint-disable-next-line array-callback-return ; (all[type] || []).slice().map(handler => { handler(...evts); }); } }; } exports.default = mitt; /***/ }), /***/ "./node_modules/next/dist/next-server/lib/router-context.js": /*!******************************************************************!*\ !*** ./node_modules/next/dist/next-server/lib/router-context.js ***! \******************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-property */ "./node_modules/@babel/runtime-corejs2/core-js/object/define-property.js"); var __importStar = this && this.__importStar || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result["default"] = mod; return result; }; _Object$defineProperty(exports, "__esModule", { value: true }); const React = __importStar(__webpack_require__(/*! react */ "react")); exports.RouterContext = React.createContext(null); /***/ }), /***/ "./node_modules/next/dist/next-server/lib/router/router.js": /*!*****************************************************************!*\ !*** ./node_modules/next/dist/next-server/lib/router/router.js ***! \*****************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _Object$assign = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/assign */ "./node_modules/@babel/runtime-corejs2/core-js/object/assign.js"); var _Promise = __webpack_require__(/*! @babel/runtime-corejs2/core-js/promise */ "./node_modules/@babel/runtime-corejs2/core-js/promise.js"); var _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-property */ "./node_modules/@babel/runtime-corejs2/core-js/object/define-property.js"); var __importDefault = this && this.__importDefault || function (mod) { return mod && mod.__esModule ? mod : { "default": mod }; }; _Object$defineProperty(exports, "__esModule", { value: true }); const url_1 = __webpack_require__(/*! url */ "url"); const mitt_1 = __importDefault(__webpack_require__(/*! ../mitt */ "./node_modules/next/dist/next-server/lib/mitt.js")); const utils_1 = __webpack_require__(/*! ../utils */ "./node_modules/next/dist/next-server/lib/utils.js"); const is_dynamic_1 = __webpack_require__(/*! ./utils/is-dynamic */ "./node_modules/next/dist/next-server/lib/router/utils/is-dynamic.js"); const route_matcher_1 = __webpack_require__(/*! ./utils/route-matcher */ "./node_modules/next/dist/next-server/lib/router/utils/route-matcher.js"); const route_regex_1 = __webpack_require__(/*! ./utils/route-regex */ "./node_modules/next/dist/next-server/lib/router/utils/route-regex.js"); function addBasePath(path) { // @ts-ignore variable is always a string const p = ""; return path.indexOf(p) !== 0 ? p + path : path; } function toRoute(path) { return path.replace(/\/$/, '') || '/'; } class Router { constructor(pathname, query, as, { initialProps, pageLoader, App, wrapApp, Component, err, subscription }) { // Static Data Cache this.sdc = {}; this.onPopState = e => { if (!e.state) { // We get state as undefined for two reasons. // 1. With older safari (< 8) and older chrome (< 34) // 2. When the URL changed with # // // In the both cases, we don't need to proceed and change the route. // (as it's already changed) // But we can simply replace the state with the new changes. // Actually, for (1) we don't need to nothing. But it's hard to detect that event. // So, doing the following for (1) does no harm. const { pathname, query } = this; this.changeState('replaceState', utils_1.formatWithValidation({ pathname, query }), utils_1.getURL()); return; } // Make sure we don't re-render on initial load, // can be caused by navigating back from an external site if (e.state && this.isSsr && e.state.url === this.pathname && e.state.as === this.asPath) { return; } // If the downstream application returns falsy, return. // They will then be responsible for handling the event. if (this._bps && !this._bps(e.state)) { return; } const { url, as, options } = e.state; if (true) { if (typeof url === 'undefined' || typeof as === 'undefined') { console.warn('`popstate` event triggered but `event.state` did not have `url` or `as` https://err.sh/zeit/next.js/popstate-state-empty'); } } this.replace(url, as, options); }; this._getStaticData = (asPath, _cachedData) => { let pathname = url_1.parse(asPath).pathname; pathname = !pathname || pathname === '/' ? '/index' : pathname; return false ? undefined : fetch( // @ts-ignore __NEXT_DATA__ `/_next/data/${__NEXT_DATA__.buildId}${pathname}.json`).then(res => { if (!res.ok) { throw new Error(`Failed to load static props`); } return res.json(); }).then(data => { this.sdc[pathname] = data; return data; }).catch(err => { ; err.code = 'PAGE_LOAD_ERROR'; throw err; }); }; // represents the current component key this.route = toRoute(pathname); // set up the component cache (by route keys) this.components = {}; // We should not keep the cache, if there's an error // Otherwise, this cause issues when when going back and // come again to the errored page. if (pathname !== '/_error') { this.components[this.route] = { Component, props: initialProps, err }; } this.components['/_app'] = { Component: App }; // Backwards compat for Router.router.events // TODO: Should be remove the following major version as it was never documented // @ts-ignore backwards compatibility this.events = Router.events; this.pageLoader = pageLoader; this.pathname = pathname; this.query = query; // if auto prerendered and dynamic route wait to update asPath // until after mount to prevent hydration mismatch this.asPath = // @ts-ignore this is temporarily global (attached to window) is_dynamic_1.isDynamicRoute(pathname) && __NEXT_DATA__.autoExport ? pathname : as; this.sub = subscription; this.clc = null; this._wrapApp = wrapApp; // make sure to ignore extra popState in safari on navigating // back from external site this.isSsr = true; if (false) {} } // @deprecated backwards compatibility even though it's a private method. static _rewriteUrlForNextExport(url) { if (false) {} else { return url; } } update(route, mod) { const Component = mod.default || mod; const data = this.components[route]; if (!data) { throw new Error(`Cannot update unavailable route: ${route}`); } const newData = _Object$assign(_Object$assign({}, data), { Component }); this.components[route] = newData; // pages/_app.js updated if (route === '/_app') { this.notify(this.components[this.route]); return; } if (route === this.route) { this.notify(newData); } } reload() { window.location.reload(); } /** * Go back in history */ back() { window.history.back(); } /** * Performs a `pushState` with arguments * @param url of the route * @param as masks `url` for the browser * @param options object you can define `shallow` and other options */ push(url, as = url, options = {}) { return this.change('pushState', url, as, options); } /** * Performs a `replaceState` with arguments * @param url of the route * @param as masks `url` for the browser * @param options object you can define `shallow` and other options */ replace(url, as = url, options = {}) { return this.change('replaceState', url, as, options); } change(method, _url, _as, options) { return new _Promise((resolve, reject) => { if (!options._h) { this.isSsr = false; } // marking route changes as a navigation start entry if (utils_1.ST) { performance.mark('routeChange'); } // If url and as provided as an object representation, // we'll format them into the string version here. const url = typeof _url === 'object' ? utils_1.formatWithValidation(_url) : _url; let as = typeof _as === 'object' ? utils_1.formatWithValidation(_as) : _as; // Add the ending slash to the paths. So, we can serve the // "<page>/index.html" directly for the SSR page. if (false) {} this.abortComponentLoad(as); // If the url change is only related to a hash change // We should not proceed. We should only change the state. // WARNING: `_h` is an internal option for handing Next.js client-side // hydration. Your app should _never_ use this property. It may change at // any time without notice. if (!options._h && this.onlyAHashChange(as)) { this.asPath = as; Router.events.emit('hashChangeStart', as); this.changeState(method, url, addBasePath(as)); this.scrollToHash(as); Router.events.emit('hashChangeComplete', as); return resolve(true); } const { pathname, query, protocol } = url_1.parse(url, true); if (!pathname || protocol) { if (true) { throw new Error(`Invalid href passed to router: ${url} https://err.sh/zeit/next.js/invalid-href-passed`); } return resolve(false); } // If asked to change the current URL we should reload the current page // (not location.reload() but reload getInitialProps and other Next.js stuffs) // We also need to set the method = replaceState always // as this should not go into the history (That's how browsers work) // We should compare the new asPath to the current asPath, not the url if (!this.urlIsNew(as)) { method = 'replaceState'; } // @ts-ignore pathname is always a string const route = toRoute(pathname); const { shallow = false } = options; if (is_dynamic_1.isDynamicRoute(route)) { const { pathname: asPathname } = url_1.parse(as); const routeMatch = route_matcher_1.getRouteMatcher(route_regex_1.getRouteRegex(route))(asPathname); if (!routeMatch) { const error = `The provided \`as\` value (${asPathname}) is incompatible with the \`href\` value (${route}). ` + `Read more: https://err.sh/zeit/next.js/incompatible-href-as`; if (true) { throw new Error(error); } else {} return resolve(false); } // Merge params into `query`, overwriting any specified in search _Object$assign(query, routeMatch); } Router.events.emit('routeChangeStart', as); // If shallow is true and the route exists in the router cache we reuse the previous result // @ts-ignore pathname is always a string this.getRouteInfo(route, pathname, query, as, shallow).then(routeInfo => { const { error } = routeInfo; if (error && error.cancelled) { return resolve(false); } Router.events.emit('beforeHistoryChange', as); this.changeState(method, url, addBasePath(as), options); const hash = window.location.hash.substring(1); if (true) { const appComp = this.components['/_app'].Component; window.next.isPrerendered = appComp.getInitialProps === appComp.origGetInitialProps && !routeInfo.Component.getInitialProps; } // @ts-ignore pathname is always defined this.set(route, pathname, query, as, _Object$assign(_Object$assign({}, routeInfo), { hash })); if (error) { Router.events.emit('routeChangeError', error, as); throw error; } Router.events.emit('routeChangeComplete', as); return resolve(true); }, reject); }); } changeState(method, url, as, options = {}) { if (true) { if (typeof window.history === 'undefined') { console.error(`Warning: window.history is not available.`); return; } // @ts-ignore method should always exist on history if (typeof window.history[method] === 'undefined') { console.error(`Warning: window.history.${method} is not available`); return; } } if (method !== 'pushState' || utils_1.getURL() !== as) { // @ts-ignore method should always exist on history window.history[method]({ url, as, options }, null, as); } } getRouteInfo(route, pathname, query, as, shallow = false) { const cachedRouteInfo = this.components[route]; // If there is a shallow route transition possible // If the route is already rendered on the screen. if (shallow && cachedRouteInfo && this.route === route) { return _Promise.resolve(cachedRouteInfo); } return new _Promise((resolve, reject) => { if (cachedRouteInfo) { return resolve(cachedRouteInfo); } this.fetchComponent(route).then(Component => resolve({ Component }), reject); }).then(routeInfo => { const { Component } = routeInfo; if (true) { const { isValidElementType } = __webpack_require__(/*! react-is */ "react-is"); if (!isValidElementType(Component)) { throw new Error(`The default export is not a React Component in page: "${pathname}"`); } } return this._getData(() => Component.__N_SSG ? this._getStaticData(as) : this.getInitialProps(Component, // we provide AppTree later so this needs to be `any` { pathname, query, asPath: as })).then(props => { routeInfo.props = props; this.components[route] = routeInfo; return routeInfo; }); }).catch(err => { return new _Promise(resolve => { if (err.code === 'PAGE_LOAD_ERROR') { // If we can't load the page it could be one of following reasons // 1. Page doesn't exists // 2. Page does exist in a different zone // 3. Internal error while loading the page // So, doing a hard reload is the proper way to deal with this. window.location.href = as; // Changing the URL doesn't block executing the current code path. // So, we need to mark it as a cancelled error and stop the routing logic. err.cancelled = true; // @ts-ignore TODO: fix the control flow here return resolve({ error: err }); } if (err.cancelled) { // @ts-ignore TODO: fix the control flow here return resolve({ error: err }); } resolve(this.fetchComponent('/_error').then(Component => { const routeInfo = { Component, err }; return new _Promise(resolve => { this.getInitialProps(Component, { err, pathname, query }).then(props => { routeInfo.props = props; routeInfo.error = err; resolve(routeInfo); }, gipErr => { console.error('Error in error page `getInitialProps`: ', gipErr); routeInfo.error = err; routeInfo.props = {}; resolve(routeInfo); }); }); })); }); }); } set(route, pathname, query, as, data) { this.route = route; this.pathname = pathname; this.query = query; this.asPath = as; this.notify(data); } /** * Callback to execute before replacing router state * @param cb callback to be executed */ beforePopState(cb) { this._bps = cb; } onlyAHashChange(as) { if (!this.asPath) return false; const [oldUrlNoHash, oldHash] = this.asPath.split('#'); const [newUrlNoHash, newHash] = as.split('#'); // Makes sure we scroll to the provided hash if the url/hash are the same if (newHash && oldUrlNoHash === newUrlNoHash && oldHash === newHash) { return true; } // If the urls are change, there's more than a hash change if (oldUrlNoHash !== newUrlNoHash) { return false; } // If the hash has changed, then it's a hash only change. // This check is necessary to handle both the enter and // leave hash === '' cases. The identity case falls through // and is treated as a next reload. return oldHash !== newHash; } scrollToHash(as) { const [, hash] = as.split('#'); // Scroll to top if the hash is just `#` with no value if (hash === '') { window.scrollTo(0, 0); return; } // First we check if the element by id is found const idEl = document.getElementById(hash); if (idEl) { idEl.scrollIntoView(); return; } // If there's no element with the id, we check the `name` property // To mirror browsers const nameEl = document.getElementsByName(hash)[0]; if (nameEl) { nameEl.scrollIntoView(); } } urlIsNew(asPath) { return this.asPath !== asPath; } /** * Prefetch `page` code, you may wait for the data during `page` rendering. * This feature only works in production! * @param url of prefetched `page` */ prefetch(url) { return new _Promise((resolve, reject) => { const { pathname, protocol } = url_1.parse(url); if (!pathname || protocol) { if (true) { throw new Error(`Invalid href passed to router: ${url} https://err.sh/zeit/next.js/invalid-href-passed`); } return; } // Prefetch is not supported in development mode because it would trigger on-demand-entries if (true) { return; } // @ts-ignore pathname is always defined const route = toRoute(pathname); this.pageLoader.prefetch(route).then(resolve, reject); }); } async fetchComponent(route) { let cancelled = false; const cancel = this.clc = () => { cancelled = true; }; const Component = await this.pageLoader.loadPage(route); if (cancelled) { const error = new Error(`Abort fetching component for route: "${route}"`); error.cancelled = true; throw error; } if (cancel === this.clc) { this.clc = null; } return Component; } _getData(fn) { let cancelled = false; const cancel = () => { cancelled = true; }; this.clc = cancel; return fn().then(data => { if (cancel === this.clc) { this.clc = null; } if (cancelled) { const err = new Error('Loading initial props cancelled'); err.cancelled = true; throw err; } return data; }); } getInitialProps(Component, ctx) { const { Component: App } = this.components['/_app']; const AppTree = this._wrapApp(App); ctx.AppTree = AppTree; return utils_1.loadGetInitialProps(App, { AppTree, Component, router: this, ctx }); } abortComponentLoad(as) { if (this.clc) { const e = new Error('Route Cancelled'); e.cancelled = true; Router.events.emit('routeChangeError', e, as); this.clc(); this.clc = null; } } notify(data) { this.sub(data, this.components['/_app'].Component); } } exports.default = Router; Router.events = mitt_1.default(); /***/ }), /***/ "./node_modules/next/dist/next-server/lib/router/utils/is-dynamic.js": /*!***************************************************************************!*\ !*** ./node_modules/next/dist/next-server/lib/router/utils/is-dynamic.js ***! \***************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-property */ "./node_modules/@babel/runtime-corejs2/core-js/object/define-property.js"); _Object$defineProperty(exports, "__esModule", { value: true }); // Identify /[param]/ in route string const TEST_ROUTE = /\/\[[^/]+?\](?=\/|$)/; function isDynamicRoute(route) { return TEST_ROUTE.test(route); } exports.isDynamicRoute = isDynamicRoute; /***/ }), /***/ "./node_modules/next/dist/next-server/lib/router/utils/route-matcher.js": /*!******************************************************************************!*\ !*** ./node_modules/next/dist/next-server/lib/router/utils/route-matcher.js ***! \******************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _Object$keys = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/keys */ "./node_modules/@babel/runtime-corejs2/core-js/object/keys.js"); var _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-property */ "./node_modules/@babel/runtime-corejs2/core-js/object/define-property.js"); _Object$defineProperty(exports, "__esModule", { value: true }); function getRouteMatcher(routeRegex) { const { re, groups } = routeRegex; return pathname => { const routeMatch = re.exec(pathname); if (!routeMatch) { return false; } const decode = decodeURIComponent; const params = {}; _Object$keys(groups).forEach(slugName => { const g = groups[slugName]; const m = routeMatch[g.pos]; if (m !== undefined) { params[slugName] = ~m.indexOf('/') ? m.split('/').map(entry => decode(entry)) : g.repeat ? [decode(m)] : decode(m); } }); return params; }; } exports.getRouteMatcher = getRouteMatcher; /***/ }), /***/ "./node_modules/next/dist/next-server/lib/router/utils/route-regex.js": /*!****************************************************************************!*\ !*** ./node_modules/next/dist/next-server/lib/router/utils/route-regex.js ***! \****************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-property */ "./node_modules/@babel/runtime-corejs2/core-js/object/define-property.js"); _Object$defineProperty(exports, "__esModule", { value: true }); function getRouteRegex(normalizedRoute) { // Escape all characters that could be considered RegEx const escapedRoute = (normalizedRoute.replace(/\/$/, '') || '/').replace(/[|\\{}()[\]^$+*?.-]/g, '\\$&'); const groups = {}; let groupIndex = 1; const parameterizedRoute = escapedRoute.replace(/\/\\\[([^/]+?)\\\](?=\/|$)/g, (_, $1) => { const isCatchAll = /^(\