@dr.pogodin/react-utils 1.42.0 → 1.43.0
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/babel.config.js +3 -0
- package/bin/build.js +5 -8
- package/bin/setup.js +2 -1
- package/build/development/client/getInj.js +7 -2
- package/build/development/client/getInj.js.map +1 -1
- package/build/development/client/index.js +1 -2
- package/build/development/client/index.js.map +1 -1
- package/build/development/client/init.js +16 -13
- package/build/development/client/init.js.map +1 -1
- package/build/development/index.js +4 -1
- package/build/development/index.js.map +1 -1
- package/build/development/server/Cache.js +5 -9
- package/build/development/server/Cache.js.map +1 -1
- package/build/development/server/index.js +14 -11
- package/build/development/server/index.js.map +1 -1
- package/build/development/server/renderer.js +36 -40
- package/build/development/server/renderer.js.map +1 -1
- package/build/development/server/server.js +19 -12
- package/build/development/server/server.js.map +1 -1
- package/build/development/server/utils/errors.js.map +1 -1
- package/build/development/shared/components/Button/index.js +2 -3
- package/build/development/shared/components/Button/index.js.map +1 -1
- package/build/development/shared/components/Checkbox/index.js +3 -1
- package/build/development/shared/components/Checkbox/index.js.map +1 -1
- package/build/development/shared/components/GenericLink/index.js +13 -6
- package/build/development/shared/components/GenericLink/index.js.map +1 -1
- package/build/development/shared/components/Input/index.js +5 -1
- package/build/development/shared/components/Input/index.js.map +1 -1
- package/build/development/shared/components/Link.js +5 -6
- package/build/development/shared/components/Link.js.map +1 -1
- package/build/development/shared/components/MetaTags.js +31 -24
- package/build/development/shared/components/MetaTags.js.map +1 -1
- package/build/development/shared/components/Modal/index.js +13 -6
- package/build/development/shared/components/Modal/index.js.map +1 -1
- package/build/development/shared/components/NavLink.js +6 -6
- package/build/development/shared/components/NavLink.js.map +1 -1
- package/build/development/shared/components/TextArea/index.js +6 -3
- package/build/development/shared/components/TextArea/index.js.map +1 -1
- package/build/development/shared/components/WithTooltip/Tooltip.js +35 -39
- package/build/development/shared/components/WithTooltip/Tooltip.js.map +1 -1
- package/build/development/shared/components/WithTooltip/index.js +27 -21
- package/build/development/shared/components/WithTooltip/index.js.map +1 -1
- package/build/development/shared/components/YouTubeVideo/index.js +4 -3
- package/build/development/shared/components/YouTubeVideo/index.js.map +1 -1
- package/build/development/shared/components/selectors/CustomDropdown/Options/index.js +4 -5
- package/build/development/shared/components/selectors/CustomDropdown/Options/index.js.map +1 -1
- package/build/development/shared/components/selectors/CustomDropdown/index.js +7 -9
- package/build/development/shared/components/selectors/CustomDropdown/index.js.map +1 -1
- package/build/development/shared/components/selectors/NativeDropdown/index.js +3 -5
- package/build/development/shared/components/selectors/NativeDropdown/index.js.map +1 -1
- package/build/development/shared/components/selectors/Switch/index.js +21 -20
- package/build/development/shared/components/selectors/Switch/index.js.map +1 -1
- package/build/development/shared/utils/config.js +6 -3
- package/build/development/shared/utils/config.js.map +1 -1
- package/build/development/shared/utils/globalState.js +6 -0
- package/build/development/shared/utils/globalState.js.map +1 -1
- package/build/development/shared/utils/isomorphy/buildInfo.js.map +1 -1
- package/build/development/shared/utils/isomorphy/environment-check.js +6 -1
- package/build/development/shared/utils/isomorphy/environment-check.js.map +1 -1
- package/build/development/shared/utils/isomorphy/index.js +1 -3
- package/build/development/shared/utils/isomorphy/index.js.map +1 -1
- package/build/development/shared/utils/jest/E2eSsrEnv.js +26 -17
- package/build/development/shared/utils/jest/E2eSsrEnv.js.map +1 -1
- package/build/development/shared/utils/jest/global.js +0 -7
- package/build/development/shared/utils/jest/global.js.map +1 -1
- package/build/development/shared/utils/jest/index.js +15 -4
- package/build/development/shared/utils/jest/index.js.map +1 -1
- package/build/development/shared/utils/splitComponent.js +37 -19
- package/build/development/shared/utils/splitComponent.js.map +1 -1
- package/build/development/shared/utils/time.js +3 -3
- package/build/development/shared/utils/time.js.map +1 -1
- package/build/development/shared/utils/webpack.js +11 -11
- package/build/development/shared/utils/webpack.js.map +1 -1
- package/build/development/web.bundle.js +30 -30
- package/build/production/client/getInj.js +4 -2
- package/build/production/client/getInj.js.map +1 -1
- package/build/production/client/index.js +2 -2
- package/build/production/client/index.js.map +1 -1
- package/build/production/client/init.js +4 -2
- package/build/production/client/init.js.map +1 -1
- package/build/production/index.js +2 -1
- package/build/production/index.js.map +1 -1
- package/build/production/server/Cache.js +1 -2
- package/build/production/server/Cache.js.map +1 -1
- package/build/production/server/index.js +9 -5
- package/build/production/server/index.js.map +1 -1
- package/build/production/server/renderer.js +24 -21
- package/build/production/server/renderer.js.map +1 -1
- package/build/production/server/server.js +13 -8
- package/build/production/server/server.js.map +1 -1
- package/build/production/server/utils/errors.js.map +1 -1
- package/build/production/shared/components/Button/index.js +1 -1
- package/build/production/shared/components/Button/index.js.map +1 -1
- package/build/production/shared/components/Checkbox/index.js +1 -1
- package/build/production/shared/components/Checkbox/index.js.map +1 -1
- package/build/production/shared/components/GenericLink/index.js +6 -4
- package/build/production/shared/components/GenericLink/index.js.map +1 -1
- package/build/production/shared/components/Input/index.js +3 -1
- package/build/production/shared/components/Input/index.js.map +1 -1
- package/build/production/shared/components/Link.js +3 -1
- package/build/production/shared/components/Link.js.map +1 -1
- package/build/production/shared/components/MetaTags.js +5 -2
- package/build/production/shared/components/MetaTags.js.map +1 -1
- package/build/production/shared/components/Modal/index.js +6 -2
- package/build/production/shared/components/Modal/index.js.map +1 -1
- package/build/production/shared/components/NavLink.js +4 -1
- package/build/production/shared/components/NavLink.js.map +1 -1
- package/build/production/shared/components/TextArea/index.js +4 -4
- package/build/production/shared/components/TextArea/index.js.map +1 -1
- package/build/production/shared/components/WithTooltip/Tooltip.js +37 -38
- package/build/production/shared/components/WithTooltip/Tooltip.js.map +1 -1
- package/build/production/shared/components/WithTooltip/index.js +4 -4
- package/build/production/shared/components/WithTooltip/index.js.map +1 -1
- package/build/production/shared/components/YouTubeVideo/index.js +3 -2
- package/build/production/shared/components/YouTubeVideo/index.js.map +1 -1
- package/build/production/shared/components/selectors/CustomDropdown/Options/index.js +2 -2
- package/build/production/shared/components/selectors/CustomDropdown/Options/index.js.map +1 -1
- package/build/production/shared/components/selectors/CustomDropdown/index.js +2 -2
- package/build/production/shared/components/selectors/CustomDropdown/index.js.map +1 -1
- package/build/production/shared/components/selectors/NativeDropdown/index.js +2 -2
- package/build/production/shared/components/selectors/NativeDropdown/index.js.map +1 -1
- package/build/production/shared/components/selectors/Switch/index.js +1 -1
- package/build/production/shared/components/selectors/Switch/index.js.map +1 -1
- package/build/production/shared/utils/config.js +6 -4
- package/build/production/shared/utils/config.js.map +1 -1
- package/build/production/shared/utils/globalState.js +4 -1
- package/build/production/shared/utils/globalState.js.map +1 -1
- package/build/production/shared/utils/isomorphy/buildInfo.js.map +1 -1
- package/build/production/shared/utils/isomorphy/environment-check.js +5 -1
- package/build/production/shared/utils/isomorphy/environment-check.js.map +1 -1
- package/build/production/shared/utils/isomorphy/index.js +1 -3
- package/build/production/shared/utils/isomorphy/index.js.map +1 -1
- package/build/production/shared/utils/jest/E2eSsrEnv.js +15 -8
- package/build/production/shared/utils/jest/E2eSsrEnv.js.map +1 -1
- package/build/production/shared/utils/jest/global.js +1 -1
- package/build/production/shared/utils/jest/global.js.map +1 -1
- package/build/production/shared/utils/jest/index.js +13 -5
- package/build/production/shared/utils/jest/index.js.map +1 -1
- package/build/production/shared/utils/splitComponent.js +16 -8
- package/build/production/shared/utils/splitComponent.js.map +1 -1
- package/build/production/shared/utils/time.js +2 -2
- package/build/production/shared/utils/time.js.map +1 -1
- package/build/production/shared/utils/webpack.js +5 -2
- 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/client/getInj.d.ts +1 -1
- package/build/types-code/client/index.d.ts +2 -2
- package/build/types-code/client/init.d.ts +1 -1
- package/build/types-code/index.d.ts +6 -5
- package/build/types-code/server/Cache.d.ts +1 -2
- package/build/types-code/server/index.d.ts +4 -5
- package/build/types-code/server/renderer.d.ts +8 -10
- package/build/types-code/server/server.d.ts +3 -5
- package/build/types-code/server/utils/errors.d.ts +1 -1
- package/build/types-code/shared/components/Button/index.d.ts +2 -2
- package/build/types-code/shared/components/TextArea/index.d.ts +3 -3
- package/build/types-code/shared/components/WithTooltip/Tooltip.d.ts +7 -1
- package/build/types-code/shared/components/index.d.ts +12 -12
- package/build/types-code/shared/utils/config.d.ts +1 -1
- package/build/types-code/shared/utils/globalState.d.ts +3 -6
- package/build/types-code/shared/utils/isomorphy/index.d.ts +1 -3
- package/build/types-code/shared/utils/jest/E2eSsrEnv.d.ts +1 -1
- package/build/types-code/shared/utils/jest/global.d.ts +4 -4
- package/build/types-code/shared/utils/jest/index.d.ts +2 -2
- package/build/types-code/shared/utils/webpack.d.ts +1 -1
- package/config/babel/node-ssr.d.ts +3 -2
- package/config/babel/node-ssr.js +5 -7
- package/config/babel/webpack.d.ts +3 -11
- package/config/babel/webpack.js +15 -15
- package/config/eslint/default.mjs +32 -0
- package/config/jest/default.js +10 -6
- package/config/jest/resolver.js +2 -0
- package/config/jest/setup.js +2 -2
- package/config/stylelint/default.js +3 -0
- package/config/webpack/app-base.d.ts +0 -6
- package/config/webpack/app-base.js +64 -70
- package/config/webpack/app-development.d.ts +2 -2
- package/config/webpack/app-development.js +8 -12
- package/config/webpack/app-production.js +1 -0
- package/config/webpack/lib-base.js +20 -18
- package/config/webpack/lib-development.js +1 -0
- package/config/webpack/lib-production.js +1 -0
- package/config/workbox/default.js +2 -5
- package/dev-styles.js +1 -0
- package/eslint.config.mjs +13 -0
- package/node-entry.js +7 -2
- package/null.js +1 -0
- package/package.json +17 -25
- package/prod-styles.js +1 -0
- package/src/client/getInj.ts +8 -3
- package/src/client/index.tsx +4 -4
- package/src/client/init.ts +18 -15
- package/src/index.ts +8 -3
- package/src/server/Cache.ts +7 -15
- package/src/server/index.ts +30 -21
- package/src/server/renderer.tsx +76 -66
- package/src/server/server.ts +38 -20
- package/src/server/utils/errors.ts +6 -3
- package/src/shared/components/Button/index.tsx +4 -5
- package/src/shared/components/Checkbox/index.tsx +10 -7
- package/src/shared/components/GenericLink/index.tsx +14 -7
- package/src/shared/components/Input/index.tsx +4 -1
- package/src/shared/components/Link.tsx +9 -5
- package/src/shared/components/MetaTags.tsx +21 -15
- package/src/shared/components/Modal/index.tsx +12 -11
- package/src/shared/components/NavLink.tsx +10 -5
- package/src/shared/components/TextArea/index.tsx +17 -9
- package/src/shared/components/WithTooltip/{Tooltip.tsx → Tooltip.ts} +35 -39
- package/src/shared/components/WithTooltip/index.tsx +36 -30
- package/src/shared/components/YouTubeVideo/index.tsx +10 -6
- package/src/shared/components/selectors/CustomDropdown/Options/index.tsx +5 -6
- package/src/shared/components/selectors/CustomDropdown/index.tsx +10 -14
- package/src/shared/components/selectors/NativeDropdown/index.tsx +5 -7
- package/src/shared/components/selectors/Switch/index.tsx +19 -17
- package/src/shared/utils/config.ts +12 -5
- package/src/shared/utils/globalState.ts +8 -5
- package/src/shared/utils/isomorphy/buildInfo.ts +1 -1
- package/src/shared/utils/isomorphy/environment-check.ts +5 -1
- package/src/shared/utils/isomorphy/index.ts +4 -6
- package/src/shared/utils/jest/E2eSsrEnv.ts +64 -39
- package/src/shared/utils/jest/global.ts +6 -8
- package/src/shared/utils/jest/{index.tsx → index.ts} +25 -12
- package/src/shared/utils/splitComponent.tsx +44 -25
- package/src/shared/utils/time.ts +16 -9
- package/src/shared/utils/webpack.ts +19 -14
- package/webpack.config.ts +36 -10
- package/config/eslint/default.json +0 -30
- package/config/eslint/jest.json +0 -19
- package/config/eslint/typescript.js +0 -46
|
@@ -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","
|
|
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","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 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\ntype SnapshotOptionsT = {\n await?: Promise<void>;\n};\n\nexport async function snapshot(\n element: React.ReactElement,\n options?: SnapshotOptionsT,\n): Promise<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) await promise;\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,QAA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,IAAM,CACRP,IAAI,CAAG,GAAAa,kBAAU,EAAChC,GAAG,CAAC,CACtBmB,IAAI,CAACc,MAAM,CAACf,KAAK,CACnB,CAAC,CAAC,CACF,MAAO,CAAAlB,GACT,CAMO,cAAe,CAAA6B,QAAQA,CAC5BT,OAA2B,CAC3Bc,OAA0B,CACH,CACvB,GAAI,CAAAlC,GAA6B,CAEjC;AACA;AACA;AACA;AACA;AACA;AACA,KAAM,CAAAmC,OAAO,CAAG,GAAAT,UAAG,EAAC,IAAM,CACxB1B,GAAG,CAAG,GAAAiC,cAAM,EAACb,OAAO,CAAC,CACrB,MAAO,CAAAc,OAAO,EAAEE,KAClB,CAAC,CAAC,CAEF,GAAIpC,GAAG,GAAKlB,SAAS,CAAE,KAAM,CAAAuD,KAAK,CAAC,eAAe,CAAC,CACnD,GAAIH,OAAO,EAAEE,KAAK,CAAE,KAAM,CAAAD,OAAO,CAEjC,KAAM,CAAAG,KAAK,CAAGtC,GAAG,CAACuC,UAAU,CAAC,CAAC,CAACC,UAAU,CACzCV,MAAM,CAACQ,KAAK,CAACG,MAAM,CAAG,CAAC,CAAG,CAAC,GAAGH,KAAK,CAAC,CAAGA,KAAK,CAAC,CAAC,CAAC,CAAC,CAACP,eAAe,CAAC,CAAC,CAClE,MAAO,CAAA/B,GACT","ignoreList":[]}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.bookStyleSheets=bookStyleSheets;exports.default=splitComponent;exports.freeStyleSheets=freeStyleSheets;var _react=require("react");var _jsUtils=require("@dr.pogodin/js-utils");var _globalState=require("./globalState");var _isomorphy=require("./isomorphy");var _jsxRuntime=require("react/jsx-runtime");/*
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.bookStyleSheets=bookStyleSheets;exports.default=splitComponent;exports.freeStyleSheets=freeStyleSheets;var _react=require("react");var _jsUtils=require("@dr.pogodin/js-utils");var _globalState=require("./globalState");var _isomorphy=require("./isomorphy");var _jsxRuntime=require("react/jsx-runtime");/* global document */// Note: At the client side we can get chunk groups immediately when loading
|
|
2
2
|
// the module; at the server-side we only can get them within React render flow.
|
|
3
3
|
// Thus, we set and use the following variable at the client-side, and then when
|
|
4
4
|
// needed on the server side, we'll fetch it differently.
|
|
5
|
-
let clientChunkGroups;if(_isomorphy.IS_CLIENT_SIDE){//
|
|
6
|
-
|
|
5
|
+
let clientChunkGroups;if(_isomorphy.IS_CLIENT_SIDE){// TODO: Rewrite to avoid these overrides of ESLint rules.
|
|
6
|
+
/* eslint-disable @typescript-eslint/no-unsafe-assignment,
|
|
7
|
+
@typescript-eslint/no-require-imports,
|
|
8
|
+
@typescript-eslint/no-unsafe-call,
|
|
9
|
+
@typescript-eslint/no-unsafe-member-access */clientChunkGroups=require("../../client/getInj").default().CHUNK_GROUPS??{};/* eslint-enable @typescript-eslint/no-unsafe-assignment,
|
|
10
|
+
@typescript-eslint/no-require-imports,
|
|
11
|
+
@typescript-eslint/no-unsafe-call,
|
|
12
|
+
@typescript-eslint/no-unsafe-member-access */}const refCounts={};function getPublicPath(){return(0,_isomorphy.getBuildInfo)().publicPath}/**
|
|
7
13
|
* Client-side only! Ensures the specified CSS stylesheet is loaded into
|
|
8
14
|
* the document; loads if it is missing; and does simple reference counting
|
|
9
15
|
* to facilitate future clean-up.
|
|
@@ -11,10 +17,10 @@ clientChunkGroups=require("../../client/getInj").default().CHUNK_GROUPS||{}}cons
|
|
|
11
17
|
* @param loadedSheets
|
|
12
18
|
* @param refCount
|
|
13
19
|
* @return
|
|
14
|
-
*/function bookStyleSheet(name,loadedSheets,refCount){let res;const path=`${getPublicPath()}/${name}`;const fullPath=`${document.location.origin}${path}`;if(!loadedSheets.has(fullPath)){let link=document.querySelector(`link[href="${path}"]`);if(!link){link=document.createElement("link");link.setAttribute("rel","stylesheet");link.setAttribute("href",path);document.head.appendChild(link)}res=new _jsUtils.Barrier;link.addEventListener("load",()=>res.resolve());link.addEventListener("error",()=>res.resolve())}if(refCount){const current=refCounts[path]
|
|
20
|
+
*/function bookStyleSheet(name,loadedSheets,refCount){let res;const path=`${getPublicPath()}/${name}`;const fullPath=`${document.location.origin}${path}`;if(!loadedSheets.has(fullPath)){let link=document.querySelector(`link[href="${path}"]`);if(!link){link=document.createElement("link");link.setAttribute("rel","stylesheet");link.setAttribute("href",path);document.head.appendChild(link)}res=new _jsUtils.Barrier;link.addEventListener("load",()=>{if(!res)throw Error("Internal error");void res.resolve()});link.addEventListener("error",()=>{if(!res)throw Error("Internal error");void res.resolve()})}if(refCount){const current=refCounts[path]??0;refCounts[path]=1+current}return res}/**
|
|
15
21
|
* Generates the set of URLs for currently loaded, linked stylesheets.
|
|
16
22
|
* @return
|
|
17
|
-
*/function getLoadedStyleSheets(){const res=new Set;const{styleSheets}=document;for(
|
|
23
|
+
*/function getLoadedStyleSheets(){const res=new Set;const{styleSheets}=document;for(const{href}of styleSheets){if(href)res.add(href)}return res}function assertChunkName(chunkName,chunkGroups){if(chunkGroups[chunkName])return;throw Error(`Unknown chunk name "${chunkName}"`)}/**
|
|
18
24
|
* Client-side only! Ensures all CSS stylesheets required for the specified
|
|
19
25
|
* code chunk are loaded into the document; loads the missing ones; and does
|
|
20
26
|
* simple reference counting to facilitate future clean-up.
|
|
@@ -22,13 +28,13 @@ clientChunkGroups=require("../../client/getInj").default().CHUNK_GROUPS||{}}cons
|
|
|
22
28
|
* @param refCount
|
|
23
29
|
* @return Resolves once all pending stylesheets, necessary for
|
|
24
30
|
* the chunk, are either loaded, or failed to load.
|
|
25
|
-
*/function bookStyleSheets(chunkName,chunkGroups,refCount){const promises=[];const assets=chunkGroups[chunkName];if(!assets)return Promise.resolve();const loadedSheets=getLoadedStyleSheets();for(
|
|
31
|
+
*/async function bookStyleSheets(chunkName,chunkGroups,refCount){const promises=[];const assets=chunkGroups[chunkName];if(!assets)return Promise.resolve();const loadedSheets=getLoadedStyleSheets();for(const asset of assets){if(asset.endsWith(".css")){const promise=bookStyleSheet(asset,loadedSheets,refCount);if(promise)promises.push(promise)}}return promises.length?Promise.allSettled(promises).then():Promise.resolve()}/**
|
|
26
32
|
* Client-side only! Frees from the document all CSS stylesheets that are
|
|
27
33
|
* required by the specified chunk, and have reference counter equal to one
|
|
28
34
|
* (for chunks with larger reference counter values, it just decrements
|
|
29
35
|
* the reference counter).
|
|
30
36
|
* @param {string} chunkName
|
|
31
|
-
*/function freeStyleSheets(chunkName,chunkGroups){const assets=chunkGroups[chunkName];if(!assets)return;for(
|
|
37
|
+
*/function freeStyleSheets(chunkName,chunkGroups){const assets=chunkGroups[chunkName];if(!assets)return;for(const asset of assets){if(asset.endsWith(".css")){const path=`${getPublicPath()}/${asset}`;const pathRefCount=refCounts[path];if(pathRefCount){if(pathRefCount<=1){document.head.querySelector(`link[href="${path}"]`).remove();delete refCounts[path]}else refCounts[path]=pathRefCount-1}}}}// Holds the set of chunk names already used for splitComponent() calls.
|
|
32
38
|
const usedChunkNames=new Set;/**
|
|
33
39
|
* Given an async component retrieval function `getComponent()` it creates
|
|
34
40
|
* a special "code split" component, which uses <Suspense> to asynchronously
|
|
@@ -47,5 +53,7 @@ if(_isomorphy.IS_CLIENT_SIDE){await bookStyleSheets(chunkName,clientChunkGroups,
|
|
|
47
53
|
// and also push it to the SSR chunks array.
|
|
48
54
|
if(_isomorphy.IS_SERVER_SIDE){const{chunkGroups,chunks}=(0,_globalState.getSsrContext)();assertChunkName(chunkName,chunkGroups);if(!chunks.includes(chunkName))chunks.push(chunkName)}// This takes care about stylesheets management every time an instance of
|
|
49
55
|
// this component is mounted / unmounted.
|
|
50
|
-
(0,_react.useInsertionEffect)(()=>{bookStyleSheets(chunkName,clientChunkGroups,true);return()=>freeStyleSheets(chunkName,clientChunkGroups)},[]);return/*#__PURE__*/(0,_jsxRuntime.jsx)(Component
|
|
56
|
+
(0,_react.useInsertionEffect)(()=>{void bookStyleSheets(chunkName,clientChunkGroups,true);return()=>{freeStyleSheets(chunkName,clientChunkGroups)}},[]);return/*#__PURE__*/(0,_jsxRuntime.jsx)(Component// eslint-disable-next-line react/jsx-props-no-spreading
|
|
57
|
+
,{...rest,ref:ref,children:children})};return{default:Wrapper}});const CodeSplit=({children,...rest})=>/*#__PURE__*/(0,_jsxRuntime.jsx)(_react.Suspense,{fallback:placeholder,children:/*#__PURE__*/(0,_jsxRuntime.jsx)(LazyComponent// eslint-disable-next-line react/jsx-props-no-spreading
|
|
58
|
+
,{...rest,children:children})});return CodeSplit}
|
|
51
59
|
//# sourceMappingURL=splitComponent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"splitComponent.js","names":["_react","require","_jsUtils","_globalState","_isomorphy","_jsxRuntime","clientChunkGroups","IS_CLIENT_SIDE","default","CHUNK_GROUPS","refCounts","getPublicPath","getBuildInfo","publicPath","bookStyleSheet","name","loadedSheets","refCount","res","path","fullPath","document","location","origin","has","link","querySelector","createElement","setAttribute","head","appendChild","Barrier","addEventListener","resolve","current","getLoadedStyleSheets","Set","styleSheets","i","length","href","add","assertChunkName","chunkName","chunkGroups","Error","bookStyleSheets","promises","assets","Promise","asset","endsWith","promise","push","allSettled","then","freeStyleSheets","pathRefCount","remove","usedChunkNames","splitComponent","getComponent","placeholder","LazyComponent","lazy","resolved","Component","Wrapper","children","ref","rest","IS_SERVER_SIDE","chunks","getSsrContext","includes","useInsertionEffect","jsx","CodeSplit","Suspense","fallback"],"sources":["../../../../src/shared/utils/splitComponent.tsx"],"sourcesContent":["/* eslint-disable react/jsx-props-no-spreading */\n/* global document */\n\nimport {\n type ComponentType,\n type FunctionComponent,\n type ReactNode,\n type RefObject,\n lazy,\n Suspense,\n useInsertionEffect,\n} from 'react';\n\nimport { Barrier } from '@dr.pogodin/js-utils';\n\nimport { type ChunkGroupsT, getSsrContext } from './globalState';\n\nimport {\n IS_CLIENT_SIDE,\n IS_SERVER_SIDE,\n getBuildInfo,\n} from './isomorphy';\n\n// Note: At the client side we can get chunk groups immediately when loading\n// the module; at the server-side we only can get them within React render flow.\n// Thus, we set and use the following variable at the client-side, and then when\n// needed on the server side, we'll fetch it differently.\nlet clientChunkGroups: ChunkGroupsT;\n\nif (IS_CLIENT_SIDE) {\n // eslint-disable-next-line global-require\n clientChunkGroups = require('client/getInj').default().CHUNK_GROUPS || {};\n}\n\nconst refCounts: { [path: string]: number } = {};\n\nfunction getPublicPath() {\n return getBuildInfo().publicPath;\n}\n\n/**\n * Client-side only! Ensures the specified CSS stylesheet is loaded into\n * the document; loads if it is missing; and does simple reference counting\n * to facilitate future clean-up.\n * @param name\n * @param loadedSheets\n * @param refCount\n * @return\n */\nfunction bookStyleSheet(\n name: string,\n loadedSheets: Set<string>,\n refCount: boolean,\n): Promise<void> | undefined {\n let res: Barrier<void> | undefined;\n const path = `${getPublicPath()}/${name}`;\n const fullPath = `${document.location.origin}${path}`;\n\n if (!loadedSheets.has(fullPath)) {\n let link = document.querySelector(`link[href=\"${path}\"]`);\n\n if (!link) {\n link = document.createElement('link');\n link.setAttribute('rel', 'stylesheet');\n link.setAttribute('href', path);\n document.head.appendChild(link);\n }\n\n res = new Barrier<void>();\n link.addEventListener('load', () => res!.resolve());\n link.addEventListener('error', () => res!.resolve());\n }\n\n if (refCount) {\n const current = refCounts[path] || 0;\n refCounts[path] = 1 + current;\n }\n\n return res;\n}\n\n/**\n * Generates the set of URLs for currently loaded, linked stylesheets.\n * @return\n */\nfunction getLoadedStyleSheets(): Set<string> {\n const res = new Set<string>();\n const { styleSheets } = document;\n for (let i = 0; i < styleSheets.length; ++i) {\n const href = styleSheets[i]?.href;\n if (href) res.add(href);\n }\n return res;\n}\n\nfunction assertChunkName(\n chunkName: string,\n chunkGroups: ChunkGroupsT,\n) {\n if (chunkGroups[chunkName]) return;\n throw Error(`Unknown chunk name \"${chunkName}\"`);\n}\n\n/**\n * Client-side only! Ensures all CSS stylesheets required for the specified\n * code chunk are loaded into the document; loads the missing ones; and does\n * simple reference counting to facilitate future clean-up.\n * @param chunkName Chunk name.\n * @param refCount\n * @return Resolves once all pending stylesheets, necessary for\n * the chunk, are either loaded, or failed to load.\n */\nexport function bookStyleSheets(\n chunkName: string,\n chunkGroups: ChunkGroupsT,\n refCount: boolean,\n): Promise<void> {\n const promises = [];\n const assets = chunkGroups[chunkName];\n if (!assets) return Promise.resolve();\n\n const loadedSheets = getLoadedStyleSheets();\n\n for (let i = 0; i < assets.length; ++i) {\n const asset = assets[i];\n if (asset?.endsWith('.css')) {\n const promise = bookStyleSheet(asset, loadedSheets, refCount);\n if (promise) promises.push(promise);\n }\n }\n\n return promises.length\n ? Promise.allSettled(promises).then()\n : Promise.resolve();\n}\n\n/**\n * Client-side only! Frees from the document all CSS stylesheets that are\n * required by the specified chunk, and have reference counter equal to one\n * (for chunks with larger reference counter values, it just decrements\n * the reference counter).\n * @param {string} chunkName\n */\nexport function freeStyleSheets(\n chunkName: string,\n chunkGroups: ChunkGroupsT,\n) {\n const assets = chunkGroups[chunkName];\n if (!assets) return;\n\n for (let i = 0; i < assets.length; ++i) {\n const asset = assets[i];\n if (asset?.endsWith('.css')) {\n const path = `${getPublicPath()}/${asset}`;\n\n const pathRefCount = refCounts[path];\n if (pathRefCount) {\n if (pathRefCount <= 1) {\n document.head.querySelector(`link[href=\"${path}\"]`)!.remove();\n delete refCounts[path];\n } else refCounts[path] = pathRefCount - 1;\n }\n }\n }\n}\n\n// Holds the set of chunk names already used for splitComponent() calls.\nconst usedChunkNames = new Set();\n\ntype ComponentOrModule<PropsT> = ComponentType<PropsT> | {\n default: ComponentType<PropsT>,\n};\n\n/**\n * Given an async component retrieval function `getComponent()` it creates\n * a special \"code split\" component, which uses <Suspense> to asynchronously\n * load on demand the code required by `getComponent()`.\n * @param options\n * @param options.chunkName\n * @param {function} options.getComponent\n * @param {React.Element} [options.placeholder]\n * @return {React.ElementType}\n */\nexport default function splitComponent<\n ComponentPropsT extends { children?: ReactNode; ref?: RefObject<unknown> },\n>({\n chunkName,\n getComponent,\n placeholder,\n}: {\n chunkName: string;\n getComponent: () => Promise<ComponentOrModule<ComponentPropsT>>,\n placeholder?: ReactNode,\n}) {\n // On the client side we can check right away if the chunk name is known.\n if (IS_CLIENT_SIDE) assertChunkName(chunkName, clientChunkGroups);\n\n // The correct usage of splitComponent() assumes a single call per chunk.\n if (usedChunkNames.has(chunkName)) {\n throw Error(`Repeated splitComponent() call for the chunk \"${chunkName}\"`);\n } else usedChunkNames.add(chunkName);\n\n const LazyComponent = lazy(async () => {\n const resolved = await getComponent();\n const Component = 'default' in resolved ? resolved.default : resolved;\n\n // This pre-loads necessary stylesheets prior to the first mount of\n // the component (the lazy load function is executed by React one at\n // the frist mount).\n if (IS_CLIENT_SIDE) {\n await bookStyleSheets(chunkName, clientChunkGroups, false);\n }\n\n const Wrapper: FunctionComponent<ComponentPropsT> = ({\n children,\n ref,\n ...rest\n }) => {\n // On the server side we'll assert the chunk name here,\n // and also push it to the SSR chunks array.\n if (IS_SERVER_SIDE) {\n const { chunkGroups, chunks } = getSsrContext()!;\n assertChunkName(chunkName, chunkGroups);\n if (!chunks.includes(chunkName)) chunks.push(chunkName);\n }\n\n // This takes care about stylesheets management every time an instance of\n // this component is mounted / unmounted.\n useInsertionEffect(() => {\n bookStyleSheets(chunkName, clientChunkGroups, true);\n return () => freeStyleSheets(chunkName, clientChunkGroups);\n }, []);\n\n return (\n <Component {...(rest as unknown as ComponentPropsT)} ref={ref}>\n {children}\n </Component>\n );\n };\n\n return { default: Wrapper };\n });\n\n const CodeSplit: React.FunctionComponent<ComponentPropsT> = ({\n children,\n ...rest\n }: ComponentPropsT) => (\n <Suspense fallback={placeholder}>\n <LazyComponent {...rest as Parameters<typeof LazyComponent>[0]}>\n {children}\n </LazyComponent>\n </Suspense>\n );\n\n return CodeSplit;\n}\n"],"mappings":"qLAGA,IAAAA,MAAA,CAAAC,OAAA,UAUA,IAAAC,QAAA,CAAAD,OAAA,yBAEA,IAAAE,YAAA,CAAAF,OAAA,kBAEA,IAAAG,UAAA,CAAAH,OAAA,gBAIqB,IAAAI,WAAA,CAAA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ACA,GAAAgC,yBAAkB,EAAC,IAAM,CACvB7B,eAAe,CAACH,SAAS,CAAErC,iBAAiB,CAAE,IAAI,CAAC,CACnD,MAAO,IAAMkD,eAAe,CAACb,SAAS,CAAErC,iBAAiB,CAC3D,CAAC,CAAE,EAAE,CAAC,CAEN,mBACE,GAAAD,WAAA,CAAAuE,GAAA,EAACV,SAAS,KAAMI,IAAI,CAAiCD,GAAG,CAAEA,GAAI,CAAAD,QAAA,CAC3DA,QAAQ,CACA,CAEf,CAAC,CAED,MAAO,CAAE5D,OAAO,CAAE2D,OAAQ,CAC5B,CAAC,CAAC,CAEF,KAAM,CAAAU,SAAmD,CAAGA,CAAC,CAC3DT,QAAQ,CACR,GAAGE,IACY,CAAC,gBAChB,GAAAjE,WAAA,CAAAuE,GAAA,EAAC5E,MAAA,CAAA8E,QAAQ,EAACC,QAAQ,CAAEjB,WAAY,CAAAM,QAAA,cAC9B,GAAA/D,WAAA,CAAAuE,GAAA,EAACb,aAAa,KAAKO,IAAI,CAAAF,QAAA,CACpBA,QAAQ,CACI,CAAC,CACR,CACX,CAED,MAAO,CAAAS,SACT","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"splitComponent.js","names":["_react","require","_jsUtils","_globalState","_isomorphy","_jsxRuntime","clientChunkGroups","IS_CLIENT_SIDE","default","CHUNK_GROUPS","refCounts","getPublicPath","getBuildInfo","publicPath","bookStyleSheet","name","loadedSheets","refCount","res","path","fullPath","document","location","origin","has","link","querySelector","createElement","setAttribute","head","appendChild","Barrier","addEventListener","Error","resolve","current","getLoadedStyleSheets","Set","styleSheets","href","add","assertChunkName","chunkName","chunkGroups","bookStyleSheets","promises","assets","Promise","asset","endsWith","promise","push","length","allSettled","then","freeStyleSheets","pathRefCount","remove","usedChunkNames","splitComponent","getComponent","placeholder","LazyComponent","lazy","resolved","Component","Wrapper","children","ref","rest","IS_SERVER_SIDE","chunks","getSsrContext","includes","useInsertionEffect","jsx","CodeSplit","Suspense","fallback"],"sources":["../../../../src/shared/utils/splitComponent.tsx"],"sourcesContent":["/* global document */\n\nimport {\n type ComponentType,\n type FunctionComponent,\n type ReactNode,\n type RefObject,\n lazy,\n Suspense,\n useInsertionEffect,\n} from 'react';\n\nimport { Barrier } from '@dr.pogodin/js-utils';\n\nimport { type ChunkGroupsT, getSsrContext } from './globalState';\n\nimport {\n IS_CLIENT_SIDE,\n IS_SERVER_SIDE,\n getBuildInfo,\n} from './isomorphy';\n\n// Note: At the client side we can get chunk groups immediately when loading\n// the module; at the server-side we only can get them within React render flow.\n// Thus, we set and use the following variable at the client-side, and then when\n// needed on the server side, we'll fetch it differently.\nlet clientChunkGroups: ChunkGroupsT;\n\nif (IS_CLIENT_SIDE) {\n // TODO: Rewrite to avoid these overrides of ESLint rules.\n /* eslint-disable @typescript-eslint/no-unsafe-assignment,\n @typescript-eslint/no-require-imports,\n @typescript-eslint/no-unsafe-call,\n @typescript-eslint/no-unsafe-member-access */\n clientChunkGroups = require('client/getInj').default().CHUNK_GROUPS ?? {};\n /* eslint-enable @typescript-eslint/no-unsafe-assignment,\n @typescript-eslint/no-require-imports,\n @typescript-eslint/no-unsafe-call,\n @typescript-eslint/no-unsafe-member-access */\n}\n\nconst refCounts: Record<string, number> = {};\n\nfunction getPublicPath() {\n return getBuildInfo().publicPath;\n}\n\n/**\n * Client-side only! Ensures the specified CSS stylesheet is loaded into\n * the document; loads if it is missing; and does simple reference counting\n * to facilitate future clean-up.\n * @param name\n * @param loadedSheets\n * @param refCount\n * @return\n */\nfunction bookStyleSheet(\n name: string,\n loadedSheets: Set<string>,\n refCount: boolean,\n): Promise<void> | undefined {\n let res: Barrier<void> | undefined;\n const path = `${getPublicPath()}/${name}`;\n const fullPath = `${document.location.origin}${path}`;\n\n if (!loadedSheets.has(fullPath)) {\n let link = document.querySelector(`link[href=\"${path}\"]`);\n\n if (!link) {\n link = document.createElement('link');\n link.setAttribute('rel', 'stylesheet');\n link.setAttribute('href', path);\n document.head.appendChild(link);\n }\n\n res = new Barrier<void>();\n link.addEventListener('load', () => {\n if (!res) throw Error('Internal error');\n void res.resolve();\n });\n link.addEventListener('error', () => {\n if (!res) throw Error('Internal error');\n void res.resolve();\n });\n }\n\n if (refCount) {\n const current = refCounts[path] ?? 0;\n refCounts[path] = 1 + current;\n }\n\n return res;\n}\n\n/**\n * Generates the set of URLs for currently loaded, linked stylesheets.\n * @return\n */\nfunction getLoadedStyleSheets(): Set<string> {\n const res = new Set<string>();\n const { styleSheets } = document;\n for (const { href } of styleSheets) {\n if (href) res.add(href);\n }\n return res;\n}\n\nfunction assertChunkName(\n chunkName: string,\n chunkGroups: ChunkGroupsT,\n) {\n if (chunkGroups[chunkName]) return;\n throw Error(`Unknown chunk name \"${chunkName}\"`);\n}\n\n/**\n * Client-side only! Ensures all CSS stylesheets required for the specified\n * code chunk are loaded into the document; loads the missing ones; and does\n * simple reference counting to facilitate future clean-up.\n * @param chunkName Chunk name.\n * @param refCount\n * @return Resolves once all pending stylesheets, necessary for\n * the chunk, are either loaded, or failed to load.\n */\nexport async function bookStyleSheets(\n chunkName: string,\n chunkGroups: ChunkGroupsT,\n refCount: boolean,\n): Promise<void> {\n const promises = [];\n const assets = chunkGroups[chunkName];\n if (!assets) return Promise.resolve();\n\n const loadedSheets = getLoadedStyleSheets();\n\n for (const asset of assets) {\n if (asset.endsWith('.css')) {\n const promise = bookStyleSheet(asset, loadedSheets, refCount);\n if (promise) promises.push(promise);\n }\n }\n\n return promises.length\n ? Promise.allSettled(promises).then()\n : Promise.resolve();\n}\n\n/**\n * Client-side only! Frees from the document all CSS stylesheets that are\n * required by the specified chunk, and have reference counter equal to one\n * (for chunks with larger reference counter values, it just decrements\n * the reference counter).\n * @param {string} chunkName\n */\nexport function freeStyleSheets(\n chunkName: string,\n chunkGroups: ChunkGroupsT,\n): void {\n const assets = chunkGroups[chunkName];\n if (!assets) return;\n\n for (const asset of assets) {\n if (asset.endsWith('.css')) {\n const path = `${getPublicPath()}/${asset}`;\n\n const pathRefCount = refCounts[path];\n if (pathRefCount) {\n if (pathRefCount <= 1) {\n document.head.querySelector(`link[href=\"${path}\"]`)!.remove();\n delete refCounts[path];\n } else refCounts[path] = pathRefCount - 1;\n }\n }\n }\n}\n\n// Holds the set of chunk names already used for splitComponent() calls.\nconst usedChunkNames = new Set();\n\ntype ComponentOrModule<PropsT> = ComponentType<PropsT> | {\n default: ComponentType<PropsT>;\n};\n\n/**\n * Given an async component retrieval function `getComponent()` it creates\n * a special \"code split\" component, which uses <Suspense> to asynchronously\n * load on demand the code required by `getComponent()`.\n * @param options\n * @param options.chunkName\n * @param {function} options.getComponent\n * @param {React.Element} [options.placeholder]\n * @return {React.ElementType}\n */\nexport default function splitComponent<\n ComponentPropsT extends { children?: ReactNode; ref?: RefObject<unknown> },\n>({\n chunkName,\n getComponent,\n placeholder,\n}: {\n chunkName: string;\n getComponent: () => Promise<ComponentOrModule<ComponentPropsT>>;\n placeholder?: ReactNode;\n}): FunctionComponent<ComponentPropsT> {\n // On the client side we can check right away if the chunk name is known.\n if (IS_CLIENT_SIDE) assertChunkName(chunkName, clientChunkGroups);\n\n // The correct usage of splitComponent() assumes a single call per chunk.\n if (usedChunkNames.has(chunkName)) {\n throw Error(`Repeated splitComponent() call for the chunk \"${chunkName}\"`);\n } else usedChunkNames.add(chunkName);\n\n const LazyComponent = lazy(async () => {\n const resolved = await getComponent();\n const Component = 'default' in resolved ? resolved.default : resolved;\n\n // This pre-loads necessary stylesheets prior to the first mount of\n // the component (the lazy load function is executed by React one at\n // the frist mount).\n if (IS_CLIENT_SIDE) {\n await bookStyleSheets(chunkName, clientChunkGroups, false);\n }\n\n const Wrapper: FunctionComponent<ComponentPropsT> = ({\n children,\n ref,\n ...rest\n }) => {\n // On the server side we'll assert the chunk name here,\n // and also push it to the SSR chunks array.\n if (IS_SERVER_SIDE) {\n const { chunkGroups, chunks } = getSsrContext()!;\n assertChunkName(chunkName, chunkGroups);\n if (!chunks.includes(chunkName)) chunks.push(chunkName);\n }\n\n // This takes care about stylesheets management every time an instance of\n // this component is mounted / unmounted.\n useInsertionEffect(() => {\n void bookStyleSheets(chunkName, clientChunkGroups, true);\n return () => {\n freeStyleSheets(chunkName, clientChunkGroups);\n };\n }, []);\n\n return (\n <Component\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...(rest as unknown as ComponentPropsT)}\n ref={ref}\n >\n {children}\n </Component>\n );\n };\n\n return { default: Wrapper };\n });\n\n const CodeSplit: React.FunctionComponent<ComponentPropsT> = ({\n children,\n ...rest\n }: ComponentPropsT) => (\n <Suspense fallback={placeholder}>\n <LazyComponent\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...rest as Parameters<typeof LazyComponent>[0]}\n >\n {children}\n </LazyComponent>\n </Suspense>\n );\n\n return CodeSplit;\n}\n"],"mappings":"qLAEA,IAAAA,MAAA,CAAAC,OAAA,UAUA,IAAAC,QAAA,CAAAD,OAAA,yBAEA,IAAAE,YAAA,CAAAF,OAAA,kBAEA,IAAAG,UAAA,CAAAH,OAAA,gBAIqB,IAAAI,WAAA,CAAAJ,OAAA,sBApBrB,qBAsBA;AACA;AACA;AACA;AACA,GAAI,CAAAK,iBAA+B,CAEnC,GAAIC,yBAAc,CAAE,CAClB;AACA;AACF;AACA;AACA,iDACED,iBAAiB,CAAGL,OAAO,sBAAgB,CAAC,CAACO,OAAO,CAAC,CAAC,CAACC,YAAY,EAAI,CAAC,CAAC,CACzE;AACF;AACA;AACA,iDACA,CAEA,KAAM,CAAAC,SAAiC,CAAG,CAAC,CAAC,CAE5C,QAAS,CAAAC,aAAaA,CAAA,CAAG,CACvB,MAAO,GAAAC,uBAAY,EAAC,CAAC,CAACC,UACxB,CAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,QAAS,CAAAC,cAAcA,CACrBC,IAAY,CACZC,YAAyB,CACzBC,QAAiB,CACU,CAC3B,GAAI,CAAAC,GAA8B,CAClC,KAAM,CAAAC,IAAI,CAAG,GAAGR,aAAa,CAAC,CAAC,IAAII,IAAI,EAA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CAED,MAAO,CAAAS,SACT","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;exports.useCurrent=useCurrent;exports.useTimezoneOffset=useTimezoneOffset;var _cookie=require("cookie");var
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;exports.useCurrent=useCurrent;exports.useTimezoneOffset=useTimezoneOffset;var _cookie=require("cookie");var _react=require("react");var _dayjs=_interopRequireDefault(require("dayjs"));var _jsUtils=require("@dr.pogodin/js-utils");var _reactGlobalState=require("@dr.pogodin/react-global-state");var _globalState=require("./globalState");/**
|
|
2
2
|
* This react hook wraps Date.now() function in a SSR friendly way,
|
|
3
3
|
* ensuring that all calls to useCurrent() within the same render return
|
|
4
4
|
* exactly the same time (which is retrieved from Date.now() first, and
|
|
@@ -17,5 +17,5 @@ function useCurrent({autorefresh=false,globalStatePath="currentTime",precision=5
|
|
|
17
17
|
* as the default value.
|
|
18
18
|
*/// TODO: Should we request the state type as generic parameter, to be able
|
|
19
19
|
// to verify the give globalStatePath is correct?
|
|
20
|
-
function useTimezoneOffset({cookieName="timezoneOffset",globalStatePath="timezoneOffset"}={}){const ssrContext=(0,_globalState.getSsrContext)(false);const[offset,setOffset]=(0,_reactGlobalState.useGlobalState)(globalStatePath,()=>{const value=cookieName&&ssrContext?.req
|
|
20
|
+
function useTimezoneOffset({cookieName="timezoneOffset",globalStatePath="timezoneOffset"}={}){const ssrContext=(0,_globalState.getSsrContext)(false);const[offset,setOffset]=(0,_reactGlobalState.useGlobalState)(globalStatePath,()=>{const value=cookieName&&ssrContext?.req.cookies[cookieName];return value?parseInt(value):0});(0,_react.useEffect)(()=>{const date=new Date;const value=date.getTimezoneOffset();setOffset(value);if(cookieName){document.cookie=(0,_cookie.serialize)(cookieName,value.toString(),{path:"/"})}},[cookieName,setOffset]);return offset}const time={DAY_MS:_jsUtils.DAY_MS,HOUR_MS:_jsUtils.HOUR_MS,MIN_MS:_jsUtils.MIN_MS,SEC_MS:_jsUtils.SEC_MS,YEAR_MS:_jsUtils.YEAR_MS,now:Date.now,timer:_jsUtils.timer,useCurrent,useTimezoneOffset};var _default=exports.default=Object.assign(_dayjs.default,time);
|
|
21
21
|
//# sourceMappingURL=time.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time.js","names":["_cookie","require","
|
|
1
|
+
{"version":3,"file":"time.js","names":["_cookie","require","_react","_dayjs","_interopRequireDefault","_jsUtils","_reactGlobalState","_globalState","useCurrent","autorefresh","globalStatePath","precision","SEC_MS","now","setter","useGlobalState","Date","useEffect","timerId","update","old","neu","Math","abs","setTimeout","clearTimeout","useTimezoneOffset","cookieName","ssrContext","getSsrContext","offset","setOffset","value","req","cookies","parseInt","date","getTimezoneOffset","document","cookie","serialize","toString","path","time","DAY_MS","HOUR_MS","MIN_MS","YEAR_MS","timer","_default","exports","default","Object","assign","dayjs"],"sources":["../../../../src/shared/utils/time.ts"],"sourcesContent":["import { serialize } from 'cookie';\nimport { useEffect } from 'react';\nimport dayjs from 'dayjs';\n\nimport {\n DAY_MS,\n HOUR_MS,\n MIN_MS,\n SEC_MS,\n YEAR_MS,\n timer,\n} from '@dr.pogodin/js-utils';\n\nimport { type ForceT, useGlobalState } from '@dr.pogodin/react-global-state';\n\nimport { getSsrContext } from './globalState';\n\n/**\n * This react hook wraps Date.now() function in a SSR friendly way,\n * ensuring that all calls to useCurrent() within the same render return\n * exactly the same time (which is retrieved from Date.now() first, and\n * then stored in the global state to be reused in all other calls), which\n * is also passed and used in the first client side render, and then updated\n * with a finite precision to avoid infinite re-rendering loops.\n */\n// TODO: Should we request the state type as generic parameter, to be able\n// to verify the give globalStatePath is correct?\nexport function useCurrent({\n autorefresh = false,\n globalStatePath = 'currentTime',\n precision = 5 * SEC_MS,\n} = {}): number {\n const [now, setter] = useGlobalState<ForceT, number>(\n globalStatePath,\n Date.now,\n );\n useEffect(() => {\n let timerId: NodeJS.Timeout | undefined;\n const update = (): void => {\n setter((old) => {\n const neu = Date.now();\n return Math.abs(neu - old) > precision ? neu : old;\n });\n if (autorefresh) timerId = setTimeout(update, precision);\n };\n update();\n return (): void => {\n if (timerId) clearTimeout(timerId);\n };\n }, [autorefresh, precision, setter]);\n return now;\n}\n\n/**\n * Wraps the standard Date.getTimezoneOffset() method in a SSR-friendly way.\n * This hook retrieves the offset value at the client side and uses a cookie\n * to pass it to the server in subsequent requests from that user. At the server\n * side the value from cookie is used in renders and passed back to the client\n * via the global state. Prior to the value being known (in the very first\n * request from the user, when the cookie is still missing), zero value is used\n * as the default value.\n */\n// TODO: Should we request the state type as generic parameter, to be able\n// to verify the give globalStatePath is correct?\nexport function useTimezoneOffset({\n cookieName = 'timezoneOffset',\n globalStatePath = 'timezoneOffset',\n} = {}): number {\n const ssrContext = getSsrContext(false);\n const [offset, setOffset] = useGlobalState<ForceT, number>(\n globalStatePath,\n () => {\n const value = cookieName\n && ssrContext?.req.cookies[cookieName] as string;\n return value ? parseInt(value) : 0;\n },\n );\n useEffect(() => {\n const date = new Date();\n const value = date.getTimezoneOffset();\n setOffset(value);\n if (cookieName) {\n document.cookie = serialize(cookieName, value.toString(), { path: '/' });\n }\n }, [cookieName, setOffset]);\n return offset;\n}\n\nconst time = {\n DAY_MS,\n HOUR_MS,\n MIN_MS,\n SEC_MS,\n YEAR_MS,\n now: Date.now,\n timer,\n useCurrent,\n useTimezoneOffset,\n};\n\nexport default Object.assign(dayjs, time);\n"],"mappings":"0PAAA,IAAAA,OAAA,CAAAC,OAAA,WACA,IAAAC,MAAA,CAAAD,OAAA,UACA,IAAAE,MAAA,CAAAC,sBAAA,CAAAH,OAAA,WAEA,IAAAI,QAAA,CAAAJ,OAAA,yBASA,IAAAK,iBAAA,CAAAL,OAAA,mCAEA,IAAAM,YAAA,CAAAN,OAAA,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KAAK,CAAGL,UAAU,EACnBC,UAAU,EAAEK,GAAG,CAACC,OAAO,CAACP,UAAU,CAAW,CAClD,MAAO,CAAAK,KAAK,CAAGG,QAAQ,CAACH,KAAK,CAAC,CAAG,CACnC,CACF,CAAC,CACD,GAAAf,gBAAS,EAAC,IAAM,CACd,KAAM,CAAAmB,IAAI,CAAG,GAAI,CAAApB,IAAM,CACvB,KAAM,CAAAgB,KAAK,CAAGI,IAAI,CAACC,iBAAiB,CAAC,CAAC,CACtCN,SAAS,CAACC,KAAK,CAAC,CAChB,GAAIL,UAAU,CAAE,CACdW,QAAQ,CAACC,MAAM,CAAG,GAAAC,iBAAS,EAACb,UAAU,CAAEK,KAAK,CAACS,QAAQ,CAAC,CAAC,CAAE,CAAEC,IAAI,CAAE,GAAI,CAAC,CACzE,CACF,CAAC,CAAE,CAACf,UAAU,CAAEI,SAAS,CAAC,CAAC,CAC3B,MAAO,CAAAD,MACT,CAEA,KAAM,CAAAa,IAAI,CAAG,CACXC,MAAM,CAANA,eAAM,CACNC,OAAO,CAAPA,gBAAO,CACPC,MAAM,CAANA,eAAM,CACNlC,MAAM,CAANA,eAAM,CACNmC,OAAO,CAAPA,gBAAO,CACPlC,GAAG,CAAEG,IAAI,CAACH,GAAG,CACbmC,KAAK,CAALA,cAAK,CACLxC,UAAU,CACVkB,iBACF,CAAC,CAAC,IAAAuB,QAAA,CAAAC,OAAA,CAAAC,OAAA,CAEaC,MAAM,CAACC,MAAM,CAACC,cAAK,CAAEX,IAAI,CAAC","ignoreList":[]}
|
|
@@ -6,10 +6,13 @@
|
|
|
6
6
|
* @return Required module.
|
|
7
7
|
*/function requireWeak(modulePath,basePath){if(_isomorphy.IS_CLIENT_SIDE)return null;// TODO: On one hand, this try/catch wrap silencing errors is bad, as it may
|
|
8
8
|
// hide legit errors, in a way difficult to notice and understand; but on the
|
|
9
|
-
// other hand it fails for some (unclear, but legit?) reasons in some
|
|
9
|
+
// other hand it fails for some (unclear, but legit?) reasons in some
|
|
10
|
+
// environments,
|
|
10
11
|
// like during the static code generation for docs. Perhaps, something should
|
|
11
12
|
// be implemented differently here.
|
|
12
|
-
try{
|
|
13
|
+
try{// eslint-disable-next-line no-eval
|
|
14
|
+
const req=eval("require");// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
15
|
+
const{resolve}=req("path");const path=basePath?resolve(basePath,modulePath):modulePath;const module=req(path);if(!("default"in module)||!module.default)return module;const{default:def,...named}=module;const res=def;Object.entries(named).forEach(([name,value])=>{const assigned=res[name];if(assigned)res[name]=value;else if(assigned!==value){throw Error("Conflict between default and named exports")}});return res}catch{return null}}/**
|
|
13
16
|
* Resolves specified module path with help of Babel's module resolver.
|
|
14
17
|
* Yes, the function itself just returns its argument to the caller, but Babel
|
|
15
18
|
* is configured to resolve the first argument of resolveWeak(..) function, thus
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpack.js","names":["_isomorphy","require","requireWeak","modulePath","basePath","IS_CLIENT_SIDE","
|
|
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 PathT from 'path';\n\nimport { IS_CLIENT_SIDE } from './isomorphy';\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): 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 PathT;\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;\n\n const { default: def, ...named } = module;\n\n const res = def as T;\n\n Object.entries(named).forEach(([name, value]) => {\n const assigned = res[name as keyof T];\n if (assigned) (res[name as keyof 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,gBAEA;AACA;AACA;AACA;AACA;AACA;AACA,GACO,QAAS,CAAAC,WAAWA,CACzBC,UAAkB,CAClBC,QAAiB,CACP,CACV,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,CAAiB,CAE/C,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,GAAQ,CAEpBG,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,CAAY,CACrC,GAAIE,QAAQ,CAAGN,GAAG,CAACI,IAAI,CAAY,CAAeC,KAAK,CAAC,IACnD,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){n.d(t,{B:function(){return r},p:function(){return o}});const r="object"!=typeof process||!process.versions||!process.versions.node||!!n.g.REACT_UTILS_FORCE_CLIENT_SIDE,o=!r},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{resolve:resolve}=eval("require")("path"),path=basePath?resolve(basePath,modulePath):modulePath,module=eval("require")(path);if(!("default"in module)||!module.default)return module;const{default:def,...named}=module,res=def;return Object.entries(named).forEach((e=>{let[t,n]=e;const r=res[t];if(void 0!==r){if(r!==n)throw Error("Conflict between default and named exports")}else res[t]=n})),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?document.querySelector('meta[itemprop="drpruinj"]'):null;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}}),n(155);var r=n(236),o=n(264),a=n(707),i=n(126),_=n(668),s=n(922);function l(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=document.getElementById("react-view");if(!n)throw Error("Failed to find container for React app");const l=(0,s.jsx)(i.GlobalStateProvider,{initialState:(0,_.A)().ISTATE||t.initialState,children:(0,s.jsx)(a.BrowserRouter,{children:(0,s.jsx)(o.HelmetProvider,{children:(0,s.jsx)(e,{})})})});t.dontHydrate?(0,r.createRoot)(n).render(l):(0,r.hydrateRoot)(n,l)}}},__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 components_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);const config=(environment_check.B?__webpack_require__(668).A().CONFIG:(0,webpack.requireWeak)("config"))||{};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_dayjs_=__webpack_require__(185),external_dayjs_default=__webpack_require__.n(external_dayjs_),external_react_=__webpack_require__(155),js_utils_=__webpack_require__(864),react_global_state_=__webpack_require__(126);const{getSsrContext:getSsrContext}=(0,react_global_state_.withGlobalStateType)();function useCurrent(){let{autorefresh:e=!1,globalStatePath:t="currentTime",precision:n=5*js_utils_.SEC_MS}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};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(){let{cookieName:e="timezoneOffset",globalStatePath:t="timezoneOffset"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=getSsrContext(!1),[r,o]=(0,react_global_state_.useGlobalState)(t,(()=>{var t;const r=e&&(null==n||null===(t=n.req)||void 0===t||null===(t=t.cookies)||void 0===t?void 0:t[e]);return r?parseInt(r,10):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;isomorphy.IS_CLIENT_SIDE&&(clientChunkGroups=__webpack_require__(668).A().CHUNK_GROUPS||{});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",(()=>r.resolve())),e.addEventListener("error",(()=>r.resolve()))}if(n){const e=refCounts[o]||0;refCounts[o]=1+e}return r}function getLoadedStyleSheets(){const e=new Set,{styleSheets:t}=document;for(let r=0;r<t.length;++r){var n;const o=null===(n=t[r])||void 0===n?void 0:n.href;o&&e.add(o)}return e}function assertChunkName(e,t){if(!t[e])throw Error(`Unknown chunk name "${e}"`)}function bookStyleSheets(e,t,n){const r=[],o=t[e];if(!o)return Promise.resolve();const a=getLoadedStyleSheets();for(let e=0;e<o.length;++e){const t=o[e];if(null!=t&&t.endsWith(".css")){const e=bookStyleSheet(t,a,n);e&&r.push(e)}}return r.length?Promise.allSettled(r).then():Promise.resolve()}function freeStyleSheets(e,t){const n=t[e];if(n)for(let e=0;e<n.length;++e){const t=n[e];if(null!=t&&t.endsWith(".css")){const e=`${getPublicPath()}/${t}`,n=refCounts[e];n&&(n<=1?(document.head.querySelector(`link[href="${e}"]`).remove(),delete refCounts[e]):refCounts[e]=n-1)}}}const usedChunkNames=new Set;function splitComponent(e){let{chunkName:t,getComponent:n,placeholder:r}=e;if(isomorphy.IS_CLIENT_SIDE&&assertChunkName(t,clientChunkGroups),usedChunkNames.has(t))throw Error(`Repeated splitComponent() call for the chunk "${t}"`);usedChunkNames.add(t);const o=(0,external_react_.lazy)((async()=>{const e=await n(),r="default"in e?e.default:e;return isomorphy.IS_CLIENT_SIDE&&await bookStyleSheets(t,clientChunkGroups,!1),{default:e=>{let{children:n,ref:o,...a}=e;if(isomorphy.IS_SERVER_SIDE){const{chunkGroups:e,chunks:n}=getSsrContext();assertChunkName(t,e),n.includes(t)||n.push(t)}return(0,external_react_.useInsertionEffect)((()=>(bookStyleSheets(t,clientChunkGroups,!0),()=>freeStyleSheets(t,clientChunkGroups))),[]),(0,jsx_runtime.jsx)(r,{...a,ref:o,children:n})}}}));return e=>{let{children:t,...n}=e;return(0,jsx_runtime.jsx)(external_react_.Suspense,{fallback:r,children:(0,jsx_runtime.jsx)(o,{...n,children:t})})}}const themed=react_themes_default();themed.COMPOSE=react_themes_.COMPOSE,themed.PRIORITY=react_themes_.PRIORITY;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=e=>{let{cancelOnScrolling:t,children:n,containerStyle:r,dontDisableScrolling:o,onCancel:a,overlayStyle:i,style:_,testId:s,testIdForOverlay:l,theme:c}=e;const u=(0,external_react_.useRef)(null),d=(0,external_react_.useRef)(null),[m,p]=(0,external_react_.useState)();(0,external_react_.useEffect)((()=>{const e=document.createElement("div");return document.body.appendChild(e),p(e),()=>{document.body.removeChild(e)}}),[]),(0,external_react_.useEffect)((()=>(t&&a&&(window.addEventListener("scroll",a),window.addEventListener("wheel",a)),()=>{t&&a&&(window.removeEventListener("scroll",a),window.removeEventListener("wheel",a))})),[t,a]),(0,external_react_.useEffect)((()=>(o||document.body.classList.add(styles.scrollingDisabledByModal),()=>{o||document.body.classList.remove(styles.scrollingDisabledByModal)})),[o]);const h=(0,external_react_.useMemo)((()=>(0,jsx_runtime.jsx)("div",{onFocus:()=>{var e,t;const n=null===(e=u.current)||void 0===e?void 0:e.querySelectorAll("*");for(let e=n.length-1;e>=0;--e){var r;if(null===(r=n[e])||void 0===r||r.focus(),document.activeElement===n[e])return}null===(t=d.current)||void 0===t||t.focus()},tabIndex:0})),[]);return m?external_react_dom_default().createPortal((0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[h,(0,jsx_runtime.jsx)("div",{"aria-label":"Cancel",className:c.overlay,"data-testid":void 0,onClick:e=>{a&&(a(),e.stopPropagation())},onKeyDown:e=>{"Escape"===e.key&&a&&(a(),e.stopPropagation())},ref:e=>{e&&e!==d.current&&(d.current=e,e.focus())},role:"button",style:i,tabIndex:0}),(0,jsx_runtime.jsx)("div",{"aria-modal":"true",className:c.container,"data-testid":void 0,onClick:e=>e.stopPropagation(),onWheel:e=>e.stopPropagation(),ref:u,role:"dialog",style:null!=_?_:r,children:n}),(0,jsx_runtime.jsx)("div",{onFocus:()=>{var e;null===(e=d.current)||void 0===e||e.focus()},tabIndex:0}),h]}),m):null};var Modal=react_themes_default()(BaseModal,"Modal",base_theme),style={overlay:"jKsMKG"};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]}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=e=>{let{containerClass:t,containerStyle:n,filter:r,onCancel:o,onChange:a,optionClass:i,options:_,ref:s}=e;const l=(0,external_react_.useRef)(null);(0,external_react_.useImperativeHandle)(s,(()=>({measure:()=>{var e;const t=null===(e=l.current)||void 0===e?void 0:e.parentElement;if(!t)return;const n=l.current.getBoundingClientRect(),r=window.getComputedStyle(t),o=parseFloat(r.marginBottom),a=parseFloat(r.marginTop);return n.height+=o+a,n}})),[]);const c=[];for(let e=0;e<_.length;++e){const t=_[e];if(void 0!==t&&(!r||r(t))){const[e,n]=optionValueName(t);c.push((0,jsx_runtime.jsx)("div",{className:i,onClick:t=>{a(e),t.stopPropagation()},onKeyDown:t=>{"Enter"===t.key&&(a(e),t.stopPropagation())},role:"button",tabIndex:0,children:n},e))}}return(0,jsx_runtime.jsx)(BaseModal,{cancelOnScrolling:!0,style:n,dontDisableScrolling:!0,onCancel:o,theme:{ad:"",hoc:"",container:t,context:"",overlay:style.overlay},children:(0,jsx_runtime.jsx)("div",{ref:l,children:c})})};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=e=>{let{filter:t,label:n,onChange:r,options:o,theme:a,value:i}=e;if(!o)throw Error("Internal error");const[_,s]=(0,external_react_.useState)(!1),l=(0,external_react_.useRef)(null),c=(0,external_react_.useRef)(null),[u,d]=(0,external_react_.useState)(),[m,p]=(0,external_react_.useState)(!1);(0,external_react_.useEffect)((()=>{if(!_)return;let e;const t=()=>{var n,r;const o=null===(n=l.current)||void 0===n?void 0:n.getBoundingClientRect(),a=null===(r=c.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;p(n);const r=n?{top:o.top-a.height-1,left:o.left,width:o.width}:{left:o.left,top:o.bottom,width:o.width};d((e=>areEqual(e,r)?e:r))}e=requestAnimationFrame(t)};return requestAnimationFrame(t),()=>{cancelAnimationFrame(e)}}),[_]);const h=e=>{const t=window.visualViewport,n=l.current.getBoundingClientRect();s(!0),d({left:(null==t?void 0:t.width)||0,top:(null==t?void 0:t.height)||0,width:n.width}),e.stopPropagation()};let f=(0,jsx_runtime.jsx)(jsx_runtime.Fragment,{children:""});for(let e=0;e<o.length;++e){const n=o[e];if(void 0!==n&&(!t||t(n))){const[e,t]=optionValueName(n);if(e===i){f=t;break}}}let x=a.container;_&&(x+=` ${a.active}`);let b=a.select||"";return m&&(x+=` ${a.upward}`,b+=` ${a.upward}`),(0,jsx_runtime.jsxs)("div",{className:x,children:[void 0===n?null:(0,jsx_runtime.jsx)("div",{className:a.label,children:n}),(0,jsx_runtime.jsxs)("div",{className:a.dropdown,onClick:h,onKeyDown:e=>{"Enter"===e.key&&h(e)},ref:l,role:"listbox",tabIndex:0,children:[f,(0,jsx_runtime.jsx)("div",{className:a.arrow})]}),_?(0,jsx_runtime.jsx)(CustomDropdown_Options,{containerClass:b,containerStyle:u,onCancel:()=>{s(!1)},onChange:e=>{s(!1),r&&r(e)},optionClass:a.option||"",options:o,ref:c}):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=e=>{let{filter:t,label:n,onChange:r,options:o,testId:a,theme:i,value:_}=e;if(!o)throw Error("Internal error");let s=!1;const l=[];for(let e=0;e<o.length;++e){const n=o[e];if(void 0!==n&&(!t||t(n))){const[e,t]=optionValueName(n);s||(s=e===_),l.push((0,jsx_runtime.jsx)("option",{className:i.option,value:e,children:t},e))}}const c=s?null:(0,jsx_runtime.jsx)("option",{disabled:!0,className:i.hiddenOption,value:_,children:_},"__reactUtilsHiddenOption");let u=i.select;return s||(u+=` ${i.invalid}`),(0,jsx_runtime.jsxs)("div",{className:i.container,children:[void 0===n?null:(0,jsx_runtime.jsx)("div",{className:i.label,children:n}),(0,jsx_runtime.jsxs)("div",{className:i.dropdown,children:[(0,jsx_runtime.jsxs)("select",{className:u,"data-testid":void 0,onChange:r,value:_,children:[c,l]}),(0,jsx_runtime.jsx)("div",{className:i.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=e=>{let{label:t,onChange:n,options:r,theme:o,value:a}=e;if(!r||!o.option)throw Error("Internal error");const i=[];for(let e=0;e<(null==r?void 0:r.length);++e){const t=r[e];if(void 0!==t){const[e,r]=optionValueName(t);let _,s=o.option;e===a?s+=` ${o.selected}`:n&&(_=()=>n(e)),i.push(_?(0,jsx_runtime.jsx)("div",{className:s,onClick:_,onKeyDown:e=>{_&&"Enter"===e.key&&_()},role:"button",tabIndex:0,children:r},e):(0,jsx_runtime.jsx)("div",{className:s,children:r},e))}}return(0,jsx_runtime.jsxs)("div",{className:o.container,children:[t?(0,jsx_runtime.jsx)("div",{className:o.label,children:t}):null,(0,jsx_runtime.jsx)("div",{className:o.options,children:i})]})};var Switch=react_themes_default()(BaseSwitch,"Switch",Switch_theme),external_react_router_=__webpack_require__(707),GenericLink_style={link:"zH52sA"};const GenericLink=e=>{let{children:t,className:n,disabled:r,enforceA:o,keepScrollPosition:a,onClick:i,onMouseDown:_,openNewTab:s,replace:l,routerLinkType:c,to:u,...d}=e;if(r||o||s||null!=u&&u.match(/^(#|(https?|mailto):)/))return(0,jsx_runtime.jsx)("a",{className:(n?n+" ":"")+"zH52sA",href:u,onClick:r?e=>e.preventDefault():i,onMouseDown:r?e=>e.preventDefault():_,rel:"noopener noreferrer",target:s?"_blank":"",children:t});const m=c;return(0,jsx_runtime.jsx)(m,{className:n,discover:"none",onMouseDown:_,replace:l,to:u,onClick:e=>{i&&i(e),a||window.scroll(0,0)},...d,children:t})};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=e=>{let{active:t,children:n,disabled:r,enforceA:o,onClick:a,onMouseDown:i,onPointerDown:_,openNewTab:s,replace:l,testId:c,theme:u,to:d}=e,m=u.button;return t&&u.active&&(m+=` ${u.active}`),r?(u.disabled&&(m+=` ${u.disabled}`),(0,jsx_runtime.jsx)("div",{className:m,"data-testid":void 0,children:n})):d?(0,jsx_runtime.jsx)(components_Link,{className:m,"data-testid":void 0,enforceA:o,onClick:a,onMouseDown:i,onPointerDown:_,openNewTab:s,replace:l,to:d,children:n}):(0,jsx_runtime.jsx)("div",{className:m,"data-testid":void 0,onClick:a,onKeyDown:a&&(e=>{"Enter"===e.key&&a(e)}),onMouseDown:i,onPointerDown:_,role:"button",tabIndex:0,children:n})};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=e=>{let{checked:t,disabled:n,label:r,onChange:o,testId:a,theme:i}=e,_=i.container;n&&(_+=` ${i.disabled}`);let s=i.checkbox;return"indeterminate"===t&&(s+=` ${i.indeterminate}`),(0,jsx_runtime.jsxs)("div",{className:_,children:[void 0===r?null:(0,jsx_runtime.jsx)("div",{className:i.label,children:r}),(0,jsx_runtime.jsx)("input",{checked:void 0===t?void 0:!0===t,className:s,"data-testid":void 0,disabled:n,onChange:o,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=e=>{let{label:t,ref:n,testId:r,theme:o,...a}=e;return(0,jsx_runtime.jsxs)("span",{className:o.container,children:[void 0===t?null:(0,jsx_runtime.jsx)("div",{className:o.label,children:t}),(0,jsx_runtime.jsx)("input",{className:o.input,"data-testid":void 0,ref:n,...a})]})};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=e=>{let{children:t,leftSidePanelContent:n,rightSidePanelContent:r,theme:o}=e;return(0,jsx_runtime.jsxs)("div",{className:o.container,children:[(0,jsx_runtime.jsx)("div",{className:[o.sidePanel,o.leftSidePanel].join(" "),children:n}),(0,jsx_runtime.jsx)("div",{className:o.mainPanel,children:t}),(0,jsx_runtime.jsx)("div",{className:[o.sidePanel,o.rightSidePanel].join(" "),children:r})]})};var components_PageLayout=react_themes_default()(PageLayout,"PageLayout",PageLayout_base_theme),react_helmet_=__webpack_require__(264);const Context=(0,external_react_.createContext)({description:"",title:""}),MetaTags=e=>{let{children:t,description:n,extraMetaTags:r,image:o,siteName:a,socialDescription:i,socialTitle:_,title:s,url:l}=e;const c=_||s,u=i||n,d=(0,external_react_.useMemo)((()=>({description:n,image:o,siteName:a,socialDescription:i,socialTitle:_,title:s,url:l})),[n,o,a,i,_,s,l]),m=[];if(null!=r&&r.length)for(let e=0;e<r.length;++e){const{content:t,name:n}=r[e];m.push((0,jsx_runtime.jsx)("meta",{content:t,name:n},`extra-meta-tag-${e}`))}return(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[(0,jsx_runtime.jsxs)(react_helmet_.Helmet,{children:[(0,jsx_runtime.jsx)("title",{children:s}),(0,jsx_runtime.jsx)("meta",{name:"description",content:n}),(0,jsx_runtime.jsx)("meta",{name:"twitter:card",content:"summary_large_image"}),(0,jsx_runtime.jsx)("meta",{name:"twitter:title",content:c}),(0,jsx_runtime.jsx)("meta",{name:"twitter:description",content:u}),o?(0,jsx_runtime.jsx)("meta",{name:"twitter:image",content:o}):null,a?(0,jsx_runtime.jsx)("meta",{name:"twitter:site",content:`@${a}`}):null,(0,jsx_runtime.jsx)("meta",{name:"og:title",content:c}),o?(0,jsx_runtime.jsx)("meta",{name:"og:image",content:o}):null,o?(0,jsx_runtime.jsx)("meta",{name:"og:image:alt",content:c}):null,(0,jsx_runtime.jsx)("meta",{name:"og:description",content:u}),a?(0,jsx_runtime.jsx)("meta",{name:"og:sitename",content:a}):null,l?(0,jsx_runtime.jsx)("meta",{name:"og:url",content:l}):null,m]}),t?(0,jsx_runtime.jsx)(Context.Provider,{value:d,children:t}):null]})};MetaTags.Context=Context;var components_MetaTags=MetaTags;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=e=>{let{theme:t}=e;return(0,jsx_runtime.jsxs)("span",{className:t.container,children:[(0,jsx_runtime.jsx)("span",{className:t.circle}),(0,jsx_runtime.jsx)("span",{className:t.circle}),(0,jsx_runtime.jsx)("span",{className:t.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),{container:r,arrow:t,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{left:e,right:e+r,top:t,bottom:t+n}}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=e=>{let{children:t,ref:n,theme:r}=e;const{current:o}=(0,external_react_.useRef)({lastElement:void 0,lastPageX:0,lastPageY:0,lastPlacement:void 0}),[a,i]=(0,external_react_.useState)(null),_=(e,t,n,r)=>{o.lastElement=r,o.lastPageX=e,o.lastPageY=t,o.lastPlacement=n,a&&setComponentPositions(e,t,n,r,a)};return(0,external_react_.useImperativeHandle)(n,(()=>({pointTo:_}))),(0,external_react_.useEffect)((()=>{const e=createTooltipComponents(r);return i(e),()=>{document.body.removeChild(e.container),i(null)}}),[r]),(0,external_react_.useEffect)((()=>{a&&setComponentPositions(o.lastPageX,o.lastPageY,o.lastPlacement,o.lastElement,a)}),[a,o.lastPageX,o.lastPageY,o.lastPlacement,o.lastElement]),a?(0,external_react_dom_.createPortal)(t,a.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=e=>{let{children:t,placement:n=PLACEMENTS.ABOVE_CURSOR,tip:r,theme:o}=e;const{current:a}=(0,external_react_.useRef)({lastCursorX:0,lastCursorY:0,triggeredByTouch:!1,timerId:void 0}),i=(0,external_react_.useRef)(null),_=(0,external_react_.useRef)(null),[s,l]=(0,external_react_.useState)(!1);return(0,external_react_.useEffect)((()=>{if(s&&null!==r){i.current&&i.current.pointTo(a.lastCursorX+window.scrollX,a.lastCursorY+window.scrollY,n,_.current);const e=()=>l(!1);return window.addEventListener("scroll",e),()=>window.removeEventListener("scroll",e)}}),[a.lastCursorX,a.lastCursorY,n,s,r]),(0,jsx_runtime.jsxs)("div",{className:o.wrapper,onMouseLeave:()=>l(!1),onMouseMove:e=>((e,t)=>{if(s){const r=_.current.getBoundingClientRect();e<r.left||e>r.right||t<r.top||t>r.bottom?l(!1):i.current&&i.current.pointTo(e+window.scrollX,t+window.scrollY,n,_.current)}else a.lastCursorX=e,a.lastCursorY=t,a.triggeredByTouch?a.timerId||(a.timerId=setTimeout((()=>{a.triggeredByTouch=!1,a.timerId=void 0,l(!0)}),300)):l(!0)})(e.clientX,e.clientY),onClick:()=>{a.timerId&&(clearTimeout(a.timerId),a.timerId=void 0,a.triggeredByTouch=!1)},onTouchStart:()=>{a.triggeredByTouch=!0},ref:_,role:"presentation",children:[s&&null!==r?(0,jsx_runtime.jsx)(WithTooltip_Tooltip,{ref:i,theme:o,children:r}):null,t]})},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=e=>{var t;let{autoplay:n,src:r,theme:o,title:a}=e;const i=r.split("?");let _=i[0];const s=i[1],l=s?external_qs_default().parse(s):{};return _=`https://www.youtube.com/embed/${l.v||(null===(t=_)||void 0===t||null===(t=t.match(/\/([a-zA-Z0-9-_]*)$/))||void 0===t?void 0:t[1])}`,delete l.v,l.autoplay=n?"1":"0",_+=`?${external_qs_default().stringify(l)}`,(0,jsx_runtime.jsxs)("div",{className:o.container,children:[(0,jsx_runtime.jsx)(components_Throbber,{theme:throbber}),(0,jsx_runtime.jsx)("iframe",{allow:"autoplay",allowFullScreen:!0,className:o.video,src:_,title:a})]})};var components_YouTubeVideo=react_themes_default()(YouTubeVideo,"YouTubeVideo",base),TextArea_style={container:"dzMVIB",context:"KVPc7g",ad:"z2GQ0Z",hoc:"_8R1Qdj",textarea:"zd-OFg",hidden:"GiHBXI"};const TextArea=e=>{let{disabled:t,onBlur:n,onChange:r,onKeyDown:o,placeholder:a,theme:i,value:_}=e;const s=(0,external_react_.useRef)(null),[l,c]=(0,external_react_.useState)(),[u,d]=(0,external_react_.useState)(_||"");return void 0!==_&&u!==_&&d(_),(0,external_react_.useEffect)((()=>{const e=s.current;if(!e)return;const t=new ResizeObserver((()=>{c(e.scrollHeight)}));return t.observe(e),()=>{t.disconnect()}}),[]),(0,external_react_.useEffect)((()=>{const e=s.current;e&&c(e.scrollHeight)}),[u]),(0,jsx_runtime.jsxs)("div",{className:i.container,children:[(0,jsx_runtime.jsx)("textarea",{readOnly:!0,ref:s,className:`${i.textarea} ${i.hidden}`,value:u}),(0,jsx_runtime.jsx)("textarea",{disabled:t,onBlur:n,onChange:void 0===_?e=>{d(e.target.value)}:r,onKeyDown:o,placeholder:a,style:{height:l},className:i.textarea,value:u})]})};var components_TextArea=react_themes_default()(TextArea,"TextArea",TextArea_style),src_dirname="/";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=>{let[t,n]=e;const r=res[t];if(r)res[t]=n;else if(r!==n)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){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};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!==(t=(0,_.A)().ISTATE)&&void 0!==t?t:n.initialState,children:(0,s.jsx)(a.BrowserRouter,{children:(0,s.jsx)(o.HelmetProvider,{children:(0,s.jsx)(e,{})})})});n.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 components_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(){let{autorefresh:e=!1,globalStatePath:t="currentTime",precision:n=5*js_utils_.SEC_MS}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};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(){let{cookieName:e="timezoneOffset",globalStatePath:t="timezoneOffset"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};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(e){let{chunkName:t,getComponent:n,placeholder:r}=e;if(isomorphy.IS_CLIENT_SIDE&&assertChunkName(t,clientChunkGroups),usedChunkNames.has(t))throw Error(`Repeated splitComponent() call for the chunk "${t}"`);usedChunkNames.add(t);const o=(0,external_react_.lazy)((async()=>{const e=await n(),r="default"in e?e.default:e;return isomorphy.IS_CLIENT_SIDE&&await bookStyleSheets(t,clientChunkGroups,!1),{default:e=>{let{children:n,ref:o,...a}=e;if(isomorphy.IS_SERVER_SIDE){const{chunkGroups:e,chunks:n}=getSsrContext();assertChunkName(t,e),n.includes(t)||n.push(t)}return(0,external_react_.useInsertionEffect)((()=>(bookStyleSheets(t,clientChunkGroups,!0),()=>{freeStyleSheets(t,clientChunkGroups)})),[]),(0,jsx_runtime.jsx)(r,{...a,ref:o,children:n})}}}));return e=>{let{children:t,...n}=e;return(0,jsx_runtime.jsx)(external_react_.Suspense,{fallback:r,children:(0,jsx_runtime.jsx)(o,{...n,children:t})})}}const themed=react_themes_default();themed.COMPOSE=react_themes_.COMPOSE,themed.PRIORITY=react_themes_.PRIORITY;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=e=>{let{cancelOnScrolling:t,children:n,containerStyle:r,dontDisableScrolling:o,onCancel:a,overlayStyle:i,style:_,testId:s,testIdForOverlay:l,theme:c}=e;const u=(0,external_react_.useRef)(null),d=(0,external_react_.useRef)(null),[m,p]=(0,external_react_.useState)();(0,external_react_.useEffect)((()=>{const e=document.createElement("div");return document.body.appendChild(e),p(e),()=>{document.body.removeChild(e)}}),[]),(0,external_react_.useEffect)((()=>(t&&a&&(window.addEventListener("scroll",a),window.addEventListener("wheel",a)),()=>{t&&a&&(window.removeEventListener("scroll",a),window.removeEventListener("wheel",a))})),[t,a]),(0,external_react_.useEffect)((()=>(o||document.body.classList.add(styles.scrollingDisabledByModal),()=>{o||document.body.classList.remove(styles.scrollingDisabledByModal)})),[o]);const f=(0,external_react_.useMemo)((()=>(0,jsx_runtime.jsx)("div",{onFocus:()=>{var e;const t=u.current.querySelectorAll("*");for(let e=t.length-1;e>=0;--e)if(t[e].focus(),document.activeElement===t[e])return;null===(e=d.current)||void 0===e||e.focus()},tabIndex:0})),[]);return m?external_react_dom_default().createPortal((0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[f,(0,jsx_runtime.jsx)("div",{"aria-label":"Cancel",className:c.overlay,"data-testid":void 0,onClick:e=>{a&&(a(),e.stopPropagation())},onKeyDown:e=>{"Escape"===e.key&&a&&(a(),e.stopPropagation())},ref:e=>{e&&e!==d.current&&(d.current=e,e.focus())},role:"button",style:i,tabIndex:0}),(0,jsx_runtime.jsx)("div",{"aria-modal":"true",className:c.container,"data-testid":void 0,onClick:e=>{e.stopPropagation()},onWheel:e=>{e.stopPropagation()},ref:u,role:"dialog",style:null!=_?_:r,children:n}),(0,jsx_runtime.jsx)("div",{onFocus:()=>{var e;null===(e=d.current)||void 0===e||e.focus()},tabIndex:0}),f]}),m):null};var Modal=react_themes_default()(BaseModal,"Modal",base_theme),style={overlay:"jKsMKG"};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]}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=e=>{let{containerClass:t,containerStyle:n,filter:r,onCancel:o,onChange:a,optionClass:i,options:_,ref:s}=e;const l=(0,external_react_.useRef)(null);(0,external_react_.useImperativeHandle)(s,(()=>({measure:()=>{var e;const t=null===(e=l.current)||void 0===e?void 0:e.parentElement;if(!t)return;const n=l.current.getBoundingClientRect(),r=window.getComputedStyle(t),o=parseFloat(r.marginBottom),a=parseFloat(r.marginTop);return n.height+=o+a,n}})),[]);const c=[];for(const e of _)if(!r||r(e)){const[t,n]=optionValueName(e);c.push((0,jsx_runtime.jsx)("div",{className:i,onClick:e=>{a(t),e.stopPropagation()},onKeyDown:e=>{"Enter"===e.key&&(a(t),e.stopPropagation())},role:"button",tabIndex:0,children:n},t))}return(0,jsx_runtime.jsx)(BaseModal,{cancelOnScrolling:!0,dontDisableScrolling:!0,onCancel:o,style:n,theme:{ad:"",container:t,context:"",hoc:"",overlay:style.overlay},children:(0,jsx_runtime.jsx)("div",{ref:l,children:c})})};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=e=>{var t,n;let{filter:r,label:o,onChange:a,options:i,theme:_,value:s}=e;const[l,c]=(0,external_react_.useState)(!1),u=(0,external_react_.useRef)(null),d=(0,external_react_.useRef)(null),[m,p]=(0,external_react_.useState)(),[f,h]=(0,external_react_.useState)(!1);(0,external_react_.useEffect)((()=>{if(!l)return;let e;const t=()=>{var n,r;const o=null===(n=u.current)||void 0===n?void 0:n.getBoundingClientRect(),a=null===(r=d.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;h(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};p((e=>areEqual(e,r)?e:r))}e=requestAnimationFrame(t)};return requestAnimationFrame(t),()=>{cancelAnimationFrame(e)}}),[l]);const x=e=>{var t,n;const r=window.visualViewport,o=u.current.getBoundingClientRect();c(!0),p({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 e of i)if(!r||r(e)){const[t,n]=optionValueName(e);if(t===s){b=n;break}}let E=_.container;l&&(E+=` ${_.active}`);let v=null!==(t=_.select)&&void 0!==t?t:"";return f&&(E+=` ${_.upward}`,v+=` ${_.upward}`),(0,jsx_runtime.jsxs)("div",{className:E,children:[void 0===o?null:(0,jsx_runtime.jsx)("div",{className:_.label,children:o}),(0,jsx_runtime.jsxs)("div",{className:_.dropdown,onClick:x,onKeyDown:e=>{"Enter"===e.key&&x(e)},ref:u,role:"listbox",tabIndex:0,children:[b,(0,jsx_runtime.jsx)("div",{className:_.arrow})]}),l?(0,jsx_runtime.jsx)(CustomDropdown_Options,{containerClass:v,containerStyle:m,onCancel:()=>{c(!1)},onChange:e=>{c(!1),a&&a(e)},optionClass:null!==(n=_.option)&&void 0!==n?n:"",options:i,ref:d}):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=e=>{let{filter:t,label:n,onChange:r,options:o,testId:a,theme:i,value:_}=e,s=!1;const l=[];for(const e of o)if(!t||t(e)){const[t,n]=optionValueName(e);s||(s=t===_),l.push((0,jsx_runtime.jsx)("option",{className:i.option,value:t,children:n},t))}const c=s?null:(0,jsx_runtime.jsx)("option",{className:i.hiddenOption,disabled:!0,value:_,children:_},"__reactUtilsHiddenOption");let u=i.select;return s||(u+=` ${i.invalid}`),(0,jsx_runtime.jsxs)("div",{className:i.container,children:[void 0===n?null:(0,jsx_runtime.jsx)("div",{className:i.label,children:n}),(0,jsx_runtime.jsxs)("div",{className:i.dropdown,children:[(0,jsx_runtime.jsxs)("select",{className:u,"data-testid":void 0,onChange:r,value:_,children:[c,l]}),(0,jsx_runtime.jsx)("div",{className:i.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=e=>{let{label:t,onChange:n,options:r,theme:o,value:a}=e;if(!r||!o.option)throw Error("Internal error");const i=[];for(const e of r){const[t,r]=optionValueName(e);let _,s=o.option;t===a?s+=` ${o.selected}`:n&&(_=()=>{n(t)}),i.push(_?(0,jsx_runtime.jsx)("div",{className:s,onClick:_,onKeyDown:e=>{"Enter"===e.key&&_()},role:"button",tabIndex:0,children:r},t):(0,jsx_runtime.jsx)("div",{className:s,children:r},t))}return(0,jsx_runtime.jsxs)("div",{className:o.container,children:[t?(0,jsx_runtime.jsx)("div",{className:o.label,children:t}):null,(0,jsx_runtime.jsx)("div",{className:o.options,children:i})]})};var Switch=react_themes_default()(BaseSwitch,"Switch",Switch_theme),external_react_router_=__webpack_require__(707),GenericLink_style={link:"zH52sA"};const GenericLink=e=>{let{children:t,className:n,disabled:r,enforceA:o,keepScrollPosition:a,onClick:i,onMouseDown:_,openNewTab:s,replace:l,routerLinkType:c,to:u,...d}=e;if(r||o||s||u.match(/^(#|(https?|mailto):)/))return(0,jsx_runtime.jsx)("a",{className:(n?n+" ":"")+"zH52sA",href:u,onClick:r?e=>{e.preventDefault()}:i,onMouseDown:r?e=>{e.preventDefault()}:_,rel:"noopener noreferrer",target:s?"_blank":"",children:t});const m=c;return(0,jsx_runtime.jsx)(m,{className:n,discover:"none",onClick:e=>{i&&i(e),a||window.scroll(0,0)},onMouseDown:_,replace:l,to:u,...d,children:t})};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=e=>{let{active:t,children:n,disabled:r,enforceA:o,onClick:a,onMouseDown:i,onPointerDown:_,openNewTab:s,replace:l,testId:c,theme:u,to:d}=e,m=u.button;return t&&u.active&&(m+=` ${u.active}`),r?(u.disabled&&(m+=` ${u.disabled}`),(0,jsx_runtime.jsx)("div",{className:m,"data-testid":void 0,children:n})):d?(0,jsx_runtime.jsx)(components_Link,{className:m,"data-testid":void 0,enforceA:o,onClick:a,onMouseDown:i,onPointerDown:_,openNewTab:s,replace:l,to:d,children:n}):(0,jsx_runtime.jsx)("div",{className:m,"data-testid":void 0,onClick:a,onKeyDown:a?e=>{"Enter"===e.key&&a(e)}:void 0,onMouseDown:i,onPointerDown:_,role:"button",tabIndex:0,children:n})};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=e=>{let{checked:t,disabled:n,label:r,onChange:o,testId:a,theme:i}=e,_=i.container;n&&(_+=` ${i.disabled}`);let s=i.checkbox;return"indeterminate"===t&&(s+=` ${i.indeterminate}`),(0,jsx_runtime.jsxs)("div",{className:_,children:[void 0===r?null:(0,jsx_runtime.jsx)("div",{className:i.label,children:r}),(0,jsx_runtime.jsx)("input",{checked:void 0===t?void 0:!0===t,className:s,"data-testid":void 0,disabled:n,onChange:o,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=e=>{let{label:t,ref:n,testId:r,theme:o,...a}=e;return(0,jsx_runtime.jsxs)("span",{className:o.container,children:[void 0===t?null:(0,jsx_runtime.jsx)("div",{className:o.label,children:t}),(0,jsx_runtime.jsx)("input",{className:o.input,"data-testid":void 0,ref:n,...a})]})};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=e=>{let{children:t,leftSidePanelContent:n,rightSidePanelContent:r,theme:o}=e;return(0,jsx_runtime.jsxs)("div",{className:o.container,children:[(0,jsx_runtime.jsx)("div",{className:[o.sidePanel,o.leftSidePanel].join(" "),children:n}),(0,jsx_runtime.jsx)("div",{className:o.mainPanel,children:t}),(0,jsx_runtime.jsx)("div",{className:[o.sidePanel,o.rightSidePanel].join(" "),children:r})]})};var components_PageLayout=react_themes_default()(PageLayout,"PageLayout",PageLayout_base_theme),react_helmet_=__webpack_require__(264);const Context=(0,external_react_.createContext)({description:"",title:""}),MetaTags=e=>{let{children:t,description:n,extraMetaTags:r,image:o,siteName:a,socialDescription:i,socialTitle:_,title:s,url:l}=e;const c=_||s,u=i||n,d=(0,external_react_.useMemo)((()=>({description:n,image:o,siteName:a,socialDescription:i,socialTitle:_,title:s,url:l})),[n,o,a,i,_,s,l]),m=[];if(null!=r&&r.length)for(let e=0;e<r.length;++e){const{content:t,name:n}=r[e];m.push((0,jsx_runtime.jsx)("meta",{content:t,name:n},`extra-meta-tag-${e}`))}return(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[(0,jsx_runtime.jsxs)(react_helmet_.Helmet,{children:[(0,jsx_runtime.jsx)("title",{children:s}),(0,jsx_runtime.jsx)("meta",{content:n,name:"description"}),(0,jsx_runtime.jsx)("meta",{content:"summary_large_image",name:"twitter:card"}),(0,jsx_runtime.jsx)("meta",{content:c,name:"twitter:title"}),(0,jsx_runtime.jsx)("meta",{content:u,name:"twitter:description"}),o?(0,jsx_runtime.jsx)("meta",{content:o,name:"twitter:image"}):null,a?(0,jsx_runtime.jsx)("meta",{content:`@${a}`,name:"twitter:site"}):null,(0,jsx_runtime.jsx)("meta",{content:c,name:"og:title"}),o?(0,jsx_runtime.jsx)("meta",{content:o,name:"og:image"}):null,o?(0,jsx_runtime.jsx)("meta",{content:c,name:"og:image:alt"}):null,(0,jsx_runtime.jsx)("meta",{content:u,name:"og:description"}),a?(0,jsx_runtime.jsx)("meta",{content:a,name:"og:sitename"}):null,l?(0,jsx_runtime.jsx)("meta",{content:l,name:"og:url"}):null,m]}),t?(0,jsx_runtime.jsx)(Context.Provider,{value:d,children:t}):null]})};MetaTags.Context=Context;var components_MetaTags=MetaTags;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=e=>{let{theme:t}=e;return(0,jsx_runtime.jsxs)("span",{className:t.container,children:[(0,jsx_runtime.jsx)("span",{className:t.circle}),(0,jsx_runtime.jsx)("span",{className:t.circle}),(0,jsx_runtime.jsx)("span",{className:t.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=e=>{let{children:t,ref:n,theme:r}=e;const{current:o}=(0,external_react_.useRef)({lastElement:void 0,lastPageX:0,lastPageY:0,lastPlacement:void 0}),[a,i]=(0,external_react_.useState)(null),_=(e,t,n,r)=>{o.lastElement=r,o.lastPageX=e,o.lastPageY=t,o.lastPlacement=n,a&&setComponentPositions(e,t,n,r,a)};return(0,external_react_.useImperativeHandle)(n,(()=>({pointTo:_}))),(0,external_react_.useEffect)((()=>{const e=createTooltipComponents(r);return i(e),()=>{document.body.removeChild(e.container),i(null)}}),[r]),(0,external_react_.useEffect)((()=>{a&&setComponentPositions(o.lastPageX,o.lastPageY,o.lastPlacement,o.lastElement,a)}),[a,o.lastPageX,o.lastPageY,o.lastPlacement,o.lastElement]),a?(0,external_react_dom_.createPortal)(t,a.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=e=>{let{children:t,placement:n=PLACEMENTS.ABOVE_CURSOR,tip:r,theme:o}=e;const{current:a}=(0,external_react_.useRef)({lastCursorX:0,lastCursorY:0,timerId:void 0,triggeredByTouch:!1}),i=(0,external_react_.useRef)(null),_=(0,external_react_.useRef)(null),[s,l]=(0,external_react_.useState)(!1);return(0,external_react_.useEffect)((()=>{if(s&&null!==r){i.current&&i.current.pointTo(a.lastCursorX+window.scrollX,a.lastCursorY+window.scrollY,n,_.current);const e=()=>{l(!1)};return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}}}),[a.lastCursorX,a.lastCursorY,n,s,r]),(0,jsx_runtime.jsxs)("div",{className:o.wrapper,onClick:()=>{a.timerId&&(clearTimeout(a.timerId),a.timerId=void 0,a.triggeredByTouch=!1)},onMouseLeave:()=>{l(!1)},onMouseMove:e=>{((e,t)=>{if(s){const r=_.current.getBoundingClientRect();e<r.left||e>r.right||t<r.top||t>r.bottom?l(!1):i.current&&i.current.pointTo(e+window.scrollX,t+window.scrollY,n,_.current)}else{var r;a.lastCursorX=e,a.lastCursorY=t,a.triggeredByTouch?null!==(r=a.timerId)&&void 0!==r||(a.timerId=setTimeout((()=>{a.triggeredByTouch=!1,a.timerId=void 0,l(!0)}),300)):l(!0)}})(e.clientX,e.clientY)},onTouchStart:()=>{a.triggeredByTouch=!0},ref:_,role:"presentation",children:[s&&null!==r?(0,jsx_runtime.jsx)(WithTooltip_Tooltip,{ref:i,theme:o,children:r}):null,t]})},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=e=>{var t,n;let{autoplay:r,src:o,theme:a,title:i}=e;const _=o.split("?");let[s]=_;const[,l]=_,c=l?external_qs_default().parse(l):{};return s=`https://www.youtube.com/embed/${null!==(t=c.v)&&void 0!==t?t:null===(n=s)||void 0===n||null===(n=n.match(/\/([a-zA-Z0-9-_]*)$/))||void 0===n?void 0:n[1]}`,delete c.v,c.autoplay=r?"1":"0",s+=`?${external_qs_default().stringify(c)}`,(0,jsx_runtime.jsxs)("div",{className:a.container,children:[(0,jsx_runtime.jsx)(components_Throbber,{theme:throbber}),(0,jsx_runtime.jsx)("iframe",{allow:"autoplay",allowFullScreen:!0,className:a.video,src:s,title:i})]})};var components_YouTubeVideo=react_themes_default()(YouTubeVideo,"YouTubeVideo",base),TextArea_style={container:"dzMVIB",context:"KVPc7g",ad:"z2GQ0Z",hoc:"_8R1Qdj",textarea:"zd-OFg",hidden:"GiHBXI"};const TextArea=e=>{let{disabled:t,onBlur:n,onChange:r,onKeyDown:o,placeholder:a,theme:i,value:_}=e;const s=(0,external_react_.useRef)(null),[l,c]=(0,external_react_.useState)(),[u,d]=(0,external_react_.useState)(null!=_?_:"");return void 0!==_&&u!==_&&d(_),(0,external_react_.useEffect)((()=>{const e=s.current;if(!e)return;const t=new ResizeObserver((()=>{c(e.scrollHeight)}));return t.observe(e),()=>{t.disconnect()}}),[]),(0,external_react_.useEffect)((()=>{const e=s.current;e&&c(e.scrollHeight)}),[u]),(0,jsx_runtime.jsxs)("div",{className:i.container,children:[(0,jsx_runtime.jsx)("textarea",{className:`${i.textarea} ${i.hidden}`,readOnly:!0,ref:s,value:u}),(0,jsx_runtime.jsx)("textarea",{className:i.textarea,disabled:t,onBlur:n,onChange:void 0===_?e=>{d(e.target.value)}:r,onKeyDown:o,placeholder:a,style:{height:l},value:u})]})};var components_TextArea=react_themes_default()(TextArea,"TextArea",TextArea_style),src_dirname="/";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
|