@modern-js/module-tools-docs 2.0.2 → 2.2.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/doc_build/api/config/build-config.html +332 -0
- package/doc_build/api/config/build-preset.html +43 -0
- package/doc_build/api/config/design-system.html +103 -0
- package/doc_build/api/config/plugins.html +7 -0
- package/doc_build/api/config/testing.html +21 -0
- package/doc_build/api/index.html +1 -0
- package/doc_build/api/plugin-api/plugin-hooks.html +113 -0
- package/doc_build/en/api/config/build-config.html +316 -0
- package/doc_build/en/api/config/build-preset.html +43 -0
- package/doc_build/en/api/config/design-system.html +117 -0
- package/doc_build/en/api/config/plugins.html +7 -0
- package/doc_build/en/api/config/testing.html +21 -0
- package/doc_build/en/api/index.html +1 -0
- package/doc_build/en/api/plugin-api/plugin-hooks.html +113 -0
- package/doc_build/en/guide/advance/asset.html +25 -0
- package/doc_build/en/guide/advance/build-umd.html +32 -0
- package/doc_build/en/guide/advance/copy.html +42 -0
- package/doc_build/en/guide/advance/external-dependency.html +31 -0
- package/doc_build/en/guide/advance/in-depth-about-build.html +112 -0
- package/doc_build/en/guide/advance/in-depth-about-dev-command.html +12 -0
- package/doc_build/en/guide/advance/theme-config.html +29 -0
- package/doc_build/en/guide/basic/before-getting-started.html +89 -0
- package/doc_build/en/guide/basic/command-preview.html +63 -0
- package/doc_build/en/guide/basic/modify-output-product.html +98 -0
- package/doc_build/en/guide/basic/publish-your-project.html +50 -0
- package/doc_build/en/guide/basic/test-your-project.html +31 -0
- package/doc_build/en/guide/basic/use-micro-generator.html +29 -0
- package/doc_build/en/guide/basic/using-storybook.html +66 -0
- package/doc_build/en/guide/best-practices/components.html +111 -0
- package/doc_build/en/guide/intro/getting-started.html +36 -0
- package/doc_build/en/guide/intro/welcome.html +13 -0
- package/doc_build/en/guide/intro/why-module-engineering-solution.html +9 -0
- package/doc_build/en/index.html +1 -0
- package/doc_build/en/plugins/guide/getting-started.html +15 -0
- package/doc_build/en/plugins/guide/plugin-object.html +14 -0
- package/doc_build/en/plugins/guide/setup-function.html +30 -0
- package/doc_build/en/plugins/official-list/overview.html +3 -0
- package/doc_build/guide/advance/asset.html +25 -0
- package/doc_build/guide/advance/build-umd.html +32 -0
- package/doc_build/guide/advance/copy.html +42 -0
- package/doc_build/guide/advance/external-dependency.html +31 -0
- package/doc_build/guide/advance/in-depth-about-build.html +112 -0
- package/doc_build/guide/advance/in-depth-about-dev-command.html +14 -0
- package/doc_build/guide/advance/theme-config.html +28 -0
- package/doc_build/guide/basic/before-getting-started.html +89 -0
- package/doc_build/guide/basic/command-preview.html +63 -0
- package/doc_build/guide/basic/modify-output-product.html +97 -0
- package/doc_build/guide/basic/publish-your-project.html +52 -0
- package/doc_build/guide/basic/test-your-project.html +32 -0
- package/doc_build/guide/basic/use-micro-generator.html +27 -0
- package/doc_build/guide/basic/using-storybook.html +67 -0
- package/doc_build/guide/best-practices/components.html +111 -0
- package/doc_build/guide/intro/getting-started.html +39 -0
- package/doc_build/guide/intro/welcome.html +13 -0
- package/doc_build/guide/intro/why-module-engineering-solution.html +9 -0
- package/doc_build/index.html +1 -0
- package/doc_build/plugins/guide/getting-started.html +15 -0
- package/doc_build/plugins/guide/plugin-object.html +14 -0
- package/doc_build/plugins/guide/setup-function.html +30 -0
- package/doc_build/plugins/official-list/overview.html +3 -0
- package/doc_build/static/css/main.edaad072.css +1 -0
- package/doc_build/static/js/1607.70af642a.js +2 -0
- package/doc_build/static/js/1607.70af642a.js.LICENSE.txt +23 -0
- package/doc_build/static/js/async/3799.e31e8293.js +1 -0
- package/doc_build/static/js/async/8652.6fbf1cb7.js +1 -0
- package/doc_build/static/js/async/en_api_config_build-config.367a5701.js +1 -0
- package/doc_build/static/js/async/en_api_config_build-preset.0d78b268.js +1 -0
- package/doc_build/static/js/async/en_api_config_design-system.b28d6723.js +1 -0
- package/doc_build/static/js/async/en_api_config_plugins.fc95fb77.js +1 -0
- package/doc_build/static/js/async/en_api_config_testing.8bc7f316.js +1 -0
- package/doc_build/static/js/async/en_api_index.669f0a56.js +1 -0
- package/doc_build/static/js/async/en_api_plugin-api_plugin-hooks.60d0260c.js +1 -0
- package/doc_build/static/js/async/en_guide_advance_asset.5ff1d623.js +1 -0
- package/doc_build/static/js/async/en_guide_advance_build-umd.c254ed46.js +1 -0
- package/doc_build/static/js/async/en_guide_advance_copy.45c0a51d.js +1 -0
- package/doc_build/static/js/async/en_guide_advance_external-dependency.a52d3247.js +1 -0
- package/doc_build/static/js/async/en_guide_advance_in-depth-about-build.51bf3569.js +1 -0
- package/doc_build/static/js/async/en_guide_advance_in-depth-about-dev-command.aec0b4e1.js +1 -0
- package/doc_build/static/js/async/en_guide_advance_theme-config.db0ad9fc.js +1 -0
- package/doc_build/static/js/async/en_guide_basic_before-getting-started.a22fc49a.js +1 -0
- package/doc_build/static/js/async/en_guide_basic_command-preview.1707ed29.js +1 -0
- package/doc_build/static/js/async/en_guide_basic_modify-output-product.ad453d13.js +1 -0
- package/doc_build/static/js/async/en_guide_basic_publish-your-project.08c5112f.js +1 -0
- package/doc_build/static/js/async/en_guide_basic_test-your-project.f5f6b204.js +1 -0
- package/doc_build/static/js/async/en_guide_basic_use-micro-generator.56325139.js +1 -0
- package/doc_build/static/js/async/en_guide_basic_using-storybook.9d721554.js +1 -0
- package/doc_build/static/js/async/en_guide_best-practices_components.45155af9.js +1 -0
- package/doc_build/static/js/async/en_guide_intro_getting-started.f8682be3.js +1 -0
- package/doc_build/static/js/async/en_guide_intro_welcome.9cc45924.js +1 -0
- package/doc_build/static/js/async/en_guide_intro_why-module-engineering-solution.7f2dae5c.js +1 -0
- package/doc_build/static/js/async/en_index.7bd869c4.js +1 -0
- package/doc_build/static/js/async/en_plugins_guide_getting-started.b850249c.js +1 -0
- package/doc_build/static/js/async/en_plugins_guide_plugin-object.bf6c6221.js +1 -0
- package/doc_build/static/js/async/en_plugins_guide_setup-function.80a2bd97.js +1 -0
- package/doc_build/static/js/async/en_plugins_official-list_overview.84e5cea0.js +1 -0
- package/doc_build/static/js/async/zh_api_config_build-config.048fd5ec.js +1 -0
- package/doc_build/static/js/async/zh_api_config_build-preset.7c13584d.js +1 -0
- package/doc_build/static/js/async/zh_api_config_design-system.1eecd474.js +1 -0
- package/doc_build/static/js/async/zh_api_config_plugins.c22dc4be.js +1 -0
- package/doc_build/static/js/async/zh_api_config_testing.a9888eed.js +1 -0
- package/doc_build/static/js/async/zh_api_index.22957707.js +1 -0
- package/doc_build/static/js/async/zh_api_plugin-api_plugin-hooks.a4d81bf6.js +1 -0
- package/doc_build/static/js/async/zh_guide_advance_asset.5b936003.js +1 -0
- package/doc_build/static/js/async/zh_guide_advance_build-umd.b6d541ff.js +1 -0
- package/doc_build/static/js/async/zh_guide_advance_copy.21a1aea4.js +1 -0
- package/doc_build/static/js/async/zh_guide_advance_external-dependency.c7cf5d4b.js +1 -0
- package/doc_build/static/js/async/zh_guide_advance_in-depth-about-build.64e795f3.js +1 -0
- package/doc_build/static/js/async/zh_guide_advance_in-depth-about-dev-command.168ce7dd.js +1 -0
- package/doc_build/static/js/async/zh_guide_advance_theme-config.b9570109.js +1 -0
- package/doc_build/static/js/async/zh_guide_basic_before-getting-started.6b06b54a.js +1 -0
- package/doc_build/static/js/async/zh_guide_basic_command-preview.1199124a.js +1 -0
- package/doc_build/static/js/async/zh_guide_basic_modify-output-product.8ccbc8d1.js +1 -0
- package/doc_build/static/js/async/zh_guide_basic_publish-your-project.bf11b1c4.js +1 -0
- package/doc_build/static/js/async/zh_guide_basic_test-your-project.ae52c47a.js +1 -0
- package/doc_build/static/js/async/zh_guide_basic_use-micro-generator.a091d57d.js +1 -0
- package/doc_build/static/js/async/zh_guide_basic_using-storybook.27829e44.js +1 -0
- package/doc_build/static/js/async/zh_guide_best-practices_components.7454d916.js +1 -0
- package/doc_build/static/js/async/zh_guide_intro_getting-started.a4c00d9a.js +1 -0
- package/doc_build/static/js/async/zh_guide_intro_welcome.71c3fe16.js +1 -0
- package/doc_build/static/js/async/zh_guide_intro_why-module-engineering-solution.6f8b5ff6.js +1 -0
- package/doc_build/static/js/async/zh_index.c19f9dcf.js +1 -0
- package/doc_build/static/js/async/zh_plugins_guide_getting-started.099dfaea.js +1 -0
- package/doc_build/static/js/async/zh_plugins_guide_plugin-object.963289d5.js +1 -0
- package/doc_build/static/js/async/zh_plugins_guide_setup-function.67d07b91.js +1 -0
- package/doc_build/static/js/async/zh_plugins_official-list_overview.a7635714.js +1 -0
- package/doc_build/static/js/lib-lodash.c5845536.js +1 -0
- package/doc_build/static/js/lib-polyfill.b3038509.js +1 -0
- package/doc_build/static/js/lib-react.d41ace5e.js +2 -0
- package/doc_build/static/js/lib-react.d41ace5e.js.LICENSE.txt +29 -0
- package/doc_build/static/js/main.2d3257a4.js +1 -0
- package/doc_build/static/search_index.json +1 -0
- package/docs/en/api/config/build-config.md +15 -5
- package/docs/en/api/config/build-preset.md +3 -2
- package/docs/en/api/config/design-system.md +623 -615
- package/docs/en/api/config/plugins.md +2 -2
- package/docs/en/api/config/testing.md +2 -1
- package/docs/en/guide/advance/asset.mdx +0 -4
- package/docs/en/guide/advance/build-umd.mdx +3 -3
- package/docs/en/guide/advance/in-depth-about-build.md +14 -13
- package/docs/en/guide/advance/in-depth-about-dev-command.md +2 -1
- package/docs/en/guide/basic/before-getting-started.md +16 -9
- package/docs/en/guide/basic/command-preview.md +2 -2
- package/docs/en/guide/basic/modify-output-product.md +65 -69
- package/docs/en/guide/basic/test-your-project.mdx +1 -3
- package/docs/en/guide/basic/use-micro-generator.md +4 -0
- package/docs/en/guide/basic/using-storybook.mdx +1 -13
- package/docs/en/plugins/guide/getting-started.mdx +2 -2
- package/docs/en/plugins/guide/plugin-object.mdx +5 -5
- package/docs/zh/api/config/build-config.md +18 -6
- package/docs/zh/api/config/build-preset.md +3 -2
- package/docs/zh/api/config/design-system.md +2 -2
- package/docs/zh/api/config/plugins.md +2 -2
- package/docs/zh/api/config/testing.md +3 -2
- package/docs/zh/guide/advance/asset.mdx +0 -5
- package/docs/zh/guide/advance/build-umd.mdx +3 -3
- package/docs/zh/guide/advance/in-depth-about-build.md +14 -13
- package/docs/zh/guide/advance/in-depth-about-dev-command.md +2 -1
- package/docs/zh/guide/basic/before-getting-started.md +15 -8
- package/docs/zh/guide/basic/command-preview.md +2 -2
- package/docs/zh/guide/basic/modify-output-product.md +17 -19
- package/docs/zh/guide/basic/test-your-project.mdx +1 -3
- package/docs/zh/guide/basic/use-micro-generator.md +5 -1
- package/docs/zh/guide/basic/using-storybook.mdx +9 -19
- package/docs/zh/guide/intro/getting-started.md +1 -1
- package/docs/zh/plugins/guide/getting-started.mdx +2 -2
- package/docs/zh/plugins/guide/plugin-object.mdx +5 -5
- package/modern.config.ts +11 -5
- package/package.json +3 -3
- package/LICENSE +0 -144
- package/doc_build/html/main/index.html +0 -16
- package/doc_build/route.json +0 -10
- package/doc_build/static/css/main.css +0 -3370
- package/doc_build/static/css/main.css.map +0 -1
- package/doc_build/static/css/vendors-node_modules_pnpm_remix-run_router_1_2_0_node_modules_remix-run_router_dist_router_js-9d5e9c.css +0 -85
- package/doc_build/static/css/vendors-node_modules_pnpm_remix-run_router_1_2_0_node_modules_remix-run_router_dist_router_js-9d5e9c.css.map +0 -1
- package/doc_build/static/js/async/api_.js +0 -56
- package/doc_build/static/js/async/api_.js.map +0 -1
- package/doc_build/static/js/async/api_config_build-config.js +0 -11309
- package/doc_build/static/js/async/api_config_build-config.js.map +0 -1
- package/doc_build/static/js/async/api_config_build-preset.js +0 -7849
- package/doc_build/static/js/async/api_config_build-preset.js.map +0 -1
- package/doc_build/static/js/async/api_config_design-system.js +0 -48708
- package/doc_build/static/js/async/api_config_design-system.js.map +0 -1
- package/doc_build/static/js/async/api_config_plugins.js +0 -1492
- package/doc_build/static/js/async/api_config_plugins.js.map +0 -1
- package/doc_build/static/js/async/api_config_testing.js +0 -2130
- package/doc_build/static/js/async/api_config_testing.js.map +0 -1
- package/doc_build/static/js/async/api_plugin-api_plugin-hooks.js +0 -14394
- package/doc_build/static/js/async/api_plugin-api_plugin-hooks.js.map +0 -1
- package/doc_build/static/js/async/en_.js +0 -85
- package/doc_build/static/js/async/en_.js.map +0 -1
- package/doc_build/static/js/async/en_api_.js +0 -55
- package/doc_build/static/js/async/en_api_.js.map +0 -1
- package/doc_build/static/js/async/en_api_config_build-config.js +0 -8363
- package/doc_build/static/js/async/en_api_config_build-config.js.map +0 -1
- package/doc_build/static/js/async/en_api_config_build-preset.js +0 -7845
- package/doc_build/static/js/async/en_api_config_build-preset.js.map +0 -1
- package/doc_build/static/js/async/en_api_config_design-system.js +0 -16345
- package/doc_build/static/js/async/en_api_config_design-system.js.map +0 -1
- package/doc_build/static/js/async/en_api_config_plugins.js +0 -1492
- package/doc_build/static/js/async/en_api_config_plugins.js.map +0 -1
- package/doc_build/static/js/async/en_api_config_testing.js +0 -2137
- package/doc_build/static/js/async/en_api_config_testing.js.map +0 -1
- package/doc_build/static/js/async/en_api_plugin-api_plugin-hooks.js +0 -14362
- package/doc_build/static/js/async/en_api_plugin-api_plugin-hooks.js.map +0 -1
- package/doc_build/static/js/async/en_guide_advance_asset.js +0 -3997
- package/doc_build/static/js/async/en_guide_advance_asset.js.map +0 -1
- package/doc_build/static/js/async/en_guide_advance_build-umd.js +0 -9861
- package/doc_build/static/js/async/en_guide_advance_build-umd.js.map +0 -1
- package/doc_build/static/js/async/en_guide_advance_copy.js +0 -6539
- package/doc_build/static/js/async/en_guide_advance_copy.js.map +0 -1
- package/doc_build/static/js/async/en_guide_advance_external-dependency.js +0 -3810
- package/doc_build/static/js/async/en_guide_advance_external-dependency.js.map +0 -1
- package/doc_build/static/js/async/en_guide_advance_in-depth-about-build.js +0 -5046
- package/doc_build/static/js/async/en_guide_advance_in-depth-about-build.js.map +0 -1
- package/doc_build/static/js/async/en_guide_advance_in-depth-about-dev-command.js +0 -150
- package/doc_build/static/js/async/en_guide_advance_in-depth-about-dev-command.js.map +0 -1
- package/doc_build/static/js/async/en_guide_advance_theme-config.js +0 -2484
- package/doc_build/static/js/async/en_guide_advance_theme-config.js.map +0 -1
- package/doc_build/static/js/async/en_guide_basic_before-getting-started.js +0 -3671
- package/doc_build/static/js/async/en_guide_basic_before-getting-started.js.map +0 -1
- package/doc_build/static/js/async/en_guide_basic_command-preview.js +0 -3961
- package/doc_build/static/js/async/en_guide_basic_command-preview.js.map +0 -1
- package/doc_build/static/js/async/en_guide_basic_modify-output-product.js +0 -2970
- package/doc_build/static/js/async/en_guide_basic_modify-output-product.js.map +0 -1
- package/doc_build/static/js/async/en_guide_basic_publish-your-project.js +0 -2182
- package/doc_build/static/js/async/en_guide_basic_publish-your-project.js.map +0 -1
- package/doc_build/static/js/async/en_guide_basic_test-your-project.js +0 -3892
- package/doc_build/static/js/async/en_guide_basic_test-your-project.js.map +0 -1
- package/doc_build/static/js/async/en_guide_basic_use-micro-generator.js +0 -168
- package/doc_build/static/js/async/en_guide_basic_use-micro-generator.js.map +0 -1
- package/doc_build/static/js/async/en_guide_basic_using-storybook.js +0 -4762
- package/doc_build/static/js/async/en_guide_basic_using-storybook.js.map +0 -1
- package/doc_build/static/js/async/en_guide_best-practices_components.js +0 -21388
- package/doc_build/static/js/async/en_guide_best-practices_components.js.map +0 -1
- package/doc_build/static/js/async/en_guide_intro_getting-started.js +0 -1906
- package/doc_build/static/js/async/en_guide_intro_getting-started.js.map +0 -1
- package/doc_build/static/js/async/en_guide_intro_welcome.js +0 -148
- package/doc_build/static/js/async/en_guide_intro_welcome.js.map +0 -1
- package/doc_build/static/js/async/en_guide_intro_why-module-engineering-solution.js +0 -92
- package/doc_build/static/js/async/en_guide_intro_why-module-engineering-solution.js.map +0 -1
- package/doc_build/static/js/async/en_plugins_guide_getting-started.js +0 -2560
- package/doc_build/static/js/async/en_plugins_guide_getting-started.js.map +0 -1
- package/doc_build/static/js/async/en_plugins_guide_plugin-object.js +0 -4177
- package/doc_build/static/js/async/en_plugins_guide_plugin-object.js.map +0 -1
- package/doc_build/static/js/async/en_plugins_guide_setup-function.js +0 -3819
- package/doc_build/static/js/async/en_plugins_guide_setup-function.js.map +0 -1
- package/doc_build/static/js/async/en_plugins_official-list_overview.js +0 -70
- package/doc_build/static/js/async/en_plugins_official-list_overview.js.map +0 -1
- package/doc_build/static/js/async/guide_advance_asset.js +0 -3997
- package/doc_build/static/js/async/guide_advance_asset.js.map +0 -1
- package/doc_build/static/js/async/guide_advance_build-umd.js +0 -9863
- package/doc_build/static/js/async/guide_advance_build-umd.js.map +0 -1
- package/doc_build/static/js/async/guide_advance_copy.js +0 -6539
- package/doc_build/static/js/async/guide_advance_copy.js.map +0 -1
- package/doc_build/static/js/async/guide_advance_external-dependency.js +0 -3812
- package/doc_build/static/js/async/guide_advance_external-dependency.js.map +0 -1
- package/doc_build/static/js/async/guide_advance_in-depth-about-build.js +0 -5046
- package/doc_build/static/js/async/guide_advance_in-depth-about-build.js.map +0 -1
- package/doc_build/static/js/async/guide_advance_in-depth-about-dev-command.js +0 -152
- package/doc_build/static/js/async/guide_advance_in-depth-about-dev-command.js.map +0 -1
- package/doc_build/static/js/async/guide_advance_theme-config.js +0 -2475
- package/doc_build/static/js/async/guide_advance_theme-config.js.map +0 -1
- package/doc_build/static/js/async/guide_basic_before-getting-started.js +0 -3662
- package/doc_build/static/js/async/guide_basic_before-getting-started.js.map +0 -1
- package/doc_build/static/js/async/guide_basic_command-preview.js +0 -3793
- package/doc_build/static/js/async/guide_basic_command-preview.js.map +0 -1
- package/doc_build/static/js/async/guide_basic_modify-output-product.js +0 -2949
- package/doc_build/static/js/async/guide_basic_modify-output-product.js.map +0 -1
- package/doc_build/static/js/async/guide_basic_publish-your-project.js +0 -2243
- package/doc_build/static/js/async/guide_basic_publish-your-project.js.map +0 -1
- package/doc_build/static/js/async/guide_basic_test-your-project.js +0 -3892
- package/doc_build/static/js/async/guide_basic_test-your-project.js.map +0 -1
- package/doc_build/static/js/async/guide_basic_use-micro-generator.js +0 -172
- package/doc_build/static/js/async/guide_basic_use-micro-generator.js.map +0 -1
- package/doc_build/static/js/async/guide_basic_using-storybook.js +0 -4762
- package/doc_build/static/js/async/guide_basic_using-storybook.js.map +0 -1
- package/doc_build/static/js/async/guide_best-practices_components.js +0 -21088
- package/doc_build/static/js/async/guide_best-practices_components.js.map +0 -1
- package/doc_build/static/js/async/guide_intro_getting-started.js +0 -1782
- package/doc_build/static/js/async/guide_intro_getting-started.js.map +0 -1
- package/doc_build/static/js/async/guide_intro_welcome.js +0 -148
- package/doc_build/static/js/async/guide_intro_welcome.js.map +0 -1
- package/doc_build/static/js/async/guide_intro_why-module-engineering-solution.js +0 -92
- package/doc_build/static/js/async/guide_intro_why-module-engineering-solution.js.map +0 -1
- package/doc_build/static/js/async/index.js +0 -85
- package/doc_build/static/js/async/index.js.map +0 -1
- package/doc_build/static/js/async/packages_cli_doc-core_src_theme-default_components_Search_logic_search_ts.js +0 -447
- package/doc_build/static/js/async/packages_cli_doc-core_src_theme-default_components_Search_logic_search_ts.js.map +0 -1
- package/doc_build/static/js/async/plugins_guide_getting-started.js +0 -2608
- package/doc_build/static/js/async/plugins_guide_getting-started.js.map +0 -1
- package/doc_build/static/js/async/plugins_guide_plugin-object.js +0 -4173
- package/doc_build/static/js/async/plugins_guide_plugin-object.js.map +0 -1
- package/doc_build/static/js/async/plugins_guide_setup-function.js +0 -3819
- package/doc_build/static/js/async/plugins_guide_setup-function.js.map +0 -1
- package/doc_build/static/js/async/plugins_official-list_overview.js +0 -70
- package/doc_build/static/js/async/plugins_official-list_overview.js.map +0 -1
- package/doc_build/static/js/async/vendors-node_modules_pnpm_code-hike_mdx_0_7_4_react_18_2_0_node_modules_code-hike_mdx_dist_co-06dd41.js +0 -6656
- package/doc_build/static/js/async/vendors-node_modules_pnpm_code-hike_mdx_0_7_4_react_18_2_0_node_modules_code-hike_mdx_dist_co-06dd41.js.map +0 -1
- package/doc_build/static/js/async/vendors-node_modules_pnpm_flexsearch_0_6_32_node_modules_flexsearch_dist_flexsearch_min_js.js +0 -54
- package/doc_build/static/js/async/vendors-node_modules_pnpm_flexsearch_0_6_32_node_modules_flexsearch_dist_flexsearch_min_js.js.map +0 -1
- package/doc_build/static/js/builder-runtime.js +0 -1375
- package/doc_build/static/js/builder-runtime.js.map +0 -1
- package/doc_build/static/js/lib-lodash.js +0 -4907
- package/doc_build/static/js/lib-lodash.js.map +0 -1
- package/doc_build/static/js/lib-polyfill.js +0 -24769
- package/doc_build/static/js/lib-polyfill.js.map +0 -1
- package/doc_build/static/js/lib-react.js +0 -39510
- package/doc_build/static/js/lib-react.js.map +0 -1
- package/doc_build/static/js/main.js +0 -9237
- package/doc_build/static/js/main.js.map +0 -1
- package/doc_build/static/js/vendors-node_modules_pnpm_remix-run_router_1_2_0_node_modules_remix-run_router_dist_router_js-9d5e9c.js +0 -8532
- package/doc_build/static/js/vendors-node_modules_pnpm_remix-run_router_1_2_0_node_modules_remix-run_router_dist_router_js-9d5e9c.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"static/js/async/vendors-node_modules_pnpm_code-hike_mdx_0_7_4_react_18_2_0_node_modules_code-hike_mdx_dist_co-06dd41.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","sources":["webpack://@modern-js/module-tools-docs/../../node_modules/.pnpm/@code-hike+mdx@0.7.4_react@18.2.0/node_modules/@code-hike/mdx/dist/components.esm.mjs"],"sourcesContent":["import React, { createContext, useCallback, useContext, useMemo } from 'react';\nimport { unstable_batchedUpdates } from 'react-dom';\n\n/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n\r\nfunction __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\n\n// from https://stackoverflow.com/a/53936623/1325646\r\nconst isValidHex = (hex) => /^#([A-Fa-f0-9]{3,4}){1,2}$/.test(hex);\r\nconst getChunksFromString = (st, chunkSize) => st.match(new RegExp(`.{${chunkSize}}`, \"g\"));\r\nconst convertHexUnitTo256 = (hex) => parseInt(hex.repeat(2 / hex.length), 16);\r\nfunction getAlphaFloat(a, alpha) {\r\n if (typeof a !== \"undefined\") {\r\n return a / 255;\r\n }\r\n if (typeof alpha != \"number\" || alpha < 0 || alpha > 1) {\r\n return 1;\r\n }\r\n return alpha;\r\n}\r\nfunction hexToObject(hex) {\r\n if (!hex) {\r\n return undefined;\r\n }\r\n if (!isValidHex(hex)) {\r\n throw new Error(\"Invalid color string, must be a valid hex color\");\r\n }\r\n const chunkSize = Math.floor((hex.length - 1) / 3);\r\n const hexArr = getChunksFromString(hex.slice(1), chunkSize);\r\n const [r, g, b, a] = hexArr.map(convertHexUnitTo256);\r\n return {\r\n r,\r\n g,\r\n b,\r\n a: getAlphaFloat(a, 1),\r\n };\r\n}\r\nfunction objectToHex(object) {\r\n if (!object) {\r\n return undefined;\r\n }\r\n const { r, g, b, a } = object;\r\n const alpha = Math.round(a * 255);\r\n return `#${r.toString(16).padStart(2, \"0\")}${g\r\n .toString(16)\r\n .padStart(2, \"0\")}${b\r\n .toString(16)\r\n .padStart(2, \"0\")}${alpha\r\n .toString(16)\r\n .padStart(2, \"0\")}`;\r\n}\r\nfunction transparent(color, opacity) {\r\n if (!color) {\r\n return color;\r\n }\r\n const { r, g, b, a } = hexToObject(color);\r\n return objectToHex({ r, g, b, a: a * opacity });\r\n}\n\nfunction map(tween, fn) {\r\n return {\r\n prev: fn(tween.prev, \"prev\"),\r\n next: fn(tween.next, \"next\"),\r\n };\r\n}\r\nfunction withDefault(t, deft) {\r\n return {\r\n prev: (t === null || t === void 0 ? void 0 : t.prev) === undefined ? deft : t.prev,\r\n next: (t === null || t === void 0 ? void 0 : t.next) === undefined ? deft : t.next,\r\n };\r\n}\r\nfunction mapWithDefault(tween, deft, fn) {\r\n return map(withDefault(tween, deft), fn);\r\n}\r\nfunction anyValue(tween, fn) {\r\n return fn(tween.prev) || fn(tween.next);\r\n}\n\nfunction codeToText(code) {\r\n return code.lines\r\n .map(line => line.tokens.map(token => token.content).join(\"\"))\r\n .join(\"\\n\");\r\n}\n\nfunction mapFocusToLineNumbers(focus, lines) {\r\n if (!focus) {\r\n // focus all lines\r\n return mergeToObject([...lines.keys()].map(lineIndex => ({\r\n [lineIndex + 1]: true,\r\n })));\r\n }\r\n else {\r\n return mergeToObject(splitParts(focus).map(parsePartToObject));\r\n }\r\n}\r\nfunction splitParts(focus) {\r\n return focus.split(/,(?![^\\[]*\\])/g);\r\n}\r\nfunction mergeToObject(entries) {\r\n return entries.reduce((acc, obj) => Object.assign(acc, obj), {});\r\n}\r\nfunction hasColumns(part) {\r\n return !!part.match(/(\\d+)\\[(.+)\\]/);\r\n}\r\nfunction parsePartToObject(part) {\r\n // a part could be\r\n // - a line number: \"2\"\r\n // - a line range: \"5:9\"\r\n // - a line number with a column selector: \"2[1,3:5,9]\"\r\n const columnsMatch = part.match(/(\\d+)\\[(.+)\\]/);\r\n if (columnsMatch) {\r\n const [, line, columns] = columnsMatch;\r\n const columnsList = columns\r\n .split(\",\")\r\n .map(parseExtremes);\r\n const lineNumber = Number(line);\r\n return { [lineNumber]: columnsList };\r\n }\r\n else {\r\n return mergeToObject(expandString(part).map(lineNumber => ({\r\n [lineNumber]: true,\r\n })));\r\n }\r\n}\r\nfunction parseExtremes(part) {\r\n // Transforms something like\r\n // - \"1:3\" to {start:1, end: 3}\r\n // - \"4\" to {start:4, end:4}\r\n const [start, end] = part.split(\":\");\r\n if (!isNaturalNumber(start)) {\r\n throw new FocusNumberError(start);\r\n }\r\n const startNumber = Number(start);\r\n if (startNumber < 1) {\r\n throw new LineOrColumnNumberError();\r\n }\r\n if (!end) {\r\n return { start: startNumber, end: startNumber };\r\n }\r\n else {\r\n if (!isNaturalNumber(end)) {\r\n throw new FocusNumberError(end);\r\n }\r\n return { start: startNumber, end: +end };\r\n }\r\n}\r\n/**\r\n * Return the first and last indexes to focus, both included\r\n */\r\nfunction getFocusExtremes(focus, lines) {\r\n if (!focus) {\r\n return [0, lines.length - 1];\r\n }\r\n else {\r\n const parsed = parseFocus(focus);\r\n const focusedIndexes = Object.keys(parsed).map(i => parseInt(i, 10));\r\n return [\r\n Math.min(...focusedIndexes),\r\n Math.max(...focusedIndexes),\r\n ];\r\n }\r\n}\r\nfunction getFocusIndexes(focus, lines) {\r\n if (!focus) {\r\n return [...lines.keys()];\r\n }\r\n else {\r\n const parsed = parseFocus(focus);\r\n const focusedIndexes = Object.keys(parsed).map(i => parseInt(i, 10));\r\n return focusedIndexes;\r\n }\r\n}\r\nfunction parseFocus(focus) {\r\n if (!focus) {\r\n throw new Error(\"Focus cannot be empty\");\r\n }\r\n try {\r\n const parts = focus\r\n .split(/,(?![^\\[]*\\])/g)\r\n .map(parsePart);\r\n return fromEntries(parts.flat());\r\n }\r\n catch (error) {\r\n // TODO enhance error\r\n throw error;\r\n }\r\n}\r\nfunction parsePart(part) {\r\n // a part could be\r\n // - a line number: \"2\"\r\n // - a line range: \"5:9\"\r\n // - a line number with a column selector: \"2[1,3:5,9]\"\r\n const columnsMatch = part.match(/(\\d+)\\[(.+)\\]/);\r\n if (columnsMatch) {\r\n const [, line, columns] = columnsMatch;\r\n const columnsList = columns.split(\",\").map(expandString);\r\n const lineIndex = Number(line) - 1;\r\n const columnIndexes = columnsList.flat().map(c => c - 1);\r\n return [[lineIndex, columnIndexes]];\r\n }\r\n else {\r\n return expandString(part).map(lineNumber => [\r\n lineNumber - 1,\r\n true,\r\n ]);\r\n }\r\n}\r\nfunction expandString(part) {\r\n // Transforms something like\r\n // - \"1:3\" to [1,2,3]\r\n // - \"4\" to [4]\r\n const [start, end] = part.split(\":\");\r\n if (!isNaturalNumber(start)) {\r\n throw new FocusNumberError(start);\r\n }\r\n const startNumber = Number(start);\r\n if (startNumber < 1) {\r\n throw new LineOrColumnNumberError();\r\n }\r\n if (!end) {\r\n return [startNumber];\r\n }\r\n else {\r\n if (!isNaturalNumber(end)) {\r\n throw new FocusNumberError(end);\r\n }\r\n const list = [];\r\n for (let i = startNumber; i <= +end; i++) {\r\n list.push(i);\r\n }\r\n return list;\r\n }\r\n}\r\nfunction isNaturalNumber(n) {\r\n n = n.toString(); // force the value in case it is not\r\n var n1 = Math.abs(n), n2 = parseInt(n, 10);\r\n return !isNaN(n1) && n2 === n1 && n1.toString() === n;\r\n}\r\nclass LineOrColumnNumberError extends Error {\r\n constructor() {\r\n super(`Invalid line or column number in focus string`);\r\n Object.setPrototypeOf(this, new.target.prototype);\r\n }\r\n}\r\nclass FocusNumberError extends Error {\r\n constructor(number) {\r\n super(`Invalid number \"${number}\" in focus string`);\r\n this.number = number;\r\n Object.setPrototypeOf(this, new.target.prototype);\r\n }\r\n}\r\nfunction fromEntries(pairs) {\r\n const result = {};\r\n let index = -1, length = pairs == null ? 0 : pairs.length;\r\n while (++index < length) {\r\n var pair = pairs[index];\r\n result[pair[0]] = pair[1];\r\n }\r\n return result;\r\n}\n\nvar ColorName;\r\n(function (ColorName) {\r\n ColorName[ColorName[\"CodeForeground\"] = 0] = \"CodeForeground\";\r\n ColorName[ColorName[\"CodeBackground\"] = 1] = \"CodeBackground\";\r\n ColorName[ColorName[\"EditorForeground\"] = 2] = \"EditorForeground\";\r\n ColorName[ColorName[\"EditorBackground\"] = 3] = \"EditorBackground\";\r\n ColorName[ColorName[\"FocusBorder\"] = 4] = \"FocusBorder\";\r\n ColorName[ColorName[\"ActiveTabBackground\"] = 5] = \"ActiveTabBackground\";\r\n ColorName[ColorName[\"ActiveTabForeground\"] = 6] = \"ActiveTabForeground\";\r\n ColorName[ColorName[\"InactiveTabBackground\"] = 7] = \"InactiveTabBackground\";\r\n ColorName[ColorName[\"InactiveTabForeground\"] = 8] = \"InactiveTabForeground\";\r\n ColorName[ColorName[\"EditorGroupBorder\"] = 9] = \"EditorGroupBorder\";\r\n ColorName[ColorName[\"EditorGroupHeaderBackground\"] = 10] = \"EditorGroupHeaderBackground\";\r\n ColorName[ColorName[\"TabBorder\"] = 11] = \"TabBorder\";\r\n ColorName[ColorName[\"ActiveTabBottomBorder\"] = 12] = \"ActiveTabBottomBorder\";\r\n ColorName[ColorName[\"LineNumberForeground\"] = 13] = \"LineNumberForeground\";\r\n ColorName[ColorName[\"InputForeground\"] = 14] = \"InputForeground\";\r\n ColorName[ColorName[\"InputBackground\"] = 15] = \"InputBackground\";\r\n ColorName[ColorName[\"InputBorder\"] = 16] = \"InputBorder\";\r\n ColorName[ColorName[\"SelectionBackground\"] = 17] = \"SelectionBackground\";\r\n ColorName[ColorName[\"IconForeground\"] = 18] = \"IconForeground\";\r\n ColorName[ColorName[\"ListActiveSelectionBackground\"] = 19] = \"ListActiveSelectionBackground\";\r\n ColorName[ColorName[\"ListActiveSelectionForeground\"] = 20] = \"ListActiveSelectionForeground\";\r\n ColorName[ColorName[\"ListHoverBackground\"] = 21] = \"ListHoverBackground\";\r\n ColorName[ColorName[\"ListHoverForeground\"] = 22] = \"ListHoverForeground\";\r\n ColorName[ColorName[\"SideBarBackground\"] = 23] = \"SideBarBackground\";\r\n ColorName[ColorName[\"SideBarForeground\"] = 24] = \"SideBarForeground\";\r\n ColorName[ColorName[\"SideBarBorder\"] = 25] = \"SideBarBorder\";\r\n // Background color for the highlight of line at the cursor position\r\n ColorName[ColorName[\"LineHighlightBackground\"] = 26] = \"LineHighlightBackground\";\r\n // Background color of highlighted ranges, like by quick open and find features\r\n ColorName[ColorName[\"RangeHighlightBackground\"] = 27] = \"RangeHighlightBackground\";\r\n // Foreground color of info squigglies in the editor\r\n ColorName[ColorName[\"EditorInfoForeground\"] = 28] = \"EditorInfoForeground\";\r\n})(ColorName || (ColorName = {}));\r\nconst contrastBorder = \"#6FC3DF\";\r\n// defaults from: https://github.com/microsoft/vscode/blob/main/src/vs/workbench/common/theme.ts\r\n// and: https://github.com/microsoft/vscode/blob/main/src/vs/editor/common/core/editorColorRegistry.ts\r\n// and: https://github.com/microsoft/vscode/blob/main/src/vs/platform/theme/common/colorRegistry.ts\r\n// keys from : https://code.visualstudio.com/api/references/theme-color#editor-groups-tabs\r\nfunction getColor(theme, colorName) {\r\n var _a, _b;\r\n const colors = theme.colors || {};\r\n switch (colorName) {\r\n case ColorName.CodeForeground:\r\n return (((_a = getGlobalSettings(theme)) === null || _a === void 0 ? void 0 : _a.foreground) ||\r\n getColor(theme, ColorName.EditorForeground));\r\n case ColorName.CodeBackground:\r\n return (((_b = getGlobalSettings(theme)) === null || _b === void 0 ? void 0 : _b.background) ||\r\n getColor(theme, ColorName.EditorBackground));\r\n case ColorName.EditorBackground:\r\n return (colors[\"editor.background\"] ||\r\n getDefault(theme, {\r\n light: \"#fffffe\",\r\n dark: \"#1E1E1E\",\r\n hc: \"#000000\",\r\n }));\r\n case ColorName.EditorForeground:\r\n return (colors[\"editor.foreground\"] ||\r\n getDefault(theme, {\r\n light: \"#333333\",\r\n dark: \"#BBBBBB\",\r\n hc: \"#fffffe\",\r\n }));\r\n case ColorName.FocusBorder:\r\n return (colors[\"focusBorder\"] ||\r\n getDefault(theme, {\r\n light: \"#0090F1\",\r\n dark: \"#007FD4\",\r\n hc: contrastBorder,\r\n }));\r\n case ColorName.ActiveTabBackground:\r\n return (colors[\"tab.activeBackground\"] ||\r\n getColor(theme, ColorName.EditorBackground));\r\n case ColorName.ActiveTabForeground:\r\n return (colors[\"tab.activeForeground\"] ||\r\n getDefault(theme, {\r\n dark: \"#ffffff\",\r\n light: \"#333333\",\r\n hc: \"#ffffff\",\r\n }));\r\n case ColorName.InactiveTabBackground:\r\n return (colors[\"tab.inactiveBackground\"] ||\r\n getDefault(theme, {\r\n dark: \"#2D2D2D\",\r\n light: \"#ECECEC\",\r\n hc: undefined,\r\n }));\r\n case ColorName.InactiveTabForeground:\r\n return (colors[\"tab.inactiveForeground\"] ||\r\n getDefault(theme, {\r\n dark: transparent(getColor(theme, ColorName.ActiveTabForeground), 0.5),\r\n light: transparent(getColor(theme, ColorName.ActiveTabForeground), 0.7),\r\n hc: \"#ffffff\",\r\n }));\r\n case ColorName.TabBorder:\r\n return (colors[\"tab.border\"] ||\r\n getDefault(theme, {\r\n dark: \"#252526\",\r\n light: \"#F3F3F3\",\r\n hc: contrastBorder,\r\n }));\r\n case ColorName.ActiveTabBottomBorder:\r\n return (colors[\"tab.activeBorder\"] ||\r\n getColor(theme, ColorName.ActiveTabBackground));\r\n case ColorName.EditorGroupBorder:\r\n return (colors[\"editorGroup.border\"] ||\r\n getDefault(theme, {\r\n dark: \"#444444\",\r\n light: \"#E7E7E7\",\r\n hc: contrastBorder,\r\n }));\r\n case ColorName.EditorGroupHeaderBackground:\r\n return (colors[\"editorGroupHeader.tabsBackground\"] ||\r\n getDefault(theme, {\r\n dark: \"#252526\",\r\n light: \"#F3F3F3\",\r\n hc: undefined,\r\n }));\r\n case ColorName.LineNumberForeground:\r\n return (colors[\"editorLineNumber.foreground\"] ||\r\n getDefault(theme, {\r\n dark: \"#858585\",\r\n light: \"#237893\",\r\n hc: \"#fffffe\",\r\n }));\r\n case ColorName.InputBackground:\r\n return (colors[\"input.background\"] ||\r\n getDefault(theme, {\r\n dark: \"#3C3C3C\",\r\n light: \"#fffffe\",\r\n hc: \"#000000\",\r\n }));\r\n case ColorName.InputForeground:\r\n return (colors[\"input.foreground\"] ||\r\n getColor(theme, ColorName.EditorForeground));\r\n case ColorName.InputBorder:\r\n return (colors[\"input.border\"] ||\r\n getDefault(theme, {\r\n dark: undefined,\r\n light: undefined,\r\n hc: contrastBorder,\r\n }));\r\n case ColorName.SelectionBackground:\r\n return (colors[\"editor.selectionBackground\"] ||\r\n getDefault(theme, {\r\n light: \"#ADD6FF\",\r\n dark: \"#264F78\",\r\n hc: \"#f3f518\",\r\n }));\r\n case ColorName.IconForeground:\r\n return (colors[\"icon.foreground\"] ||\r\n getDefault(theme, {\r\n dark: \"#C5C5C5\",\r\n light: \"#424242\",\r\n hc: \"#FFFFFF\",\r\n }));\r\n case ColorName.SideBarBackground:\r\n return (colors[\"sideBar.background\"] ||\r\n getDefault(theme, {\r\n dark: \"#252526\",\r\n light: \"#F3F3F3\",\r\n hc: \"#000000\",\r\n }));\r\n case ColorName.SideBarForeground:\r\n return (colors[\"sideBar.foreground\"] ||\r\n getColor(theme, ColorName.EditorForeground));\r\n case ColorName.SideBarBorder:\r\n return (colors[\"sideBar.border\"] ||\r\n getColor(theme, ColorName.SideBarBackground));\r\n case ColorName.ListActiveSelectionBackground:\r\n return (colors[\"list.activeSelectionBackground\"] ||\r\n getDefault(theme, {\r\n dark: \"#094771\",\r\n light: \"#0060C0\",\r\n hc: \"#000000\",\r\n }));\r\n case ColorName.ListActiveSelectionForeground:\r\n return (colors[\"list.activeSelectionForeground\"] ||\r\n getDefault(theme, {\r\n dark: \"#fffffe\",\r\n light: \"#fffffe\",\r\n hc: \"#fffffe\",\r\n }));\r\n case ColorName.ListHoverBackground:\r\n return (colors[\"list.hoverBackground\"] ||\r\n getDefault(theme, {\r\n dark: \"#2A2D2E\",\r\n light: \"#F0F0F0\",\r\n hc: undefined,\r\n }));\r\n case ColorName.ListHoverForeground:\r\n return colors[\"list.hoverForeground\"] || undefined;\r\n case ColorName.LineHighlightBackground:\r\n return (colors[\"editor.lineHighlightBackground\"] ||\r\n getDefault(theme, {\r\n dark: undefined,\r\n light: undefined,\r\n hc: undefined,\r\n }));\r\n case ColorName.RangeHighlightBackground:\r\n return (colors[\"editor.rangeHighlightBackground\"] ||\r\n getDefault(theme, {\r\n dark: \"#ffffff0b\",\r\n light: \"#fdff0033\",\r\n hc: undefined,\r\n }));\r\n case ColorName.EditorInfoForeground:\r\n return (colors[\"editor.infoForeground\"] ||\r\n getDefault(theme, {\r\n dark: \"#3794FF\",\r\n light: \"#1a85ff\",\r\n hc: \"#3794FF\",\r\n }));\r\n default:\r\n return \"#f00\";\r\n }\r\n}\r\nfunction getColorScheme(theme) {\r\n const themeType = getThemeType(theme);\r\n if (themeType === \"dark\") {\r\n return \"dark\";\r\n }\r\n else if (themeType === \"light\") {\r\n return \"light\";\r\n }\r\n return undefined;\r\n}\r\nfunction getDefault(theme, defaults) {\r\n return defaults[getThemeType(theme)];\r\n}\r\nfunction getThemeType(theme) {\r\n var _a;\r\n return (theme.type\r\n ? theme.type\r\n : ((_a = theme.name) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(\"light\"))\r\n ? \"light\"\r\n : \"dark\");\r\n}\r\nfunction getCodeColors(theme) {\r\n return {\r\n fg: getColor(theme, ColorName.CodeForeground),\r\n bg: getColor(theme, ColorName.CodeBackground),\r\n };\r\n}\r\nfunction getGlobalSettings(theme) {\r\n let settings = theme.settings\r\n ? theme.settings\r\n : theme.tokenColors;\r\n const globalSetting = settings\r\n ? settings.find(s => {\r\n return !s.name && !s.scope;\r\n })\r\n : undefined;\r\n return globalSetting === null || globalSetting === void 0 ? void 0 : globalSetting.settings;\r\n}\n\nconst useLayoutEffect$4 = typeof window !== \"undefined\"\r\n ? React.useLayoutEffect\r\n : React.useEffect;\r\n// for debugging:\r\n// export const useLayoutEffect = (\r\n// effect: any,\r\n// deps?: any\r\n// ) => {}\r\n// from https://overreacted.io/making-setinterval-declarative-with-react-hooks/\r\nfunction useInterval(callback, delay) {\r\n const savedCallback = React.useRef(callback);\r\n React.useEffect(() => {\r\n savedCallback.current = callback;\r\n }, [callback]);\r\n React.useEffect(() => {\r\n if (!delay && delay !== 0) {\r\n return undefined;\r\n }\r\n const id = setInterval(() => savedCallback.current(), delay);\r\n return () => clearInterval(id);\r\n }, [delay]);\r\n}\n\nfunction clamp$2(x, min, max) {\r\n return Math.min(Math.max(x, min), max);\r\n}\n\nconst DEFAULT_WIDTH = 200;\r\n// type DimensionsResult = {\r\n// width: number\r\n// height: number\r\n// lineWidths: { prev: number; next: number }\r\n// lineHeight: number\r\n// colWidth: number\r\n// }\r\nfunction useDimensions(code, focus, minColumns, lineNumbers, rows, deps) {\r\n const [dimensions, setDimensions] = React.useState(null);\r\n const windowWidth = useWindowWidth();\r\n const prevLineRef = React.useRef(null);\r\n const { prevLongestLine, nextLongestLine, element } = React.useMemo(() => {\r\n const prevLongestLine = getLongestLine(code.prev, focus.prev);\r\n const nextLongestLine = getLongestLine(code.next, focus.next);\r\n const lines = (code.prev || code.next)\r\n .trimEnd()\r\n .split(newlineRe);\r\n const originalLineCount = lines.length;\r\n if (rows) {\r\n // make the lines match the requested number of rows\r\n const heightInLines = rows === \"focus\"\r\n ? focusHeightInLines(focus, lines)\r\n : rows;\r\n let i = lines.length;\r\n while (i < heightInLines) {\r\n lines.push(\"\");\r\n i++;\r\n }\r\n // remove extra lines to match the requested rows\r\n while (i > heightInLines) {\r\n lines.pop();\r\n i--;\r\n }\r\n // if we removed prevLongestLine, add it back\r\n if (prevLongestLine &&\r\n !lines.includes(prevLongestLine)) {\r\n lines[lines.length - 1] = prevLongestLine;\r\n }\r\n }\r\n // avod setting the ref more than once https://github.com/code-hike/codehike/issues/232\r\n let prevLineRefSet = false;\r\n const element = (React.createElement(\"code\", { className: \"ch-code-scroll-parent\" },\r\n React.createElement(\"br\", null),\r\n lines.map((line, i) => {\r\n const ref = !prevLineRefSet && line === prevLongestLine\r\n ? prevLineRef\r\n : undefined;\r\n prevLineRefSet = prevLineRefSet || ref != null;\r\n return (React.createElement(\"div\", { ref: ref, key: i },\r\n lineNumbers ? (React.createElement(\"span\", { className: \"ch-code-line-number\" },\r\n \"_\",\r\n originalLineCount)) : undefined,\r\n React.createElement(\"div\", { style: {\r\n display: \"inline-block\",\r\n // leftPad\r\n marginLeft: 16,\r\n } },\r\n React.createElement(\"span\", null, line))));\r\n }),\r\n React.createElement(\"br\", null)));\r\n return { prevLongestLine, nextLongestLine, element };\r\n }, [code]);\r\n const allDeps = [\r\n ...deps,\r\n windowWidth,\r\n prevLongestLine,\r\n nextLongestLine,\r\n minColumns,\r\n ];\r\n useLayoutEffect$4(() => {\r\n var _a;\r\n if (prevLineRef.current) {\r\n const pll = prevLineRef.current;\r\n const contentElement = pll === null || pll === void 0 ? void 0 : pll.parentElement;\r\n const codeElement = contentElement.parentElement;\r\n // TODO is it clientWidth or clientRect?\r\n const lineContentDiv = pll === null || pll === void 0 ? void 0 : pll.querySelector(\":scope > div\");\r\n const lineNumberSpan = pll === null || pll === void 0 ? void 0 : pll.querySelector(\":scope > span\");\r\n const lnw = lineNumberSpan\r\n ? getWidthWithPadding(lineNumberSpan)\r\n : 0;\r\n const plw = getWidthWithoutPadding(lineContentDiv);\r\n const colWidth = plw / prevLongestLine.length || 1;\r\n const nlw = nextLongestLine.length * colWidth;\r\n const lineHeight = (_a = getHeightWithoutPadding(lineContentDiv)) !== null && _a !== void 0 ? _a : 20;\r\n const d = {\r\n containerWidth: getWidthWithoutPadding(codeElement.parentElement),\r\n containerHeight: getHeightWithoutPadding(codeElement.parentElement),\r\n contentWidth: getWidthWithoutPadding(contentElement.parentElement),\r\n contentHeight: getHeightWithoutPadding(contentElement.parentElement),\r\n lineWidths: [\r\n plw || nlw || DEFAULT_WIDTH,\r\n nlw || plw || DEFAULT_WIDTH,\r\n ],\r\n lineWidth: [\r\n Math.max(plw || nlw || DEFAULT_WIDTH, colWidth * minColumns),\r\n Math.max(nlw || plw || DEFAULT_WIDTH, colWidth * minColumns),\r\n ],\r\n lineHeight,\r\n colWidth,\r\n lineNumberWidth: lnw,\r\n deps: allDeps,\r\n };\r\n setDimensions(d);\r\n }\r\n }, allDeps);\r\n if (!dimensions ||\r\n depsChanged(dimensions.deps, allDeps)) {\r\n return { element, dimensions: null };\r\n }\r\n else {\r\n return { element, dimensions };\r\n }\r\n}\r\nconst newlineRe = /\\r\\n|\\r|\\n/;\r\nfunction getLongestLine(code, focus) {\r\n const lines = code ? code.split(newlineRe) : [\"\"];\r\n const focusIndexes = getFocusIndexes(focus, lines);\r\n let longestLine = \"\";\r\n lines.forEach((line, index) => {\r\n if (focusIndexes.includes(index) &&\r\n line.length > longestLine.length) {\r\n longestLine = line;\r\n }\r\n });\r\n return longestLine;\r\n}\r\nfunction getWidthWithoutPadding(element) {\r\n const computedStyle = getComputedStyle(element);\r\n return (parseFloat(computedStyle.width) -\r\n parseFloat(computedStyle.paddingLeft) -\r\n parseFloat(computedStyle.paddingRight));\r\n}\r\nfunction getWidthWithPadding(element) {\r\n const computedStyle = getComputedStyle(element);\r\n return parseFloat(computedStyle.width);\r\n}\r\nfunction getHeightWithoutPadding(element) {\r\n if (!element)\r\n return null;\r\n const computedStyle = getComputedStyle(element);\r\n return (parseFloat(computedStyle.height) -\r\n parseFloat(computedStyle.paddingTop) -\r\n parseFloat(computedStyle.paddingBottom));\r\n}\r\nfunction depsChanged(oldDeps, newDeps) {\r\n for (let i = 0; i < oldDeps.length; i++) {\r\n if (oldDeps[i] !== newDeps[i])\r\n return true;\r\n }\r\n return false;\r\n}\r\nfunction useWindowWidth() {\r\n const [width, setWidth] = React.useState(undefined);\r\n React.useEffect(() => {\r\n function handleResize() {\r\n setWidth(window.innerWidth);\r\n }\r\n window.addEventListener(\"resize\", handleResize);\r\n return () => window.removeEventListener(\"resize\", handleResize);\r\n }, []);\r\n return width;\r\n}\r\nfunction focusHeightInLines(focus, lines) {\r\n const [start, end] = getFocusExtremes(focus.prev, lines);\r\n return end - start + 1;\r\n}\n\nfunction Diff() {}\nDiff.prototype = {\n diff: function diff(oldString, newString) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var callback = options.callback;\n\n if (typeof options === 'function') {\n callback = options;\n options = {};\n }\n\n this.options = options;\n var self = this;\n\n function done(value) {\n if (callback) {\n setTimeout(function () {\n callback(undefined, value);\n }, 0);\n return true;\n } else {\n return value;\n }\n } // Allow subclasses to massage the input prior to running\n\n\n oldString = this.castInput(oldString);\n newString = this.castInput(newString);\n oldString = this.removeEmpty(this.tokenize(oldString));\n newString = this.removeEmpty(this.tokenize(newString));\n var newLen = newString.length,\n oldLen = oldString.length;\n var editLength = 1;\n var maxEditLength = newLen + oldLen;\n var bestPath = [{\n newPos: -1,\n components: []\n }]; // Seed editLength = 0, i.e. the content starts with the same values\n\n var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);\n\n if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {\n // Identity per the equality and tokenizer\n return done([{\n value: this.join(newString),\n count: newString.length\n }]);\n } // Main worker method. checks all permutations of a given edit length for acceptance.\n\n\n function execEditLength() {\n for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {\n var basePath = void 0;\n\n var addPath = bestPath[diagonalPath - 1],\n removePath = bestPath[diagonalPath + 1],\n _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;\n\n if (addPath) {\n // No one else is going to attempt to use this value, clear it\n bestPath[diagonalPath - 1] = undefined;\n }\n\n var canAdd = addPath && addPath.newPos + 1 < newLen,\n canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen;\n\n if (!canAdd && !canRemove) {\n // If this path is a terminal then prune\n bestPath[diagonalPath] = undefined;\n continue;\n } // Select the diagonal that we want to branch from. We select the prior\n // path whose position in the new string is the farthest from the origin\n // and does not pass the bounds of the diff graph\n\n\n if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {\n basePath = clonePath(removePath);\n self.pushComponent(basePath.components, undefined, true);\n } else {\n basePath = addPath; // No need to clone, we've pulled it from the list\n\n basePath.newPos++;\n self.pushComponent(basePath.components, true, undefined);\n }\n\n _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath); // If we have hit the end of both strings, then we are done\n\n if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {\n return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken));\n } else {\n // Otherwise track this path as a potential candidate and continue.\n bestPath[diagonalPath] = basePath;\n }\n }\n\n editLength++;\n } // Performs the length of edit iteration. Is a bit fugly as this has to support the\n // sync and async mode which is never fun. Loops over execEditLength until a value\n // is produced.\n\n\n if (callback) {\n (function exec() {\n setTimeout(function () {\n // This should not happen, but we want to be safe.\n\n /* istanbul ignore next */\n if (editLength > maxEditLength) {\n return callback();\n }\n\n if (!execEditLength()) {\n exec();\n }\n }, 0);\n })();\n } else {\n while (editLength <= maxEditLength) {\n var ret = execEditLength();\n\n if (ret) {\n return ret;\n }\n }\n }\n },\n pushComponent: function pushComponent(components, added, removed) {\n var last = components[components.length - 1];\n\n if (last && last.added === added && last.removed === removed) {\n // We need to clone here as the component clone operation is just\n // as shallow array clone\n components[components.length - 1] = {\n count: last.count + 1,\n added: added,\n removed: removed\n };\n } else {\n components.push({\n count: 1,\n added: added,\n removed: removed\n });\n }\n },\n extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {\n var newLen = newString.length,\n oldLen = oldString.length,\n newPos = basePath.newPos,\n oldPos = newPos - diagonalPath,\n commonCount = 0;\n\n while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {\n newPos++;\n oldPos++;\n commonCount++;\n }\n\n if (commonCount) {\n basePath.components.push({\n count: commonCount\n });\n }\n\n basePath.newPos = newPos;\n return oldPos;\n },\n equals: function equals(left, right) {\n if (this.options.comparator) {\n return this.options.comparator(left, right);\n } else {\n return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase();\n }\n },\n removeEmpty: function removeEmpty(array) {\n var ret = [];\n\n for (var i = 0; i < array.length; i++) {\n if (array[i]) {\n ret.push(array[i]);\n }\n }\n\n return ret;\n },\n castInput: function castInput(value) {\n return value;\n },\n tokenize: function tokenize(value) {\n return value.split('');\n },\n join: function join(chars) {\n return chars.join('');\n }\n};\n\nfunction buildValues(diff, components, newString, oldString, useLongestToken) {\n var componentPos = 0,\n componentLen = components.length,\n newPos = 0,\n oldPos = 0;\n\n for (; componentPos < componentLen; componentPos++) {\n var component = components[componentPos];\n\n if (!component.removed) {\n if (!component.added && useLongestToken) {\n var value = newString.slice(newPos, newPos + component.count);\n value = value.map(function (value, i) {\n var oldValue = oldString[oldPos + i];\n return oldValue.length > value.length ? oldValue : value;\n });\n component.value = diff.join(value);\n } else {\n component.value = diff.join(newString.slice(newPos, newPos + component.count));\n }\n\n newPos += component.count; // Common case\n\n if (!component.added) {\n oldPos += component.count;\n }\n } else {\n component.value = diff.join(oldString.slice(oldPos, oldPos + component.count));\n oldPos += component.count; // Reverse add and remove so removes are output first to match common convention\n // The diffing algorithm is tied to add then remove output and this is the simplest\n // route to get the desired output with minimal overhead.\n\n if (componentPos && components[componentPos - 1].added) {\n var tmp = components[componentPos - 1];\n components[componentPos - 1] = components[componentPos];\n components[componentPos] = tmp;\n }\n }\n } // Special case handle for when one terminal is ignored (i.e. whitespace).\n // For this case we merge the terminal into the prior string and drop the change.\n // This is only available for string mode.\n\n\n var lastComponent = components[componentLen - 1];\n\n if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) {\n components[componentLen - 2].value += lastComponent.value;\n components.pop();\n }\n\n return components;\n}\n\nfunction clonePath(path) {\n return {\n newPos: path.newPos,\n components: path.components.slice(0)\n };\n}\n\n//\n// Ranges and exceptions:\n// Latin-1 Supplement, 0080–00FF\n// - U+00D7 × Multiplication sign\n// - U+00F7 ÷ Division sign\n// Latin Extended-A, 0100–017F\n// Latin Extended-B, 0180–024F\n// IPA Extensions, 0250–02AF\n// Spacing Modifier Letters, 02B0–02FF\n// - U+02C7 ˇ ˇ Caron\n// - U+02D8 ˘ ˘ Breve\n// - U+02D9 ˙ ˙ Dot Above\n// - U+02DA ˚ ˚ Ring Above\n// - U+02DB ˛ ˛ Ogonek\n// - U+02DC ˜ ˜ Small Tilde\n// - U+02DD ˝ ˝ Double Acute Accent\n// Latin Extended Additional, 1E00–1EFF\n\nvar extendedWordChars = /^[A-Za-z\\xC0-\\u02C6\\u02C8-\\u02D7\\u02DE-\\u02FF\\u1E00-\\u1EFF]+$/;\nvar reWhitespace = /\\S/;\nvar wordDiff = new Diff();\n\nwordDiff.equals = function (left, right) {\n if (this.options.ignoreCase) {\n left = left.toLowerCase();\n right = right.toLowerCase();\n }\n\n return left === right || this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right);\n};\n\nwordDiff.tokenize = function (value) {\n var tokens = value.split(/(\\s+|[()[\\]{}'\"]|\\b)/); // Join the boundary splits that we do not consider to be boundaries. This is primarily the extended Latin character set.\n\n for (var i = 0; i < tokens.length - 1; i++) {\n // If we have an empty string in the next field and we have only word chars before and after, merge\n if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars.test(tokens[i]) && extendedWordChars.test(tokens[i + 2])) {\n tokens[i] += tokens[i + 2];\n tokens.splice(i + 1, 2);\n i--;\n }\n }\n\n return tokens;\n};\n\nvar lineDiff = new Diff();\n\nlineDiff.tokenize = function (value) {\n var retLines = [],\n linesAndNewlines = value.split(/(\\n|\\r\\n)/); // Ignore the final empty token that occurs if the string ends with a new line\n\n if (!linesAndNewlines[linesAndNewlines.length - 1]) {\n linesAndNewlines.pop();\n } // Merge the content and line separators into single tokens\n\n\n for (var i = 0; i < linesAndNewlines.length; i++) {\n var line = linesAndNewlines[i];\n\n if (i % 2 && !this.options.newlineIsToken) {\n retLines[retLines.length - 1] += line;\n } else {\n if (this.options.ignoreWhitespace) {\n line = line.trim();\n }\n\n retLines.push(line);\n }\n }\n\n return retLines;\n};\n\nfunction diffLines(oldStr, newStr, callback) {\n return lineDiff.diff(oldStr, newStr, callback);\n}\n\nvar sentenceDiff = new Diff();\n\nsentenceDiff.tokenize = function (value) {\n return value.split(/(\\S.+?[.!?])(?=\\s+|$)/);\n};\n\nvar cssDiff = new Diff();\n\ncssDiff.tokenize = function (value) {\n return value.split(/([{}:;,]|\\s+)/);\n};\n\nfunction _typeof(obj) {\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function (obj) {\n return typeof obj;\n };\n } else {\n _typeof = function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}\n\nvar objectPrototypeToString = Object.prototype.toString;\nvar jsonDiff = new Diff(); // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a\n// dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output:\n\njsonDiff.useLongestToken = true;\njsonDiff.tokenize = lineDiff.tokenize;\n\njsonDiff.castInput = function (value) {\n var _this$options = this.options,\n undefinedReplacement = _this$options.undefinedReplacement,\n _this$options$stringi = _this$options.stringifyReplacer,\n stringifyReplacer = _this$options$stringi === void 0 ? function (k, v) {\n return typeof v === 'undefined' ? undefinedReplacement : v;\n } : _this$options$stringi;\n return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, ' ');\n};\n\njsonDiff.equals = function (left, right) {\n return Diff.prototype.equals.call(jsonDiff, left.replace(/,([\\r\\n])/g, '$1'), right.replace(/,([\\r\\n])/g, '$1'));\n};\n// object that is already on the \"stack\" of items being processed. Accepts an optional replacer\n\nfunction canonicalize(obj, stack, replacementStack, replacer, key) {\n stack = stack || [];\n replacementStack = replacementStack || [];\n\n if (replacer) {\n obj = replacer(key, obj);\n }\n\n var i;\n\n for (i = 0; i < stack.length; i += 1) {\n if (stack[i] === obj) {\n return replacementStack[i];\n }\n }\n\n var canonicalizedObj;\n\n if ('[object Array]' === objectPrototypeToString.call(obj)) {\n stack.push(obj);\n canonicalizedObj = new Array(obj.length);\n replacementStack.push(canonicalizedObj);\n\n for (i = 0; i < obj.length; i += 1) {\n canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key);\n }\n\n stack.pop();\n replacementStack.pop();\n return canonicalizedObj;\n }\n\n if (obj && obj.toJSON) {\n obj = obj.toJSON();\n }\n\n if (_typeof(obj) === 'object' && obj !== null) {\n stack.push(obj);\n canonicalizedObj = {};\n replacementStack.push(canonicalizedObj);\n\n var sortedKeys = [],\n _key;\n\n for (_key in obj) {\n /* istanbul ignore else */\n if (obj.hasOwnProperty(_key)) {\n sortedKeys.push(_key);\n }\n }\n\n sortedKeys.sort();\n\n for (i = 0; i < sortedKeys.length; i += 1) {\n _key = sortedKeys[i];\n canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key);\n }\n\n stack.pop();\n replacementStack.pop();\n } else {\n canonicalizedObj = obj;\n }\n\n return canonicalizedObj;\n}\n\nvar arrayDiff = new Diff();\n\narrayDiff.tokenize = function (value) {\n return value.slice();\n};\n\narrayDiff.join = arrayDiff.removeEmpty = function (value) {\n return value;\n};\n\nfunction mergeLines(code, lines) {\r\n let enterIndex = 0;\r\n let exitIndex = 0;\r\n const indexes = diff(code);\r\n const newLines = indexes.map(index => {\r\n if (index.next === undefined) {\r\n return Object.assign(Object.assign({}, lines.prev[index.prev]), { lineNumber: {\r\n prev: index.prev + 1,\r\n }, move: \"exit\", enterIndex: null, exitIndex: exitIndex++ });\r\n }\r\n if (index.prev === undefined) {\r\n return Object.assign(Object.assign({}, lines.next[index.next]), { lineNumber: {\r\n next: index.next + 1,\r\n }, move: \"enter\", enterIndex: enterIndex++, exitIndex: null });\r\n }\r\n return Object.assign(Object.assign({}, lines.prev[index.prev]), { lineNumber: {\r\n prev: index.prev + 1,\r\n next: index.next + 1,\r\n }, move: \"stay\", enterIndex: null, exitIndex: null });\r\n });\r\n return {\r\n lines: newLines,\r\n enterCount: enterIndex,\r\n exitCount: exitIndex,\r\n };\r\n}\r\n/**\r\n * Returns a list of pairs of line indexes:\r\n *\r\n * For example if lines 2 and 3 were removed\r\n * and two lines where added at the end:\r\n * 0 0\r\n * 1 -\r\n * 2 -\r\n * 3 1\r\n * - 2\r\n * - 3\r\n */\r\nfunction diff(code) {\r\n const changes = diffLines(code.prev, code.next);\r\n let indexes = [];\r\n let prevIndex = 0;\r\n let nextIndex = 0;\r\n changes.forEach(change => {\r\n if (change.added) {\r\n for (let i = 0; i < change.count; i++) {\r\n indexes.push({ next: nextIndex++ });\r\n }\r\n }\r\n else if (change.removed) {\r\n for (let i = 0; i < change.count; i++) {\r\n indexes.push({ prev: prevIndex++ });\r\n }\r\n }\r\n else {\r\n for (let i = 0; i < change.count; i++) {\r\n indexes.push({\r\n prev: prevIndex++,\r\n next: nextIndex++,\r\n });\r\n }\r\n }\r\n });\r\n return indexes;\r\n}\n\nfunction splitByFocus(mergedCode, focus, annotations) {\r\n const { lines } = mergedCode, mergedCodeRest = __rest(mergedCode, [\"lines\"]);\r\n const focusByLineNumber = map(focus, (focus, key) => {\r\n // we need to filter the lines that don't belong to the step\r\n // for the case where focus == \"\"\r\n const stepLines = key === \"prev\"\r\n ? lines.filter(l => l.move !== \"enter\")\r\n : lines.filter(l => l.move !== \"exit\");\r\n return mapFocusToLineNumbers(focus, stepLines);\r\n });\r\n const splittedLines = lines.map(line => {\r\n const { tokens } = line, rest = __rest(line, [\"tokens\"]);\r\n const lineFocus = {\r\n prev: line.lineNumber.prev\r\n ? focusByLineNumber.prev[line.lineNumber.prev]\r\n : false,\r\n next: line.lineNumber.next\r\n ? focusByLineNumber.next[line.lineNumber.next]\r\n : false,\r\n };\r\n const lineAnnotations = {\r\n prev: line.lineNumber.prev\r\n ? annotations.prev[line.lineNumber.prev] || []\r\n : [],\r\n next: line.lineNumber.next\r\n ? annotations.next[line.lineNumber.next] || []\r\n : [],\r\n };\r\n return Object.assign({ focused: map(lineFocus, focus => !!focus), groups: getTokenGroups(tokens, lineFocus, lineAnnotations) }, rest);\r\n });\r\n const focusedLineNumbers = map(focusByLineNumber, focusByLineNumber => Object.keys(focusByLineNumber).map(k => Number(k)));\r\n const firstFocusedLineNumber = map(focusedLineNumbers, focusedLineNumbers => Math.min(...focusedLineNumbers));\r\n const lastFocusedLineNumber = map(focusedLineNumbers, focusedLineNumbers => Math.max(...focusedLineNumbers));\r\n return Object.assign({ lines: splittedLines, firstFocusedLineNumber,\r\n lastFocusedLineNumber }, mergedCodeRest);\r\n}\r\n/**\r\n * Get the least amount of groups where no consecutive groups have\r\n * the same combination of prevFocus, nextFocus, prevAnnotation, nextAnnotation.\r\n */\r\nfunction getTokenGroups(tokens, focus, annotations) {\r\n const focusExtremes = map(focus, focus => Array.isArray(focus) ? focus : []);\r\n const annotationExtremes = map(annotations, annotations => annotations.map(({ columnNumbers }) => columnNumbers));\r\n const allExtremes = [\r\n ...focusExtremes.prev,\r\n ...focusExtremes.next,\r\n ...annotationExtremes.prev,\r\n ...annotationExtremes.next,\r\n ];\r\n const splittedTokens = splitTokens(tokens, allExtremes);\r\n let startIndex = 0;\r\n let currentGroup = null;\r\n const groups = [];\r\n splittedTokens.forEach(token => {\r\n const newPrevFocus = isIn(startIndex, focus.prev);\r\n const newNextFocus = isIn(startIndex, focus.next);\r\n const newPrevAnnotation = getAnnotation(startIndex, annotations.prev);\r\n const newNextAnnotation = getAnnotation(startIndex, annotations.next);\r\n if (!currentGroup ||\r\n currentGroup.focused.prev !== newPrevFocus ||\r\n currentGroup.focused.next !== newNextFocus ||\r\n currentGroup.annotation.prev !== newPrevAnnotation ||\r\n currentGroup.annotation.next !== newNextAnnotation) {\r\n currentGroup = {\r\n focused: {\r\n prev: newPrevFocus,\r\n next: newNextFocus,\r\n },\r\n tokens: [],\r\n annotation: {\r\n prev: newPrevAnnotation,\r\n next: newNextAnnotation,\r\n },\r\n };\r\n groups.push(currentGroup);\r\n }\r\n currentGroup === null || currentGroup === void 0 ? void 0 : currentGroup.tokens.push(token);\r\n startIndex += token.content.length;\r\n });\r\n return groups.map(group => ({\r\n focused: group.focused,\r\n tokens: group.tokens,\r\n element: getGroupElement(group),\r\n }));\r\n}\r\nfunction getGroupElement(group) {\r\n return (React.createElement(React.Fragment, null, group.tokens.map(({ content, props }, i) => (React.createElement(\"span\", Object.assign({}, props, { key: i + 1 }), content)))));\r\n}\r\n/**\r\n * Split a list of tokens into a more fine-graned list of tokens\r\n *\r\n * tokens: [abc][defg]\r\n * extremes: [1:2,2:5]\r\n * result tokens: [ab][c][de][fg]\r\n *\r\n */\r\nfunction splitTokens(tokens, extremes) {\r\n const splitIndexes = [\r\n ...extremes.map(e => e.start - 1),\r\n ...extremes.map(e => e.end),\r\n ];\r\n let oldTokens = tokens;\r\n splitIndexes.forEach(splitIndex => {\r\n const newTokens = [];\r\n let i = 0;\r\n oldTokens.forEach(token => {\r\n const startIndex = i;\r\n const endIndex = i + token.content.length;\r\n const shouldSplit = startIndex < splitIndex && splitIndex < endIndex;\r\n if (shouldSplit) {\r\n const sliceIndex = splitIndex - startIndex;\r\n const content0 = token.content.slice(0, sliceIndex);\r\n const content1 = token.content.slice(sliceIndex);\r\n newTokens.push(Object.assign(Object.assign({}, token), { content: content0 }));\r\n newTokens.push(Object.assign(Object.assign({}, token), { content: content1 }));\r\n }\r\n else {\r\n newTokens.push(token);\r\n }\r\n i = endIndex;\r\n });\r\n oldTokens = newTokens;\r\n });\r\n return oldTokens;\r\n}\r\nfunction isIn(index, intervals) {\r\n if (!Array.isArray(intervals)) {\r\n return intervals;\r\n }\r\n return intervals.some(({ start, end }) => start - 1 <= index && index < end);\r\n}\r\nfunction getAnnotation(index, annotations) {\r\n return annotations.find(({ columnNumbers }) => columnNumbers.start - 1 <= index &&\r\n index < columnNumbers.end);\r\n}\n\nfunction tween$1(params, t) {\r\n // needs === true for typescript...\r\n if (params.fixed === true) {\r\n return params.value;\r\n }\r\n else {\r\n const [start, end] = params.interval;\r\n const [from, to] = params.extremes;\r\n if (t < start)\r\n return from;\r\n if (t > end)\r\n return to;\r\n const x = (t - start) / (end - start);\r\n const ease = params.ease || easing.linear;\r\n return from + ease(x) * (to - from);\r\n }\r\n}\r\nfunction stagger([start, end], index, count) {\r\n if (count <= 1)\r\n return [start, end];\r\n const totalDuration = end - start;\r\n const stepDuration = totalDuration / Math.pow(count, 1 / 8);\r\n const tick = (totalDuration - stepDuration) / (count - 1);\r\n const stepStart = start + tick * index;\r\n const stepEnd = stepStart + stepDuration;\r\n return [stepStart, stepEnd];\r\n}\r\nconst easing = {\r\n linear: function (t) {\r\n return t;\r\n },\r\n easeInQuad: function (t) {\r\n return t * t;\r\n },\r\n easeOutQuad: function (t) {\r\n return t * (2 - t);\r\n },\r\n easeInOutCubic: function (t) {\r\n return t < 0.5\r\n ? 4 * t * t * t\r\n : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1;\r\n },\r\n};\n\nfunction getLinesWithElements(lines, verticalInterval, enterCount, exitCount) {\r\n // startY is the progress when we start moving vertically\r\n // endY is when we stop\r\n const [startY, endY] = verticalInterval;\r\n return lines.map(line => {\r\n const lineIndex = map(line.lineNumber, ln => ln && ln - 1);\r\n const { enterIndex, exitIndex } = line;\r\n const tweenY = line.move === \"exit\"\r\n ? { fixed: true, value: lineIndex.prev }\r\n : line.move === \"enter\"\r\n ? { fixed: true, value: lineIndex.next }\r\n : {\r\n fixed: false,\r\n extremes: [lineIndex.prev, lineIndex.next],\r\n interval: [startY, endY],\r\n ease: easing.easeInOutCubic,\r\n };\r\n const tweenX = line.move === \"exit\"\r\n ? {\r\n fixed: false,\r\n extremes: [0, -1],\r\n ease: easing.easeInQuad,\r\n interval: stagger([0, startY], exitIndex, exitCount),\r\n }\r\n : line.move === \"enter\"\r\n ? {\r\n fixed: false,\r\n extremes: [1, 0],\r\n ease: easing.easeOutQuad,\r\n interval: stagger([endY, 1], enterIndex, enterCount),\r\n }\r\n : { fixed: true, value: 0 };\r\n return Object.assign(Object.assign({}, line), { tweenX,\r\n tweenY });\r\n });\r\n}\n\nfunction parseAnnotations(annotations, theme) {\r\n // split annotations with multiple parts in the focus string\r\n // \"1:2,3[4:5]\" becomes two annotations \"1:2\" and \"3[4:5]\"\r\n const expandedAnnotations = mapWithDefault(annotations, [], annotations => annotations.flatMap(annotation => splitParts(annotation.focus).map(part => (Object.assign(Object.assign({}, annotation), { focus: part })))));\r\n const inlineCodeAnnotations = mapWithDefault(expandedAnnotations, [], annotations => annotations.filter(isInline));\r\n const multilineCodeAnnotations = mapWithDefault(expandedAnnotations, [], annotations => annotations.filter(a => !isInline(a)));\r\n return {\r\n inlineAnnotations: map(inlineCodeAnnotations, annotations => parseInlineAnnotations(annotations, theme)),\r\n multilineAnnotations: map(multilineCodeAnnotations, annotations => parseMultilineAnnotations(annotations, theme)),\r\n };\r\n}\r\nfunction isInline(annotation) {\r\n return hasColumns(annotation.focus);\r\n}\r\nfunction parseInlineAnnotations(annotations, theme) {\r\n const annotationMap = {};\r\n annotations.forEach(annotation => {\r\n const focusMap = parsePartToObject(annotation.focus);\r\n const lineNumber = +Object.keys(focusMap)[0];\r\n const columnNumbersList = focusMap[lineNumber];\r\n const lineAnnotations = annotationMap[lineNumber] || [];\r\n lineAnnotations.push({\r\n columnNumbers: columnNumbersList[0],\r\n data: annotation.data,\r\n theme: theme,\r\n Component: annotation.Component ||\r\n defaultInlineComponent(),\r\n });\r\n annotationMap[lineNumber] = lineAnnotations;\r\n });\r\n return annotationMap;\r\n}\r\nfunction defaultInlineComponent(annotation, theme) {\r\n return ({ children }) => (React.createElement(\"span\", { style: { outline: \"red 1px solid\" } }, children));\r\n}\r\nfunction parseMultilineAnnotations(annotations, theme) {\r\n return annotations.map(annotation => {\r\n return {\r\n lineNumbers: parseExtremes(annotation.focus),\r\n data: annotation.data,\r\n theme: theme,\r\n Component: annotation.Component ||\r\n defaultMultilineComponent(annotation, theme),\r\n };\r\n });\r\n}\r\nfunction defaultMultilineComponent(annotation, theme) {\r\n // TODO handle missing bg\r\n const bg = (theme.colors[\"editor.lineHighlightBackground\"] ||\r\n theme.colors[\"editor.selectionHighlightBackground\"]);\r\n return ({ children, style }) => (React.createElement(\"div\", { style: Object.assign(Object.assign({}, style), { background: bg, cursor: \"pointer\" }), onClick: _ => alert(\"clicked\"), className: \"ch-code-bg-annotation\" },\r\n React.createElement(\"span\", { className: \"ch-code-bg-annotation-border\", style: {\r\n background: \"#00a2d3\",\r\n width: \"3px\",\r\n height: \"100%\",\r\n position: \"absolute\",\r\n left: 0,\r\n } }),\r\n children));\r\n}\r\n// --- multiline\r\nfunction annotateMultiline(lines, annotations) {\r\n return {\r\n prev: annotateMultilineSide(lines, annotations.prev, line => line.lineNumber.prev),\r\n next: annotateMultilineSide(lines, annotations.next, line => line.lineNumber.next),\r\n };\r\n}\r\nfunction annotateMultilineSide(lines, ogAnnotations, getLineNumber) {\r\n const annotations = [...ogAnnotations];\r\n annotations.sort((a, b) => a.lineNumbers.start - b.lineNumbers.start);\r\n let lineIndex = 0;\r\n const groups = [];\r\n while (lineIndex < lines.length) {\r\n const annotation = annotations[0];\r\n let line = lines[lineIndex];\r\n if (annotation &&\r\n getLineNumber(line) > annotation.lineNumbers.start) {\r\n throw \"Code Hike can't handle two annotations for the same line\";\r\n }\r\n if (annotation &&\r\n getLineNumber(line) === annotation.lineNumbers.start) {\r\n // create annotation group\r\n const group = {\r\n lines: [],\r\n annotation,\r\n };\r\n while (line &&\r\n (!getLineNumber(line) ||\r\n getLineNumber(line) <=\r\n annotation.lineNumbers.end)) {\r\n group.lines.push(line);\r\n line = lines[++lineIndex];\r\n }\r\n groups.push(group);\r\n annotations.shift();\r\n }\r\n else if (!annotation) {\r\n // create unannotated group until the end\r\n groups.push({ lines: lines.slice(lineIndex) });\r\n lineIndex = lines.length;\r\n }\r\n else {\r\n // create unannotated group until next annotation\r\n const group = {\r\n lines: [],\r\n };\r\n while (line &&\r\n (!getLineNumber(line) ||\r\n getLineNumber(line) <\r\n annotation.lineNumbers.start)) {\r\n group.lines.push(line);\r\n line = lines[++lineIndex];\r\n }\r\n groups.push(group);\r\n }\r\n }\r\n return groups;\r\n}\r\n// --- inline\r\nfunction annotateInline(lines, inlineAnnotations) {\r\n return lines.map((_a) => {\r\n var { groups } = _a, line = __rest(_a, [\"groups\"]);\r\n const { lineNumber } = line;\r\n const annotations = {\r\n prev: lineNumber.prev\r\n ? inlineAnnotations.prev[lineNumber.prev] || []\r\n : [],\r\n next: lineNumber.next\r\n ? inlineAnnotations.next[lineNumber.next] || []\r\n : [],\r\n };\r\n return Object.assign(Object.assign({}, line), { annotatedGroups: annotateLineTokenGroups(groups, annotations) });\r\n });\r\n}\r\n/**\r\n * Generate a list of annotated groups tweens\r\n * each annotated group contains a list of token groups and maybe an annotation.\r\n * The two annotated groups in a tween doesn't need to have the same token groups.\r\n */\r\nfunction annotateLineTokenGroups(tokenGroups, annotations) {\r\n let prevTokenGroups = [...tokenGroups];\r\n let nextTokenGroups = [...tokenGroups];\r\n const prevAnnotations = [...annotations.prev];\r\n const nextAnnotations = [...annotations.next];\r\n const annotatedGroups = [];\r\n let prevColumn = 1;\r\n let nextColumn = 1;\r\n // iterate until we consume both lists of token groups\r\n while (prevTokenGroups.length > 0 ||\r\n nextTokenGroups.length > 0) {\r\n const prevAnnotation = prevAnnotations[0];\r\n const nextAnnotation = nextAnnotations[0];\r\n const isPrevAnnotationStarting = prevAnnotation &&\r\n prevAnnotation.columnNumbers.start === prevColumn;\r\n const isNextAnnotationStarting = nextAnnotation &&\r\n nextAnnotation.columnNumbers.start === nextColumn;\r\n if (prevColumn < nextColumn) {\r\n // if the prev list is behind we consume from prevTokenGroups\r\n if (isPrevAnnotationStarting) {\r\n // if there is an annotation starting at this point we consume until the annotation ends\r\n const end = prevAnnotation.columnNumbers.end + 1;\r\n annotatedGroups.push({\r\n prev: {\r\n annotation: prevAnnotation,\r\n groups: shiftGroups(prevTokenGroups, prevColumn, end),\r\n },\r\n });\r\n prevColumn = end;\r\n prevAnnotations.shift();\r\n }\r\n else {\r\n // if there isn't we consume until we sync with the next list or an annotation starts\r\n const end = Math.min(nextColumn, (prevAnnotation === null || prevAnnotation === void 0 ? void 0 : prevAnnotation.columnNumbers.start) || nextColumn);\r\n annotatedGroups.push({\r\n prev: {\r\n groups: shiftGroups(prevTokenGroups, prevColumn, end),\r\n },\r\n });\r\n prevColumn = end;\r\n }\r\n }\r\n else if (prevColumn > nextColumn) {\r\n // if the next list is behind we consume from nextTokenGroups\r\n if (isNextAnnotationStarting) {\r\n // if there is an annotation starting at this point we consume until the annotation ends\r\n const end = nextAnnotation.columnNumbers.end + 1;\r\n annotatedGroups.push({\r\n next: {\r\n annotation: nextAnnotation,\r\n groups: shiftGroups(nextTokenGroups, nextColumn, end),\r\n },\r\n });\r\n nextColumn = end;\r\n nextAnnotations.shift();\r\n }\r\n else {\r\n // if there isn't we consume until we sync with the prev list or an annotation starts\r\n const end = Math.min(prevColumn, (nextAnnotation === null || nextAnnotation === void 0 ? void 0 : nextAnnotation.columnNumbers.start) || prevColumn);\r\n annotatedGroups.push({\r\n next: {\r\n groups: shiftGroups(nextTokenGroups, nextColumn, end),\r\n },\r\n });\r\n nextColumn = end;\r\n }\r\n }\r\n else if (prevColumn == nextColumn) {\r\n // if we are at the same column in both lists we have 5 different cases\r\n if (isPrevAnnotationStarting &&\r\n isNextAnnotationStarting &&\r\n prevAnnotation.columnNumbers.end ===\r\n nextAnnotation.columnNumbers.end) {\r\n // both annotations starts here and end at the same place, so we puth both in one tween annotated group\r\n const end = nextAnnotation.columnNumbers.end + 1;\r\n annotatedGroups.push({\r\n prev: {\r\n annotation: prevAnnotation,\r\n groups: shiftGroups(prevTokenGroups, prevColumn, end),\r\n },\r\n next: {\r\n annotation: nextAnnotation,\r\n groups: shiftGroups(nextTokenGroups, nextColumn, end),\r\n },\r\n });\r\n prevColumn = end;\r\n nextColumn = end;\r\n prevAnnotations.shift();\r\n nextAnnotations.shift();\r\n }\r\n else if (isPrevAnnotationStarting) {\r\n // if only the prev annotation starting at this point we consume until the annotation ends\r\n const end = prevAnnotation.columnNumbers.end + 1;\r\n annotatedGroups.push({\r\n prev: {\r\n annotation: prevAnnotation,\r\n groups: shiftGroups(prevTokenGroups, prevColumn, end),\r\n },\r\n });\r\n prevColumn = end;\r\n prevAnnotations.shift();\r\n }\r\n else if (isNextAnnotationStarting) {\r\n // same for the next annotation\r\n const end = nextAnnotation.columnNumbers.end + 1;\r\n annotatedGroups.push({\r\n next: {\r\n annotation: nextAnnotation,\r\n groups: shiftGroups(nextTokenGroups, nextColumn, end),\r\n },\r\n });\r\n nextColumn = end;\r\n nextAnnotations.shift();\r\n }\r\n else if (!prevAnnotation && !nextAnnotation) {\r\n // if there aren't any remaining annotation we add a last group\r\n annotatedGroups.push({\r\n prev: { groups: prevTokenGroups },\r\n next: { groups: nextTokenGroups },\r\n });\r\n // this is the last iteration\r\n prevTokenGroups = [];\r\n nextTokenGroups = [];\r\n }\r\n else {\r\n // if we still have annotations left we consume until the next one\r\n const end = Math.min((prevAnnotation === null || prevAnnotation === void 0 ? void 0 : prevAnnotation.columnNumbers.start) ||\r\n Number.MAX_VALUE, (nextAnnotation === null || nextAnnotation === void 0 ? void 0 : nextAnnotation.columnNumbers.start) ||\r\n Number.MAX_VALUE);\r\n annotatedGroups.push({\r\n prev: {\r\n groups: shiftGroups(prevTokenGroups, prevColumn, end),\r\n },\r\n next: {\r\n groups: shiftGroups(nextTokenGroups, nextColumn, end),\r\n },\r\n });\r\n prevColumn = end;\r\n nextColumn = end;\r\n }\r\n }\r\n }\r\n return annotatedGroups;\r\n}\r\n/**\r\n * Remove and return some groups from the beggining of the array\r\n * startColumn is the column at which the array is starting\r\n * (because other groups has been already removed)\r\n * newStartColumn is the first column that should stay in the array\r\n */\r\nfunction shiftGroups(tokenGroups, startColumn, newStartColumn) {\r\n const removedGroups = [];\r\n let currentStartColumn = startColumn;\r\n while (currentStartColumn < newStartColumn &&\r\n tokenGroups.length > 0) {\r\n const currentTokenGroup = tokenGroups.shift();\r\n removedGroups.push(currentTokenGroup);\r\n const length = currentTokenGroup.tokens.reduce((a, t) => a + t.content.length, 0);\r\n currentStartColumn += length;\r\n }\r\n return removedGroups;\r\n}\n\nfunction useStepParser(input) {\r\n const { highlightedLines, theme, focus } = input;\r\n return React.useMemo(() => parse$1(input), [\r\n highlightedLines.prev,\r\n highlightedLines.next,\r\n focus.prev,\r\n focus.next,\r\n theme,\r\n ]);\r\n}\r\nfunction parse$1({ theme, focus, annotations, highlightedLines, lang, }) {\r\n const normalCode = getCode(highlightedLines);\r\n const mergedCode = merge(normalCode, highlightedLines);\r\n const { inlineAnnotations, multilineAnnotations } = parseAllAnnotations(annotations, theme);\r\n const focusedCode = splitLinesByFocus(mergedCode, withDefault(focus, null), inlineAnnotations);\r\n const annotatedCode = addAnnotations(focusedCode, inlineAnnotations, multilineAnnotations);\r\n const codeStep = addExtraStuff(annotatedCode, normalCode, lang);\r\n // console.log({ codeStep })\r\n return codeStep;\r\n}\r\n// 0 - normalize\r\nfunction getCode(highlightedLines) {\r\n return map(highlightedLines, lines => lines\r\n .map(line => line.tokens.map(t => t.content).join(\"\"))\r\n .join(\"\\n\")\r\n .trimEnd()\r\n .concat(\"\\n\"));\r\n}\r\nfunction merge(code, highlightedLines) {\r\n return mergeLines(code, highlightedLines);\r\n}\r\nfunction parseAllAnnotations(annotations, theme) {\r\n return parseAnnotations(annotations, theme);\r\n}\r\nfunction splitLinesByFocus(mergedCode, focus, annotations) {\r\n return splitByFocus(mergedCode, focus, annotations);\r\n}\r\nfunction addAnnotations(_a, inlineAnnotations, annotations) {\r\n var { lines } = _a, focusedCode = __rest(_a, [\"lines\"]);\r\n const annotatedLines = annotateInline(lines, inlineAnnotations);\r\n const lineGroups = annotateMultiline(annotatedLines, annotations);\r\n return Object.assign(Object.assign({}, focusedCode), { lineGroups: lineGroups, lineCount: {\r\n prev: lines.filter(l => l.lineNumber.prev != null)\r\n .length,\r\n next: lines.filter(l => l.lineNumber.next != null)\r\n .length,\r\n } });\r\n}\r\nfunction addExtraStuff(codeStep, code, lang) {\r\n const vInterval = verticalInterval(codeStep.enterCount, codeStep.exitCount);\r\n const newGroups = map(codeStep.lineGroups, groups => groups.map(group => (Object.assign(Object.assign({}, group), { lines: getLinesWithElements(group.lines, vInterval, codeStep.enterCount, codeStep.exitCount) }))));\r\n return Object.assign(Object.assign({}, codeStep), { groups: newGroups, verticalInterval: vInterval, code,\r\n lang });\r\n}\r\nfunction verticalInterval(enterCount, exitCount) {\r\n if (enterCount <= 0 && exitCount <= 0)\r\n return [0, 1];\r\n if (enterCount <= 0 && exitCount >= 1)\r\n return [0.33, 1];\r\n if (enterCount >= 1 && exitCount <= 0)\r\n return [0, 0.67];\r\n return [0.25, 0.75];\r\n}\n\nfunction SmoothContainer({ dimensions, codeStep, children, minZoom = 0, maxZoom = 1.2, center = false, progress, }) {\r\n const { prev, next } = getTweenContentProps({\r\n codeStep,\r\n dimensions,\r\n minZoom,\r\n maxZoom,\r\n horizontalCenter: center,\r\n });\r\n // all these tweens depends on annotations now (t instead of progress)\r\n const zoom = tweenProp(prev.zoom, next.zoom, progress);\r\n const dx = tweenProp(prev.dx, next.dx, progress);\r\n const dy = tweenProp(prev.dy, next.dy, progress, codeStep.verticalInterval);\r\n const focusHeight = tweenProp(prev.focusHeight, next.focusHeight, progress);\r\n const focusWidth = tweenProp(prev.focusWidth, next.focusWidth, progress);\r\n const lineNumberPad = ((dimensions === null || dimensions === void 0 ? void 0 : dimensions.lineNumberWidth) || 0) * zoom;\r\n const leftPad = lineNumberPad || 16;\r\n const width = Math.max(focusWidth + leftPad, dimensions.contentWidth);\r\n const startX = leftPad / zoom;\r\n return (React.createElement(Container, { width: dimensions.containerWidth, height: dimensions.containerHeight, lang: codeStep.lang },\r\n React.createElement(Content$1, { dx: dx, dy: dy, scale: zoom, height: Math.max(focusHeight, dimensions.contentHeight), width: width }, children(focusWidth, startX))));\r\n}\r\nfunction Container({ width, height, children, lang, }) {\r\n return (React.createElement(\"code\", { style: {\r\n width,\r\n height,\r\n position: \"relative\",\r\n overflow: \"auto\",\r\n }, className: \"ch-code-scroll-parent\", children: children, \"data-ch-lang\": lang }));\r\n}\r\nfunction Content$1({ dx, dy, scale, height, width, children, }) {\r\n return (React.createElement(\"div\", { style: {\r\n position: \"absolute\",\r\n top: 0,\r\n left: 0,\r\n transformOrigin: \"top left\",\r\n width: width,\r\n height: height,\r\n overflow: \"hidden\",\r\n }, className: \"ch-code-scroll-content\" },\r\n React.createElement(\"div\", { style: {\r\n position: \"absolute\",\r\n top: 0,\r\n left: 0,\r\n transform: `translateX(${dx}px) translateY(${dy}px) scale(${scale})`,\r\n transformOrigin: \"left top\",\r\n width: width / scale,\r\n height: (height - 2 * dy) / scale,\r\n // outline: \"1px solid yellow\",\r\n }, children: children })));\r\n}\r\nfunction getTweenContentProps(_a) {\r\n var { codeStep } = _a, rest = __rest(_a, [\"codeStep\"]);\r\n const { lineHeight, lineWidth } = rest.dimensions;\r\n const paramTween = {\r\n prev: {\r\n extremes: [\r\n codeStep.firstFocusedLineNumber.prev - 1,\r\n codeStep.lastFocusedLineNumber.prev - 1,\r\n ],\r\n originalContentHeight: codeStep.lineCount.prev * lineHeight,\r\n lineWidth: lineWidth[0],\r\n },\r\n next: {\r\n extremes: [\r\n codeStep.firstFocusedLineNumber.next - 1,\r\n codeStep.lastFocusedLineNumber.next - 1,\r\n ],\r\n originalContentHeight: codeStep.lineCount.next * lineHeight,\r\n lineWidth: lineWidth[1],\r\n },\r\n };\r\n return map(paramTween, ({ extremes, originalContentHeight, lineWidth }) => getContentProps(Object.assign({ extremes,\r\n originalContentHeight,\r\n lineWidth }, rest)));\r\n}\r\nfunction getContentProps({ dimensions, lineWidth, minZoom, maxZoom, extremes, originalContentHeight, horizontalCenter, }) {\r\n const { lineHeight } = dimensions;\r\n const containerHeight = dimensions === null || dimensions === void 0 ? void 0 : dimensions.contentHeight;\r\n const containerWidth = dimensions === null || dimensions === void 0 ? void 0 : dimensions.contentWidth;\r\n const originalFocusHeight = (extremes[1] - extremes[0] + 3) * lineHeight;\r\n const leftPadding = (dimensions === null || dimensions === void 0 ? void 0 : dimensions.lineNumberWidth) || 16;\r\n const rightPadding = 16;\r\n const zoom = Math.max(Math.min((containerWidth - leftPadding - rightPadding) /\r\n lineWidth, containerHeight / originalFocusHeight, maxZoom), minZoom);\r\n const contentHeight = originalContentHeight * zoom;\r\n const focusStart = (extremes[0] - 1) * lineHeight * zoom;\r\n const focusEnd = (extremes[1] + 2) * lineHeight * zoom;\r\n const focusCenter = (focusEnd + focusStart) / 2;\r\n const focusHeight = focusEnd - focusStart;\r\n const dy = containerHeight > contentHeight\r\n ? (containerHeight - contentHeight) / 2\r\n : clamp$1(containerHeight / 2 - focusCenter, Math.max(containerHeight - contentHeight, -focusStart // to ensure first focus line is shown when focus is bigger than container\r\n ), 0);\r\n const dx = horizontalCenter\r\n ? Math.max(containerWidth / 2 - (lineWidth * zoom) / 2, 0)\r\n : 0;\r\n return {\r\n zoom,\r\n dx,\r\n dy,\r\n focusHeight: focusHeight,\r\n focusWidth: lineWidth * zoom,\r\n };\r\n}\r\nfunction clamp$1(num, min, max) {\r\n return num <= min ? min : num >= max ? max : num;\r\n}\r\nfunction tweenProp(start, end, progress, interval = [0, 1]) {\r\n return tween$1({\r\n fixed: false,\r\n interval,\r\n extremes: [start, end],\r\n ease: easing.easeInOutCubic,\r\n }, progress);\r\n}\n\nfunction SmoothLines(props) {\r\n return (React.createElement(SmoothContainer, Object.assign({}, props), (focusWidth, startX) => (React.createElement(Lines, { codeStep: props.codeStep, focusWidth: focusWidth, lineHeight: props.dimensions.lineHeight, progress: props.progress, theme: props.theme, startX: startX, lineNumberWidth: props.dimensions.lineNumberWidth }))));\r\n}\r\nfunction Lines({ codeStep, progress, focusWidth, lineHeight, startX, theme, lineNumberWidth, }) {\r\n const groups = progress < 0.5\r\n ? codeStep.groups.prev\r\n : codeStep.groups.next;\r\n return (React.createElement(React.Fragment, null, groups.map((group, i) => {\r\n if (!group.annotation) {\r\n return (React.createElement(LineGroup, { lines: group.lines, t: progress, focusWidth: focusWidth, lineHeight: lineHeight, startX: startX, key: i, theme: theme, lineNumberWidth: lineNumberWidth }));\r\n }\r\n const startY = tween$1(group.lines[0].tweenY, progress);\r\n const lineCount = group.annotation.lineNumbers.end -\r\n group.annotation.lineNumbers.start +\r\n 1;\r\n const Component = group.annotation.Component;\r\n return (React.createElement(Component, { style: {\r\n position: \"absolute\",\r\n height: lineCount * lineHeight,\r\n width: \"100%\",\r\n transform: `translateY(${startY * lineHeight}px)`,\r\n }, key: i, data: group.annotation.data, theme: group.annotation.theme, isInline: false },\r\n React.createElement(LineGroup, { lines: group.lines, t: progress, focusWidth: focusWidth, lineHeight: lineHeight, startY: startY, startX: startX, theme: theme, lineNumberWidth: lineNumberWidth })));\r\n })));\r\n}\r\nfunction LineGroup({ lines, focusWidth, lineHeight, t, startX, startY = 0, theme, lineNumberWidth, }) {\r\n return (React.createElement(React.Fragment, null, lines.map((line, key) => {\r\n const { tweenX, tweenY, focused } = line;\r\n const dx = tween$1(tweenX, t);\r\n const dy = tween$1(tweenY, t);\r\n const opacity = getOpacity(focused, t, dx);\r\n return (React.createElement(React.Fragment, { key: key },\r\n lineNumberWidth ? (React.createElement(\"span\", { className: \"ch-code-line-number\", style: {\r\n position: \"absolute\",\r\n top: 0,\r\n left: 0,\r\n transform: `translate(${dx * focusWidth}px, ${(dy - startY) * lineHeight}px)`,\r\n width: lineNumberWidth,\r\n opacity,\r\n color: getColor(theme, ColorName.LineNumberForeground),\r\n } }, t < 0.5\r\n ? line.lineNumber.prev\r\n : line.lineNumber.next)) : undefined,\r\n React.createElement(LineContainer, { dx: startX + dx * focusWidth, dy: (dy - startY) * lineHeight, width: focusWidth, opacity: opacity },\r\n React.createElement(LineContent, { line: line, progress: t, dx: dx }))));\r\n })));\r\n}\r\nfunction LineContent({ line, progress, dx, }) {\r\n return (React.createElement(\"div\", { style: {\r\n display: \"inline-block\",\r\n width: \"100%\",\r\n } },\r\n line.annotatedGroups.map((annotatedGroup, i) => (React.createElement(AnnotatedTokens, { annotatedGroup: annotatedGroup, progress: progress, dx: dx, key: i }))),\r\n React.createElement(\"br\", null)));\r\n}\r\nfunction AnnotatedTokens({ annotatedGroup, progress, dx, }) {\r\n var _a, _b, _c;\r\n const annotated = progress < 0.5\r\n ? annotatedGroup.prev\r\n : annotatedGroup.next;\r\n const tokenGroups = (annotated === null || annotated === void 0 ? void 0 : annotated.groups) || [];\r\n const Component = (_a = annotated === null || annotated === void 0 ? void 0 : annotated.annotation) === null || _a === void 0 ? void 0 : _a.Component;\r\n const children = tokenGroups.map((group, i) => {\r\n const opacity = getOpacity(group.focused, progress, dx);\r\n return (React.createElement(\"span\", { style: { opacity }, key: i + 1 }, group.element));\r\n });\r\n return Component ? (React.createElement(Component, { children: children, data: (_b = annotated === null || annotated === void 0 ? void 0 : annotated.annotation) === null || _b === void 0 ? void 0 : _b.data, theme: (_c = annotated === null || annotated === void 0 ? void 0 : annotated.annotation) === null || _c === void 0 ? void 0 : _c.theme, isInline: true })) : (React.createElement(React.Fragment, null, children));\r\n}\r\nfunction LineContainer({ children, dx, dy, opacity, width, }) {\r\n return (React.createElement(\"div\", { style: {\r\n position: \"absolute\",\r\n top: 0,\r\n left: 0,\r\n transform: `translate(${dx}px, ${dy}px)`,\r\n width,\r\n display: opacity <= 0 ? \"none\" : undefined,\r\n } }, children));\r\n}\r\nconst OFF_OPACITY = 0.33;\r\nfunction getOpacity(focused, progress, dx) {\r\n return (tween$1({\r\n fixed: false,\r\n extremes: [\r\n focused.prev ? 0.99 : OFF_OPACITY,\r\n focused.next ? 0.99 : OFF_OPACITY,\r\n ],\r\n interval: [0, 1],\r\n }, progress) -\r\n Math.abs(dx) * 1);\r\n}\n\nfunction CopyButton({ content, style, className, }) {\r\n const [copied, setCopied] = React.useState(false);\r\n return (React.createElement(\"svg\", { style: style, onClick: () => {\r\n copyToClipboard(content);\r\n setCopied(true);\r\n setTimeout(() => {\r\n setCopied(false);\r\n }, 1200);\r\n }, fill: \"none\", stroke: \"currentColor\", viewBox: \"0 0 24 24\", xmlns: \"http://www.w3.org/2000/svg\", className: className },\r\n React.createElement(\"title\", null, \"Copy\"),\r\n copied ? (React.createElement(\"path\", { strokeLinecap: \"round\", strokeLinejoin: \"round\", strokeWidth: 2, d: \"M5 13l4 4L19 7\" })) : (React.createElement(\"path\", { strokeLinecap: \"round\", strokeLinejoin: \"round\", strokeWidth: \"1.6px\", d: \"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\" }))));\r\n}\r\nfunction copyToClipboard(text) {\r\n if (!navigator.clipboard) {\r\n fallbackCopyTextToClipboard(text);\r\n return;\r\n }\r\n navigator.clipboard.writeText(text);\r\n}\r\nfunction fallbackCopyTextToClipboard(text) {\r\n var textArea = document.createElement(\"textarea\");\r\n textArea.value = text;\r\n // Avoid scrolling to bottom\r\n textArea.style.top = \"0\";\r\n textArea.style.left = \"0\";\r\n textArea.style.position = \"fixed\";\r\n document.body.appendChild(textArea);\r\n textArea.focus();\r\n textArea.select();\r\n try {\r\n var successful = document.execCommand(\"copy\");\r\n // var msg = successful ? \"successful\" : \"unsuccessful\"\r\n // console.log(\"Fallback: Copying text command was \" + msg)\r\n }\r\n catch (err) {\r\n // console.error(\"Fallback: Oops, unable to copy\", err)\r\n }\r\n document.body.removeChild(textArea);\r\n}\n\nfunction useCodeShift({ tween, theme, }) {\r\n return useStepParser({\r\n highlightedLines: map(tween, tween => tween.code.lines),\r\n theme,\r\n focus: map(tween, tween => tween.focus),\r\n annotations: map(tween, tween => tween.annotations),\r\n lang: anyValue(tween, tween => { var _a; return (_a = tween === null || tween === void 0 ? void 0 : tween.code) === null || _a === void 0 ? void 0 : _a.lang; }),\r\n });\r\n}\r\nconst DEFAULT_MIN_COLUMNS = 10;\r\nfunction CodeTween(_a) {\r\n var { tween, progress, config } = _a, preProps = __rest(_a, [\"tween\", \"progress\", \"config\"]);\r\n const stepInfo = useCodeShift({\r\n tween,\r\n theme: config.theme,\r\n });\r\n const { element, dimensions } = useDimensions(stepInfo.code, map(tween, tween => tween.focus), config.minColumns || DEFAULT_MIN_COLUMNS, config.lineNumbers || false, config.rows, [config.parentHeight]);\r\n return !dimensions || config.debug ? (React.createElement(BeforeDimensions, { element: element, htmlProps: preProps, debug: config.debug })) : (React.createElement(AfterDimensions, { dimensions: dimensions, stepInfo: stepInfo, config: config, progress: progress, htmlProps: preProps }));\r\n}\r\nfunction BeforeDimensions({ element, htmlProps, debug, }) {\r\n return (React.createElement(Wrapper, { htmlProps: htmlProps, style: { opacity: debug ? 0.9 : 0, overflow: \"auto\" } }, element));\r\n}\r\nfunction AfterDimensions({ config: { minZoom = 1, maxZoom = 1, horizontalCenter = false, theme, }, dimensions, stepInfo, progress, htmlProps, config, }) {\r\n var _a;\r\n const { bg, fg } = getCodeColors(theme);\r\n return (React.createElement(Wrapper, { htmlProps: htmlProps, style: {\r\n opacity: 1,\r\n backgroundColor: bg,\r\n color: fg,\r\n [\"colorScheme\"]: getColorScheme(theme),\r\n [\"--ch-selection-background\"]: getColor(theme, ColorName.SelectionBackground),\r\n } },\r\n React.createElement(SmoothLines, { codeStep: stepInfo, progress: progress, dimensions: dimensions, \r\n // TODO move to dimensions?\r\n minZoom: minZoom, maxZoom: maxZoom, center: horizontalCenter, theme: theme }),\r\n config.showCopyButton ? (React.createElement(CopyButton, { className: \"ch-code-button\", content: (_a = stepInfo === null || stepInfo === void 0 ? void 0 : stepInfo.code) === null || _a === void 0 ? void 0 : _a.prev })) : undefined));\r\n}\r\nfunction Wrapper({ htmlProps, style, children, }) {\r\n return (React.createElement(\"div\", Object.assign({ className: \"ch-code-wrapper\" }, htmlProps, { style: Object.assign(Object.assign({ margin: 0, padding: 0, position: \"relative\", \r\n // using this instead of <pre> because https://github.com/code-hike/codehike/issues/120\r\n whiteSpace: \"pre\", \r\n // to avoid resets using \"border-box\" that break the scrollbar https://github.com/code-hike/codehike/issues/240\r\n boxSizing: \"content-box\" }, style), htmlProps === null || htmlProps === void 0 ? void 0 : htmlProps.style), children: children })));\r\n}\n\nfunction currentTime() {\n if (typeof window !== \"undefined\") {\n return performance.now();\n } else {\n return 0;\n }\n}\n\nfunction useSpringInstance(target, config) {\n var ref = React.useRef(null);\n\n if (ref.current == null) {\n ref.current = {\n config: getConfigWithDefaults(target, config),\n state: getInitialState(target, config)\n };\n }\n\n return ref.current;\n}\nfunction getConfigWithDefaults(target, _ref) {\n var stiffness = _ref.stiffness,\n damping = _ref.damping,\n mass = _ref.mass,\n decimals = _ref.decimals,\n teleport = _ref.teleport;\n return {\n X: target,\n k: stiffness !== null && stiffness !== void 0 ? stiffness : 170,\n c: damping !== null && damping !== void 0 ? damping : 26,\n m: mass !== null && mass !== void 0 ? mass : 1,\n teleport: teleport !== null && teleport !== void 0 ? teleport : false,\n decimals: decimals !== null && decimals !== void 0 ? decimals : 2\n };\n}\n\nfunction getInitialState(target, _ref2) {\n var from = _ref2.from,\n initialSpeed = _ref2.initialSpeed;\n return {\n x0: from !== null && from !== void 0 ? from : target,\n v0: initialSpeed !== null && initialSpeed !== void 0 ? initialSpeed : 0,\n t0: currentTime(),\n raf: null\n };\n}\n\nvar sqrt = Math.sqrt,\n exp = Math.exp,\n sin = Math.sin,\n cos = Math.cos;\nfunction spring(_ref) {\n var x0 = _ref.x0,\n v0 = _ref.v0,\n t0 = _ref.t0,\n t = _ref.t,\n k = _ref.k,\n c = _ref.c,\n m = _ref.m,\n X = _ref.X;\n var dx = x0 - X;\n var dt = (t - t0) / 1000;\n var radicand = c * c - 4 * k * m;\n\n if (radicand > 0) {\n var rp = (-c + sqrt(radicand)) / (2 * m);\n var rn = (-c - sqrt(radicand)) / (2 * m);\n var a = (dx * rp - v0) / (rp - rn);\n var b = (v0 - dx * rn) / (rp - rn);\n return {\n x: X + a * exp(rn * dt) + b * exp(rp * dt),\n v: a * rn * exp(rn * dt) + b * rp * exp(rp * dt)\n };\n } else if (radicand < 0) {\n var r = -c / (2 * m);\n var s = sqrt(-radicand) / (2 * m);\n var _a = dx;\n\n var _b = (v0 - r * dx) / s;\n\n return {\n x: X + exp(r * dt) * (_a * cos(s * dt) + _b * sin(s * dt)),\n v: exp(r * dt) * ((_b * s + _a * r) * cos(s * dt) - (_a * s - _b * r) * sin(s * dt))\n };\n } else {\n var _r = -c / (2 * m);\n\n var _a2 = dx;\n\n var _b2 = v0 - _r * dx;\n\n return {\n x: X + (_a2 + _b2 * dt) * exp(_r * dt),\n v: (_b2 + _a2 * _r + _b2 * _r * dt) * exp(_r * dt)\n };\n }\n}\n\nvar nextFrameQueue = [];\nvar nextFrameId = null;\nfunction queueAnimationFrame(fn) {\n var length = nextFrameQueue.push(fn);\n\n if (length === 1) {\n nextFrameId = requestAnimationFrame(runQueue);\n }\n\n return [nextFrameId, length - 1];\n}\nfunction unqueueAnimationFrame(_ref) {\n var frameId = _ref[0],\n index = _ref[1];\n\n if (frameId === nextFrameId) {\n delete nextFrameQueue[index];\n }\n}\n\nfunction runQueue() {\n var now = currentTime();\n var queue = nextFrameQueue;\n nextFrameQueue = [];\n unstable_batchedUpdates(function () {\n return queue.forEach(function (task) {\n return task && task(now);\n });\n });\n}\n\nvar useLayoutEffect$3 = typeof window !== \"undefined\" ? React.useLayoutEffect : React.useEffect;\nfunction useSpring(target, config) {\n if (config === void 0) {\n config = {};\n }\n\n var _React$useState = React.useState(),\n forceUpdate = _React$useState[1];\n\n var newConfig = getConfigWithDefaults(target, config);\n\n var _useSpringInstance = useSpringInstance(target, config),\n state = _useSpringInstance.state,\n oldConfig = _useSpringInstance.config; // TODO all springs should use the same t in the same frame\n\n\n var t = currentTime();\n var x0 = state.x0,\n v0 = state.v0,\n t0 = state.t0;\n var k = oldConfig.k,\n c = oldConfig.c,\n m = oldConfig.m,\n X = oldConfig.X;\n\n var _ref = newConfig.teleport ? {\n x: X,\n v: 0\n } : spring({\n x0: x0,\n v0: v0,\n t0: t0,\n t: t,\n k: k,\n c: c,\n m: m,\n X: X\n }),\n x = _ref.x,\n v = _ref.v;\n\n var moving = isMoving(x, v, t, newConfig);\n useLayoutEffect$3(function () {\n Object.assign(oldConfig, newConfig);\n }, [newConfig.X, newConfig.k, newConfig.c, newConfig.m, newConfig.teleport]);\n useLayoutEffect$3(function () {\n state.x0 = x;\n state.v0 = v;\n state.t0 = t;\n }, [x, v, t]);\n useLayoutEffect$3(function () {\n var loop = function loop(now) {\n var x0 = state.x0,\n v0 = state.v0,\n t0 = state.t0;\n var k = oldConfig.k,\n c = oldConfig.c,\n m = oldConfig.m,\n X = oldConfig.X,\n decimals = oldConfig.decimals;\n\n var _spring = spring({\n x0: x0,\n v0: v0,\n t0: t0,\n t: now,\n k: k,\n c: c,\n m: m,\n X: X\n }),\n nextX = _spring.x;\n\n if (roundTo(nextX, decimals) !== roundTo(x0, decimals)) {\n state.raf = null;\n forceUpdate(now);\n } else {\n state.raf = queueAnimationFrame(loop);\n }\n };\n\n if (moving && state.raf == null) {\n state.raf = queueAnimationFrame(loop);\n } else if (!moving && state.raf != null) {\n unqueueAnimationFrame(state.raf);\n state.raf = null;\n }\n });\n useLayoutEffect$3(function () {\n return function () {\n if (state.raf != null) {\n unqueueAnimationFrame(state.raf);\n }\n };\n }, []);\n return [roundTo(x, newConfig.decimals), moving];\n}\n\nfunction isMoving(x, v, t, _ref2) {\n var decimals = _ref2.decimals,\n X = _ref2.X,\n k = _ref2.k,\n c = _ref2.c,\n m = _ref2.m;\n\n if (roundTo(x, decimals) !== roundTo(X, decimals)) {\n return true;\n }\n\n var nextT = t + 0.016;\n\n var _spring2 = spring({\n x0: x,\n v0: v,\n t0: t,\n t: nextT,\n k: k,\n c: c,\n m: m,\n X: X\n }),\n nextX = _spring2.x;\n\n return roundTo(nextX, decimals) !== roundTo(X, decimals);\n}\n\nfunction roundTo(x, decimals) {\n var p = Math.pow(10, decimals);\n return Math.round(x * p) / p;\n}\n\nconst defaultSpring$1 = {\r\n stiffness: 120,\r\n damping: 24,\r\n mass: 0.2,\r\n decimals: 3,\r\n};\r\nfunction CodeSpring(_a) {\r\n var { step, config } = _a, htmlProps = __rest(_a, [\"step\", \"config\"]);\r\n const { tween, t } = useStepSpring$1(step, config.spring);\r\n return (React.createElement(CodeTween, Object.assign({ tween: tween, progress: t, config: config }, htmlProps)));\r\n}\r\nfunction useStepSpring$1(step, springConfig = defaultSpring$1) {\r\n const [{ target, steps, index }, setState] = React.useState({\r\n target: 2,\r\n steps: [step, step, step],\r\n index: 0,\r\n });\r\n React.useEffect(() => {\r\n const lastStep = steps[steps.length - 1];\r\n if (lastStep != step) {\r\n setState(s => updateStepSpring$1(s, step, progress));\r\n }\r\n }, [step]);\r\n const [progress] = useSpring(target, springConfig);\r\n const trioProgress = progress - index;\r\n const result = trioProgress <= 1\r\n ? {\r\n tween: { prev: steps[0], next: steps[1] },\r\n t: trioProgress,\r\n }\r\n : {\r\n tween: { prev: steps[1], next: steps[2] },\r\n t: trioProgress - 1,\r\n };\r\n return result;\r\n}\r\nfunction updateStepSpring$1(state, newStep, progress) {\r\n const { steps, target, index } = state;\r\n const stepsClone = steps.slice();\r\n const trioProgress = progress - index;\r\n if (trioProgress < 1) {\r\n stepsClone[2] = newStep;\r\n return Object.assign(Object.assign({}, state), { steps: stepsClone });\r\n }\r\n else {\r\n stepsClone[0] = steps[1];\r\n stepsClone[1] = steps[2];\r\n stepsClone[2] = newStep;\r\n return Object.assign(Object.assign({}, state), { steps: stepsClone, target: target + 1, index: index + 1 });\r\n }\r\n}\n\nconst ClasserContext = createContext({});\r\nfunction ClasserProvider({ classes, children, }) {\r\n const outer = useContext(ClasserContext);\r\n const mixed = useMerge(outer, classes);\r\n return (React.createElement(ClasserContext.Provider, { value: mixed, children: children }));\r\n}\r\nfunction useClasser(libClassPrefix, innerClasses) {\r\n const outerClasses = useContext(ClasserContext);\r\n const classes = useMerge(outerClasses, innerClasses);\r\n return useCallback(getClasser(libClassPrefix, classes), [\r\n libClassPrefix,\r\n classes,\r\n ]);\r\n}\r\nfunction getClasser(libClassPrefix, classes) {\r\n return function classer(...libClassSuffixList) {\r\n const libClassList = libClassSuffixList.map(libClassSuffix => libClassPrefix +\r\n (libClassPrefix && libClassSuffix ? \"-\" : \"\") +\r\n libClassSuffix);\r\n const outputList = libClassList.slice();\r\n libClassList.forEach(libClass => {\r\n if (libClass in classes) {\r\n outputList.push(classes[libClass]);\r\n }\r\n });\r\n return outputList.join(\" \");\r\n };\r\n}\r\nfunction useMerge(outer, inner) {\r\n return useMemo(() => (Object.assign(Object.assign({}, outer), inner)), [outer, inner]);\r\n}\n\nconst MiniFrame = React.forwardRef(function (_a, ref) {\r\n var { title, children, titleBar, classes, theme, zoom = 1, overflow } = _a, props = __rest(_a, [\"title\", \"children\", \"titleBar\", \"classes\", \"theme\", \"zoom\", \"overflow\"]);\r\n const c = useClasser(\"ch-frame\", classes);\r\n const bar = titleBar || React.createElement(DefaultTitleBar, { title: title });\r\n const zoomStyle = {\r\n \"--ch-frame-zoom\": zoom,\r\n overflow,\r\n };\r\n return (React.createElement(ClasserProvider, { classes: classes },\r\n React.createElement(\"div\", Object.assign({}, props, { ref: ref }),\r\n React.createElement(\"div\", { className: c(\"\") },\r\n React.createElement(\"div\", { className: c(\"title-bar\"), style: {\r\n background: getColor(theme, ColorName.EditorGroupHeaderBackground),\r\n } }, bar),\r\n React.createElement(\"div\", { className: c(\"content\") },\r\n React.createElement(\"div\", { className: c(\"zoom\"), style: zoomStyle }, children))))));\r\n});\r\nReact.forwardRef(function (_a, ref) {\r\n var { title, children, titleBar, classes, overflow } = _a, props = __rest(_a, [\"title\", \"children\", \"titleBar\", \"classes\", \"overflow\"]);\r\n const c = useClasser(\"ch\", classes);\r\n const bar = titleBar || React.createElement(DefaultTitleBar, { title: title });\r\n return (React.createElement(ClasserProvider, { classes: classes },\r\n React.createElement(\"div\", Object.assign({}, props, { ref: ref }),\r\n React.createElement(\"div\", { className: c(\"simple-frame\") },\r\n React.createElement(\"div\", { className: c(\"frame-title-bar\") }, bar),\r\n children))));\r\n});\r\nfunction DefaultTitleBar({ title }) {\r\n const c = useClasser(\"ch-frame\");\r\n return (React.createElement(React.Fragment, null,\r\n React.createElement(\"div\", { className: c(\"left-bar\") },\r\n React.createElement(FrameButtons, null)),\r\n React.createElement(\"div\", { className: c(\"middle-bar\") }, title),\r\n React.createElement(\"div\", { className: c(\"right-bar\") })));\r\n}\r\nfunction FrameButtons() {\r\n const c = useClasser(\"ch-frame\");\r\n return (React.createElement(\"div\", { className: c(\"buttons\") },\r\n React.createElement(\"div\", { className: c(\"button\", \"button-left\") }),\r\n React.createElement(\"div\", { className: c(\"button-space\") }),\r\n React.createElement(\"div\", { className: c(\"button\", \"button-middle\") }),\r\n React.createElement(\"div\", { className: c(\"button-space\") }),\r\n React.createElement(\"div\", { className: c(\"button\", \"button-right\") })));\r\n}\n\nconst EditorFrame = React.forwardRef(function InnerEditorFrame(_a, ref) {\r\n var _b;\r\n var { northPanel, southPanel, terminalPanel, style, height, northButton, southButton, theme, className, onTabClick } = _a, rest = __rest(_a, [\"northPanel\", \"southPanel\", \"terminalPanel\", \"style\", \"height\", \"northButton\", \"southButton\", \"theme\", \"className\", \"onTabClick\"]);\r\n return (React.createElement(\"div\", Object.assign({ ref: ref }, rest, { className: \"ch-editor-frame\", style: Object.assign({ background: getColor(theme, ColorName.EditorBackground) }, style) }),\r\n React.createElement(\"div\", { className: \"ch-frame-title-bar\", style: {\r\n color: getColor(theme, ColorName.IconForeground),\r\n background: getColor(theme, ColorName.EditorGroupHeaderBackground),\r\n } },\r\n React.createElement(TabsContainer, { tabs: northPanel.tabs, showFrameButtons: true, button: northButton, panel: \"north\", theme: theme, onTabClick: onTabClick })),\r\n React.createElement(\"div\", { \"data-ch-panel\": \"north\", style: northPanel.style, children: northPanel.children }),\r\n southPanel && (React.createElement(React.Fragment, null,\r\n React.createElement(\"div\", { className: \"ch-frame-title-bar\", style: {\r\n transform: (_b = southPanel.style) === null || _b === void 0 ? void 0 : _b.transform,\r\n color: getColor(theme, ColorName.IconForeground),\r\n background: getColor(theme, ColorName.EditorGroupHeaderBackground),\r\n } },\r\n React.createElement(TabsContainer, { tabs: southPanel.tabs, showFrameButtons: false, button: southButton, topBorder: true, panel: \"south\", theme: theme, onTabClick: onTabClick })),\r\n React.createElement(\"div\", { \"data-ch-panel\": \"south\", children: southPanel.children, style: southPanel.style })))));\r\n});\r\nfunction TabsContainer({ tabs, button, showFrameButtons, topBorder, panel, theme, onTabClick, }) {\r\n const c = useClasser(\"ch-editor-tab\");\r\n return (React.createElement(React.Fragment, null,\r\n topBorder && (React.createElement(\"div\", { style: {\r\n position: \"absolute\",\r\n height: \"1px\",\r\n background: getColor(theme, ColorName.EditorGroupBorder),\r\n width: \"100%\",\r\n top: 0,\r\n zIndex: 1,\r\n } })),\r\n showFrameButtons ? React.createElement(FrameButtons, null) : React.createElement(\"div\", null),\r\n tabs.map(({ title, active, style }) => (React.createElement(\"div\", { key: title, title: title, \"data-ch-tab\": panel, className: c(\"\", active ? \"active\" : \"inactive\"), style: Object.assign(Object.assign({}, style), { background: getColor(theme, active\r\n ? ColorName.ActiveTabBackground\r\n : ColorName.InactiveTabBackground), color: getColor(theme, active\r\n ? ColorName.ActiveTabForeground\r\n : ColorName.InactiveTabForeground), borderRightColor: getColor(theme, ColorName.TabBorder), borderBottomColor: getColor(theme, active\r\n ? ColorName.ActiveTabBottomBorder\r\n : ColorName.InactiveTabBackground) }), onClick: onTabClick && (() => onTabClick(title)) },\r\n React.createElement(TabTitle, { title: title })))),\r\n React.createElement(\"div\", { style: { flex: 1, minWidth: \"0.8em\" } }),\r\n button));\r\n}\r\nfunction TabTitle({ title }) {\r\n if (!title) {\r\n return React.createElement(\"div\", null);\r\n }\r\n const separatorIndex = title.lastIndexOf(\"/\") + 1;\r\n const filename = title.substring(separatorIndex);\r\n const folder = title.substring(0, separatorIndex);\r\n return (React.createElement(\"div\", null,\r\n React.createElement(\"span\", { style: { opacity: 0.5 } }, folder),\r\n filename));\r\n}\n\nfunction getCommands(text) {\r\n const [, ...lines] = text.split(/^\\$\\s*/gm);\r\n const commands = lines.map((c) => {\r\n const [run, ...outputLines] = c.split(/\\r?\\n/);\r\n return {\r\n run,\r\n output: outputLines.length > 0 ? outputLines.join(\"\\n\") : null,\r\n };\r\n });\r\n const lastCommand = commands[commands.length - 1];\r\n const isRunning = commands.length > 0 && lastCommand.output != null;\r\n const title = isRunning ? lastCommand.run.split(/(\\s+)/)[0] : \"bash\";\r\n return {\r\n title,\r\n isRunning,\r\n commands,\r\n };\r\n}\n\nconst prompt = React.createElement(\"span\", { className: \"ch-terminal-prompt\" }, \"$\");\r\nfunction TerminalContent({ text, progress = 1, style, }) {\r\n const commands = parse(text, progress);\r\n return (React.createElement(\"pre\", { style: style, className: \"ch-terminal-content\" }, commands.map(({ run, output }, i) => (React.createElement(React.Fragment, { key: i },\r\n React.createElement(\"div\", null,\r\n prompt,\r\n \" \",\r\n React.createElement(\"span\", null, run)),\r\n output && (React.createElement(\"div\", { className: \"ch-terminal-output\" }, output)))))));\r\n}\r\nfunction parse(text, progress) {\r\n if (!text)\r\n return [];\r\n const chars = Math.round(text.length * progress);\r\n const { commands } = getCommands(text.slice(0, chars));\r\n return commands;\r\n}\n\nfunction InnerTerminalTransition({ prev = \"\", prevKey, next = \"\", nextKey, progress, }) {\r\n return (React.createElement(\"div\", { className: \"ch-terminal\" },\r\n React.createElement(\"div\", { style: {\r\n position: \"relative\",\r\n transform: `translateY(-${progress * 100}%)`,\r\n } },\r\n React.createElement(TerminalContent, { text: prev, progress: 1, key: prevKey }),\r\n React.createElement(TerminalContent, { style: { position: \"absolute\" }, text: next, progress: progress, key: nextKey }))));\r\n}\n\nfunction InnerTerminalTransitions({ steps, progress, }) {\r\n const textSteps = steps.map((s) => s.text);\r\n const stepProgress = progress % 1;\r\n const prevIndex = clamp(Math.floor(progress), 0, steps.length - 1);\r\n const nextIndex = prevIndex + 1;\r\n return (React.createElement(InnerTerminalTransition, { prev: textSteps[prevIndex], prevKey: prevIndex, next: textSteps[nextIndex] || \"\", nextKey: nextIndex, progress: stepProgress }));\r\n}\r\nfunction clamp(x, min, max) {\r\n return Math.min(Math.max(x, min), max);\r\n}\n\nfunction TerminalPanel({ prev, next, t, backward, }) {\r\n const height = getHeight({ prev, next, t, backward });\r\n return !height ? null : (React.createElement(\"div\", { className: \"ch-editor-terminal\", style: { height } },\r\n React.createElement(\"div\", { className: \"ch-editor-terminal-tab\" },\r\n React.createElement(\"span\", null, \"Terminal\")),\r\n React.createElement(\"div\", { className: \"ch-editor-terminal-content\" },\r\n React.createElement(InnerTerminalTransitions, { steps: [\r\n { text: prev || \"\" },\r\n { text: next || \"\" },\r\n ], progress: t }),\r\n \")\")));\r\n}\r\nfunction getHeight({ prev, next, t, backward, }) {\r\n if (!prev && !next)\r\n return 0;\r\n if (!prev && next)\r\n return MAX_HEIGHT * Math.min(t * 4, 1);\r\n if (prev && !next)\r\n return MAX_HEIGHT * Math.max(1 - t * 4, 0);\r\n return MAX_HEIGHT;\r\n}\r\nconst MAX_HEIGHT = 150;\n\nfunction northConfig(codeConfig) {\r\n if (Array.isArray(codeConfig.rows)) {\r\n return Object.assign(Object.assign({}, codeConfig), { rows: codeConfig.rows[0] });\r\n }\r\n return codeConfig;\r\n}\r\nfunction southConfig(codeConfig) {\r\n if (Array.isArray(codeConfig.rows)) {\r\n return Object.assign(Object.assign({}, codeConfig), { rows: codeConfig.rows[1] });\r\n }\r\n return codeConfig;\r\n}\r\nfunction useTransition(ref, prev, next, t, backward, codeConfig) {\r\n // prevSnapshot has the dimensions of the editor for t=0\r\n // nextSnapshot has the dimensions of the editor for t=1\r\n const { prevSnapshot, nextSnapshot } = useSnapshots(ref, prev, next);\r\n // we return the default styles for t=0 until we measure the dimensions\r\n if (!prevSnapshot) {\r\n return startingPosition(prev, next, codeConfig);\r\n }\r\n // and the same for t=1\r\n if (!nextSnapshot) {\r\n return endingPosition(prev, next, codeConfig);\r\n }\r\n // TODO this should be commented\r\n // if (t === 0) {\r\n // return startingPosition(prev, next, codeConfig)\r\n // }\r\n if (t === 1) {\r\n return endingPosition(prev, next, codeConfig);\r\n }\r\n const inputSouthPanel = prev.southPanel || next.southPanel;\r\n const { prevNorthFile, prevSouthFile, nextNorthFile, nextSouthFile, } = getStepFiles(prev, next, t == 0 || backward);\r\n const { northStyle, southStyle } = getPanelStyles(prevSnapshot, nextSnapshot, t);\r\n const { northTabs, southTabs } = getTabs(prevSnapshot, nextSnapshot, prevNorthFile.name, prevSouthFile === null || prevSouthFile === void 0 ? void 0 : prevSouthFile.name, t);\r\n return {\r\n northContent: getContentFromFile(nextNorthFile),\r\n northPanel: {\r\n tabs: northTabs,\r\n style: northStyle,\r\n children: (React.createElement(CodeTransition, { codeConfig: northConfig(codeConfig), prevFile: prevNorthFile, nextFile: nextNorthFile, t: t, parentHeight: (northStyle.height ||\r\n northStyle.minHeight) })),\r\n },\r\n southContent: getContentFromFile(nextSouthFile),\r\n southPanel: inputSouthPanel && {\r\n tabs: southTabs,\r\n style: southStyle,\r\n children: (React.createElement(CodeTransition, { codeConfig: southConfig(codeConfig), prevFile: prevSouthFile, nextFile: nextSouthFile, t: t, parentHeight: ((southStyle === null || southStyle === void 0 ? void 0 : southStyle.height) ||\r\n (southStyle === null || southStyle === void 0 ? void 0 : southStyle.minHeight)) })),\r\n },\r\n };\r\n}\r\n// Returns the t=0 state of the transition\r\nfunction startingPosition(prev, next, codeConfig) {\r\n const inputNorthPanel = prev.northPanel;\r\n const inputSouthPanel = prev.southPanel;\r\n const { prevNorthFile, prevSouthFile, nextNorthFile, nextSouthFile, } = getStepFiles(prev, next, true);\r\n return {\r\n northContent: getContentFromFile(prevNorthFile),\r\n northPanel: {\r\n tabs: inputNorthPanel.tabs.map(title => ({\r\n title,\r\n active: title === inputNorthPanel.active,\r\n style: {},\r\n })),\r\n style: {\r\n flexGrow: 1,\r\n overflow: \"hidden\",\r\n },\r\n children: (React.createElement(CodeTransition, { codeConfig: northConfig(codeConfig), prevFile: prevNorthFile, nextFile: prevNorthFile, t: 0, parentHeight: \"0\" })),\r\n },\r\n southContent: getContentFromFile(prevSouthFile),\r\n southPanel: inputSouthPanel && {\r\n tabs: inputSouthPanel.tabs.map(title => ({\r\n title,\r\n active: title === inputSouthPanel.active,\r\n style: {},\r\n })),\r\n style: {\r\n flexGrow: 1,\r\n overflow: \"hidden\",\r\n },\r\n children: (React.createElement(CodeTransition, { codeConfig: southConfig(codeConfig), prevFile: prevSouthFile, nextFile: prevSouthFile, t: 0, parentHeight: \"0\" })),\r\n },\r\n };\r\n}\r\n// Returns the t=1 state of the transition\r\nfunction endingPosition(prev, next, codeConfig) {\r\n var _a;\r\n const inputNorthPanel = next.northPanel;\r\n const inputSouthPanel = next.southPanel;\r\n let { prevNorthFile, prevSouthFile, nextNorthFile, nextSouthFile, } = getStepFiles(prev, next, false);\r\n // getStepFiles return the intermediate files, we need to patch the ending state (2to1south)\r\n const isTwoToOneSouth = !inputSouthPanel &&\r\n inputNorthPanel.active === ((_a = prev === null || prev === void 0 ? void 0 : prev.southPanel) === null || _a === void 0 ? void 0 : _a.active);\r\n if (isTwoToOneSouth) {\r\n nextNorthFile = nextSouthFile;\r\n }\r\n return {\r\n northContent: getContentFromFile(nextNorthFile),\r\n northPanel: {\r\n tabs: inputNorthPanel.tabs.map(title => ({\r\n title,\r\n active: title === inputNorthPanel.active,\r\n style: {},\r\n })),\r\n style: {\r\n flexGrow: 1,\r\n overflow: \"hidden\",\r\n },\r\n children: (React.createElement(CodeTransition, { codeConfig: northConfig(codeConfig), prevFile: nextNorthFile, nextFile: nextNorthFile, t: 1, parentHeight: \"1\" })),\r\n },\r\n southContent: getContentFromFile(nextSouthFile),\r\n southPanel: inputSouthPanel && {\r\n tabs: inputSouthPanel.tabs.map(title => ({\r\n title,\r\n active: title === inputSouthPanel.active,\r\n style: {},\r\n })),\r\n style: {\r\n flexGrow: 1,\r\n overflow: \"hidden\",\r\n },\r\n children: (React.createElement(CodeTransition, { codeConfig: southConfig(codeConfig), prevFile: nextSouthFile, nextFile: nextSouthFile, t: 1, parentHeight: \"1\" })),\r\n },\r\n };\r\n}\r\nfunction CodeTransition({ prevFile, nextFile, t, codeConfig, parentHeight, }) {\r\n var _a;\r\n const htmlProps = Object.assign(Object.assign({}, codeConfig === null || codeConfig === void 0 ? void 0 : codeConfig.htmlProps), { style: Object.assign({ height: \"100%\" }, (_a = codeConfig === null || codeConfig === void 0 ? void 0 : codeConfig.htmlProps) === null || _a === void 0 ? void 0 : _a.style) });\r\n return (React.createElement(CodeTween, Object.assign({ progress: t, tween: { prev: prevFile, next: nextFile }, config: Object.assign(Object.assign({}, codeConfig), { parentHeight }) }, htmlProps)));\r\n}\r\nfunction getContentFromFile(file) {\r\n return file ? codeToText(file.code) : \"\";\r\n}\r\n/**\r\n * Get the StepFiles for a transition\r\n * in each panel, if the prev and next active files are the same\r\n * we return the prev and next version of that panel\r\n * if the active files are different, we return the same file twice,\r\n * if backward is true we return the prev active file twice,\r\n * or else the next active file twice\r\n */\r\nfunction getStepFiles(prev, next, backward) {\r\n var _a, _b;\r\n // The active file in each panel before and after:\r\n // +----+----+\r\n // | pn | nn |\r\n // +----+----+\r\n // | ps | ns |\r\n // +----+----+\r\n //\r\n const pn = prev.northPanel.active;\r\n const nn = next.northPanel.active;\r\n const ps = (_a = prev.southPanel) === null || _a === void 0 ? void 0 : _a.active;\r\n const ns = (_b = next.southPanel) === null || _b === void 0 ? void 0 : _b.active;\r\n const pnFile = prev.files.find(f => f.name === pn);\r\n const nnFile = next.files.find(f => f.name === nn);\r\n const psFile = ps\r\n ? prev.files.find(f => f.name === ps)\r\n : null;\r\n const nsFile = ns\r\n ? next.files.find(f => f.name === ns)\r\n : null;\r\n const oneToTwoSouth = !ps && pn === ns;\r\n if (oneToTwoSouth) {\r\n return {\r\n prevNorthFile: nnFile,\r\n nextNorthFile: nnFile,\r\n prevSouthFile: pnFile,\r\n nextSouthFile: nsFile,\r\n };\r\n }\r\n const twoToOneSouth = !ns && nn === ps;\r\n if (twoToOneSouth) {\r\n return {\r\n prevNorthFile: pnFile,\r\n nextNorthFile: pnFile,\r\n prevSouthFile: psFile,\r\n nextSouthFile: nnFile,\r\n };\r\n }\r\n const prevNorthFile = pn === nn ? pnFile : backward ? pnFile : nnFile;\r\n const nextNorthFile = pn === nn ? nnFile : backward ? pnFile : nnFile;\r\n const prevSouthFile = ps === ns\r\n ? psFile\r\n : backward\r\n ? psFile || nsFile\r\n : nsFile || psFile;\r\n const nextSouthFile = ps === ns\r\n ? nsFile\r\n : backward\r\n ? psFile || nsFile\r\n : nsFile || psFile;\r\n return {\r\n prevNorthFile,\r\n nextNorthFile,\r\n prevSouthFile,\r\n nextSouthFile,\r\n };\r\n}\r\nfunction getPanelStyles(prev, next, t) {\r\n // +---+---+\r\n // | x | x |\r\n // +---+---+\r\n // | | |\r\n // +---+---+\r\n if (prev.southHeight === null &&\r\n next.southHeight === null) {\r\n return {\r\n northStyle: {\r\n minHeight: prev.northHeight,\r\n },\r\n };\r\n }\r\n // +---+---+\r\n // | x | x |\r\n // +---+---+\r\n // | y | |\r\n // +---+---+\r\n if (prev.southHeight !== null &&\r\n next.southHeight === null &&\r\n next.northKey !== prev.southKey) {\r\n return {\r\n northStyle: {\r\n minHeight: tween(prev.northHeight, next.northHeight, t),\r\n },\r\n southStyle: {\r\n minHeight: prev.southHeight,\r\n },\r\n };\r\n }\r\n // +---+---+\r\n // | x | y |\r\n // +---+---+\r\n // | y | |\r\n // +---+---+\r\n if (prev.southHeight !== null &&\r\n next.southHeight === null &&\r\n prev.southKey === next.northKey) {\r\n return {\r\n northStyle: {\r\n minHeight: prev.northHeight,\r\n },\r\n southStyle: {\r\n position: \"relative\",\r\n minHeight: tween(prev.southHeight, next.northHeight, t),\r\n transform: `translateY(${tween(0, -(prev.northHeight + prev.titleBarHeight), t)}px)`,\r\n },\r\n };\r\n }\r\n // +---+---+\r\n // | x | x |\r\n // +---+---+\r\n // | | y |\r\n // +---+---+\r\n if (prev.southHeight === null &&\r\n next.southHeight !== null &&\r\n prev.northKey !== next.southKey) {\r\n return {\r\n northStyle: {\r\n minHeight: tween(prev.northHeight, next.northHeight, t),\r\n },\r\n southStyle: {\r\n position: \"relative\",\r\n minHeight: next.southHeight,\r\n },\r\n };\r\n }\r\n // +---+---+\r\n // | y | x |\r\n // +---+---+\r\n // | | y |\r\n // +---+---+\r\n if (prev.southHeight === null &&\r\n next.southHeight !== null &&\r\n prev.northKey === next.southKey) {\r\n return {\r\n northStyle: {\r\n minHeight: next.northHeight,\r\n },\r\n southStyle: {\r\n position: \"relative\",\r\n minHeight: tween(prev.northHeight, next.southHeight, t),\r\n transform: `translateY(${tween(-(next.northHeight + next.titleBarHeight), 0, t)}px)`,\r\n },\r\n };\r\n }\r\n // +---+---+\r\n // | x | x |\r\n // +---+---+\r\n // | y | y |\r\n // +---+---+\r\n return {\r\n northStyle: {\r\n minHeight: tween(prev.northHeight, next.northHeight, t),\r\n },\r\n southStyle: {\r\n minHeight: tween(prev.southHeight, next.southHeight, t),\r\n },\r\n };\r\n}\r\nfunction tween(a, b, t) {\r\n return a + (b - a) * t;\r\n}\r\nfunction getTabs(prevSnapshot, nextSnapshot, northActive, southActive, t) {\r\n // TODO simplify\r\n if (!prevSnapshot.southTabs &&\r\n isPresent(southActive, prevSnapshot.northTabs)) {\r\n /// one to two south\r\n return {\r\n northTabs: getPanelTabs(nextSnapshot.northTabs, nextSnapshot.southTabs, prevSnapshot.southTabs, prevSnapshot.northTabs, northActive, t),\r\n southTabs: getPanelTabs(nextSnapshot.southTabs, nextSnapshot.northTabs, prevSnapshot.northTabs, prevSnapshot.southTabs, southActive, t),\r\n };\r\n }\r\n if (!nextSnapshot.southTabs &&\r\n isPresent(southActive, nextSnapshot.northTabs)) {\r\n /// two to one south\r\n return {\r\n northTabs: getPanelTabs(nextSnapshot.southTabs, nextSnapshot.northTabs, prevSnapshot.northTabs, prevSnapshot.southTabs, northActive, t),\r\n southTabs: getPanelTabs(nextSnapshot.northTabs, nextSnapshot.southTabs, prevSnapshot.southTabs, prevSnapshot.northTabs, southActive, t),\r\n };\r\n }\r\n return {\r\n northTabs: getPanelTabs(nextSnapshot.northTabs, nextSnapshot.southTabs, prevSnapshot.northTabs, prevSnapshot.southTabs, northActive, t),\r\n southTabs: getPanelTabs(nextSnapshot.southTabs, nextSnapshot.northTabs, prevSnapshot.southTabs, prevSnapshot.northTabs, southActive, t),\r\n };\r\n}\r\nfunction getPanelTabs(nextSnapshot, otherNextSnapshot, prevSnapshot, otherPrevSnapshot, active, t) {\r\n // For each tab bar there are four types of tabs\r\n // - oldTabs: tabs that are present in both prev and next versions of the bar\r\n // - totallyNewTabs: tabs that are totally new (present in next\r\n // but not in any prev)\r\n // - migratingTabs: tabs that are come from the other bar (present\r\n // in next and in otherPrev)\r\n // - disappearingTabs: present in prev but not in next or otherNext\r\n const oldTabs = !nextSnapshot\r\n ? []\r\n : Object.keys(nextSnapshot)\r\n .filter(filename => isPresent(filename, prevSnapshot) ||\r\n !prevSnapshot)\r\n .map(filename => {\r\n const prev = prevSnapshot && prevSnapshot[filename];\r\n const next = nextSnapshot[filename];\r\n const dx = prev\r\n ? prev.left + (next.left - prev.left) * t\r\n : next.left;\r\n const width = prev\r\n ? prev.width + (next.width - prev.width) * t\r\n : next.width;\r\n return {\r\n active: filename === active,\r\n title: filename,\r\n style: {\r\n position: \"absolute\",\r\n transform: `translateX(${dx}px)`,\r\n width,\r\n },\r\n };\r\n });\r\n const totallyNewTabs = !nextSnapshot\r\n ? []\r\n : Object.keys(nextSnapshot)\r\n .filter(filename => prevSnapshot &&\r\n !isPresent(filename, prevSnapshot)\r\n // && !isPresent(filename, otherPrevSnapshot)\r\n )\r\n .map(filename => {\r\n const next = nextSnapshot[filename];\r\n return {\r\n active: filename === active,\r\n title: filename,\r\n style: {\r\n position: \"absolute\",\r\n transform: `translateX(${next.left}px)`,\r\n opacity: t,\r\n width: next.width,\r\n },\r\n };\r\n });\r\n !nextSnapshot\r\n ? []\r\n : Object.keys(nextSnapshot)\r\n .filter(filename => isPresent(filename, otherPrevSnapshot))\r\n .map(filename => {\r\n const prev = otherPrevSnapshot[filename];\r\n const next = nextSnapshot[filename];\r\n const dx = next.left - prev.left;\r\n return {\r\n active: filename === active,\r\n title: filename,\r\n style: {\r\n position: \"absolute\",\r\n transform: `translateX(${dx}px)`,\r\n },\r\n };\r\n });\r\n const disappearingTabs = !prevSnapshot\r\n ? []\r\n : Object.keys(prevSnapshot)\r\n .filter(filename => !isPresent(filename, nextSnapshot)\r\n // && !isPresent(filename, otherNextSnapshot)\r\n )\r\n .map(filename => {\r\n const prev = prevSnapshot[filename];\r\n return {\r\n active: filename === active,\r\n title: filename,\r\n style: {\r\n position: \"absolute\",\r\n opacity: 1 - t,\r\n transform: `translateX(${prev.left}px)`,\r\n width: prev.width,\r\n },\r\n };\r\n });\r\n return [\r\n ...totallyNewTabs,\r\n // ...migratingTabs,\r\n ...oldTabs,\r\n ...disappearingTabs,\r\n ];\r\n}\r\nfunction isPresent(filename, snapshot) {\r\n return snapshot && filename && filename in snapshot;\r\n}\r\n// snapshots\r\nconst useLayoutEffect$2 = typeof window !== \"undefined\"\r\n ? React.useLayoutEffect\r\n : React.useEffect;\r\nfunction useSnapshots(ref, prev, next) {\r\n const [{ prevSnapshot, nextSnapshot }, setState] = React.useState({\r\n prevSnapshot: null,\r\n nextSnapshot: null,\r\n });\r\n useLayoutEffect$2(() => {\r\n if (prevSnapshot || nextSnapshot) {\r\n setState({\r\n prevSnapshot: null,\r\n nextSnapshot: null,\r\n });\r\n }\r\n }, [prev, next]);\r\n useLayoutEffect$2(() => {\r\n if (!prevSnapshot) {\r\n const parent = ref.current;\r\n setState(s => (Object.assign(Object.assign({}, s), { prevSnapshot: Object.assign(Object.assign({}, getPanelSnapshot(parent, prev)), getTabsSnapshot(parent, prev)) })));\r\n }\r\n else if (!nextSnapshot) {\r\n const parent = ref.current;\r\n setState(s => (Object.assign(Object.assign({}, s), { nextSnapshot: Object.assign(Object.assign({}, getPanelSnapshot(parent, next)), getTabsSnapshot(parent, next)) })));\r\n }\r\n });\r\n return { prevSnapshot, nextSnapshot };\r\n}\r\nfunction getPanelSnapshot(parent, step) {\r\n var _a;\r\n const northElement = parent.querySelector(\"[data-ch-panel='north']\");\r\n const southElement = parent.querySelector(\"[data-ch-panel='south']\");\r\n const bar = parent.querySelector(\".ch-frame-title-bar\");\r\n return {\r\n titleBarHeight: bar.getBoundingClientRect().height,\r\n northHeight: northElement.getBoundingClientRect().height,\r\n northKey: step.northPanel.active,\r\n southHeight: (southElement === null || southElement === void 0 ? void 0 : southElement.getBoundingClientRect().height) || null,\r\n southKey: (_a = step.southPanel) === null || _a === void 0 ? void 0 : _a.active,\r\n };\r\n}\r\nfunction getTabsSnapshot(parent, step) {\r\n var _a;\r\n const northTabs = Array.from(parent.querySelectorAll(\"[data-ch-tab='north']\"));\r\n const southTabs = Array.from(parent.querySelectorAll(\"[data-ch-tab='south']\"));\r\n return {\r\n northTabs: getTabsDimensions(northTabs, step.northPanel.active),\r\n southTabs: getTabsDimensions(southTabs, (_a = step.southPanel) === null || _a === void 0 ? void 0 : _a.active),\r\n };\r\n}\r\nfunction getTabsDimensions(tabElements, active) {\r\n if (!tabElements[0]) {\r\n return null;\r\n }\r\n const parent = tabElements[0].parentElement;\r\n const parentLeft = parent.getBoundingClientRect().left;\r\n const dimensions = {};\r\n tabElements.forEach(child => {\r\n const filename = child.getAttribute(\"title\");\r\n const rect = child.getBoundingClientRect();\r\n dimensions[filename] = {\r\n left: rect.left - parentLeft,\r\n width: rect.width,\r\n active: filename === active,\r\n };\r\n });\r\n return dimensions;\r\n}\n\nfunction CodeBrowser({ files, theme, startingFileName, }) {\r\n const [activeFile, setActiveFile] = React.useState(() => files.find(f => f.name === startingFileName));\r\n return (React.createElement(\"div\", { className: \"ch-code-browser\", style: {\r\n color: getColor(theme, ColorName.EditorForeground),\r\n } },\r\n React.createElement(Sidebar, { files: files, theme: theme, activeFile: activeFile, setActiveFile: setActiveFile }),\r\n React.createElement(Content, { file: activeFile, theme: theme })));\r\n}\r\nfunction Sidebar({ theme, files, activeFile, setActiveFile, }) {\r\n const tree = React.useMemo(() => toFileTree(files), [files]);\r\n return (React.createElement(\"div\", { className: \"ch-code-browser-sidebar\", style: {\r\n borderColor: getColor(theme, ColorName.SideBarBorder),\r\n background: getColor(theme, ColorName.SideBarBackground),\r\n color: getColor(theme, ColorName.SideBarForeground),\r\n [\"--ch-list-selection-background\"]: getColor(theme, ColorName.ListActiveSelectionBackground),\r\n [\"--ch-list-selection-foreground\"]: getColor(theme, ColorName.ListActiveSelectionForeground),\r\n [\"--ch-hover-background\"]: getColor(theme, ColorName.ListHoverBackground),\r\n [\"--ch-hover-foreground\"]: getColor(theme, ColorName.ListHoverForeground),\r\n } },\r\n React.createElement(SidebarNodes, { tree: tree, activeFile: activeFile, setActiveFile: setActiveFile })));\r\n}\r\nfunction SidebarNodes({ tree, activeFile, setActiveFile, level = 0, }) {\r\n return (React.createElement(React.Fragment, null, tree.map(node => (React.createElement(SidebarNode, { key: node.name, node: node, activeFile: activeFile, setActiveFile: setActiveFile, level: level })))));\r\n}\r\nfunction SidebarNode({ node, activeFile, setActiveFile, level, }) {\r\n const isFolder = node.children && node.children.length > 0;\r\n const isSelected = node.codeFile === activeFile;\r\n if (isFolder) {\r\n return (React.createElement(\"div\", null,\r\n React.createElement(\"div\", { className: \"ch-code-browser-sidebar-folder\" },\r\n React.createElement(\"div\", { style: { paddingLeft: level * 1.5 + \"ch\" } }, node.name)),\r\n React.createElement(SidebarNodes, { tree: node.children, activeFile: activeFile, setActiveFile: setActiveFile, level: level + 1 })));\r\n }\r\n else {\r\n return (React.createElement(\"div\", null,\r\n React.createElement(\"div\", { className: \"ch-code-browser-sidebar-file\", onClick: () => setActiveFile(node.codeFile), style: isSelected\r\n ? {\r\n color: \"var(--ch-list-selection-foreground)\",\r\n background: \"var(--ch-list-selection-background)\",\r\n }\r\n : {} },\r\n React.createElement(\"div\", { style: { paddingLeft: level * 1.5 + \"ch\" } }, node.name))));\r\n }\r\n}\r\nfunction Content({ file, theme, }) {\r\n return (React.createElement(\"div\", { className: \"ch-code-browser-content\", style: {\r\n background: getColor(theme, ColorName.CodeBackground),\r\n color: getColor(theme, ColorName.CodeForeground),\r\n [\"--ch-selection-background\"]: getColor(theme, ColorName.SelectionBackground),\r\n colorScheme: getColorScheme(theme),\r\n } },\r\n React.createElement(CopyButton, { className: \"ch-code-browser-button\", content: codeToText(file.code) }),\r\n file.code.lines.map((line, i) => (React.createElement(\"div\", { key: i }, line.tokens.length === 0 ? (React.createElement(\"br\", null)) : (line.tokens.map((token, i) => (React.createElement(\"span\", Object.assign({ key: i }, token.props), token.content)))))))));\r\n}\r\nfunction toFileTree(files) {\r\n let tree = [];\r\n for (const file of files) {\r\n const parts = file.name.split(\"/\");\r\n let current = tree;\r\n for (let i = 0; i < parts.length; i++) {\r\n const part = parts[i];\r\n const isLastPart = i === parts.length - 1;\r\n const index = current.findIndex(f => f.name === part);\r\n if (index === -1) {\r\n const sub = {\r\n name: part,\r\n children: [],\r\n codeFile: undefined,\r\n };\r\n if (isLastPart) {\r\n sub.codeFile = file;\r\n }\r\n current.push(sub);\r\n current = sub.children;\r\n }\r\n else {\r\n current = current[index].children;\r\n }\r\n }\r\n }\r\n tree = sortTree(tree);\r\n return tree;\r\n}\r\nfunction sortTree(tree) {\r\n for (const child of tree) {\r\n child.children = sortTree(child.children);\r\n }\r\n return tree.sort((a, b) => {\r\n const aIsFolder = a.children && a.children.length > 0;\r\n const bIsFolder = b.children && b.children.length > 0;\r\n if ((aIsFolder && bIsFolder) ||\r\n (!aIsFolder && !bIsFolder)) {\r\n return a.name.localeCompare(b.name);\r\n }\r\n if (aIsFolder) {\r\n return -1;\r\n }\r\n return 1;\r\n });\r\n}\n\nfunction ExpandButton({ style, step, theme, className, }) {\r\n const [expanded, setExpanded] = React.useState(false);\r\n const [dialogSupported, setDialogSupported] = React.useState(true);\r\n const ref = React.useRef(null);\r\n const files = step.files;\r\n // check if <dialog /> is supported\r\n React.useEffect(() => {\r\n if (ref.current && !ref.current.showModal) {\r\n setDialogSupported(false);\r\n }\r\n }, []);\r\n if (!dialogSupported) {\r\n return null;\r\n }\r\n return (React.createElement(React.Fragment, null,\r\n React.createElement(ExpandIcon, { className: className, style: style, onClick: () => {\r\n ref.current.showModal();\r\n document.body.classList.add(\"ch-no-scroll\");\r\n setExpanded(true);\r\n } }),\r\n React.createElement(\"dialog\", { ref: ref, className: \"ch-expand-dialog\", onClose: () => {\r\n setExpanded(false);\r\n }, onClick: e => {\r\n if (e.currentTarget === e.target) {\r\n ref.current.close();\r\n document.body.classList.remove(\"ch-no-scroll\");\r\n }\r\n } },\r\n React.createElement(CloseButton, { onClick: () => {\r\n ref.current.close();\r\n document.body.classList.remove(\"ch-no-scroll\");\r\n } }),\r\n expanded ? (React.createElement(\"div\", { className: \"ch-expand-dialog-content\", style: {\r\n borderColor: getColor(theme, ColorName.SideBarBorder),\r\n } },\r\n React.createElement(CodeBrowser, { files: files, theme: theme, startingFileName: step.northPanel.active }))) : undefined)));\r\n}\r\nfunction ExpandIcon({ onClick, style, className, }) {\r\n return (React.createElement(\"svg\", { style: style, onClick: onClick, className: className, fill: \"none\", stroke: \"currentColor\", viewBox: \"0 0 24 24\", xmlns: \"http://www.w3.org/2000/svg\", role: \"button\" },\r\n React.createElement(\"title\", null, \"Expand\"),\r\n React.createElement(\"path\", { strokeLinecap: \"round\", strokeLinejoin: \"round\", strokeWidth: 2, d: \"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4\" })));\r\n}\r\nfunction CloseButton({ onClick }) {\r\n return (React.createElement(\"svg\", { onClick: onClick, className: \"ch-expand-close\", fill: \"none\", stroke: \"currentColor\", viewBox: \"0 0 24 24\", xmlns: \"http://www.w3.org/2000/svg\", role: \"button\" },\r\n React.createElement(\"title\", null, \"Close\"),\r\n React.createElement(\"path\", { strokeLinecap: \"round\", strokeLinejoin: \"round\", strokeWidth: 2, d: \"M6 18L18 6M6 6l12 12\" })));\r\n}\n\nconst DEFAULT_STEP = {\r\n files: [\r\n {\r\n code: { lines: [], lang: \"js\" },\r\n focus: \"\",\r\n name: \"\",\r\n },\r\n ],\r\n northPanel: { active: \"\", tabs: [\"\"], heightRatio: 1 },\r\n};\r\nfunction EditorTween(_a) {\r\n var { prev = DEFAULT_STEP, next, t, backward, codeConfig, frameProps = {} } = _a, divProps = __rest(_a, [\"prev\", \"next\", \"t\", \"backward\", \"codeConfig\", \"frameProps\"]);\r\n const ref = React.createRef();\r\n const { showCopyButton, showExpandButton } = codeConfig, config = __rest(codeConfig, [\"showCopyButton\", \"showExpandButton\"]);\r\n const { northPanel, southPanel, northContent, southContent, } = useTransition(ref, prev, next || prev, t, backward, config);\r\n const [frozenHeight, freezeHeight] = React.useState(undefined);\r\n useLayoutEffect$4(() => {\r\n var _a;\r\n const height = (_a = ref.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().height;\r\n freezeHeight(height);\r\n }, []);\r\n const framePropsWithHeight = Object.assign(Object.assign(Object.assign({}, frameProps), divProps), { style: Object.assign(Object.assign({}, frameProps === null || frameProps === void 0 ? void 0 : frameProps.style), divProps === null || divProps === void 0 ? void 0 : divProps.style) });\r\n if (frozenHeight) {\r\n framePropsWithHeight.style.height = frozenHeight;\r\n framePropsWithHeight.style.maxHeight = frozenHeight;\r\n }\r\n const northButtons = (React.createElement(React.Fragment, null,\r\n showCopyButton ? (React.createElement(CopyButton, { className: \"ch-editor-button\", content: northContent })) : undefined,\r\n showExpandButton ? (React.createElement(ExpandButton, { className: \"ch-editor-button\", step: next || prev, theme: codeConfig.theme })) : undefined));\r\n const southCopyButton = showCopyButton ? (React.createElement(CopyButton, { className: \"ch-editor-button\", content: southContent })) : undefined;\r\n const terminalPanel = (React.createElement(TerminalPanel, { prev: prev.terminal, next: (next || prev).terminal, t: t, backward: backward }));\r\n return (React.createElement(EditorFrame, Object.assign({ ref: ref }, framePropsWithHeight, { northPanel: northPanel, southPanel: southPanel, terminalPanel: terminalPanel, theme: codeConfig.theme, northButton: northButtons, southButton: southCopyButton })));\r\n}\n\nconst defaultSpring = {\r\n stiffness: 120,\r\n damping: 24,\r\n mass: 0.2,\r\n decimals: 3,\r\n};\r\nfunction EditorSpring(_a) {\r\n var { northPanel, southPanel, files, terminal, springConfig } = _a, props = __rest(_a, [\"northPanel\", \"southPanel\", \"files\", \"terminal\", \"springConfig\"]);\r\n const step = React.useMemo(() => {\r\n return {\r\n northPanel,\r\n southPanel,\r\n files,\r\n terminal,\r\n };\r\n }, [northPanel, southPanel, files, terminal]);\r\n const { prev, next, t } = useStepSpring(step, springConfig);\r\n return (React.createElement(EditorTween, Object.assign({ t: t, backward: false, prev: prev, next: next }, props)));\r\n}\r\nfunction useStepSpring(step, springConfig = defaultSpring) {\r\n const [{ target, steps, index }, setState] = React.useState({\r\n target: 2,\r\n steps: [step, step, step],\r\n index: 0,\r\n });\r\n React.useEffect(() => {\r\n const lastStep = steps[steps.length - 1];\r\n if (lastStep != step) {\r\n setState(s => updateStepSpring(s, step, progress));\r\n }\r\n }, [step]);\r\n const [progress] = useSpring(target, springConfig);\r\n const trioProgress = progress - index;\r\n const result = trioProgress <= 1\r\n ? {\r\n prev: steps[0],\r\n next: steps[1],\r\n t: trioProgress,\r\n }\r\n : {\r\n prev: steps[1],\r\n next: steps[2],\r\n t: trioProgress - 1,\r\n };\r\n return result;\r\n}\r\nfunction updateStepSpring(state, newStep, progress) {\r\n const { steps, target, index } = state;\r\n const stepsClone = steps.slice();\r\n const trioProgress = progress - index;\r\n if (trioProgress < 1) {\r\n stepsClone[2] = newStep;\r\n return Object.assign(Object.assign({}, state), { steps: stepsClone });\r\n }\r\n else {\r\n stepsClone[0] = steps[1];\r\n stepsClone[1] = steps[2];\r\n stepsClone[2] = newStep;\r\n return Object.assign(Object.assign({}, state), { steps: stepsClone, target: target + 1, index: index + 1 });\r\n }\r\n}\n\nfunction Code(props) {\r\n const [step, setStep] = React.useState(props);\r\n function onTabClick(filename) {\r\n const newStep = updateEditorStep(step, filename, null);\r\n setStep(Object.assign(Object.assign({}, step), newStep));\r\n }\r\n return React.createElement(InnerCode, Object.assign({}, step, { onTabClick: onTabClick }));\r\n}\r\n// build the CodeConfig from props and props.codeConfig\r\nfunction mergeCodeConfig(props) {\r\n var _a, _b, _c, _d, _e, _f, _g, _h, _j;\r\n const { lineNumbers, showCopyButton, showExpandButton, minZoom, maxZoom } = props, rest = __rest(props, [\"lineNumbers\", \"showCopyButton\", \"showExpandButton\", \"minZoom\", \"maxZoom\"]);\r\n const codeConfig = Object.assign(Object.assign({}, props.codeConfig), { maxZoom: maxZoom == null ? (_a = props.codeConfig) === null || _a === void 0 ? void 0 : _a.maxZoom : maxZoom, minZoom: minZoom == null ? (_b = props.codeConfig) === null || _b === void 0 ? void 0 : _b.minZoom : minZoom, horizontalCenter: (_d = (_c = props.codeConfig) === null || _c === void 0 ? void 0 : _c.horizontalCenter) !== null && _d !== void 0 ? _d : props.horizontalCenter, lineNumbers: lineNumbers == null\r\n ? (_e = props.codeConfig) === null || _e === void 0 ? void 0 : _e.lineNumbers\r\n : lineNumbers, showCopyButton: showCopyButton == null\r\n ? (_f = props.codeConfig) === null || _f === void 0 ? void 0 : _f.showCopyButton\r\n : showCopyButton, showExpandButton: showExpandButton == null\r\n ? (_g = props.codeConfig) === null || _g === void 0 ? void 0 : _g.showExpandButton\r\n : showExpandButton, rows: props.rows, debug: (_h = props.debug) !== null && _h !== void 0 ? _h : (_j = props.codeConfig) === null || _j === void 0 ? void 0 : _j.debug });\r\n return Object.assign(Object.assign({}, rest), { codeConfig });\r\n}\r\nfunction InnerCode(_a) {\r\n var { onTabClick } = _a, props = __rest(_a, [\"onTabClick\"]);\r\n const _b = mergeCodeConfig(props), { className, style, codeConfig } = _b, editorProps = __rest(_b, [\"className\", \"style\", \"codeConfig\"]);\r\n if (!props.southPanel &&\r\n props.files.length === 1 &&\r\n !props.files[0].name) {\r\n return (React.createElement(\"div\", { className: `ch-codeblock not-prose ${className || \"\"}`, style: style },\r\n React.createElement(CodeSpring, { className: \"ch-code\", config: codeConfig, step: editorProps.files[0] })));\r\n }\r\n else {\r\n const frameProps = Object.assign(Object.assign({}, editorProps === null || editorProps === void 0 ? void 0 : editorProps.frameProps), { onTabClick });\r\n return (React.createElement(\"div\", { className: `ch-codegroup not-prose ${className || \"\"}`, style: style },\r\n React.createElement(EditorSpring, Object.assign({}, editorProps, { frameProps: frameProps, codeConfig: codeConfig }))));\r\n }\r\n}\r\nfunction updateEditorStep(step, filename, focus) {\r\n const name = filename || step.northPanel.active;\r\n const newFiles = step.files.map((file) => file.name === name\r\n ? Object.assign(Object.assign({}, file), { focus: focus === null ? file.focus : focus }) : file);\r\n let northPanel = Object.assign({}, step.northPanel);\r\n let southPanel = step.southPanel && Object.assign({}, step.southPanel);\r\n if (step.northPanel.tabs.includes(name)) {\r\n northPanel.active = name;\r\n }\r\n else if (southPanel) {\r\n southPanel.active = name;\r\n }\r\n return { files: newFiles, northPanel, southPanel };\r\n}\n\nconst SectionContext = React.createContext({\r\n props: null,\r\n setFocus: () => { },\r\n});\r\nfunction Section(_a) {\r\n var { children, className, style } = _a, props = __rest(_a, [\"children\", \"className\", \"style\"]);\r\n const [state, setState] = React.useState(props);\r\n const resetFocus = () => setState(props);\r\n const setFocus = ({ fileName, focus, id, }) => {\r\n const newStep = updateEditorStep(state, fileName, focus);\r\n setState(Object.assign(Object.assign(Object.assign({}, state), newStep), { selectedId: id }));\r\n };\r\n const rest = __rest(state, [\"selectedId\"]);\r\n return (React.createElement(\"section\", { className: `ch-section ${className || \"\"}`, style: style },\r\n React.createElement(SectionContext.Provider, { value: {\r\n props: rest,\r\n setFocus,\r\n } },\r\n React.createElement(LinkableSection, { onActivation: setFocus, onReset: resetFocus }, children))));\r\n}\r\nfunction SectionCode(innerProps) {\r\n const { props, setFocus } = React.useContext(SectionContext);\r\n const onTabClick = (filename) => {\r\n setFocus({ fileName: filename, focus: null, id: \"\" });\r\n };\r\n return (React.createElement(InnerCode, Object.assign({}, innerProps, props, { onTabClick: onTabClick })));\r\n}\r\n// ---\r\nfunction SectionLink({ focus, file, children, id, }) {\r\n const { activate, reset, activatedId } = React.useContext(LinkableContext);\r\n const isSelected = activatedId === id;\r\n // const handleClick = isSelected\r\n // ? resetFocus\r\n // : () => setFocus({ fileName: file, focus, id })\r\n return (React.createElement(\"span\", { className: \"ch-section-link\", \"data-active\": isSelected, \r\n // onClick={handleClick}\r\n children: children, onMouseOver: () => activate({ fileName: file, focus, id }), onMouseOut: reset }));\r\n}\r\nconst LinkableContext = React.createContext({\r\n activatedId: undefined,\r\n activate: () => { },\r\n reset: () => { },\r\n});\r\nfunction LinkableSection({ onActivation, onReset, children, }) {\r\n const [activatedId, setActivatedId] = React.useState(undefined);\r\n const activate = React.useCallback(x => {\r\n setActivatedId(x.id);\r\n onActivation(x);\r\n }, [onActivation]);\r\n const reset = React.useCallback(() => {\r\n setActivatedId(undefined);\r\n onReset();\r\n }, [onReset]);\r\n return (React.createElement(LinkableContext.Provider, { value: {\r\n activate,\r\n reset,\r\n activatedId,\r\n } }, children));\r\n}\n\nfunction Back() {\r\n const c = useClasser(\"ch-browser\");\r\n return (React.createElement(\"svg\", { fill: \"currentColor\", preserveAspectRatio: \"xMidYMid meet\", height: \"1em\", viewBox: \"13 10 14 23\", className: c(\"button\", \"back-button\") },\r\n React.createElement(\"g\", null,\r\n React.createElement(\"path\", { d: \"m26.5 12.1q0 0.3-0.2 0.6l-8.8 8.7 8.8 8.8q0.2 0.2 0.2 0.5t-0.2 0.5l-1.1 1.1q-0.3 0.3-0.6 0.3t-0.5-0.3l-10.4-10.4q-0.2-0.2-0.2-0.5t0.2-0.5l10.4-10.4q0.3-0.2 0.5-0.2t0.6 0.2l1.1 1.1q0.2 0.2 0.2 0.5z\" }))));\r\n}\r\nfunction Forward() {\r\n const c = useClasser(\"ch-browser\");\r\n return (React.createElement(\"svg\", { fill: \"currentColor\", preserveAspectRatio: \"xMidYMid meet\", height: \"1em\", viewBox: \"13 10 14 23\", className: c(\"button\", \"forward-button\") },\r\n React.createElement(\"g\", null,\r\n React.createElement(\"path\", { d: \"m26.3 21.4q0 0.3-0.2 0.5l-10.4 10.4q-0.3 0.3-0.6 0.3t-0.5-0.3l-1.1-1.1q-0.2-0.2-0.2-0.5t0.2-0.5l8.8-8.8-8.8-8.7q-0.2-0.3-0.2-0.6t0.2-0.5l1.1-1.1q0.3-0.2 0.5-0.2t0.6 0.2l10.4 10.4q0.2 0.2 0.2 0.5z\" }))));\r\n}\r\nfunction Open({ href, style, }) {\r\n const c = useClasser(\"ch-browser\");\r\n return (React.createElement(\"a\", { className: c(\"button\", \"open-button\"), title: \"Open in new tab\", href: href, style: style, target: \"_blank\", rel: \"noopener noreferrer\" },\r\n React.createElement(\"svg\", { stroke: \"currentColor\", fill: \"currentColor\", strokeWidth: \"0\", viewBox: \"3 3 18 18\", height: \"1em\", width: \"1em\", className: c(\"open-icon\"), xmlns: \"http://www.w3.org/2000/svg\" },\r\n React.createElement(\"path\", { d: \"M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z\" }))));\r\n}\n\nfunction TitleBar({ url, linkUrl, theme, }) {\r\n const inputBorder = getColor(theme, ColorName.InputBorder);\r\n return (React.createElement(React.Fragment, null,\r\n React.createElement(FrameButtons, null),\r\n React.createElement(Back, null),\r\n React.createElement(Forward, null),\r\n React.createElement(\"input\", { value: url || \"\", readOnly: true, style: {\r\n background: getColor(theme, ColorName.InputBackground),\r\n color: getColor(theme, ColorName.InputForeground),\r\n border: inputBorder\r\n ? `1px solid ${inputBorder}`\r\n : undefined,\r\n } }),\r\n React.createElement(Open, { href: linkUrl, style: {\r\n color: getColor(theme, ColorName.EditorForeground),\r\n } })));\r\n}\n\nfunction useSteps$1(steps) {\r\n return React.useMemo(() => {\r\n if (!steps) {\r\n return [{ zoom: 1 }];\r\n }\r\n return steps.map(step => {\r\n const { displayUrl, loadUrl } = transformUrl(step.url, step.loadUrl, step.prependOrigin);\r\n return {\r\n zoom: step.zoom || 1,\r\n displayUrl,\r\n loadUrl,\r\n children: step.children,\r\n };\r\n });\r\n }, [steps]);\r\n}\r\nfunction transformUrl(url, loadUrl, prependOrigin) {\r\n const currentOrigin = typeof window !== \"undefined\" ? window.origin : \"\";\r\n const displayUrl = url && prependOrigin === true\r\n ? currentOrigin + url\r\n : url;\r\n return { displayUrl, loadUrl: loadUrl || displayUrl };\r\n}\n\nconst MiniBrowserHike = React.forwardRef(MiniBrowserWithRef);\r\nfunction MiniBrowserWithRef(_a, ref) {\r\n var { progress = 0, backward = false, steps: ogSteps, transition = \"none\", classes, theme } = _a, props = __rest(_a, [\"progress\", \"backward\", \"steps\", \"transition\", \"classes\", \"theme\"]);\r\n const c = useClasser(\"ch-mini-browser\", classes);\r\n const steps = useSteps$1(ogSteps);\r\n const stepIndex = Math.round(progress);\r\n const { zoom, displayUrl, loadUrl, children } = steps[stepIndex];\r\n return (React.createElement(MiniFrame, Object.assign({}, props, { zoom: zoom, className: `${c(\"\")} ${props.className || \"\"}`, style: Object.assign(Object.assign({}, transitionStyle({ progress, transition })), props.style), classes: classes, titleBar: React.createElement(TitleBar, { url: displayUrl, linkUrl: loadUrl, theme: theme }), theme: theme }), children || React.createElement(\"iframe\", { ref: ref, src: loadUrl })));\r\n}\r\nfunction transitionStyle({ progress, transition, }) {\r\n if (transition === \"slide\") {\r\n const X = 50;\r\n const t = progress - Math.floor(progress);\r\n const x = t <= 0.5 ? -X * t : X - X * t;\r\n const o = Math.abs(t - 0.5) * 2;\r\n return {\r\n transform: `translateX(${x}px)`,\r\n opacity: o * o,\r\n };\r\n }\r\n return {};\r\n}\n\nfunction MiniBrowser(_a) {\r\n var { url, loadUrl, prependOrigin, children, zoom } = _a, rest = __rest(_a, [\"url\", \"loadUrl\", \"prependOrigin\", \"children\", \"zoom\"]);\r\n const [steps, progress] = useSteps({\r\n url,\r\n loadUrl,\r\n prependOrigin,\r\n children,\r\n zoom,\r\n });\r\n return (React.createElement(MiniBrowserHike, Object.assign({}, rest, { steps: steps, progress: progress })));\r\n}\r\nfunction useSteps({ url, loadUrl, prependOrigin, children, zoom, }) {\r\n const [state, setState] = React.useState({\r\n target: 0,\r\n steps: [\r\n { url, loadUrl, prependOrigin, children, zoom },\r\n ],\r\n });\r\n React.useEffect(() => {\r\n const last = state.steps[state.steps.length - 1];\r\n if (last.url !== url ||\r\n last.loadUrl !== loadUrl ||\r\n last.prependOrigin !== prependOrigin ||\r\n last.children !== children) {\r\n setState(s => ({\r\n target: s.target + 1,\r\n steps: [\r\n ...s.steps,\r\n { url, loadUrl, prependOrigin, children, zoom },\r\n ],\r\n }));\r\n }\r\n }, [url, loadUrl, prependOrigin, children, zoom]);\r\n const [progress] = useSpring(state.target, {\r\n stiffness: 100,\r\n decimals: 3,\r\n });\r\n return [state.steps, progress];\r\n}\n\nvar commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};\n\nvar templates = {};\n\nObject.defineProperty(templates, \"__esModule\", { value: true });\nfunction getMainFile(template) {\n if (template === \"vue-cli\") {\n return \"src/main.js\";\n }\n if (template === \"angular-cli\") {\n return \"src/main.ts\";\n }\n if (template === \"create-react-app-typescript\") {\n return \"src/index.tsx\";\n }\n if (template === \"parcel\") {\n return \"index.html\";\n }\n if (template === \"gatsby\") {\n return \"src/pages/index.js\";\n }\n if (template === \"nuxt\") {\n // Wildcard, because nuxt is not specific on this\n return \"package.json\";\n }\n if (template === \"next\") {\n // Wildcard, because next is not specific on this\n return \"package.json\";\n }\n if (template === \"apollo\") {\n // Wildcard, because apollo is not specific on this\n return \"package.json\";\n }\n if (template === \"reason\") {\n // Wildcard, because reason is not specific on this\n return \"package.json\";\n }\n if (template === \"sapper\") {\n // Wildcard, because sapper is not specific on this\n return \"package.json\";\n }\n if (template === \"nest\") {\n return \"src/main.ts\";\n }\n if (template === \"static\") {\n return \"index.html\";\n }\n return \"src/index.js\";\n}\ntemplates.getMainFile = getMainFile;\nvar SANDBOX_CONFIG = \"sandbox.config.json\";\nfunction getTemplate(packageJSONPackage, modules) {\n var sandboxConfig = modules[SANDBOX_CONFIG] || modules[\"/\" + SANDBOX_CONFIG];\n if (sandboxConfig) {\n try {\n var config = JSON.parse(sandboxConfig.content);\n if (config.template) {\n return config.template;\n }\n }\n catch (e) { }\n }\n var _a = packageJSONPackage.dependencies, dependencies = _a === void 0 ? {} : _a, _b = packageJSONPackage.devDependencies, devDependencies = _b === void 0 ? {} : _b;\n var totalDependencies = Object.keys(dependencies).concat(Object.keys(devDependencies));\n var nuxt = [\"nuxt\", \"nuxt-edge\"];\n if (totalDependencies.some(function (dep) { return nuxt.indexOf(dep) > -1; })) {\n return \"nuxt\";\n }\n if (totalDependencies.indexOf(\"next\") > -1) {\n return \"next\";\n }\n var apollo = [\n \"apollo-server\",\n \"apollo-server-express\",\n \"apollo-server-hapi\",\n \"apollo-server-koa\",\n \"apollo-server-lambda\",\n \"apollo-server-micro\"\n ];\n if (totalDependencies.some(function (dep) { return apollo.indexOf(dep) > -1; })) {\n return \"apollo\";\n }\n if (totalDependencies.indexOf(\"ember-cli\") > -1) {\n return \"ember\";\n }\n if (totalDependencies.indexOf(\"sapper\") > -1) {\n return \"sapper\";\n }\n var moduleNames = Object.keys(modules);\n if (moduleNames.some(function (m) { return m.endsWith(\".vue\"); })) {\n return \"vue-cli\";\n }\n if (moduleNames.some(function (m) { return m.endsWith(\".re\"); })) {\n return \"reason\";\n }\n if (totalDependencies.indexOf(\"gatsby\") > -1) {\n return \"gatsby\";\n }\n if (totalDependencies.indexOf(\"parcel-bundler\") > -1) {\n return \"parcel\";\n }\n if (totalDependencies.indexOf(\"react-scripts\") > -1) {\n return \"create-react-app\";\n }\n if (totalDependencies.indexOf(\"react-scripts-ts\") > -1) {\n return \"create-react-app-typescript\";\n }\n if (totalDependencies.indexOf(\"@angular/core\") > -1) {\n return \"angular-cli\";\n }\n if (totalDependencies.indexOf(\"preact-cli\") > -1) {\n return \"preact-cli\";\n }\n if (totalDependencies.indexOf(\"svelte\") > -1) {\n return \"svelte\";\n }\n if (totalDependencies.indexOf(\"vue\") > -1) {\n return \"vue-cli\";\n }\n var dojo = [\"@dojo/core\", \"@dojo/framework\"];\n if (totalDependencies.some(function (dep) { return dojo.indexOf(dep) > -1; })) {\n return \"@dojo/cli-create-app\";\n }\n if (totalDependencies.indexOf(\"cx\") > -1) {\n return \"cxjs\";\n }\n if (totalDependencies.indexOf(\"@nestjs/core\") > -1 ||\n totalDependencies.indexOf(\"@nestjs/common\") > -1) {\n return \"nest\";\n }\n return undefined;\n}\nvar getTemplate_1 = templates.getTemplate = getTemplate;\n\nvar lodash_isequal = {exports: {}};\n\n/**\n * Lodash (Custom Build) <https://lodash.com/>\n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright JS Foundation and other contributors <https://js.foundation/>\n * Released under MIT license <https://lodash.com/license>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n(function (module, exports) {\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n asyncTag = '[object AsyncFunction]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n nullTag = '[object Null]',\n objectTag = '[object Object]',\n promiseTag = '[object Promise]',\n proxyTag = '[object Proxy]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]',\n undefinedTag = '[object Undefined]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/** Used to identify `toStringTag` values of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\ntypedArrayTags[errorTag] = typedArrayTags[funcTag] =\ntypedArrayTags[mapTag] = typedArrayTags[numberTag] =\ntypedArrayTags[objectTag] = typedArrayTags[regexpTag] =\ntypedArrayTags[setTag] = typedArrayTags[stringTag] =\ntypedArrayTags[weakMapTag] = false;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/** Detect free variable `exports`. */\nvar freeExports = exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Detect free variable `process` from Node.js. */\nvar freeProcess = moduleExports && freeGlobal.process;\n\n/** Used to access faster Node.js helpers. */\nvar nodeUtil = (function() {\n try {\n return freeProcess && freeProcess.binding && freeProcess.binding('util');\n } catch (e) {}\n}());\n\n/* Node.js helper references. */\nvar nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;\n\n/**\n * A specialized version of `_.filter` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\nfunction arrayFilter(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (predicate(value, index, array)) {\n result[resIndex++] = value;\n }\n }\n return result;\n}\n\n/**\n * Appends the elements of `values` to `array`.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to append.\n * @returns {Array} Returns `array`.\n */\nfunction arrayPush(array, values) {\n var index = -1,\n length = values.length,\n offset = array.length;\n\n while (++index < length) {\n array[offset + index] = values[index];\n }\n return array;\n}\n\n/**\n * A specialized version of `_.some` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n */\nfunction arraySome(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (predicate(array[index], index, array)) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\n/**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\nfunction baseUnary(func) {\n return function(value) {\n return func(value);\n };\n}\n\n/**\n * Checks if a `cache` value for `key` exists.\n *\n * @private\n * @param {Object} cache The cache to query.\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction cacheHas(cache, key) {\n return cache.has(key);\n}\n\n/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\n/**\n * Converts `map` to its key-value pairs.\n *\n * @private\n * @param {Object} map The map to convert.\n * @returns {Array} Returns the key-value pairs.\n */\nfunction mapToArray(map) {\n var index = -1,\n result = Array(map.size);\n\n map.forEach(function(value, key) {\n result[++index] = [key, value];\n });\n return result;\n}\n\n/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\n/**\n * Converts `set` to an array of its values.\n *\n * @private\n * @param {Object} set The set to convert.\n * @returns {Array} Returns the values.\n */\nfunction setToArray(set) {\n var index = -1,\n result = Array(set.size);\n\n set.forEach(function(value) {\n result[++index] = value;\n });\n return result;\n}\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype,\n funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined,\n Symbol = root.Symbol,\n Uint8Array = root.Uint8Array,\n propertyIsEnumerable = objectProto.propertyIsEnumerable,\n splice = arrayProto.splice,\n symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeGetSymbols = Object.getOwnPropertySymbols,\n nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,\n nativeKeys = overArg(Object.keys, Object);\n\n/* Built-in method references that are verified to be native. */\nvar DataView = getNative(root, 'DataView'),\n Map = getNative(root, 'Map'),\n Promise = getNative(root, 'Promise'),\n Set = getNative(root, 'Set'),\n WeakMap = getNative(root, 'WeakMap'),\n nativeCreate = getNative(Object, 'create');\n\n/** Used to detect maps, sets, and weakmaps. */\nvar dataViewCtorString = toSource(DataView),\n mapCtorString = toSource(Map),\n promiseCtorString = toSource(Promise),\n setCtorString = toSource(Set),\n weakMapCtorString = toSource(WeakMap);\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Hash(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\nfunction hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n}\n\n/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(key) {\n var result = this.has(key) && delete this.__data__[key];\n this.size -= result ? 1 : 0;\n return result;\n}\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n}\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);\n}\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\nfunction hashSet(key, value) {\n var data = this.__data__;\n this.size += this.has(key) ? 0 : 1;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n}\n\n// Add methods to `Hash`.\nHash.prototype.clear = hashClear;\nHash.prototype['delete'] = hashDelete;\nHash.prototype.get = hashGet;\nHash.prototype.has = hashHas;\nHash.prototype.set = hashSet;\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n}\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n --this.size;\n return true;\n}\n\n/**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n}\n\n/**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n}\n\n/**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\nfunction listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n ++this.size;\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = listCacheClear;\nListCache.prototype['delete'] = listCacheDelete;\nListCache.prototype.get = listCacheGet;\nListCache.prototype.has = listCacheHas;\nListCache.prototype.set = listCacheSet;\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n}\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n var result = getMapData(this, key)['delete'](key);\n this.size -= result ? 1 : 0;\n return result;\n}\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapCacheGet(key) {\n return getMapData(this, key).get(key);\n}\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return getMapData(this, key).has(key);\n}\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n var data = getMapData(this, key),\n size = data.size;\n\n data.set(key, value);\n this.size += data.size == size ? 0 : 1;\n return this;\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapCacheClear;\nMapCache.prototype['delete'] = mapCacheDelete;\nMapCache.prototype.get = mapCacheGet;\nMapCache.prototype.has = mapCacheHas;\nMapCache.prototype.set = mapCacheSet;\n\n/**\n *\n * Creates an array cache object to store unique values.\n *\n * @private\n * @constructor\n * @param {Array} [values] The values to cache.\n */\nfunction SetCache(values) {\n var index = -1,\n length = values == null ? 0 : values.length;\n\n this.__data__ = new MapCache;\n while (++index < length) {\n this.add(values[index]);\n }\n}\n\n/**\n * Adds `value` to the array cache.\n *\n * @private\n * @name add\n * @memberOf SetCache\n * @alias push\n * @param {*} value The value to cache.\n * @returns {Object} Returns the cache instance.\n */\nfunction setCacheAdd(value) {\n this.__data__.set(value, HASH_UNDEFINED);\n return this;\n}\n\n/**\n * Checks if `value` is in the array cache.\n *\n * @private\n * @name has\n * @memberOf SetCache\n * @param {*} value The value to search for.\n * @returns {number} Returns `true` if `value` is found, else `false`.\n */\nfunction setCacheHas(value) {\n return this.__data__.has(value);\n}\n\n// Add methods to `SetCache`.\nSetCache.prototype.add = SetCache.prototype.push = setCacheAdd;\nSetCache.prototype.has = setCacheHas;\n\n/**\n * Creates a stack cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Stack(entries) {\n var data = this.__data__ = new ListCache(entries);\n this.size = data.size;\n}\n\n/**\n * Removes all key-value entries from the stack.\n *\n * @private\n * @name clear\n * @memberOf Stack\n */\nfunction stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n}\n\n/**\n * Removes `key` and its value from the stack.\n *\n * @private\n * @name delete\n * @memberOf Stack\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction stackDelete(key) {\n var data = this.__data__,\n result = data['delete'](key);\n\n this.size = data.size;\n return result;\n}\n\n/**\n * Gets the stack value for `key`.\n *\n * @private\n * @name get\n * @memberOf Stack\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction stackGet(key) {\n return this.__data__.get(key);\n}\n\n/**\n * Checks if a stack value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Stack\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction stackHas(key) {\n return this.__data__.has(key);\n}\n\n/**\n * Sets the stack `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Stack\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the stack cache instance.\n */\nfunction stackSet(key, value) {\n var data = this.__data__;\n if (data instanceof ListCache) {\n var pairs = data.__data__;\n if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {\n pairs.push([key, value]);\n this.size = ++data.size;\n return this;\n }\n data = this.__data__ = new MapCache(pairs);\n }\n data.set(key, value);\n this.size = data.size;\n return this;\n}\n\n// Add methods to `Stack`.\nStack.prototype.clear = stackClear;\nStack.prototype['delete'] = stackDelete;\nStack.prototype.get = stackGet;\nStack.prototype.has = stackHas;\nStack.prototype.set = stackSet;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n var isArr = isArray(value),\n isArg = !isArr && isArguments(value),\n isBuff = !isArr && !isArg && isBuffer(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? baseTimes(value.length, String) : [],\n length = result.length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (\n // Safari 9 has enumerable `arguments.length` in strict mode.\n key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n isIndex(key, length)\n ))) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\n/**\n * The base implementation of `getAllKeys` and `getAllKeysIn` which uses\n * `keysFunc` and `symbolsFunc` to get the enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @param {Function} symbolsFunc The function to get the symbols of `object`.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction baseGetAllKeys(object, keysFunc, symbolsFunc) {\n var result = keysFunc(object);\n return isArray(object) ? result : arrayPush(result, symbolsFunc(object));\n}\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\n/**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\nfunction baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag;\n}\n\n/**\n * The base implementation of `_.isEqual` which supports partial comparisons\n * and tracks traversed objects.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Unordered comparison\n * 2 - Partial comparison\n * @param {Function} [customizer] The function to customize comparisons.\n * @param {Object} [stack] Tracks traversed `value` and `other` objects.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n */\nfunction baseIsEqual(value, other, bitmask, customizer, stack) {\n if (value === other) {\n return true;\n }\n if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {\n return value !== value && other !== other;\n }\n return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);\n}\n\n/**\n * A specialized version of `baseIsEqual` for arrays and objects which performs\n * deep comparisons and tracks traversed objects enabling objects with circular\n * references to be compared.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} [stack] Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {\n var objIsArr = isArray(object),\n othIsArr = isArray(other),\n objTag = objIsArr ? arrayTag : getTag(object),\n othTag = othIsArr ? arrayTag : getTag(other);\n\n objTag = objTag == argsTag ? objectTag : objTag;\n othTag = othTag == argsTag ? objectTag : othTag;\n\n var objIsObj = objTag == objectTag,\n othIsObj = othTag == objectTag,\n isSameTag = objTag == othTag;\n\n if (isSameTag && isBuffer(object)) {\n if (!isBuffer(other)) {\n return false;\n }\n objIsArr = true;\n objIsObj = false;\n }\n if (isSameTag && !objIsObj) {\n stack || (stack = new Stack);\n return (objIsArr || isTypedArray(object))\n ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)\n : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);\n }\n if (!(bitmask & COMPARE_PARTIAL_FLAG)) {\n var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),\n othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');\n\n if (objIsWrapped || othIsWrapped) {\n var objUnwrapped = objIsWrapped ? object.value() : object,\n othUnwrapped = othIsWrapped ? other.value() : other;\n\n stack || (stack = new Stack);\n return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);\n }\n }\n if (!isSameTag) {\n return false;\n }\n stack || (stack = new Stack);\n return equalObjects(object, other, bitmask, customizer, equalFunc, stack);\n}\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = isFunction(value) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\n/**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\nfunction baseIsTypedArray(value) {\n return isObjectLike(value) &&\n isLength(value.length) && !!typedArrayTags[baseGetTag(value)];\n}\n\n/**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * A specialized version of `baseIsEqualDeep` for arrays with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Array} array The array to compare.\n * @param {Array} other The other array to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `array` and `other` objects.\n * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.\n */\nfunction equalArrays(array, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n arrLength = array.length,\n othLength = other.length;\n\n if (arrLength != othLength && !(isPartial && othLength > arrLength)) {\n return false;\n }\n // Assume cyclic values are equal.\n var stacked = stack.get(array);\n if (stacked && stack.get(other)) {\n return stacked == other;\n }\n var index = -1,\n result = true,\n seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;\n\n stack.set(array, other);\n stack.set(other, array);\n\n // Ignore non-index properties.\n while (++index < arrLength) {\n var arrValue = array[index],\n othValue = other[index];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, arrValue, index, other, array, stack)\n : customizer(arrValue, othValue, index, array, other, stack);\n }\n if (compared !== undefined) {\n if (compared) {\n continue;\n }\n result = false;\n break;\n }\n // Recursively compare arrays (susceptible to call stack limits).\n if (seen) {\n if (!arraySome(other, function(othValue, othIndex) {\n if (!cacheHas(seen, othIndex) &&\n (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {\n return seen.push(othIndex);\n }\n })) {\n result = false;\n break;\n }\n } else if (!(\n arrValue === othValue ||\n equalFunc(arrValue, othValue, bitmask, customizer, stack)\n )) {\n result = false;\n break;\n }\n }\n stack['delete'](array);\n stack['delete'](other);\n return result;\n}\n\n/**\n * A specialized version of `baseIsEqualDeep` for comparing objects of\n * the same `toStringTag`.\n *\n * **Note:** This function only supports comparing values with tags of\n * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {string} tag The `toStringTag` of the objects to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {\n switch (tag) {\n case dataViewTag:\n if ((object.byteLength != other.byteLength) ||\n (object.byteOffset != other.byteOffset)) {\n return false;\n }\n object = object.buffer;\n other = other.buffer;\n\n case arrayBufferTag:\n if ((object.byteLength != other.byteLength) ||\n !equalFunc(new Uint8Array(object), new Uint8Array(other))) {\n return false;\n }\n return true;\n\n case boolTag:\n case dateTag:\n case numberTag:\n // Coerce booleans to `1` or `0` and dates to milliseconds.\n // Invalid dates are coerced to `NaN`.\n return eq(+object, +other);\n\n case errorTag:\n return object.name == other.name && object.message == other.message;\n\n case regexpTag:\n case stringTag:\n // Coerce regexes to strings and treat strings, primitives and objects,\n // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring\n // for more details.\n return object == (other + '');\n\n case mapTag:\n var convert = mapToArray;\n\n case setTag:\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG;\n convert || (convert = setToArray);\n\n if (object.size != other.size && !isPartial) {\n return false;\n }\n // Assume cyclic values are equal.\n var stacked = stack.get(object);\n if (stacked) {\n return stacked == other;\n }\n bitmask |= COMPARE_UNORDERED_FLAG;\n\n // Recursively compare objects (susceptible to call stack limits).\n stack.set(object, other);\n var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);\n stack['delete'](object);\n return result;\n\n case symbolTag:\n if (symbolValueOf) {\n return symbolValueOf.call(object) == symbolValueOf.call(other);\n }\n }\n return false;\n}\n\n/**\n * A specialized version of `baseIsEqualDeep` for objects with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction equalObjects(object, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n objProps = getAllKeys(object),\n objLength = objProps.length,\n othProps = getAllKeys(other),\n othLength = othProps.length;\n\n if (objLength != othLength && !isPartial) {\n return false;\n }\n var index = objLength;\n while (index--) {\n var key = objProps[index];\n if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {\n return false;\n }\n }\n // Assume cyclic values are equal.\n var stacked = stack.get(object);\n if (stacked && stack.get(other)) {\n return stacked == other;\n }\n var result = true;\n stack.set(object, other);\n stack.set(other, object);\n\n var skipCtor = isPartial;\n while (++index < objLength) {\n key = objProps[index];\n var objValue = object[key],\n othValue = other[key];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, objValue, key, other, object, stack)\n : customizer(objValue, othValue, key, object, other, stack);\n }\n // Recursively compare objects (susceptible to call stack limits).\n if (!(compared === undefined\n ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))\n : compared\n )) {\n result = false;\n break;\n }\n skipCtor || (skipCtor = key == 'constructor');\n }\n if (result && !skipCtor) {\n var objCtor = object.constructor,\n othCtor = other.constructor;\n\n // Non `Object` object instances with different constructors are not equal.\n if (objCtor != othCtor &&\n ('constructor' in object && 'constructor' in other) &&\n !(typeof objCtor == 'function' && objCtor instanceof objCtor &&\n typeof othCtor == 'function' && othCtor instanceof othCtor)) {\n result = false;\n }\n }\n stack['delete'](object);\n stack['delete'](other);\n return result;\n}\n\n/**\n * Creates an array of own enumerable property names and symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction getAllKeys(object) {\n return baseGetAllKeys(object, keys, getSymbols);\n}\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\n/**\n * Creates an array of the own enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\nvar getSymbols = !nativeGetSymbols ? stubArray : function(object) {\n if (object == null) {\n return [];\n }\n object = Object(object);\n return arrayFilter(nativeGetSymbols(object), function(symbol) {\n return propertyIsEnumerable.call(object, symbol);\n });\n};\n\n/**\n * Gets the `toStringTag` of `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nvar getTag = baseGetTag;\n\n// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.\nif ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||\n (Map && getTag(new Map) != mapTag) ||\n (Promise && getTag(Promise.resolve()) != promiseTag) ||\n (Set && getTag(new Set) != setTag) ||\n (WeakMap && getTag(new WeakMap) != weakMapTag)) {\n getTag = function(value) {\n var result = baseGetTag(value),\n Ctor = result == objectTag ? value.constructor : undefined,\n ctorString = Ctor ? toSource(Ctor) : '';\n\n if (ctorString) {\n switch (ctorString) {\n case dataViewCtorString: return dataViewTag;\n case mapCtorString: return mapTag;\n case promiseCtorString: return promiseTag;\n case setCtorString: return setTag;\n case weakMapCtorString: return weakMapTag;\n }\n }\n return result;\n };\n}\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n length = length == null ? MAX_SAFE_INTEGER : length;\n return !!length &&\n (typeof value == 'number' || reIsUint.test(value)) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\n/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n}\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\n/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nvar isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {\n return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&\n !propertyIsEnumerable.call(value, 'callee');\n};\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\n/**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\nvar isBuffer = nativeIsBuffer || stubFalse;\n\n/**\n * Performs a deep comparison between two values to determine if they are\n * equivalent.\n *\n * **Note:** This method supports comparing arrays, array buffers, booleans,\n * date objects, error objects, maps, numbers, `Object` objects, regexes,\n * sets, strings, symbols, and typed arrays. `Object` objects are compared\n * by their own, not inherited, enumerable properties. Functions and DOM\n * nodes are compared by strict equality, i.e. `===`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.isEqual(object, other);\n * // => true\n *\n * object === other;\n * // => false\n */\nfunction isEqual(value, other) {\n return baseIsEqual(value, other);\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\nvar isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n}\n\n/**\n * This method returns a new empty array.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {Array} Returns the new empty array.\n * @example\n *\n * var arrays = _.times(2, _.stubArray);\n *\n * console.log(arrays);\n * // => [[], []]\n *\n * console.log(arrays[0] === arrays[1]);\n * // => false\n */\nfunction stubArray() {\n return [];\n}\n\n/**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\nfunction stubFalse() {\n return false;\n}\n\nmodule.exports = isEqual;\n}(lodash_isequal, lodash_isequal.exports));\n\nvar isEqual = lodash_isequal.exports;\n\n// src/client.ts\n\n// src/file-resolver-protocol.ts\nvar generateId = () => Math.floor(Math.random() * 1e6 + Math.random() * 1e6);\nvar getConstructorName = (x) => {\n try {\n return x.constructor.name;\n } catch (e) {\n return \"\";\n }\n};\nvar Protocol = class {\n constructor(type, handleMessage, target) {\n this.type = type;\n this.handleMessage = handleMessage;\n this.target = target;\n this.outgoingMessages = new Set();\n this._messageListener = async (e) => {\n var _a;\n const { data } = e;\n if (data.$type !== this.getTypeId()) {\n return;\n }\n if (this.outgoingMessages.has(data.$id)) {\n return;\n }\n let returnMessage = {\n $originId: this.internalId,\n $type: this.getTypeId(),\n $id: data.$id\n };\n try {\n const result = await this.handleMessage(data.$data);\n returnMessage.$data = result;\n } catch (err) {\n if (!err.message) {\n console.error(err);\n }\n returnMessage.$error = { message: (_a = err.message) != null ? _a : \"Unknown error\" };\n }\n if (e.source) {\n e.source.postMessage(returnMessage, \"*\");\n } else {\n this._postMessage(returnMessage);\n }\n };\n this.createConnection();\n this.internalId = generateId();\n this.isWorker = getConstructorName(target) === \"Worker\";\n }\n getTypeId() {\n return `p-${this.type}`;\n }\n createConnection() {\n self.addEventListener(\"message\", this._messageListener);\n }\n dispose() {\n self.removeEventListener(\"message\", this._messageListener);\n }\n sendMessage(data) {\n return new Promise((resolve) => {\n const messageId = generateId();\n const message = {\n $originId: this.internalId,\n $type: this.getTypeId(),\n $data: data,\n $id: messageId\n };\n this.outgoingMessages.add(messageId);\n const listenFunction = (e) => {\n const { data: data2 } = e;\n if (data2.$type === this.getTypeId() && data2.$id === messageId && data2.$originId !== this.internalId) {\n resolve(data2.$data);\n self.removeEventListener(\"message\", listenFunction);\n }\n };\n self.addEventListener(\"message\", listenFunction);\n this._postMessage(message);\n });\n }\n _postMessage(m) {\n if (this.isWorker || typeof DedicatedWorkerGlobalScope !== \"undefined\" && this.target instanceof DedicatedWorkerGlobalScope) {\n this.target.postMessage(m);\n } else {\n this.target.postMessage(m, \"*\");\n }\n }\n};\n\n// src/iframe-protocol.ts\nvar IFrameProtocol = class {\n constructor(iframe, origin) {\n this.globalListeners = {};\n this.globalListenersCount = 0;\n this.channelListeners = {};\n this.channelListenersCount = 0;\n this.channelId = Math.floor(Math.random() * 1e6);\n this.frameWindow = iframe.contentWindow;\n this.origin = origin;\n this.globalListeners = [];\n this.channelListeners = [];\n this.eventListener = this.eventListener.bind(this);\n if (typeof window !== \"undefined\") {\n window.addEventListener(\"message\", this.eventListener);\n }\n }\n cleanup() {\n window.removeEventListener(\"message\", this.eventListener);\n this.globalListeners = {};\n this.channelListeners = {};\n this.globalListenersCount = 0;\n this.channelListenersCount = 0;\n }\n register() {\n if (!this.frameWindow) {\n return;\n }\n this.frameWindow.postMessage({\n type: \"register-frame\",\n origin: document.location.origin,\n id: this.channelId\n }, this.origin);\n }\n dispatch(message) {\n if (!this.frameWindow) {\n return;\n }\n this.frameWindow.postMessage({\n $id: this.channelId,\n codesandbox: true,\n ...message\n }, this.origin);\n }\n globalListen(listener) {\n if (typeof listener !== \"function\") {\n return () => {\n return;\n };\n }\n const listenerId = this.globalListenersCount;\n this.globalListeners[listenerId] = listener;\n this.globalListenersCount++;\n return () => {\n delete this.globalListeners[listenerId];\n };\n }\n channelListen(listener) {\n if (typeof listener !== \"function\") {\n return () => {\n return;\n };\n }\n const listenerId = this.channelListenersCount;\n this.channelListeners[listenerId] = listener;\n this.channelListenersCount++;\n return () => {\n delete this.channelListeners[listenerId];\n };\n }\n eventListener(evt) {\n if (evt.source !== this.frameWindow) {\n return;\n }\n const message = evt.data;\n if (!message.codesandbox) {\n return;\n }\n Object.values(this.globalListeners).forEach((listener) => listener(message));\n if (message.$id !== this.channelId) {\n return;\n }\n Object.values(this.channelListeners).forEach((listener) => listener(message));\n }\n};\n\n// src/utils.ts\nfunction createPackageJSON(dependencies = {}, devDependencies = {}, entry = \"/index.js\") {\n return JSON.stringify({\n name: \"sandpack-project\",\n main: entry,\n dependencies,\n devDependencies\n }, null, 2);\n}\nfunction addPackageJSONIfNeeded(files, dependencies, devDependencies, entry) {\n const newFiles = { ...files };\n if (!newFiles[\"/package.json\"]) {\n if (!dependencies) {\n throw new Error(\"No dependencies specified, please specify either a package.json or dependencies.\");\n }\n if (!entry) {\n throw new Error(\"Missing 'entry' parameter. Either specify an entry point, or pass in a package.json with the 'main' field set.\");\n }\n newFiles[\"/package.json\"] = {\n code: createPackageJSON(dependencies, devDependencies, entry)\n };\n }\n return newFiles;\n}\nfunction extractErrorDetails(msg) {\n if (msg.title === \"SyntaxError\") {\n const { title, path, message, line, column } = msg;\n return { title, path, message, line, column };\n }\n const relevantStackFrame = getRelevantStackFrame(msg.payload.frames);\n if (!relevantStackFrame) {\n return { message: msg.message };\n }\n const errorInCode = getErrorInOriginalCode(relevantStackFrame);\n const errorLocation = getErrorLocation(relevantStackFrame);\n const errorMessage = formatErrorMessage(relevantStackFrame._originalFileName, msg.message, errorLocation, errorInCode);\n return {\n message: errorMessage,\n title: msg.title,\n path: relevantStackFrame._originalFileName,\n line: relevantStackFrame._originalLineNumber,\n column: relevantStackFrame._originalColumnNumber\n };\n}\nfunction getRelevantStackFrame(frames) {\n if (!frames) {\n return;\n }\n return frames.find((frame) => !!frame._originalFileName);\n}\nfunction getErrorLocation(errorFrame) {\n return errorFrame ? ` (${errorFrame._originalLineNumber}:${errorFrame._originalColumnNumber})` : ``;\n}\nfunction getErrorInOriginalCode(errorFrame) {\n const lastScriptLine = errorFrame._originalScriptCode[errorFrame._originalScriptCode.length - 1];\n const numberOfLineNumberCharacters = lastScriptLine.lineNumber.toString().length;\n const leadingCharacterOffset = 2;\n const barSeparatorCharacterOffset = 3;\n const extraLineLeadingSpaces = leadingCharacterOffset + numberOfLineNumberCharacters + barSeparatorCharacterOffset + errorFrame._originalColumnNumber;\n return errorFrame._originalScriptCode.reduce((result, scriptLine) => {\n const leadingChar = scriptLine.highlight ? \">\" : \" \";\n const lineNumber = scriptLine.lineNumber.toString().length === numberOfLineNumberCharacters ? `${scriptLine.lineNumber}` : ` ${scriptLine.lineNumber}`;\n const extraLine = scriptLine.highlight ? \"\\n\" + \" \".repeat(extraLineLeadingSpaces) + \"^\" : \"\";\n return result + \"\\n\" + leadingChar + \" \" + lineNumber + \" | \" + scriptLine.content + extraLine;\n }, \"\");\n}\nfunction formatErrorMessage(filePath, message, location, errorInCode) {\n return `${filePath}: ${message}${location}\n${errorInCode}`;\n}\n\n// src/client.ts\nvar BUNDLER_URL = `https://${\"0.19.0\".replace(/\\./g, \"-\")}-sandpack.codesandbox.io/`;\nvar SandpackClient = class {\n constructor(selector, sandboxInfo, options = {}) {\n this.getTranspilerContext = () => new Promise((resolve) => {\n const unsubscribe = this.listen((message) => {\n if (message.type === \"transpiler-context\") {\n resolve(message.data);\n unsubscribe();\n }\n });\n this.dispatch({ type: \"get-transpiler-context\" });\n });\n var _a;\n this.options = options;\n this.sandboxInfo = sandboxInfo;\n this.bundlerURL = options.bundlerURL || BUNDLER_URL;\n this.bundlerState = void 0;\n this.errors = [];\n this.status = \"initializing\";\n if (typeof selector === \"string\") {\n this.selector = selector;\n const element = document.querySelector(selector);\n if (!element) {\n throw new Error(`No element found for selector '${selector}'`);\n }\n this.element = element;\n this.iframe = document.createElement(\"iframe\");\n this.initializeElement();\n } else {\n this.element = selector;\n this.iframe = selector;\n }\n if (!this.iframe.getAttribute(\"sandbox\")) {\n this.iframe.setAttribute(\"sandbox\", \"allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts\");\n }\n const urlSource = options.startRoute ? new URL(options.startRoute, this.bundlerURL).toString() : this.bundlerURL;\n (_a = this.iframe.contentWindow) == null ? void 0 : _a.location.replace(urlSource);\n this.iframeProtocol = new IFrameProtocol(this.iframe, this.bundlerURL);\n this.unsubscribeGlobalListener = this.iframeProtocol.globalListen((mes) => {\n if (mes.type !== \"initialized\" || !this.iframe.contentWindow) {\n return;\n }\n this.iframeProtocol.register();\n if (this.options.fileResolver) {\n this.fileResolverProtocol = new Protocol(\"file-resolver\", async (data) => {\n if (data.m === \"isFile\") {\n return this.options.fileResolver.isFile(data.p);\n }\n return this.options.fileResolver.readFile(data.p);\n }, this.iframe.contentWindow);\n }\n this.updatePreview(this.sandboxInfo, true);\n });\n this.unsubscribeChannelListener = this.iframeProtocol.channelListen((mes) => {\n switch (mes.type) {\n case \"start\": {\n this.errors = [];\n break;\n }\n case \"status\": {\n this.status = mes.status;\n break;\n }\n case \"action\": {\n if (mes.action === \"show-error\") {\n this.errors = [...this.errors, extractErrorDetails(mes)];\n }\n break;\n }\n case \"state\": {\n this.bundlerState = mes.state;\n break;\n }\n }\n });\n }\n cleanup() {\n this.unsubscribeChannelListener();\n this.unsubscribeGlobalListener();\n this.iframeProtocol.cleanup();\n }\n updateOptions(options) {\n if (!isEqual(this.options, options)) {\n this.options = options;\n this.updatePreview();\n }\n }\n updatePreview(sandboxInfo = this.sandboxInfo, isInitializationCompile) {\n var _a, _b, _c, _d;\n this.sandboxInfo = {\n ...this.sandboxInfo,\n ...sandboxInfo\n };\n const files = this.getFiles();\n const modules = Object.keys(files).reduce((prev, next) => ({\n ...prev,\n [next]: {\n code: files[next].code,\n path: next\n }\n }), {});\n let packageJSON = JSON.parse(createPackageJSON(this.sandboxInfo.dependencies, this.sandboxInfo.devDependencies, this.sandboxInfo.entry));\n try {\n packageJSON = JSON.parse(files[\"/package.json\"].code);\n } catch (e) {\n console.error(\"Could not parse package.json file: \" + e.message);\n }\n const normalizedModules = Object.keys(files).reduce((prev, next) => ({\n ...prev,\n [next]: {\n content: files[next].code,\n path: next\n }\n }), {});\n this.dispatch({\n type: \"compile\",\n codesandbox: true,\n version: 3,\n isInitializationCompile,\n modules,\n reactDevTools: this.options.reactDevTools,\n externalResources: this.options.externalResources || [],\n hasFileResolver: Boolean(this.options.fileResolver),\n disableDependencyPreprocessing: this.sandboxInfo.disableDependencyPreprocessing,\n template: this.sandboxInfo.template || getTemplate_1(packageJSON, normalizedModules),\n showOpenInCodeSandbox: (_a = this.options.showOpenInCodeSandbox) != null ? _a : true,\n showErrorScreen: (_b = this.options.showErrorScreen) != null ? _b : true,\n showLoadingScreen: (_c = this.options.showLoadingScreen) != null ? _c : true,\n skipEval: this.options.skipEval || false,\n clearConsoleDisabled: !this.options.clearConsoleOnFirstCompile,\n logLevel: (_d = this.options.logLevel) != null ? _d : SandpackLogLevel.Info\n });\n }\n dispatch(message) {\n this.iframeProtocol.dispatch(message);\n }\n listen(listener) {\n return this.iframeProtocol.channelListen(listener);\n }\n getCodeSandboxURL() {\n const files = this.getFiles();\n const paramFiles = Object.keys(files).reduce((prev, next) => ({\n ...prev,\n [next.replace(\"/\", \"\")]: {\n content: files[next].code,\n isBinary: false\n }\n }), {});\n return fetch(\"https://codesandbox.io/api/v1/sandboxes/define?json=1\", {\n method: \"POST\",\n body: JSON.stringify({ files: paramFiles }),\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\"\n }\n }).then((x) => x.json()).then((res) => ({\n sandboxId: res.sandbox_id,\n editorUrl: `https://codesandbox.io/s/${res.sandbox_id}`,\n embedUrl: `https://codesandbox.io/embed/${res.sandbox_id}`\n }));\n }\n getFiles() {\n const { sandboxInfo } = this;\n if (sandboxInfo.files[\"/package.json\"] === void 0) {\n return addPackageJSONIfNeeded(sandboxInfo.files, sandboxInfo.dependencies, sandboxInfo.devDependencies, sandboxInfo.entry);\n }\n return this.sandboxInfo.files;\n }\n initializeElement() {\n this.iframe.style.border = \"0\";\n this.iframe.style.width = this.options.width || \"100%\";\n this.iframe.style.height = this.options.height || \"100%\";\n this.iframe.style.overflow = \"hidden\";\n if (!this.element.parentNode) {\n throw new Error(\"Given element does not have a parent.\");\n }\n this.element.parentNode.replaceChild(this.iframe, this.element);\n }\n};\n\n// src/types.ts\nvar SandpackLogLevel;\n(function(SandpackLogLevel2) {\n SandpackLogLevel2[SandpackLogLevel2[\"None\"] = 0] = \"None\";\n SandpackLogLevel2[SandpackLogLevel2[\"Error\"] = 10] = \"Error\";\n SandpackLogLevel2[SandpackLogLevel2[\"Warning\"] = 20] = \"Warning\";\n SandpackLogLevel2[SandpackLogLevel2[\"Info\"] = 30] = \"Info\";\n SandpackLogLevel2[SandpackLogLevel2[\"Debug\"] = 40] = \"Debug\";\n})(SandpackLogLevel || (SandpackLogLevel = {}));\n\nfunction Preview(_a) {\r\n var { className, files, presetConfig, show, children, codeConfig, style, frameless } = _a, rest = __rest(_a, [\"className\", \"files\", \"presetConfig\", \"show\", \"children\", \"codeConfig\", \"style\", \"frameless\"]);\r\n const kids = presetConfig ? (React.createElement(SandpackPreview, { files: files, presetConfig: presetConfig })) : (children);\r\n return (React.createElement(\"div\", { className: \"ch-preview\" + (className ? \" \" + className : \"\"), style: style }, frameless ? (kids) : (React.createElement(MiniBrowser, Object.assign({ loadUrl: show, theme: codeConfig.theme }, rest, { children: kids })))));\r\n}\r\nfunction SandpackPreview({ files, presetConfig, }) {\r\n const iframeRef = React.useRef(null);\r\n const clientRef = React.useRef(null);\r\n React.useEffect(() => {\r\n clientRef.current = new SandpackClient(iframeRef.current, Object.assign(Object.assign({}, presetConfig), { files: mergeFiles(presetConfig.files, files) }), {\r\n showOpenInCodeSandbox: false,\r\n // showErrorScreen: false,\r\n // showLoadingScreen: false,\r\n });\r\n }, []);\r\n React.useEffect(() => {\r\n if (clientRef.current) {\r\n clientRef.current.updatePreview(Object.assign(Object.assign({}, presetConfig), { files: mergeFiles(presetConfig.files, files) }));\r\n }\r\n }, [files]);\r\n return React.createElement(\"iframe\", { ref: iframeRef });\r\n}\r\nfunction mergeFiles(csbFiles, chFiles) {\r\n const result = Object.assign({}, csbFiles);\r\n chFiles.forEach(file => {\r\n result[\"/\" + file.name] = {\r\n code: file.code.lines\r\n .map(l => l.tokens.map(t => t.content).join(\"\"))\r\n .join(\"\\n\"),\r\n };\r\n });\r\n return result;\r\n}\n\nfunction extractPreviewSteps(children, hasPreviewSteps) {\r\n const allChildren = React.Children.toArray(children);\r\n const stepsChildren = hasPreviewSteps\r\n ? allChildren.slice(0, allChildren.length / 2)\r\n : allChildren;\r\n const previewChildren = hasPreviewSteps\r\n ? allChildren.slice(allChildren.length / 2)\r\n : undefined;\r\n return { stepsChildren, previewChildren };\r\n}\n\nfunction Spotlight(_a) {\r\n var _b;\r\n var { children, editorSteps, codeConfig, start = 0, presetConfig, className, style, hasPreviewSteps } = _a, rest = __rest(_a, [\"children\", \"editorSteps\", \"codeConfig\", \"start\", \"presetConfig\", \"className\", \"style\", \"hasPreviewSteps\"]);\r\n const { stepsChildren, previewChildren } = extractPreviewSteps(children, hasPreviewSteps);\r\n const withPreview = presetConfig || hasPreviewSteps;\r\n const [state, setState] = React.useState({\r\n stepIndex: start,\r\n step: editorSteps[start],\r\n });\r\n const tab = state.step;\r\n function onTabClick(filename) {\r\n const newStep = updateEditorStep(state.step, filename, null);\r\n setState(Object.assign(Object.assign({}, state), { step: newStep }));\r\n }\r\n const headerElement = stepsChildren[0];\r\n return (React.createElement(\"section\", { className: `ch-spotlight ${withPreview ? \"ch-spotlight-with-preview\" : \"\"} ${className || \"\"}`, style: style },\r\n React.createElement(\"div\", { className: \"ch-spotlight-tabs\" },\r\n ((_b = headerElement === null || headerElement === void 0 ? void 0 : headerElement.props) === null || _b === void 0 ? void 0 : _b.children) ? (React.createElement(\"div\", null, stepsChildren[0])) : null,\r\n stepsChildren.map((children, i) => i === 0 ? null : (React.createElement(\"div\", { key: i, onClick: () => setState({\r\n stepIndex: i,\r\n step: editorSteps[i],\r\n }), className: \"ch-spotlight-tab\", \"data-selected\": i === state.stepIndex ? \"true\" : undefined }, children)))),\r\n React.createElement(\"div\", { className: \"ch-spotlight-sticker\" },\r\n React.createElement(InnerCode, Object.assign({}, rest, tab, { codeConfig: codeConfig, onTabClick: onTabClick })),\r\n presetConfig ? (React.createElement(Preview, { className: \"ch-spotlight-preview\", files: tab.files, presetConfig: presetConfig, codeConfig: codeConfig })) : hasPreviewSteps ? (React.createElement(Preview, Object.assign({ className: \"ch-spotlight-preview\" }, previewChildren[state.stepIndex][\"props\"]))) : null)));\r\n}\n\nfunction debugEntries(entries) {\r\n entries.forEach(showEntry);\r\n}\r\nfunction showEntry(entry) {\r\n var _a;\r\n const rootHeight = ((_a = entry.rootBounds) === null || _a === void 0 ? void 0 : _a.height) || 0;\r\n addFlashingRect(entry.rootBounds, {\r\n border: `${Math.min(10, rootHeight / 2)}px solid ${iodOptions.rootColor}`,\r\n overflow: \"hidden\",\r\n boxSizing: \"border-box\",\r\n });\r\n addFlashingRect(entry.boundingClientRect, {\r\n border: `${Math.min(10, entry.boundingClientRect.height / 2)}px solid ${entry.isIntersecting\r\n ? iodOptions.enterColor\r\n : iodOptions.exitColor}`,\r\n overflow: \"hidden\",\r\n boxSizing: \"border-box\",\r\n });\r\n addFlashingRect(entry.intersectionRect, {\r\n backgroundColor: iodOptions.interColor,\r\n zIndex: 2,\r\n });\r\n}\r\nfunction addFlashingRect(bounds, style = {}) {\r\n const { width, left, height, top } = bounds;\r\n const div = document.createElement(\"div\");\r\n div.style.position = \"fixed\";\r\n div.style.width = width + \"px\";\r\n div.style.left = left + \"px\";\r\n div.style.top = top + \"px\";\r\n div.style.height = height + \"px\";\r\n div.style.pointerEvents = \"none\";\r\n div.style.transition = \"opacity 2s ease-in\";\r\n Object.assign(div.style, style);\r\n requestAnimationFrame(() => requestAnimationFrame(() => {\r\n div.style.opacity = \"0\";\r\n }));\r\n div.addEventListener(\"transitionend\", () => {\r\n document.body.removeChild(div);\r\n });\r\n document.body.appendChild(div);\r\n return div;\r\n}\r\nconst iodOptions = {\r\n rootColor: \"#9428AB\",\r\n enterColor: \"#B35C00\",\r\n exitColor: \"#035570\",\r\n interColor: \"#9CAF00BB\",\r\n};\n\nconst useLayoutEffect$1 = typeof window !== \"undefined\"\r\n ? React.useLayoutEffect\r\n : React.useEffect;\r\nfunction useWindowHeight() {\r\n const isClient = typeof window === \"object\";\r\n function getHeight() {\r\n return isClient\r\n ? document.documentElement.clientHeight\r\n : undefined;\r\n }\r\n const [windowHeight, setWindowHeight] = React.useState(getHeight);\r\n React.useEffect(() => {\r\n function handleResize() {\r\n setWindowHeight(getHeight());\r\n }\r\n window.addEventListener(\"resize\", handleResize);\r\n return () => window.removeEventListener(\"resize\", handleResize);\r\n }, []);\r\n useLayoutEffect$1(() => {\r\n // FIX when a horizontal scrollbar is added after the first layout\r\n setWindowHeight(getHeight());\r\n }, []);\r\n return windowHeight;\r\n}\n\nconst ObserverContext = React.createContext(undefined);\r\nconst useLayoutEffect = typeof window !== \"undefined\"\r\n ? React.useLayoutEffect\r\n : React.useEffect;\r\nfunction Scroller({ onStepChange, children, getRootMargin = defaultRootMargin, debug = false, }) {\r\n const [observer, setObserver,] = React.useState();\r\n const vh = useWindowHeight();\r\n useLayoutEffect(() => {\r\n const windowHeight = vh || 0;\r\n const handleIntersect = entries => {\r\n if (debug || window.chDebugScroller) {\r\n debugEntries(entries);\r\n }\r\n entries.forEach(entry => {\r\n if (entry.intersectionRatio > 0) {\r\n const stepElement = entry.target;\r\n onStepChange(+stepElement.stepIndex);\r\n }\r\n });\r\n };\r\n const observer = newIntersectionObserver(handleIntersect, getRootMargin(windowHeight));\r\n setObserver(observer);\r\n return () => observer.disconnect();\r\n }, [vh]);\r\n return (React.createElement(ObserverContext.Provider, { value: observer }, children));\r\n}\r\nfunction Step(_a) {\r\n var { as = \"section\", index } = _a, props = __rest(_a, [\"as\", \"index\"]);\r\n const ref = React.useRef(null);\r\n const observer = React.useContext(ObserverContext);\r\n useLayoutEffect(() => {\r\n if (observer) {\r\n observer.observe(ref.current);\r\n }\r\n return () => observer && observer.unobserve(ref.current);\r\n }, [observer]);\r\n useLayoutEffect(() => {\r\n const stepElement = ref.current;\r\n stepElement.stepIndex = index;\r\n }, [index]);\r\n return React.createElement(as, Object.assign(Object.assign({}, props), { ref }));\r\n}\r\nfunction newIntersectionObserver(handleIntersect, rootMargin) {\r\n return new IntersectionObserver(handleIntersect, {\r\n rootMargin,\r\n threshold: 0.000001,\r\n root: null,\r\n });\r\n}\r\nfunction defaultRootMargin(vh) {\r\n return `-${vh / 2 - 2}px 0px`;\r\n}\n\n// server-side-media-queries-for-react\r\nlet suffixCounter = 0;\r\n/**\r\n * @typedef SwapProps\r\n * @prop {[string, JSX.Element][]} match\r\n */\r\n/**\r\n * Swap between different components depending on the media queries\r\n * @param {SwapProps} props\r\n */\r\nfunction Swap({ match }) {\r\n const queries = match.map(([q]) => q);\r\n const { isServer, matchedIndex } = useMedia(queries);\r\n const mainClassName = isServer\r\n ? \"ssmq-\" + suffixCounter++\r\n : \"\";\r\n return isServer ? (React.createElement(React.Fragment, null,\r\n React.createElement(\"style\", { className: mainClassName, dangerouslySetInnerHTML: {\r\n __html: getStyle(queries, mainClassName),\r\n } }),\r\n match.map(([query, element]) => (React.createElement(\"div\", { key: query, className: `${mainClassName} ${getClassName(query)}` }, element))),\r\n React.createElement(\"script\", { className: mainClassName, dangerouslySetInnerHTML: {\r\n __html: getScript(match, mainClassName),\r\n } }))) : (React.createElement(React.Fragment, null,\r\n React.createElement(\"div\", null, match[matchedIndex][1])));\r\n}\r\nfunction getStyle(queries, mainClass) {\r\n const reversedQueries = queries.slice().reverse();\r\n const style = reversedQueries\r\n .map(query => {\r\n const currentStyle = `.${mainClass}.${getClassName(query)}{display:block}`;\r\n const otherStyle = `.${mainClass}:not(.${getClassName(query)}){display: none;}`;\r\n if (query === \"default\") {\r\n return `${currentStyle}${otherStyle}`;\r\n }\r\n else {\r\n return `@media ${query}{${currentStyle}${otherStyle}}`;\r\n }\r\n })\r\n .join(\"\\n\");\r\n return style;\r\n}\r\nfunction getScript(match, mainClass) {\r\n const queries = match.map(([query]) => query);\r\n const classes = queries.map(getClassName);\r\n return `(function() {\n var qs = ${JSON.stringify(queries)};\n var clss = ${JSON.stringify(classes)};\n var mainCls = \"${mainClass}\";\n\n var scrEls = document.getElementsByTagName(\"script\");\n var scrEl = scrEls[scrEls.length - 1];\n var parent = scrEl.parentNode;\n\n var el = null;\n for (var i = 0; i < qs.length - 1; i++) {\n if (window.matchMedia(qs[i]).matches) {\n el = parent.querySelector(\":scope > .\" + mainCls + \".\" + clss[i]);\n break;\n }\n }\n if (!el) {\n var defaultClass = clss.pop();\n el = parent.querySelector(\":scope > .\" + mainCls + \".\" + defaultClass);\n }\n el.removeAttribute(\"class\");\n\n parent.querySelectorAll(\":scope > .\" + mainCls).forEach(function (e) {\n parent.removeChild(e);\n });\n})();`;\r\n}\r\nfunction getClassName(string) {\r\n return (\"ssmq-\" +\r\n string\r\n .replace(/[!\\\"#$%&'\\(\\)\\*\\+,\\.\\/:;<=>\\?\\@\\[\\\\\\]\\^`\\{\\|\\}~\\s]/g, \"\")\r\n .toLowerCase());\r\n}\r\nfunction useMedia(queries) {\r\n const isServer = typeof window === \"undefined\";\r\n const allQueries = queries.slice(0, -1);\r\n if (queries[queries.length - 1] !== \"default\") {\r\n console.warn(\"last media query should be 'default'\");\r\n }\r\n const [, setValue] = React.useState(0);\r\n const mediaQueryLists = isServer\r\n ? []\r\n : allQueries.map(q => window.matchMedia(q));\r\n React.useEffect(() => {\r\n const handler = () => setValue(x => x + 1);\r\n mediaQueryLists.forEach(mql => mql.addListener(handler));\r\n return () => mediaQueryLists.forEach(mql => mql.removeListener(handler));\r\n }, []);\r\n const matchedIndex = mediaQueryLists.findIndex(mql => mql.matches);\r\n return {\r\n isServer,\r\n matchedIndex: matchedIndex < 0 ? queries.length - 1 : matchedIndex,\r\n };\r\n}\n\nfunction CodeSlot() {\r\n const context = React.useContext(StaticStepContext);\r\n if (!context) {\r\n return null;\r\n }\r\n return React.createElement(InnerCodeSlot, Object.assign({}, context));\r\n}\r\nfunction InnerCodeSlot({ editorStep, setFocus }) {\r\n const onTabClick = (filename) => {\r\n setFocus({ fileName: filename, focus: null, id: \"\" });\r\n };\r\n const props = __rest(editorStep, [\"preset\", \"presetConfig\"]);\r\n return React.createElement(InnerCode, Object.assign({}, props, { onTabClick: onTabClick }));\r\n}\r\nfunction PreviewSlot() {\r\n const context = React.useContext(StaticStepContext);\r\n if (!context) {\r\n return null;\r\n }\r\n return React.createElement(InnerPreviewSlot, Object.assign({}, context));\r\n}\r\nfunction InnerPreviewSlot({ previewStep, allProps, editorStep, }) {\r\n const props = __rest(allProps, [\"preset\"]);\r\n return (React.createElement(Preview, Object.assign({ className: \"ch-scrollycoding-preview\" }, props, previewStep === null || previewStep === void 0 ? void 0 : previewStep.props, { files: editorStep.files })));\r\n}\r\nconst StaticStepContext = React.createContext(null);\n\nfunction Scrollycoding(props) {\r\n return (React.createElement(Swap, { match: [\r\n [\r\n props.codeConfig.staticMediaQuery,\r\n React.createElement(StaticScrollycoding, Object.assign({}, props)),\r\n ],\r\n [\"default\", React.createElement(DynamicScrollycoding, Object.assign({}, props))],\r\n ] }));\r\n}\r\nfunction StaticScrollycoding(_a) {\r\n var { children, hasPreviewSteps, editorSteps } = _a, rest = __rest(_a, [\"children\", \"hasPreviewSteps\", \"editorSteps\"]);\r\n const { stepsChildren, previewChildren } = extractPreviewSteps(children, hasPreviewSteps);\r\n return (React.createElement(\"section\", { className: `ch-scrollycoding-static` }, stepsChildren.map((children, i) => (React.createElement(StaticSection, { key: i, editorStep: editorSteps[i], previewStep: previewChildren && previewChildren[i], allProps: rest }, children)))));\r\n}\r\nfunction StaticSection({ editorStep, previewStep, allProps, children, }) {\r\n const [step, setStep] = React.useState(Object.assign(Object.assign({}, editorStep), allProps));\r\n const resetFocus = () => setStep(Object.assign(Object.assign({}, editorStep), allProps));\r\n const setFocus = ({ fileName, focus, id, }) => {\r\n const newStep = updateEditorStep(step, fileName, focus);\r\n setStep(Object.assign(Object.assign(Object.assign({}, step), newStep), { selectedId: id }));\r\n };\r\n return (React.createElement(StaticStepContext.Provider, { value: {\r\n editorStep: step,\r\n previewStep: previewStep,\r\n allProps,\r\n setFocus,\r\n } },\r\n React.createElement(LinkableSection, { onActivation: setFocus, onReset: resetFocus }, children)));\r\n}\r\nfunction DynamicScrollycoding(_a) {\r\n var { children, editorSteps, codeConfig, presetConfig, start = 0, className, style, hasPreviewSteps } = _a, rest = __rest(_a, [\"children\", \"editorSteps\", \"codeConfig\", \"presetConfig\", \"start\", \"className\", \"style\", \"hasPreviewSteps\"]);\r\n const { stepsChildren, previewChildren } = extractPreviewSteps(children, hasPreviewSteps);\r\n const withPreview = presetConfig || hasPreviewSteps;\r\n const [state, setState] = React.useState({\r\n stepIndex: start,\r\n step: editorSteps[start],\r\n });\r\n const tab = state.step;\r\n function onStepChange(index) {\r\n setState({ stepIndex: index, step: editorSteps[index] });\r\n }\r\n function onTabClick(filename) {\r\n const newStep = updateEditorStep(state.step, filename, null);\r\n setState(Object.assign(Object.assign({}, state), { step: newStep }));\r\n }\r\n function onLinkActivation(stepIndex, filename, focus) {\r\n const newStep = updateEditorStep(editorSteps[stepIndex], filename, focus);\r\n setState(Object.assign(Object.assign({}, state), { stepIndex, step: newStep }));\r\n }\r\n return (React.createElement(\"section\", { className: `ch-scrollycoding ${withPreview ? \"ch-scrollycoding-with-preview\" : \"\"} ${className || \"\"}`, style: style },\r\n React.createElement(\"div\", { className: \"ch-scrollycoding-content\" },\r\n React.createElement(Scroller, { onStepChange: onStepChange }, stepsChildren.map((children, i) => (React.createElement(Step, { as: \"div\", key: i, index: i, onClick: () => onStepChange(i), className: \"ch-scrollycoding-step-content\", \"data-selected\": i === state.stepIndex ? \"true\" : undefined },\r\n React.createElement(LinkableSection, { onActivation: ({ fileName, focus }) => {\r\n onLinkActivation(i, fileName, focus);\r\n }, onReset: () => {\r\n onStepChange(i);\r\n } }, children)))))),\r\n React.createElement(\"div\", { className: \"ch-scrollycoding-sticker\" },\r\n React.createElement(InnerCode, Object.assign({ showExpandButton: true }, rest, tab, { codeConfig: codeConfig, onTabClick: onTabClick })),\r\n presetConfig ? (React.createElement(Preview, { className: \"ch-scrollycoding-preview\", files: tab.files, presetConfig: presetConfig, codeConfig: codeConfig })) : hasPreviewSteps ? (React.createElement(Preview, Object.assign({ className: \"ch-scrollycoding-preview\" }, previewChildren[state.stepIndex][\"props\"]))) : null)));\r\n}\n\nfunction Slideshow(_a) {\r\n var { children, className, code, codeConfig, editorSteps, autoFocus, hasPreviewSteps, \r\n // Set the initial slide index\r\n start = 0, \r\n // Called when the slideshow state changes and returns the current state object\r\n onChange: onSlideshowChange = () => { }, presetConfig, style, autoPlay, loop = false } = _a, rest = __rest(_a, [\"children\", \"className\", \"code\", \"codeConfig\", \"editorSteps\", \"autoFocus\", \"hasPreviewSteps\", \"start\", \"onChange\", \"presetConfig\", \"style\", \"autoPlay\", \"loop\"]);\r\n const { stepsChildren, previewChildren } = extractPreviewSteps(children, hasPreviewSteps);\r\n const withPreview = presetConfig || hasPreviewSteps;\r\n const hasNotes = stepsChildren.some((child) => { var _a; return (_a = child.props) === null || _a === void 0 ? void 0 : _a.children; });\r\n const maxSteps = editorSteps.length - 1;\r\n const [state, setState] = React.useState(() => {\r\n const startIndex = clamp$2(start, 0, maxSteps);\r\n return {\r\n stepIndex: startIndex,\r\n step: editorSteps[startIndex],\r\n };\r\n });\r\n const { stepIndex: currentIndex, step: tab } = state;\r\n const atSlideshowEnd = currentIndex === maxSteps;\r\n React.useEffect(() => {\r\n onSlideshowChange({ index: currentIndex });\r\n }, [currentIndex]);\r\n function onTabClick(filename) {\r\n const newStep = updateEditorStep(tab, filename, null);\r\n setState(Object.assign(Object.assign({}, state), { step: newStep }));\r\n }\r\n function setIndex(newIndex) {\r\n const stepIndex = clamp$2(newIndex, 0, maxSteps);\r\n setState({ stepIndex, step: editorSteps[stepIndex] });\r\n }\r\n function nextSlide() {\r\n setState(s => {\r\n const stepIndex = loop\r\n ? (s.stepIndex + 1) % (maxSteps + 1)\r\n : clamp$2(s.stepIndex + 1, 0, maxSteps);\r\n return {\r\n stepIndex,\r\n step: editorSteps[stepIndex],\r\n };\r\n });\r\n }\r\n useInterval(nextSlide, autoPlay);\r\n return (React.createElement(\"div\", { className: `ch-slideshow ${withPreview ? \"ch-slideshow-with-preview\" : \"\"} ${className || \"\"}`, style: style },\r\n React.createElement(\"div\", { className: \"ch-slideshow-slide\" },\r\n React.createElement(InnerCode, Object.assign({}, rest, tab, { codeConfig: Object.assign(Object.assign({}, codeConfig), code), onTabClick: onTabClick })),\r\n presetConfig ? (React.createElement(Preview, { className: \"ch-slideshow-preview\", files: tab.files, presetConfig: presetConfig, codeConfig: codeConfig })) : hasPreviewSteps ? (React.createElement(Preview, Object.assign({ className: \"ch-slideshow-preview\" }, previewChildren[currentIndex][\"props\"]))) : null),\r\n React.createElement(\"div\", { className: \"ch-slideshow-notes\" },\r\n React.createElement(\"div\", { className: \"ch-slideshow-range\" },\r\n React.createElement(\"button\", { onClick: () => setIndex(currentIndex - 1), disabled: currentIndex === 0 }, \"Prev\"),\r\n React.createElement(\"input\", { max: maxSteps, min: 0, step: 1, type: \"range\", value: currentIndex, onChange: e => setIndex(+e.target.value), ref: useAutoFocusRef(autoFocus), autoFocus: autoFocus }),\r\n React.createElement(\"button\", { onClick: nextSlide, disabled: atSlideshowEnd }, \"Next\")),\r\n hasNotes && (React.createElement(\"div\", { className: \"ch-slideshow-note\" }, stepsChildren[currentIndex])))));\r\n}\r\nfunction useAutoFocusRef(autoFocus) {\r\n const ref = React.useRef(null);\r\n React.useEffect(() => {\r\n autoFocus && ref.current.focus();\r\n }, []);\r\n return ref;\r\n}\n\nfunction Annotation() {\r\n return (React.createElement(\"div\", null, \"\\\"error: code hike remark plugin not running or annotation isn't at the right place\\\"\"));\r\n}\r\nconst annotationsMap = {\r\n box: Box,\r\n bg: MultilineMark,\r\n label: Label,\r\n link: CodeLink,\r\n mark: Mark,\r\n withClass: WithClass,\r\n};\r\nfunction Mark(props) {\r\n if (props.isInline) {\r\n return React.createElement(InlineMark, Object.assign({}, props));\r\n }\r\n else {\r\n return React.createElement(MultilineMark, Object.assign({}, props));\r\n }\r\n}\r\nfunction MultilineMark({ children, data, style, theme, }) {\r\n const className = `ch-code-multiline-mark ` + (data !== null && data !== void 0 ? data : \"\");\r\n const bg = getColor(theme, ColorName.RangeHighlightBackground);\r\n const border = getColor(theme, ColorName.EditorInfoForeground);\r\n return (React.createElement(\"div\", { style: Object.assign(Object.assign({}, style), { background: bg }), className: className },\r\n React.createElement(\"span\", { className: \"ch-code-multiline-mark-border\", style: { background: border } }),\r\n children));\r\n}\r\nfunction InlineMark({ children, data, theme, }) {\r\n const bg = tryGuessColor(children) ||\r\n transparent(getColor(theme, ColorName.CodeForeground), 0.2);\r\n const className = \"ch-code-inline-mark \" + (data !== null && data !== void 0 ? data : \"\");\r\n return (React.createElement(\"span\", { className: className, style: { background: bg } }, children));\r\n}\r\nfunction tryGuessColor(children) {\r\n var _a, _b, _c;\r\n const child = React.Children.toArray(children)[0];\r\n const grandChild = React.Children.toArray(((_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.children) || [])[0];\r\n const grandGrandChild = React.Children.toArray(((_b = grandChild === null || grandChild === void 0 ? void 0 : grandChild.props) === null || _b === void 0 ? void 0 : _b.children) || [])[0];\r\n const { color } = ((_c = grandGrandChild === null || grandGrandChild === void 0 ? void 0 : grandGrandChild.props) === null || _c === void 0 ? void 0 : _c.style) || {};\r\n if (color) {\r\n return transparent(color, 0.2);\r\n }\r\n return undefined;\r\n}\r\nfunction Box({ children, data, theme, }) {\r\n var _a, _b;\r\n const border = typeof data === \"string\"\r\n ? data\r\n : ((_b = (_a = theme.tokenColors.find((tc) => { var _a; return (_a = tc.scope) === null || _a === void 0 ? void 0 : _a.includes(\"string\"); })) === null || _a === void 0 ? void 0 : _a.settings) === null || _b === void 0 ? void 0 : _b.foreground) || \"yellow\";\r\n return (React.createElement(\"span\", { className: \"ch-code-box-annotation\", style: { outline: `2px solid ${border}` } }, children));\r\n}\r\nfunction WithClass({ children, data, style, theme, }) {\r\n const className = data;\r\n return (React.createElement(\"span\", { style: style, className: className }, children));\r\n}\r\nfunction Label({ children, data, style, theme, }) {\r\n const bg = (theme.colors[\"editor.lineHighlightBackground\"] ||\r\n theme.colors[\"editor.selectionHighlightBackground\"]);\r\n const [hover, setHover] = React.useState(false);\r\n return (React.createElement(\"div\", { style: Object.assign(Object.assign({}, style), { background: hover ? bg : undefined }), onMouseEnter: () => setHover(true), onMouseLeave: () => setHover(false) },\r\n children,\r\n React.createElement(\"div\", { style: {\r\n position: \"absolute\",\r\n right: 0,\r\n paddingRight: 16,\r\n display: hover ? \"block\" : \"none\",\r\n opacity: 0.7,\r\n } }, (data === null || data === void 0 ? void 0 : data.children) || data)));\r\n}\r\nfunction CodeLink({ children, isInline, style, data, }) {\r\n const url = (data === null || data === void 0 ? void 0 : data.url) || data;\r\n const title = data === null || data === void 0 ? void 0 : data.title;\r\n return (React.createElement(\"a\", { href: url, title: title, className: isInline ? \"ch-code-inline-link\" : \"ch-code-link\", style: style }, children));\r\n}\n\nfunction InlineCode(_a) {\r\n var { className, codeConfig, children, code } = _a, rest = __rest(_a, [\"className\", \"codeConfig\", \"children\", \"code\"]);\r\n const { theme } = codeConfig;\r\n const { lines } = code;\r\n const allTokens = lines.flatMap(line => line.tokens);\r\n const foreground = getColor(theme, ColorName.CodeForeground);\r\n return (React.createElement(\"span\", Object.assign({ className: \"ch-inline-code not-prose\" +\r\n (className ? \" \" + className : \"\") }, rest),\r\n React.createElement(\"code\", { style: {\r\n [\"--ch-code-foreground\"]: foreground,\r\n background: transparent(getColor(theme, ColorName.CodeBackground), 0.9),\r\n color: foreground,\r\n } }, allTokens.map((token, j) => (React.createElement(\"span\", Object.assign({ key: j }, token.props), token.content))))));\r\n}\n\nconst CH = {\r\n Code,\r\n Section,\r\n SectionLink,\r\n SectionCode,\r\n Spotlight,\r\n Scrollycoding,\r\n Preview,\r\n annotations: annotationsMap,\r\n Annotation,\r\n Slideshow,\r\n InlineCode,\r\n CodeSlot,\r\n PreviewSlot,\r\n};\r\nconst internal = {\r\n MiniBrowser,\r\n EditorSpring,\r\n};\n\nexport { Annotation, CH, Code, CodeSlot, InlineCode, Preview, PreviewSlot, Scrollycoding, Section, SectionCode, SectionLink, Slideshow, Spotlight, annotationsMap as annotations, internal };\n"],"names":[],"sourceRoot":""}
|