@dr.pogodin/react-utils 1.18.0 → 1.18.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/development/client/index.js +4 -4
- package/build/development/client/index.js.map +1 -1
- package/build/development/client/init.js +24 -41
- package/build/development/client/init.js.map +1 -1
- package/build/development/server/renderer.js +6 -2
- package/build/development/server/renderer.js.map +1 -1
- package/build/development/server/server.js +15 -9
- package/build/development/server/server.js.map +1 -1
- package/build/development/web.bundle.js +31 -171
- package/build/production/client/index.js +1 -1
- package/build/production/client/index.js.map +1 -1
- package/build/production/client/init.js +6 -2
- package/build/production/client/init.js.map +1 -1
- package/build/production/server/renderer.js +5 -2
- package/build/production/server/renderer.js.map +1 -1
- package/build/production/server/server.js +14 -4
- package/build/production/server/server.js.map +1 -1
- package/build/production/web.bundle.js +1 -1
- package/build/production/web.bundle.js.map +1 -1
- package/package.json +23 -23
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* Prepares and launches the app at client side.
|
|
4
4
|
* @param {object} Application Root application component
|
|
5
5
|
* @param {object} [options={}] Optional. Additional settings.
|
|
6
|
-
*/function Launch(Application){
|
|
6
|
+
*/function Launch(Application){let options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};const container=document.getElementById("react-view");const scene=/*#__PURE__*/(0,_jsxRuntime.jsx)(_reactGlobalState.GlobalStateProvider,{initialState:window.ISTATE,children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_reactRouterDom.BrowserRouter,{children:/*#__PURE__*/(0,_jsxRuntime.jsx)(Application,{})})});if(options.dontHydrate){const root=(0,_client.createRoot)(container);root.render(scene)}else(0,_client.hydrateRoot)(container,scene)}
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Launch","Application","options","container","document","getElementById","scene","window","ISTATE","dontHydrate","root","createRoot","render","hydrateRoot"],"sources":["../../../src/client/index.jsx"],"sourcesContent":["// Initialization of client-side code.\n/* global document, window */\n\nimport { GlobalStateProvider } from '@dr.pogodin/react-global-state';\n\nimport { createRoot, hydrateRoot } from 'react-dom/client';\nimport { BrowserRouter } from 'react-router-dom';\n\n/**\n * Prepares and launches the app at client side.\n * @param {object} Application Root application component\n * @param {object} [options={}] Optional. Additional settings.\n */\nexport default function Launch(Application, options = {}) {\n const container = document.getElementById('react-view');\n const scene = (\n <GlobalStateProvider initialState={window.ISTATE}>\n <BrowserRouter>\n <Application />\n </BrowserRouter>\n </GlobalStateProvider>\n );\n\n if (options.dontHydrate) {\n const root = createRoot(container);\n root.render(scene);\n } else hydrateRoot(container, scene);\n}\n"],"mappings":"6FAGA,gEAEA,wCACA,gD,6CANA;AACA,6B,CAOA;AACA;AACA;AACA;AACA,GACe,QAASA,OAAT,CAAgBC,WAAhB,CAA2C,IAAdC,QAAc,2DAAJ,EAAI,CACxD,
|
|
1
|
+
{"version":3,"file":"index.js","names":["Launch","Application","options","container","document","getElementById","scene","window","ISTATE","dontHydrate","root","createRoot","render","hydrateRoot"],"sources":["../../../src/client/index.jsx"],"sourcesContent":["// Initialization of client-side code.\n/* global document, window */\n\nimport { GlobalStateProvider } from '@dr.pogodin/react-global-state';\n\nimport { createRoot, hydrateRoot } from 'react-dom/client';\nimport { BrowserRouter } from 'react-router-dom';\n\n/**\n * Prepares and launches the app at client side.\n * @param {object} Application Root application component\n * @param {object} [options={}] Optional. Additional settings.\n */\nexport default function Launch(Application, options = {}) {\n const container = document.getElementById('react-view');\n const scene = (\n <GlobalStateProvider initialState={window.ISTATE}>\n <BrowserRouter>\n <Application />\n </BrowserRouter>\n </GlobalStateProvider>\n );\n\n if (options.dontHydrate) {\n const root = createRoot(container);\n root.render(scene);\n } else hydrateRoot(container, scene);\n}\n"],"mappings":"6FAGA,gEAEA,wCACA,gD,6CANA;AACA,6B,CAOA;AACA;AACA;AACA;AACA,GACe,QAASA,OAAT,CAAgBC,WAAhB,CAA2C,IAAdC,QAAc,2DAAJ,EAAI,CACxD,KAAMC,UAAS,CAAGC,QAAQ,CAACC,cAAT,CAAwB,YAAxB,CAAlB,CACA,KAAMC,MAAK,cACT,oBAAC,qCAAD,EAAqB,YAAY,CAAEC,MAAM,CAACC,MAA1C,uBACE,oBAAC,6BAAD,wBACE,oBAAC,WAAD,IADF,EADF,EADF,CAQA,GAAIN,OAAO,CAACO,WAAZ,CAAyB,CACvB,KAAMC,KAAI,CAAG,GAAAC,kBAAA,EAAWR,SAAX,CAAb,CACAO,IAAI,CAACE,MAAL,CAAYN,KAAZ,CACD,CAHD,IAGO,GAAAO,mBAAA,EAAYV,SAAZ,CAAuBG,KAAvB,CACR"}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _forge=_interopRequireDefault(require("node-forge/lib/forge"));require("node-forge/lib/aes");/**
|
|
2
2
|
* Initialization of client-side environment.
|
|
3
3
|
*/ /* global BUILD_INFO, document, window */ // Note: this way, only required part of "node-forge": AES, and some utils,
|
|
4
4
|
// is bundled into client-side code.
|
|
5
5
|
/* `BUILD_INFO` is always injected by Webpack build, but this check is needed
|
|
6
6
|
* to adopt the code for usage in tests. */if(typeof BUILD_INFO!=="undefined"){window.TRU_BUILD_INFO=BUILD_INFO}/* Removes data injection script out of the document.
|
|
7
|
-
* The if block is here for test purposes. */if(!window.TRU_KEEP_INJ_SCRIPT){
|
|
7
|
+
* The if block is here for test purposes. */if(!window.TRU_KEEP_INJ_SCRIPT){const block=document.querySelector("script[id=\"inj\"]");if(block)document.getElementsByTagName("body")[0].removeChild(block)}/* TODO: A proper logger should be moved to `@dr.pogodin/react-utils`. */ /* eslint-disable no-console */const{useServiceWorker}=window.TRU_BUILD_INFO;if(useServiceWorker){const{navigator}=window;if("serviceWorker"in navigator){window.addEventListener("load",async()=>{try{// Note: no matter the "publicPath", we want to serve the service worker
|
|
8
|
+
// from the web app root, to allow it control any and all pages of the
|
|
9
|
+
// web app (otherwise, it will be restricted to the scope of its path).
|
|
10
|
+
// The server takes it into account.
|
|
11
|
+
const reg=await navigator.serviceWorker.register("/__service-worker.js");console.log("SW registered:",reg)}catch(err){console.log("SW registration failed:",err)}})}}/* eslint-enable no-console */ /* Decodes data injected at the server side. */if(window.INJ){const{key}=window.TRU_BUILD_INFO;let data=_forge.default.util.decode64(window.INJ);const decipher=_forge.default.cipher.createDecipher("AES-CBC",key);decipher.start({iv:data.slice(0,32)});decipher.update(_forge.default.util.createBuffer(data.slice(32)));decipher.finish();data=_forge.default.util.decodeUtf8(decipher.output.data);data=eval("(".concat(data,")"));// eslint-disable-line no-eval
|
|
8
12
|
window.CHUNK_GROUPS=data.CHUNK_GROUPS;window.CONFIG=data.CONFIG;window.ISTATE=data.ISTATE}else{// This is possible when the client-side bundle is launched as a stand-alone
|
|
9
13
|
// precompiled website, rather than served by react-utils' based server.
|
|
10
14
|
window.CHUNK_GROUPS={};window.CONFIG={}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","names":["BUILD_INFO","window","TRU_BUILD_INFO","TRU_KEEP_INJ_SCRIPT","block","document","querySelector","getElementsByTagName","removeChild","
|
|
1
|
+
{"version":3,"file":"init.js","names":["BUILD_INFO","window","TRU_BUILD_INFO","TRU_KEEP_INJ_SCRIPT","block","document","querySelector","getElementsByTagName","removeChild","useServiceWorker","navigator","addEventListener","reg","serviceWorker","register","console","log","err","INJ","key","data","forge","util","decode64","decipher","cipher","createDecipher","start","iv","slice","update","createBuffer","finish","decodeUtf8","output","eval","CHUNK_GROUPS","CONFIG","ISTATE"],"sources":["../../../src/client/init.js"],"sourcesContent":["/**\n * Initialization of client-side environment.\n */\n\n/* global BUILD_INFO, document, window */\n\n// Note: this way, only required part of \"node-forge\": AES, and some utils,\n// is bundled into client-side code.\nimport forge from 'node-forge/lib/forge';\nimport 'node-forge/lib/aes';\n\n/* `BUILD_INFO` is always injected by Webpack build, but this check is needed\n * to adopt the code for usage in tests. */\nif (typeof BUILD_INFO !== 'undefined') {\n window.TRU_BUILD_INFO = BUILD_INFO;\n}\n\n/* Removes data injection script out of the document.\n * The if block is here for test purposes. */\nif (!window.TRU_KEEP_INJ_SCRIPT) {\n const block = document.querySelector('script[id=\"inj\"]');\n if (block) document.getElementsByTagName('body')[0].removeChild(block);\n}\n\n/* TODO: A proper logger should be moved to `@dr.pogodin/react-utils`. */\n/* eslint-disable no-console */\nconst { useServiceWorker } = window.TRU_BUILD_INFO;\nif (useServiceWorker) {\n const { navigator } = window;\n if ('serviceWorker' in navigator) {\n window.addEventListener('load', async () => {\n try {\n // Note: no matter the \"publicPath\", we want to serve the service worker\n // from the web app root, to allow it control any and all pages of the\n // web app (otherwise, it will be restricted to the scope of its path).\n // The server takes it into account.\n const reg = await navigator\n .serviceWorker.register('/__service-worker.js');\n console.log('SW registered:', reg);\n } catch (err) {\n console.log('SW registration failed:', err);\n }\n });\n }\n}\n/* eslint-enable no-console */\n\n/* Decodes data injected at the server side. */\nif (window.INJ) {\n const { key } = window.TRU_BUILD_INFO;\n let data = forge.util.decode64(window.INJ);\n const decipher = forge.cipher.createDecipher('AES-CBC', key);\n decipher.start({ iv: data.slice(0, 32) });\n decipher.update(forge.util.createBuffer(data.slice(32)));\n decipher.finish();\n\n data = forge.util.decodeUtf8(decipher.output.data);\n data = eval(`(${data})`); // eslint-disable-line no-eval\n\n window.CHUNK_GROUPS = data.CHUNK_GROUPS;\n window.CONFIG = data.CONFIG;\n window.ISTATE = data.ISTATE;\n} else {\n // This is possible when the client-side bundle is launched as a stand-alone\n // precompiled website, rather than served by react-utils' based server.\n window.CHUNK_GROUPS = {};\n window.CONFIG = {};\n}\n"],"mappings":"gGAQA,mEACA,8BATA;AACA;AACA,G,CAEA,yC,CAEA;AACA;AAIA;AACA,2CACA,GAAI,MAAOA,WAAP,GAAsB,WAA1B,CAAuC,CACrCC,MAAM,CAACC,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AwBX,IAAI,CAACS,KAAL,CAAW,EAAX,CAAxB,CAAhB,EACAL,QAAQ,CAACQ,MAAT,GAEAZ,IAAI,CAAGC,cAAA,CAAMC,IAAN,CAAWW,UAAX,CAAsBT,QAAQ,CAACU,MAAT,CAAgBd,IAAtC,CAAP,CACAA,IAAI,CAAGe,IAAI,YAAKf,IAAL,MAAX,CAA0B;AAE1BnB,MAAM,CAACmC,YAAP,CAAsBhB,IAAI,CAACgB,YAA3B,CACAnC,MAAM,CAACoC,MAAP,CAAgBjB,IAAI,CAACiB,MAArB,CACApC,MAAM,CAACqC,MAAP,CAAgBlB,IAAI,CAACkB,MACtB,CAdD,IAcO,CACL;AACA;AACArC,MAAM,CAACmC,YAAP,CAAsB,EAAtB,CACAnC,MAAM,CAACoC,MAAP,CAAgB,EACjB"}
|
|
@@ -136,8 +136,11 @@ stream=await renderPass();logMsg=bailed?`SSR timed out after ${ops.ssrTimeout} s
|
|
|
136
136
|
${scriptChunkString}
|
|
137
137
|
${grouppedExtraScripts[SCRIPT_LOCATIONS.DEFAULT]}
|
|
138
138
|
</body>
|
|
139
|
-
</html>`;const status=ssrContext.status||200;if(status!==200)res.status(status);
|
|
139
|
+
</html>`;const status=ssrContext.status||200;if(status!==200)res.status(status);if(cacheRef&&status<500){// Note: waiting for the caching to complete is not strictly necessary,
|
|
140
140
|
// but it greately simplifies testing, and error reporting.
|
|
141
141
|
await new Promise((done,failed)=>{(0,_zlib.brotliCompress)(html,(error,buffer)=>{if(error)failed(error);else{buffer.nonce=req.nonce;// eslint-disable-line no-param-reassign
|
|
142
|
-
cache.add({buffer,status},cacheRef.key);done()}})})}
|
|
142
|
+
cache.add({buffer,status},cacheRef.key);done()}})})}// Note: as caching code above may throw in some cases, sending response
|
|
143
|
+
// before it completes will likely hide the error, making it difficult
|
|
144
|
+
// to debug. Thus, at least for now, lets send response after it.
|
|
145
|
+
res.send(html)}catch(error){next(error)}}}
|
|
143
146
|
//# sourceMappingURL=renderer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.js","names":["sanitizedConfig","omit","config","SCRIPT_LOCATIONS","BODY_OPEN","DEFAULT","HEAD_OPEN","getBuildInfo","context","url","path","resolve","JSON","parse","fs","readFileSync","readChunkGroupsJson","buildDir","res","err","prepareCipher","key","Promise","reject","forge","random","getBytes","iv","cipher","createCipher","start","isBrotliAcceptable","req","acceptable","get","ops","split","i","length","type","priority","trim","parseFloat","groupExtraScripts","scripts","script","isString","code","location","undefined","Error","newDefaultLogger","defaultLogLevel","format","transports","winston","createLogger","level","combine","splat","timestamp","colorize","printf","message","stack","rest","Object","keys","stringify","Console","factory","webpackConfig","options","defaults","clone","beforeRender","maxSsrRounds","ssrTimeout","staticCacheSize","logger","defaultLoggerLogLevel","buildInfo","global","TRU_BUILD_INFO","publicPath","outputPath","output","manifestLink","existsSync","cache","staticCacheController","Cache","CHUNK_GROUPS","next","set","cacheRef","data","buffer","status","noCsp","send","done","failed","brotliDecompress","error","html","h","toString","regex","RegExp","nonce","replace","configToInject","extraScripts","initialState","all","helmet","App","Application","ssrContext","state","cloneDeep","chunks","stream","ssrStart","Date","now","renderPass","pipeableStream","renderToPipeableStream","onAllReady","onError","ssrRound","bailed","dirty","timeout","race","allSettled","pending","timer","then","logMsg","log","pipe","Writable","write","chunk","_","Helmet","renderStatic","chunkGroups","webpackStats","locals","mapValues","toJson","namedChunkGroups","item","assets","map","name","dr_pogodin_react_utils___split_components","payload","serializeJs","CONFIG","ISTATE","ignoreFunction","unsafe","update","util","createBuffer","finish","INJ","encode64","chunkSet","Set","forEach","asset","add","styleChunkString","scriptChunkString","endsWith","grouppedExtraScripts","faviconLink","favicon","title","meta","brotliCompress"],"sources":["../../../src/server/renderer.jsx"],"sourcesContent":["/**\n * ExpressJS middleware for server-side rendering of a ReactJS app.\n */\n\nimport { Writable } from 'stream';\n\nimport { GlobalStateProvider } from '@dr.pogodin/react-global-state';\n\nimport {\n clone,\n cloneDeep,\n defaults,\n isString,\n get,\n mapValues,\n omit,\n} from 'lodash';\n\nimport config from 'config';\nimport forge from 'node-forge';\nimport fs from 'fs';\nimport path from 'path';\nimport { brotliCompress, brotliDecompress } from 'zlib';\n\nimport { renderToPipeableStream } from 'react-dom/server';\nimport { Helmet } from 'react-helmet';\nimport { StaticRouter } from 'react-router-dom/server';\nimport serializeJs from 'serialize-javascript';\nimport { timer } from 'utils/time';\nimport winston from 'winston';\n\nimport Cache from './Cache';\n\nconst sanitizedConfig = omit(config, 'SECRET');\n\nexport const SCRIPT_LOCATIONS = {\n BODY_OPEN: 'BODY_OPEN',\n DEFAULT: 'DEFAULT',\n HEAD_OPEN: 'HEAD_OPEN',\n};\n\n/**\n * Reads build-time information about the app. This information is generated\n * by our standard Webpack config for apps, and it is written into\n * \".build-info\" file in the context folder specified in Webpack config.\n * At the moment, that file contains build timestamp and a random 32-bit key,\n * suitable for cryptographical use.\n * @ignore\n * @param {String} context Webpack context path used during the build.\n * @return {Object} Resolves to the build-time information.\n */\nfunction getBuildInfo(context) {\n const url = path.resolve(context, '.build-info');\n return JSON.parse(fs.readFileSync(url));\n}\n\n/**\n * Attempts to read from disk the named chunk groups mapping generated\n * by Webpack during the compilation.\n * It will not work for development builds, where these stats should be captured\n * via compilator callback.\n * @ignore\n * @param {string} buildDir\n * @return {object}\n */\nfunction readChunkGroupsJson(buildDir) {\n const url = path.resolve(buildDir, '__chunk_groups__.json');\n let res;\n try {\n res = JSON.parse(fs.readFileSync(url));\n } catch (err) {\n res = null;\n }\n return res;\n}\n\n/**\n * Prepares a new Cipher for data encryption.\n * @ignore\n * @param {String} key Encryption key (32-bit random key is expected, see\n * node-forge documentation, in case of doubts).\n * @return {Promise} Resolves to the object with two fields:\n * 1. cipher - a new Cipher, ready for encryption;\n * 2. iv - initial vector used by the cipher.\n */\nfunction prepareCipher(key) {\n return new Promise((resolve, reject) => {\n forge.random.getBytes(32, (err, iv) => {\n if (err) reject(err);\n else {\n const cipher = forge.cipher.createCipher('AES-CBC', key);\n cipher.start({ iv });\n resolve({ cipher, iv });\n }\n });\n });\n}\n\n/**\n * Given an incoming HTTP requests, it deduces whether Brotli-encoded responses\n * are acceptable to the caller.\n * @param {object} req\n * @return {boolean}\n * @ignore\n */\nexport function isBrotliAcceptable(req) {\n const acceptable = req.get('accept-encoding');\n if (acceptable) {\n const ops = acceptable.split(',');\n for (let i = 0; i < ops.length; ++i) {\n const [type, priority] = ops[i].trim().split(';q=');\n if ((type === '*' || type === 'br')\n && (!priority || parseFloat(priority) > 0)) {\n return true;\n }\n }\n }\n return false;\n}\n\n/**\n * Given an array of extra script strings / objects, it returns an object with\n * arrays of scripts to inject in different HTML template locations. During\n * the script groupping it also filters out any empty scripts.\n * @param {({\n * code: string;\n * location: string;\n * }|string)[]} [scripts=[]]\n * @return {{\n * BODY_OPEN: string[];\n * DEFAULT: string[];\n * HEAD_OPEN: string[];\n * }}\n */\nfunction groupExtraScripts(scripts = []) {\n const res = {\n [SCRIPT_LOCATIONS.BODY_OPEN]: '',\n [SCRIPT_LOCATIONS.DEFAULT]: '',\n [SCRIPT_LOCATIONS.HEAD_OPEN]: '',\n };\n for (let i = 0; i < scripts.length; ++i) {\n const script = scripts[i];\n if (isString(script)) {\n if (script) res[SCRIPT_LOCATIONS.DEFAULT] += script;\n } else if (script.code) {\n if (res[script.location] !== undefined) {\n res[script.location] += script.code;\n } else throw Error(`Invalid location \"${script.location}\"`);\n }\n }\n return res;\n}\n\n/**\n * Creates a new default (Winston) logger.\n * @param {object} [options={}]\n * @param {string} [options.defaultLogLevel='info']\n * @return {object}\n */\nexport function newDefaultLogger({\n defaultLogLevel = 'info',\n} = {}) {\n const { format, transports } = winston;\n return winston.createLogger({\n level: defaultLogLevel,\n format: format.combine(\n format.splat(),\n format.timestamp(),\n format.colorize(),\n format.printf(\n ({\n level,\n message,\n timestamp,\n stack,\n ...rest\n }) => {\n let res = `${level}\\t(at ${timestamp}):\\t${message}`;\n if (Object.keys(rest).length) {\n res += `\\n${JSON.stringify(rest, null, 2)}`;\n }\n if (stack) res += `\\n${stack}`;\n return res;\n },\n ),\n ),\n transports: [new transports.Console()],\n });\n}\n\n/**\n * Creates the middleware.\n * @param {object} webpackConfig\n * @param {object} options Additional options:\n * @param {Component} [options.Application] The root ReactJS component of\n * the app to use for the server-side rendering. When not provided\n * the server-side rendering is disabled.\n * @param {object} [options.buildInfo] \"Build info\" object to use. If provided,\n * it will be used, instead of trying to load from the filesystem the one\n * generated by the Webpack build. It is intended for test environments,\n * where passing this stuff via file system is no bueno.\n * @param {boolean} [options.favicon] `true` will include favicon\n * link into the rendered HTML templates.\n * @param {boolean} [options.noCsp] `true` means that no\n * Content-Security-Policy (CSP) is used by server, thus the renderer\n * may cut a few corners.\n * @param {number} [options.maxSsrRounds=10] Maximum number of SSR rounds.\n * @param {number} [options.ssrTimeout=1000] SSR timeout in milliseconds,\n * defaults to 1 second.\n * @param {number} [options.staticCacheSize=1.e7] The maximum\n * static cache size in bytes. Defaults to ~10 MB.\n * @param {function} [options.staticCacheController] When given, it activates,\n * and controls the static caching of generated HTML markup. When this function\n * is provided, on each incoming request it is triggered with the request\n * passed in as the argument. To attempt to serve the response from the cache\n * it should return the object with the following fields:\n * - `key: string` – the cache key for the response;\n * - `maxage?: number` – the maximum age of cached result in ms.\n * If undefined - infinite age is assumed.\n * @return {function} Created middleware.\n */\nexport default function factory(webpackConfig, options) {\n const ops = defaults(clone(options), {\n beforeRender: () => Promise.resolve({}),\n maxSsrRounds: 10,\n ssrTimeout: 1000,\n staticCacheSize: 1.e7,\n });\n\n // Note: in normal use the default logger is created and set in the root\n // server function, and this initialization is for testing uses, where\n // renderer is imported directly.\n if (ops.logger === undefined) {\n ops.logger = newDefaultLogger({\n defaultLogLevel: ops.defaultLoggerLogLevel,\n });\n }\n\n const buildInfo = ops.buildInfo || getBuildInfo(webpackConfig.context);\n global.TRU_BUILD_INFO = buildInfo;\n\n // publicPath from webpack.output has a trailing slash at the end.\n const { publicPath, path: outputPath } = webpackConfig.output;\n\n const manifestLink = fs.existsSync(`${outputPath}/manifest.json`)\n ? `<link rel=\"manifest\" href=\"${publicPath}manifest.json\">` : '';\n\n const cache = ops.staticCacheController\n ? new Cache(ops.staticCacheSize) : null;\n\n const CHUNK_GROUPS = readChunkGroupsJson(outputPath);\n\n return async (req, res, next) => {\n try {\n // Ensures any caches always revalidate HTML markup before reuse.\n res.set('Cache-Control', 'no-cache');\n\n let cacheRef;\n if (cache) {\n cacheRef = ops.staticCacheController(req);\n if (cacheRef) {\n const data = cache.get(cacheRef);\n if (data !== null) {\n const { buffer, status } = data;\n if (ops.noCsp && isBrotliAcceptable(req)) {\n res.set('Content-Type', 'text/html');\n res.set('Content-Encoding', 'br');\n if (status !== 200) res.status(status);\n res.send(buffer);\n } else {\n await new Promise((done, failed) => {\n brotliDecompress(buffer, (error, html) => {\n if (error) failed(error);\n else {\n let h = html.toString();\n if (!ops.noCsp) {\n // TODO: Starting from Node v15 we'll be able to use string's\n // .replaceAll() method instead relying on reg. expression for\n // global matching.\n const regex = new RegExp(buffer.nonce, 'g');\n h = h.replace(regex, req.nonce);\n }\n if (status !== 200) res.status(status);\n res.send(h);\n done();\n }\n });\n });\n }\n return;\n }\n }\n }\n\n const [{\n configToInject,\n extraScripts,\n initialState,\n }, {\n cipher,\n iv,\n }] = await Promise.all([\n ops.beforeRender(req, sanitizedConfig),\n prepareCipher(buildInfo.key),\n ]);\n\n let helmet;\n\n /* Optional server-side rendering. */\n let App = ops.Application;\n const ssrContext = {\n req,\n state: cloneDeep(initialState || {}),\n\n // Array of chunk names encountered during the rendering.\n chunks: [],\n };\n let stream;\n if (App) {\n const ssrStart = Date.now();\n\n const renderPass = async () => {\n ssrContext.chunks = [];\n return new Promise((resolve, reject) => {\n const pipeableStream = renderToPipeableStream(\n <GlobalStateProvider\n initialState={ssrContext.state}\n ssrContext={ssrContext}\n >\n <StaticRouter location={req.url}>\n <App />\n </StaticRouter>\n </GlobalStateProvider>,\n {\n onAllReady: () => resolve(pipeableStream),\n onError: reject,\n },\n );\n });\n };\n\n let ssrRound = 0;\n let bailed = false;\n for (; ssrRound < ops.maxSsrRounds; ++ssrRound) {\n stream = await renderPass(); // eslint-disable-line no-await-in-loop\n\n if (!ssrContext.dirty) break;\n\n /* eslint-disable no-await-in-loop */\n const timeout = ops.ssrTimeout + ssrStart - Date.now();\n bailed = timeout <= 0 || !await Promise.race([\n Promise.allSettled(ssrContext.pending),\n timer(timeout).then(() => false),\n ]);\n if (bailed) break;\n /* eslint-enable no-await-in-loop */\n }\n\n let logMsg;\n if (ssrContext.dirty) {\n // NOTE: In the case of incomplete SSR one more round is necessary\n // to ensure the correct hydration when some pending promises have\n // resolved and placed their data into the initial global state.\n stream = await renderPass();\n\n logMsg = bailed ? `SSR timed out after ${ops.ssrTimeout} second(s)`\n : `SSR bailed out after ${ops.maxSsrRounds} round(s)`;\n } else logMsg = `SSR completed in ${ssrRound + 1} round(s)`;\n\n ops.logger.log(ssrContext.dirty ? 'warn' : 'info', logMsg);\n\n App = '';\n stream.pipe(new Writable({\n write: (chunk, _, done) => {\n App += chunk.toString();\n done();\n },\n }));\n\n /* This takes care about server-side rendering of page title and meta tags\n * (still demands injection into HTML template, which happens below). */\n helmet = Helmet.renderStatic();\n }\n\n let chunkGroups;\n const webpackStats = get(res.locals, 'webpack.devMiddleware.stats');\n if (webpackStats) {\n chunkGroups = mapValues(\n webpackStats.toJson({\n all: false,\n chunkGroups: true,\n }).namedChunkGroups,\n (item) => item.assets.map(({ name }) => name),\n );\n } else if (CHUNK_GROUPS) chunkGroups = CHUNK_GROUPS;\n else chunkGroups = {};\n\n /* Encrypts data to be injected into HTML.\n * Keep in mind, that this encryption is no way secure: as the JS bundle\n * contains decryption key and is able to decode it at the client side.\n * Hovewer, for a number of reasons, encryption of injected data is still\n * better than injection of a plain text. */\n delete ssrContext.state.dr_pogodin_react_utils___split_components;\n\n const payload = serializeJs({\n CHUNK_GROUPS: chunkGroups,\n CONFIG: configToInject || sanitizedConfig,\n ISTATE: ssrContext.state,\n }, {\n ignoreFunction: true,\n unsafe: true,\n });\n cipher.update(forge.util.createBuffer(payload, 'utf8'));\n cipher.finish();\n const INJ = forge.util.encode64(`${iv}${cipher.output.data}`);\n\n const chunkSet = new Set();\n\n // TODO: \"main\" chunk has to be added explicitly,\n // because unlike all other chunks they are not managed by <CodeSplit>\n // component, thus they are not added to the ssrContext.chunks\n // automatically. Actually, names of these entry chunks should be\n // read from Wepback config, as the end user may customize them,\n // remove or add other entry points, but it requires additional\n // efforts to figure out how to automatically order them right,\n // thus for now this handles the default config.\n [\n 'main',\n ...ssrContext.chunks,\n ].forEach((chunk) => {\n const assets = chunkGroups[chunk];\n if (assets) assets.forEach((asset) => chunkSet.add(asset));\n });\n\n let styleChunkString = '';\n let scriptChunkString = '';\n chunkSet.forEach((chunk) => {\n if (chunk.endsWith('.css')) {\n styleChunkString += `<link href=\"${publicPath}${chunk}\" rel=\"stylesheet\">`;\n } else if (\n chunk.endsWith('.js')\n // In dev mode HMR adds JS updates into asset arrays,\n // and they (updates) should be ignored.\n && !chunk.endsWith('.hot-update.js')\n ) {\n scriptChunkString += `<script src=\"${publicPath}${chunk}\" type=\"application/javascript\"></script>`;\n }\n });\n\n const grouppedExtraScripts = groupExtraScripts(extraScripts);\n\n const faviconLink = ops.favicon ? (\n '<link rel=\"shortcut icon\" href=\"/favicon.ico\">'\n ) : '';\n\n const html = `<!DOCTYPE html>\n <html lang=\"en\">\n <head>\n ${grouppedExtraScripts[SCRIPT_LOCATIONS.HEAD_OPEN]}\n ${helmet ? helmet.title.toString() : ''}\n ${helmet ? helmet.meta.toString() : ''}\n <meta name=\"theme-color\" content=\"#FFFFFF\">\n ${manifestLink}\n ${styleChunkString}\n ${faviconLink}\n <meta charset=\"utf-8\">\n <meta\n content=\"width=device-width,initial-scale=1.0\"\n name=\"viewport\"\n >\n </head>\n <body>\n ${grouppedExtraScripts[SCRIPT_LOCATIONS.BODY_OPEN]}\n <div id=\"react-view\">${App || ''}</div>\n <script\n id=\"inj\"\n type=\"application/javascript\"\n ${ops.noCsp ? '' : `nonce=\"${req.nonce}\"`}\n >\n window.INJ=\"${INJ}\"\n </script>\n ${scriptChunkString}\n ${grouppedExtraScripts[SCRIPT_LOCATIONS.DEFAULT]}\n </body>\n </html>`;\n\n const status = ssrContext.status || 200;\n if (status !== 200) res.status(status);\n res.send(html);\n\n if (cacheRef && status < 500) {\n // Note: waiting for the caching to complete is not strictly necessary,\n // but it greately simplifies testing, and error reporting.\n await new Promise((done, failed) => {\n brotliCompress(html, (error, buffer) => {\n if (error) failed(error);\n else {\n buffer.nonce = req.nonce; // eslint-disable-line no-param-reassign\n cache.add({ buffer, status }, cacheRef.key);\n done();\n }\n });\n });\n }\n } catch (error) {\n next(error);\n }\n };\n}\n"],"mappings":"ySAIA,8BAEA,gEAEA,8BAUA,sDACA,6DACA,8CACA,kDACA,0BAEA,wCACA,yCACA,gDACA,iFACA,0CACA,wDAEA,sD,6CA/BA;AACA;AACA,GA+BA,KAAMA,gBAAe,CAAG,GAAAC,YAAA,EAAKC,eAAL,CAAa,QAAb,CAAxB,CAEO,KAAMC,iBAAgB,CAAG,CAC9BC,SAAS,CAAE,WADmB,CAE9BC,OAAO,CAAE,SAFqB,CAG9BC,SAAS,CAAE,WAHmB,CAAzB,CAMP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G,0CACA,QAASC,aAAT,CAAsBC,OAAtB,CAA+B,CAC7B,KAAMC,IAAG,CAAGC,aAAA,CAAKC,OAAL,CAAaH,OAAb,CAAsB,aAAtB,CAAZ,CACA,MAAOI,KAAI,CAACC,KAAL,CAAWC,WAAA,CAAGC,YAAH,CAAgBN,GAAhB,CAAX,CACR,CAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,QAASO,oBAAT,CAA6BC,QAA7B,CAAuC,CACrC,KAAMR,IAAG,CAAGC,aAAA,CAAKC,OAAL,CAAaM,QAAb,CAAuB,uBAAvB,CAAZ,CACA,GAAIC,IAAJ,CAC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MAAR,GAAmB,CACtC,GAAIO,KAAJ,CAAWF,MAAM,CAACE,KAAD,CAAN,CAAX,IACK,CACHP,MAAM,CAACa,KAAP,CAAe9E,GAAG,CAAC8E,KAAnB,CAA0B;AAC1BrB,KAAK,CAACwF,GAAN,CAAU,CAAEhF,MAAF,CAAUC,MAAV,CAAV,CAA8BH,QAAQ,CAAC1E,GAAvC,EACAgF,IAAI,EACL,CACF,CAPD,CAQD,CATK,CAUP,CACF,CAAC,MAAOG,KAAP,CAAc,CACdX,IAAI,CAACW,KAAD,CACL,CACF,CACF"}
|
|
1
|
+
{"version":3,"file":"renderer.js","names":["sanitizedConfig","omit","config","SCRIPT_LOCATIONS","BODY_OPEN","DEFAULT","HEAD_OPEN","getBuildInfo","context","url","path","resolve","JSON","parse","fs","readFileSync","readChunkGroupsJson","buildDir","res","err","prepareCipher","key","Promise","reject","forge","random","getBytes","iv","cipher","createCipher","start","isBrotliAcceptable","req","acceptable","get","ops","split","i","length","type","priority","trim","parseFloat","groupExtraScripts","scripts","script","isString","code","location","undefined","Error","newDefaultLogger","defaultLogLevel","format","transports","winston","createLogger","level","combine","splat","timestamp","colorize","printf","message","stack","rest","Object","keys","stringify","Console","factory","webpackConfig","options","defaults","clone","beforeRender","maxSsrRounds","ssrTimeout","staticCacheSize","logger","defaultLoggerLogLevel","buildInfo","global","TRU_BUILD_INFO","publicPath","outputPath","output","manifestLink","existsSync","cache","staticCacheController","Cache","CHUNK_GROUPS","next","set","cacheRef","data","buffer","status","noCsp","send","done","failed","brotliDecompress","error","html","h","toString","regex","RegExp","nonce","replace","configToInject","extraScripts","initialState","all","helmet","App","Application","ssrContext","state","cloneDeep","chunks","stream","ssrStart","Date","now","renderPass","pipeableStream","renderToPipeableStream","onAllReady","onError","ssrRound","bailed","dirty","timeout","race","allSettled","pending","timer","then","logMsg","log","pipe","Writable","write","chunk","_","Helmet","renderStatic","chunkGroups","webpackStats","locals","mapValues","toJson","namedChunkGroups","item","assets","map","name","dr_pogodin_react_utils___split_components","payload","serializeJs","CONFIG","ISTATE","ignoreFunction","unsafe","update","util","createBuffer","finish","INJ","encode64","chunkSet","Set","forEach","asset","add","styleChunkString","scriptChunkString","endsWith","grouppedExtraScripts","faviconLink","favicon","title","meta","brotliCompress"],"sources":["../../../src/server/renderer.jsx"],"sourcesContent":["/**\n * ExpressJS middleware for server-side rendering of a ReactJS app.\n */\n\nimport { Writable } from 'stream';\n\nimport { GlobalStateProvider } from '@dr.pogodin/react-global-state';\n\nimport {\n clone,\n cloneDeep,\n defaults,\n isString,\n get,\n mapValues,\n omit,\n} from 'lodash';\n\nimport config from 'config';\nimport forge from 'node-forge';\nimport fs from 'fs';\nimport path from 'path';\nimport { brotliCompress, brotliDecompress } from 'zlib';\n\nimport { renderToPipeableStream } from 'react-dom/server';\nimport { Helmet } from 'react-helmet';\nimport { StaticRouter } from 'react-router-dom/server';\nimport serializeJs from 'serialize-javascript';\nimport { timer } from 'utils/time';\nimport winston from 'winston';\n\nimport Cache from './Cache';\n\nconst sanitizedConfig = omit(config, 'SECRET');\n\nexport const SCRIPT_LOCATIONS = {\n BODY_OPEN: 'BODY_OPEN',\n DEFAULT: 'DEFAULT',\n HEAD_OPEN: 'HEAD_OPEN',\n};\n\n/**\n * Reads build-time information about the app. This information is generated\n * by our standard Webpack config for apps, and it is written into\n * \".build-info\" file in the context folder specified in Webpack config.\n * At the moment, that file contains build timestamp and a random 32-bit key,\n * suitable for cryptographical use.\n * @ignore\n * @param {String} context Webpack context path used during the build.\n * @return {Object} Resolves to the build-time information.\n */\nfunction getBuildInfo(context) {\n const url = path.resolve(context, '.build-info');\n return JSON.parse(fs.readFileSync(url));\n}\n\n/**\n * Attempts to read from disk the named chunk groups mapping generated\n * by Webpack during the compilation.\n * It will not work for development builds, where these stats should be captured\n * via compilator callback.\n * @ignore\n * @param {string} buildDir\n * @return {object}\n */\nfunction readChunkGroupsJson(buildDir) {\n const url = path.resolve(buildDir, '__chunk_groups__.json');\n let res;\n try {\n res = JSON.parse(fs.readFileSync(url));\n } catch (err) {\n res = null;\n }\n return res;\n}\n\n/**\n * Prepares a new Cipher for data encryption.\n * @ignore\n * @param {String} key Encryption key (32-bit random key is expected, see\n * node-forge documentation, in case of doubts).\n * @return {Promise} Resolves to the object with two fields:\n * 1. cipher - a new Cipher, ready for encryption;\n * 2. iv - initial vector used by the cipher.\n */\nfunction prepareCipher(key) {\n return new Promise((resolve, reject) => {\n forge.random.getBytes(32, (err, iv) => {\n if (err) reject(err);\n else {\n const cipher = forge.cipher.createCipher('AES-CBC', key);\n cipher.start({ iv });\n resolve({ cipher, iv });\n }\n });\n });\n}\n\n/**\n * Given an incoming HTTP requests, it deduces whether Brotli-encoded responses\n * are acceptable to the caller.\n * @param {object} req\n * @return {boolean}\n * @ignore\n */\nexport function isBrotliAcceptable(req) {\n const acceptable = req.get('accept-encoding');\n if (acceptable) {\n const ops = acceptable.split(',');\n for (let i = 0; i < ops.length; ++i) {\n const [type, priority] = ops[i].trim().split(';q=');\n if ((type === '*' || type === 'br')\n && (!priority || parseFloat(priority) > 0)) {\n return true;\n }\n }\n }\n return false;\n}\n\n/**\n * Given an array of extra script strings / objects, it returns an object with\n * arrays of scripts to inject in different HTML template locations. During\n * the script groupping it also filters out any empty scripts.\n * @param {({\n * code: string;\n * location: string;\n * }|string)[]} [scripts=[]]\n * @return {{\n * BODY_OPEN: string[];\n * DEFAULT: string[];\n * HEAD_OPEN: string[];\n * }}\n */\nfunction groupExtraScripts(scripts = []) {\n const res = {\n [SCRIPT_LOCATIONS.BODY_OPEN]: '',\n [SCRIPT_LOCATIONS.DEFAULT]: '',\n [SCRIPT_LOCATIONS.HEAD_OPEN]: '',\n };\n for (let i = 0; i < scripts.length; ++i) {\n const script = scripts[i];\n if (isString(script)) {\n if (script) res[SCRIPT_LOCATIONS.DEFAULT] += script;\n } else if (script.code) {\n if (res[script.location] !== undefined) {\n res[script.location] += script.code;\n } else throw Error(`Invalid location \"${script.location}\"`);\n }\n }\n return res;\n}\n\n/**\n * Creates a new default (Winston) logger.\n * @param {object} [options={}]\n * @param {string} [options.defaultLogLevel='info']\n * @return {object}\n */\nexport function newDefaultLogger({\n defaultLogLevel = 'info',\n} = {}) {\n const { format, transports } = winston;\n return winston.createLogger({\n level: defaultLogLevel,\n format: format.combine(\n format.splat(),\n format.timestamp(),\n format.colorize(),\n format.printf(\n ({\n level,\n message,\n timestamp,\n stack,\n ...rest\n }) => {\n let res = `${level}\\t(at ${timestamp}):\\t${message}`;\n if (Object.keys(rest).length) {\n res += `\\n${JSON.stringify(rest, null, 2)}`;\n }\n if (stack) res += `\\n${stack}`;\n return res;\n },\n ),\n ),\n transports: [new transports.Console()],\n });\n}\n\n/**\n * Creates the middleware.\n * @param {object} webpackConfig\n * @param {object} options Additional options:\n * @param {Component} [options.Application] The root ReactJS component of\n * the app to use for the server-side rendering. When not provided\n * the server-side rendering is disabled.\n * @param {object} [options.buildInfo] \"Build info\" object to use. If provided,\n * it will be used, instead of trying to load from the filesystem the one\n * generated by the Webpack build. It is intended for test environments,\n * where passing this stuff via file system is no bueno.\n * @param {boolean} [options.favicon] `true` will include favicon\n * link into the rendered HTML templates.\n * @param {boolean} [options.noCsp] `true` means that no\n * Content-Security-Policy (CSP) is used by server, thus the renderer\n * may cut a few corners.\n * @param {number} [options.maxSsrRounds=10] Maximum number of SSR rounds.\n * @param {number} [options.ssrTimeout=1000] SSR timeout in milliseconds,\n * defaults to 1 second.\n * @param {number} [options.staticCacheSize=1.e7] The maximum\n * static cache size in bytes. Defaults to ~10 MB.\n * @param {function} [options.staticCacheController] When given, it activates,\n * and controls the static caching of generated HTML markup. When this function\n * is provided, on each incoming request it is triggered with the request\n * passed in as the argument. To attempt to serve the response from the cache\n * it should return the object with the following fields:\n * - `key: string` – the cache key for the response;\n * - `maxage?: number` – the maximum age of cached result in ms.\n * If undefined - infinite age is assumed.\n * @return {function} Created middleware.\n */\nexport default function factory(webpackConfig, options) {\n const ops = defaults(clone(options), {\n beforeRender: () => Promise.resolve({}),\n maxSsrRounds: 10,\n ssrTimeout: 1000,\n staticCacheSize: 1.e7,\n });\n\n // Note: in normal use the default logger is created and set in the root\n // server function, and this initialization is for testing uses, where\n // renderer is imported directly.\n if (ops.logger === undefined) {\n ops.logger = newDefaultLogger({\n defaultLogLevel: ops.defaultLoggerLogLevel,\n });\n }\n\n const buildInfo = ops.buildInfo || getBuildInfo(webpackConfig.context);\n global.TRU_BUILD_INFO = buildInfo;\n\n // publicPath from webpack.output has a trailing slash at the end.\n const { publicPath, path: outputPath } = webpackConfig.output;\n\n const manifestLink = fs.existsSync(`${outputPath}/manifest.json`)\n ? `<link rel=\"manifest\" href=\"${publicPath}manifest.json\">` : '';\n\n const cache = ops.staticCacheController\n ? new Cache(ops.staticCacheSize) : null;\n\n const CHUNK_GROUPS = readChunkGroupsJson(outputPath);\n\n return async (req, res, next) => {\n try {\n // Ensures any caches always revalidate HTML markup before reuse.\n res.set('Cache-Control', 'no-cache');\n\n let cacheRef;\n if (cache) {\n cacheRef = ops.staticCacheController(req);\n if (cacheRef) {\n const data = cache.get(cacheRef);\n if (data !== null) {\n const { buffer, status } = data;\n if (ops.noCsp && isBrotliAcceptable(req)) {\n res.set('Content-Type', 'text/html');\n res.set('Content-Encoding', 'br');\n if (status !== 200) res.status(status);\n res.send(buffer);\n } else {\n await new Promise((done, failed) => {\n brotliDecompress(buffer, (error, html) => {\n if (error) failed(error);\n else {\n let h = html.toString();\n if (!ops.noCsp) {\n // TODO: Starting from Node v15 we'll be able to use string's\n // .replaceAll() method instead relying on reg. expression for\n // global matching.\n const regex = new RegExp(buffer.nonce, 'g');\n h = h.replace(regex, req.nonce);\n }\n if (status !== 200) res.status(status);\n res.send(h);\n done();\n }\n });\n });\n }\n return;\n }\n }\n }\n\n const [{\n configToInject,\n extraScripts,\n initialState,\n }, {\n cipher,\n iv,\n }] = await Promise.all([\n ops.beforeRender(req, sanitizedConfig),\n prepareCipher(buildInfo.key),\n ]);\n\n let helmet;\n\n /* Optional server-side rendering. */\n let App = ops.Application;\n const ssrContext = {\n req,\n state: cloneDeep(initialState || {}),\n\n // Array of chunk names encountered during the rendering.\n chunks: [],\n };\n let stream;\n if (App) {\n const ssrStart = Date.now();\n\n const renderPass = async () => {\n ssrContext.chunks = [];\n return new Promise((resolve, reject) => {\n const pipeableStream = renderToPipeableStream(\n <GlobalStateProvider\n initialState={ssrContext.state}\n ssrContext={ssrContext}\n >\n <StaticRouter location={req.url}>\n <App />\n </StaticRouter>\n </GlobalStateProvider>,\n {\n onAllReady: () => resolve(pipeableStream),\n onError: reject,\n },\n );\n });\n };\n\n let ssrRound = 0;\n let bailed = false;\n for (; ssrRound < ops.maxSsrRounds; ++ssrRound) {\n stream = await renderPass(); // eslint-disable-line no-await-in-loop\n\n if (!ssrContext.dirty) break;\n\n /* eslint-disable no-await-in-loop */\n const timeout = ops.ssrTimeout + ssrStart - Date.now();\n bailed = timeout <= 0 || !await Promise.race([\n Promise.allSettled(ssrContext.pending),\n timer(timeout).then(() => false),\n ]);\n if (bailed) break;\n /* eslint-enable no-await-in-loop */\n }\n\n let logMsg;\n if (ssrContext.dirty) {\n // NOTE: In the case of incomplete SSR one more round is necessary\n // to ensure the correct hydration when some pending promises have\n // resolved and placed their data into the initial global state.\n stream = await renderPass();\n\n logMsg = bailed ? `SSR timed out after ${ops.ssrTimeout} second(s)`\n : `SSR bailed out after ${ops.maxSsrRounds} round(s)`;\n } else logMsg = `SSR completed in ${ssrRound + 1} round(s)`;\n\n ops.logger.log(ssrContext.dirty ? 'warn' : 'info', logMsg);\n\n App = '';\n stream.pipe(new Writable({\n write: (chunk, _, done) => {\n App += chunk.toString();\n done();\n },\n }));\n\n /* This takes care about server-side rendering of page title and meta tags\n * (still demands injection into HTML template, which happens below). */\n helmet = Helmet.renderStatic();\n }\n\n let chunkGroups;\n const webpackStats = get(res.locals, 'webpack.devMiddleware.stats');\n if (webpackStats) {\n chunkGroups = mapValues(\n webpackStats.toJson({\n all: false,\n chunkGroups: true,\n }).namedChunkGroups,\n (item) => item.assets.map(({ name }) => name),\n );\n } else if (CHUNK_GROUPS) chunkGroups = CHUNK_GROUPS;\n else chunkGroups = {};\n\n /* Encrypts data to be injected into HTML.\n * Keep in mind, that this encryption is no way secure: as the JS bundle\n * contains decryption key and is able to decode it at the client side.\n * Hovewer, for a number of reasons, encryption of injected data is still\n * better than injection of a plain text. */\n delete ssrContext.state.dr_pogodin_react_utils___split_components;\n\n const payload = serializeJs({\n CHUNK_GROUPS: chunkGroups,\n CONFIG: configToInject || sanitizedConfig,\n ISTATE: ssrContext.state,\n }, {\n ignoreFunction: true,\n unsafe: true,\n });\n cipher.update(forge.util.createBuffer(payload, 'utf8'));\n cipher.finish();\n const INJ = forge.util.encode64(`${iv}${cipher.output.data}`);\n\n const chunkSet = new Set();\n\n // TODO: \"main\" chunk has to be added explicitly,\n // because unlike all other chunks they are not managed by <CodeSplit>\n // component, thus they are not added to the ssrContext.chunks\n // automatically. Actually, names of these entry chunks should be\n // read from Wepback config, as the end user may customize them,\n // remove or add other entry points, but it requires additional\n // efforts to figure out how to automatically order them right,\n // thus for now this handles the default config.\n [\n 'main',\n ...ssrContext.chunks,\n ].forEach((chunk) => {\n const assets = chunkGroups[chunk];\n if (assets) assets.forEach((asset) => chunkSet.add(asset));\n });\n\n let styleChunkString = '';\n let scriptChunkString = '';\n chunkSet.forEach((chunk) => {\n if (chunk.endsWith('.css')) {\n styleChunkString += `<link href=\"${publicPath}${chunk}\" rel=\"stylesheet\">`;\n } else if (\n chunk.endsWith('.js')\n // In dev mode HMR adds JS updates into asset arrays,\n // and they (updates) should be ignored.\n && !chunk.endsWith('.hot-update.js')\n ) {\n scriptChunkString += `<script src=\"${publicPath}${chunk}\" type=\"application/javascript\"></script>`;\n }\n });\n\n const grouppedExtraScripts = groupExtraScripts(extraScripts);\n\n const faviconLink = ops.favicon ? (\n '<link rel=\"shortcut icon\" href=\"/favicon.ico\">'\n ) : '';\n\n const html = `<!DOCTYPE html>\n <html lang=\"en\">\n <head>\n ${grouppedExtraScripts[SCRIPT_LOCATIONS.HEAD_OPEN]}\n ${helmet ? helmet.title.toString() : ''}\n ${helmet ? helmet.meta.toString() : ''}\n <meta name=\"theme-color\" content=\"#FFFFFF\">\n ${manifestLink}\n ${styleChunkString}\n ${faviconLink}\n <meta charset=\"utf-8\">\n <meta\n content=\"width=device-width,initial-scale=1.0\"\n name=\"viewport\"\n >\n </head>\n <body>\n ${grouppedExtraScripts[SCRIPT_LOCATIONS.BODY_OPEN]}\n <div id=\"react-view\">${App || ''}</div>\n <script\n id=\"inj\"\n type=\"application/javascript\"\n ${ops.noCsp ? '' : `nonce=\"${req.nonce}\"`}\n >\n window.INJ=\"${INJ}\"\n </script>\n ${scriptChunkString}\n ${grouppedExtraScripts[SCRIPT_LOCATIONS.DEFAULT]}\n </body>\n </html>`;\n\n const status = ssrContext.status || 200;\n if (status !== 200) res.status(status);\n\n if (cacheRef && status < 500) {\n // Note: waiting for the caching to complete is not strictly necessary,\n // but it greately simplifies testing, and error reporting.\n await new Promise((done, failed) => {\n brotliCompress(html, (error, buffer) => {\n if (error) failed(error);\n else {\n buffer.nonce = req.nonce; // eslint-disable-line no-param-reassign\n cache.add({ buffer, status }, cacheRef.key);\n done();\n }\n });\n });\n }\n\n // Note: as caching code above may throw in some cases, sending response\n // before it completes will likely hide the error, making it difficult\n // to debug. Thus, at least for now, lets send response after it.\n res.send(html);\n } catch (error) {\n next(error);\n }\n };\n}\n"],"mappings":"ySAIA,8BAEA,gEAEA,8BAUA,sDACA,6DACA,8CACA,kDACA,0BAEA,wCACA,yCACA,gDACA,iFACA,0CACA,wDAEA,sD,6CA/BA;AACA;AACA,GA+BA,KAAMA,gBAAe,CAAG,GAAAC,YAAA,EAAKC,eAAL,CAAa,QAAb,CAAxB,CAEO,KAAMC,iBAAgB,CAAG,CAC9BC,SAAS,CAAE,WADmB,CAE9BC,OAAO,CAAE,SAFqB,CAG9BC,SAAS,CAAE,WAHmB,CAAzB,CAMP;AACA;AACA;AACA;AACA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gBAAgB,CAACE,OAAlB,CAA2B;AAC7D;AACA,gBA7BM,CA+BA,KAAM6F,OAAM,CAAGqB,UAAU,CAACrB,MAAX,EAAqB,GAApC,CACA,GAAIA,MAAM,GAAK,GAAf,CAAoBhF,GAAG,CAACgF,MAAJ,CAAWA,MAAX,EAEpB,GAAIH,QAAQ,EAAIG,MAAM,CAAG,GAAzB,CAA8B,CAC5B;AACA;AACA,KAAM,IAAI5E,QAAJ,CAAY,CAAC+E,IAAD,CAAOC,MAAP,GAAkB,CAClC,GAAAoF,oBAAA,EAAejF,IAAf,CAAqB,CAACD,KAAD,CAAQP,MAAR,GAAmB,CACtC,GAAIO,KAAJ,CAAWF,MAAM,CAACE,KAAD,CAAN,CAAX,IACK,CACHP,MAAM,CAACa,KAAP,CAAe9E,GAAG,CAAC8E,KAAnB,CAA0B;AAC1BrB,KAAK,CAACwF,GAAN,CAAU,CAAEhF,MAAF,CAAUC,MAAV,CAAV,CAA8BH,QAAQ,CAAC1E,GAAvC,EACAgF,IAAI,EACL,CACF,CAPD,CAQD,CATK,CAUP,CAED;AACA;AACA;AACAnF,GAAG,CAACkF,IAAJ,CAASK,IAAT,CACD,CAAC,MAAOD,KAAP,CAAc,CACdX,IAAI,CAACW,KAAD,CACL,CACF,CACF"}
|
|
@@ -30,16 +30,26 @@ delete defaultCspSettings.directives["upgrade-insecure-requests"];/**
|
|
|
30
30
|
// compatibility. Should be removed sometime later.
|
|
31
31
|
req.cspNonce=req.nonce;// The deep clone is necessary here to ensure that default value can't be
|
|
32
32
|
// mutated during request processing.
|
|
33
|
-
let cspSettings=(0,_lodash.cloneDeep)(defaultCspSettings);cspSettings.directives["script-src"].push(`'nonce-${req.nonce}'`);if(options.cspSettingsHook){cspSettings=options.cspSettingsHook(cspSettings,req)}_helmet.default.contentSecurityPolicy(cspSettings)(req,res,next)})}if(options.favicon){server.use((0,_serveFavicon.default)(options.favicon))}server.use("/robots.txt",(req,res)=>res.send("User-agent: *\nDisallow:"));server.use(_express.default.json({limit:"300kb"}));server.use(_express.default.urlencoded({extended:false}));server.use((0,_cookieParser.default)());server.use(_requestIp.default.mw());_morgan.default.token("ip",req=>req.clientIp);const FORMAT=":ip > :status :method :url :response-time ms :res[content-length] :referrer :user-agent";server.use((0,_morgan.default)(FORMAT,{stream:{write:options.logger.info.bind(options.logger)}}))
|
|
33
|
+
let cspSettings=(0,_lodash.cloneDeep)(defaultCspSettings);cspSettings.directives["script-src"].push(`'nonce-${req.nonce}'`);if(options.cspSettingsHook){cspSettings=options.cspSettingsHook(cspSettings,req)}_helmet.default.contentSecurityPolicy(cspSettings)(req,res,next)})}if(options.favicon){server.use((0,_serveFavicon.default)(options.favicon))}server.use("/robots.txt",(req,res)=>res.send("User-agent: *\nDisallow:"));server.use(_express.default.json({limit:"300kb"}));server.use(_express.default.urlencoded({extended:false}));server.use((0,_cookieParser.default)());server.use(_requestIp.default.mw());_morgan.default.token("ip",req=>req.clientIp);const FORMAT=":ip > :status :method :url :response-time ms :res[content-length] :referrer :user-agent";server.use((0,_morgan.default)(FORMAT,{stream:{write:options.logger.info.bind(options.logger)}}));// Note: no matter the "public path", we want the service worker, if any,
|
|
34
|
+
// to be served from the root, to have all web app pages in its scope.
|
|
35
|
+
// Thus, this setup to serve it. Probably, need some more configuration
|
|
36
|
+
// for special cases, but this will do for now.
|
|
37
|
+
server.get("/__service-worker.js",_express.default.static(webpackConfig.output.path,{setHeaders:res=>res.set("Cache-Control","no-cache")}));/* Setup of Hot Module Reloading for development environment.
|
|
34
38
|
* These dependencies are not used, nor installed for production use,
|
|
35
39
|
* hence we should violate some import-related lint rules. */ /* eslint-disable global-require */ /* eslint-disable import/no-extraneous-dependencies */ /* eslint-disable import/no-unresolved */if(options.devMode){// This is a workaround for SASS bug:
|
|
36
40
|
// https://github.com/dart-lang/sdk/issues/27979
|
|
37
41
|
// which manifests itself sometimes when webpack dev middleware is used
|
|
38
42
|
// (in dev mode), and app modules are imported in some unfortunate ways.
|
|
39
|
-
if(!global.location){global.location={href:`${(0,_url.pathToFileURL)(process.cwd()).href}${_path.sep}`}}const webpack=require("webpack");const webpackDevMiddleware=require("webpack-dev-middleware");const webpackHotMiddleware=require("webpack-hot-middleware");const compiler=webpack(webpackConfig);server.use(webpackDevMiddleware(compiler,{publicPath,serverSideRender:true}));server.use(webpackHotMiddleware(compiler))}/* eslint-enable global-require */ /* eslint-enable import/no-extraneous-dependencies */ /* eslint-enable import/no-unresolved */server.use(publicPath,_express.default.static(webpackConfig.output.path));if(options.onExpressJsSetup){await options.onExpressJsSetup(server)}server.use(renderer);/* Detects 404 errors, and forwards them to the error handler. */server.use((req,res,next)=>{next((0,_errors.newError)(_errors.ERRORS.NOT_FOUND,_errors.CODES.NOT_FOUND))});let dontAttachDefaultErrorHandler;if(options.beforeExpressJsError){dontAttachDefaultErrorHandler=await options.beforeExpressJsError(server)}/* Error handler. */if(!dontAttachDefaultErrorHandler){// TODO:
|
|
43
|
+
if(!global.location){global.location={href:`${(0,_url.pathToFileURL)(process.cwd()).href}${_path.sep}`}}const webpack=require("webpack");const webpackDevMiddleware=require("webpack-dev-middleware");const webpackHotMiddleware=require("webpack-hot-middleware");const compiler=webpack(webpackConfig);server.use(webpackDevMiddleware(compiler,{publicPath,serverSideRender:true}));server.use(webpackHotMiddleware(compiler))}/* eslint-enable global-require */ /* eslint-enable import/no-extraneous-dependencies */ /* eslint-enable import/no-unresolved */server.use(publicPath,_express.default.static(webpackConfig.output.path));if(options.onExpressJsSetup){await options.onExpressJsSetup(server)}server.use(renderer);/* Detects 404 errors, and forwards them to the error handler. */server.use((req,res,next)=>{next((0,_errors.newError)(_errors.ERRORS.NOT_FOUND,_errors.CODES.NOT_FOUND))});let dontAttachDefaultErrorHandler;if(options.beforeExpressJsError){dontAttachDefaultErrorHandler=await options.beforeExpressJsError(server)}/* Error handler. */if(!dontAttachDefaultErrorHandler){// TODO: Do we need this error handler at all? It actually seems to do
|
|
44
|
+
// what the default ExpressJS error handler does anyway, see:
|
|
45
|
+
// https://expressjs.com/en/guide/error-handling.html
|
|
46
|
+
//
|
|
47
|
+
// TODO: It is better to move the default error handler definition
|
|
40
48
|
// to a stand-alone function at top-level, but the use of options.logger
|
|
41
49
|
// prevents to do it without some extra refactoring. Should be done sometime
|
|
42
50
|
// though.
|
|
43
|
-
|
|
44
|
-
|
|
51
|
+
server.use((error,req,res,next)=>{// TODO: This is needed to correctly handled any errors thrown after
|
|
52
|
+
// sending initial response to the client.
|
|
53
|
+
if(res.headersSent)return next(error);const status=error.status||_errors.CODES.INTERNAL_SERVER_ERROR;const serverSide=status>=_errors.CODES.INTERNAL_SERVER_ERROR;// Log server-side errors always, client-side at debug level only.
|
|
54
|
+
options.logger.log(serverSide?"error":"debug",error);let message=error.message||(0,_errors.getErrorForCode)(status);if(serverSide&&process.env.NODE_ENV==="production"){message=_errors.ERRORS.INTERNAL_SERVER_ERROR}res.status(status).send(message);return undefined})}return server}
|
|
45
55
|
//# sourceMappingURL=server.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","names":["defaultCspSettings","directives","mapValues","helmet","contentSecurityPolicy","getDefaultDirectives","array","filter","item","push","getDefaultCspSettings","cloneDeep","factory","webpackConfig","options","rendererOps","pick","renderer","rendererFactory","publicPath","output","server","express","beforeExpressJsSetup","logger","httpsRedirect","use","req","res","next","schema","headers","url","host","originalUrl","redirect","compression","crossOriginEmbedderPolicy","crossOriginOpenerPolicy","crossOriginResourcePolicy","noCsp","nonce","uuid","cspNonce","cspSettings","cspSettingsHook","favicon","send","json","limit","urlencoded","extended","cookieParser","requestIp","mw","loggerMiddleware","token","clientIp","FORMAT","stream","write","info","bind","header","devMode","global","location","href","pathToFileURL","process","cwd","sep","webpack","require","webpackDevMiddleware","webpackHotMiddleware","compiler","serverSideRender","static","path","onExpressJsSetup","newError","ERRORS","NOT_FOUND","CODES","dontAttachDefaultErrorHandler","beforeExpressJsError","error","status","INTERNAL_SERVER_ERROR","serverSide","log","message","getErrorForCode","env","NODE_ENV"],"sources":["../../../src/server/server.js"],"sourcesContent":["/**\n * Creation of standard ExpressJS server for ReactJS apps.\n */\n\nimport { sep } from 'path';\nimport { pathToFileURL } from 'url';\n\nimport {\n cloneDeep,\n mapValues,\n pick,\n} from 'lodash';\n\nimport compression from 'compression';\nimport cookieParser from 'cookie-parser';\nimport express from 'express';\nimport favicon from 'serve-favicon';\nimport helmet from 'helmet';\nimport loggerMiddleware from 'morgan';\nimport requestIp from 'request-ip';\nimport { v4 as uuid } from 'uuid';\n\nimport rendererFactory from './renderer';\n\nimport {\n CODES,\n ERRORS,\n getErrorForCode,\n newError,\n} from './utils/errors';\n\n/**\n * Default Content Security Policy settings.\n * @ignore\n */\nconst defaultCspSettings = {\n directives: mapValues(\n helmet.contentSecurityPolicy.getDefaultDirectives(),\n\n // 'https:' options (automatic re-write of insecure URLs to secure ones)\n // is removed to facilitate local development with HTTP server. In cloud\n // deployments we assume Apache or Nginx server in front of out app takes\n // care about such re-writes.\n (array) => array.filter((item) => item !== 'https:'),\n ),\n};\ndefaultCspSettings.directives['frame-src'] = [\n \"'self'\",\n\n // YouTube domain is whitelisted to allow <YouTubeVideo> component to work\n // out of box.\n 'https://*.youtube.com',\n];\ndefaultCspSettings.directives['script-src'].push(\"'unsafe-eval'\");\n\n// No need for automatic re-writes via Content Security Policy settings:\n// the forefront Apache or Nginx server is supposed to take care of this\n// in production cloud deployments.\ndelete defaultCspSettings.directives['upgrade-insecure-requests'];\n\n/**\n * @category Utilities\n * @func server/getDefaultCspSettings\n * @global\n * @desc\n * ```js\n * import { server } from '@dr.pogodin/react-utils';\n * const { getDefaultCspSettings } from '@dr.pogodin/react-utils';\n * ```\n * @return {{\n * directives: object\n * }} A deep copy of default CSP settings object used by `react-utils`,\n * with the exception of `nonce-xxx` clause in `script-src` directive,\n * which is added dynamically for each request.\n */\nexport function getDefaultCspSettings() {\n return cloneDeep(defaultCspSettings);\n}\n\nexport default async function factory(webpackConfig, options) {\n const rendererOps = pick(options, [\n 'Application',\n 'beforeRender',\n 'favicon',\n 'logger',\n 'maxSsrRounds',\n 'noCsp',\n 'ssrTimeout',\n 'staticCacheController',\n 'staticCacheSize',\n ]);\n const renderer = rendererFactory(webpackConfig, rendererOps);\n const { publicPath } = webpackConfig.output;\n\n const server = express();\n\n if (options.beforeExpressJsSetup) {\n await options.beforeExpressJsSetup(server);\n }\n\n server.logger = options.logger;\n\n if (options.httpsRedirect) {\n server.use((req, res, next) => {\n const schema = req.headers['x-forwarded-proto'];\n if (schema === 'http') {\n let url = `https://${req.headers.host}`;\n if (req.originalUrl !== '/') url += req.originalUrl;\n return res.redirect(url);\n }\n return next();\n });\n }\n\n server.use(compression());\n server.use(\n helmet({\n contentSecurityPolicy: false,\n crossOriginEmbedderPolicy: false,\n crossOriginOpenerPolicy: false,\n crossOriginResourcePolicy: false,\n }),\n );\n\n if (!options.noCsp) {\n server.use((req, res, next) => {\n req.nonce = uuid();\n\n // TODO: This is deprecated, but it is kept for now for backward\n // compatibility. Should be removed sometime later.\n req.cspNonce = req.nonce;\n\n // The deep clone is necessary here to ensure that default value can't be\n // mutated during request processing.\n let cspSettings = cloneDeep(defaultCspSettings);\n cspSettings.directives['script-src'].push(`'nonce-${req.nonce}'`);\n if (options.cspSettingsHook) {\n cspSettings = options.cspSettingsHook(cspSettings, req);\n }\n helmet.contentSecurityPolicy(cspSettings)(req, res, next);\n });\n }\n\n if (options.favicon) {\n server.use(favicon(options.favicon));\n }\n\n server.use('/robots.txt', (req, res) => res.send('User-agent: *\\nDisallow:'));\n\n server.use(express.json({ limit: '300kb' }));\n server.use(express.urlencoded({ extended: false }));\n server.use(cookieParser());\n server.use(requestIp.mw());\n\n loggerMiddleware.token('ip', (req) => req.clientIp);\n const FORMAT = ':ip > :status :method :url :response-time ms :res[content-length] :referrer :user-agent';\n server.use(loggerMiddleware(FORMAT, {\n stream: {\n write: options.logger.info.bind(options.logger),\n },\n }));\n\n /* Ensures no caching for the service worker script. */\n server.use(`${publicPath}service-worker.js`, (req, res, next) => {\n res.header('Cache-Control', 'no-cache');\n next();\n });\n\n /* Setup of Hot Module Reloading for development environment.\n * These dependencies are not used, nor installed for production use,\n * hence we should violate some import-related lint rules. */\n /* eslint-disable global-require */\n /* eslint-disable import/no-extraneous-dependencies */\n /* eslint-disable import/no-unresolved */\n if (options.devMode) {\n // This is a workaround for SASS bug:\n // https://github.com/dart-lang/sdk/issues/27979\n // which manifests itself sometimes when webpack dev middleware is used\n // (in dev mode), and app modules are imported in some unfortunate ways.\n if (!global.location) {\n global.location = {\n href: `${pathToFileURL(process.cwd()).href}${sep}`,\n };\n }\n\n const webpack = require('webpack');\n const webpackDevMiddleware = require('webpack-dev-middleware');\n const webpackHotMiddleware = require('webpack-hot-middleware');\n const compiler = webpack(webpackConfig);\n server.use(webpackDevMiddleware(compiler, {\n publicPath,\n serverSideRender: true,\n }));\n server.use(webpackHotMiddleware(compiler));\n }\n /* eslint-enable global-require */\n /* eslint-enable import/no-extraneous-dependencies */\n /* eslint-enable import/no-unresolved */\n\n server.use(publicPath, express.static(webpackConfig.output.path));\n\n if (options.onExpressJsSetup) {\n await options.onExpressJsSetup(server);\n }\n server.use(renderer);\n\n /* Detects 404 errors, and forwards them to the error handler. */\n server.use((req, res, next) => {\n next(newError(ERRORS.NOT_FOUND, CODES.NOT_FOUND));\n });\n\n let dontAttachDefaultErrorHandler;\n if (options.beforeExpressJsError) {\n dontAttachDefaultErrorHandler = await options.beforeExpressJsError(server);\n }\n\n /* Error handler. */\n if (!dontAttachDefaultErrorHandler) {\n // TODO: It is better to move the default error handler definition\n // to a stand-alone function at top-level, but the use of options.logger\n // prevents to do it without some extra refactoring. Should be done sometime\n // though.\n /* eslint-disable no-unused-vars */\n server.use((error, req, res, next) => {\n /* eslint-enable no-unused-vars */\n const status = error.status || CODES.INTERNAL_SERVER_ERROR;\n const serverSide = status >= CODES.INTERNAL_SERVER_ERROR;\n\n // Log server-side errors always, client-side at debug level only.\n options.logger.log(serverSide ? 'error' : 'debug', error);\n\n let message = error.message || getErrorForCode(status);\n if (serverSide && process.env.NODE_ENV === 'production') {\n message = ERRORS.INTERNAL_SERVER_ERROR;\n }\n\n res.status(status).send(message);\n });\n }\n\n return server;\n}\n"],"mappings":"qOAIA,0BACA,wBAEA,8BAMA,gEACA,mEACA,wDACA,mEACA,sDACA,sDACA,6DACA,0BAEA,4DAEA,sCAxBA;AACA;AACA,G,CA6BA;AACA;AACA;AACA,GACA,KAAMA,mBAAkB,CAAG,CACzBC,UAAU,CAAE,GAAAC,iBAAA,EACVC,eAAA,CAAOC,qBAAP,CAA6BC,oBAA7B,EADU,CAGV;AACA;AACA;AACA;AACCC,KAAD,EAAWA,KAAK,CAACC,MAAN,CAAcC,IAAD,EAAUA,IAAI,GAAK,QAAhC,CAPD,CADa,CAA3B,CAWAR,kBAAkB,CAACC,UAAnB,CAA8B,WAA9B,EAA6C,CAC3C,QAD2C,CAG3C;AACA;AACA,uBAL2C,CAA7C,CAOAD,kBAAkB,CAACC,UAAnB,CAA8B,YAA9B,EAA4CQ,IAA5C,CAAiD,eAAjD,EAEA;AACA;AACA;AACA,MAAOT,mBAAkB,CAACC,UAAnB,CAA8B,2BAA9B,CAAP,CAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACO,QAASS,sBAAT,EAAiC,CACtC,MAAO,GAAAC,iBAAA,EAAUX,kBAAV,CACR,CAEc,cAAeY,QAAf,CAAuBC,aAAvB,CAAsCC,OAAtC,CAA+C,CAC5D,KAAMC,YAAW,CAAG,GAAAC,YAAA,EAAKF,OAAL,CAAc,CAChC,aADgC,CAEhC,cAFgC,CAGhC,SAHgC,CAIhC,QAJgC,CAKhC,cALgC,CAMhC,OANgC,CAOhC,YAPgC,CAQhC,uBARgC,CAShC,iBATgC,CAAd,CAApB,CAWA,KAAMG,SAAQ,CAAG,GAAAC,iBAAA,EAAgBL,aAAhB,CAA+BE,WAA/B,CAAjB,CACA,KAAM,CAAEI,UAAF,EAAi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GAAN,CAAWC,IAAX,GAAoB,CAC7BA,IAAI,CAAC,GAAAoD,gBAAA,EAASC,cAAA,CAAOC,SAAhB,CAA2BC,aAAA,CAAMD,SAAjC,CAAD,CACL,CAFD,EAIA,GAAIE,8BAAJ,CACA,GAAIvE,OAAO,CAACwE,oBAAZ,CAAkC,CAChCD,6BAA6B,CAAG,KAAMvE,QAAO,CAACwE,oBAAR,CAA6BjE,MAA7B,CACvC,CAED,oBACA,GAAI,CAACgE,6BAAL,CAAoC,CAClC;AACA;AACA;AACA;AACA,mCACAhE,MAAM,CAACK,GAAP,CAAW,CAAC6D,KAAD,CAAQ5D,GAAR,CAAaC,GAAb,CAAkBC,IAAlB,GAA2B,CACtC,kCACE,KAAM2D,OAAM,CAAGD,KAAK,CAACC,MAAN,EAAgBJ,aAAA,CAAMK,qBAArC,CACA,KAAMC,WAAU,CAAGF,MAAM,EAAIJ,aAAA,CAAMK,qBAAnC,CAEA;AACA3E,OAAO,CAACU,MAAR,CAAemE,GAAf,CAAmBD,UAAU,CAAG,OAAH,CAAa,OAA1C,CAAmDH,KAAnD,EAEA,GAAIK,QAAO,CAAGL,KAAK,CAACK,OAAN,EAAiB,GAAAC,uBAAA,EAAgBL,MAAhB,CAA/B,CACA,GAAIE,UAAU,EAAIrB,OAAO,CAACyB,GAAR,CAAYC,QAAZ,GAAyB,YAA3C,CAAyD,CACvDH,OAAO,CAAGV,cAAA,CAAOO,qBAClB,CAED7D,GAAG,CAAC4D,MAAJ,CAAWA,MAAX,EAAmBzC,IAAnB,CAAwB6C,OAAxB,CACD,CAdD,CAeD,CAED,MAAOvE,OACR"}
|
|
1
|
+
{"version":3,"file":"server.js","names":["defaultCspSettings","directives","mapValues","helmet","contentSecurityPolicy","getDefaultDirectives","array","filter","item","push","getDefaultCspSettings","cloneDeep","factory","webpackConfig","options","rendererOps","pick","renderer","rendererFactory","publicPath","output","server","express","beforeExpressJsSetup","logger","httpsRedirect","use","req","res","next","schema","headers","url","host","originalUrl","redirect","compression","crossOriginEmbedderPolicy","crossOriginOpenerPolicy","crossOriginResourcePolicy","noCsp","nonce","uuid","cspNonce","cspSettings","cspSettingsHook","favicon","send","json","limit","urlencoded","extended","cookieParser","requestIp","mw","loggerMiddleware","token","clientIp","FORMAT","stream","write","info","bind","get","static","path","setHeaders","set","devMode","global","location","href","pathToFileURL","process","cwd","sep","webpack","require","webpackDevMiddleware","webpackHotMiddleware","compiler","serverSideRender","onExpressJsSetup","newError","ERRORS","NOT_FOUND","CODES","dontAttachDefaultErrorHandler","beforeExpressJsError","error","headersSent","status","INTERNAL_SERVER_ERROR","serverSide","log","message","getErrorForCode","env","NODE_ENV","undefined"],"sources":["../../../src/server/server.js"],"sourcesContent":["/**\n * Creation of standard ExpressJS server for ReactJS apps.\n */\n\nimport { sep } from 'path';\nimport { pathToFileURL } from 'url';\n\nimport {\n cloneDeep,\n mapValues,\n pick,\n} from 'lodash';\n\nimport compression from 'compression';\nimport cookieParser from 'cookie-parser';\nimport express from 'express';\nimport favicon from 'serve-favicon';\nimport helmet from 'helmet';\nimport loggerMiddleware from 'morgan';\nimport requestIp from 'request-ip';\nimport { v4 as uuid } from 'uuid';\n\nimport rendererFactory from './renderer';\n\nimport {\n CODES,\n ERRORS,\n getErrorForCode,\n newError,\n} from './utils/errors';\n\n/**\n * Default Content Security Policy settings.\n * @ignore\n */\nconst defaultCspSettings = {\n directives: mapValues(\n helmet.contentSecurityPolicy.getDefaultDirectives(),\n\n // 'https:' options (automatic re-write of insecure URLs to secure ones)\n // is removed to facilitate local development with HTTP server. In cloud\n // deployments we assume Apache or Nginx server in front of out app takes\n // care about such re-writes.\n (array) => array.filter((item) => item !== 'https:'),\n ),\n};\ndefaultCspSettings.directives['frame-src'] = [\n \"'self'\",\n\n // YouTube domain is whitelisted to allow <YouTubeVideo> component to work\n // out of box.\n 'https://*.youtube.com',\n];\ndefaultCspSettings.directives['script-src'].push(\"'unsafe-eval'\");\n\n// No need for automatic re-writes via Content Security Policy settings:\n// the forefront Apache or Nginx server is supposed to take care of this\n// in production cloud deployments.\ndelete defaultCspSettings.directives['upgrade-insecure-requests'];\n\n/**\n * @category Utilities\n * @func server/getDefaultCspSettings\n * @global\n * @desc\n * ```js\n * import { server } from '@dr.pogodin/react-utils';\n * const { getDefaultCspSettings } from '@dr.pogodin/react-utils';\n * ```\n * @return {{\n * directives: object\n * }} A deep copy of default CSP settings object used by `react-utils`,\n * with the exception of `nonce-xxx` clause in `script-src` directive,\n * which is added dynamically for each request.\n */\nexport function getDefaultCspSettings() {\n return cloneDeep(defaultCspSettings);\n}\n\nexport default async function factory(webpackConfig, options) {\n const rendererOps = pick(options, [\n 'Application',\n 'beforeRender',\n 'favicon',\n 'logger',\n 'maxSsrRounds',\n 'noCsp',\n 'ssrTimeout',\n 'staticCacheController',\n 'staticCacheSize',\n ]);\n const renderer = rendererFactory(webpackConfig, rendererOps);\n const { publicPath } = webpackConfig.output;\n\n const server = express();\n\n if (options.beforeExpressJsSetup) {\n await options.beforeExpressJsSetup(server);\n }\n\n server.logger = options.logger;\n\n if (options.httpsRedirect) {\n server.use((req, res, next) => {\n const schema = req.headers['x-forwarded-proto'];\n if (schema === 'http') {\n let url = `https://${req.headers.host}`;\n if (req.originalUrl !== '/') url += req.originalUrl;\n return res.redirect(url);\n }\n return next();\n });\n }\n\n server.use(compression());\n server.use(\n helmet({\n contentSecurityPolicy: false,\n crossOriginEmbedderPolicy: false,\n crossOriginOpenerPolicy: false,\n crossOriginResourcePolicy: false,\n }),\n );\n\n if (!options.noCsp) {\n server.use((req, res, next) => {\n req.nonce = uuid();\n\n // TODO: This is deprecated, but it is kept for now for backward\n // compatibility. Should be removed sometime later.\n req.cspNonce = req.nonce;\n\n // The deep clone is necessary here to ensure that default value can't be\n // mutated during request processing.\n let cspSettings = cloneDeep(defaultCspSettings);\n cspSettings.directives['script-src'].push(`'nonce-${req.nonce}'`);\n if (options.cspSettingsHook) {\n cspSettings = options.cspSettingsHook(cspSettings, req);\n }\n helmet.contentSecurityPolicy(cspSettings)(req, res, next);\n });\n }\n\n if (options.favicon) {\n server.use(favicon(options.favicon));\n }\n\n server.use('/robots.txt', (req, res) => res.send('User-agent: *\\nDisallow:'));\n\n server.use(express.json({ limit: '300kb' }));\n server.use(express.urlencoded({ extended: false }));\n server.use(cookieParser());\n server.use(requestIp.mw());\n\n loggerMiddleware.token('ip', (req) => req.clientIp);\n const FORMAT = ':ip > :status :method :url :response-time ms :res[content-length] :referrer :user-agent';\n server.use(loggerMiddleware(FORMAT, {\n stream: {\n write: options.logger.info.bind(options.logger),\n },\n }));\n\n // Note: no matter the \"public path\", we want the service worker, if any,\n // to be served from the root, to have all web app pages in its scope.\n // Thus, this setup to serve it. Probably, need some more configuration\n // for special cases, but this will do for now.\n server.get('/__service-worker.js', express.static(\n webpackConfig.output.path,\n {\n setHeaders: (res) => res.set('Cache-Control', 'no-cache'),\n },\n ));\n\n /* Setup of Hot Module Reloading for development environment.\n * These dependencies are not used, nor installed for production use,\n * hence we should violate some import-related lint rules. */\n /* eslint-disable global-require */\n /* eslint-disable import/no-extraneous-dependencies */\n /* eslint-disable import/no-unresolved */\n if (options.devMode) {\n // This is a workaround for SASS bug:\n // https://github.com/dart-lang/sdk/issues/27979\n // which manifests itself sometimes when webpack dev middleware is used\n // (in dev mode), and app modules are imported in some unfortunate ways.\n if (!global.location) {\n global.location = {\n href: `${pathToFileURL(process.cwd()).href}${sep}`,\n };\n }\n\n const webpack = require('webpack');\n const webpackDevMiddleware = require('webpack-dev-middleware');\n const webpackHotMiddleware = require('webpack-hot-middleware');\n const compiler = webpack(webpackConfig);\n server.use(webpackDevMiddleware(compiler, {\n publicPath,\n serverSideRender: true,\n }));\n server.use(webpackHotMiddleware(compiler));\n }\n /* eslint-enable global-require */\n /* eslint-enable import/no-extraneous-dependencies */\n /* eslint-enable import/no-unresolved */\n\n server.use(publicPath, express.static(webpackConfig.output.path));\n\n if (options.onExpressJsSetup) {\n await options.onExpressJsSetup(server);\n }\n server.use(renderer);\n\n /* Detects 404 errors, and forwards them to the error handler. */\n server.use((req, res, next) => {\n next(newError(ERRORS.NOT_FOUND, CODES.NOT_FOUND));\n });\n\n let dontAttachDefaultErrorHandler;\n if (options.beforeExpressJsError) {\n dontAttachDefaultErrorHandler = await options.beforeExpressJsError(server);\n }\n\n /* Error handler. */\n if (!dontAttachDefaultErrorHandler) {\n // TODO: Do we need this error handler at all? It actually seems to do\n // what the default ExpressJS error handler does anyway, see:\n // https://expressjs.com/en/guide/error-handling.html\n //\n // TODO: It is better to move the default error handler definition\n // to a stand-alone function at top-level, but the use of options.logger\n // prevents to do it without some extra refactoring. Should be done sometime\n // though.\n server.use((error, req, res, next) => {\n // TODO: This is needed to correctly handled any errors thrown after\n // sending initial response to the client.\n if (res.headersSent) return next(error);\n\n const status = error.status || CODES.INTERNAL_SERVER_ERROR;\n const serverSide = status >= CODES.INTERNAL_SERVER_ERROR;\n\n // Log server-side errors always, client-side at debug level only.\n options.logger.log(serverSide ? 'error' : 'debug', error);\n\n let message = error.message || getErrorForCode(status);\n if (serverSide && process.env.NODE_ENV === 'production') {\n message = ERRORS.INTERNAL_SERVER_ERROR;\n }\n\n res.status(status).send(message);\n return undefined;\n });\n }\n\n return server;\n}\n"],"mappings":"qOAIA,0BACA,wBAEA,8BAMA,gEACA,mEACA,wDACA,mEACA,sDACA,sDACA,6DACA,0BAEA,4DAEA,sCAxBA;AACA;AACA,G,CA6BA;AACA;AACA;AACA,GACA,KAAMA,mBAAkB,CAAG,CACzBC,UAAU,CAAE,GAAAC,iBAAA,EACVC,eAAA,CAAOC,qBAAP,CAA6BC,oBAA7B,EADU,CAGV;AACA;AACA;AACA;AACCC,KAAD,EAAWA,KAAK,CAACC,MAAN,CAAcC,IAAD,EAAUA,IAAI,GAAK,QAAhC,CAPD,CADa,CAA3B,CAWAR,kBAAkB,CAACC,UAAnB,CAA8B,WAA9B,EAA6C,CAC3C,QAD2C,CAG3C;AACA;AACA,uBAL2C,CAA7C,CAOAD,kBAAkB,CAACC,UA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CAAGF,KAAK,CAACE,MAAN,EAAgBL,aAAA,CAAMM,qBAArC,CACA,KAAMC,WAAU,CAAGF,MAAM,EAAIL,aAAA,CAAMM,qBAAnC,CAEA;AACA9E,OAAO,CAACU,MAAR,CAAesE,GAAf,CAAmBD,UAAU,CAAG,OAAH,CAAa,OAA1C,CAAmDJ,KAAnD,EAEA,GAAIM,QAAO,CAAGN,KAAK,CAACM,OAAN,EAAiB,GAAAC,uBAAA,EAAgBL,MAAhB,CAA/B,CACA,GAAIE,UAAU,EAAIpB,OAAO,CAACwB,GAAR,CAAYC,QAAZ,GAAyB,YAA3C,CAAyD,CACvDH,OAAO,CAAGX,cAAA,CAAOQ,qBAClB,CAEDhE,GAAG,CAAC+D,MAAJ,CAAWA,MAAX,EAAmB5C,IAAnB,CAAwBgD,OAAxB,EACA,MAAOI,UACR,CAlBD,CAmBD,CAED,MAAO9E,OACR"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! For license information please see web.bundle.js.LICENSE.txt */
|
|
2
|
-
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("@babel/runtime/helpers/assertThisInitialized"),require("@babel/runtime/helpers/asyncToGenerator"),require("@babel/runtime/helpers/classCallCheck"),require("@babel/runtime/helpers/classPrivateFieldGet"),require("@babel/runtime/helpers/classPrivateFieldSet"),require("@babel/runtime/helpers/createClass"),require("@babel/runtime/helpers/defineProperty"),require("@babel/runtime/helpers/get"),require("@babel/runtime/helpers/getPrototypeOf"),require("@babel/runtime/helpers/inherits"),require("@babel/runtime/helpers/objectWithoutProperties"),require("@babel/runtime/helpers/possibleConstructorReturn"),require("@babel/runtime/helpers/slicedToArray"),require("@babel/runtime/helpers/typeof"),require("@babel/runtime/helpers/wrapNativeSuper"),require("@babel/runtime/regenerator"),require("@dr.pogodin/react-global-state"),require("@dr.pogodin/react-themes"),require("axios"),require("dayjs"),require("lodash"),require("prop-types"),require("qs"),require("react"),require("react-dom"),require("react-dom/client"),require("react-helmet"),require("react-router-dom")):"function"==typeof define&&define.amd?define(["@babel/runtime/helpers/assertThisInitialized","@babel/runtime/helpers/asyncToGenerator","@babel/runtime/helpers/classCallCheck","@babel/runtime/helpers/classPrivateFieldGet","@babel/runtime/helpers/classPrivateFieldSet","@babel/runtime/helpers/createClass","@babel/runtime/helpers/defineProperty","@babel/runtime/helpers/get","@babel/runtime/helpers/getPrototypeOf","@babel/runtime/helpers/inherits","@babel/runtime/helpers/objectWithoutProperties","@babel/runtime/helpers/possibleConstructorReturn","@babel/runtime/helpers/slicedToArray","@babel/runtime/helpers/typeof","@babel/runtime/helpers/wrapNativeSuper","@babel/runtime/regenerator","@dr.pogodin/react-global-state","@dr.pogodin/react-themes","axios","dayjs","lodash","prop-types","qs","react","react-dom","react-dom/client","react-helmet","react-router-dom"],r):"object"==typeof exports?exports["@dr.pogodin/react-utils"]=r(require("@babel/runtime/helpers/assertThisInitialized"),require("@babel/runtime/helpers/asyncToGenerator"),require("@babel/runtime/helpers/classCallCheck"),require("@babel/runtime/helpers/classPrivateFieldGet"),require("@babel/runtime/helpers/classPrivateFieldSet"),require("@babel/runtime/helpers/createClass"),require("@babel/runtime/helpers/defineProperty"),require("@babel/runtime/helpers/get"),require("@babel/runtime/helpers/getPrototypeOf"),require("@babel/runtime/helpers/inherits"),require("@babel/runtime/helpers/objectWithoutProperties"),require("@babel/runtime/helpers/possibleConstructorReturn"),require("@babel/runtime/helpers/slicedToArray"),require("@babel/runtime/helpers/typeof"),require("@babel/runtime/helpers/wrapNativeSuper"),require("@babel/runtime/regenerator"),require("@dr.pogodin/react-global-state"),require("@dr.pogodin/react-themes"),require("axios"),require("dayjs"),require("lodash"),require("prop-types"),require("qs"),require("react"),require("react-dom"),require("react-dom/client"),require("react-helmet"),require("react-router-dom")):e["@dr.pogodin/react-utils"]=r(e["@babel/runtime/helpers/assertThisInitialized"],e["@babel/runtime/helpers/asyncToGenerator"],e["@babel/runtime/helpers/classCallCheck"],e["@babel/runtime/helpers/classPrivateFieldGet"],e["@babel/runtime/helpers/classPrivateFieldSet"],e["@babel/runtime/helpers/createClass"],e["@babel/runtime/helpers/defineProperty"],e["@babel/runtime/helpers/get"],e["@babel/runtime/helpers/getPrototypeOf"],e["@babel/runtime/helpers/inherits"],e["@babel/runtime/helpers/objectWithoutProperties"],e["@babel/runtime/helpers/possibleConstructorReturn"],e["@babel/runtime/helpers/slicedToArray"],e["@babel/runtime/helpers/typeof"],e["@babel/runtime/helpers/wrapNativeSuper"],e["@babel/runtime/regenerator"],e["@dr.pogodin/react-global-state"],e["@dr.pogodin/react-themes"],e.axios,e.dayjs,e.lodash,e["prop-types"],e.qs,e.react,e["react-dom"],e["react-dom/client"],e["react-helmet"],e["react-router-dom"])}("undefined"!=typeof self?self:this,(function(__WEBPACK_EXTERNAL_MODULE__383__,__WEBPACK_EXTERNAL_MODULE__314__,__WEBPACK_EXTERNAL_MODULE__162__,__WEBPACK_EXTERNAL_MODULE__226__,__WEBPACK_EXTERNAL_MODULE__556__,__WEBPACK_EXTERNAL_MODULE__111__,__WEBPACK_EXTERNAL_MODULE__311__,__WEBPACK_EXTERNAL_MODULE__615__,__WEBPACK_EXTERNAL_MODULE__365__,__WEBPACK_EXTERNAL_MODULE__346__,__WEBPACK_EXTERNAL_MODULE__189__,__WEBPACK_EXTERNAL_MODULE__205__,__WEBPACK_EXTERNAL_MODULE__673__,__WEBPACK_EXTERNAL_MODULE__541__,__WEBPACK_EXTERNAL_MODULE__446__,__WEBPACK_EXTERNAL_MODULE__395__,__WEBPACK_EXTERNAL_MODULE__899__,__WEBPACK_EXTERNAL_MODULE__198__,__WEBPACK_EXTERNAL_MODULE__300__,__WEBPACK_EXTERNAL_MODULE__760__,__WEBPACK_EXTERNAL_MODULE__467__,__WEBPACK_EXTERNAL_MODULE__99__,__WEBPACK_EXTERNAL_MODULE__656__,__WEBPACK_EXTERNAL_MODULE__156__,__WEBPACK_EXTERNAL_MODULE__386__,__WEBPACK_EXTERNAL_MODULE__715__,__WEBPACK_EXTERNAL_MODULE__684__,__WEBPACK_EXTERNAL_MODULE__128__){return function(){"use strict";var __webpack_modules__={450:function(e,r,t){t.r(r),t.d(r,{IS_CLIENT_SIDE:function(){return i},IS_SERVER_SIDE:function(){return o},buildTimestamp:function(){return u},getBuildInfo:function(){return _},isDevBuild:function(){return a},isProdBuild:function(){return c}});var n=t(541),i="object"!==("undefined"==typeof process?"undefined":t.n(n)()(process))||!process.versions||!process.versions.node||!!t.g.REACT_UTILS_FORCE_CLIENT_SIDE,o=!i;function a(){return!1}function c(){return!0}function _(){return(i?window:t.g).TRU_BUILD_INFO}function u(){return _().timestamp}},869:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{requireWeak:function(){return requireWeak},resolveWeak:function(){return resolveWeak}});var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(673),_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__),_babel_runtime_helpers_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(189),_babel_runtime_helpers_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(_babel_runtime_helpers_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_1__),_isomorphy__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(450),_excluded=["default"];function requireWeak(modulePath,basePath){if(_isomorphy__WEBPACK_IMPORTED_MODULE_2__.IS_CLIENT_SIDE)return null;try{var _eval=eval("require")("path"),resolve=_eval.resolve,path=basePath?resolve(basePath,modulePath):modulePath,_eval2=eval("require")(path),def=_eval2.default,named=_babel_runtime_helpers_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_1___default()(_eval2,_excluded);return def?(Object.entries(named).forEach((function(e){var r=_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default()(e,2),t=r[0],n=r[1];if(def[t])throw Error("Conflict between default and named exports");def[t]=n})),def):named}catch(e){return null}}function resolveWeak(e){return e}},251:function(e,r,t){var n=t(156),i=Symbol.for("react.element"),o=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,c=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,_={key:!0,ref:!0,__self:!0,__source:!0};function u(e,r,t){var n,o={},u=null,l=null;for(n in void 0!==t&&(u=""+t),void 0!==r.key&&(u=""+r.key),void 0!==r.ref&&(l=r.ref),r)a.call(r,n)&&!_.hasOwnProperty(n)&&(o[n]=r[n]);if(e&&e.defaultProps)for(n in r=e.defaultProps)void 0===o[n]&&(o[n]=r[n]);return{$$typeof:i,type:e,key:u,ref:l,props:o,_owner:c.current}}r.Fragment=o,r.jsx=u,r.jsxs=u},893:function(e,r,t){e.exports=t(251)},383:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__383__},314:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__314__},162:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__162__},226:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__226__},556:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__556__},111:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__111__},311:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__311__},615:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__615__},365:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__365__},346:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__346__},189:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__189__},205:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__205__},673:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__673__},541:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__541__},446:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__446__},395:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__395__},899:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__899__},198:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__198__},300:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__300__},760:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__760__},467:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__467__},99:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__99__},656:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__656__},156:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__156__},386:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__386__},715:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__715__},684:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__684__},128:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__128__}},__webpack_module_cache__={};function __webpack_require__(e){var r=__webpack_module_cache__[e];if(void 0!==r)return r.exports;var t=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](t,t.exports,__webpack_require__),t.exports}__webpack_require__.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return __webpack_require__.d(r,{a:r}),r},__webpack_require__.d=function(e,r){for(var t in r)__webpack_require__.o(r,t)&&!__webpack_require__.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},__webpack_require__.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};return function(){__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{Barrier:function(){return M},BaseModal:function(){return rr},Button:function(){return Le},Checkbox:function(){return xe},Dropdown:function(){return Be},Emitter:function(){return X},GlobalStateProvider:function(){return ie.GlobalStateProvider},Input:function(){return Ge},JU:function(){return fe},Link:function(){return Te},MetaTags:function(){return Qe},Modal:function(){return nr},NavLink:function(){return ar},PT:function(){return te},PageLayout:function(){return Fe},ScalableRect:function(){return cr},Semaphore:function(){return V},ThemeProvider:function(){return i.ThemeProvider},Throbber:function(){return ur},WithTooltip:function(){return Er},YouTubeVideo:function(){return Pr},api:function(){return ve()},client:function(){return Ne},config:function(){return c},getGlobalState:function(){return ie.getGlobalState},getSsrContext:function(){return ie.getSsrContext},isomorphy:function(){return _},newBarrier:function(){return S},server:function(){return gr},splitComponent:function(){return be},themed:function(){return o()},time:function(){return U},useAsyncCollection:function(){return ie.useAsyncCollection},useAsyncData:function(){return ie.useAsyncData},useGlobalState:function(){return ie.useGlobalState},webpack:function(){return a},withRetries:function(){return he}});var e=__webpack_require__(314),r=__webpack_require__.n(e),t=__webpack_require__(395),n=__webpack_require__.n(t),i=__webpack_require__(198),o=__webpack_require__.n(i),a=__webpack_require__(869),c=(0,a.requireWeak)("config")||window.CONFIG||{},_=__webpack_require__(450),u=__webpack_require__(760),l=__webpack_require__.n(u),s=__webpack_require__(162),p=__webpack_require__.n(s),d=__webpack_require__(111),b=__webpack_require__.n(d),f=__webpack_require__(383),h=__webpack_require__.n(f),E=__webpack_require__(615),m=__webpack_require__.n(E),v=__webpack_require__(346),w=__webpack_require__.n(v),y=__webpack_require__(205),O=__webpack_require__.n(y),P=__webpack_require__(365),g=__webpack_require__.n(P),k=__webpack_require__(446),T=__webpack_require__.n(k),A=__webpack_require__(226),C=__webpack_require__.n(A),L=__webpack_require__(556),j=__webpack_require__.n(L);function q(e,r,t){!function(e,r){if(r.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,r),r.set(e,t)}var x=new WeakMap,R=new WeakMap,N=new WeakMap,D=new WeakMap,M=function(e){w()(i,e);var r,t,n=(r=i,t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=g()(r);if(t){var i=g()(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return O()(this,e)});function i(e){var r,t,o;return p()(this,i),r=n.call(this,(function(n,i){t=function(e){n(e),j()(h()(r),R,!0)},o=function(e){i(e),j()(h()(r),D,!0)},e&&e(t,o)})),q(h()(r),x,{writable:!0,value:void 0}),q(h()(r),R,{writable:!0,value:!1}),q(h()(r),N,{writable:!0,value:void 0}),q(h()(r),D,{writable:!0,value:!1}),j()(h()(r),x,t),j()(h()(r),N,o),r}return b()(i,[{key:"resolve",get:function(){return C()(this,x)}},{key:"resolved",get:function(){return C()(this,R)}},{key:"reject",get:function(){return C()(this,N)}},{key:"rejected",get:function(){return C()(this,D)}},{key:"then",value:function(e,r){var t=m()(g()(i.prototype),"then",this).call(this,e,r);return j()(t,x,C()(this,x)),j()(t,N,C()(this,N)),t}}]),i}(T()(Promise));function S(e){return new M(e)}function B(e){return W.apply(this,arguments)}function W(){return(W=r()(n().mark((function e(r){var t,i;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=new M,i=setTimeout(t.resolve.bind(t),r),t.abort=function(){return clearTimeout(i)},e.abrupt("return",t);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}l().SEC_MS=1e3,l().MIN_MS=60*l().SEC_MS,l().HOUR_MS=60*l().MIN_MS,l().DAY_MS=24*l().HOUR_MS,l().YEAR_MS=365*l().DAY_MS,l().now=Date.now,l().timer=B;var U=l(),X=function(){function e(){p()(this,e),this.listeners=[]}return b()(e,[{key:"hasListeners",get:function(){return!!this.listeners.length}},{key:"addListener",value:function(e){var r=this;return this.listeners.includes(e)||this.listeners.push(e),function(){return r.removeListener(e)}}},{key:"emit",value:function(){for(var e=this.listeners,r=0;r<e.length;++r)e[r].apply(e,arguments)}},{key:"removeListener",value:function(e){var r=this.listeners.indexOf(e);r>=0&&this.listeners.splice(r,1)}}]),e}();function K(e,r,t){I(e,r),r.set(e,t)}function I(e,r){if(r.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function G(e,r,t){if(!r.has(e))throw new TypeError("attempted to get private field on non-instance");return t}var Y=new WeakSet,z=new WeakMap,F=new WeakMap,H=new WeakMap,V=function(){function e(r){var t;p()(this,e),I(this,t=Y),t.add(this),K(this,z,{writable:!0,value:!1}),K(this,F,{writable:!0,value:[]}),K(this,H,{writable:!0,value:void 0}),j()(this,H,!!r)}var t,i;return b()(e,[{key:"ready",get:function(){return C()(this,H)}},{key:"setReady",value:function(e){var r=!!e;C()(this,H)!==r&&(j()(this,H,r),r&&!C()(this,z)&&G(this,Y,Q).call(this))}},{key:"seize",value:(i=r()(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.waitReady();case 2:this.setReady(!1);case 3:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"waitReady",value:(t=r()(n().mark((function e(){var r;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(C()(this,H)&&!C()(this,F).length){e.next=6;break}return r=S(),C()(this,F).push(r),e.next=5,r;case 5:C()(this,F).shift();case 6:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),e}();function Q(){if(C()(this,H)&&C()(this,F).length&&(C()(this,F)[0].resolve(),C()(this,F).length))return setTimeout(G(this,Y,Q).bind(this)),void j()(this,z,!0);j()(this,z,!1)}var J=__webpack_require__(311),Z=__webpack_require__.n(J),$=__webpack_require__(189),ee=__webpack_require__.n($),re=__webpack_require__(156),te=__webpack_require__(99),ne=__webpack_require__.n(te),ie=__webpack_require__(899),oe=__webpack_require__(893),ae=["children","chunkName","getComponent","placeholder"];function ce(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function _e(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ce(Object(t),!0).forEach((function(r){Z()(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ce(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function ue(e){var t=e.children,i=e.chunkName,o=e.getComponent,a=e.placeholder,c=ee()(e,ae),u=(0,re.useRef)({mounted:!1,pendingStyles:[]}).current,l=(0,_.getBuildInfo)().publicPath,s=(0,re.lazy)(r()(n().mark((function e(){var r;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o();case 2:if(r=e.sent,!u.pendingStyles.length){e.next=6;break}return e.next=6,Promise.all(u.pendingStyles);case 6:return e.abrupt("return",r.default?r:{default:r});case 7:case"end":return e.stop()}}),e)}))));if(_.IS_SERVER_SIDE){var p=(0,ie.getGlobalState)().ssrContext.chunks;if(p.includes(i))throw Error('Chunk name clash for "'.concat(i,'"'));p.push(i)}else u.mounted||(u.mounted=!0,window.CHUNK_GROUPS[i].forEach((function(e){var r,t;if(e.endsWith(".css")){var n="".concat(l,"/").concat(e),i=document.querySelector('link[href="'.concat(n,'"]'));if(!i){(i=document.createElement("link")).setAttribute("href",n),i.setAttribute("rel","stylesheet");var o=S();i.onload=o.resolve,i.onerror=o.resolve,u.pendingStyles.push(o),document.querySelector("head").appendChild(i)}(r=window).STYLESHEET_USAGE_COUNTERS||(r.STYLESHEET_USAGE_COUNTERS={}),(t=window.STYLESHEET_USAGE_COUNTERS)[n]||(t[n]=0),++window.STYLESHEET_USAGE_COUNTERS[n]}})));return(0,re.useEffect)((function(){return function(){u.mounted=!1,window.CHUNK_GROUPS[i].forEach((function(e){if(e.endsWith(".css")){var r="".concat(l,"/").concat(e);if(--window.STYLESHEET_USAGE_COUNTERS[r]<=0){var t=document.querySelector('link[href="'.concat(r,'"]'));document.querySelector("head").removeChild(t)}}}))}}),[i,u,l]),(0,oe.jsx)(re.Suspense,{fallback:a,children:(0,oe.jsx)(s,_e(_e({},c),{},{children:t}))})}ue.propTypes={children:ne().node,chunkName:ne().string.isRequired,getComponent:ne().func.isRequired,placeholder:ne().node},ue.defaultProps={children:void 0,placeholder:void 0};var le,se=["children"];function pe(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function de(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?pe(Object(t),!0).forEach((function(r){Z()(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):pe(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function be(e){var r=e.chunkName,t=e.getComponent,n=e.placeholder;return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=e.children,o=ee()(e,se);return(0,re.createElement)(ue,de(de({},o),{},{chunkName:r,getComponent:t,placeholder:n}),i)}}o().COMPOSE=i.COMPOSE,o().PRIORITY=i.PRIORITY;try{le=process.env.NODE_CONFIG_ENV}catch(e){}var fe="production"!==(le||"production")&&a.requireWeak("./jest","/");function he(e){return Ee.apply(this,arguments)}function Ee(){return Ee=r()(n().mark((function e(r){var t,i,o,a=arguments;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=a.length>1&&void 0!==a[1]?a[1]:5,i=a.length>2&&void 0!==a[2]?a[2]:1e3,o=1;case 3:return e.prev=3,e.next=6,r();case 6:return e.abrupt("return",e.sent);case 9:if(e.prev=9,e.t0=e.catch(3),!(o<t)){e.next=16;break}return e.next=14,B(i);case 14:e.next=17;break;case 16:throw e.t0;case 17:++o,e.next=3;break;case 20:case"end":return e.stop()}}),e,null,[[3,9]])}))),Ee.apply(this,arguments)}var me=__webpack_require__(300),ve=__webpack_require__.n(me),we=__webpack_require__(128),ye=["children","className","disabled","enforceA","keepScrollPosition","onClick","onMouseDown","openNewTab","replace","routerLinkType","to"];function Oe(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function Pe(e){var r=e.children,t=e.className,n=e.disabled,i=e.enforceA,o=e.keepScrollPosition,a=e.onClick,c=e.onMouseDown,_=e.openNewTab,u=e.replace,l=e.routerLinkType,s=e.to,p=ee()(e,ye);return n||i||_||s.match(/^(#|(https?|mailto):)/)?(0,oe.jsx)("a",{className:(t?t+" ":"")+"zH52sA",disabled:n,href:s,onClick:n?function(e){return e.preventDefault()}:a,onMouseDown:n?function(e){return e.preventDefault()}:c,rel:"noopener noreferrer",target:_?"_blank":"",children:r}):(0,re.createElement)(l,function(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?Oe(Object(t),!0).forEach((function(r){Z()(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Oe(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}({className:t,disabled:n,onMouseDown:c,replace:u,to:s,onClick:function(e){a&&a(e),o||window.scroll(0,0)}},p),r)}function ge(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function ke(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ge(Object(t),!0).forEach((function(r){Z()(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ge(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function Te(e){return(0,oe.jsx)(Pe,ke(ke({},e),{},{routerLinkType:we.Link}))}function Ae(e){var r=e.active,t=e.children,n=e.disabled,i=e.enforceA,o=e.onClick,a=e.onMouseDown,c=e.openNewTab,_=e.replace,u=e.theme,l=e.to,s=u.button;return r&&u.active&&(s+=" ".concat(u.active)),n?(u.disabled&&(s+=" ".concat(u.disabled)),(0,oe.jsx)("div",{className:s,children:t})):l?(0,oe.jsx)(Te,{className:s,enforceA:i,onClick:o,onMouseDown:a,openNewTab:c,replace:_,to:l,children:t}):(0,oe.jsx)("div",{className:s,onClick:o,onKeyPress:o,onMouseDown:a,role:"button",tabIndex:0,children:t})}Pe.defaultProps={children:null,className:null,disabled:!1,enforceA:!1,keepScrollPosition:!1,onClick:null,onMouseDown:null,openNewTab:!1,replace:!1,to:""},Pe.propTypes={children:ne().node,className:ne().string,disabled:ne().bool,enforceA:ne().bool,keepScrollPosition:ne().bool,onClick:ne().func,onMouseDown:ne().func,openNewTab:ne().bool,replace:ne().bool,routerLinkType:ne().elementType.isRequired,to:ne().oneOfType([ne().object,ne().string])};var Ce=o()("Button",["active","button","disabled"],{button:"E1FNQT",context:"KM0v4f",ad:"_3jm1-Q",hoc:"_0plpDL",active:"MAe9O6",disabled:"Br9IWV"})(Ae);Ae.defaultProps={active:!1,children:void 0,disabled:!1,enforceA:!1,onClick:void 0,onMouseDown:void 0,openNewTab:!1,replace:!1,to:void 0},Ae.propTypes={active:ne().bool,children:ne().node,disabled:ne().bool,enforceA:ne().bool,onClick:ne().func,onMouseDown:ne().func,openNewTab:ne().bool,replace:ne().bool,theme:Ce.themeType.isRequired,to:ne().oneOfType([ne().object,ne().string])};var Le=Ce;function je(e){var r=e.checked,t=e.label,n=e.onChange,i=e.theme;return(0,oe.jsxs)("div",{className:i.container,children:[void 0===t?null:(0,oe.jsx)("p",{className:i.label,children:t}),(0,oe.jsx)("input",{checked:r,className:i.checkbox,onChange:n,type:"checkbox"})]})}var qe=o()("Checkbox",["checkbox","container","label"],{checkbox:"A-f8qJ",context:"dNQcC6",ad:"earXxa",hoc:"qAPfQ6",container:"Kr0g3M",label:"_3dML-O"})(je);je.propTypes={checked:ne().bool,label:ne().string,onChange:ne().func,theme:qe.themeType.isRequired},je.defaultProps={checked:void 0,label:void 0,onChange:void 0};var xe=qe,Re=__webpack_require__(715);function Ne(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=document.getElementById("react-view"),n=(0,oe.jsx)(ie.GlobalStateProvider,{initialState:window.ISTATE,children:(0,oe.jsx)(we.BrowserRouter,{children:(0,oe.jsx)(e,{})})});if(r.dontHydrate){var i=(0,Re.createRoot)(t);i.render(n)}else(0,Re.hydrateRoot)(t,n)}var De=__webpack_require__(467);function Me(e){for(var r=e.filter,t=e.label,n=e.onChange,i=e.options,o=e.theme,a=e.value,c=[(0,oe.jsx)("option",{className:o.hiddenOption,children:""},"__reactUtilsHiddenOption")],_=0;_<i.length;++_){var u=i[_];r&&!r(u)||((0,De.isString)(u)&&(u={value:u}),c.push((0,oe.jsx)("option",{className:o.option,value:u.value,children:void 0===u.name?u.value:u.name},u.value)))}return(0,oe.jsxs)("div",{className:o.container,children:[void 0===t?null:(0,oe.jsx)("p",{className:o.label,children:t}),(0,oe.jsx)("select",{className:o.select,onChange:n,value:a,children:c}),(0,oe.jsx)("div",{className:o.arrow,children:"▼"})]})}var Se=o()("Dropdown",["arrow","container","hiddenOption","label","option","select"],{arrow:"-zPK7Y",context:"haRIry",ad:"D4XHG2",hoc:"N3nd34",container:"_9CQpeA",label:"Gv0kyu",hiddenOption:"RdW3yR",select:"JXK1uw"})(Me);Me.propTypes={filter:ne().func,label:ne().string,onChange:ne().func,options:ne().arrayOf(ne().oneOfType([ne().shape({name:ne().node,value:ne().string.isRequired}),ne().string]).isRequired),theme:Se.themeType.isRequired,value:ne().string},Me.defaultProps={filter:void 0,label:void 0,onChange:void 0,options:[],value:void 0};var Be=Se,We=["label","theme"];function Ue(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function Xe(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?Ue(Object(t),!0).forEach((function(r){Z()(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ue(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function Ke(e){var r=e.label,t=e.theme,n=ee()(e,We);return(0,oe.jsxs)("div",{className:t.container,children:[void 0===r?null:(0,oe.jsx)("p",{className:t.label,children:r}),(0,oe.jsx)("input",Xe({className:t.input},n))]})}var Ie=o()("Input",["container","input","label"],{container:"Cxx397",context:"X5WszA",ad:"_8s7GCr",hoc:"TVlBYc",input:"M07d4s",label:"gfbdq-"})(Ke);Ke.propTypes={label:ne().string,theme:Ie.themeType.isRequired},Ke.defaultProps={label:void 0};var Ge=Ie;function Ye(e){var r=e.children,t=e.leftSidePanelContent,n=e.rightSidePanelContent,i=e.theme;return(0,oe.jsxs)("div",{className:i.container,children:[(0,oe.jsx)("div",{className:[i.sidePanel,i.leftSidePanel].join(" "),children:t}),(0,oe.jsx)("div",{className:i.mainPanel,children:r}),(0,oe.jsx)("div",{className:[i.sidePanel,i.rightSidePanel].join(" "),children:n})]})}var ze=o()("PageLayout",["container","leftSidePanel","mainPanel","rightSidePanel","sidePanel"],{container:"T3cuHB",context:"m4mL-M",ad:"m3-mdC",hoc:"J15Z4H",mainPanel:"pPlQO2",sidePanel:"lqNh4h"})(Ye);Ye.propTypes={children:ne().node,leftSidePanelContent:ne().node,rightSidePanelContent:ne().node,theme:ze.themeType.isRequired},Ye.defaultProps={children:null,leftSidePanelContent:null,rightSidePanelContent:null};var Fe=ze,He=__webpack_require__(684),Ve=(0,re.createContext)();function Qe(e){var r=e.children,t=e.description,n=e.image,i=e.siteName,o=e.socialDescription,a=e.socialTitle,c=e.title,_=e.url,u=a||c,l=o||t,s=(0,re.useMemo)((function(){return{description:t,image:n,siteName:i,socialDescription:o,socialTitle:a,title:c,url:_}}),[t,n,i,o,a,c,_]);return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsxs)(He.Helmet,{children:[(0,oe.jsx)("title",{children:c}),(0,oe.jsx)("meta",{name:"description",content:t}),(0,oe.jsx)("meta",{name:"twitter:card",content:"summary_large_image"}),(0,oe.jsx)("meta",{name:"twitter:title",content:u}),(0,oe.jsx)("meta",{name:"twitter:description",content:l}),n?(0,oe.jsx)("meta",{name:"twitter:image",content:n}):null,i?(0,oe.jsx)("meta",{name:"twitter:site",content:"@".concat(i)}):null,(0,oe.jsx)("meta",{name:"og:title",content:u}),n?(0,oe.jsx)("meta",{name:"og:image",content:n}):null,n?(0,oe.jsx)("meta",{name:"og:image:alt",content:u}):null,(0,oe.jsx)("meta",{name:"og:description",content:l}),i?(0,oe.jsx)("meta",{name:"og:sitename",content:i}):null,_?(0,oe.jsx)("meta",{name:"og:url",content:_}):null]}),r?(0,oe.jsx)(Ve.Provider,{value:s,children:r}):null]})}Qe.Context=Ve,Qe.defaultProps={children:null,image:null,siteName:null,socialDescription:null,socialTitle:null,url:null},Qe.propTypes={children:ne().node,description:ne().string.isRequired,image:ne().string,siteName:ne().string,socialDescription:ne().string,socialTitle:ne().string,title:ne().string.isRequired,url:ne().string};var Je=__webpack_require__(673),Ze=__webpack_require__.n(Je),$e=__webpack_require__(386),er=__webpack_require__.n($e);function rr(e){var r=e.children,t=e.onCancel,n=e.theme,i=(0,re.useRef)(),o=(0,re.useRef)(),a=(0,re.useState)(),c=Ze()(a,2),_=c[0],u=c[1];(0,re.useEffect)((function(){var e=document.createElement("div");return document.body.classList.add("scrolling-disabled-by-modal"),document.body.appendChild(e),u(e),function(){document.body.classList.remove("scrolling-disabled-by-modal"),document.body.removeChild(e)}}),[]);var l=(0,re.useMemo)((function(){return(0,oe.jsx)("div",{onFocus:function(){for(var e=i.current.querySelectorAll("*"),r=e.length-1;r>=0;--r)if(e[r].focus(),document.activeElement===e[r])return;o.current.focus()},tabIndex:"0"})}),[]);return _?er().createPortal((0,oe.jsxs)(oe.Fragment,{children:[l,(0,oe.jsx)("div",{"aria-label":"Cancel",className:n.overlay,onClick:function(){return t()},onKeyDown:function(e){"Escape"===e.key&&t()},ref:function(e){e&&e!==o.current&&(o.current=e,e.focus())},role:"button",tabIndex:"0"}),(0,oe.jsx)("div",{"aria-modal":"true",className:n.container,onWheel:function(e){return e.stopPropagation()},ref:i,role:"dialog",children:r}),(0,oe.jsx)("div",{onFocus:function(){o.current.focus()},tabIndex:"0"}),l]}),_):null}var tr=o()("Modal",["container","overlay"],{overlay:"ye2BZo",context:"Szmbbz",ad:"Ah-Nsc",hoc:"Wki41G",container:"gyZ4rc"})(rr);rr.propTypes={onCancel:ne().func,children:ne().node,theme:tr.themeType.isRequired},rr.defaultProps={onCancel:De.noop,children:null};var nr=tr;function ir(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function or(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ir(Object(t),!0).forEach((function(r){Z()(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ir(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function ar(e){return(0,oe.jsx)(Pe,or(or({},e),{},{routerLinkType:we.NavLink}))}function cr(e){var r=e.children,t=e.className,n=e.ratio.split(":"),i="".concat(100*n[1]/n[0],"%"),o=(0,oe.jsx)("div",{style:{paddingBottom:i},className:"EznFz3",children:(0,oe.jsx)("div",{className:"_0vb7tq",children:r})});return t?(0,oe.jsx)("div",{className:t,children:o}):o}function _r(e){var r=e.theme;return(0,oe.jsxs)("div",{className:(r.container?r.container+" ":"")+"_7zdld4",children:[(0,oe.jsx)("div",{className:(r.circle?r.circle+" ":"")+"dBrB4g"}),(0,oe.jsx)("div",{className:(r.circle?r.circle+" ":"")+"dBrB4g"}),(0,oe.jsx)("div",{className:(r.circle?r.circle+" ":"")+"dBrB4g"})]})}cr.defaultProps={children:null,className:null,ratio:"1:1"},cr.propTypes={children:ne().node,className:ne().string,ratio:ne().string},_r.defaultProps={theme:{}},_r.propTypes={theme:ne().shape({container:ne().string,circle:ne().string})};var ur=o()("Throbber",["circle","container"],{container:"_7zdld4",context:"uIObt7",ad:"XIxe9o",hoc:"YOyORH",circle:"dBrB4g",bouncing:"TJe-6j"})(_r),lr={ABOVE_CURSOR:"ABOVE_CURSOR",ABOVE_ELEMENT:"ABOVE_ELEMENT",BELOW_CURSOR:"BELOW_CURSOR",BELOW_ELEMENT:"BELOW_ELEMENT"},sr=["border-bottom-color:transparent","border-left-color:transparent","border-right-color:transparent"].join(";"),pr=["border-top-color:transparent","border-left-color:transparent","border-right-color:transparent"].join(";");var dr=(0,re.forwardRef)((function(e,r){var t=e.children,n=e.theme,i=(0,re.useState)(null),o=Ze()(i,2),a=o[0],c=o[1],_=function(e,r,t,n){return a&&function(e,r,t,n,i){var o,a,c,_,u,l=function(e){return{arrow:e.arrow.getBoundingClientRect(),container:e.container.getBoundingClientRect()}}(i),s=(a=(o=window).pageXOffset,c=o.pageYOffset,u=(_=document.documentElement).clientHeight,{left:a,right:a+_.clientWidth,top:c,bottom:c+u}),p=function(e,r,t){var n=t.arrow,i=t.container;return{arrowX:.5*(i.width-n.width),arrowY:i.height,containerX:e-i.width/2,containerY:r-i.height-n.height/1.5,baseArrowStyle:sr}}(e,r,l);if(p.containerX<s.left+6)p.containerX=s.left+6,p.arrowX=Math.max(6,e-p.containerX-l.arrow.width/2);else{var d=s.right-6-l.container.width;p.containerX>d&&(p.containerX=d,p.arrowX=Math.min(l.container.width-6,e-p.containerX-l.arrow.width/2))}p.containerY<s.top+6&&(p.containerY+=l.container.height+2*l.arrow.height,p.arrowY-=l.container.height+l.arrow.height,p.baseArrowStyle=pr);var b="left:".concat(p.containerX,"px;top:").concat(p.containerY,"px");i.container.setAttribute("style",b);var f="".concat(p.baseArrowStyle,";left:").concat(p.arrowX,"px;top:").concat(p.arrowY,"px");i.arrow.setAttribute("style",f)}(e,r,0,0,a)};return(0,re.useImperativeHandle)(r,(function(){return{pointTo:_}})),(0,re.useEffect)((function(){var e=function(e){var r=document.createElement("div");e.arrow&&r.setAttribute("class",e.arrow);var t=document.createElement("div");e.content&&t.setAttribute("class",e.content);var n=document.createElement("div");return e.container&&n.setAttribute("class",e.container),n.appendChild(r),n.appendChild(t),document.body.appendChild(n),{container:n,arrow:r,content:t}}(n);return c(e),function(){document.body.removeChild(e.container),c(null)}}),[n]),a?(0,$e.createPortal)(t,a.content):null}));dr.propTypes={children:ne().node,theme:ne().shape().isRequired},dr.defaultProps={children:null};var br=dr;function fr(e){var r=e.children,t=e.placement,n=e.tip,i=e.theme,o=(0,re.useRef)(),a=(0,re.useRef)(),c=(0,re.useState)(!1),_=Ze()(c,2),u=_[0],l=_[1];return(0,re.useEffect)((function(){if(u&&null!==n){var e=function(){return l(!1)};return window.addEventListener("scroll",e),function(){return window.removeEventListener("scroll",e)}}}),[u,n]),(0,oe.jsxs)("div",{className:i.wrapper,onMouseLeave:function(){return l(!1)},onMouseMove:function(e){return function(e,r){if(u){var n=a.current.getBoundingClientRect();e<n.left||e>n.right||r<n.top||r>n.bottom?l(!1):o.current&&o.current.pointTo(e+window.pageXOffset,r+window.pageYOffset,t,a.current)}else l(!0)}(e.clientX,e.clientY)},ref:a,children:[u&&null!==n?(0,oe.jsx)(br,{ref:o,theme:i,children:n}):null,r]})}var hr=o()("WithTooltip",["appearance","arrow","container","content","wrapper"],{arrow:"M9gywF",ad:"_4xT7zE",hoc:"zd-vnH",context:"GdZucr",container:"f9gY8K",appearance:"L4ubm-",wrapper:"_4qDBRM"})(fr);hr.PLACEMENTS=lr,fr.propTypes={children:ne().node,placement:ne().oneOf(Object.values(lr)),theme:hr.themeType.isRequired,tip:ne().node},fr.defaultProps={children:null,placement:lr.ABOVE_CURSOR,tip:null};var Er=hr,mr=__webpack_require__(656),vr=__webpack_require__.n(mr),wr={container:"jTxmOX",context:"dzIcLh",ad:"_5a9XX1",hoc:"_7sH52O"};function yr(e){var r=e.autoplay,t=e.src,n=e.theme,i=e.title,o=t.split("?"),a=Ze()(o,2),c=a[0],_=a[1],u=(_=_?vr().parse(_):{}).v||c.match(/\/([a-zA-Z0-9-_]*)$/)[1];return c="https://www.youtube.com/embed/".concat(u),delete _.v,_.autoplay=r?1:0,c+="?".concat(vr().stringify(_)),(0,oe.jsxs)(cr,{className:n.container,ratio:"16:9",children:[(0,oe.jsx)(ur,{theme:wr}),(0,oe.jsx)("iframe",{allow:"autoplay",allowFullScreen:!0,className:n.video,src:c,title:i})]})}var Or=o()("YouTubeVideo",["container","video"],{container:"sXHM81",context:"veKyYi",ad:"r3ABzd",hoc:"YKcPnR",video:"SlV2zw"})(yr);yr.propTypes={autoplay:ne().bool,src:ne().string.isRequired,theme:Or.themeType.isRequired,title:ne().string},yr.defaultProps={autoplay:!1,title:""};var Pr=Or,gr=a.requireWeak("./server","/")}(),__webpack_exports__}()}));
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@babel/runtime/helpers/classPrivateFieldGet"),require("@babel/runtime/helpers/classPrivateFieldSet"),require("@dr.pogodin/react-global-state"),require("@dr.pogodin/react-themes"),require("axios"),require("dayjs"),require("lodash"),require("prop-types"),require("qs"),require("react"),require("react-dom"),require("react-dom/client"),require("react-helmet"),require("react-router-dom")):"function"==typeof define&&define.amd?define(["@babel/runtime/helpers/classPrivateFieldGet","@babel/runtime/helpers/classPrivateFieldSet","@dr.pogodin/react-global-state","@dr.pogodin/react-themes","axios","dayjs","lodash","prop-types","qs","react","react-dom","react-dom/client","react-helmet","react-router-dom"],t):"object"==typeof exports?exports["@dr.pogodin/react-utils"]=t(require("@babel/runtime/helpers/classPrivateFieldGet"),require("@babel/runtime/helpers/classPrivateFieldSet"),require("@dr.pogodin/react-global-state"),require("@dr.pogodin/react-themes"),require("axios"),require("dayjs"),require("lodash"),require("prop-types"),require("qs"),require("react"),require("react-dom"),require("react-dom/client"),require("react-helmet"),require("react-router-dom")):e["@dr.pogodin/react-utils"]=t(e["@babel/runtime/helpers/classPrivateFieldGet"],e["@babel/runtime/helpers/classPrivateFieldSet"],e["@dr.pogodin/react-global-state"],e["@dr.pogodin/react-themes"],e.axios,e.dayjs,e.lodash,e["prop-types"],e.qs,e.react,e["react-dom"],e["react-dom/client"],e["react-helmet"],e["react-router-dom"])}("undefined"!=typeof self?self:this,(function(__WEBPACK_EXTERNAL_MODULE__226__,__WEBPACK_EXTERNAL_MODULE__556__,__WEBPACK_EXTERNAL_MODULE__899__,__WEBPACK_EXTERNAL_MODULE__198__,__WEBPACK_EXTERNAL_MODULE__300__,__WEBPACK_EXTERNAL_MODULE__760__,__WEBPACK_EXTERNAL_MODULE__467__,__WEBPACK_EXTERNAL_MODULE__99__,__WEBPACK_EXTERNAL_MODULE__656__,__WEBPACK_EXTERNAL_MODULE__156__,__WEBPACK_EXTERNAL_MODULE__111__,__WEBPACK_EXTERNAL_MODULE__715__,__WEBPACK_EXTERNAL_MODULE__383__,__WEBPACK_EXTERNAL_MODULE__128__){return function(){"use strict";var __webpack_modules__={450:function(e,t,n){n.r(t),n.d(t,{IS_CLIENT_SIDE:function(){return r},IS_SERVER_SIDE:function(){return o},buildTimestamp:function(){return l},getBuildInfo:function(){return c},isDevBuild:function(){return i},isProdBuild:function(){return a}});const r="object"!=typeof process||!process.versions||!process.versions.node||!!n.g.REACT_UTILS_FORCE_CLIENT_SIDE,o=!r;function i(){return!1}function a(){return!0}function c(){return(r?window:n.g).TRU_BUILD_INFO}function l(){return c().timestamp}},869:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{requireWeak:function(){return requireWeak},resolveWeak:function(){return resolveWeak}});var _isomorphy__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(450);function requireWeak(modulePath,basePath){if(_isomorphy__WEBPACK_IMPORTED_MODULE_0__.IS_CLIENT_SIDE)return null;try{const{resolve:resolve}=eval("require")("path"),path=basePath?resolve(basePath,modulePath):modulePath,{default:def,...named}=eval("require")(path);return def?(Object.entries(named).forEach((e=>{let[t,n]=e;if(def[t])throw Error("Conflict between default and named exports");def[t]=n})),def):named}catch{return null}}function resolveWeak(e){return e}},251:function(e,t,n){var r=n(156),o=Symbol.for("react.element"),i=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,c=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,n){var r,i={},s=null,u=null;for(r in void 0!==n&&(s=""+n),void 0!==t.key&&(s=""+t.key),void 0!==t.ref&&(u=t.ref),t)a.call(t,r)&&!l.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===i[r]&&(i[r]=t[r]);return{$$typeof:o,type:e,key:s,ref:u,props:i,_owner:c.current}}t.Fragment=i,t.jsx=s,t.jsxs=s},893:function(e,t,n){e.exports=n(251)},226:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__226__},556:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__556__},899:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__899__},198:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__198__},300:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__300__},760:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__760__},467:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__467__},99:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__99__},656:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__656__},156:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__156__},111:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__111__},715:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__715__},383:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__383__},128:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__128__}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var n=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](n,n.exports,__webpack_require__),n.exports}__webpack_require__.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=function(e,t){for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},__webpack_require__.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};return function(){__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{Barrier:function(){return m},BaseModal:function(){return he},Button:function(){return H},Checkbox:function(){return Q},Dropdown:function(){return ne},Emitter:function(){return v},GlobalStateProvider:function(){return L.GlobalStateProvider},Input:function(){return ie},JU:function(){return D},Link:function(){return Y},MetaTags:function(){return _e},Modal:function(){return me},NavLink:function(){return be},PT:function(){return R},PageLayout:function(){return le},ScalableRect:function(){return Ee},Semaphore:function(){return S},ThemeProvider:function(){return e.ThemeProvider},Throbber:function(){return ve},WithTooltip:function(){return Se},YouTubeVideo:function(){return Oe},api:function(){return X()},client:function(){return Z},config:function(){return r},getGlobalState:function(){return L.getGlobalState},getSsrContext:function(){return L.getSsrContext},isomorphy:function(){return o},newBarrier:function(){return b},server:function(){return je},splitComponent:function(){return M},themed:function(){return t()},time:function(){return w},useAsyncCollection:function(){return L.useAsyncCollection},useAsyncData:function(){return L.useAsyncData},useGlobalState:function(){return L.useGlobalState},webpack:function(){return n},withRetries:function(){return W}});var e=__webpack_require__(198),t=__webpack_require__.n(e),n=__webpack_require__(869),r=(0,n.requireWeak)("config")||window.CONFIG||{},o=__webpack_require__(450),i=__webpack_require__(760),a=__webpack_require__.n(i),c=__webpack_require__(226),l=__webpack_require__.n(c),s=__webpack_require__(556),u=__webpack_require__.n(s);function _(e,t,n){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,n)}var d=new WeakMap,p=new WeakMap,h=new WeakMap,f=new WeakMap;class m extends Promise{constructor(e){let t,n;super(((r,o)=>{t=e=>{r(e),u()(this,p,!0)},n=e=>{o(e),u()(this,f,!0)},e&&e(t,n)})),_(this,d,{writable:!0,value:void 0}),_(this,p,{writable:!0,value:!1}),_(this,h,{writable:!0,value:void 0}),_(this,f,{writable:!0,value:!1}),u()(this,d,t),u()(this,h,n)}get resolve(){return l()(this,d)}get resolved(){return l()(this,p)}get reject(){return l()(this,h)}get rejected(){return l()(this,f)}then(e,t){const n=super.then(e,t);return u()(n,d,l()(this,d)),u()(n,h,l()(this,h)),n}}function b(e){return new m(e)}async function E(e){const t=new m,n=setTimeout(t.resolve.bind(t),e);return t.abort=()=>clearTimeout(n),t}a().SEC_MS=1e3,a().MIN_MS=60*a().SEC_MS,a().HOUR_MS=60*a().MIN_MS,a().DAY_MS=24*a().HOUR_MS,a().YEAR_MS=365*a().DAY_MS,a().now=Date.now,a().timer=E;var w=a();class v{constructor(){this.listeners=[]}get hasListeners(){return!!this.listeners.length}addListener(e){return this.listeners.includes(e)||this.listeners.push(e),()=>this.removeListener(e)}emit(){const{listeners:e}=this;for(let t=0;t<e.length;++t)e[t](...arguments)}removeListener(e){const t=this.listeners.indexOf(e);t>=0&&this.listeners.splice(t,1)}}function g(e,t,n){y(e,t),t.set(e,n)}function y(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function x(e,t,n){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return n}var T=new WeakSet,k=new WeakMap,C=new WeakMap,P=new WeakMap;class S{constructor(e){var t;y(this,t=T),t.add(this),g(this,k,{writable:!0,value:!1}),g(this,C,{writable:!0,value:[]}),g(this,P,{writable:!0,value:void 0}),u()(this,P,!!e)}get ready(){return l()(this,P)}setReady(e){const t=!!e;l()(this,P)!==t&&(u()(this,P,t),t&&!l()(this,k)&&x(this,T,N).call(this))}async seize(){await this.waitReady(),this.setReady(!1)}async waitReady(){if(!l()(this,P)||l()(this,C).length){const e=b();l()(this,C).push(e),await e,l()(this,C).shift()}}}function N(){if(l()(this,P)&&l()(this,C).length&&(l()(this,C)[0].resolve(),l()(this,C).length))return setTimeout(x(this,T,N).bind(this)),void u()(this,k,!0);u()(this,k,!1)}var q=__webpack_require__(156),R=__webpack_require__(99),A=__webpack_require__.n(R),L=__webpack_require__(899),O=__webpack_require__(893);function j(e){let{children:t,chunkName:n,getComponent:r,placeholder:i,...a}=e;const{current:c}=(0,q.useRef)({mounted:!1,pendingStyles:[]}),{publicPath:l}=(0,o.getBuildInfo)(),s=(0,q.lazy)((async()=>{const e=await r();return c.pendingStyles.length&&await Promise.all(c.pendingStyles),e.default?e:{default:e}}));if(o.IS_SERVER_SIDE){const{chunks:e}=(0,L.getGlobalState)().ssrContext;if(e.includes(n))throw Error('Chunk name clash for "'.concat(n,'"'));e.push(n)}else c.mounted||(c.mounted=!0,window.CHUNK_GROUPS[n].forEach((e=>{var t,n;if(!e.endsWith(".css"))return;const r="".concat(l,"/").concat(e);let o=document.querySelector('link[href="'.concat(r,'"]'));if(!o){o=document.createElement("link"),o.setAttribute("href",r),o.setAttribute("rel","stylesheet");const e=b();o.onload=e.resolve,o.onerror=e.resolve,c.pendingStyles.push(e),document.querySelector("head").appendChild(o)}(t=window).STYLESHEET_USAGE_COUNTERS||(t.STYLESHEET_USAGE_COUNTERS={}),(n=window.STYLESHEET_USAGE_COUNTERS)[r]||(n[r]=0),++window.STYLESHEET_USAGE_COUNTERS[r]})));return(0,q.useEffect)((()=>()=>{c.mounted=!1,window.CHUNK_GROUPS[n].forEach((e=>{if(!e.endsWith(".css"))return;const t="".concat(l,"/").concat(e);if(--window.STYLESHEET_USAGE_COUNTERS[t]<=0){const e=document.querySelector('link[href="'.concat(t,'"]'));document.querySelector("head").removeChild(e)}}))}),[n,c,l]),(0,O.jsx)(q.Suspense,{fallback:i,children:(0,O.jsx)(s,{...a,children:t})})}function M(e){let{chunkName:t,getComponent:n,placeholder:r}=e;return function(){let{children:e,...o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,q.createElement)(j,{...o,chunkName:t,getComponent:n,placeholder:r},e)}}let B;j.propTypes={children:A().node,chunkName:A().string.isRequired,getComponent:A().func.isRequired,placeholder:A().node},j.defaultProps={children:void 0,placeholder:void 0},t().COMPOSE=e.COMPOSE,t().PRIORITY=e.PRIORITY;try{B=process.env.NODE_CONFIG_ENV}catch{}const D="production"!==(B||"production")&&n.requireWeak("./jest","/");async function W(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;for(let r=1;;++r)try{return await e()}catch(e){if(!(r<t))throw e;await E(n)}}var U=__webpack_require__(300),X=__webpack_require__.n(U),I=__webpack_require__(128);function K(e){let{children:t,className:n,disabled:r,enforceA:o,keepScrollPosition:i,onClick:a,onMouseDown:c,openNewTab:l,replace:s,routerLinkType:u,to:_,...d}=e;return r||o||l||_.match(/^(#|(https?|mailto):)/)?(0,O.jsx)("a",{className:(n?n+" ":"")+"zH52sA",disabled:r,href:_,onClick:r?e=>e.preventDefault():a,onMouseDown:r?e=>e.preventDefault():c,rel:"noopener noreferrer",target:l?"_blank":"",children:t}):(0,q.createElement)(u,{className:n,disabled:r,onMouseDown:c,replace:s,to:_,onClick:e=>{a&&a(e),i||window.scroll(0,0)},...d},t)}function Y(e){return(0,O.jsx)(K,{...e,routerLinkType:I.Link})}function G(e){let{active:t,children:n,disabled:r,enforceA:o,onClick:i,onMouseDown:a,openNewTab:c,replace:l,theme:s,to:u}=e,_=s.button;return t&&s.active&&(_+=" ".concat(s.active)),r?(s.disabled&&(_+=" ".concat(s.disabled)),(0,O.jsx)("div",{className:_,children:n})):u?(0,O.jsx)(Y,{className:_,enforceA:o,onClick:i,onMouseDown:a,openNewTab:c,replace:l,to:u,children:n}):(0,O.jsx)("div",{className:_,onClick:i,onKeyPress:i,onMouseDown:a,role:"button",tabIndex:0,children:n})}K.defaultProps={children:null,className:null,disabled:!1,enforceA:!1,keepScrollPosition:!1,onClick:null,onMouseDown:null,openNewTab:!1,replace:!1,to:""},K.propTypes={children:A().node,className:A().string,disabled:A().bool,enforceA:A().bool,keepScrollPosition:A().bool,onClick:A().func,onMouseDown:A().func,openNewTab:A().bool,replace:A().bool,routerLinkType:A().elementType.isRequired,to:A().oneOfType([A().object,A().string])};const F=t()("Button",["active","button","disabled"],{button:"E1FNQT",context:"KM0v4f",ad:"_3jm1-Q",hoc:"_0plpDL",active:"MAe9O6",disabled:"Br9IWV"})(G);G.defaultProps={active:!1,children:void 0,disabled:!1,enforceA:!1,onClick:void 0,onMouseDown:void 0,openNewTab:!1,replace:!1,to:void 0},G.propTypes={active:A().bool,children:A().node,disabled:A().bool,enforceA:A().bool,onClick:A().func,onMouseDown:A().func,openNewTab:A().bool,replace:A().bool,theme:F.themeType.isRequired,to:A().oneOfType([A().object,A().string])};var H=F;function z(e){let{checked:t,label:n,onChange:r,theme:o}=e;return(0,O.jsxs)("div",{className:o.container,children:[void 0===n?null:(0,O.jsx)("p",{className:o.label,children:n}),(0,O.jsx)("input",{checked:t,className:o.checkbox,onChange:r,type:"checkbox"})]})}const V=t()("Checkbox",["checkbox","container","label"],{checkbox:"A-f8qJ",context:"dNQcC6",ad:"earXxa",hoc:"qAPfQ6",container:"Kr0g3M",label:"_3dML-O"})(z);z.propTypes={checked:A().bool,label:A().string,onChange:A().func,theme:V.themeType.isRequired},z.defaultProps={checked:void 0,label:void 0,onChange:void 0};var Q=V,J=__webpack_require__(715);function Z(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=document.getElementById("react-view"),r=(0,O.jsx)(L.GlobalStateProvider,{initialState:window.ISTATE,children:(0,O.jsx)(I.BrowserRouter,{children:(0,O.jsx)(e,{})})});t.dontHydrate?(0,J.createRoot)(n).render(r):(0,J.hydrateRoot)(n,r)}var $=__webpack_require__(467);function ee(e){let{filter:t,label:n,onChange:r,options:o,theme:i,value:a}=e;const c=[(0,O.jsx)("option",{className:i.hiddenOption,children:""},"__reactUtilsHiddenOption")];for(let e=0;e<o.length;++e){let n=o[e];t&&!t(n)||((0,$.isString)(n)&&(n={value:n}),c.push((0,O.jsx)("option",{className:i.option,value:n.value,children:void 0===n.name?n.value:n.name},n.value)))}return(0,O.jsxs)("div",{className:i.container,children:[void 0===n?null:(0,O.jsx)("p",{className:i.label,children:n}),(0,O.jsx)("select",{className:i.select,onChange:r,value:a,children:c}),(0,O.jsx)("div",{className:i.arrow,children:"▼"})]})}const te=t()("Dropdown",["arrow","container","hiddenOption","label","option","select"],{arrow:"-zPK7Y",context:"haRIry",ad:"D4XHG2",hoc:"N3nd34",container:"_9CQpeA",label:"Gv0kyu",hiddenOption:"RdW3yR",select:"JXK1uw"})(ee);ee.propTypes={filter:A().func,label:A().string,onChange:A().func,options:A().arrayOf(A().oneOfType([A().shape({name:A().node,value:A().string.isRequired}),A().string]).isRequired),theme:te.themeType.isRequired,value:A().string},ee.defaultProps={filter:void 0,label:void 0,onChange:void 0,options:[],value:void 0};var ne=te;function re(e){let{label:t,theme:n,...r}=e;return(0,O.jsxs)("div",{className:n.container,children:[void 0===t?null:(0,O.jsx)("p",{className:n.label,children:t}),(0,O.jsx)("input",{className:n.input,...r})]})}const oe=t()("Input",["container","input","label"],{container:"Cxx397",context:"X5WszA",ad:"_8s7GCr",hoc:"TVlBYc",input:"M07d4s",label:"gfbdq-"})(re);re.propTypes={label:A().string,theme:oe.themeType.isRequired},re.defaultProps={label:void 0};var ie=oe;function ae(e){let{children:t,leftSidePanelContent:n,rightSidePanelContent:r,theme:o}=e;return(0,O.jsxs)("div",{className:o.container,children:[(0,O.jsx)("div",{className:[o.sidePanel,o.leftSidePanel].join(" "),children:n}),(0,O.jsx)("div",{className:o.mainPanel,children:t}),(0,O.jsx)("div",{className:[o.sidePanel,o.rightSidePanel].join(" "),children:r})]})}const ce=t()("PageLayout",["container","leftSidePanel","mainPanel","rightSidePanel","sidePanel"],{container:"T3cuHB",context:"m4mL-M",ad:"m3-mdC",hoc:"J15Z4H",mainPanel:"pPlQO2",sidePanel:"lqNh4h"})(ae);ae.propTypes={children:A().node,leftSidePanelContent:A().node,rightSidePanelContent:A().node,theme:ce.themeType.isRequired},ae.defaultProps={children:null,leftSidePanelContent:null,rightSidePanelContent:null};var le=ce,se=__webpack_require__(383);const ue=(0,q.createContext)();function _e(e){let{children:t,description:n,image:r,siteName:o,socialDescription:i,socialTitle:a,title:c,url:l}=e;const s=a||c,u=i||n,_=(0,q.useMemo)((()=>({description:n,image:r,siteName:o,socialDescription:i,socialTitle:a,title:c,url:l})),[n,r,o,i,a,c,l]);return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(se.Helmet,{children:[(0,O.jsx)("title",{children:c}),(0,O.jsx)("meta",{name:"description",content:n}),(0,O.jsx)("meta",{name:"twitter:card",content:"summary_large_image"}),(0,O.jsx)("meta",{name:"twitter:title",content:s}),(0,O.jsx)("meta",{name:"twitter:description",content:u}),r?(0,O.jsx)("meta",{name:"twitter:image",content:r}):null,o?(0,O.jsx)("meta",{name:"twitter:site",content:"@".concat(o)}):null,(0,O.jsx)("meta",{name:"og:title",content:s}),r?(0,O.jsx)("meta",{name:"og:image",content:r}):null,r?(0,O.jsx)("meta",{name:"og:image:alt",content:s}):null,(0,O.jsx)("meta",{name:"og:description",content:u}),o?(0,O.jsx)("meta",{name:"og:sitename",content:o}):null,l?(0,O.jsx)("meta",{name:"og:url",content:l}):null]}),t?(0,O.jsx)(ue.Provider,{value:_,children:t}):null]})}_e.Context=ue,_e.defaultProps={children:null,image:null,siteName:null,socialDescription:null,socialTitle:null,url:null},_e.propTypes={children:A().node,description:A().string.isRequired,image:A().string,siteName:A().string,socialDescription:A().string,socialTitle:A().string,title:A().string.isRequired,url:A().string};var de=__webpack_require__(111),pe=__webpack_require__.n(de);function he(e){let{children:t,onCancel:n,theme:r}=e;const o=(0,q.useRef)(),i=(0,q.useRef)(),[a,c]=(0,q.useState)();(0,q.useEffect)((()=>{const e=document.createElement("div");return document.body.classList.add("scrolling-disabled-by-modal"),document.body.appendChild(e),c(e),()=>{document.body.classList.remove("scrolling-disabled-by-modal"),document.body.removeChild(e)}}),[]);const l=(0,q.useMemo)((()=>(0,O.jsx)("div",{onFocus:()=>{const e=o.current.querySelectorAll("*");for(let t=e.length-1;t>=0;--t)if(e[t].focus(),document.activeElement===e[t])return;i.current.focus()},tabIndex:"0"})),[]);return a?pe().createPortal((0,O.jsxs)(O.Fragment,{children:[l,(0,O.jsx)("div",{"aria-label":"Cancel",className:r.overlay,onClick:()=>n(),onKeyDown:e=>{"Escape"===e.key&&n()},ref:e=>{e&&e!==i.current&&(i.current=e,e.focus())},role:"button",tabIndex:"0"}),(0,O.jsx)("div",{"aria-modal":"true",className:r.container,onWheel:e=>e.stopPropagation(),ref:o,role:"dialog",children:t}),(0,O.jsx)("div",{onFocus:()=>{i.current.focus()},tabIndex:"0"}),l]}),a):null}const fe=t()("Modal",["container","overlay"],{overlay:"ye2BZo",context:"Szmbbz",ad:"Ah-Nsc",hoc:"Wki41G",container:"gyZ4rc"})(he);he.propTypes={onCancel:A().func,children:A().node,theme:fe.themeType.isRequired},he.defaultProps={onCancel:$.noop,children:null};var me=fe;function be(e){return(0,O.jsx)(K,{...e,routerLinkType:I.NavLink})}function Ee(e){let{children:t,className:n,ratio:r}=e;const o=r.split(":"),i="".concat(100*o[1]/o[0],"%"),a=(0,O.jsx)("div",{style:{paddingBottom:i},className:"EznFz3",children:(0,O.jsx)("div",{className:"_0vb7tq",children:t})});return n?(0,O.jsx)("div",{className:n,children:a}):a}function we(e){let{theme:t}=e;return(0,O.jsxs)("div",{className:(t.container?t.container+" ":"")+"_7zdld4",children:[(0,O.jsx)("div",{className:(t.circle?t.circle+" ":"")+"dBrB4g"}),(0,O.jsx)("div",{className:(t.circle?t.circle+" ":"")+"dBrB4g"}),(0,O.jsx)("div",{className:(t.circle?t.circle+" ":"")+"dBrB4g"})]})}Ee.defaultProps={children:null,className:null,ratio:"1:1"},Ee.propTypes={children:A().node,className:A().string,ratio:A().string},we.defaultProps={theme:{}},we.propTypes={theme:A().shape({container:A().string,circle:A().string})};var ve=t()("Throbber",["circle","container"],{container:"_7zdld4",context:"uIObt7",ad:"XIxe9o",hoc:"YOyORH",circle:"dBrB4g",bouncing:"TJe-6j"})(we);const ge={ABOVE_CURSOR:"ABOVE_CURSOR",ABOVE_ELEMENT:"ABOVE_ELEMENT",BELOW_CURSOR:"BELOW_CURSOR",BELOW_ELEMENT:"BELOW_ELEMENT"},ye=["border-bottom-color:transparent","border-left-color:transparent","border-right-color:transparent"].join(";"),xe=["border-top-color:transparent","border-left-color:transparent","border-right-color:transparent"].join(";");const Te=(0,q.forwardRef)(((e,t)=>{let{children:n,theme:r}=e;const[o,i]=(0,q.useState)(null),a=(e,t,n,r)=>o&&function(e,t,n,r,o){const i=function(e){return{arrow:e.arrow.getBoundingClientRect(),container:e.container.getBoundingClientRect()}}(o),a=function(){const{pageXOffset:e,pageYOffset:t}=window,{documentElement:{clientHeight:n,clientWidth:r}}=document;return{left:e,right:e+r,top:t,bottom:t+n}}(),c=function(e,t,n){const{arrow:r,container:o}=n;return{arrowX:.5*(o.width-r.width),arrowY:o.height,containerX:e-o.width/2,containerY:t-o.height-r.height/1.5,baseArrowStyle:ye}}(e,t,i);if(c.containerX<a.left+6)c.containerX=a.left+6,c.arrowX=Math.max(6,e-c.containerX-i.arrow.width/2);else{const t=a.right-6-i.container.width;c.containerX>t&&(c.containerX=t,c.arrowX=Math.min(i.container.width-6,e-c.containerX-i.arrow.width/2))}c.containerY<a.top+6&&(c.containerY+=i.container.height+2*i.arrow.height,c.arrowY-=i.container.height+i.arrow.height,c.baseArrowStyle=xe);const l="left:".concat(c.containerX,"px;top:").concat(c.containerY,"px");o.container.setAttribute("style",l);const s="".concat(c.baseArrowStyle,";left:").concat(c.arrowX,"px;top:").concat(c.arrowY,"px");o.arrow.setAttribute("style",s)}(e,t,0,0,o);return(0,q.useImperativeHandle)(t,(()=>({pointTo:a}))),(0,q.useEffect)((()=>{const e=function(e){const t=document.createElement("div");e.arrow&&t.setAttribute("class",e.arrow);const n=document.createElement("div");e.content&&n.setAttribute("class",e.content);const r=document.createElement("div");return e.container&&r.setAttribute("class",e.container),r.appendChild(t),r.appendChild(n),document.body.appendChild(r),{container:r,arrow:t,content:n}}(r);return i(e),()=>{document.body.removeChild(e.container),i(null)}}),[r]),o?(0,de.createPortal)(n,o.content):null}));Te.propTypes={children:A().node,theme:A().shape().isRequired},Te.defaultProps={children:null};var ke=Te;function Ce(e){let{children:t,placement:n,tip:r,theme:o}=e;const i=(0,q.useRef)(),a=(0,q.useRef)(),[c,l]=(0,q.useState)(!1);return(0,q.useEffect)((()=>{if(c&&null!==r){const e=()=>l(!1);return window.addEventListener("scroll",e),()=>window.removeEventListener("scroll",e)}}),[c,r]),(0,O.jsxs)("div",{className:o.wrapper,onMouseLeave:()=>l(!1),onMouseMove:e=>((e,t)=>{if(c){const r=a.current.getBoundingClientRect();e<r.left||e>r.right||t<r.top||t>r.bottom?l(!1):i.current&&i.current.pointTo(e+window.pageXOffset,t+window.pageYOffset,n,a.current)}else l(!0)})(e.clientX,e.clientY),ref:a,children:[c&&null!==r?(0,O.jsx)(ke,{ref:i,theme:o,children:r}):null,t]})}const Pe=t()("WithTooltip",["appearance","arrow","container","content","wrapper"],{arrow:"M9gywF",ad:"_4xT7zE",hoc:"zd-vnH",context:"GdZucr",container:"f9gY8K",appearance:"L4ubm-",wrapper:"_4qDBRM"})(Ce);Pe.PLACEMENTS=ge,Ce.propTypes={children:A().node,placement:A().oneOf(Object.values(ge)),theme:Pe.themeType.isRequired,tip:A().node},Ce.defaultProps={children:null,placement:ge.ABOVE_CURSOR,tip:null};var Se=Pe,Ne=__webpack_require__(656),qe=__webpack_require__.n(Ne),Re={container:"jTxmOX",context:"dzIcLh",ad:"_5a9XX1",hoc:"_7sH52O"};function Ae(e){let{autoplay:t,src:n,theme:r,title:o}=e,[i,a]=n.split("?");a=a?qe().parse(a):{};const c=a.v||i.match(/\/([a-zA-Z0-9-_]*)$/)[1];return i="https://www.youtube.com/embed/".concat(c),delete a.v,a.autoplay=t?1:0,i+="?".concat(qe().stringify(a)),(0,O.jsxs)(Ee,{className:r.container,ratio:"16:9",children:[(0,O.jsx)(ve,{theme:Re}),(0,O.jsx)("iframe",{allow:"autoplay",allowFullScreen:!0,className:r.video,src:i,title:o})]})}const Le=t()("YouTubeVideo",["container","video"],{container:"sXHM81",context:"veKyYi",ad:"r3ABzd",hoc:"YKcPnR",video:"SlV2zw"})(Ae);Ae.propTypes={autoplay:A().bool,src:A().string.isRequired,theme:Le.themeType.isRequired,title:A().string},Ae.defaultProps={autoplay:!1,title:""};var Oe=Le;const je=n.requireWeak("./server","/")}(),__webpack_exports__}()}));
|
|
3
3
|
//# sourceMappingURL=web.bundle.js.map
|