@dr.pogodin/react-utils 1.43.25 → 1.43.26
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/bin/build.js +3 -3
- package/bin/setup.js +3 -3
- package/build/development/server/index.js +4 -4
- package/build/development/server/index.js.map +1 -1
- package/build/development/server/renderer.js +12 -12
- package/build/development/server/renderer.js.map +1 -1
- package/build/development/server/server.js +3 -3
- package/build/development/server/server.js.map +1 -1
- package/build/development/shared/components/Input/index.js.map +1 -1
- package/build/development/shared/components/PageLayout/index.js.map +1 -1
- package/build/development/shared/components/TextArea/index.js.map +1 -1
- package/build/development/shared/components/Throbber/index.js.map +1 -1
- package/build/development/shared/components/WithTooltip/Tooltip.js.map +1 -1
- package/build/development/shared/components/selectors/Switch/index.js.map +1 -1
- package/build/development/shared/components/selectors/common.js.map +1 -1
- package/build/development/shared/utils/jest/E2eSsrEnv.js +4 -4
- package/build/development/shared/utils/jest/E2eSsrEnv.js.map +1 -1
- package/build/development/shared/utils/jest/index.js.map +1 -1
- package/build/development/shared/utils/webpack.js.map +1 -1
- package/build/production/server/index.js +2 -2
- package/build/production/server/index.js.map +1 -1
- package/build/production/server/renderer.js +7 -7
- package/build/production/server/renderer.js.map +1 -1
- package/build/production/server/server.js +2 -2
- package/build/production/server/server.js.map +1 -1
- package/build/production/shared/components/Input/index.js.map +1 -1
- package/build/production/shared/components/PageLayout/index.js.map +1 -1
- package/build/production/shared/components/TextArea/index.js.map +1 -1
- package/build/production/shared/components/Throbber/index.js.map +1 -1
- package/build/production/shared/components/WithTooltip/Tooltip.js.map +1 -1
- package/build/production/shared/components/selectors/Switch/index.js.map +1 -1
- package/build/production/shared/components/selectors/common.js.map +1 -1
- package/build/production/shared/utils/jest/E2eSsrEnv.js +4 -4
- package/build/production/shared/utils/jest/E2eSsrEnv.js.map +1 -1
- package/build/production/shared/utils/jest/index.js.map +1 -1
- package/build/production/shared/utils/webpack.js.map +1 -1
- package/build/production/web.bundle.js +1 -1
- package/build/production/web.bundle.js.map +1 -1
- package/build/types-code/server/index.d.ts +1 -1
- package/config/jest/default.js +1 -1
- package/config/webpack/app-base.d.ts +1 -1
- package/config/webpack/app-base.js +14 -14
- package/config/webpack/lib-base.js +5 -5
- package/config/webpack/lib-development.js +2 -2
- package/config/webpack/lib-production.js +2 -2
- package/package.json +3 -3
- package/src/server/index.ts +5 -5
- package/src/server/renderer.tsx +8 -6
- package/src/server/server.ts +3 -4
- package/src/shared/components/Input/index.tsx +1 -4
- package/src/shared/components/PageLayout/index.tsx +1 -5
- package/src/shared/components/TextArea/index.tsx +1 -5
- package/src/shared/components/Throbber/index.tsx +1 -4
- package/src/shared/components/WithTooltip/Tooltip.ts +1 -5
- package/src/shared/components/selectors/Switch/index.tsx +1 -6
- package/src/shared/components/selectors/common.ts +1 -2
- package/src/shared/utils/jest/E2eSsrEnv.ts +1 -1
- package/src/shared/utils/jest/index.ts +3 -2
- package/src/shared/utils/webpack.ts +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"E2eSsrEnv.js","names":["_path","_interopRequireDefault","require","_lodash","_experimentalWorker","_jestEnvironmentJsdom","_memfs","_webpack","_renderer","_buildInfo","E2eSsrEnv","JsdomEnv","loadWebpackConfig","optionsString","pragmas","options","JSON","parse","defaults","context","testFolder","fs","global","webpackOutputFs","factoryPath","factory","path","resolve","rootDir","default","webpackConfig","buildInfo","existsSync","readFileSync","runWebpack","Error","compiler","webpack","outputFileSystem","Promise","done","fail","run","err","stats","hasErrors","console","error","toJson","errors","webpackStats","runSsr","logger","debug","noop","info","log","warn","cleanup","entry","p","module","exportName","entryExportName","Application","renderer","ssrFactory","status","markup","ssrRequest","cookie","send","set","value","locals","devMiddleware","ssrMarkup","ssrOptions","ssrStatus","constructor","config","docblockPragmas","requestString","request","url","csrfToken","projectConfig","dom","createFsFromVolume","Volume","dirname","testPath","withSsr","root","process","cwd","register","envName","babelEnv","extensions","setup","cache","setBuildInfo","undefined","REACT_UTILS_FORCE_CLIENT_SIDE","teardown","Object","keys","forEach","key","revert","exports"],"sources":["../../../../../src/shared/utils/jest/E2eSsrEnv.ts"],"sourcesContent":["/**\n * Jest environment for end-to-end SSR and client-side testing. It relies on\n * the standard react-utils mechanics to execute SSR of given scene, and also\n * Webpack build of the code for client-side execution, it further exposes\n * Jsdom environment for the client-side testing of the outcomes.\n */\n\n// BEWARE: The module is not imported into the JU module / the main assembly of\n// the library, because doing so easily breaks stuff:\n// 1) This module depends on Node-specific modules, which would make JU\n// incompatible with JsDom if included into JU.\n// 2) If this module is weakly imported from somewhere else in the lib,\n// it seems to randomly break tests using it for a different reason,\n// probably some sort of a require-loop, or some issues with weak\n// require in that scenario.\n\n// TODO: We need to add correct typing for environment options.\n\nimport path from 'path';\n\nimport type { Request, Response } from 'express';\nimport { defaults, noop, set } from 'lodash';\nimport type { ReactNode } from 'react';\n\n// As this environment is a part of the Jest testing utils,\n// we assume development dependencies are available when it is used.\n/* eslint-disable import/no-extraneous-dependencies */\nimport register from '@babel/register/experimental-worker';\n\nimport JsdomEnv from 'jest-environment-jsdom';\nimport { Volume, createFsFromVolume } from 'memfs';\nimport webpack, { type Configuration } from 'webpack';\n/* eslint-enable import/no-extraneous-dependencies */\n\nimport type {\n EnvironmentContext,\n JestEnvironmentConfig,\n} from '@jest/environment';\n\nimport ssrFactory from 'server/renderer';\n\nimport { setBuildInfo } from '../isomorphy/buildInfo';\n\nexport default class E2eSsrEnv extends JsdomEnv {\n pragmas: Record<string, string | string[]>;\n\n ssrRequest: object;\n\n rootDir: string;\n\n testFolder: string;\n\n withSsr: boolean;\n\n webpackStats?: webpack.StatsCompilation;\n\n /**\n * Loads Webpack config, and exposes it to the environment via global\n * webpackConfig object.\n */\n private loadWebpackConfig() {\n const optionsString = this.pragmas['webpack-config-options'] as string;\n\n const options = (optionsString ? JSON.parse(optionsString) : {}) as\n webpack.Configuration;\n\n defaults(options, {\n context: this.testFolder,\n fs: this.global.webpackOutputFs,\n });\n\n const factoryPath = this.pragmas['webpack-config-factory'] as string;\n // eslint-disable-next-line import/no-dynamic-require, @typescript-eslint/no-require-imports\n let factory = require(path.resolve(this.rootDir, factoryPath)) as\n (((ops: Configuration) => Configuration) | {\n default: (ops: Configuration) => Configuration;\n });\n factory = 'default' in factory ? factory.default : factory;\n\n this.global.webpackConfig = factory(options);\n\n const fs = this.global.webpackOutputFs;\n let buildInfo = `${options.context}/.build-info`;\n if (fs.existsSync(buildInfo)) {\n buildInfo = fs.readFileSync(buildInfo, 'utf8') as string;\n this.global.buildInfo = JSON.parse(buildInfo);\n }\n }\n\n /**\n * Executes Webpack build.\n * @return {Promise}\n */\n async runWebpack(): Promise<void> {\n this.loadWebpackConfig();\n\n if (!this.global.webpackConfig) throw Error('Failed to load Webpack config');\n const compiler = webpack(this.global.webpackConfig);\n\n // TODO: The \"as typeof compiler.outputFileSystem\" piece below is\n // a workaround for the Webpack regression:\n // https://github.com/webpack/webpack/issues/18242\n compiler.outputFileSystem = this.global.webpackOutputFs as\n typeof compiler.outputFileSystem;\n\n return new Promise<void>((done, fail) => {\n compiler.run((err, stats) => {\n if (err) fail(err);\n if (stats?.hasErrors()) {\n // eslint-disable-next-line no-console\n console.error(stats.toJson().errors);\n fail(Error('Webpack compilation failed'));\n }\n\n this.global.webpackStats = stats?.toJson();\n\n // Keeps reference to the raw Webpack stats object, which should be\n // explicitly passed to the server-side renderer alongside the request,\n // so that it can to pick up asset paths for different named chunks.\n this.webpackStats = stats;\n\n done();\n });\n });\n }\n\n async runSsr(): Promise<void> {\n const optionsString = this.pragmas['ssr-options'] as string;\n const options = optionsString\n ? JSON.parse(optionsString) as Record<string, unknown>\n : {};\n\n // TODO: This is temporary to shortcut the logging added to SSR.\n options.logger ??= {\n debug: noop,\n info: noop,\n log: noop,\n warn: noop,\n };\n\n options.buildInfo ??= this.global.buildInfo;\n\n let cleanup: (() => void) | undefined;\n\n if (options.entry) {\n const p = path.resolve(this.testFolder, options.entry as string);\n // TODO: This sure can be replaced by a dynamic import().\n // eslint-disable-next-line import/no-dynamic-require, @typescript-eslint/no-require-imports\n const module = require(p) as NodeJS.Module;\n if ('cleanup' in module) cleanup = module.cleanup as () => void;\n\n const exportName = (options.entryExportName as string) || 'default';\n if (exportName in module) {\n options.Application = (\n module as unknown as Record<string, unknown>\n )[exportName] as ReactNode;\n }\n }\n\n const renderer = ssrFactory(this.global.webpackConfig!, options);\n let status = 200; // OK\n const markup = await new Promise<string>((done, fail) => {\n void renderer(\n this.ssrRequest as Request,\n\n // TODO: This will do for now, with the current implementation of\n // the renderer, but it will require a rework once the renderer is\n // updated to do streaming.\n ({\n cookie: noop,\n send: done,\n set: noop,\n status: (value: number) => {\n status = value;\n },\n\n // This is how up-to-date Webpack stats are passed to the server in\n // development mode, and we use this here always, instead of having\n // to pass some information via filesystem.\n locals: {\n webpack: {\n devMiddleware: {\n stats: this.webpackStats,\n },\n },\n },\n } as unknown) as Response,\n\n (error) => {\n // TODO: Strictly speaking, that error as Error casting is not all\n // correct, but it works, so no need to spend time on it right now.\n if (error) fail(error as Error);\n else done('');\n },\n );\n });\n\n this.global.ssrMarkup = markup;\n this.global.ssrOptions = options;\n this.global.ssrStatus = status;\n\n if (cleanup) cleanup();\n }\n\n constructor(\n config: JestEnvironmentConfig,\n context: EnvironmentContext,\n ) {\n const pragmas = context.docblockPragmas;\n\n const requestString = pragmas['ssr-request'] as string;\n const request = requestString\n ? JSON.parse(requestString) as Record<string, unknown>\n : {};\n\n request.url ??= '/';\n request.csrfToken = noop;\n\n // This ensures the initial JsDom URL matches the value we use for SSR.\n set(\n config.projectConfig,\n 'testEnvironmentOptions.url',\n `http://localhost${request.url as string}`,\n );\n\n super(config, context);\n\n this.global.dom = this.dom;\n this.global.webpackOutputFs = createFsFromVolume(new Volume());\n\n // Extracts necessary settings from config and context.\n const { projectConfig } = config;\n this.rootDir = projectConfig.rootDir;\n this.testFolder = path.dirname(context.testPath);\n this.withSsr = !pragmas['no-ssr'];\n this.ssrRequest = request;\n this.pragmas = pragmas;\n\n // The usual \"babel-jest\" transformation setup does not apply to\n // the environment code and imports from it, this workaround enables it.\n const optionsString = this.pragmas['ssr-options'] as string;\n const options = optionsString\n ? JSON.parse(optionsString) as Record<string, unknown>\n : {};\n let root;\n switch (options.root) {\n case 'TEST':\n root = this.testFolder;\n break;\n default: root = process.cwd();\n }\n register({\n envName: options.babelEnv as string,\n extensions: ['.js', '.jsx', '.ts', '.tsx', '.svg'],\n root,\n });\n }\n\n async setup(): Promise<void> {\n await super.setup();\n await this.runWebpack();\n\n // NOTE: It is possible that the Webpack run above, and the SSR run below\n // load different versions of the same module (CommonJS, and ES), and it may\n // cause very confusing problems (e.g. see:\n // https://github.com/birdofpreyru/react-utils/issues/413).\n // It seems we can't reset the cache of ES modules, and Jest's module reset\n // does not reset modules loaded in this enviroment module, and also only\n // replacing entire cache object by and empty {} seems to help (in contrast\n // to deleting all entries by their keys, as it is done within .teardown()\n // method below). Thus, for now we do this as a hotfix, and we also reset\n // build info to undefined, because ES module version not beeing reset\n // triggers an error on the subsequent test using the environment.\n // TODO: Look for a cleaner solution.\n require.cache = {};\n setBuildInfo(undefined, true);\n\n if (this.withSsr) await this.runSsr();\n this.global.REACT_UTILS_FORCE_CLIENT_SIDE = true;\n }\n\n async teardown(): Promise<void> {\n delete this.global.REACT_UTILS_FORCE_CLIENT_SIDE;\n\n // Resets module cache and @babel/register. Effectively this ensures that\n // the next time an instance of this environment is set up, all modules are\n // transformed by Babel from scratch, thus taking into account the latest\n // Babel config (which may change between different environment instances,\n // which does not seem to be taken into account by Babel / Node caches\n // automatically).\n Object.keys(require.cache).forEach((key) => {\n delete require.cache[key];\n });\n register.revert();\n await super.teardown();\n }\n}\n"],"mappings":"gLAkBA,IAAAA,KAAA,CAAAC,sBAAA,CAAAC,OAAA,UAGA,IAAAC,OAAA,CAAAD,OAAA,WAMA,IAAAE,mBAAA,CAAAH,sBAAA,CAAAC,OAAA,yCAEA,IAAAG,qBAAA,CAAAJ,sBAAA,CA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A;AACA;AACA;AACA;AACA;AACAE,MAAM,CAACC,IAAI,CAACzG,OAAO,CAACmG,KAAK,CAAC,CAACO,OAAO,CAAEC,GAAG,EAAK,CAC1C,MAAO,CAAA3G,OAAO,CAACmG,KAAK,CAACQ,GAAG,CAC1B,CAAC,CAAC,CACFb,2BAAQ,CAACc,MAAM,CAAC,CAAC,CACjB,KAAM,MAAK,CAACL,QAAQ,CAAC,CACvB,CACF,CAACM,OAAA,CAAAlF,OAAA,CAAAnB,SAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"E2eSsrEnv.js","names":["_nodePath","_interopRequireDefault","require","_lodash","_experimentalWorker","_jestEnvironmentJsdom","_memfs","_webpack","_renderer","_buildInfo","E2eSsrEnv","JsdomEnv","loadWebpackConfig","optionsString","pragmas","options","JSON","parse","defaults","context","testFolder","fs","global","webpackOutputFs","factoryPath","factory","path","resolve","rootDir","default","webpackConfig","buildInfo","existsSync","readFileSync","runWebpack","Error","compiler","webpack","outputFileSystem","Promise","done","fail","run","err","stats","hasErrors","console","error","toJson","errors","webpackStats","runSsr","logger","debug","noop","info","log","warn","cleanup","entry","p","module","exportName","entryExportName","Application","renderer","ssrFactory","status","markup","ssrRequest","cookie","send","set","value","locals","devMiddleware","ssrMarkup","ssrOptions","ssrStatus","constructor","config","docblockPragmas","requestString","request","url","csrfToken","projectConfig","dom","createFsFromVolume","Volume","dirname","testPath","withSsr","root","process","cwd","register","envName","babelEnv","extensions","setup","cache","setBuildInfo","undefined","REACT_UTILS_FORCE_CLIENT_SIDE","teardown","Object","keys","forEach","key","revert","exports"],"sources":["../../../../../src/shared/utils/jest/E2eSsrEnv.ts"],"sourcesContent":["/**\n * Jest environment for end-to-end SSR and client-side testing. It relies on\n * the standard react-utils mechanics to execute SSR of given scene, and also\n * Webpack build of the code for client-side execution, it further exposes\n * Jsdom environment for the client-side testing of the outcomes.\n */\n\n// BEWARE: The module is not imported into the JU module / the main assembly of\n// the library, because doing so easily breaks stuff:\n// 1) This module depends on Node-specific modules, which would make JU\n// incompatible with JsDom if included into JU.\n// 2) If this module is weakly imported from somewhere else in the lib,\n// it seems to randomly break tests using it for a different reason,\n// probably some sort of a require-loop, or some issues with weak\n// require in that scenario.\n\n// TODO: We need to add correct typing for environment options.\n\nimport path from 'node:path';\n\nimport type { Request, Response } from 'express';\nimport { defaults, noop, set } from 'lodash';\nimport type { ReactNode } from 'react';\n\n// As this environment is a part of the Jest testing utils,\n// we assume development dependencies are available when it is used.\n/* eslint-disable import/no-extraneous-dependencies */\nimport register from '@babel/register/experimental-worker';\n\nimport JsdomEnv from 'jest-environment-jsdom';\nimport { Volume, createFsFromVolume } from 'memfs';\nimport webpack, { type Configuration } from 'webpack';\n/* eslint-enable import/no-extraneous-dependencies */\n\nimport type {\n EnvironmentContext,\n JestEnvironmentConfig,\n} from '@jest/environment';\n\nimport ssrFactory from 'server/renderer';\n\nimport { setBuildInfo } from '../isomorphy/buildInfo';\n\nexport default class E2eSsrEnv extends JsdomEnv {\n pragmas: Record<string, string | string[]>;\n\n ssrRequest: object;\n\n rootDir: string;\n\n testFolder: string;\n\n withSsr: boolean;\n\n webpackStats?: webpack.StatsCompilation;\n\n /**\n * Loads Webpack config, and exposes it to the environment via global\n * webpackConfig object.\n */\n private loadWebpackConfig() {\n const optionsString = this.pragmas['webpack-config-options'] as string;\n\n const options = (optionsString ? JSON.parse(optionsString) : {}) as\n webpack.Configuration;\n\n defaults(options, {\n context: this.testFolder,\n fs: this.global.webpackOutputFs,\n });\n\n const factoryPath = this.pragmas['webpack-config-factory'] as string;\n // eslint-disable-next-line import/no-dynamic-require, @typescript-eslint/no-require-imports\n let factory = require(path.resolve(this.rootDir, factoryPath)) as\n (((ops: Configuration) => Configuration) | {\n default: (ops: Configuration) => Configuration;\n });\n factory = 'default' in factory ? factory.default : factory;\n\n this.global.webpackConfig = factory(options);\n\n const fs = this.global.webpackOutputFs;\n let buildInfo = `${options.context}/.build-info`;\n if (fs.existsSync(buildInfo)) {\n buildInfo = fs.readFileSync(buildInfo, 'utf8') as string;\n this.global.buildInfo = JSON.parse(buildInfo);\n }\n }\n\n /**\n * Executes Webpack build.\n * @return {Promise}\n */\n async runWebpack(): Promise<void> {\n this.loadWebpackConfig();\n\n if (!this.global.webpackConfig) throw Error('Failed to load Webpack config');\n const compiler = webpack(this.global.webpackConfig);\n\n // TODO: The \"as typeof compiler.outputFileSystem\" piece below is\n // a workaround for the Webpack regression:\n // https://github.com/webpack/webpack/issues/18242\n compiler.outputFileSystem = this.global.webpackOutputFs as\n typeof compiler.outputFileSystem;\n\n return new Promise<void>((done, fail) => {\n compiler.run((err, stats) => {\n if (err) fail(err);\n if (stats?.hasErrors()) {\n // eslint-disable-next-line no-console\n console.error(stats.toJson().errors);\n fail(Error('Webpack compilation failed'));\n }\n\n this.global.webpackStats = stats?.toJson();\n\n // Keeps reference to the raw Webpack stats object, which should be\n // explicitly passed to the server-side renderer alongside the request,\n // so that it can to pick up asset paths for different named chunks.\n this.webpackStats = stats;\n\n done();\n });\n });\n }\n\n async runSsr(): Promise<void> {\n const optionsString = this.pragmas['ssr-options'] as string;\n const options = optionsString\n ? JSON.parse(optionsString) as Record<string, unknown>\n : {};\n\n // TODO: This is temporary to shortcut the logging added to SSR.\n options.logger ??= {\n debug: noop,\n info: noop,\n log: noop,\n warn: noop,\n };\n\n options.buildInfo ??= this.global.buildInfo;\n\n let cleanup: (() => void) | undefined;\n\n if (options.entry) {\n const p = path.resolve(this.testFolder, options.entry as string);\n // TODO: This sure can be replaced by a dynamic import().\n // eslint-disable-next-line import/no-dynamic-require, @typescript-eslint/no-require-imports\n const module = require(p) as NodeJS.Module;\n if ('cleanup' in module) cleanup = module.cleanup as () => void;\n\n const exportName = (options.entryExportName as string) || 'default';\n if (exportName in module) {\n options.Application = (\n module as unknown as Record<string, unknown>\n )[exportName] as ReactNode;\n }\n }\n\n const renderer = ssrFactory(this.global.webpackConfig!, options);\n let status = 200; // OK\n const markup = await new Promise<string>((done, fail) => {\n void renderer(\n this.ssrRequest as Request,\n\n // TODO: This will do for now, with the current implementation of\n // the renderer, but it will require a rework once the renderer is\n // updated to do streaming.\n ({\n cookie: noop,\n send: done,\n set: noop,\n status: (value: number) => {\n status = value;\n },\n\n // This is how up-to-date Webpack stats are passed to the server in\n // development mode, and we use this here always, instead of having\n // to pass some information via filesystem.\n locals: {\n webpack: {\n devMiddleware: {\n stats: this.webpackStats,\n },\n },\n },\n } as unknown) as Response,\n\n (error) => {\n // TODO: Strictly speaking, that error as Error casting is not all\n // correct, but it works, so no need to spend time on it right now.\n if (error) fail(error as Error);\n else done('');\n },\n );\n });\n\n this.global.ssrMarkup = markup;\n this.global.ssrOptions = options;\n this.global.ssrStatus = status;\n\n if (cleanup) cleanup();\n }\n\n constructor(\n config: JestEnvironmentConfig,\n context: EnvironmentContext,\n ) {\n const pragmas = context.docblockPragmas;\n\n const requestString = pragmas['ssr-request'] as string;\n const request = requestString\n ? JSON.parse(requestString) as Record<string, unknown>\n : {};\n\n request.url ??= '/';\n request.csrfToken = noop;\n\n // This ensures the initial JsDom URL matches the value we use for SSR.\n set(\n config.projectConfig,\n 'testEnvironmentOptions.url',\n `http://localhost${request.url as string}`,\n );\n\n super(config, context);\n\n this.global.dom = this.dom;\n this.global.webpackOutputFs = createFsFromVolume(new Volume());\n\n // Extracts necessary settings from config and context.\n const { projectConfig } = config;\n this.rootDir = projectConfig.rootDir;\n this.testFolder = path.dirname(context.testPath);\n this.withSsr = !pragmas['no-ssr'];\n this.ssrRequest = request;\n this.pragmas = pragmas;\n\n // The usual \"babel-jest\" transformation setup does not apply to\n // the environment code and imports from it, this workaround enables it.\n const optionsString = this.pragmas['ssr-options'] as string;\n const options = optionsString\n ? JSON.parse(optionsString) as Record<string, unknown>\n : {};\n let root;\n switch (options.root) {\n case 'TEST':\n root = this.testFolder;\n break;\n default: root = process.cwd();\n }\n register({\n envName: options.babelEnv as string,\n extensions: ['.js', '.jsx', '.ts', '.tsx', '.svg'],\n root,\n });\n }\n\n async setup(): Promise<void> {\n await super.setup();\n await this.runWebpack();\n\n // NOTE: It is possible that the Webpack run above, and the SSR run below\n // load different versions of the same module (CommonJS, and ES), and it may\n // cause very confusing problems (e.g. see:\n // https://github.com/birdofpreyru/react-utils/issues/413).\n // It seems we can't reset the cache of ES modules, and Jest's module reset\n // does not reset modules loaded in this enviroment module, and also only\n // replacing entire cache object by and empty {} seems to help (in contrast\n // to deleting all entries by their keys, as it is done within .teardown()\n // method below). Thus, for now we do this as a hotfix, and we also reset\n // build info to undefined, because ES module version not beeing reset\n // triggers an error on the subsequent test using the environment.\n // TODO: Look for a cleaner solution.\n require.cache = {};\n setBuildInfo(undefined, true);\n\n if (this.withSsr) await this.runSsr();\n this.global.REACT_UTILS_FORCE_CLIENT_SIDE = true;\n }\n\n async teardown(): Promise<void> {\n delete this.global.REACT_UTILS_FORCE_CLIENT_SIDE;\n\n // Resets module cache and @babel/register. Effectively this ensures that\n // the next time an instance of this environment is set up, all modules are\n // transformed by Babel from scratch, thus taking into account the latest\n // Babel config (which may change between different environment instances,\n // which does not seem to be taken into account by Babel / Node caches\n // automatically).\n Object.keys(require.cache).forEach((key) => {\n delete require.cache[key];\n });\n register.revert();\n await super.teardown();\n }\n}\n"],"mappings":"gLAkBA,IAAAA,SAAA,CAAAC,sBAAA,CAAAC,OAAA,eAGA,IAAAC,OAAA,CAAAD,OAAA,WAMA,IAAAE,mBAAA,CAAAH,sBAAA,CAAAC,OAAA,yCAEA,IAAAG,qBAAA,CAAAJ,sBAAA,CAAAC,OAAA,4BACA,IAAAI,MAAA,CAAAJ,OAAA,UACA,IAAAK,QAAA,CAAAN,sBAAA,CAAAC,OAAA,aAQA,IAAAM,SAAA,CAAAP,sBAAA,CAAAC,OAAA,8BAEA,IAAAO,UAAA,CAAAP,OAAA,2BAzCA;AACA;AACA;AACA;AACA;AACA,GAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAQA;AACA;AACA,sDAMA,qDAWe,KAAM,CAAAQ,SAAS,QA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AAnB,SAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_mockdate","_interopRequireDefault","require","_react","_client","_react2","_global","global","IS_REACT_ACT_ENVIRONMENT","originalProcessVersions","process","versions","mockClientSide","Object","defineProperty","value","undefined","unmockClientSide","writable","getMockUuid","seed","x","toString","padStart","slice","mockAxios","handlers","axios","jest","requireActual","defaults","adapter","config","handler","res","data","headers","status","statusText","console","warn","JSON","stringify","e","mockTimer","time","mockdate","set","Date","now","advanceTimersByTimeAsync","mount","scene","root","element","document","createElement","body","appendChild","destroy","act","unmount","remove","snapshot","expect","toMatchSnapshot","createRoot","render","options","promise","await","Error","Promise","resolve","then","nodes","asFragment","childNodes","length"],"sources":["../../../../../src/shared/utils/jest/index.ts"],"sourcesContent":["/* global jest, document */\n/* eslint-disable import/no-extraneous-dependencies */\n\nimport type {\n AxiosRequestConfig,\n AxiosResponse,\n AxiosStatic,\n InternalAxiosRequestConfig,\n} from 'axios';\n\nimport mockdate from 'mockdate';\nimport { type ReactElement, type ReactNode, act } from 'react';\nimport { type Root, createRoot } from 'react-dom/client';\n\nimport { type RenderResult, render } from '@testing-library/react';\n\n/**\n * An alias for [act(..)](https://reactjs.org/docs/test-utils.html#act)\n * from `react`.\n */\nexport { act };\n\nexport { default as getGlobal } from './global';\n\nglobal.IS_REACT_ACT_ENVIRONMENT = true;\n\nconst originalProcessVersions = process.versions;\n\n/**\n * Tricks **react-utils** into thinking the test is running within client-side\n * (browser) environment.\n */\nexport function mockClientSide(): void {\n Object.defineProperty(process, 'versions', { value: undefined });\n}\n\n/**\n * Reverts the effect of {@link module:JU.mockClientSide mockClientSide(..)}.\n */\nexport function unmockClientSide(): void {\n Object.defineProperty(process, 'versions', {\n value: originalProcessVersions,\n writable: false,\n });\n}\n\n/**\n * Generates a mock UUID, or better said it determenistically transforms given\n * `seed` number into a UUID-formatted string.\n * @param {number} seed\n * @return {string}\n */\nexport function getMockUuid(seed = 0): string {\n const x = seed.toString(16).padStart(32, '0');\n return `${x.slice(0, 8)}-${x.slice(8, 12)}-${x.slice(12, 16)}-${x.slice(16, 20)}-${x.slice(20)}`;\n}\n\nexport type AxiosRequestHandlerT =\n (config: AxiosRequestConfig) => Partial<AxiosResponse> | null | undefined;\n\nexport function mockAxios(handlers: AxiosRequestHandlerT[]): AxiosStatic {\n const axios: AxiosStatic = jest.requireActual('axios');\n\n axios.defaults.adapter = async (\n config: AxiosRequestConfig,\n ): Promise<AxiosResponse> => {\n for (const handler of handlers) {\n const res = handler(config);\n if (res) {\n return {\n config: config as InternalAxiosRequestConfig,\n data: null,\n headers: {},\n status: 200,\n statusText: 'OK',\n ...res,\n };\n }\n }\n\n // Fallback to the regular network request.\n let res: AxiosResponse;\n try {\n res = await axios({ ...config, adapter: ['xhr', 'http', 'fetch'] });\n // eslint-disable-next-line no-console\n console.warn(\n 'Network request has not been mocked for a test.\\n\\nConfig:\\n',\n config,\n '\\n\\nResult:\\n',\n JSON.stringify(res, null, 2),\n );\n } catch (e) {\n // eslint-disable-next-line no-console\n console.warn(\n 'Network request has not been mocked for a test, and failed.\\n\\nConfig:\\n',\n config,\n '\\n\\nError\\n',\n JSON.stringify(e, null, 2),\n );\n throw e;\n }\n\n return res;\n };\n\n return axios;\n}\n\n/**\n * Advances mock timers, and mock date by the specified time.\n * @param {number} time Time step [ms].\n * @returns {Promise} Wait for this to \"jump after\" any async code which should\n * be executed because of the mock time movement.\n */\nexport async function mockTimer(time: number): Promise<void> {\n mockdate.set(time + Date.now());\n await jest.advanceTimersByTimeAsync(time);\n}\n\nexport type MountedSceneT = HTMLElement & {\n destroy: () => void;\n snapshot: () => void;\n};\n\n/**\n * Mounts `scene` to the DOM, and returns the root scene element.\n * @param scene\n * @return Created container DOM element with destroy() function\n * attached.\n */\nexport function mount(scene: ReactNode): MountedSceneT {\n let root: Root;\n const element = document.createElement('div');\n document.body.appendChild(element);\n\n const res: MountedSceneT = (element as unknown) as MountedSceneT;\n res.destroy = () => {\n // NOTE: As it seems @testing-library may reset this flag to false\n // when it is simulating user events.\n global.IS_REACT_ACT_ENVIRONMENT = true;\n\n act(() => {\n root.unmount();\n });\n res.remove();\n };\n\n res.snapshot = () => {\n expect(res).toMatchSnapshot();\n };\n\n // NOTE: As it seems @testing-library may reset this flag to false\n // when it is simulating user events.\n global.IS_REACT_ACT_ENVIRONMENT = true;\n\n act(() => {\n root = createRoot(res);\n root.render(scene);\n });\n return res;\n}\n\n// NOTE: If in future we have additional options here, they should be distributed\n// across two objects, depending whether they are applicable to the sync, or async\n// versions of snapshot(), or both.\ntype AsyncSnapshotOptionsT = {\n await?: Promise<void>;\n};\n\nexport function snapshot(element: ReactElement): RenderResult;\n\nexport async function snapshot(\n element: ReactElement,\n options: AsyncSnapshotOptionsT,\n): Promise<RenderResult>;\n\nexport function snapshot(\n element: React.ReactElement,\n options?: AsyncSnapshotOptionsT,\n): Promise<RenderResult> | RenderResult {\n let res: RenderResult | undefined;\n\n // TODO: Just adding async to the actor function breaks stuff, as it makes\n // act() asynchronous no matter the `options.await` value, thus breaking all\n // calls that do not await for snapshot() result... thus... perhaps we need\n // to have a more complex typing to ensure it all works as intended in all\n // cases, and while being correctly enforced by TypeScript.\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n const promise = act(() => {\n res = render(element);\n return options?.await;\n });\n\n if (res === undefined) throw Error('Render failed');\n if (options?.await) {\n // BEWARE: Although `promise` is thenable (i.e. it has .then() method),\n // it is not an instance of proper Promise class, and returning it directly\n // breaks some async logic in Jest test or React test functions... thus, we\n // wrap it into Promise instance here.\n return new Promise((resolve) => {\n void promise.then(() => {\n // TODO: These lines are the same as the lines below for sync variant of\n // the function. We should split and reuse them in both places.\n const nodes = res!.asFragment().childNodes;\n expect(nodes.length > 1 ? [...nodes] : nodes[0]).toMatchSnapshot();\n resolve(res!);\n });\n });\n }\n\n const nodes = res.asFragment().childNodes;\n expect(nodes.length > 1 ? [...nodes] : nodes[0]).toMatchSnapshot();\n return res;\n}\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AI,CAAAE,OAAO,CAAEC,OAAO,EAAK,CAC9B,IAAK,CAAAJ,OAAO,CAACK,IAAI,CAAC,IAAM,CACtB;AACA;AACA,KAAM,CAAAC,KAAK,CAAGzC,GAAG,CAAE0C,UAAU,CAAC,CAAC,CAACC,UAAU,CAC1Cb,MAAM,CAACW,KAAK,CAACG,MAAM,CAAG,CAAC,CAAG,CAAC,GAAGH,KAAK,CAAC,CAAGA,KAAK,CAAC,CAAC,CAAC,CAAC,CAACV,eAAe,CAAC,CAAC,CAClEQ,OAAO,CAACvC,GAAI,CACd,CAAC,CACH,CAAC,CACH,CAEA,KAAM,CAAAyC,KAAK,CAAGzC,GAAG,CAAC0C,UAAU,CAAC,CAAC,CAACC,UAAU,CACzCb,MAAM,CAACW,KAAK,CAACG,MAAM,CAAG,CAAC,CAAG,CAAC,GAAGH,KAAK,CAAC,CAAGA,KAAK,CAAC,CAAC,CAAC,CAAC,CAACV,eAAe,CAAC,CAAC,CAClE,MAAO,CAAA/B,GACT","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_mockdate","_interopRequireDefault","require","_react","_client","_react2","_global","global","IS_REACT_ACT_ENVIRONMENT","originalProcessVersions","process","versions","mockClientSide","Object","defineProperty","value","undefined","unmockClientSide","writable","getMockUuid","seed","x","toString","padStart","slice","mockAxios","handlers","axios","jest","requireActual","defaults","adapter","config","handler","res","data","headers","status","statusText","console","warn","JSON","stringify","e","mockTimer","time","mockdate","set","Date","now","advanceTimersByTimeAsync","mount","scene","root","element","document","createElement","body","appendChild","destroy","act","unmount","remove","snapshot","expect","toMatchSnapshot","createRoot","render","options","promise","await","Error","Promise","resolve","then","nodes","asFragment","childNodes","length"],"sources":["../../../../../src/shared/utils/jest/index.ts"],"sourcesContent":["/* global jest, document */\n/* eslint-disable import/no-extraneous-dependencies */\n\nimport type {\n AxiosRequestConfig,\n AxiosResponse,\n AxiosStatic,\n InternalAxiosRequestConfig,\n} from 'axios';\n\nimport mockdate from 'mockdate';\nimport { type ReactElement, type ReactNode, act } from 'react';\nimport { type Root, createRoot } from 'react-dom/client';\n\nimport { type RenderResult, render } from '@testing-library/react';\n\n/**\n * An alias for [act(..)](https://reactjs.org/docs/test-utils.html#act)\n * from `react`.\n */\nexport { act };\n\nexport { default as getGlobal } from './global';\n\nglobal.IS_REACT_ACT_ENVIRONMENT = true;\n\nconst originalProcessVersions = process.versions;\n\n/**\n * Tricks **react-utils** into thinking the test is running within client-side\n * (browser) environment.\n */\nexport function mockClientSide(): void {\n Object.defineProperty(process, 'versions', { value: undefined });\n}\n\n/**\n * Reverts the effect of {@link module:JU.mockClientSide mockClientSide(..)}.\n */\nexport function unmockClientSide(): void {\n Object.defineProperty(process, 'versions', {\n value: originalProcessVersions,\n writable: false,\n });\n}\n\n/**\n * Generates a mock UUID, or better said it determenistically transforms given\n * `seed` number into a UUID-formatted string.\n * @param {number} seed\n * @return {string}\n */\nexport function getMockUuid(seed = 0): string {\n const x = seed.toString(16).padStart(32, '0');\n return `${x.slice(0, 8)}-${x.slice(8, 12)}-${x.slice(12, 16)}-${x.slice(16, 20)}-${x.slice(20)}`;\n}\n\nexport type AxiosRequestHandlerT = (\n config: AxiosRequestConfig,\n) => Partial<AxiosResponse> | null | undefined;\n\nexport function mockAxios(handlers: AxiosRequestHandlerT[]): AxiosStatic {\n const axios: AxiosStatic = jest.requireActual('axios');\n\n axios.defaults.adapter = async (\n config: AxiosRequestConfig,\n ): Promise<AxiosResponse> => {\n for (const handler of handlers) {\n const res = handler(config);\n if (res) {\n return {\n config: config as InternalAxiosRequestConfig,\n data: null,\n headers: {},\n status: 200,\n statusText: 'OK',\n ...res,\n };\n }\n }\n\n // Fallback to the regular network request.\n let res: AxiosResponse;\n try {\n res = await axios({ ...config, adapter: ['xhr', 'http', 'fetch'] });\n // eslint-disable-next-line no-console\n console.warn(\n 'Network request has not been mocked for a test.\\n\\nConfig:\\n',\n config,\n '\\n\\nResult:\\n',\n JSON.stringify(res, null, 2),\n );\n } catch (e) {\n // eslint-disable-next-line no-console\n console.warn(\n 'Network request has not been mocked for a test, and failed.\\n\\nConfig:\\n',\n config,\n '\\n\\nError\\n',\n JSON.stringify(e, null, 2),\n );\n throw e;\n }\n\n return res;\n };\n\n return axios;\n}\n\n/**\n * Advances mock timers, and mock date by the specified time.\n * @param {number} time Time step [ms].\n * @returns {Promise} Wait for this to \"jump after\" any async code which should\n * be executed because of the mock time movement.\n */\nexport async function mockTimer(time: number): Promise<void> {\n mockdate.set(time + Date.now());\n await jest.advanceTimersByTimeAsync(time);\n}\n\nexport type MountedSceneT = HTMLElement & {\n destroy: () => void;\n snapshot: () => void;\n};\n\n/**\n * Mounts `scene` to the DOM, and returns the root scene element.\n * @param scene\n * @return Created container DOM element with destroy() function\n * attached.\n */\nexport function mount(scene: ReactNode): MountedSceneT {\n let root: Root;\n const element = document.createElement('div');\n document.body.appendChild(element);\n\n const res: MountedSceneT = (element as unknown) as MountedSceneT;\n res.destroy = () => {\n // NOTE: As it seems @testing-library may reset this flag to false\n // when it is simulating user events.\n global.IS_REACT_ACT_ENVIRONMENT = true;\n\n act(() => {\n root.unmount();\n });\n res.remove();\n };\n\n res.snapshot = () => {\n expect(res).toMatchSnapshot();\n };\n\n // NOTE: As it seems @testing-library may reset this flag to false\n // when it is simulating user events.\n global.IS_REACT_ACT_ENVIRONMENT = true;\n\n act(() => {\n root = createRoot(res);\n root.render(scene);\n });\n return res;\n}\n\n// NOTE: If in future we have additional options here, they should be distributed\n// across two objects, depending whether they are applicable to the sync, or async\n// versions of snapshot(), or both.\ntype AsyncSnapshotOptionsT = {\n await?: Promise<void>;\n};\n\nexport function snapshot(element: ReactElement): RenderResult;\n\nexport async function snapshot(\n element: ReactElement,\n options: AsyncSnapshotOptionsT,\n): Promise<RenderResult>;\n\nexport function snapshot(\n element: React.ReactElement,\n options?: AsyncSnapshotOptionsT,\n): Promise<RenderResult> | RenderResult {\n let res: RenderResult | undefined;\n\n // TODO: Just adding async to the actor function breaks stuff, as it makes\n // act() asynchronous no matter the `options.await` value, thus breaking all\n // calls that do not await for snapshot() result... thus... perhaps we need\n // to have a more complex typing to ensure it all works as intended in all\n // cases, and while being correctly enforced by TypeScript.\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n const promise = act(() => {\n res = render(element);\n return options?.await;\n });\n\n if (res === undefined) throw Error('Render failed');\n if (options?.await) {\n // BEWARE: Although `promise` is thenable (i.e. it has .then() method),\n // it is not an instance of proper Promise class, and returning it directly\n // breaks some async logic in Jest test or React test functions... thus, we\n // wrap it into Promise instance here.\n return new Promise((resolve) => {\n void promise.then(() => {\n // TODO: These lines are the same as the lines below for sync variant of\n // the function. We should split and reuse them in both places.\n const nodes = res!.asFragment().childNodes;\n expect(nodes.length > 1 ? [...nodes] : nodes[0]).toMatchSnapshot();\n resolve(res!);\n });\n });\n }\n\n const nodes = res.asFragment().childNodes;\n expect(nodes.length > 1 ? [...nodes] : nodes[0]).toMatchSnapshot();\n return res;\n}\n"],"mappings":"4iBAUA,IAAAA,SAAA,CAAAC,sBAAA,CAAAC,OAAA,cACA,IAAAC,MAAA,CAAAD,OAAA,UACA,IAAAE,OAAA,CAAAF,OAAA,qBAEA,IAAAG,OAAA,CAAAH,OAAA,2BAQA,IAAAI,OAAA,CAAAL,sBAAA,CAAAC,OAAA,cAtBA,2BACA,sDAeA;AACA;AACA;AACA,GAKAK,MAAM,CAACC,wBAAwB,CAAG,IAAI,CAEtC,KAAM,CAAAC,uBAAuB,CAAGC,OAAO,CAACC,QAAQ,CAEhD;AACA;AACA;AACA,GACO,QAAS,CAAAC,cAAcA,CAAA,CAAS,CACrCC,MAAM,CAACC,cAAc,CAACJ,OAAO,CAAE,UAAU,CAAE,CAAEK,KAAK,CAAEC,SAAU,CAAC,CACjE,CAEA;AACA;AACA,GACO,QAAS,CAAAC,gBAAgBA,CAAA,CAAS,CACvCJ,MAAM,CAACC,cAAc,CAACJ,OAAO,CAAE,UAAU,CAAE,CACzCK,KAAK,CAAEN,uBAAuB,CAC9BS,QA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-1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpack.js","names":["_isomorphy","require","requireWeak","modulePath","basePath","IS_CLIENT_SIDE","req","eval","resolve","path","module","default","def","named","res","Object","entries","forEach","name","value","assigned","Error","resolveWeak"],"sources":["../../../../src/shared/utils/webpack.ts"],"sourcesContent":["import type
|
|
1
|
+
{"version":3,"file":"webpack.js","names":["_isomorphy","require","requireWeak","modulePath","basePath","IS_CLIENT_SIDE","req","eval","resolve","path","module","default","def","named","res","Object","entries","forEach","name","value","assigned","Error","resolveWeak"],"sources":["../../../../src/shared/utils/webpack.ts"],"sourcesContent":["import type PathNS from 'node:path';\n\nimport { IS_CLIENT_SIDE } from './isomorphy';\n\ntype RequireWeakResT<T> = T extends { default: infer D }\n ? (D extends null | undefined ? T : D & Omit<T, 'default'>)\n : T;\n\n/**\n * Requires the specified module without including it into the bundle during\n * Webpack build.\n * @param modulePath\n * @param [basePath]\n * @return Required module.\n */\nexport function requireWeak<T extends object>(\n modulePath: string,\n basePath?: string,\n): RequireWeakResT<T> | null {\n if (IS_CLIENT_SIDE) return null;\n\n // TODO: On one hand, this try/catch wrap silencing errors is bad, as it may\n // hide legit errors, in a way difficult to notice and understand; but on the\n // other hand it fails for some (unclear, but legit?) reasons in some\n // environments,\n // like during the static code generation for docs. Perhaps, something should\n // be implemented differently here.\n try {\n // eslint-disable-next-line no-eval\n const req = eval('require') as (path: string) => unknown;\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const { resolve } = req('path') as typeof PathNS;\n\n const path = basePath ? resolve(basePath, modulePath) : modulePath;\n const module = req(path) as T;\n\n if (!('default' in module) || !module.default) return module as RequireWeakResT<T>;\n\n const { default: def, ...named } = module;\n\n const res = def as RequireWeakResT<T>;\n\n Object.entries(named).forEach(([name, value]) => {\n const assigned = res[name as keyof RequireWeakResT<T>];\n if (assigned) (res[name as keyof RequireWeakResT<T>] as unknown) = value;\n else if (assigned !== value) {\n throw Error('Conflict between default and named exports');\n }\n });\n return res;\n } catch {\n return null;\n }\n}\n\n/**\n * Resolves specified module path with help of Babel's module resolver.\n * Yes, the function itself just returns its argument to the caller, but Babel\n * is configured to resolve the first argument of resolveWeak(..) function, thus\n * the result will be the resolved path.\n * @param {string} modulePath\n * @return {string} Absolute or relative path to the module.\n */\nexport function resolveWeak(modulePath: string): string {\n return modulePath;\n}\n"],"mappings":"sIAEA,IAAAA,UAAA,CAAAC,OAAA,gBAMA;AACA;AACA;AACA;AACA;AACA;AACA,GACO,QAAS,CAAAC,WAAWA,CACzBC,UAAkB,CAClBC,QAAiB,CACU,CAC3B,GAAIC,yBAAc,CAAE,MAAO,KAAI,CAE/B;AACA;AACA;AACA;AACA;AACA;AACA,GAAI,CACF;AACA,KAAM,CAAAC,GAAG,CAAGC,IAAI,CAAC,SAAS,CAA8B,CAExD;AACA,KAAM,CAAEC,OAAQ,CAAC,CAAGF,GAAG,CAAC,MAAM,CAAkB,CAEhD,KAAM,CAAAG,IAAI,CAAGL,QAAQ,CAAGI,OAAO,CAACJ,QAAQ,CAAED,UAAU,CAAC,CAAGA,UAAU,CAClE,KAAM,CAAAO,MAAM,CAAGJ,GAAG,CAACG,IAAI,CAAM,CAE7B,GAAI,EAAE,SAAS,EAAI,CAAAC,MAAM,CAAC,EAAI,CAACA,MAAM,CAACC,OAAO,CAAE,MAAO,CAAAD,MAAM,CAE5D,KAAM,CAAEC,OAAO,CAAEC,GAAG,CAAE,GAAGC,KAAM,CAAC,CAAGH,MAAM,CAEzC,KAAM,CAAAI,GAAG,CAAGF,GAAyB,CAErCG,MAAM,CAACC,OAAO,CAACH,KAAK,CAAC,CAACI,OAAO,CAAC,CAAC,CAACC,IAAI,CAAEC,KAAK,CAAC,GAAK,CAC/C,KAAM,CAAAC,QAAQ,CAAGN,GAAG,CAACI,IAAI,CAA6B,CACtD,GAAIE,QAAQ,CAAGN,GAAG,CAACI,IAAI,CAA6B,CAAeC,KAAK,CAAC,IACpE,IAAIC,QAAQ,GAAKD,KAAK,CAAE,CAC3B,KAAM,CAAAE,KAAK,CAAC,4CAA4C,CAC1D,CACF,CAAC,CAAC,CACF,MAAO,CAAAP,GACT,CAAE,KAAM,CACN,MAAO,KACT,CACF,CAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACO,QAAS,CAAAQ,WAAWA,CAACnB,UAAkB,CAAU,CACtD,MAAO,CAAAA,UACT","ignoreList":[]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! For license information please see web.bundle.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@dr.pogodin/js-utils"),require("@dr.pogodin/react-global-state"),require("@dr.pogodin/react-helmet"),require("@dr.pogodin/react-themes"),require("cookie"),require("dayjs"),require("node-forge/lib/aes"),require("node-forge/lib/forge"),require("qs"),require("react"),require("react-dom"),require("react-dom/client"),require("react-router")):"function"==typeof define&&define.amd?define(["@dr.pogodin/js-utils","@dr.pogodin/react-global-state","@dr.pogodin/react-helmet","@dr.pogodin/react-themes","cookie","dayjs","node-forge/lib/aes","node-forge/lib/forge","qs","react","react-dom","react-dom/client","react-router"],t):"object"==typeof exports?exports["@dr.pogodin/react-utils"]=t(require("@dr.pogodin/js-utils"),require("@dr.pogodin/react-global-state"),require("@dr.pogodin/react-helmet"),require("@dr.pogodin/react-themes"),require("cookie"),require("dayjs"),require("node-forge/lib/aes"),require("node-forge/lib/forge"),require("qs"),require("react"),require("react-dom"),require("react-dom/client"),require("react-router")):e["@dr.pogodin/react-utils"]=t(e["@dr.pogodin/js-utils"],e["@dr.pogodin/react-global-state"],e["@dr.pogodin/react-helmet"],e["@dr.pogodin/react-themes"],e.cookie,e.dayjs,e["node-forge/lib/aes"],e["node-forge/lib/forge"],e.qs,e.react,e["react-dom"],e["react-dom/client"],e["react-router"])}("undefined"!=typeof self?self:this,(function(__WEBPACK_EXTERNAL_MODULE__864__,__WEBPACK_EXTERNAL_MODULE__126__,__WEBPACK_EXTERNAL_MODULE__264__,__WEBPACK_EXTERNAL_MODULE__859__,__WEBPACK_EXTERNAL_MODULE__462__,__WEBPACK_EXTERNAL_MODULE__185__,__WEBPACK_EXTERNAL_MODULE__958__,__WEBPACK_EXTERNAL_MODULE__814__,__WEBPACK_EXTERNAL_MODULE__360__,__WEBPACK_EXTERNAL_MODULE__155__,__WEBPACK_EXTERNAL_MODULE__514__,__WEBPACK_EXTERNAL_MODULE__236__,__WEBPACK_EXTERNAL_MODULE__707__){return function(){"use strict";var __webpack_modules__={48:function(e,t,n){var r;n.d(t,{B:function(){return o},p:function(){return a}});const o="object"!=typeof process||!(null!==(r=process.versions)&&void 0!==r&&r.node)||!!n.g.REACT_UTILS_FORCE_CLIENT_SIDE,a=!o},126:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__126__},148: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__(724);function requireWeak(modulePath,basePath){if(_isomorphy__WEBPACK_IMPORTED_MODULE_0__.IS_CLIENT_SIDE)return null;try{const req=eval("require"),{resolve:resolve}=req("path"),path=basePath?resolve(basePath,modulePath):modulePath,module=req(path);if(!("default"in module)||!module.default)return module;const{default:def,...named}=module,res=def;return Object.entries(named).forEach((([e,t])=>{const n=res[e];if(n)res[e]=t;else if(n!==t)throw Error("Conflict between default and named exports")})),res}catch{return null}}function resolveWeak(e){return e}},155:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__155__},185:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__185__},208:function(e,t){var n=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function o(e,t,r){var o=null;if(void 0!==r&&(o=""+r),void 0!==t.key&&(o=""+t.key),"key"in t)for(var a in r={},t)"key"!==a&&(r[a]=t[a]);else r=t;return t=r.ref,{$$typeof:n,type:e,key:o,ref:void 0!==t?t:null,props:r}}t.Fragment=r,t.jsx=o,t.jsxs=o},236:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__236__},264:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__264__},360:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__360__},462:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__462__},514:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__514__},540:function(e,t,n){let r;function o(){if(void 0===r)throw Error('"Build Info" has not been initialized yet');return r}n.d(t,{F:function(){return o}}),"undefined"!=typeof BUILD_INFO&&(r=BUILD_INFO)},668:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{A:function(){return getInj}});var node_forge_lib_forge__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(814),node_forge_lib_forge__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(node_forge_lib_forge__WEBPACK_IMPORTED_MODULE_0__),node_forge_lib_aes__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(958),node_forge_lib_aes__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(node_forge_lib_aes__WEBPACK_IMPORTED_MODULE_1__),_shared_utils_isomorphy_buildInfo__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(540);let inj={};const metaElement="undefined"==typeof document?null:document.querySelector('meta[itemprop="drpruinj"]');if(metaElement){metaElement.remove();let data=node_forge_lib_forge__WEBPACK_IMPORTED_MODULE_0___default().util.decode64(metaElement.content);const{key:key}=(0,_shared_utils_isomorphy_buildInfo__WEBPACK_IMPORTED_MODULE_2__.F)(),d=node_forge_lib_forge__WEBPACK_IMPORTED_MODULE_0___default().cipher.createDecipher("AES-CBC",key);d.start({iv:data.slice(0,key.length)}),d.update(node_forge_lib_forge__WEBPACK_IMPORTED_MODULE_0___default().util.createBuffer(data.slice(key.length))),d.finish(),data=node_forge_lib_forge__WEBPACK_IMPORTED_MODULE_0___default().util.decodeUtf8(d.output.data),inj=eval(`(${data})`)}else"undefined"!=typeof window&&window.REACT_UTILS_INJECTION?(inj=window.REACT_UTILS_INJECTION,delete window.REACT_UTILS_INJECTION):inj={};function getInj(){return inj}},707:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__707__},724:function(e,t,n){n.r(t),n.d(t,{IS_CLIENT_SIDE:function(){return o.B},IS_SERVER_SIDE:function(){return o.p},buildTimestamp:function(){return _},getBuildInfo:function(){return r.F},isDevBuild:function(){return a},isProdBuild:function(){return i}});var r=n(540),o=n(48);function a(){return!1}function i(){return!0}function _(){return(0,r.F)().timestamp}},814:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__814__},859:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__859__},864:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__864__},922:function(e,t,n){e.exports=n(208)},958:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__958__},969:function(e,t,n){n.d(t,{A:function(){return l}});var r=n(236),o=n(264),a=n(707),i=n(126),_=n(668),s=n(922);function l(e,t={}){var n;const l=document.getElementById("react-view");if(!l)throw Error("Failed to find container for React app");const c=(0,s.jsx)(i.GlobalStateProvider,{initialState:null!==(n=(0,_.A)().ISTATE)&&void 0!==n?n:t.initialState,children:(0,s.jsx)(a.BrowserRouter,{children:(0,s.jsx)(o.HelmetProvider,{children:(0,s.jsx)(e,{})})})});t.dontHydrate?(0,r.createRoot)(l).render(c):(0,r.hydrateRoot)(l,c)}}},__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__={};__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{Barrier:function(){return js_utils_.Barrier},BaseButton:function(){return BaseButton},BaseModal:function(){return BaseModal},Button:function(){return Button},Checkbox:function(){return components_Checkbox},CustomDropdown:function(){return CustomDropdown},Dropdown:function(){return NativeDropdown},Emitter:function(){return js_utils_.Emitter},GlobalStateProvider:function(){return react_global_state_.GlobalStateProvider},Input:function(){return components_Input},Link:function(){return components_Link},MetaTags:function(){return react_helmet_.MetaTags},Modal:function(){return Modal},NavLink:function(){return components_NavLink},PageLayout:function(){return components_PageLayout},Semaphore:function(){return js_utils_.Semaphore},Switch:function(){return Switch},TextArea:function(){return components_TextArea},ThemeProvider:function(){return react_themes_.ThemeProvider},Throbber:function(){return components_Throbber},WithTooltip:function(){return WithTooltip},YouTubeVideo:function(){return components_YouTubeVideo},client:function(){return client},config:function(){return utils_config},getGlobalState:function(){return react_global_state_.getGlobalState},getSsrContext:function(){return getSsrContext},isomorphy:function(){return isomorphy},newAsyncDataEnvelope:function(){return react_global_state_.newAsyncDataEnvelope},server:function(){return server},splitComponent:function(){return splitComponent},themed:function(){return themed},time:function(){return utils_time},useAsyncCollection:function(){return react_global_state_.useAsyncCollection},useAsyncData:function(){return react_global_state_.useAsyncData},useGlobalState:function(){return react_global_state_.useGlobalState},webpack:function(){return webpack},withGlobalStateType:function(){return react_global_state_.withGlobalStateType},withRetries:function(){return js_utils_.withRetries}});var global={},react_themes_=__webpack_require__(859),react_themes_default=__webpack_require__.n(react_themes_),environment_check=__webpack_require__(48),webpack=__webpack_require__(148),_ref;const config=null!==(_ref=environment_check.B?__webpack_require__(668).A().CONFIG:(0,webpack.requireWeak)("config"))&&void 0!==_ref?_ref:{};if(environment_check.B&&"undefined"!=typeof document){const e=__webpack_require__(462);config.CSRF=e.parse(document.cookie).csrfToken}var utils_config=config,isomorphy=__webpack_require__(724),external_cookie_=__webpack_require__(462),external_react_=__webpack_require__(155),external_dayjs_=__webpack_require__(185),external_dayjs_default=__webpack_require__.n(external_dayjs_),js_utils_=__webpack_require__(864),react_global_state_=__webpack_require__(126);const{getSsrContext:getSsrContext}=(0,react_global_state_.withGlobalStateType)();function useCurrent({autorefresh:e=!1,globalStatePath:t="currentTime",precision:n=5*js_utils_.SEC_MS}={}){const[r,o]=(0,react_global_state_.useGlobalState)(t,Date.now);return(0,external_react_.useEffect)((()=>{let t;const r=()=>{o((e=>{const t=Date.now();return Math.abs(t-e)>n?t:e})),e&&(t=setTimeout(r,n))};return r(),()=>{t&&clearTimeout(t)}}),[e,n,o]),r}function useTimezoneOffset({cookieName:e="timezoneOffset",globalStatePath:t="timezoneOffset"}={}){const n=getSsrContext(!1),[r,o]=(0,react_global_state_.useGlobalState)(t,(()=>{const t=e&&(null==n?void 0:n.req.cookies[e]);return t?parseInt(t):0}));return(0,external_react_.useEffect)((()=>{const t=(new Date).getTimezoneOffset();o(t),e&&(document.cookie=(0,external_cookie_.serialize)(e,t.toString(),{path:"/"}))}),[e,o]),r}const time={DAY_MS:js_utils_.DAY_MS,HOUR_MS:js_utils_.HOUR_MS,MIN_MS:js_utils_.MIN_MS,SEC_MS:js_utils_.SEC_MS,YEAR_MS:js_utils_.YEAR_MS,now:Date.now,timer:js_utils_.timer,useCurrent:useCurrent,useTimezoneOffset:useTimezoneOffset};var utils_time=Object.assign(external_dayjs_default(),time),jsx_runtime=__webpack_require__(922);let clientChunkGroups;var _require$default$CHUN;isomorphy.IS_CLIENT_SIDE&&(clientChunkGroups=null!==(_require$default$CHUN=__webpack_require__(668).A().CHUNK_GROUPS)&&void 0!==_require$default$CHUN?_require$default$CHUN:{});const refCounts={};function getPublicPath(){return(0,isomorphy.getBuildInfo)().publicPath}function bookStyleSheet(e,t,n){let r;const o=`${getPublicPath()}/${e}`,a=`${document.location.origin}${o}`;if(!t.has(a)){let e=document.querySelector(`link[href="${o}"]`);e||(e=document.createElement("link"),e.setAttribute("rel","stylesheet"),e.setAttribute("href",o),document.head.appendChild(e)),r=new js_utils_.Barrier,e.addEventListener("load",(()=>{if(!r)throw Error("Internal error");r.resolve()})),e.addEventListener("error",(()=>{if(!r)throw Error("Internal error");r.resolve()}))}if(n){var i;const e=null!==(i=refCounts[o])&&void 0!==i?i:0;refCounts[o]=1+e}return r}function getLoadedStyleSheets(){const e=new Set,{styleSheets:t}=document;for(const{href:n}of t)n&&e.add(n);return e}function assertChunkName(e,t){if(!t[e])throw Error(`Unknown chunk name "${e}"`)}async function bookStyleSheets(e,t,n){const r=[],o=t[e];if(!o)return Promise.resolve();const a=getLoadedStyleSheets();for(const e of o)if(e.endsWith(".css")){const t=bookStyleSheet(e,a,n);t&&r.push(t)}return r.length?Promise.allSettled(r).then():Promise.resolve()}function freeStyleSheets(e,t){const n=t[e];if(n)for(const e of n)if(e.endsWith(".css")){const t=`${getPublicPath()}/${e}`,n=refCounts[t];n&&(n<=1?(document.head.querySelector(`link[href="${t}"]`).remove(),delete refCounts[t]):refCounts[t]=n-1)}}const usedChunkNames=new Set;function splitComponent({chunkName:e,getComponent:t,placeholder:n}){if(isomorphy.IS_CLIENT_SIDE&&assertChunkName(e,clientChunkGroups),usedChunkNames.has(e))throw Error(`Repeated splitComponent() call for the chunk "${e}"`);usedChunkNames.add(e);const r=(0,external_react_.lazy)((async()=>{const n=await t(),r="default"in n?n.default:n;return isomorphy.IS_CLIENT_SIDE&&await bookStyleSheets(e,clientChunkGroups,!1),{default:({children:t,ref:n,...o})=>{if(isomorphy.IS_SERVER_SIDE){const{chunkGroups:t,chunks:n}=getSsrContext();assertChunkName(e,t),n.includes(e)||n.push(e)}return(0,external_react_.useInsertionEffect)((()=>(bookStyleSheets(e,clientChunkGroups,!0),()=>{freeStyleSheets(e,clientChunkGroups)})),[]),(0,jsx_runtime.jsx)(r,{...o,ref:n,children:t})}}}));return({children:e,...t})=>(0,jsx_runtime.jsx)(external_react_.Suspense,{fallback:n,children:(0,jsx_runtime.jsx)(r,{...t,children:e})})}const themed=react_themes_default();themed.COMPOSE=react_themes_.COMPOSE,themed.PRIORITY=react_themes_.PRIORITY;var react_helmet_=__webpack_require__(264);function isValue(e){const t=typeof e;return"number"===t||"string"===t}function optionValueName(e){var t;return isValue(e)?[e,e]:[e.value,null!==(t=e.name)&&void 0!==t?t:e.value]}var external_react_dom_=__webpack_require__(514),external_react_dom_default=__webpack_require__.n(external_react_dom_),base_theme={overlay:"ye2BZo",context:"Szmbbz",ad:"Ah-Nsc",hoc:"Wki41G",container:"gyZ4rc"},styles={scrollingDisabledByModal:"_5fRFtF"};const BaseModal=({cancelOnScrolling:e,children:t,containerStyle:n,dontDisableScrolling:r,onCancel:o,overlayStyle:a,style:i,testId:_,testIdForOverlay:s,theme:l})=>{const c=(0,external_react_.useRef)(null),u=(0,external_react_.useRef)(null),[d,m]=(0,external_react_.useState)();(0,external_react_.useEffect)((()=>{const e=document.createElement("div");return document.body.appendChild(e),m(e),()=>{document.body.removeChild(e)}}),[]),(0,external_react_.useEffect)((()=>(e&&o&&(window.addEventListener("scroll",o),window.addEventListener("wheel",o)),()=>{e&&o&&(window.removeEventListener("scroll",o),window.removeEventListener("wheel",o))})),[e,o]),(0,external_react_.useEffect)((()=>(r||document.body.classList.add(styles.scrollingDisabledByModal),()=>{r||document.body.classList.remove(styles.scrollingDisabledByModal)})),[r]);const p=(0,external_react_.useMemo)((()=>(0,jsx_runtime.jsx)("div",{onFocus:()=>{var e;const t=c.current.querySelectorAll("*");for(let e=t.length-1;e>=0;--e)if(t[e].focus(),document.activeElement===t[e])return;null===(e=u.current)||void 0===e||e.focus()},tabIndex:0})),[]);return d?external_react_dom_default().createPortal((0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[p,(0,jsx_runtime.jsx)("div",{"aria-label":"Cancel",className:l.overlay,"data-testid":void 0,onClick:e=>{o&&(o(),e.stopPropagation())},onKeyDown:e=>{"Escape"===e.key&&o&&(o(),e.stopPropagation())},ref:e=>{e&&e!==u.current&&(u.current=e,e.focus())},role:"button",style:a,tabIndex:0}),(0,jsx_runtime.jsx)("div",{"aria-modal":"true",className:l.container,"data-testid":void 0,onClick:e=>{e.stopPropagation()},onWheel:e=>{e.stopPropagation()},ref:c,role:"dialog",style:null!=i?i:n,children:t}),(0,jsx_runtime.jsx)("div",{onFocus:()=>{var e;null===(e=u.current)||void 0===e||e.focus()},tabIndex:0}),p]}),d):null};var Modal=react_themes_default()(BaseModal,"Modal",base_theme),style={overlay:"jKsMKG"};function areEqual(e,t){return(null==e?void 0:e.left)===(null==t?void 0:t.left)&&(null==e?void 0:e.top)===(null==t?void 0:t.top)&&(null==e?void 0:e.width)===(null==t?void 0:t.width)}const Options=({containerClass:e,containerStyle:t,filter:n,onCancel:r,onChange:o,optionClass:a,options:i,ref:_})=>{const s=(0,external_react_.useRef)(null);(0,external_react_.useImperativeHandle)(_,(()=>({measure:()=>{var e;const t=null===(e=s.current)||void 0===e?void 0:e.parentElement;if(!t)return;const n=s.current.getBoundingClientRect(),r=window.getComputedStyle(t),o=parseFloat(r.marginBottom),a=parseFloat(r.marginTop);return n.height+=o+a,n}})),[]);const l=[];for(const e of i)if(!n||n(e)){const[t,n]=optionValueName(e);l.push((0,jsx_runtime.jsx)("div",{className:a,onClick:e=>{o(t),e.stopPropagation()},onKeyDown:e=>{"Enter"===e.key&&(o(t),e.stopPropagation())},role:"button",tabIndex:0,children:n},t))}return(0,jsx_runtime.jsx)(BaseModal,{cancelOnScrolling:!0,dontDisableScrolling:!0,onCancel:r,style:t,theme:{ad:"",container:e,context:"",hoc:"",overlay:style.overlay},children:(0,jsx_runtime.jsx)("div",{ref:s,children:l})})};var CustomDropdown_Options=Options,theme={container:"oQKv0Y",context:"_9Tod5r",ad:"R58zIg",hoc:"O-Tp1i",label:"YUPUNs",dropdown:"pNEyAA",option:"LD2Kzy",select:"LP5azC",arrow:"-wscve",active:"k2UDsV",upward:"HWRvu4"};const BaseCustomDropdown=({filter:e,label:t,onChange:n,options:r,theme:o,value:a})=>{var i,_;const[s,l]=(0,external_react_.useState)(!1),c=(0,external_react_.useRef)(null),u=(0,external_react_.useRef)(null),[d,m]=(0,external_react_.useState)(),[p,f]=(0,external_react_.useState)(!1);(0,external_react_.useEffect)((()=>{if(!s)return;let e;const t=()=>{var n,r;const o=null===(n=c.current)||void 0===n?void 0:n.getBoundingClientRect(),a=null===(r=u.current)||void 0===r?void 0:r.measure();if(o&&a){var i,_;const e=o.bottom+a.height<(null!==(i=null===(_=window.visualViewport)||void 0===_?void 0:_.height)&&void 0!==i?i:0),t=o.top-a.height>0,n=!e&&t;f(n);const r=n?{left:o.left,top:o.top-a.height-1,width:o.width}:{left:o.left,top:o.bottom,width:o.width};m((e=>areEqual(e,r)?e:r))}e=requestAnimationFrame(t)};return requestAnimationFrame(t),()=>{cancelAnimationFrame(e)}}),[s]);const h=e=>{var t,n;const r=window.visualViewport,o=c.current.getBoundingClientRect();l(!0),m({left:null!==(t=null==r?void 0:r.width)&&void 0!==t?t:0,top:null!==(n=null==r?void 0:r.height)&&void 0!==n?n:0,width:o.width}),e.stopPropagation()};let b=(0,jsx_runtime.jsx)(jsx_runtime.Fragment,{children:""});for(const t of r)if(!e||e(t)){const[e,n]=optionValueName(t);if(e===a){b=n;break}}let E=o.container;s&&(E+=` ${o.active}`);let x=null!==(i=o.select)&&void 0!==i?i:"";return p&&(E+=` ${o.upward}`,x+=` ${o.upward}`),(0,jsx_runtime.jsxs)("div",{className:E,children:[void 0===t?null:(0,jsx_runtime.jsx)("div",{className:o.label,children:t}),(0,jsx_runtime.jsxs)("div",{className:o.dropdown,onClick:h,onKeyDown:e=>{"Enter"===e.key&&h(e)},ref:c,role:"listbox",tabIndex:0,children:[b,(0,jsx_runtime.jsx)("div",{className:o.arrow})]}),s?(0,jsx_runtime.jsx)(CustomDropdown_Options,{containerClass:x,containerStyle:d,onCancel:()=>{l(!1)},onChange:e=>{l(!1),n&&n(e)},optionClass:null!==(_=o.option)&&void 0!==_?_:"",options:r,ref:u}):null]})};var CustomDropdown=react_themes_default()(BaseCustomDropdown,"CustomDropdown",theme),NativeDropdown_theme={dropdown:"kI9A9U",context:"xHyZo4",ad:"ADu59e",hoc:"FTP2bb",arrow:"DubGkT",container:"WtSZPd",active:"ayMn7O",label:"K7JYKw",option:"_27pZ6W",hiddenOption:"clAKFJ",select:"N0Fc14",invalid:"wL4umU"};const Dropdown=({filter:e,label:t,onChange:n,options:r,testId:o,theme:a,value:i})=>{let _=!1;const s=[];for(const t of r)if(!e||e(t)){const[e,n]=optionValueName(t);_||(_=e===i),s.push((0,jsx_runtime.jsx)("option",{className:a.option,value:e,children:n},e))}const l=_?null:(0,jsx_runtime.jsx)("option",{className:a.hiddenOption,disabled:!0,value:i,children:i},"__reactUtilsHiddenOption");let c=a.select;return _||(c+=` ${a.invalid}`),(0,jsx_runtime.jsxs)("div",{className:a.container,children:[void 0===t?null:(0,jsx_runtime.jsx)("div",{className:a.label,children:t}),(0,jsx_runtime.jsxs)("div",{className:a.dropdown,children:[(0,jsx_runtime.jsxs)("select",{className:c,"data-testid":void 0,onChange:n,value:i,children:[l,s]}),(0,jsx_runtime.jsx)("div",{className:a.arrow})]})]})};var NativeDropdown=react_themes_default()(Dropdown,"Dropdown",NativeDropdown_theme),Switch_theme={container:"AWNvRj",context:"VMHfnP",ad:"HNliRC",hoc:"_2Ue-db",option:"fUfIAd",selected:"Wco-qk",options:"CZYtcC"};const BaseSwitch=({label:e,onChange:t,options:n,theme:r,value:o})=>{if(!n||!r.option)throw Error("Internal error");const a=[];for(const e of n){const[n,i]=optionValueName(e);let _,s=r.option;n===o?s+=` ${r.selected}`:t&&(_=()=>{t(n)}),a.push(_?(0,jsx_runtime.jsx)("div",{className:s,onClick:_,onKeyDown:e=>{"Enter"===e.key&&_()},role:"button",tabIndex:0,children:i},n):(0,jsx_runtime.jsx)("div",{className:s,children:i},n))}return(0,jsx_runtime.jsxs)("div",{className:r.container,children:[e?(0,jsx_runtime.jsx)("div",{className:r.label,children:e}):null,(0,jsx_runtime.jsx)("div",{className:r.options,children:a})]})};var Switch=react_themes_default()(BaseSwitch,"Switch",Switch_theme),external_react_router_=__webpack_require__(707),GenericLink_style={link:"zH52sA"};const GenericLink=({children:e,className:t,disabled:n,enforceA:r,keepScrollPosition:o,onClick:a,onMouseDown:i,openNewTab:_,replace:s,routerLinkType:l,to:c,...u})=>{if(n||r||_||c.match(/^(#|(https?|mailto):)/))return(0,jsx_runtime.jsx)("a",{className:(t?t+" ":"")+"zH52sA",href:c,onClick:n?e=>{e.preventDefault()}:a,onMouseDown:n?e=>{e.preventDefault()}:i,rel:"noopener noreferrer",target:_?"_blank":"",children:e});const d=l;return(0,jsx_runtime.jsx)(d,{className:t,discover:"none",onClick:e=>{a&&a(e),o||window.scroll(0,0)},onMouseDown:i,replace:s,to:c,...u,children:e})};var components_GenericLink=GenericLink;const Link=e=>(0,jsx_runtime.jsx)(components_GenericLink,{...e,routerLinkType:external_react_router_.Link});var components_Link=Link,Button_style={button:"E1FNQT",context:"KM0v4f",ad:"_3jm1-Q",hoc:"_0plpDL",active:"MAe9O6",disabled:"Br9IWV"};const BaseButton=({active:e,children:t,disabled:n,enforceA:r,onClick:o,onMouseDown:a,onMouseUp:i,onPointerDown:_,onPointerUp:s,openNewTab:l,replace:c,testId:u,theme:d,to:m})=>{let p=d.button;return e&&d.active&&(p+=` ${d.active}`),n?(d.disabled&&(p+=` ${d.disabled}`),(0,jsx_runtime.jsx)("div",{className:p,"data-testid":void 0,children:t})):m?(0,jsx_runtime.jsx)(components_Link,{className:p,"data-testid":void 0,enforceA:r,onClick:o,onMouseDown:a,onMouseUp:i,onPointerDown:_,onPointerUp:s,openNewTab:l,replace:c,to:m,children:t}):(0,jsx_runtime.jsx)("div",{className:p,"data-testid":void 0,onClick:o,onKeyDown:o?e=>{"Enter"===e.key&&o(e)}:void 0,onMouseDown:a,onMouseUp:i,onPointerDown:_,onPointerUp:s,role:"button",tabIndex:0,children:t})};var Button=react_themes_default()(BaseButton,"Button",Button_style),Checkbox_theme={checkbox:"A-f8qJ",context:"dNQcC6",ad:"earXxa",hoc:"qAPfQ6",indeterminate:"N9bCb8",container:"Kr0g3M",label:"_3dML-O",disabled:"EzQra1"};const Checkbox=({checked:e,disabled:t,label:n,onChange:r,testId:o,theme:a})=>{let i=a.container;t&&(i+=` ${a.disabled}`);let _=a.checkbox;return"indeterminate"===e&&(_+=` ${a.indeterminate}`),(0,jsx_runtime.jsxs)("div",{className:i,children:[void 0===n?null:(0,jsx_runtime.jsx)("div",{className:a.label,children:n}),(0,jsx_runtime.jsx)("input",{checked:void 0===e?void 0:!0===e,className:_,"data-testid":void 0,disabled:t,onChange:r,onClick:e=>{e.stopPropagation()},type:"checkbox"})]})};var components_Checkbox=react_themes_default()(Checkbox,"Checkbox",Checkbox_theme),Input_theme={container:"Cxx397",context:"X5WszA",ad:"_8s7GCr",hoc:"TVlBYc",input:"M07d4s",label:"gfbdq-"};const Input=({label:e,ref:t,testId:n,theme:r,...o})=>(0,jsx_runtime.jsxs)("span",{className:r.container,children:[void 0===e?null:(0,jsx_runtime.jsx)("div",{className:r.label,children:e}),(0,jsx_runtime.jsx)("input",{className:r.input,"data-testid":void 0,ref:t,...o})]});var components_Input=react_themes_default()(Input,"Input",Input_theme),PageLayout_base_theme={container:"T3cuHB",context:"m4mL-M",ad:"m3-mdC",hoc:"J15Z4H",mainPanel:"pPlQO2",sidePanel:"lqNh4h"};const PageLayout=({children:e,leftSidePanelContent:t,rightSidePanelContent:n,theme:r})=>(0,jsx_runtime.jsxs)("div",{className:r.container,children:[(0,jsx_runtime.jsx)("div",{className:[r.sidePanel,r.leftSidePanel].join(" "),children:t}),(0,jsx_runtime.jsx)("div",{className:r.mainPanel,children:e}),(0,jsx_runtime.jsx)("div",{className:[r.sidePanel,r.rightSidePanel].join(" "),children:n})]});var components_PageLayout=react_themes_default()(PageLayout,"PageLayout",PageLayout_base_theme);const NavLink=e=>(0,jsx_runtime.jsx)(components_GenericLink,{...e,routerLinkType:external_react_router_.NavLink});var components_NavLink=NavLink,Throbber_theme={container:"_7zdld4",context:"uIObt7",ad:"XIxe9o",hoc:"YOyORH",circle:"dBrB4g",bouncing:"TJe-6j"};const Throbber=({theme:e})=>(0,jsx_runtime.jsxs)("span",{className:e.container,children:[(0,jsx_runtime.jsx)("span",{className:e.circle}),(0,jsx_runtime.jsx)("span",{className:e.circle}),(0,jsx_runtime.jsx)("span",{className:e.circle})]});var components_Throbber=react_themes_default()(Throbber,"Throbber",Throbber_theme);let PLACEMENTS=function(e){return e.ABOVE_CURSOR="ABOVE_CURSOR",e.ABOVE_ELEMENT="ABOVE_ELEMENT",e.BELOW_CURSOR="BELOW_CURSOR",e.BELOW_ELEMENT="BELOW_ELEMENT",e}({});const ARROW_STYLE_DOWN=["border-bottom-color:transparent","border-left-color:transparent","border-right-color:transparent"].join(";"),ARROW_STYLE_UP=["border-top-color:transparent","border-left-color:transparent","border-right-color:transparent"].join(";");function createTooltipComponents(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),{arrow:t,container:r,content:n}}function calcTooltipRects(e){return{arrow:e.arrow.getBoundingClientRect(),container:e.container.getBoundingClientRect()}}function calcViewportRect(){const{scrollX:e,scrollY:t}=window,{documentElement:{clientHeight:n,clientWidth:r}}=document;return{bottom:t+n,left:e,right:e+r,top:t}}function calcPositionAboveXY(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:ARROW_STYLE_DOWN}}function setComponentPositions(e,t,n,r,o){const a=calcTooltipRects(o),i=calcViewportRect(),_=calcPositionAboveXY(e,t,a);if(_.containerX<i.left+6)_.containerX=i.left+6,_.arrowX=Math.max(6,e-_.containerX-a.arrow.width/2);else{const t=i.right-6-a.container.width;_.containerX>t&&(_.containerX=t,_.arrowX=Math.min(a.container.width-6,e-_.containerX-a.arrow.width/2))}_.containerY<i.top+6&&(_.containerY+=a.container.height+2*a.arrow.height,_.arrowY-=a.container.height+a.arrow.height,_.baseArrowStyle=ARROW_STYLE_UP);const s=`left:${_.containerX}px;top:${_.containerY}px`;o.container.setAttribute("style",s);const l=`${_.baseArrowStyle};left:${_.arrowX}px;top:${_.arrowY}px`;o.arrow.setAttribute("style",l)}const Tooltip=({children:e,ref:t,theme:n})=>{const{current:r}=(0,external_react_.useRef)({lastElement:void 0,lastPageX:0,lastPageY:0,lastPlacement:void 0}),[o,a]=(0,external_react_.useState)(null),i=(e,t,n,a)=>{r.lastElement=a,r.lastPageX=e,r.lastPageY=t,r.lastPlacement=n,o&&setComponentPositions(e,t,n,a,o)};return(0,external_react_.useImperativeHandle)(t,(()=>({pointTo:i}))),(0,external_react_.useEffect)((()=>{const e=createTooltipComponents(n);return a(e),()=>{document.body.removeChild(e.container),a(null)}}),[n]),(0,external_react_.useEffect)((()=>{o&&setComponentPositions(r.lastPageX,r.lastPageY,r.lastPlacement,r.lastElement,o)}),[o,r.lastPageX,r.lastPageY,r.lastPlacement,r.lastElement]),o?(0,external_react_dom_.createPortal)(e,o.content):null};var WithTooltip_Tooltip=Tooltip,default_theme={arrow:"M9gywF",ad:"_4xT7zE",hoc:"zd-vnH",context:"GdZucr",container:"f9gY8K",appearance:"L4ubm-",wrapper:"_4qDBRM"};const Wrapper=({children:e,placement:t=PLACEMENTS.ABOVE_CURSOR,tip:n,theme:r})=>{const{current:o}=(0,external_react_.useRef)({lastCursorX:0,lastCursorY:0,timerId:void 0,triggeredByTouch:!1}),a=(0,external_react_.useRef)(null),i=(0,external_react_.useRef)(null),[_,s]=(0,external_react_.useState)(!1);return(0,external_react_.useEffect)((()=>{if(_&&null!==n){a.current&&a.current.pointTo(o.lastCursorX+window.scrollX,o.lastCursorY+window.scrollY,t,i.current);const e=()=>{s(!1)};return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}}}),[o.lastCursorX,o.lastCursorY,t,_,n]),(0,jsx_runtime.jsxs)("div",{className:r.wrapper,onClick:()=>{o.timerId&&(clearTimeout(o.timerId),o.timerId=void 0,o.triggeredByTouch=!1)},onMouseLeave:()=>{s(!1)},onMouseMove:e=>{((e,n)=>{if(_){const r=i.current.getBoundingClientRect();e<r.left||e>r.right||n<r.top||n>r.bottom?s(!1):a.current&&a.current.pointTo(e+window.scrollX,n+window.scrollY,t,i.current)}else{var r;o.lastCursorX=e,o.lastCursorY=n,o.triggeredByTouch?null!==(r=o.timerId)&&void 0!==r||(o.timerId=setTimeout((()=>{o.triggeredByTouch=!1,o.timerId=void 0,s(!0)}),300)):s(!0)}})(e.clientX,e.clientY)},onTouchStart:()=>{o.triggeredByTouch=!0},ref:i,role:"presentation",children:[_&&null!==n?(0,jsx_runtime.jsx)(WithTooltip_Tooltip,{ref:a,theme:r,children:n}):null,e]})},ThemedWrapper=react_themes_default()(Wrapper,"WithTooltip",default_theme),e=ThemedWrapper;e.PLACEMENTS=PLACEMENTS;var WithTooltip=e,external_qs_=__webpack_require__(360),external_qs_default=__webpack_require__.n(external_qs_),base={container:"sXHM81",context:"veKyYi",ad:"r3ABzd",hoc:"YKcPnR",video:"SlV2zw"},throbber={container:"jTxmOX",context:"dzIcLh",ad:"_5a9XX1",hoc:"_7sH52O"};const YouTubeVideo=({autoplay:e,src:t,theme:n,title:r})=>{var o,a;const i=t.split("?");let[_]=i;const[,s]=i,l=s?external_qs_default().parse(s):{};return _=`https://www.youtube.com/embed/${null!==(o=l.v)&&void 0!==o?o:null===(a=_)||void 0===a||null===(a=a.match(/\/([a-zA-Z0-9-_]*)$/))||void 0===a?void 0:a[1]}`,delete l.v,l.autoplay=e?"1":"0",_+=`?${external_qs_default().stringify(l)}`,(0,jsx_runtime.jsxs)("div",{className:n.container,children:[(0,jsx_runtime.jsx)(components_Throbber,{theme:throbber}),(0,jsx_runtime.jsx)("iframe",{allow:"autoplay",allowFullScreen:!0,className:n.video,src:_,title:r})]})};var components_YouTubeVideo=react_themes_default()(YouTubeVideo,"YouTubeVideo",base),TextArea_style={container:"dzMVIB",context:"KVPc7g",ad:"z2GQ0Z",hoc:"_8R1Qdj",label:"Vw9EKL",textarea:"zd-OFg",hidden:"GiHBXI"};const TextArea=({disabled:e,label:t,onBlur:n,onChange:r,onKeyDown:o,placeholder:a,testId:i,theme:_,value:s})=>{const l=(0,external_react_.useRef)(null),[c,u]=(0,external_react_.useState)(),[d,m]=(0,external_react_.useState)(null!=s?s:"");return void 0!==s&&d!==s&&m(s),(0,external_react_.useEffect)((()=>{const e=l.current;if(!e)return;const t=new ResizeObserver((()=>{u(e.scrollHeight)}));return t.observe(e),()=>{t.disconnect()}}),[]),(0,external_react_.useLayoutEffect)((()=>{const e=l.current;e&&u(e.scrollHeight)}),[d]),(0,jsx_runtime.jsxs)("div",{className:_.container,children:[void 0===t?null:(0,jsx_runtime.jsx)("div",{className:_.label,children:t}),(0,jsx_runtime.jsx)("textarea",{className:`${_.textarea} ${_.hidden}`,readOnly:!0,ref:l,tabIndex:-1,value:d||" "}),(0,jsx_runtime.jsx)("textarea",{className:_.textarea,"data-testid":void 0,disabled:e,onBlur:n,onChange:void 0===s?e=>{m(e.target.value)}:r,onKeyDown:o,placeholder:a,style:{height:c},value:d})]})};var components_TextArea=react_themes_default()(TextArea,"TextArea",TextArea_style),src_dirname="/";if(__webpack_require__.g.REACT_UTILS_LIBRARY_LOADED)throw Error("React utils library is already loaded");__webpack_require__.g.REACT_UTILS_LIBRARY_LOADED=!0;const server=webpack.requireWeak("./server",src_dirname),client=server?void 0:__webpack_require__(969).A;return __webpack_exports__}()}));
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@dr.pogodin/js-utils"),require("@dr.pogodin/react-global-state"),require("@dr.pogodin/react-helmet"),require("@dr.pogodin/react-themes"),require("cookie"),require("dayjs"),require("node-forge/lib/aes"),require("node-forge/lib/forge"),require("qs"),require("react"),require("react-dom"),require("react-dom/client"),require("react-router")):"function"==typeof define&&define.amd?define(["@dr.pogodin/js-utils","@dr.pogodin/react-global-state","@dr.pogodin/react-helmet","@dr.pogodin/react-themes","cookie","dayjs","node-forge/lib/aes","node-forge/lib/forge","qs","react","react-dom","react-dom/client","react-router"],t):"object"==typeof exports?exports["@dr.pogodin/react-utils"]=t(require("@dr.pogodin/js-utils"),require("@dr.pogodin/react-global-state"),require("@dr.pogodin/react-helmet"),require("@dr.pogodin/react-themes"),require("cookie"),require("dayjs"),require("node-forge/lib/aes"),require("node-forge/lib/forge"),require("qs"),require("react"),require("react-dom"),require("react-dom/client"),require("react-router")):e["@dr.pogodin/react-utils"]=t(e["@dr.pogodin/js-utils"],e["@dr.pogodin/react-global-state"],e["@dr.pogodin/react-helmet"],e["@dr.pogodin/react-themes"],e.cookie,e.dayjs,e["node-forge/lib/aes"],e["node-forge/lib/forge"],e.qs,e.react,e["react-dom"],e["react-dom/client"],e["react-router"])}("undefined"!=typeof self?self:this,function(__WEBPACK_EXTERNAL_MODULE__864__,__WEBPACK_EXTERNAL_MODULE__126__,__WEBPACK_EXTERNAL_MODULE__264__,__WEBPACK_EXTERNAL_MODULE__859__,__WEBPACK_EXTERNAL_MODULE__462__,__WEBPACK_EXTERNAL_MODULE__185__,__WEBPACK_EXTERNAL_MODULE__958__,__WEBPACK_EXTERNAL_MODULE__814__,__WEBPACK_EXTERNAL_MODULE__360__,__WEBPACK_EXTERNAL_MODULE__155__,__WEBPACK_EXTERNAL_MODULE__514__,__WEBPACK_EXTERNAL_MODULE__236__,__WEBPACK_EXTERNAL_MODULE__707__){return function(){"use strict";var __webpack_modules__={48:function(e,t,n){var r;n.d(t,{B:function(){return o},p:function(){return a}});const o="object"!=typeof process||!(null!==(r=process.versions)&&void 0!==r&&r.node)||!!n.g.REACT_UTILS_FORCE_CLIENT_SIDE,a=!o},126:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__126__},148: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__(724);function requireWeak(modulePath,basePath){if(_isomorphy__WEBPACK_IMPORTED_MODULE_0__.IS_CLIENT_SIDE)return null;try{const req=eval("require"),{resolve:resolve}=req("path"),path=basePath?resolve(basePath,modulePath):modulePath,module=req(path);if(!("default"in module)||!module.default)return module;const{default:def,...named}=module,res=def;return Object.entries(named).forEach(([e,t])=>{const n=res[e];if(n)res[e]=t;else if(n!==t)throw Error("Conflict between default and named exports")}),res}catch{return null}}function resolveWeak(e){return e}},155:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__155__},185:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__185__},208:function(e,t){var n=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function o(e,t,r){var o=null;if(void 0!==r&&(o=""+r),void 0!==t.key&&(o=""+t.key),"key"in t)for(var a in r={},t)"key"!==a&&(r[a]=t[a]);else r=t;return t=r.ref,{$$typeof:n,type:e,key:o,ref:void 0!==t?t:null,props:r}}t.Fragment=r,t.jsx=o,t.jsxs=o},236:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__236__},264:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__264__},360:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__360__},462:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__462__},514:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__514__},540:function(e,t,n){let r;function o(){if(void 0===r)throw Error('"Build Info" has not been initialized yet');return r}n.d(t,{F:function(){return o}}),"undefined"!=typeof BUILD_INFO&&(r=BUILD_INFO)},668:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{A:function(){return getInj}});var node_forge_lib_forge__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(814),node_forge_lib_forge__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(node_forge_lib_forge__WEBPACK_IMPORTED_MODULE_0__),node_forge_lib_aes__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(958),node_forge_lib_aes__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(node_forge_lib_aes__WEBPACK_IMPORTED_MODULE_1__),_shared_utils_isomorphy_buildInfo__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(540);let inj={};const metaElement="undefined"==typeof document?null:document.querySelector('meta[itemprop="drpruinj"]');if(metaElement){metaElement.remove();let data=node_forge_lib_forge__WEBPACK_IMPORTED_MODULE_0___default().util.decode64(metaElement.content);const{key:key}=(0,_shared_utils_isomorphy_buildInfo__WEBPACK_IMPORTED_MODULE_2__.F)(),d=node_forge_lib_forge__WEBPACK_IMPORTED_MODULE_0___default().cipher.createDecipher("AES-CBC",key);d.start({iv:data.slice(0,key.length)}),d.update(node_forge_lib_forge__WEBPACK_IMPORTED_MODULE_0___default().util.createBuffer(data.slice(key.length))),d.finish(),data=node_forge_lib_forge__WEBPACK_IMPORTED_MODULE_0___default().util.decodeUtf8(d.output.data),inj=eval(`(${data})`)}else"undefined"!=typeof window&&window.REACT_UTILS_INJECTION?(inj=window.REACT_UTILS_INJECTION,delete window.REACT_UTILS_INJECTION):inj={};function getInj(){return inj}},707:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__707__},724:function(e,t,n){n.r(t),n.d(t,{IS_CLIENT_SIDE:function(){return o.B},IS_SERVER_SIDE:function(){return o.p},buildTimestamp:function(){return _},getBuildInfo:function(){return r.F},isDevBuild:function(){return a},isProdBuild:function(){return i}});var r=n(540),o=n(48);function a(){return!1}function i(){return!0}function _(){return(0,r.F)().timestamp}},814:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__814__},859:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__859__},864:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__864__},922:function(e,t,n){e.exports=n(208)},958:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__958__},969:function(e,t,n){n.d(t,{A:function(){return l}});var r=n(236),o=n(264),a=n(707),i=n(126),_=n(668),s=n(922);function l(e,t={}){var n;const l=document.getElementById("react-view");if(!l)throw Error("Failed to find container for React app");const c=(0,s.jsx)(i.GlobalStateProvider,{initialState:null!==(n=(0,_.A)().ISTATE)&&void 0!==n?n:t.initialState,children:(0,s.jsx)(a.BrowserRouter,{children:(0,s.jsx)(o.HelmetProvider,{children:(0,s.jsx)(e,{})})})});t.dontHydrate?(0,r.createRoot)(l).render(c):(0,r.hydrateRoot)(l,c)}}},__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__={};__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{Barrier:function(){return js_utils_.Barrier},BaseButton:function(){return BaseButton},BaseModal:function(){return BaseModal},Button:function(){return Button},Checkbox:function(){return components_Checkbox},CustomDropdown:function(){return CustomDropdown},Dropdown:function(){return NativeDropdown},Emitter:function(){return js_utils_.Emitter},GlobalStateProvider:function(){return react_global_state_.GlobalStateProvider},Input:function(){return components_Input},Link:function(){return components_Link},MetaTags:function(){return react_helmet_.MetaTags},Modal:function(){return Modal},NavLink:function(){return components_NavLink},PageLayout:function(){return components_PageLayout},Semaphore:function(){return js_utils_.Semaphore},Switch:function(){return Switch},TextArea:function(){return components_TextArea},ThemeProvider:function(){return react_themes_.ThemeProvider},Throbber:function(){return components_Throbber},WithTooltip:function(){return WithTooltip},YouTubeVideo:function(){return components_YouTubeVideo},client:function(){return client},config:function(){return utils_config},getGlobalState:function(){return react_global_state_.getGlobalState},getSsrContext:function(){return getSsrContext},isomorphy:function(){return isomorphy},newAsyncDataEnvelope:function(){return react_global_state_.newAsyncDataEnvelope},server:function(){return server},splitComponent:function(){return splitComponent},themed:function(){return themed},time:function(){return utils_time},useAsyncCollection:function(){return react_global_state_.useAsyncCollection},useAsyncData:function(){return react_global_state_.useAsyncData},useGlobalState:function(){return react_global_state_.useGlobalState},webpack:function(){return webpack},withGlobalStateType:function(){return react_global_state_.withGlobalStateType},withRetries:function(){return js_utils_.withRetries}});var global={},react_themes_=__webpack_require__(859),react_themes_default=__webpack_require__.n(react_themes_),environment_check=__webpack_require__(48),webpack=__webpack_require__(148),_ref;const config=null!==(_ref=environment_check.B?__webpack_require__(668).A().CONFIG:(0,webpack.requireWeak)("config"))&&void 0!==_ref?_ref:{};if(environment_check.B&&"undefined"!=typeof document){const e=__webpack_require__(462);config.CSRF=e.parse(document.cookie).csrfToken}var utils_config=config,isomorphy=__webpack_require__(724),external_cookie_=__webpack_require__(462),external_react_=__webpack_require__(155),external_dayjs_=__webpack_require__(185),external_dayjs_default=__webpack_require__.n(external_dayjs_),js_utils_=__webpack_require__(864),react_global_state_=__webpack_require__(126);const{getSsrContext:getSsrContext}=(0,react_global_state_.withGlobalStateType)();function useCurrent({autorefresh:e=!1,globalStatePath:t="currentTime",precision:n=5*js_utils_.SEC_MS}={}){const[r,o]=(0,react_global_state_.useGlobalState)(t,Date.now);return(0,external_react_.useEffect)(()=>{let t;const r=()=>{o(e=>{const t=Date.now();return Math.abs(t-e)>n?t:e}),e&&(t=setTimeout(r,n))};return r(),()=>{t&&clearTimeout(t)}},[e,n,o]),r}function useTimezoneOffset({cookieName:e="timezoneOffset",globalStatePath:t="timezoneOffset"}={}){const n=getSsrContext(!1),[r,o]=(0,react_global_state_.useGlobalState)(t,()=>{const t=e&&(null==n?void 0:n.req.cookies[e]);return t?parseInt(t):0});return(0,external_react_.useEffect)(()=>{const t=(new Date).getTimezoneOffset();o(t),e&&(document.cookie=(0,external_cookie_.serialize)(e,t.toString(),{path:"/"}))},[e,o]),r}const time={DAY_MS:js_utils_.DAY_MS,HOUR_MS:js_utils_.HOUR_MS,MIN_MS:js_utils_.MIN_MS,SEC_MS:js_utils_.SEC_MS,YEAR_MS:js_utils_.YEAR_MS,now:Date.now,timer:js_utils_.timer,useCurrent:useCurrent,useTimezoneOffset:useTimezoneOffset};var utils_time=Object.assign(external_dayjs_default(),time),jsx_runtime=__webpack_require__(922);let clientChunkGroups;var _require$default$CHUN;isomorphy.IS_CLIENT_SIDE&&(clientChunkGroups=null!==(_require$default$CHUN=__webpack_require__(668).A().CHUNK_GROUPS)&&void 0!==_require$default$CHUN?_require$default$CHUN:{});const refCounts={};function getPublicPath(){return(0,isomorphy.getBuildInfo)().publicPath}function bookStyleSheet(e,t,n){let r;const o=`${getPublicPath()}/${e}`,a=`${document.location.origin}${o}`;if(!t.has(a)){let e=document.querySelector(`link[href="${o}"]`);e||(e=document.createElement("link"),e.setAttribute("rel","stylesheet"),e.setAttribute("href",o),document.head.appendChild(e)),r=new js_utils_.Barrier,e.addEventListener("load",()=>{if(!r)throw Error("Internal error");r.resolve()}),e.addEventListener("error",()=>{if(!r)throw Error("Internal error");r.resolve()})}if(n){var i;const e=null!==(i=refCounts[o])&&void 0!==i?i:0;refCounts[o]=1+e}return r}function getLoadedStyleSheets(){const e=new Set,{styleSheets:t}=document;for(const{href:n}of t)n&&e.add(n);return e}function assertChunkName(e,t){if(!t[e])throw Error(`Unknown chunk name "${e}"`)}async function bookStyleSheets(e,t,n){const r=[],o=t[e];if(!o)return Promise.resolve();const a=getLoadedStyleSheets();for(const e of o)if(e.endsWith(".css")){const t=bookStyleSheet(e,a,n);t&&r.push(t)}return r.length?Promise.allSettled(r).then():Promise.resolve()}function freeStyleSheets(e,t){const n=t[e];if(n)for(const e of n)if(e.endsWith(".css")){const t=`${getPublicPath()}/${e}`,n=refCounts[t];n&&(n<=1?(document.head.querySelector(`link[href="${t}"]`).remove(),delete refCounts[t]):refCounts[t]=n-1)}}const usedChunkNames=new Set;function splitComponent({chunkName:e,getComponent:t,placeholder:n}){if(isomorphy.IS_CLIENT_SIDE&&assertChunkName(e,clientChunkGroups),usedChunkNames.has(e))throw Error(`Repeated splitComponent() call for the chunk "${e}"`);usedChunkNames.add(e);const r=(0,external_react_.lazy)(async()=>{const n=await t(),r="default"in n?n.default:n;return isomorphy.IS_CLIENT_SIDE&&await bookStyleSheets(e,clientChunkGroups,!1),{default:({children:t,ref:n,...o})=>{if(isomorphy.IS_SERVER_SIDE){const{chunkGroups:t,chunks:n}=getSsrContext();assertChunkName(e,t),n.includes(e)||n.push(e)}return(0,external_react_.useInsertionEffect)(()=>(bookStyleSheets(e,clientChunkGroups,!0),()=>{freeStyleSheets(e,clientChunkGroups)}),[]),(0,jsx_runtime.jsx)(r,{...o,ref:n,children:t})}}});return({children:e,...t})=>(0,jsx_runtime.jsx)(external_react_.Suspense,{fallback:n,children:(0,jsx_runtime.jsx)(r,{...t,children:e})})}const themed=react_themes_default();themed.COMPOSE=react_themes_.COMPOSE,themed.PRIORITY=react_themes_.PRIORITY;var react_helmet_=__webpack_require__(264);function isValue(e){const t=typeof e;return"number"===t||"string"===t}function optionValueName(e){var t;return isValue(e)?[e,e]:[e.value,null!==(t=e.name)&&void 0!==t?t:e.value]}var external_react_dom_=__webpack_require__(514),external_react_dom_default=__webpack_require__.n(external_react_dom_),base_theme={overlay:"ye2BZo",context:"Szmbbz",ad:"Ah-Nsc",hoc:"Wki41G",container:"gyZ4rc"},styles={scrollingDisabledByModal:"_5fRFtF"};const BaseModal=({cancelOnScrolling:e,children:t,containerStyle:n,dontDisableScrolling:r,onCancel:o,overlayStyle:a,style:i,testId:_,testIdForOverlay:s,theme:l})=>{const c=(0,external_react_.useRef)(null),u=(0,external_react_.useRef)(null),[d,m]=(0,external_react_.useState)();(0,external_react_.useEffect)(()=>{const e=document.createElement("div");return document.body.appendChild(e),m(e),()=>{document.body.removeChild(e)}},[]),(0,external_react_.useEffect)(()=>(e&&o&&(window.addEventListener("scroll",o),window.addEventListener("wheel",o)),()=>{e&&o&&(window.removeEventListener("scroll",o),window.removeEventListener("wheel",o))}),[e,o]),(0,external_react_.useEffect)(()=>(r||document.body.classList.add(styles.scrollingDisabledByModal),()=>{r||document.body.classList.remove(styles.scrollingDisabledByModal)}),[r]);const p=(0,external_react_.useMemo)(()=>(0,jsx_runtime.jsx)("div",{onFocus:()=>{var e;const t=c.current.querySelectorAll("*");for(let e=t.length-1;e>=0;--e)if(t[e].focus(),document.activeElement===t[e])return;null===(e=u.current)||void 0===e||e.focus()},tabIndex:0}),[]);return d?external_react_dom_default().createPortal((0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[p,(0,jsx_runtime.jsx)("div",{"aria-label":"Cancel",className:l.overlay,"data-testid":void 0,onClick:e=>{o&&(o(),e.stopPropagation())},onKeyDown:e=>{"Escape"===e.key&&o&&(o(),e.stopPropagation())},ref:e=>{e&&e!==u.current&&(u.current=e,e.focus())},role:"button",style:a,tabIndex:0}),(0,jsx_runtime.jsx)("div",{"aria-modal":"true",className:l.container,"data-testid":void 0,onClick:e=>{e.stopPropagation()},onWheel:e=>{e.stopPropagation()},ref:c,role:"dialog",style:null!=i?i:n,children:t}),(0,jsx_runtime.jsx)("div",{onFocus:()=>{var e;null===(e=u.current)||void 0===e||e.focus()},tabIndex:0}),p]}),d):null};var Modal=react_themes_default()(BaseModal,"Modal",base_theme),style={overlay:"jKsMKG"};function areEqual(e,t){return(null==e?void 0:e.left)===(null==t?void 0:t.left)&&(null==e?void 0:e.top)===(null==t?void 0:t.top)&&(null==e?void 0:e.width)===(null==t?void 0:t.width)}const Options=({containerClass:e,containerStyle:t,filter:n,onCancel:r,onChange:o,optionClass:a,options:i,ref:_})=>{const s=(0,external_react_.useRef)(null);(0,external_react_.useImperativeHandle)(_,()=>({measure:()=>{var e;const t=null===(e=s.current)||void 0===e?void 0:e.parentElement;if(!t)return;const n=s.current.getBoundingClientRect(),r=window.getComputedStyle(t),o=parseFloat(r.marginBottom),a=parseFloat(r.marginTop);return n.height+=o+a,n}}),[]);const l=[];for(const e of i)if(!n||n(e)){const[t,n]=optionValueName(e);l.push((0,jsx_runtime.jsx)("div",{className:a,onClick:e=>{o(t),e.stopPropagation()},onKeyDown:e=>{"Enter"===e.key&&(o(t),e.stopPropagation())},role:"button",tabIndex:0,children:n},t))}return(0,jsx_runtime.jsx)(BaseModal,{cancelOnScrolling:!0,dontDisableScrolling:!0,onCancel:r,style:t,theme:{ad:"",container:e,context:"",hoc:"",overlay:style.overlay},children:(0,jsx_runtime.jsx)("div",{ref:s,children:l})})};var CustomDropdown_Options=Options,theme={container:"oQKv0Y",context:"_9Tod5r",ad:"R58zIg",hoc:"O-Tp1i",label:"YUPUNs",dropdown:"pNEyAA",option:"LD2Kzy",select:"LP5azC",arrow:"-wscve",active:"k2UDsV",upward:"HWRvu4"};const BaseCustomDropdown=({filter:e,label:t,onChange:n,options:r,theme:o,value:a})=>{var i,_;const[s,l]=(0,external_react_.useState)(!1),c=(0,external_react_.useRef)(null),u=(0,external_react_.useRef)(null),[d,m]=(0,external_react_.useState)(),[p,f]=(0,external_react_.useState)(!1);(0,external_react_.useEffect)(()=>{if(!s)return;let e;const t=()=>{var n,r;const o=null===(n=c.current)||void 0===n?void 0:n.getBoundingClientRect(),a=null===(r=u.current)||void 0===r?void 0:r.measure();if(o&&a){var i,_;const e=o.bottom+a.height<(null!==(i=null===(_=window.visualViewport)||void 0===_?void 0:_.height)&&void 0!==i?i:0),t=o.top-a.height>0,n=!e&&t;f(n);const r=n?{left:o.left,top:o.top-a.height-1,width:o.width}:{left:o.left,top:o.bottom,width:o.width};m(e=>areEqual(e,r)?e:r)}e=requestAnimationFrame(t)};return requestAnimationFrame(t),()=>{cancelAnimationFrame(e)}},[s]);const h=e=>{var t,n;const r=window.visualViewport,o=c.current.getBoundingClientRect();l(!0),m({left:null!==(t=null==r?void 0:r.width)&&void 0!==t?t:0,top:null!==(n=null==r?void 0:r.height)&&void 0!==n?n:0,width:o.width}),e.stopPropagation()};let b=(0,jsx_runtime.jsx)(jsx_runtime.Fragment,{children:""});for(const t of r)if(!e||e(t)){const[e,n]=optionValueName(t);if(e===a){b=n;break}}let E=o.container;s&&(E+=` ${o.active}`);let x=null!==(i=o.select)&&void 0!==i?i:"";return p&&(E+=` ${o.upward}`,x+=` ${o.upward}`),(0,jsx_runtime.jsxs)("div",{className:E,children:[void 0===t?null:(0,jsx_runtime.jsx)("div",{className:o.label,children:t}),(0,jsx_runtime.jsxs)("div",{className:o.dropdown,onClick:h,onKeyDown:e=>{"Enter"===e.key&&h(e)},ref:c,role:"listbox",tabIndex:0,children:[b,(0,jsx_runtime.jsx)("div",{className:o.arrow})]}),s?(0,jsx_runtime.jsx)(CustomDropdown_Options,{containerClass:x,containerStyle:d,onCancel:()=>{l(!1)},onChange:e=>{l(!1),n&&n(e)},optionClass:null!==(_=o.option)&&void 0!==_?_:"",options:r,ref:u}):null]})};var CustomDropdown=react_themes_default()(BaseCustomDropdown,"CustomDropdown",theme),NativeDropdown_theme={dropdown:"kI9A9U",context:"xHyZo4",ad:"ADu59e",hoc:"FTP2bb",arrow:"DubGkT",container:"WtSZPd",active:"ayMn7O",label:"K7JYKw",option:"_27pZ6W",hiddenOption:"clAKFJ",select:"N0Fc14",invalid:"wL4umU"};const Dropdown=({filter:e,label:t,onChange:n,options:r,testId:o,theme:a,value:i})=>{let _=!1;const s=[];for(const t of r)if(!e||e(t)){const[e,n]=optionValueName(t);_||(_=e===i),s.push((0,jsx_runtime.jsx)("option",{className:a.option,value:e,children:n},e))}const l=_?null:(0,jsx_runtime.jsx)("option",{className:a.hiddenOption,disabled:!0,value:i,children:i},"__reactUtilsHiddenOption");let c=a.select;return _||(c+=` ${a.invalid}`),(0,jsx_runtime.jsxs)("div",{className:a.container,children:[void 0===t?null:(0,jsx_runtime.jsx)("div",{className:a.label,children:t}),(0,jsx_runtime.jsxs)("div",{className:a.dropdown,children:[(0,jsx_runtime.jsxs)("select",{className:c,"data-testid":void 0,onChange:n,value:i,children:[l,s]}),(0,jsx_runtime.jsx)("div",{className:a.arrow})]})]})};var NativeDropdown=react_themes_default()(Dropdown,"Dropdown",NativeDropdown_theme),Switch_theme={container:"AWNvRj",context:"VMHfnP",ad:"HNliRC",hoc:"_2Ue-db",option:"fUfIAd",selected:"Wco-qk",options:"CZYtcC"};const BaseSwitch=({label:e,onChange:t,options:n,theme:r,value:o})=>{if(!n||!r.option)throw Error("Internal error");const a=[];for(const e of n){const[n,i]=optionValueName(e);let _,s=r.option;n===o?s+=` ${r.selected}`:t&&(_=()=>{t(n)}),a.push(_?(0,jsx_runtime.jsx)("div",{className:s,onClick:_,onKeyDown:e=>{"Enter"===e.key&&_()},role:"button",tabIndex:0,children:i},n):(0,jsx_runtime.jsx)("div",{className:s,children:i},n))}return(0,jsx_runtime.jsxs)("div",{className:r.container,children:[e?(0,jsx_runtime.jsx)("div",{className:r.label,children:e}):null,(0,jsx_runtime.jsx)("div",{className:r.options,children:a})]})};var Switch=react_themes_default()(BaseSwitch,"Switch",Switch_theme),external_react_router_=__webpack_require__(707),GenericLink_style={link:"zH52sA"};const GenericLink=({children:e,className:t,disabled:n,enforceA:r,keepScrollPosition:o,onClick:a,onMouseDown:i,openNewTab:_,replace:s,routerLinkType:l,to:c,...u})=>{if(n||r||_||c.match(/^(#|(https?|mailto):)/))return(0,jsx_runtime.jsx)("a",{className:(t?t+" ":"")+"zH52sA",href:c,onClick:n?e=>{e.preventDefault()}:a,onMouseDown:n?e=>{e.preventDefault()}:i,rel:"noopener noreferrer",target:_?"_blank":"",children:e});const d=l;return(0,jsx_runtime.jsx)(d,{className:t,discover:"none",onClick:e=>{a&&a(e),o||window.scroll(0,0)},onMouseDown:i,replace:s,to:c,...u,children:e})};var components_GenericLink=GenericLink;const Link=e=>(0,jsx_runtime.jsx)(components_GenericLink,{...e,routerLinkType:external_react_router_.Link});var components_Link=Link,Button_style={button:"E1FNQT",context:"KM0v4f",ad:"_3jm1-Q",hoc:"_0plpDL",active:"MAe9O6",disabled:"Br9IWV"};const BaseButton=({active:e,children:t,disabled:n,enforceA:r,onClick:o,onMouseDown:a,onMouseUp:i,onPointerDown:_,onPointerUp:s,openNewTab:l,replace:c,testId:u,theme:d,to:m})=>{let p=d.button;return e&&d.active&&(p+=` ${d.active}`),n?(d.disabled&&(p+=` ${d.disabled}`),(0,jsx_runtime.jsx)("div",{className:p,"data-testid":void 0,children:t})):m?(0,jsx_runtime.jsx)(components_Link,{className:p,"data-testid":void 0,enforceA:r,onClick:o,onMouseDown:a,onMouseUp:i,onPointerDown:_,onPointerUp:s,openNewTab:l,replace:c,to:m,children:t}):(0,jsx_runtime.jsx)("div",{className:p,"data-testid":void 0,onClick:o,onKeyDown:o?e=>{"Enter"===e.key&&o(e)}:void 0,onMouseDown:a,onMouseUp:i,onPointerDown:_,onPointerUp:s,role:"button",tabIndex:0,children:t})};var Button=react_themes_default()(BaseButton,"Button",Button_style),Checkbox_theme={checkbox:"A-f8qJ",context:"dNQcC6",ad:"earXxa",hoc:"qAPfQ6",indeterminate:"N9bCb8",container:"Kr0g3M",label:"_3dML-O",disabled:"EzQra1"};const Checkbox=({checked:e,disabled:t,label:n,onChange:r,testId:o,theme:a})=>{let i=a.container;t&&(i+=` ${a.disabled}`);let _=a.checkbox;return"indeterminate"===e&&(_+=` ${a.indeterminate}`),(0,jsx_runtime.jsxs)("div",{className:i,children:[void 0===n?null:(0,jsx_runtime.jsx)("div",{className:a.label,children:n}),(0,jsx_runtime.jsx)("input",{checked:void 0===e?void 0:!0===e,className:_,"data-testid":void 0,disabled:t,onChange:r,onClick:e=>{e.stopPropagation()},type:"checkbox"})]})};var components_Checkbox=react_themes_default()(Checkbox,"Checkbox",Checkbox_theme),Input_theme={container:"Cxx397",context:"X5WszA",ad:"_8s7GCr",hoc:"TVlBYc",input:"M07d4s",label:"gfbdq-"};const Input=({label:e,ref:t,testId:n,theme:r,...o})=>(0,jsx_runtime.jsxs)("span",{className:r.container,children:[void 0===e?null:(0,jsx_runtime.jsx)("div",{className:r.label,children:e}),(0,jsx_runtime.jsx)("input",{className:r.input,"data-testid":void 0,ref:t,...o})]});var components_Input=react_themes_default()(Input,"Input",Input_theme),PageLayout_base_theme={container:"T3cuHB",context:"m4mL-M",ad:"m3-mdC",hoc:"J15Z4H",mainPanel:"pPlQO2",sidePanel:"lqNh4h"};const PageLayout=({children:e,leftSidePanelContent:t,rightSidePanelContent:n,theme:r})=>(0,jsx_runtime.jsxs)("div",{className:r.container,children:[(0,jsx_runtime.jsx)("div",{className:[r.sidePanel,r.leftSidePanel].join(" "),children:t}),(0,jsx_runtime.jsx)("div",{className:r.mainPanel,children:e}),(0,jsx_runtime.jsx)("div",{className:[r.sidePanel,r.rightSidePanel].join(" "),children:n})]});var components_PageLayout=react_themes_default()(PageLayout,"PageLayout",PageLayout_base_theme);const NavLink=e=>(0,jsx_runtime.jsx)(components_GenericLink,{...e,routerLinkType:external_react_router_.NavLink});var components_NavLink=NavLink,Throbber_theme={container:"_7zdld4",context:"uIObt7",ad:"XIxe9o",hoc:"YOyORH",circle:"dBrB4g",bouncing:"TJe-6j"};const Throbber=({theme:e})=>(0,jsx_runtime.jsxs)("span",{className:e.container,children:[(0,jsx_runtime.jsx)("span",{className:e.circle}),(0,jsx_runtime.jsx)("span",{className:e.circle}),(0,jsx_runtime.jsx)("span",{className:e.circle})]});var components_Throbber=react_themes_default()(Throbber,"Throbber",Throbber_theme);let PLACEMENTS=function(e){return e.ABOVE_CURSOR="ABOVE_CURSOR",e.ABOVE_ELEMENT="ABOVE_ELEMENT",e.BELOW_CURSOR="BELOW_CURSOR",e.BELOW_ELEMENT="BELOW_ELEMENT",e}({});const ARROW_STYLE_DOWN=["border-bottom-color:transparent","border-left-color:transparent","border-right-color:transparent"].join(";"),ARROW_STYLE_UP=["border-top-color:transparent","border-left-color:transparent","border-right-color:transparent"].join(";");function createTooltipComponents(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),{arrow:t,container:r,content:n}}function calcTooltipRects(e){return{arrow:e.arrow.getBoundingClientRect(),container:e.container.getBoundingClientRect()}}function calcViewportRect(){const{scrollX:e,scrollY:t}=window,{documentElement:{clientHeight:n,clientWidth:r}}=document;return{bottom:t+n,left:e,right:e+r,top:t}}function calcPositionAboveXY(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:ARROW_STYLE_DOWN}}function setComponentPositions(e,t,n,r,o){const a=calcTooltipRects(o),i=calcViewportRect(),_=calcPositionAboveXY(e,t,a);if(_.containerX<i.left+6)_.containerX=i.left+6,_.arrowX=Math.max(6,e-_.containerX-a.arrow.width/2);else{const t=i.right-6-a.container.width;_.containerX>t&&(_.containerX=t,_.arrowX=Math.min(a.container.width-6,e-_.containerX-a.arrow.width/2))}_.containerY<i.top+6&&(_.containerY+=a.container.height+2*a.arrow.height,_.arrowY-=a.container.height+a.arrow.height,_.baseArrowStyle=ARROW_STYLE_UP);const s=`left:${_.containerX}px;top:${_.containerY}px`;o.container.setAttribute("style",s);const l=`${_.baseArrowStyle};left:${_.arrowX}px;top:${_.arrowY}px`;o.arrow.setAttribute("style",l)}const Tooltip=({children:e,ref:t,theme:n})=>{const{current:r}=(0,external_react_.useRef)({lastElement:void 0,lastPageX:0,lastPageY:0,lastPlacement:void 0}),[o,a]=(0,external_react_.useState)(null),i=(e,t,n,a)=>{r.lastElement=a,r.lastPageX=e,r.lastPageY=t,r.lastPlacement=n,o&&setComponentPositions(e,t,n,a,o)};return(0,external_react_.useImperativeHandle)(t,()=>({pointTo:i})),(0,external_react_.useEffect)(()=>{const e=createTooltipComponents(n);return a(e),()=>{document.body.removeChild(e.container),a(null)}},[n]),(0,external_react_.useEffect)(()=>{o&&setComponentPositions(r.lastPageX,r.lastPageY,r.lastPlacement,r.lastElement,o)},[o,r.lastPageX,r.lastPageY,r.lastPlacement,r.lastElement]),o?(0,external_react_dom_.createPortal)(e,o.content):null};var WithTooltip_Tooltip=Tooltip,default_theme={arrow:"M9gywF",ad:"_4xT7zE",hoc:"zd-vnH",context:"GdZucr",container:"f9gY8K",appearance:"L4ubm-",wrapper:"_4qDBRM"};const Wrapper=({children:e,placement:t=PLACEMENTS.ABOVE_CURSOR,tip:n,theme:r})=>{const{current:o}=(0,external_react_.useRef)({lastCursorX:0,lastCursorY:0,timerId:void 0,triggeredByTouch:!1}),a=(0,external_react_.useRef)(null),i=(0,external_react_.useRef)(null),[_,s]=(0,external_react_.useState)(!1);return(0,external_react_.useEffect)(()=>{if(_&&null!==n){a.current&&a.current.pointTo(o.lastCursorX+window.scrollX,o.lastCursorY+window.scrollY,t,i.current);const e=()=>{s(!1)};return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}}},[o.lastCursorX,o.lastCursorY,t,_,n]),(0,jsx_runtime.jsxs)("div",{className:r.wrapper,onClick:()=>{o.timerId&&(clearTimeout(o.timerId),o.timerId=void 0,o.triggeredByTouch=!1)},onMouseLeave:()=>{s(!1)},onMouseMove:e=>{((e,n)=>{if(_){const r=i.current.getBoundingClientRect();e<r.left||e>r.right||n<r.top||n>r.bottom?s(!1):a.current&&a.current.pointTo(e+window.scrollX,n+window.scrollY,t,i.current)}else{var r;o.lastCursorX=e,o.lastCursorY=n,o.triggeredByTouch?null!==(r=o.timerId)&&void 0!==r||(o.timerId=setTimeout(()=>{o.triggeredByTouch=!1,o.timerId=void 0,s(!0)},300)):s(!0)}})(e.clientX,e.clientY)},onTouchStart:()=>{o.triggeredByTouch=!0},ref:i,role:"presentation",children:[_&&null!==n?(0,jsx_runtime.jsx)(WithTooltip_Tooltip,{ref:a,theme:r,children:n}):null,e]})},ThemedWrapper=react_themes_default()(Wrapper,"WithTooltip",default_theme),e=ThemedWrapper;e.PLACEMENTS=PLACEMENTS;var WithTooltip=e,external_qs_=__webpack_require__(360),external_qs_default=__webpack_require__.n(external_qs_),base={container:"sXHM81",context:"veKyYi",ad:"r3ABzd",hoc:"YKcPnR",video:"SlV2zw"},throbber={container:"jTxmOX",context:"dzIcLh",ad:"_5a9XX1",hoc:"_7sH52O"};const YouTubeVideo=({autoplay:e,src:t,theme:n,title:r})=>{var o,a;const i=t.split("?");let[_]=i;const[,s]=i,l=s?external_qs_default().parse(s):{};return _=`https://www.youtube.com/embed/${null!==(o=l.v)&&void 0!==o?o:null===(a=_)||void 0===a||null===(a=a.match(/\/([a-zA-Z0-9-_]*)$/))||void 0===a?void 0:a[1]}`,delete l.v,l.autoplay=e?"1":"0",_+=`?${external_qs_default().stringify(l)}`,(0,jsx_runtime.jsxs)("div",{className:n.container,children:[(0,jsx_runtime.jsx)(components_Throbber,{theme:throbber}),(0,jsx_runtime.jsx)("iframe",{allow:"autoplay",allowFullScreen:!0,className:n.video,src:_,title:r})]})};var components_YouTubeVideo=react_themes_default()(YouTubeVideo,"YouTubeVideo",base),TextArea_style={container:"dzMVIB",context:"KVPc7g",ad:"z2GQ0Z",hoc:"_8R1Qdj",label:"Vw9EKL",textarea:"zd-OFg",hidden:"GiHBXI"};const TextArea=({disabled:e,label:t,onBlur:n,onChange:r,onKeyDown:o,placeholder:a,testId:i,theme:_,value:s})=>{const l=(0,external_react_.useRef)(null),[c,u]=(0,external_react_.useState)(),[d,m]=(0,external_react_.useState)(null!=s?s:"");return void 0!==s&&d!==s&&m(s),(0,external_react_.useEffect)(()=>{const e=l.current;if(!e)return;const t=new ResizeObserver(()=>{u(e.scrollHeight)});return t.observe(e),()=>{t.disconnect()}},[]),(0,external_react_.useLayoutEffect)(()=>{const e=l.current;e&&u(e.scrollHeight)},[d]),(0,jsx_runtime.jsxs)("div",{className:_.container,children:[void 0===t?null:(0,jsx_runtime.jsx)("div",{className:_.label,children:t}),(0,jsx_runtime.jsx)("textarea",{className:`${_.textarea} ${_.hidden}`,readOnly:!0,ref:l,tabIndex:-1,value:d||" "}),(0,jsx_runtime.jsx)("textarea",{className:_.textarea,"data-testid":void 0,disabled:e,onBlur:n,onChange:void 0===s?e=>{m(e.target.value)}:r,onKeyDown:o,placeholder:a,style:{height:c},value:d})]})};var components_TextArea=react_themes_default()(TextArea,"TextArea",TextArea_style),src_dirname="/";if(__webpack_require__.g.REACT_UTILS_LIBRARY_LOADED)throw Error("React utils library is already loaded");__webpack_require__.g.REACT_UTILS_LIBRARY_LOADED=!0;const server=webpack.requireWeak("./server",src_dirname),client=server?void 0:__webpack_require__(969).A;return __webpack_exports__}()});
|
|
3
3
|
//# sourceMappingURL=web.bundle.js.map
|