@jsenv/core 26.0.1 → 27.0.0-alpha.2

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.
Files changed (465) hide show
  1. package/main.js +17 -24
  2. package/package.json +35 -71
  3. package/readme.md +30 -37
  4. package/src/build/build.js +737 -0
  5. package/src/build/build_urls_generator.js +64 -0
  6. package/src/build/inject_version_mappings.js +62 -0
  7. package/src/build/plugins/bundle_js_module/jsenv_plugin_bundle_js_module.js +225 -0
  8. package/src/build/plugins/minify_html/jsenv_plugin_minify_html.js +30 -0
  9. package/src/build/plugins/minify_js/jsenv_plugin_minify_js.js +47 -0
  10. package/src/dev/plugins/autoreload/babel_plugin_metadata_import_meta_hot.js +98 -0
  11. package/src/dev/plugins/autoreload/client/autoreload_preference.js +11 -0
  12. package/src/dev/plugins/autoreload/client/event_source_client.js +186 -0
  13. package/src/{internal/dev_server/event_source_client → dev/plugins/autoreload/client}/event_source_connection.js +21 -25
  14. package/src/dev/plugins/autoreload/client/import_meta_hot.js +80 -0
  15. package/src/dev/plugins/autoreload/client/reload.js +101 -0
  16. package/src/dev/plugins/autoreload/client/url_helpers.js +20 -0
  17. package/src/dev/plugins/autoreload/html_hot_dependencies.js +156 -0
  18. package/src/dev/plugins/autoreload/jsenv_plugin_autoreload.js +374 -0
  19. package/src/dev/plugins/autoreload/sse_service.js +149 -0
  20. package/src/dev/plugins/explorer/client/explorer.html +607 -0
  21. package/src/{internal → dev/plugins/explorer/client}/jsenv.png +0 -0
  22. package/src/dev/plugins/explorer/jsenv_plugin_explorer.js +74 -0
  23. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/animation/toolbar_animation.js +0 -0
  24. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/eventsource/eventsource.css +2 -2
  25. package/src/dev/plugins/toolbar/client/eventsource/toolbar_eventsource.js +57 -0
  26. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/execution/execution.css +0 -0
  27. package/src/dev/plugins/toolbar/client/execution/toolbar_execution.js +88 -0
  28. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/focus/focus.css +0 -0
  29. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/focus/toolbar_focus.js +0 -0
  30. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/jsenv_logo.svg +0 -0
  31. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/notification/toolbar_notification.js +0 -0
  32. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/responsive/overflow_menu.css +0 -0
  33. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/responsive/toolbar_responsive.js +0 -0
  34. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/settings/settings.css +0 -0
  35. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/settings/toolbar_settings.js +1 -0
  36. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/theme/jsenv_theme.css +1 -15
  37. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/theme/light_theme.css +0 -17
  38. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/theme/toolbar_theme.js +0 -0
  39. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/toolbar.html +40 -199
  40. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/toolbar_injector.js +8 -28
  41. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/toolbar_main.css +0 -24
  42. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/toolbar_main.js +10 -56
  43. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/tooltip/tooltip.css +1 -1
  44. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/tooltip/tooltip.js +0 -0
  45. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/util/animation.js +0 -0
  46. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/util/dom.js +0 -0
  47. package/src/{internal/browser_utils → dev/plugins/toolbar/client/util}/fetch_using_xhr.js +0 -0
  48. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/util/fetching.js +2 -4
  49. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/util/iframe_to_parent_href.js +0 -0
  50. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/util/jsenv_logger.js +0 -0
  51. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/util/preferences.js +0 -0
  52. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/util/responsive.js +0 -0
  53. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/util/util.js +0 -0
  54. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/variant/variant.js +0 -0
  55. package/src/dev/plugins/toolbar/jsenv_plugin_toolbar.js +62 -0
  56. package/src/dev/start_dev_server.js +105 -0
  57. package/src/execute/execute.js +132 -0
  58. package/src/execute/run.js +208 -0
  59. package/src/execute/runtimes/browsers/chromium.js +8 -0
  60. package/src/execute/runtimes/browsers/firefox.js +7 -0
  61. package/src/execute/runtimes/browsers/from_playwright.js +464 -0
  62. package/src/{browser_runtimes.js → execute/runtimes/browsers/webkit.js} +4 -18
  63. package/src/{internal/node_launcher/child_process_options.js → execute/runtimes/node/child_exec_options.js} +25 -36
  64. package/src/{internal/node_launcher/node_controllable_file.mjs → execute/runtimes/node/controllable_file.mjs} +1 -18
  65. package/src/{internal/node_launcher/node_controllable_process.js → execute/runtimes/node/controlled_process.js} +128 -150
  66. package/src/execute/runtimes/node/exec_options.js +44 -0
  67. package/src/{internal/node_launcher → execute/runtimes/node}/kill_process_tree.js +3 -1
  68. package/src/execute/runtimes/node/node_process.js +92 -0
  69. package/src/execute/runtimes/node/node_worker_thread.js +28 -0
  70. package/src/omega/core_plugins/babel/babel_helper/babel_helper_directory.js +29 -0
  71. package/src/{internal/compile_server/js → omega/core_plugins/babel/babel_helper}/babel_plugin_babel_helpers_as_jsenv_imports.js +15 -19
  72. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/.eslintrc.cjs +0 -0
  73. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/AsyncGenerator/AsyncGenerator.js +0 -0
  74. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/AwaitValue/AwaitValue.js +0 -0
  75. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/applyDecoratorDescriptor/applyDecoratorDescriptor.js +0 -0
  76. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/arrayLikeToArray/arrayLikeToArray.js +0 -0
  77. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/arrayWithHoles/arrayWithHoles.js +0 -0
  78. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/arrayWithoutHoles/arrayWithoutHoles.js +0 -0
  79. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/assertThisInitialized/assertThisInitialized.js +0 -0
  80. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/asyncGeneratorDelegate/asyncGeneratorDelegate.js +0 -0
  81. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/asyncIterator/asyncIterator.js +0 -0
  82. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/asyncToGenerator/asyncToGenerator.js +0 -0
  83. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/awaitAsyncGenerator/awaitAsyncGenerator.js +0 -0
  84. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classApplyDescriptorDestructureSet/classApplyDescriptorDestructureSet.js +0 -0
  85. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classApplyDescriptorGet/classApplyDescriptorGet.js +0 -0
  86. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classApplyDescriptorSet/classApplyDescriptorSet.js +0 -0
  87. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classCallCheck/classCallCheck.js +0 -0
  88. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classCheckPrivateStaticAccess/classCheckPrivateStaticAccess.js +0 -0
  89. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classCheckPrivateStaticFieldDescriptor/classCheckPrivateStaticFieldDescriptor.js +0 -0
  90. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classExtractFieldDescriptor/classExtractFieldDescriptor.js +0 -0
  91. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classNameTDZError/classNameTDZError.js +0 -0
  92. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classPrivateFieldDestructureSet/classPrivateFieldDestructureSet.js +0 -0
  93. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classPrivateFieldGet/classPrivateFieldGet.js +0 -0
  94. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classPrivateFieldLooseBase/classPrivateFieldLooseBase.js +0 -0
  95. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classPrivateFieldLooseKey/classPrivateFieldLooseKey.js +0 -0
  96. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classPrivateFieldSet/classPrivateFieldSet.js +0 -0
  97. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classPrivateMethodGet/classPrivateMethodGet.js +0 -0
  98. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classPrivateMethodSet/classPrivateMethodSet.js +0 -0
  99. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classStaticPrivateFieldSpecGet/classStaticPrivateFieldSpecGet.js +0 -0
  100. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classStaticPrivateFieldSpecSet/classStaticPrivateFieldSpecSet.js +0 -0
  101. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classStaticPrivateMethodGet/classStaticPrivateMethodGet.js +0 -0
  102. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classStaticPrivateMethodSet/classStaticPrivateMethodSet.js +0 -0
  103. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/construct/construct.js +0 -0
  104. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/createClass/createClass.js +0 -0
  105. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/createForOfIteratorHelper/createForOfIteratorHelper.js +0 -0
  106. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/createForOfIteratorHelperLoose/createForOfIteratorHelperLoose.js +0 -0
  107. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/createRawReactElement/createRawReactElement.js +0 -0
  108. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/createSuper/createSuper.js +0 -0
  109. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/decorate/decorate.js +0 -0
  110. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/defaults/defaults.js +0 -0
  111. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/defineEnumerableProperties/defineEnumerableProperties.js +0 -0
  112. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/defineProperty/defineProperty.js +0 -0
  113. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/extends/extends.js +0 -0
  114. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/get/get.js +0 -0
  115. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/getPrototypeOf/getPrototypeOf.js +0 -0
  116. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/inherits/inherits.js +0 -0
  117. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/inheritsLoose/inheritsLoose.js +0 -0
  118. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/initializerDefineProperty/initializerDefineProperty.js +0 -0
  119. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/initializerWarningHelper/initializerWarningHelper.js +0 -0
  120. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/instanceof/instanceof.js +0 -0
  121. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/interopRequireDefault/interopRequireDefault.js +0 -0
  122. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/interopRequireWildcard/interopRequireWildcard.js +0 -0
  123. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/isNativeFunction/isNativeFunction.js +0 -0
  124. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/isNativeReflectConstruct/isNativeReflectConstruct.js +0 -0
  125. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/iterableToArray/iterableToArray.js +0 -0
  126. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/iterableToArrayLimit/iterableToArrayLimit.js +0 -0
  127. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/iterableToArrayLimitLoose/iterableToArrayLimitLoose.js +0 -0
  128. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/jsx/jsx.js +0 -0
  129. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/maybeArrayLike/maybeArrayLike.js +0 -0
  130. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/newArrowCheck/newArrowCheck.js +0 -0
  131. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/nonIterableRest/nonIterableRest.js +0 -0
  132. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/nonIterableSpread/nonIterableSpread.js +0 -0
  133. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/objectDestructuringEmpty/objectDestructuringEmpty.js +0 -0
  134. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/objectSpread/objectSpread.js +0 -0
  135. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/objectSpread2/objectSpread2.js +0 -0
  136. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/objectWithoutProperties/objectWithoutProperties.js +0 -0
  137. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/objectWithoutPropertiesLoose/objectWithoutPropertiesLoose.js +0 -0
  138. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/possibleConstructorReturn/possibleConstructorReturn.js +0 -0
  139. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/readOnlyError/readOnlyError.js +0 -0
  140. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/readme.md +0 -0
  141. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/set/set.js +0 -0
  142. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/setPrototypeOf/setPrototypeOf.js +0 -0
  143. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/skipFirstGeneratorNext/skipFirstGeneratorNext.js +0 -0
  144. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/slicedToArray/slicedToArray.js +0 -0
  145. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/slicedToArrayLoose/slicedToArrayLoose.js +0 -0
  146. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/superPropBase/superPropBase.js +0 -0
  147. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/taggedTemplateLiteral/taggedTemplateLiteral.js +0 -0
  148. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/taggedTemplateLiteralLoose/taggedTemplateLiteralLoose.js +0 -0
  149. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/tdz/tdz.js +0 -0
  150. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/temporalRef/temporalRef.js +0 -0
  151. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/temporalUndefined/temporalUndefined.js +0 -0
  152. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/toArray/toArray.js +0 -0
  153. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/toConsumableArray/toConsumableArray.js +0 -0
  154. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/toPrimitive/toPrimitive.js +0 -0
  155. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/toPropertyKey/toPropertyKey.js +0 -0
  156. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/typeof/typeof.js +0 -0
  157. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/unsupportedIterableToArray/unsupportedIterableToArray.js +0 -0
  158. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/wrapAsyncGenerator/wrapAsyncGenerator.js +0 -0
  159. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/wrapNativeSuper/wrapNativeSuper.js +0 -0
  160. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/wrapRegExp/wrapRegExp.js +0 -0
  161. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/writeOnlyError/writeOnlyError.js +0 -0
  162. package/src/omega/core_plugins/babel/global_this/babel_plugin_global_this_as_jsenv_import.js +35 -0
  163. package/{helpers/global-this/global-this.js → src/omega/core_plugins/babel/global_this/client/global_this.js} +0 -0
  164. package/src/omega/core_plugins/babel/helpers/babel_plugin_structure.js +187 -0
  165. package/src/{internal/features → omega/core_plugins/babel/helpers}/babel_plugins_compatibility.js +1 -24
  166. package/src/omega/core_plugins/babel/jsenv_plugin_babel.js +97 -0
  167. package/src/omega/core_plugins/babel/new_stylesheet/babel_plugin_new_stylesheet_as_jsenv_import.js +117 -0
  168. package/src/omega/core_plugins/babel/new_stylesheet/client/.eslintrc.cjs +24 -0
  169. package/{helpers/new_stylesheet → src/omega/core_plugins/babel/new_stylesheet/client}/new_stylesheet.js +0 -0
  170. package/src/omega/core_plugins/babel/regenerator_runtime/babel_plugin_regenerator_runtime_as_jsenv_import.js +34 -0
  171. package/{helpers/regenerator-runtime/regenerator-runtime.js → src/omega/core_plugins/babel/regenerator_runtime/client/regenerator_runtime.js} +0 -0
  172. package/src/omega/core_plugins/commonjs_globals/jsenv_plugin_commonjs_globals.js +169 -0
  173. package/src/omega/core_plugins/file_urls/jsenv_plugin_file_urls.js +67 -0
  174. package/src/omega/core_plugins/filesystem_magic/jsenv_plugin_filesystem_magic.js +58 -0
  175. package/src/{internal/browser_client → omega/core_plugins/html_supervisor/client}/error_in_document.js +10 -16
  176. package/src/{internal/browser_client → omega/core_plugins/html_supervisor/client}/error_in_notification.js +0 -0
  177. package/src/omega/core_plugins/html_supervisor/client/html_supervisor_installer.js +168 -0
  178. package/src/omega/core_plugins/html_supervisor/client/html_supervisor_setup.js +77 -0
  179. package/src/{internal/browser_client → omega/core_plugins/html_supervisor/client}/perf_browser.js +0 -0
  180. package/src/{internal/runtime_client → omega/core_plugins/html_supervisor/client}/uneval_exception.js +0 -0
  181. package/src/omega/core_plugins/html_supervisor/jsenv_plugin_html_supervisor.js +233 -0
  182. package/src/omega/core_plugins/import_assertions/helpers/babel_plugin_metadata_import_assertions.js +98 -0
  183. package/src/{internal/building/import_assertions → omega/core_plugins/import_assertions/helpers}/json_module.js +3 -2
  184. package/src/omega/core_plugins/import_assertions/helpers/text_module.js +6 -0
  185. package/src/omega/core_plugins/import_assertions/jsenv_plugin_import_assertions.js +211 -0
  186. package/src/omega/core_plugins/import_meta_scenarios/jsenv_plugin_import_meta_scenarios.js +80 -0
  187. package/src/omega/core_plugins/importmap/jsenv_plugin_importmap.js +212 -0
  188. package/src/omega/core_plugins/inline/client/inline_content.js +6 -0
  189. package/src/omega/core_plugins/inline/jsenv_plugin_data_urls.js +70 -0
  190. package/src/omega/core_plugins/inline/jsenv_plugin_inline.js +13 -0
  191. package/src/omega/core_plugins/inline/jsenv_plugin_inline_query_param.js +42 -0
  192. package/src/omega/core_plugins/inline/jsenv_plugin_js_and_css_inside_html.js +142 -0
  193. package/src/omega/core_plugins/inline/jsenv_plugin_new_inline_content.js +210 -0
  194. package/src/omega/core_plugins/leading_slash/jsenv_plugin_leading_slash.js +12 -0
  195. package/src/omega/core_plugins/node_esm_resolution/jsenv_plugin_node_esm_resolution.js +77 -0
  196. package/src/omega/core_plugins/url_resolution/jsenv_plugin_url_resolution.js +28 -0
  197. package/src/omega/core_plugins/url_version/jsenv_plugin_url_version.js +50 -0
  198. package/src/omega/core_plugins.js +39 -0
  199. package/src/omega/errors.js +168 -0
  200. package/src/omega/file_url_converter.js +63 -0
  201. package/src/omega/kitchen.js +777 -0
  202. package/src/omega/omega_server.js +129 -0
  203. package/src/omega/plugin_controller.js +240 -0
  204. package/src/omega/runtime_support/default_runtime_support.js +13 -0
  205. package/src/omega/runtime_support/features_compatibility.js +91 -0
  206. package/src/omega/runtime_support/runtime_support.js +20 -0
  207. package/src/omega/server/file_service.js +155 -0
  208. package/src/omega/server/user_agent.js +22 -0
  209. package/src/omega/url_graph/url_graph_load.js +68 -0
  210. package/src/omega/url_graph/url_graph_report.js +151 -0
  211. package/src/omega/url_graph/url_graph_sort.js +29 -0
  212. package/src/omega/url_graph/url_info_transformations.js +161 -0
  213. package/src/omega/url_graph.js +132 -0
  214. package/src/omega/url_mentions/css_url_mentions.js +63 -0
  215. package/src/omega/url_mentions/html_url_mentions.js +185 -0
  216. package/src/omega/url_mentions/js_module_url_mentions.js +91 -0
  217. package/src/omega/url_mentions/parse_url_mentions.js +37 -0
  218. package/src/omega/url_mentions/worker_classic_url_mentions.js +37 -0
  219. package/src/{internal/executing → test}/execute_plan.js +154 -211
  220. package/src/{execute_test_plan.js → test/execute_test_plan.js} +26 -81
  221. package/src/{internal/executing → test}/execution_colors.js +0 -0
  222. package/src/{internal/executing → test}/execution_steps.js +2 -8
  223. package/src/{internal/executing → test}/gc.js +0 -0
  224. package/src/test/logs_file_execution.js +223 -0
  225. package/dist/browser_client/asset-manifest.json +0 -4
  226. package/dist/browser_client/browser_client_fb33eaa4.js +0 -5320
  227. package/dist/browser_client/browser_client_fb33eaa4.js.map +0 -1089
  228. package/dist/build_manifest.js +0 -12
  229. package/dist/compile_proxy/asset-manifest.json +0 -4
  230. package/dist/compile_proxy/compile_proxy.html__inline__20_651d1e7b.js.map +0 -343
  231. package/dist/compile_proxy/compile_proxy_62f952c4.html +0 -2245
  232. package/dist/event_source_client/asset-manifest.json +0 -4
  233. package/dist/event_source_client/event_source_client_69f48287.js +0 -354
  234. package/dist/event_source_client/event_source_client_69f48287.js.map +0 -128
  235. package/dist/redirector/asset-manifest.json +0 -4
  236. package/dist/redirector/redirector.html__inline__12_171e07b4.js.map +0 -349
  237. package/dist/redirector/redirector_8117ec92.html +0 -2290
  238. package/dist/toolbar/asset-manifest.json +0 -13
  239. package/dist/toolbar/assets/compilation.css_7421bd55.map +0 -12
  240. package/dist/toolbar/assets/eventsource.css_c0c71e7b.map +0 -12
  241. package/dist/toolbar/assets/execution.css_f3377c10.map +0 -12
  242. package/dist/toolbar/assets/focus.css_896f3e45.map +0 -12
  243. package/dist/toolbar/assets/light_theme.css_5bff0336.map +0 -12
  244. package/dist/toolbar/assets/overflow_menu.css_9a0fc3d8.map +0 -12
  245. package/dist/toolbar/assets/settings.css_942b5a9e.map +0 -12
  246. package/dist/toolbar/assets/toolbar_main.css_b1c67dd7.map +0 -28
  247. package/dist/toolbar/assets/tooltip.css_a94a8bdd.map +0 -12
  248. package/dist/toolbar/toolbar_b0c9100c.html +0 -4976
  249. package/dist/toolbar/toolbar_main_f54c1bb0.js.map +0 -776
  250. package/dist/toolbar_injector/asset-manifest.json +0 -5
  251. package/dist/toolbar_injector/assets/jsenv_logo_192011c2.svg +0 -95
  252. package/dist/toolbar_injector/toolbar_injector_65b501eb.js +0 -976
  253. package/dist/toolbar_injector/toolbar_injector_65b501eb.js.map +0 -294
  254. package/helpers/import-meta/import-meta-url-commonjs.js +0 -9
  255. package/helpers/import-meta/import-meta-url-global.js +0 -54
  256. package/src/build_project.js +0 -336
  257. package/src/commonjs_to_js_module.js +0 -180
  258. package/src/dev_server.js +0 -302
  259. package/src/execute.js +0 -184
  260. package/src/import_using_child_process.js +0 -68
  261. package/src/internal/browser_client/browser_client.js +0 -220
  262. package/src/internal/browser_client/browser_client_factory.js +0 -144
  263. package/src/internal/browser_client/browser_error_stack_remap.js +0 -43
  264. package/src/internal/browser_client/browser_system.js +0 -216
  265. package/src/internal/browser_client/module_namespace_transfer.js +0 -90
  266. package/src/internal/browser_detection/browser_detection.js +0 -65
  267. package/src/internal/browser_detection/detect_android.js +0 -13
  268. package/src/internal/browser_detection/detect_chrome.js +0 -28
  269. package/src/internal/browser_detection/detect_edge.js +0 -13
  270. package/src/internal/browser_detection/detect_electron.js +0 -1
  271. package/src/internal/browser_detection/detect_firefox.js +0 -17
  272. package/src/internal/browser_detection/detect_internet_explorer.js +0 -14
  273. package/src/internal/browser_detection/detect_ios.js +0 -19
  274. package/src/internal/browser_detection/detect_opera.js +0 -27
  275. package/src/internal/browser_detection/detect_safari.js +0 -13
  276. package/src/internal/browser_detection/user_agent_data.js +0 -25
  277. package/src/internal/browser_detection/util.js +0 -13
  278. package/src/internal/browser_launcher/browser_runtime_profile.js +0 -81
  279. package/src/internal/browser_launcher/execute_html_file.js +0 -355
  280. package/src/internal/browser_launcher/from_playwright.js +0 -320
  281. package/src/internal/browser_launcher/page_errors_and_logs.js +0 -77
  282. package/src/internal/browser_utils/fetch_and_eval.js +0 -27
  283. package/src/internal/browser_utils/fetch_and_eval_using_script.js +0 -47
  284. package/src/internal/browser_utils/fetch_browser.js +0 -34
  285. package/src/internal/browser_utils/fetch_json.js +0 -7
  286. package/src/internal/building/build_logs.js +0 -134
  287. package/src/internal/building/build_stats.js +0 -100
  288. package/src/internal/building/build_url_generator.js +0 -153
  289. package/src/internal/building/build_using_rollup.js +0 -359
  290. package/src/internal/building/css/apply_post_css.js +0 -55
  291. package/src/internal/building/css/jsenv_parse_css.js +0 -260
  292. package/src/internal/building/css/move_css_urls.js +0 -44
  293. package/src/internal/building/css/parse_css_urls.js +0 -38
  294. package/src/internal/building/css/postcss_plugin_url_visitor.js +0 -245
  295. package/src/internal/building/css/replace_css_urls.js +0 -68
  296. package/src/internal/building/global_format/es_to_system.js +0 -34
  297. package/src/internal/building/html/html_node_mutations.js +0 -29
  298. package/src/internal/building/html/html_scan.js +0 -70
  299. package/src/internal/building/html/jsenv_parse_html.js +0 -813
  300. package/src/internal/building/html/minify_html.js +0 -7
  301. package/src/internal/building/import_assertions/css_module.js +0 -43
  302. package/src/internal/building/import_references.js +0 -80
  303. package/src/internal/building/importmap/jsenv_parse_importmap.js +0 -28
  304. package/src/internal/building/js/babel_plugin_inline_worker_imports.js +0 -96
  305. package/src/internal/building/js/jsenv_parse_js.js +0 -122
  306. package/src/internal/building/js/minify_js.js +0 -33
  307. package/src/internal/building/js/transform_worker.js +0 -55
  308. package/src/internal/building/json/jsenv_parse_json.js +0 -11
  309. package/src/internal/building/parse_ressource.js +0 -207
  310. package/src/internal/building/ressource_builder.js +0 -1098
  311. package/src/internal/building/ressource_builder_util.js +0 -194
  312. package/src/internal/building/rollup_plugin_jsenv.js +0 -1965
  313. package/src/internal/building/sort_pathnames.js +0 -10
  314. package/src/internal/building/sourcemap/sourcemap_loader.js +0 -70
  315. package/src/internal/building/svg/jsenv_parse_svg.js +0 -112
  316. package/src/internal/building/url_fetcher.js +0 -85
  317. package/src/internal/building/url_loader.js +0 -127
  318. package/src/internal/building/url_trace.js +0 -229
  319. package/src/internal/building/url_versioning/resolve_import_url_helper.js +0 -12
  320. package/src/internal/building/url_versioning/url_versioning.js +0 -65
  321. package/src/internal/building/webmanifest/jsenv_parse_webmanifest.js +0 -48
  322. package/src/internal/compile_server/commonjs/rollup_plugin_commonjs_named_exports.js +0 -187
  323. package/src/internal/compile_server/compile_file.js +0 -273
  324. package/src/internal/compile_server/compile_server.js +0 -519
  325. package/src/internal/compile_server/compiled_file_service.js +0 -264
  326. package/src/internal/compile_server/html/html_ast.js +0 -534
  327. package/src/internal/compile_server/html/html_source_file_service.js +0 -453
  328. package/src/internal/compile_server/html/jsenv_compile_html.js +0 -674
  329. package/src/internal/compile_server/importmap/jsenv_compile_importmap.js +0 -28
  330. package/src/internal/compile_server/js/ansi_to_html.js +0 -9
  331. package/src/internal/compile_server/js/babelHelper.js +0 -145
  332. package/src/internal/compile_server/js/babel_parse_error.js +0 -9
  333. package/src/internal/compile_server/js/babel_plugin_global_this_as_jsenv_import.js +0 -34
  334. package/src/internal/compile_server/js/babel_plugin_import_assertions.js +0 -121
  335. package/src/internal/compile_server/js/babel_plugin_import_metadata.js +0 -18
  336. package/src/internal/compile_server/js/babel_plugin_import_visitor.js +0 -84
  337. package/src/internal/compile_server/js/babel_plugin_new_stylesheet_as_jsenv_import.js +0 -113
  338. package/src/internal/compile_server/js/babel_plugin_proxy_external_imports.js +0 -31
  339. package/src/internal/compile_server/js/babel_plugin_regenerator_runtime_as_jsenv_import.js +0 -48
  340. package/src/internal/compile_server/js/babel_plugin_replace_expressions.js +0 -101
  341. package/src/internal/compile_server/js/babel_plugin_systemjs_prepend.js +0 -23
  342. package/src/internal/compile_server/js/babel_plugin_transform_import_meta.js +0 -134
  343. package/src/internal/compile_server/js/babel_plugins.js +0 -37
  344. package/src/internal/compile_server/js/generateBabelHelper.js +0 -36
  345. package/src/internal/compile_server/js/js_transformer.js +0 -195
  346. package/src/internal/compile_server/js/jsenv_compile_js.js +0 -62
  347. package/src/internal/compile_server/js/load_babel_plugin_map_from_file.js +0 -49
  348. package/src/internal/compile_server/jsenv_directory/comparison_utils.js +0 -27
  349. package/src/internal/compile_server/jsenv_directory/compilation_result.js +0 -243
  350. package/src/internal/compile_server/jsenv_directory/compilation_result_from_build.js +0 -184
  351. package/src/internal/compile_server/jsenv_directory/compile_asset.js +0 -24
  352. package/src/internal/compile_server/jsenv_directory/compile_context.js +0 -60
  353. package/src/internal/compile_server/jsenv_directory/compile_profile.js +0 -217
  354. package/src/internal/compile_server/jsenv_directory/file_lock_registry.js +0 -24
  355. package/src/internal/compile_server/jsenv_directory/file_lock_registry.test.js +0 -47
  356. package/src/internal/compile_server/jsenv_directory/fs_optimized_for_cache.js +0 -57
  357. package/src/internal/compile_server/jsenv_directory/jsenv_directory.js +0 -183
  358. package/src/internal/compile_server/jsenv_directory/reuse_or_create_compiled_file.js +0 -269
  359. package/src/internal/compile_server/jsenv_directory/update_compile_cache.js +0 -131
  360. package/src/internal/compile_server/jsenv_directory/validate_compile_cache.js +0 -264
  361. package/src/internal/compile_server/sse_service/sse_service.js +0 -369
  362. package/src/internal/coverage/babel_plugin_instrument.js +0 -90
  363. package/src/internal/coverage/coverage_reporter_html_directory.js +0 -37
  364. package/src/internal/coverage/coverage_reporter_json_file.js +0 -22
  365. package/src/internal/coverage/coverage_reporter_text_log.js +0 -20
  366. package/src/internal/coverage/empty_coverage_factory.js +0 -70
  367. package/src/internal/coverage/file_by_file_coverage.js +0 -28
  368. package/src/internal/coverage/istanbul_coverage_composition.js +0 -28
  369. package/src/internal/coverage/istanbul_coverage_map_from_coverage.js +0 -16
  370. package/src/internal/coverage/list_files_not_covered.js +0 -20
  371. package/src/internal/coverage/missing_coverage.js +0 -46
  372. package/src/internal/coverage/report_to_coverage.js +0 -198
  373. package/src/internal/coverage/v8_and_istanbul.js +0 -38
  374. package/src/internal/coverage/v8_coverage_composition.js +0 -23
  375. package/src/internal/coverage/v8_coverage_from_directory.js +0 -86
  376. package/src/internal/coverage/v8_coverage_to_istanbul.js +0 -100
  377. package/src/internal/data_url.js +0 -54
  378. package/src/internal/dev_server/event_source_client/event_source_client.js +0 -63
  379. package/src/internal/dev_server/event_source_client/file_changes.js +0 -82
  380. package/src/internal/dev_server/event_source_client/livereload_preference.js +0 -13
  381. package/src/internal/dev_server/exploring/exploring.css +0 -237
  382. package/src/internal/dev_server/exploring/exploring.html +0 -79
  383. package/src/internal/dev_server/exploring/exploring.js +0 -243
  384. package/src/internal/dev_server/exploring/fetch_exploring_json.js +0 -19
  385. package/src/internal/dev_server/toolbar/compilation/compilation.css +0 -23
  386. package/src/internal/dev_server/toolbar/compilation/toolbar_compilation.js +0 -202
  387. package/src/internal/dev_server/toolbar/eventsource/toolbar_eventsource.js +0 -83
  388. package/src/internal/dev_server/toolbar/execution/toolbar_execution.js +0 -91
  389. package/src/internal/error_stack_remap/install_error_stack_remapping.js +0 -142
  390. package/src/internal/error_stack_remap/remap_call_site.js +0 -315
  391. package/src/internal/error_stack_remap/remap_stack.js +0 -218
  392. package/src/internal/error_stack_remap/stringify_stack.js +0 -9
  393. package/src/internal/executing/launch_and_execute.js +0 -458
  394. package/src/internal/executing/logs_file_execution.js +0 -160
  395. package/src/internal/executing/logs_plan_summary.js +0 -144
  396. package/src/internal/features/browser_feature_detection/browser_feature_detect_dynamic_import.js +0 -20
  397. package/src/internal/features/browser_feature_detection/browser_feature_detect_import_assertions_css.js +0 -23
  398. package/src/internal/features/browser_feature_detection/browser_feature_detect_import_assertions_json.js +0 -25
  399. package/src/internal/features/browser_feature_detection/browser_feature_detect_importmap.js +0 -37
  400. package/src/internal/features/browser_feature_detection/browser_feature_detect_new_stylesheet.js +0 -9
  401. package/src/internal/features/browser_feature_detection/browser_feature_detect_top_level_await.js +0 -14
  402. package/src/internal/features/browser_feature_detection/browser_feature_detection.js +0 -89
  403. package/src/internal/features/browser_feature_detection/compile_proxy.html +0 -27
  404. package/src/internal/features/browser_feature_detection/execute_with_script_module.js +0 -24
  405. package/src/internal/features/features_compat_from_runtime.js +0 -38
  406. package/src/internal/features/features_compat_from_runtime_support.js +0 -31
  407. package/src/internal/features/features_compatibility.js +0 -37
  408. package/src/internal/features/node_feature_detection/feature_detect_dynamic_import.mjs +0 -5
  409. package/src/internal/features/node_feature_detection/feature_detect_top_level_await.mjs +0 -1
  410. package/src/internal/features/node_feature_detection/node_feature_detect_dynamic_import.js +0 -5
  411. package/src/internal/features/node_feature_detection/node_feature_detect_top_level_await.js +0 -16
  412. package/src/internal/features/node_feature_detection/node_feature_detection.js +0 -66
  413. package/src/internal/fetching.js +0 -28
  414. package/src/internal/import_resolution/default_extension.js +0 -40
  415. package/src/internal/import_resolution/import_resolver_importmap.js +0 -64
  416. package/src/internal/import_resolution/import_resolver_node.js +0 -254
  417. package/src/internal/import_resolution/importmap_default.js +0 -37
  418. package/src/internal/jsenv_builds.js +0 -19
  419. package/src/internal/jsenv_params_assertions.js +0 -12
  420. package/src/internal/jsenv_remote_directory.js +0 -156
  421. package/src/internal/logs/byte.js +0 -10
  422. package/src/internal/logs/byte_as_file_size.js +0 -9
  423. package/src/internal/logs/ms_as_duration.js +0 -12
  424. package/src/internal/memoize.js +0 -24
  425. package/src/internal/node_launcher/eval_source.js +0 -6
  426. package/src/internal/node_launcher/fetch_source.js +0 -8
  427. package/src/internal/node_launcher/node_error_stack_remap.js +0 -22
  428. package/src/internal/node_launcher/node_execution_dynamic_import.js +0 -75
  429. package/src/internal/node_launcher/node_execution_performance.js +0 -67
  430. package/src/internal/node_launcher/node_execution_systemjs.js +0 -125
  431. package/src/internal/node_launcher/node_runtime_report.js +0 -77
  432. package/src/internal/node_launcher/node_system.js +0 -192
  433. package/src/internal/node_launcher/perf_node.js +0 -13
  434. package/src/internal/node_launcher/process_options.js +0 -46
  435. package/src/internal/node_launcher/value_install.js +0 -14
  436. package/src/internal/origin_directory_converter.js +0 -62
  437. package/src/internal/promise_race.js +0 -19
  438. package/src/internal/redirector/redirector.html +0 -40
  439. package/src/internal/regexp_escape.js +0 -34
  440. package/src/internal/require.js +0 -3
  441. package/src/internal/response_validation.js +0 -130
  442. package/src/internal/runtime_client/module_registration.js +0 -207
  443. package/src/internal/runtime_client/s.js +0 -864
  444. package/src/internal/runtime_client/s.js.md +0 -1
  445. package/src/internal/runtime_support/jsenv_runtime_support.js +0 -15
  446. package/src/internal/runtime_support/runtime_support.js +0 -70
  447. package/src/internal/semantic_versioning/compare_versions.js +0 -28
  448. package/src/internal/semantic_versioning/highest_version.js +0 -11
  449. package/src/internal/semantic_versioning/is_above.js +0 -5
  450. package/src/internal/semantic_versioning/is_below.js +0 -5
  451. package/src/internal/semantic_versioning/is_equal.js +0 -3
  452. package/src/internal/semantic_versioning/lowest_version.js +0 -11
  453. package/src/internal/semantic_versioning/version_from_value.js +0 -42
  454. package/src/internal/sourcemap_utils.js +0 -112
  455. package/src/internal/template_string_escape.js +0 -20
  456. package/src/internal/url_conversion.js +0 -313
  457. package/src/internal/url_utils.js +0 -33
  458. package/src/internal/url_utils.test.js +0 -39
  459. package/src/internal/windows_file_path_utils.js +0 -16
  460. package/src/jsenv_file_urls.js +0 -35
  461. package/src/jsenv_service_worker_finalizer.js +0 -55
  462. package/src/json_to_js_module.js +0 -13
  463. package/src/node_runtime.js +0 -227
  464. package/src/require_using_child_process.js +0 -67
  465. package/src/text_to_js_module.js +0 -13
@@ -1,4976 +0,0 @@
1
- <!DOCTYPE html><html><head>
2
- <title>Jsenv toolbar</title>
3
- <meta name="viewport" content="width=device-width, initial-scale=1">
4
- <meta charset="utf-8">
5
-
6
- <style>/* Loader icon */
7
- #loader-icon {
8
- width: 20px;
9
- height: 20px;
10
- margin: 10px;
11
- transform: scaleX(-1);
12
- color: #cecece;
13
- }
14
- #loader-icon[data-animate] {
15
- opacity: 0;
16
- transform-origin: center;
17
- animation: rotateLoader 1s linear infinite !important;
18
- }
19
- @keyframes rotateLoader {
20
- 0% {
21
- transform: scaleX(-1) rotate(360deg);
22
- opacity: 1;
23
- }
24
- 50% {
25
- opacity: 0;
26
- }
27
- 100% {
28
- transform: scaleX(-1) rotate(0deg);
29
- opacity: 1;
30
- }
31
- }
32
- /* Check icon */
33
- #check-icon {
34
- width: 25px;
35
- height: 25px;
36
- margin: 7px;
37
- opacity: 0;
38
- stroke-width: 5;
39
- }
40
- #check-icon[data-animate] {
41
- opacity: 1;
42
- }
43
- #check-icon[data-animate] path {
44
- transform-origin: 50% 50%;
45
- stroke-dasharray: 48;
46
- stroke-dashoffset: 48;
47
- animation: stroke 0.5s cubic-bezier(0.65, 0, 0.45, 1) forwards;
48
- stroke: green;
49
- }
50
- @keyframes stroke {
51
- 100% {
52
- stroke-dashoffset: 0;
53
- }
54
- }
55
- /* Cross icon */
56
- #cross-icon {
57
- width: 20px;
58
- height: 20px;
59
- margin: 10px;
60
- opacity: 0;
61
- stroke-width: 5;
62
- }
63
- #cross-icon rect {
64
- width: 33px;
65
- height: 0;
66
- fill: #d74640;
67
- }
68
- #cross-icon[data-animate] {
69
- opacity: 1;
70
- }
71
- #cross-icon[data-animate] #cross_p1 {
72
- animation: draw 0.5s cubic-bezier(0.65, 0, 0.45, 1) forwards;
73
- }
74
- #cross-icon[data-animate] #cross_p2 {
75
- animation: draw 0.5s cubic-bezier(0.65, 0, 0.45, 1) forwards 0.2s;
76
- }
77
- @keyframes draw {
78
- 100% {
79
- height: 376.964px;
80
- width: 45px;
81
- }
82
- }
83
- #file_info_svg {
84
- width: 20px;
85
- height: 20px;
86
- margin: 10px;
87
- color: #cecece;
88
- }
89
- #file_info ul {
90
- margin: 0;
91
- margin-bottom: 0.7em;
92
- padding-left: 1em;
93
- }
94
- #file_info ul li {
95
- text-align: left;
96
- }
97
- .browser_support_text[data-warning],
98
- .files_compilation_text[data-warning] {
99
- color: #cb5909;
100
- margin-bottom: 5px;
101
- display: block;
102
- }
103
- button:focus,
104
- a:focus,
105
- input:focus,
106
- *[data-contains-hidden-input] input:focus + * {
107
- outline-style: none;
108
- outline-offset: -2px;
109
- }
110
- *[data-contains-hidden-input] input:focus + * {
111
- outline-width: 4px;
112
- outline-offset: -2px;
113
- }
114
- html[data-last-interaction="keyboard"] button:focus,
115
- html[data-last-interaction="keyboard"] a:focus,
116
- html[data-last-interaction="keyboard"] input:focus,
117
- html[data-last-interaction="keyboard"]
118
- *[data-contains-hidden-input]
119
- input:focus
120
- + * {
121
- outline-style: auto;
122
- }
123
- html[data-last-interaction="keyboard"]
124
- *[data-contains-hidden-input]
125
- input:focus
126
- + * {
127
- outline-color: rgb(0, 150, 255);
128
- }
129
- /*
130
- Don't try to replace @-moz-document url-prefix() this by
131
-
132
- -moz-outline or -moz-outline-color
133
- Because firefox would take into account outline instead of -moz-outline
134
-
135
- :moz-focus-ring
136
- Because for some element we set the focus outline on a div which would not match :focusring
137
- */
138
- @-moz-document url-prefix() {
139
- html[data-last-interaction="keyboard"] button:focus,
140
- html[data-last-interaction="keyboard"] a:focus,
141
- html[data-last-interaction="keyboard"] input:focus,
142
- html[data-last-interaction="keyboard"]
143
- *[data-input-customized]
144
- input:focus
145
- + * {
146
- outline-width: 2px;
147
- outline-offset: 0;
148
- outline-style: solid;
149
- /*
150
- force a blue color for firefox otherwise
151
- it uses outline-color: inherit
152
- making it unpredictible and sometimes hard to see
153
- */
154
- outline-color: rgb(0, 150, 255);
155
- }
156
- }
157
- ::-moz-focus-inner {
158
- border: 0;
159
- }
160
- #eventsource-indicator button {
161
- position: relative;
162
- }
163
- #eventsource-indicator button svg {
164
- width: 40px;
165
- height: 40px;
166
- }
167
- #eventsource-indicator .event-source-livereload {
168
- position: absolute;
169
- width: 32px;
170
- height: 32px;
171
- margin: 4px;
172
- left: 0;
173
- top: 0;
174
- }
175
- .event-source-livereload[data-variant="enabled"] {
176
- color: green;
177
- }
178
- #eventsource-indicator .event-source-icon {
179
- width: 40px;
180
- height: 40px;
181
- }
182
- .eventsource-circle {
183
- stroke: black;
184
- stroke-width: 0;
185
- }
186
- .eventsource-circle[data-variant="off"] {
187
- fill: #cecece;
188
- }
189
- .eventsource-circle[data-variant="connecting"] {
190
- fill: #cecece;
191
- animation: wink 1.2s ease-out infinite;
192
- transform-origin: center;
193
- }
194
- @keyframes wink {
195
- 0% {
196
- opacity: 0;
197
- }
198
- 80% {
199
- opacity: 1;
200
- }
201
- 100% {
202
- opacity: 0;
203
- }
204
- }
205
- .eventsource-ring {
206
- stroke: rgba(206, 206, 206, 0.46);
207
- stroke-width: 4;
208
- fill: transparent;
209
- animation: pulse 1.2s ease-out infinite;
210
- transform-origin: center;
211
- }
212
- @keyframes pulse {
213
- 0% {
214
- transform: scale(0);
215
- opacity: 0;
216
- }
217
- 50% {
218
- opacity: 1;
219
- }
220
- 100% {
221
- transform: scale(1);
222
- opacity: 0;
223
- }
224
- }
225
- .eventsource-circle[data-variant="connected"] {
226
- fill: green;
227
- }
228
- .eventsource-circle[data-variant="failed"] {
229
- fill: #cc0000;
230
- }
231
- #overflow-menu-button {
232
- display: none;
233
- position: absolute;
234
- top: 0;
235
- right: 0;
236
- width: 40px;
237
- background: #404040;
238
- }
239
- #dotsIconSvg {
240
- width: 25px;
241
- }
242
- #overflow-menu {
243
- visibility: hidden; /* disable keyboard navigation */
244
- display: none;
245
- position: absolute;
246
- left: 100%;
247
- top: 0;
248
- bottom: 0;
249
- width: 100%;
250
- height: 100%;
251
- background: #404040;
252
- opacity: 0;
253
- }
254
- #overflow-menu[data-animate] {
255
- transition-property: left, opacity;
256
- transition-duration: 0.3s;
257
- }
258
- #overflow-menu > * {
259
- display: table-cell;
260
- vertical-align: middle;
261
- text-align: center;
262
- }
263
- #toolbar[data-overflow-menu-enabled] #overflow-menu-button {
264
- display: block;
265
- }
266
- #toolbar[data-overflow-menu-visible] #overflow-menu-button {
267
- background: #030713;
268
- }
269
- #toolbar[data-overflow-menu-enabled][data-overflow-menu-visible]
270
- #toolbar-wrapper {
271
- visibility: hidden; /* disable keyboard navigation */
272
- }
273
- #toolbar[data-overflow-menu-visible] #overflow-menu {
274
- visibility: visible; /* restore keyboard navigation */
275
- display: block;
276
- opacity: 1;
277
- left: 0;
278
- margin-left: -40px;
279
- }
280
- #toolbar[data-overflow-menu-enabled] #settings-box {
281
- right: -40px;
282
- }
283
- #settings-button {
284
- position: relative;
285
- }
286
- #settings-button[data-warning] svg {
287
- fill: #cb5909;
288
- }
289
- #settings-button[data-warning] svg:hover {
290
- fill: darkorange !important;
291
- }
292
- #settings-box {
293
- display: none;
294
- position: absolute;
295
- bottom: 40px;
296
- right: 0;
297
- text-align: center;
298
- padding: 17px;
299
- font-size: 14px;
300
- color: #fff;
301
- background-color: #030713;
302
- border-radius: 5px 5px 0 0;
303
- min-width: 250px;
304
- min-height: 150px;
305
- z-index: -1;
306
- }
307
- [data-active] #settings-box {
308
- display: block;
309
- animation: comeUp ease 0.3s;
310
- }
311
- @keyframes comeUp {
312
- 0% {
313
- opacity: 0;
314
- transform: translate(0, 90px);
315
- }
316
- 100% {
317
- opacity: 1;
318
- transform: translate(0, 0);
319
- }
320
- }
321
- #settings-box-body {
322
- text-align: left;
323
- padding: 18px 0;
324
- max-height: 80vh;
325
- overflow: auto;
326
- width: 100vw;
327
- display: flex;
328
- justify-content: center;
329
- }
330
- .settings-box-items-wrapper {
331
- max-width: 700px;
332
- display: flex;
333
- flex-wrap: wrap;
334
- justify-content: center;
335
- }
336
- .settings-box-item {
337
- padding: 15px;
338
- background: #0c111b;
339
- width: 250px;
340
- margin: 9px 18px;
341
- }
342
- #settings-box-header .settings-icon {
343
- fill: none;
344
- stroke: #24b1b0;
345
- stroke-width: 2;
346
- margin-right: 10px;
347
- width: 22px;
348
- height: 22px;
349
- position: relative;
350
- top: 4px;
351
- }
352
- #settings-box h3 {
353
- display: inline-block;
354
- font-size: 20px;
355
- margin: 10px 0;
356
- color: #24b1b0;
357
- }
358
- #button-close-settings {
359
- float: right;
360
- fill: #24b1b0;
361
- }
362
- #button-close-settings:hover {
363
- opacity: 0.6;
364
- }
365
- label {
366
- color: #a9a8a8;
367
- font-size: 14px;
368
- padding-bottom: 3px;
369
- display: block;
370
- }
371
- #settings-box .category-title {
372
- color: #24b1b0;
373
- font-size: 16px;
374
- display: inline-block;
375
- margin-bottom: 15px;
376
- margin-top: 4px;
377
- }
378
- #settings-box .category-title svg {
379
- fill: currentColor;
380
- vertical-align: top;
381
- margin-right: 5px;
382
- width: 18px;
383
- height: 18px;
384
- }
385
- #settings-box .category-subtitle {
386
- color: #a9a8a8;
387
- font-size: 14px;
388
- max-width: 220px;
389
- }
390
- /* checkbox switch */
391
- .switch {
392
- position: relative;
393
- float: right;
394
- width: 3.5em;
395
- height: 2em;
396
- padding: 0;
397
- cursor: pointer;
398
- }
399
- .switch input {
400
- position: absolute;
401
- opacity: 0;
402
- width: 0;
403
- height: 0;
404
- }
405
- .switch .slider {
406
- position: absolute;
407
- vertical-align: middle;
408
- height: 0.3em;
409
- left: 0.5em;
410
- right: 0.5em;
411
- top: 50%;
412
- margin-top: -0.15em;
413
- background-color: #4c4c4c;
414
- transition: 0.4s;
415
- border-radius: 0.15em;
416
- }
417
- .switch .square {
418
- position: absolute;
419
- content: "";
420
- height: 1em;
421
- width: 1em;
422
- left: 0.5em;
423
- top: 50%;
424
- margin-top: -0.5em;
425
- background-color: #4c4c4c;
426
- color: #030713;
427
- transition: 0.4s;
428
- border-radius: 0.15em;
429
- }
430
- .switch input + * {
431
- position: relative;
432
- width: 100%;
433
- height: 100%;
434
-
435
- /* It's important to have a border (event transparent)
436
- To be able to apply an outline to this element later*/
437
- border-width: 1px;
438
- border-color: transparent;
439
- border-style: solid;
440
- }
441
- .switch input:checked + * .slider {
442
- background-color: #24b1b0;
443
- }
444
- .switch input:checked + * .square {
445
- transform: translateX(1.6em);
446
- background-color: #24b1b0;
447
- }
448
- .settings-box-item[data-disabled] {
449
- background-color: rgba(12, 17, 27, 0.4);
450
- cursor: default;
451
- }
452
- .settings-box-item[data-disabled] .category-title,
453
- .settings-box-item[data-disabled] .switch,
454
- .settings-box-item[data-disabled] .category-subtitle {
455
- opacity: 0.4;
456
- }
457
- .settings-box-item[data-disabled] .category-title span {
458
- text-decoration: line-through;
459
- }
460
- .settings-box-item[data-disabled] .category-subtitle {
461
- text-decoration: line-through;
462
- }
463
- .settings-box-item[data-disabled] .switch {
464
- cursor: default;
465
- }
466
- /* general */
467
- html[data-theme="light"] #toolbar {
468
- background: #e8eff3;
469
- }
470
- /* icons */
471
- html[data-theme="light"] .iconToolbar {
472
- fill: #404040;
473
- }
474
- html[data-theme="light"] .iconToolbar:hover {
475
- fill: #757575 !important;
476
- }
477
- /* loaders */
478
- html[data-theme="light"] #loader-icon {
479
- color: #404040;
480
- }
481
- html[data-theme="light"] .livereload-circle[data-variant="off"] {
482
- fill: #757575;
483
- }
484
- html[data-theme="light"] .livereload-circle[data-variant="connecting"] {
485
- fill: #717171;
486
- }
487
- html[data-theme="light"] .livereload-ring {
488
- stroke: rgba(138, 136, 136, 0.46);
489
- }
490
- /* settings */
491
- html[data-theme="light"] #settings-box,
492
- html[data-theme="light"] #settings[data-active] button {
493
- background: #87acd3;
494
- }
495
- html[data-theme="light"] .settings-box-item {
496
- background: #97b9da;
497
- }
498
- html[data-theme="light"] #settings-box-header .settings-icon {
499
- stroke: #076570;
500
- }
501
- html[data-theme="light"] #button-close-settings {
502
- fill: #076570;
503
- }
504
- html[data-theme="light"] #settings-box h3,
505
- html[data-theme="light"] #settings-box .category-title {
506
- color: #076570;
507
- }
508
- html[data-theme="light"] #settings-box .category-title svg {
509
- fill: #076570;
510
- }
511
- html[data-theme="light"] #settings-box .category-subtitle {
512
- color: #5d5d5d;
513
- }
514
- html[data-theme="light"] label {
515
- color: #002e33;
516
- }
517
- html[data-theme="light"] .switch input + * .slider,
518
- html[data-theme="light"] .switch input + * .square {
519
- background-color: grey;
520
- }
521
- html[data-theme="light"] .switch input:checked + * .slider,
522
- html[data-theme="light"] .switch input:checked + * .square {
523
- background-color: #076570;
524
- }
525
- /* file input */
526
- html[data-theme="light"] #file[data-active] {
527
- background: rgba(129, 177, 214, 0.34);
528
- }
529
- html[data-theme="light"] #file-input {
530
- color: #076570;
531
- }
532
- /* tooltips */
533
- html[data-theme="light"] .tooltip {
534
- background-color: rgb(138, 145, 154);
535
- color: #fff;
536
- }
537
- html[data-theme="light"] .tooltipAction {
538
- border-color: #fff;
539
- }
540
- html[data-theme="light"] .tooltip::after {
541
- border-color: rgb(138, 145, 154) transparent transparent transparent;
542
- }
543
- /* overflow menu */
544
- html[data-theme="light"] #overflow-menu-button {
545
- background: #e8eff3;
546
- }
547
- html[data-theme="light"]
548
- #toolbar[data-overflow-menu-visible]
549
- #overflow-menu-button {
550
- background: #a5a9ad;
551
- }
552
- html[data-theme="light"] #overflow-menu {
553
- background: #dfe4e7;
554
- }
555
- /* page file list */
556
- html[data-theme="light"] h2,
557
- html[data-theme="light"] h4 {
558
- color: #076570;
559
- }
560
- html[data-theme="light"] #fileIconSvgConfig {
561
- fill: #076570;
562
- }
563
- html[data-theme="light"] #explorables h2 span {
564
- color: #ff8d00;
565
- }
566
- html[data-theme="light"] article[data-page="file-list"],
567
- html[data-theme="light"] #file-list-link[data-active] a {
568
- background: #bbd5ea;
569
- }
570
- html[data-theme="light"] #explorables fieldset input:checked + * {
571
- color: #ff8d00;
572
- background: #bbd5ea;
573
- }
574
- html[data-theme="light"] #explorables #explorables-header,
575
- html[data-theme="light"] #explorables fieldset label input + * {
576
- background: #ddf0ff;
577
- }
578
- html[data-theme="light"] .execution-link {
579
- background: #ddf0ff;
580
- color: #076570;
581
- }
582
- .tooltip {
583
- display: none;
584
- background-color: rgb(94, 94, 94);
585
- color: #fff;
586
- text-align: center;
587
- border-radius: 6px;
588
- position: absolute;
589
- bottom: 120%;
590
- padding: 10px;
591
- font-size: 14px;
592
- margin-left: -40px;
593
- max-width: 160px;
594
- cursor: default;
595
- }
596
- .tooltip::after {
597
- content: "";
598
- position: absolute;
599
- top: 100%;
600
- left: 60px;
601
- margin-left: -5px;
602
- border-width: 5px;
603
- border-style: solid;
604
- border-color: rgb(94, 94, 94) transparent transparent transparent;
605
- }
606
- [data-tooltip-visible] .tooltip,
607
- [data-tooltip-auto-visible] .tooltip {
608
- display: block;
609
- animation: fadeIn ease 0.4s;
610
- }
611
- @keyframes fadeIn {
612
- 0% {
613
- opacity: 0;
614
- }
615
- 100% {
616
- opacity: 1;
617
- }
618
- }
619
- .tooltipAction {
620
- display: inline-block;
621
- border: 1px solid #a0a0a0;
622
- border-radius: 3px;
623
- padding: 3px 7px;
624
- margin-top: 6px;
625
- }
626
- .tooltipAction a {
627
- vertical-align: middle;
628
- color: white;
629
- text-decoration: none;
630
- }
631
- .tooltipIcon {
632
- fill: white;
633
- width: 20px;
634
- height: 20px;
635
- vertical-align: middle;
636
- }
637
- html[data-animation-disabled] * {
638
- transition: none !important;
639
- animation-duration: 0s !important;
640
- animation-delay: 0s !important;
641
- }
642
- [data-when] {
643
- display: none !important;
644
- }
645
- * {
646
- box-sizing: border-box;
647
- }
648
- html,
649
- body {
650
- margin: 0;
651
- padding: 0;
652
- }
653
- html {
654
- font-family: arial, sans;
655
- }
656
- /* global utils */
657
- [data-force-hide] {
658
- display: none !important;
659
- }
660
- #toolbar-overlay {
661
- position: fixed;
662
- left: 0;
663
- top: 0;
664
- width: 100%;
665
- height: 100%;
666
- filter: url(#better-blur);
667
- background-color: rgba(0, 0, 0, 0.2);
668
- }
669
- #toolbar {
670
- position: fixed;
671
- bottom: 0;
672
- height: 40px;
673
- width: 100%;
674
- background: #404040;
675
- }
676
- #toolbar-wrapper {
677
- display: table;
678
- width: 100%;
679
- height: 100%;
680
- }
681
- #toolbar-wrapper > * {
682
- display: table-cell;
683
- vertical-align: middle;
684
- }
685
- #toolbar button {
686
- background: none;
687
- border: none;
688
- height: 100%;
689
- padding: 0;
690
- }
691
- #toolbar button:hover {
692
- cursor: pointer;
693
- }
694
- #toolbar a:hover {
695
- cursor: pointer;
696
- }
697
- /* file name input & indicators */
698
- #file {
699
- max-width: 40%;
700
- padding: 0 1.2em;
701
- }
702
- #file-input {
703
- width: 100%;
704
- padding: 0px;
705
- font-family: monospace;
706
- font-size: 15px;
707
- color: #cecece;
708
- background: transparent;
709
- border: transparent;
710
- display: inline-block;
711
- overflow: hidden;
712
- text-overflow: ellipsis;
713
- }
714
- #file-input:focus {
715
- border-bottom: 1px solid grey;
716
- }
717
- /* file and settings icons */
718
- #fileIconSvg,
719
- .settings-icon {
720
- width: 20px;
721
- }
722
- .iconToolbar {
723
- height: 40px;
724
- fill: #cecece;
725
- color: #cecece;
726
- }
727
- .iconToolbar:hover {
728
- fill: #909090 !important;
729
- }
730
- .toolbar-icon-wrapper {
731
- height: 100%;
732
- text-align: center;
733
- width: 40px;
734
- display: inline-block;
735
- }
736
- #file-list-link[data-active] a {
737
- background: #1f262c;
738
- }
739
- #file[data-active] {
740
- background: rgba(31, 38, 44, 0.72);
741
- }
742
- #settings[data-active] button {
743
- background: #030713;
744
- }
745
- /* close icon */
746
- #crossIconSvg {
747
- width: 18px;
748
- }
749
- /* re-open toolbar-trigger */
750
- #toolbar-trigger {
751
- display: block;
752
- overflow: hidden;
753
- position: absolute;
754
- bottom: -32px;
755
- right: 20px;
756
- height: 40px;
757
- width: 40px;
758
- padding: 0;
759
- border-radius: 5px 5px 0 0;
760
- border: 1px solid rgba(0, 0, 0, 0.33);
761
- border-bottom: none;
762
- box-shadow: 0px 0px 6px 2px rgba(0, 0, 0, 0.46);
763
- background: transparent;
764
- }
765
- #toolbar-trigger[data-animate] {
766
- transition: 600ms;
767
- }
768
- #toolbar-trigger #jsenvLogoSvg {
769
- width: 35px;
770
- height: 35px;
771
- opacity: 0;
772
- transition: 600ms;
773
- }
774
- html[data-toolbar-visible] #toolbar-trigger {
775
- display: none;
776
- }
777
- #toolbar-trigger:hover {
778
- cursor: pointer;
779
- }
780
- #toolbar-trigger[data-expanded] {
781
- bottom: 0;
782
- }
783
- #toolbar-trigger[data-expanded] #jsenvLogoSvg {
784
- opacity: 1;
785
- }
786
- /* #jsenvLogo {
787
- transition: 600ms;
788
- } */
789
- #toolbar a {
790
- color: inherit;
791
- }
792
-
793
- /*# sourceMappingURL=assets/toolbar_main.css_b1c67dd7.map */</style>
794
- <script id="jsenv_inject_systemjs">/*
795
- * SJS 6.11.0
796
- * Minimal SystemJS Build
797
- */
798
- (function () {
799
-
800
- function errMsg(errCode, msg) {
801
- return (msg || "") + " (SystemJS https://git.io/JvFET#" + errCode + ")";
802
- }
803
-
804
- var hasSymbol = typeof Symbol !== 'undefined';
805
- var hasSelf = typeof self !== 'undefined';
806
- var hasDocument = typeof document !== 'undefined';
807
-
808
- var envGlobal = hasSelf ? self : global;
809
-
810
- var baseUrl;
811
-
812
- if (hasDocument) {
813
- var baseEl = document.querySelector('base[href]');
814
- if (baseEl)
815
- baseUrl = baseEl.href;
816
- }
817
-
818
- if (!baseUrl && typeof location !== 'undefined') {
819
- baseUrl = location.href.split('#')[0].split('?')[0];
820
- var lastSepIndex = baseUrl.lastIndexOf('/');
821
- if (lastSepIndex !== -1)
822
- baseUrl = baseUrl.slice(0, lastSepIndex + 1);
823
- }
824
-
825
- var backslashRegEx = /\\/g;
826
- function resolveIfNotPlainOrUrl (relUrl, parentUrl) {
827
- if (relUrl.indexOf('\\') !== -1)
828
- relUrl = relUrl.replace(backslashRegEx, '/');
829
- // protocol-relative
830
- if (relUrl[0] === '/' && relUrl[1] === '/') {
831
- return parentUrl.slice(0, parentUrl.indexOf(':') + 1) + relUrl;
832
- }
833
- // relative-url
834
- else if (relUrl[0] === '.' && (relUrl[1] === '/' || relUrl[1] === '.' && (relUrl[2] === '/' || relUrl.length === 2 && (relUrl += '/')) ||
835
- relUrl.length === 1 && (relUrl += '/')) ||
836
- relUrl[0] === '/') {
837
- var parentProtocol = parentUrl.slice(0, parentUrl.indexOf(':') + 1);
838
- // Disabled, but these cases will give inconsistent results for deep backtracking
839
- //if (parentUrl[parentProtocol.length] !== '/')
840
- // throw Error('Cannot resolve');
841
- // read pathname from parent URL
842
- // pathname taken to be part after leading "/"
843
- var pathname;
844
- if (parentUrl[parentProtocol.length + 1] === '/') {
845
- // resolving to a :// so we need to read out the auth and host
846
- if (parentProtocol !== 'file:') {
847
- pathname = parentUrl.slice(parentProtocol.length + 2);
848
- pathname = pathname.slice(pathname.indexOf('/') + 1);
849
- }
850
- else {
851
- pathname = parentUrl.slice(8);
852
- }
853
- }
854
- else {
855
- // resolving to :/ so pathname is the /... part
856
- pathname = parentUrl.slice(parentProtocol.length + (parentUrl[parentProtocol.length] === '/'));
857
- }
858
-
859
- if (relUrl[0] === '/')
860
- return parentUrl.slice(0, parentUrl.length - pathname.length - 1) + relUrl;
861
-
862
- // join together and split for removal of .. and . segments
863
- // looping the string instead of anything fancy for perf reasons
864
- // '../../../../../z' resolved to 'x/y' is just 'z'
865
- var segmented = pathname.slice(0, pathname.lastIndexOf('/') + 1) + relUrl;
866
-
867
- var output = [];
868
- var segmentIndex = -1;
869
- for (var i = 0; i < segmented.length; i++) {
870
- // busy reading a segment - only terminate on '/'
871
- if (segmentIndex !== -1) {
872
- if (segmented[i] === '/') {
873
- output.push(segmented.slice(segmentIndex, i + 1));
874
- segmentIndex = -1;
875
- }
876
- }
877
-
878
- // new segment - check if it is relative
879
- else if (segmented[i] === '.') {
880
- // ../ segment
881
- if (segmented[i + 1] === '.' && (segmented[i + 2] === '/' || i + 2 === segmented.length)) {
882
- output.pop();
883
- i += 2;
884
- }
885
- // ./ segment
886
- else if (segmented[i + 1] === '/' || i + 1 === segmented.length) {
887
- i += 1;
888
- }
889
- else {
890
- // the start of a new segment as below
891
- segmentIndex = i;
892
- }
893
- }
894
- // it is the start of a new segment
895
- else {
896
- segmentIndex = i;
897
- }
898
- }
899
- // finish reading out the last segment
900
- if (segmentIndex !== -1)
901
- output.push(segmented.slice(segmentIndex));
902
- return parentUrl.slice(0, parentUrl.length - pathname.length) + output.join('');
903
- }
904
- }
905
-
906
- /*
907
- * Import maps implementation
908
- *
909
- * To make lookups fast we pre-resolve the entire import map
910
- * and then match based on backtracked hash lookups
911
- *
912
- */
913
-
914
- function resolveUrl (relUrl, parentUrl) {
915
- return resolveIfNotPlainOrUrl(relUrl, parentUrl) || (relUrl.indexOf(':') !== -1 ? relUrl : resolveIfNotPlainOrUrl('./' + relUrl, parentUrl));
916
- }
917
-
918
- function resolveAndComposePackages (packages, outPackages, baseUrl, parentMap, parentUrl) {
919
- for (var p in packages) {
920
- var resolvedLhs = resolveIfNotPlainOrUrl(p, baseUrl) || p;
921
- var rhs = packages[p];
922
- // package fallbacks not currently supported
923
- if (typeof rhs !== 'string')
924
- continue;
925
- var mapped = resolveImportMap(parentMap, resolveIfNotPlainOrUrl(rhs, baseUrl) || rhs, parentUrl);
926
- if (!mapped) {
927
- targetWarning('W1', p, rhs);
928
- }
929
- else
930
- outPackages[resolvedLhs] = mapped;
931
- }
932
- }
933
-
934
- function resolveAndComposeImportMap (json, baseUrl, outMap) {
935
- if (json.imports)
936
- resolveAndComposePackages(json.imports, outMap.imports, baseUrl, outMap, null);
937
-
938
- var u;
939
- for (u in json.scopes || {}) {
940
- var resolvedScope = resolveUrl(u, baseUrl);
941
- resolveAndComposePackages(json.scopes[u], outMap.scopes[resolvedScope] || (outMap.scopes[resolvedScope] = {}), baseUrl, outMap, resolvedScope);
942
- }
943
-
944
- for (u in json.depcache || {})
945
- outMap.depcache[resolveUrl(u, baseUrl)] = json.depcache[u];
946
-
947
- for (u in json.integrity || {})
948
- outMap.integrity[resolveUrl(u, baseUrl)] = json.integrity[u];
949
- }
950
-
951
- function getMatch (path, matchObj) {
952
- if (matchObj[path])
953
- return path;
954
- var sepIndex = path.length;
955
- do {
956
- var segment = path.slice(0, sepIndex + 1);
957
- if (segment in matchObj)
958
- return segment;
959
- } while ((sepIndex = path.lastIndexOf('/', sepIndex - 1)) !== -1)
960
- }
961
-
962
- function applyPackages (id, packages) {
963
- var pkgName = getMatch(id, packages);
964
- if (pkgName) {
965
- var pkg = packages[pkgName];
966
- if (pkg === null) return;
967
- if (id.length > pkgName.length && pkg[pkg.length - 1] !== '/') {
968
- targetWarning('W2', pkgName, pkg);
969
- }
970
- else
971
- return pkg + id.slice(pkgName.length);
972
- }
973
- }
974
-
975
- function targetWarning (code, match, target, msg) {
976
- console.warn(errMsg(code, [target, match].join(', ') ));
977
- }
978
-
979
- function resolveImportMap (importMap, resolvedOrPlain, parentUrl) {
980
- var scopes = importMap.scopes;
981
- var scopeUrl = parentUrl && getMatch(parentUrl, scopes);
982
- while (scopeUrl) {
983
- var packageResolution = applyPackages(resolvedOrPlain, scopes[scopeUrl]);
984
- if (packageResolution)
985
- return packageResolution;
986
- scopeUrl = getMatch(scopeUrl.slice(0, scopeUrl.lastIndexOf('/')), scopes);
987
- }
988
- return applyPackages(resolvedOrPlain, importMap.imports) || resolvedOrPlain.indexOf(':') !== -1 && resolvedOrPlain;
989
- }
990
-
991
- /*
992
- * SystemJS Core
993
- *
994
- * Provides
995
- * - System.import
996
- * - System.register support for
997
- * live bindings, function hoisting through circular references,
998
- * reexports, dynamic import, import.meta.url, top-level await
999
- * - System.getRegister to get the registration
1000
- * - Symbol.toStringTag support in Module objects
1001
- * - Hookable System.createContext to customize import.meta
1002
- * - System.onload(err, id, deps) handler for tracing / hot-reloading
1003
- *
1004
- * Core comes with no System.prototype.resolve or
1005
- * System.prototype.instantiate implementations
1006
- */
1007
-
1008
- var toStringTag = hasSymbol && Symbol.toStringTag;
1009
- var REGISTRY = hasSymbol ? Symbol() : '@';
1010
-
1011
- function SystemJS () {
1012
- this[REGISTRY] = {};
1013
- }
1014
-
1015
- var systemJSPrototype = SystemJS.prototype;
1016
-
1017
- systemJSPrototype.import = function (id, parentUrl) {
1018
- var loader = this;
1019
- return Promise.resolve(loader.prepareImport())
1020
- .then(function() {
1021
- return loader.resolve(String(id), parentUrl);
1022
- })
1023
- .then(function (id) {
1024
- var load = getOrCreateLoad(loader, id);
1025
- return load.C || topLevelLoad(loader, load);
1026
- });
1027
- };
1028
-
1029
- // Hookable createContext function -> allowing eg custom import meta
1030
- systemJSPrototype.createContext = function (parentId) {
1031
- var loader = this;
1032
- return {
1033
- url: parentId,
1034
- resolve: function (id, parentUrl) {
1035
- return Promise.resolve(loader.resolve(id, parentUrl || parentId));
1036
- }
1037
- };
1038
- };
1039
- function loadToId (load) {
1040
- return load.id;
1041
- }
1042
- function triggerOnload (loader, load, err, isErrSource) {
1043
- loader.onload(err, load.id, load.d && load.d.map(loadToId), !!isErrSource);
1044
- if (err)
1045
- throw err;
1046
- }
1047
-
1048
- var lastRegister;
1049
- systemJSPrototype.register = function (deps, declare) {
1050
- lastRegister = [deps, declare];
1051
- };
1052
-
1053
- /*
1054
- * getRegister provides the last anonymous System.register call
1055
- */
1056
- systemJSPrototype.getRegister = function () {
1057
- var _lastRegister = lastRegister;
1058
- lastRegister = undefined;
1059
- return _lastRegister;
1060
- };
1061
-
1062
- function getOrCreateLoad (loader, id, firstParentUrl) {
1063
- var load = loader[REGISTRY][id];
1064
- if (load)
1065
- return load;
1066
-
1067
- var importerSetters = [];
1068
- var ns = Object.create(null);
1069
- if (toStringTag)
1070
- Object.defineProperty(ns, toStringTag, { value: 'Module' });
1071
-
1072
- var instantiatePromise = Promise.resolve()
1073
- .then(function () {
1074
- return loader.instantiate(id, firstParentUrl);
1075
- })
1076
- .then(function (registration) {
1077
- if (!registration)
1078
- throw Error(errMsg(2, id ));
1079
- function _export (name, value) {
1080
- // note if we have hoisted exports (including reexports)
1081
- load.h = true;
1082
- var changed = false;
1083
- if (typeof name === 'string') {
1084
- if (!(name in ns) || ns[name] !== value) {
1085
- ns[name] = value;
1086
- changed = true;
1087
- }
1088
- }
1089
- else {
1090
- for (var p in name) {
1091
- var value = name[p];
1092
- if (!(p in ns) || ns[p] !== value) {
1093
- ns[p] = value;
1094
- changed = true;
1095
- }
1096
- }
1097
-
1098
- if (name && name.__esModule) {
1099
- ns.__esModule = name.__esModule;
1100
- }
1101
- }
1102
- if (changed)
1103
- for (var i = 0; i < importerSetters.length; i++) {
1104
- var setter = importerSetters[i];
1105
- if (setter) setter(ns);
1106
- }
1107
- return value;
1108
- }
1109
- var declared = registration[1](_export, registration[1].length === 2 ? {
1110
- import: function (importId) {
1111
- return loader.import(importId, id);
1112
- },
1113
- meta: loader.createContext(id)
1114
- } : undefined);
1115
- load.e = declared.execute || function () {};
1116
- return [registration[0], declared.setters || []];
1117
- }, function (err) {
1118
- load.e = null;
1119
- load.er = err;
1120
- throw err;
1121
- });
1122
-
1123
- var linkPromise = instantiatePromise
1124
- .then(function (instantiation) {
1125
- return Promise.all(instantiation[0].map(function (dep, i) {
1126
- var setter = instantiation[1][i];
1127
- return Promise.resolve(loader.resolve(dep, id))
1128
- .then(function (depId) {
1129
- var depLoad = getOrCreateLoad(loader, depId, id);
1130
- // depLoad.I may be undefined for already-evaluated
1131
- return Promise.resolve(depLoad.I)
1132
- .then(function () {
1133
- if (setter) {
1134
- depLoad.i.push(setter);
1135
- // only run early setters when there are hoisted exports of that module
1136
- // the timing works here as pending hoisted export calls will trigger through importerSetters
1137
- if (depLoad.h || !depLoad.I)
1138
- setter(depLoad.n);
1139
- }
1140
- return depLoad;
1141
- });
1142
- });
1143
- }))
1144
- .then(function (depLoads) {
1145
- load.d = depLoads;
1146
- });
1147
- });
1148
-
1149
- // Capital letter = a promise function
1150
- return load = loader[REGISTRY][id] = {
1151
- id: id,
1152
- // importerSetters, the setters functions registered to this dependency
1153
- // we retain this to add more later
1154
- i: importerSetters,
1155
- // module namespace object
1156
- n: ns,
1157
-
1158
- // instantiate
1159
- I: instantiatePromise,
1160
- // link
1161
- L: linkPromise,
1162
- // whether it has hoisted exports
1163
- h: false,
1164
-
1165
- // On instantiate completion we have populated:
1166
- // dependency load records
1167
- d: undefined,
1168
- // execution function
1169
- e: undefined,
1170
-
1171
- // On execution we have populated:
1172
- // the execution error if any
1173
- er: undefined,
1174
- // in the case of TLA, the execution promise
1175
- E: undefined,
1176
-
1177
- // On execution, L, I, E cleared
1178
-
1179
- // Promise for top-level completion
1180
- C: undefined,
1181
-
1182
- // parent instantiator / executor
1183
- p: undefined
1184
- };
1185
- }
1186
-
1187
- function instantiateAll (loader, load, parent, loaded) {
1188
- if (!loaded[load.id]) {
1189
- loaded[load.id] = true;
1190
- // load.L may be undefined for already-instantiated
1191
- return Promise.resolve(load.L)
1192
- .then(function () {
1193
- if (!load.p || load.p.e === null)
1194
- load.p = parent;
1195
- return Promise.all(load.d.map(function (dep) {
1196
- return instantiateAll(loader, dep, parent, loaded);
1197
- }));
1198
- })
1199
- .catch(function (err) {
1200
- if (load.er)
1201
- throw err;
1202
- load.e = null;
1203
- throw err;
1204
- });
1205
- }
1206
- }
1207
-
1208
- function topLevelLoad (loader, load) {
1209
- return load.C = instantiateAll(loader, load, load, {})
1210
- .then(function () {
1211
- return postOrderExec(loader, load, {});
1212
- })
1213
- .then(function () {
1214
- return load.n;
1215
- });
1216
- }
1217
-
1218
- // the closest we can get to call(undefined)
1219
- var nullContext = Object.freeze(Object.create(null));
1220
-
1221
- // returns a promise if and only if a top-level await subgraph
1222
- // throws on sync errors
1223
- function postOrderExec (loader, load, seen) {
1224
- if (seen[load.id])
1225
- return;
1226
- seen[load.id] = true;
1227
-
1228
- if (!load.e) {
1229
- if (load.er)
1230
- throw load.er;
1231
- if (load.E)
1232
- return load.E;
1233
- return;
1234
- }
1235
-
1236
- // deps execute first, unless circular
1237
- var depLoadPromises;
1238
- load.d.forEach(function (depLoad) {
1239
- try {
1240
- var depLoadPromise = postOrderExec(loader, depLoad, seen);
1241
- if (depLoadPromise)
1242
- (depLoadPromises = depLoadPromises || []).push(depLoadPromise);
1243
- }
1244
- catch (err) {
1245
- load.e = null;
1246
- load.er = err;
1247
- throw err;
1248
- }
1249
- });
1250
- if (depLoadPromises)
1251
- return Promise.all(depLoadPromises).then(doExec);
1252
-
1253
- return doExec();
1254
-
1255
- function doExec () {
1256
- try {
1257
- var execPromise = load.e.call(nullContext);
1258
- if (execPromise) {
1259
- execPromise = execPromise.then(function () {
1260
- load.C = load.n;
1261
- load.E = null; // indicates completion
1262
- if (!true) ;
1263
- }, function (err) {
1264
- load.er = err;
1265
- load.E = null;
1266
- if (!true) ;
1267
- throw err;
1268
- });
1269
- return load.E = execPromise;
1270
- }
1271
- // (should be a promise, but a minify optimization to leave out Promise.resolve)
1272
- load.C = load.n;
1273
- load.L = load.I = undefined;
1274
- }
1275
- catch (err) {
1276
- load.er = err;
1277
- throw err;
1278
- }
1279
- finally {
1280
- load.e = null;
1281
- }
1282
- }
1283
- }
1284
-
1285
- envGlobal.System = new SystemJS();
1286
-
1287
- /*
1288
- * SystemJS browser attachments for script and import map processing
1289
- */
1290
-
1291
- var importMapPromise = Promise.resolve();
1292
- var importMap = { imports: {}, scopes: {}, depcache: {}, integrity: {} };
1293
- systemJSPrototype.importMap = importMap;
1294
- systemJSPrototype.baseUrl = baseUrl;
1295
-
1296
- // Scripts are processed immediately, on the first System.import, and on DOMReady.
1297
- // Import map scripts are processed only once (by being marked) and in order for each phase.
1298
- // This is to avoid using DOM mutation observers in core, although that would be an alternative.
1299
- var processFirst = hasDocument;
1300
- systemJSPrototype.prepareImport = function (doProcessScripts) {
1301
- if (processFirst || doProcessScripts) {
1302
- processScripts();
1303
- processFirst = false;
1304
- }
1305
- return importMapPromise;
1306
- };
1307
- if (hasDocument) {
1308
- processScripts();
1309
- window.addEventListener('DOMContentLoaded', processScripts);
1310
- }
1311
-
1312
- function processScripts () {
1313
- [].forEach.call(document.querySelectorAll('script'), function (script) {
1314
- if (script.sp) // sp marker = systemjs processed
1315
- return;
1316
- // TODO: deprecate systemjs-module in next major now that we have auto import
1317
- if (script.type === 'systemjs-module') {
1318
- script.sp = true;
1319
- if (!script.src)
1320
- return;
1321
- System.import(script.src.slice(0, 7) === 'import:' ? script.src.slice(7) : resolveUrl(script.src, baseUrl)).catch(function (e) {
1322
- // if there is a script load error, dispatch an "error" event
1323
- // on the script tag.
1324
- if (e.message.indexOf('https://git.io/JvFET#3') > -1) {
1325
- var event = document.createEvent('Event');
1326
- event.initEvent('error', false, false);
1327
- script.dispatchEvent(event);
1328
- }
1329
- return Promise.reject(e);
1330
- });
1331
- }
1332
- else if (script.type === 'systemjs-importmap') {
1333
- script.sp = true;
1334
- var fetchPromise = script.src ? fetch(script.src, { integrity: script.integrity }).then(function (res) {
1335
- if (!res.ok)
1336
- throw Error( res.status );
1337
- return res.text();
1338
- }).catch(function (err) {
1339
- err.message = errMsg('W4', script.src ) + '\n' + err.message;
1340
- console.warn(err);
1341
- if (typeof script.onerror === 'function') {
1342
- script.onerror();
1343
- }
1344
- return '{}';
1345
- }) : script.innerHTML;
1346
- importMapPromise = importMapPromise.then(function () {
1347
- return fetchPromise;
1348
- }).then(function (text) {
1349
- extendImportMap(importMap, text, script.src || baseUrl);
1350
- return importMap
1351
- });
1352
- }
1353
- });
1354
- }
1355
-
1356
- function extendImportMap (importMap, newMapText, newMapUrl) {
1357
- var newMap = {};
1358
- try {
1359
- newMap = JSON.parse(newMapText);
1360
- } catch (err) {
1361
- console.warn(Error(( errMsg('W5') )));
1362
- }
1363
- resolveAndComposeImportMap(newMap, newMapUrl, importMap);
1364
- }
1365
- System.extendImportMap = extendImportMap
1366
-
1367
- /*
1368
- * Script instantiation loading
1369
- */
1370
-
1371
- if (hasDocument) {
1372
- window.addEventListener('error', function (evt) {
1373
- lastWindowErrorUrl = evt.filename;
1374
- lastWindowError = evt.error;
1375
- });
1376
- var baseOrigin = location.origin;
1377
- }
1378
-
1379
- systemJSPrototype.createScript = function (url) {
1380
- var script = document.createElement('script');
1381
- script.async = true;
1382
- // Only add cross origin for actual cross origin
1383
- // this is because Safari triggers for all
1384
- // - https://bugs.webkit.org/show_bug.cgi?id=171566
1385
- if (url.indexOf(baseOrigin + '/'))
1386
- script.crossOrigin = 'anonymous';
1387
- var integrity = importMap.integrity[url];
1388
- if (integrity)
1389
- script.integrity = integrity;
1390
- script.src = url;
1391
- return script;
1392
- };
1393
-
1394
- // Auto imports -> script tags can be inlined directly for load phase
1395
- var lastAutoImportDeps, lastAutoImportTimeout;
1396
- var autoImportCandidates = {};
1397
- var systemRegister = systemJSPrototype.register;
1398
- var inlineScriptCount = 0;
1399
- systemJSPrototype.register = function (deps, declare, autoUrl) {
1400
- if (hasDocument && document.readyState === 'loading' && typeof deps !== 'string') {
1401
- var scripts = document.querySelectorAll('script[src]');
1402
- var lastScript = scripts[scripts.length - 1];
1403
- var lastAutoImportUrl
1404
- lastAutoImportDeps = deps;
1405
- if (lastScript && lastScript.src) {
1406
- lastAutoImportUrl = lastScript.src;
1407
- }
1408
- else if (autoUrl) {
1409
- lastAutoImportUrl = autoUrl
1410
- }
1411
- else {
1412
- inlineScriptCount++
1413
- lastAutoImportUrl = document.location.href + "__inline_script__" + inlineScriptCount;
1414
- }
1415
- // if this is already a System load, then the instantiate has already begun
1416
- // so this re-import has no consequence
1417
- var loader = this;
1418
- lastAutoImportTimeout = setTimeout(function () {
1419
- autoImportCandidates[lastAutoImportUrl] = [deps, declare];
1420
- loader.import(lastAutoImportUrl);
1421
- });
1422
- }
1423
- else {
1424
- lastAutoImportDeps = undefined;
1425
- }
1426
- return systemRegister.call(this, deps, declare);
1427
- };
1428
-
1429
- var lastWindowErrorUrl, lastWindowError;
1430
- systemJSPrototype.instantiate = function (url, firstParentUrl) {
1431
- var autoImportRegistration = autoImportCandidates[url];
1432
- if (autoImportRegistration) {
1433
- delete autoImportCandidates[url];
1434
- return autoImportRegistration;
1435
- }
1436
- var loader = this;
1437
- return Promise.resolve(systemJSPrototype.createScript(url)).then(function (script) {
1438
- return new Promise(function (resolve, reject) {
1439
- script.addEventListener('error', function () {
1440
- reject(Error(errMsg(3, [url, firstParentUrl].join(', ') )));
1441
- });
1442
- script.addEventListener('load', function () {
1443
- document.head.removeChild(script);
1444
- // Note that if an error occurs that isn't caught by this if statement,
1445
- // that getRegister will return null and a "did not instantiate" error will be thrown.
1446
- if (lastWindowErrorUrl === url) {
1447
- reject(lastWindowError);
1448
- }
1449
- else {
1450
- var register = loader.getRegister(url);
1451
- // Clear any auto import registration for dynamic import scripts during load
1452
- if (register && register[0] === lastAutoImportDeps)
1453
- clearTimeout(lastAutoImportTimeout);
1454
- resolve(register);
1455
- }
1456
- });
1457
- document.head.appendChild(script);
1458
- });
1459
- });
1460
- };
1461
-
1462
- /*
1463
- * Fetch loader, sets up shouldFetch and fetch hooks
1464
- */
1465
- systemJSPrototype.shouldFetch = function () {
1466
- return false;
1467
- };
1468
- if (typeof fetch !== 'undefined')
1469
- systemJSPrototype.fetch = fetch;
1470
-
1471
- var instantiate = systemJSPrototype.instantiate;
1472
- var jsContentTypeRegEx = /^(text|application)\/(x-)?javascript(;|$)/;
1473
- systemJSPrototype.instantiate = function (url, parent) {
1474
- var loader = this;
1475
- if (!this.shouldFetch(url))
1476
- return instantiate.apply(this, arguments);
1477
- return this.fetch(url, {
1478
- credentials: 'same-origin',
1479
- integrity: importMap.integrity[url]
1480
- })
1481
- .then(function (res) {
1482
- if (!res.ok)
1483
- throw Error(errMsg(7, [res.status, res.statusText, url, parent].join(', ') ));
1484
- var contentType = res.headers.get('content-type');
1485
- if (!contentType || !jsContentTypeRegEx.test(contentType))
1486
- throw Error(errMsg(4, contentType ));
1487
- return res.text().then(function (source) {
1488
- if (source.indexOf('//# sourceURL=') < 0)
1489
- source += '\n//# sourceURL=' + url;
1490
- (0, eval)(source);
1491
- return loader.getRegister(url);
1492
- });
1493
- });
1494
- };
1495
-
1496
- systemJSPrototype.resolve = function (id, parentUrl) {
1497
- parentUrl = parentUrl || !true || baseUrl;
1498
- return resolveImportMap(( importMap), resolveIfNotPlainOrUrl(id, parentUrl) || id, parentUrl) || throwUnresolved(id, parentUrl);
1499
- };
1500
-
1501
- function throwUnresolved (id, parentUrl) {
1502
- throw Error(errMsg(8, [id, parentUrl].join(', ') ));
1503
- }
1504
-
1505
- var systemInstantiate = systemJSPrototype.instantiate;
1506
- systemJSPrototype.instantiate = function (url, firstParentUrl) {
1507
- var preloads = ( importMap).depcache[url];
1508
- if (preloads) {
1509
- for (var i = 0; i < preloads.length; i++)
1510
- getOrCreateLoad(this, this.resolve(preloads[i], url), url);
1511
- }
1512
- return systemInstantiate.call(this, url, firstParentUrl);
1513
- };
1514
-
1515
- /*
1516
- * Supports loading System.register in workers
1517
- */
1518
-
1519
- if (hasSelf && typeof importScripts === 'function') {
1520
- systemJSPrototype.instantiate = function (url) {
1521
- var loader = this;
1522
- return self.fetch(url, {
1523
- credentials: 'same-origin',
1524
- }).then(function (response) {
1525
- if (!response.ok) {
1526
- throw Error(errMsg(7, [response.status, response.statusText, url].join(', ') ));
1527
- }
1528
- return response.text()
1529
- }).then(function (source) {
1530
- if (source.indexOf('//# sourceURL=') < 0) source += '\n//# sourceURL=' + url;
1531
- (0, eval)(source);
1532
- return loader.getRegister(url);
1533
- })
1534
- };
1535
- }
1536
-
1537
- }());
1538
-
1539
- (function(){
1540
- var envGlobal = typeof self !== 'undefined' ? self : global;
1541
- var System = envGlobal.System;
1542
-
1543
- var registerRegistry = Object.create(null)
1544
- var register = System.register;
1545
- System.registerRegistry = registerRegistry;
1546
- System.register = function (name, deps, declare) {
1547
- if (typeof name !== 'string') return register.apply(this, arguments);
1548
- var define = [deps, declare];
1549
- return System.prepareImport().then(function () {
1550
- var url = System.resolve(`./${name}`);
1551
- registerRegistry[url] = define;
1552
- return register.call(System, deps, declare, url);
1553
- })
1554
- };
1555
-
1556
- var instantiate = System.instantiate;
1557
- System.instantiate = function (url, firstParentUrl) {
1558
- var result = registerRegistry[url];
1559
-
1560
- if (result) {
1561
- registerRegistry[url] = null;
1562
- return result;
1563
- } else {
1564
- return instantiate.call(this, url, firstParentUrl);
1565
- }
1566
- };
1567
-
1568
- var getRegister = System.getRegister;
1569
- System.getRegister = function (url) {
1570
- // Calling getRegister() because other extras need to know it was called so they can perform side effects
1571
- var register = getRegister.call(this, url);
1572
- var result = registerRegistry[url] || register;
1573
- return result;
1574
- };
1575
- }());
1576
-
1577
- (function () {
1578
- // worker or service worker
1579
- if (typeof WorkerGlobalScope === 'function' && self instanceof WorkerGlobalScope) {
1580
- var importMapFromParentPromise = new Promise((resolve) => {
1581
- var importmapMessageCallback = function (e) {
1582
- if (e.data === "__importmap_init__") {
1583
- self.removeEventListener("message", importmapMessageCallback)
1584
- e.ports[0].onmessage = (message) => {
1585
- resolve(message.data)
1586
- }
1587
- e.ports[0].postMessage('__importmap_request__')
1588
- }
1589
- };
1590
- self.addEventListener("message", importmapMessageCallback)
1591
- })
1592
- // var prepareImport = System.prepareImport
1593
- System.prepareImport = function () {
1594
- return importMapFromParentPromise.then(function (importmap) {
1595
- System.extendImportMap(System.importMap, JSON.stringify(importmap), System.baseUrl)
1596
- })
1597
- }
1598
-
1599
- // auto import first register
1600
- var messageEvents = []
1601
- var messageCallback = (event) => {
1602
- messageEvents.push(event)
1603
- }
1604
- self.addEventListener('message', messageCallback)
1605
- var register = System.register;
1606
- System.register = function(deps, declare) {
1607
- System.register = register;
1608
- System.registerRegistry[self.location.href] = [deps, declare];
1609
- return System.import(self.location.href).then((result) => {
1610
- self.removeEventListener('message', messageCallback)
1611
- messageEvents.forEach((messageEvent) => {
1612
- self.dispatchEvent(messageEvent)
1613
- })
1614
- messageEvents = null
1615
- return result
1616
- })
1617
- }
1618
- }
1619
- else if (typeof window === 'object') {
1620
- var WorkerConstructor = window.Worker;
1621
- if (typeof WorkerConstructor === 'function') {
1622
- window.Worker = function (url, options) {
1623
- var worker = new WorkerConstructor(url, options);
1624
- var importmapChannel = new MessageChannel();
1625
- importmapChannel.port1.onmessage = function (message) {
1626
- System.prepareImport().then(function (importmap) {
1627
- message.target.postMessage(importmap);
1628
- });
1629
- }
1630
- worker.postMessage('__importmap_init__', [importmapChannel.port2]);
1631
- return worker
1632
- }
1633
- }
1634
-
1635
- var serviceWorker = navigator.serviceWorker;
1636
- if (serviceWorker) {
1637
- var register = serviceWorker.register;
1638
- serviceWorker.register = function(url, options) {
1639
- var registrationPromise = register.call(this, url, options);
1640
- registrationPromise.then(function(registration) {
1641
- var installing = registration.installing;
1642
- var waiting = registration.waiting;
1643
- var active = registration.active;
1644
- var worker = installing || waiting || active;
1645
- var importmapChannel = new MessageChannel();
1646
- importmapChannel.port1.onmessage = function (message) {
1647
- System.prepareImport().then(function (importmap) {
1648
- message.target.postMessage(importmap)
1649
- });
1650
- }
1651
- worker.postMessage('__importmap_init__', [importmapChannel.port2]);
1652
- })
1653
- return registrationPromise
1654
- }
1655
- }
1656
- }
1657
- }());</script>
1658
- </head>
1659
- <body>
1660
- <div id="toolbar-overlay"></div>
1661
- <!-- toolbar -->
1662
- <div id="toolbar">
1663
- <div id="toolbar-wrapper">
1664
- <section id="file-list-link" data-responsive-toolbar-element="">
1665
- <a class="toolbar-icon-wrapper" href="javascript:void(0);">
1666
- <svg id="fileIconSvg" class="iconToolbar" viewBox="0 0 24 24" width="35" height="35">
1667
- <path d="M0 0h24v24H0V0z" fill="none"></path>
1668
- <path d="M8 16h8v2H8zm0-4h8v2H8zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm4 18H6V4h7v5h5v11z"></path>
1669
- </svg>
1670
- </a>
1671
- </section>
1672
-
1673
- <section id="file">
1674
- <input type="text" id="file-input" value="" dir="rtl" tabindex="-1" readonly="">
1675
- </section>
1676
-
1677
- <section id="execution-indicator">
1678
- <div data-when="execution:default">
1679
- <div class="tooltip">Unknown state</div>
1680
- </div>
1681
- <div data-when="execution:running">
1682
- <div class="tooltip">Executing...</div>
1683
- <button>
1684
- <svg id="loader-icon" data-animate="">
1685
- <use xlink:href="#loading_svg"></use>
1686
- </svg>
1687
- </button>
1688
- </div>
1689
- <div data-when="execution:completed">
1690
- <div class="tooltip">Execution completed in X ms</div>
1691
- <button>
1692
- <svg id="check-icon" data-animate="" viewBox="0 0 52 52">
1693
- <path fill="none" d="M14.1 27.2l7.1 7.2 16.7-16.8"></path>
1694
- </svg>
1695
- </button>
1696
- </div>
1697
- <div data-when="execution:errored">
1698
- <div class="tooltip">Execution failed in X ms</div>
1699
- <button>
1700
- <svg id="cross-icon" data-animate="" viewBox="0 0 512 512">
1701
- <rect id="cross_p1" x="239.397" y="67.518" rx="17" ry="17" transform="matrix(0.7071 0.7071 -0.7071 0.7071 255.9995 -106.0389)"></rect>
1702
- <rect id="cross_p2" x="239.397" y="67.519" rx="17" ry="17" transform="matrix(0.7071 -0.7071 0.7071 0.7071 -106.039 256.0001)"></rect>
1703
- </svg>
1704
- </button>
1705
- </div>
1706
- </section>
1707
-
1708
- <div style="width: 100%"></div>
1709
-
1710
- <section id="eventsource-indicator" data-responsive-toolbar-element="">
1711
- <div data-when="eventsource:default">
1712
- <div class="tooltip">Unknown state</div>
1713
- <button>
1714
- <svg>
1715
- <circle class="eventsource-circle" cx="20" cy="20" r="5"></circle>
1716
- </svg>
1717
- </button>
1718
- </div>
1719
- <div data-when="eventsource:connecting">
1720
- <div class="tooltip">
1721
- Connecting to server...
1722
- <br>
1723
- <div class="tooltipAction">
1724
- <a href="javascript:void(0);">
1725
- <svg xmlns="http://www.w3.org/2000/svg" id="powerOffIconSvg" class="tooltipIcon" viewBox="0 0 24 24">
1726
- <path d="M0 0h24v24H0V0z" fill="none"></path>
1727
- <path d="M10 3H8v1.88l2 2zm6 6v3.88l1.8 1.8.2-.2V9c0-1.1-.9-2-2-2V3h-2v4h-3.88l2 2H16zM4.12 3.84L2.71 5.25 6 8.54v5.96L9.5 18v3h5v-3l.48-.48 4.47 4.47 1.41-1.41L4.12 3.84zm8.38 13.33V19h-1v-1.83L8 13.65v-3.11l5.57 5.57-1.07 1.06z"></path>
1728
- </svg>
1729
- cancel
1730
- </a>
1731
- </div>
1732
- </div>
1733
- <button>
1734
- <svg>
1735
- <circle class="eventsource-circle" data-variant="connecting" cx="20" cy="20" r="5"></circle>
1736
- <circle class="eventsource-ring" cx="20" cy="20" r="13"></circle>
1737
- </svg>
1738
- </button>
1739
- </div>
1740
- <div data-when="eventsource:disconnected">
1741
- <div class="tooltip">
1742
- Disconnected from server
1743
- <br>
1744
- <div class="tooltipAction">
1745
- <a href="javascript:void(0);">
1746
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" id="powerIconSvg" class="tooltipIcon">
1747
- <path d="M0 0h24v24H0V0z" fill="none"></path>
1748
- <path d="M16 9v4.66l-3.5 3.51V19h-1v-1.83L8 13.65V9h8m0-6h-2v4h-4V3H8v4h-.01C6.9 6.99 6 7.89 6 8.98v5.52L9.5 18v3h5v-3l3.5-3.51V9c0-1.1-.9-2-2-2V3z"></path>
1749
- </svg>
1750
- connect
1751
- </a>
1752
- </div>
1753
- </div>
1754
- <button>
1755
- <svg>
1756
- <circle class="eventsource-circle" data-variant="off" cx="20" cy="20" r="5"></circle>
1757
- </svg>
1758
- </button>
1759
- </div>
1760
- <div data-when="eventsource:connected">
1761
- <div class="tooltip">
1762
- Connected to server
1763
- <br>
1764
- Livereload:
1765
- <span data-when="livereload:on" style="color: green">ON</span><span data-when="livereload:off" style="color: grey">OFF</span>
1766
- <br>
1767
- Changes:
1768
- <span data-when="changes:yes"><a class="eventsource-changes-link" style="color: inherit" href="javascript:void(0);">X</a></span><span data-when="changes:no">none</span>
1769
- <div data-when="changes:yes">
1770
- <br>
1771
- <a class="eventsource-reload-link" style="color: inherit" href="javascript:void(0);">reload</a>
1772
- </div>
1773
- </div>
1774
- <button>
1775
- <div data-when="livereload:on">
1776
- <svg class="event-source-livereload iconToolbar" data-variant="enabled">
1777
- <use xlink:href="#loading_svg"></use>
1778
- </svg>
1779
- </div>
1780
- <div data-when="changes:yes">
1781
- <svg class="event-source-livereload iconToolbar" data-variant="disabled">
1782
- <use xlink:href="#loading_svg"></use>
1783
- </svg>
1784
- </div>
1785
- <svg class="event-source-icon">
1786
- <circle class="eventsource-circle" data-variant="connected" cx="20" cy="20" r="5"></circle>
1787
- </svg>
1788
- </button>
1789
- </div>
1790
- </section>
1791
-
1792
- <section id="settings" data-responsive-toolbar-element="">
1793
- <div id="settings-box">
1794
- <div id="settings-box-header">
1795
- <button id="button-close-settings">
1796
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="18px" height="18px">
1797
- <path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"></path>
1798
- <path d="M0 0h24v24H0z" fill="none"></path>
1799
- </svg>
1800
- </button>
1801
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="35px" height="35px" class="settings-icon">
1802
- <path d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z"></path>
1803
- </svg>
1804
- <h3>Settings</h3>
1805
- </div>
1806
- <div id="settings-box-body">
1807
- <div class="settings-box-items-wrapper">
1808
- <div class="settings-box-item settings-notification">
1809
- <div class="category-title">
1810
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20px" height="20px">
1811
- <path d="M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z"></path>
1812
- </svg>
1813
- Notifications
1814
- </div>
1815
- <label class="switch" data-contains-hidden-input="">
1816
- <input id="toggle-notifs" type="checkbox">
1817
- <div>
1818
- <div class="slider"></div>
1819
- <div class="square"></div>
1820
- </div>
1821
- </label>
1822
- <div class="category-subtitle">
1823
- Send system notification when execution fails or is fixed.
1824
- <div class="notification-text">
1825
- <a data-when="notif_granted:no" class="request_notification_permission" href="javascript:void(0);">Enable notification</a>
1826
- </div>
1827
- </div>
1828
- </div>
1829
- <div class="settings-box-item settings-livereload">
1830
- <div class="category-title">
1831
- <svg width="20px" height="20px">
1832
- <use xlink:href="#loading_svg"></use>
1833
- </svg>
1834
- <span>Livereload</span>
1835
- </div>
1836
- <label class="switch" data-contains-hidden-input="">
1837
- <input id="toggle-livereload" type="checkbox">
1838
- <div>
1839
- <div class="slider"></div>
1840
- <div class="square"></div>
1841
- </div>
1842
- </label>
1843
- <div class="category-subtitle">
1844
- Reload page when a file is modified, deleted or created.
1845
- </div>
1846
- </div>
1847
- <div class="settings-box-item">
1848
- <div class="category-title">
1849
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20px" height="20px">
1850
- <path d="M18 3v2h-2V3H8v2H6V3H4v18h2v-2h2v2h8v-2h2v2h2V3h-2zM8 17H6v-2h2v2zm0-4H6v-2h2v2zm0-4H6V7h2v2zm10 8h-2v-2h2v2zm0-4h-2v-2h2v2zm0-4h-2V7h2v2z"></path>
1851
- <path d="M0 0h24v24H0z" fill="none"></path>
1852
- </svg>
1853
- Animations
1854
- </div>
1855
- <label class="switch" data-contains-hidden-input="">
1856
- <input id="toggle-anims" type="checkbox">
1857
- <div>
1858
- <div class="slider"></div>
1859
- <div class="square"></div>
1860
- </div>
1861
- </label>
1862
- <div class="category-subtitle">
1863
- Play toolbar animations and transitions.
1864
- </div>
1865
- </div>
1866
- <div class="settings-box-item">
1867
- <div class="category-title">
1868
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20px" height="20px" id="paletteIconSvg">
1869
- <path d="M12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9c.83 0 1.5-.67 1.5-1.5 0-.39-.15-.74-.39-1.01-.23-.26-.38-.61-.38-.99 0-.83.67-1.5 1.5-1.5H16c2.76 0 5-2.24 5-5 0-4.42-4.03-8-9-8zm-5.5 9c-.83 0-1.5-.67-1.5-1.5S5.67 9 6.5 9 8 9.67 8 10.5 7.33 12 6.5 12zm3-4C8.67 8 8 7.33 8 6.5S8.67 5 9.5 5s1.5.67 1.5 1.5S10.33 8 9.5 8zm5 0c-.83 0-1.5-.67-1.5-1.5S13.67 5 14.5 5s1.5.67 1.5 1.5S15.33 8 14.5 8zm3 4c-.83 0-1.5-.67-1.5-1.5S16.67 9 17.5 9s1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"></path>
1870
- <path d="M0 0h24v24H0z" fill="none"></path>
1871
- </svg>
1872
- Dark mode
1873
- </div>
1874
- <label class="switch" data-contains-hidden-input="">
1875
- <input id="checkbox-dark-theme" type="checkbox">
1876
- <div>
1877
- <div class="slider"></div>
1878
- <div class="square"></div>
1879
- </div>
1880
- </label>
1881
- <div class="category-subtitle">
1882
- Choose between light and dark theme for jsenv toolbar.
1883
- </div>
1884
- </div>
1885
- <div class="settings-box-item" id="browser_support">
1886
- <div class="category-title">
1887
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="20px" height="20px" style="enable-background: new 0 0 512 512" id="browser_support_svg">
1888
- <path d="M497.938,430.063l-126.914-126.91C389.287,272.988,400,237.762,400,200C400,89.719,310.281,0,200,0
1889
- C89.719,0,0,89.719,0,200c0,110.281,89.719,200,200,200c37.762,0,72.984-10.711,103.148-28.973l126.914,126.91
1890
- C439.438,507.313,451.719,512,464,512c12.281,0,24.563-4.688,33.938-14.063C516.688,479.195,516.688,448.805,497.938,430.063z
1891
- M64,200c0-74.992,61.016-136,136-136s136,61.008,136,136s-61.016,136-136,136S64,274.992,64,200z"></path>
1892
- </svg>
1893
- Browser support
1894
- </div>
1895
- <div class="category-subtitle">
1896
- <div>
1897
- <span class="browser_support_text" data-when="browserSupport:no">No browser support</span>
1898
- <span class="browser_support_text" data-when="browserSupport:partial">Excellent browser support
1899
- <span class="emoji">❤️</span></span>
1900
- <span class="browser_support_text" data-when="browserSupport:full">Perfect browser support
1901
- <span class="emoji">❤️</span></span>
1902
- </div>
1903
- <a class="browser_support_read_more_link" href="javascript:void(0);">Read more</a>
1904
- </div>
1905
- </div>
1906
- <div class="settings-box-item" id="files_compilation">
1907
- <div class="category-title">
1908
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="-74 0 512 512" width="20px" height="20px" id="browser_support_svg">
1909
- <path d="m361.414062 443.589844-108.269531-263.902344c-6.003906-14.640625-9.050781-30.085938-9.050781-45.910156v-69.757813c0-7.511719 2.925781-14.574219 8.238281-19.886719 6.476563-6.476562 10.046875-15.089843 10.046875-24.25v-9.882812c0-5.523438-4.480468-10-10-10h-139.621094c-5.523437 0-10 4.476562-10 10v9.882812c0 9.160157 3.566407 17.773438 10.042969 24.25 5.3125 5.3125 8.238281 12.375 8.238281 19.890626v69.753906c0 15.824218-3.042968 31.269531-9.050781 45.910156l-29.75 72.515625c-.011719.027344-.023437.054687-.035156.082031l-78.484375 191.304688c-6.285156 15.324218-4.53125 32.6875 4.695312 46.441406 9.226563 13.757812 24.621094 21.96875 41.183594 21.96875h265.9375c16.5625 0 31.960938-8.210938 41.1875-21.96875 9.222656-13.757812 10.976563-31.117188 4.691406-46.441406zm-230.921874-256.3125c7-17.058594 10.546874-35.058594 10.546874-53.5v-69.757813c0-12.851562-5.003906-24.9375-14.09375-34.027343-2.671874-2.671876-4.15625-6.21875-4.1875-9.992188h119.621094c-.03125 3.773438-1.515625 7.316406-4.191406 9.992188-9.085938 9.089843-14.09375 21.171874-14.09375 34.027343v69.753907c0 18.441406 3.550781 36.441406 10.546875 53.5l24.144531 58.851562h-152.4375zm209.617187 291.613281c-5.585937 8.332031-14.542969 13.109375-24.574219 13.109375h-265.9375c-10.027344 0-18.984375-4.777344-24.574218-13.109375-4.214844-6.285156-5.824219-13.574219-4.730469-20.761719h16.476562c5.519531 0 10-4.480468 10-10 0-5.523437-4.480469-10-10-10h-9.1875l11.484375-28h16.867188c5.523437 0 10-4.480468 10-10 0-5.523437-4.476563-10-10-10h-8.660156l11.484374-28h17.34375c5.523438 0 10-4.480468 10-10 0-5.523437-4.476562-10-10-10h-9.136718l11.488281-28h17.8125c5.523437 0 10-4.480468 10-10 0-5.523437-4.476563-10-10-10h-9.609375l11.488281-28h168.84375l75.921875 185.054688c3.804688 9.277344 2.785156 19.378906-2.800781 27.707031zm0 0"></path>
1910
- <path d="m312.03125 444.214844c-2.09375-5.113282-7.929688-7.558594-13.042969-5.46875-5.109375 2.09375-7.558593 7.929687-5.46875 13.042968l.054688.125c1.585937 3.871094 5.316406 6.214844 9.257812 6.214844 1.261719 0 2.542969-.238281 3.785157-.746094 5.109374-2.09375 7.558593-7.933593 5.464843-13.042968zm0 0"></path>
1911
- <path d="m297.898438 409.761719-35.8125-87.289063c-2.09375-5.109375-7.933594-7.554687-13.046876-5.457031-5.109374 2.09375-7.550781 7.9375-5.457031 13.046875l35.8125 87.289062c1.585938 3.871094 5.316407 6.207032 9.257813 6.207032 1.261718 0 2.546875-.238282 3.789062-.75 5.109375-2.09375 7.554688-7.9375 5.457032-13.046875zm0 0"></path>
1912
- </svg>
1913
- Files compilation
1914
- </div>
1915
- <div class="category-subtitle">
1916
- <div class="files_compilation_text">
1917
- <span data-when="filesCompilation:no">Files shown are source files</span>
1918
- <span data-when="filesCompilation:html_only">Files shown are source files, except html</span>
1919
- <span data-when="filesCompilation:yes">Files shown are compiled for {runtime}</span>
1920
- <span data-when="filesCompilation:mismatch">Files shown are compiled for an other runtime</span>
1921
- </div>
1922
- <a data-when="compilation_link:source" class="link_to_source_files" href="javascript:void(0);">Switch to source files</a>
1923
- <a data-when="compilation_link:mismatch" class="link_to_appropriate_files" href="javascript:void(0);">Switch to appropriate files</a>
1924
- <a data-when="compilation_link:compiled" class="link_to_compiled_files" href="javascript:void(0);">Switch to compiled files</a>
1925
- <a data-when="compilation_link:force" class="link_to_compilation_forced_files" href="javascript:void(0);">Force compilation</a>
1926
- </div>
1927
- </div>
1928
- </div>
1929
- </div>
1930
- </div>
1931
- <button id="settings-button" class="toolbar-icon-wrapper">
1932
- <div data-when="has_warning:yes">
1933
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 45.818 45.818" width="20px" height="20px" class="iconToolbar" style="transform: rotate(180deg)">
1934
- <path d="M22.909,0C10.258,0,0,10.257,0,22.908c0,12.652,10.258,22.91,22.909,22.91s22.909-10.258,22.909-22.91
1935
- C45.818,10.257,35.561,0,22.909,0z M26.411,35.417c0,1.921-1.573,3.478-3.492,3.478c-1.92,0-3.492-1.557-3.492-3.478V20.201
1936
- c0-1.92,1.572-3.477,3.492-3.477c1.919,0,3.492,1.556,3.492,3.477V35.417z M22.909,13.851c-2.119,0-3.837-1.718-3.837-3.836
1937
- c0-2.12,1.718-3.836,3.837-3.836c2.118,0,3.837,1.716,3.837,3.836C26.746,12.133,25.027,13.851,22.909,13.851z"></path>
1938
- </svg>
1939
- </div>
1940
- <div data-when="has_warning:no">
1941
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24px" height="24px" class="iconToolbar">
1942
- <path d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z"></path>
1943
- </svg>
1944
- </div>
1945
- </button>
1946
- </section>
1947
-
1948
- <section id="close" data-responsive-toolbar-element="">
1949
- <button id="button-close-toolbar">
1950
- <div class="toolbar-icon-wrapper">
1951
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" id="crossIconSvg" class="iconToolbar" width="35px" height="35px">
1952
- <path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"></path>
1953
- <path d="M0 0h24v24H0z" fill="none"></path>
1954
- </svg>
1955
- </div>
1956
- </button>
1957
- </section>
1958
- </div>
1959
-
1960
- <div id="overflow-menu">
1961
- <div style="width: 100%"></div>
1962
- </div>
1963
-
1964
- <div id="overflow-menu-button">
1965
- <button class="toolbar-icon-wrapper">
1966
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="35px" height="35px" id="dotsIconSvg" class="iconToolbar">
1967
- <path d="M0 0h24v24H0V0z" fill="none"></path>
1968
- <path d="M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"></path>
1969
- </svg>
1970
- </button>
1971
- </div>
1972
- </div>
1973
-
1974
- <!-- svg filter
1975
- must not be hidden or won't show in firefox)
1976
- see also:
1977
- https://codepen.io/tigt/post/fixing-the-white-glow-in-the-css-blur-filter
1978
- https://stackoverflow.com/questions/46906819/edge-detection-in-svg-filter
1979
- https://github.com/msurguy/background-blur/issues/5
1980
- https://tympanus.net/codrops/2019/01/22/svg-filter-effects-outline-text-with-femorphology/
1981
- -->
1982
- <svg width="0" height="0">
1983
- <defs>
1984
- <filter id="better-blur" x="0" y="0" width="1" height="1">
1985
- <feGaussianBlur stdDeviation="5" result="blurred"></feGaussianBlur>
1986
-
1987
- <feMerge>
1988
- <feMergeNode in="SourceGraphic"></feMergeNode>
1989
- <feMergeNode in="blurred"></feMergeNode>
1990
- </feMerge>
1991
- </filter>
1992
- </defs>
1993
- </svg>
1994
-
1995
- <!--
1996
- Reusable svg(s)
1997
- -->
1998
- <div style="display: none; position: absolute">
1999
- <svg id="loading_svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 430 430">
2000
- <path fill="currentColor" d="m32.118 204.979.302 5.179c.124 3.4.638 8.29 1.434 14.48l.786 4.882.421 2.617c.154.89.376 1.789.558 2.712l1.197 5.75c.444 1.981 1.027 4.008 1.56 6.112 2.274 8.378 5.328 17.708 9.758 27.396a180.713 180.713 0 0 0 17.062 29.673 178.57 178.57 0 0 0 25.102 28.499c9.702 8.888 20.652 17.025 32.581 23.85a180.596 180.596 0 0 0 38.159 16.203c13.357 3.824 27.155 5.896 40.737 6.35l2.541.113 2.542-.017c1.689-.012 3.376-.142 5.059-.152l1.259-.126h.157c-.466 0-.034.113-.096.111l.329.039.657-.012 2.625-.138c1.748-.094 3.492-.181 5.229-.274l2.599-.14 2.399-.292c1.596-.203 3.188-.354 4.772-.526 3.147-.236 6.372-.888 9.541-1.397a213.826 213.826 0 0 0 35.916-9.232 622.925 622.925 0 0 1 8.182-3.142c2.655-1.114 5.222-2.329 7.782-3.459 2.6-1.056 4.984-2.43 7.407-3.636l3.584-1.832c1.189-.598 2.295-1.31 3.432-1.949 2.248-1.316 4.477-2.577 6.623-3.866l6.146-4.011c2.042-1.258 3.901-2.66 5.735-3.997 1.822-1.352 3.646-2.613 5.355-3.907l4.843-3.918c1.569-1.258 3.121-2.439 4.471-3.723l4.031-3.563c1.288-1.139 2.548-2.204 3.621-3.327 2.193-2.203 4.225-4.131 5.979-5.831 1.697-1.744 3.063-3.304 4.243-4.516l3.588-3.767.026-.028a.855.855 0 0 1 1.37.997s-.868 1.598-2.574 4.574c-.854 1.488-1.885 3.349-3.214 5.459-1.387 2.064-2.967 4.465-4.816 7.108-.887 1.355-1.955 2.669-3.051 4.075l-3.46 4.412c-1.185 1.56-2.571 3.036-3.979 4.607a11889.58 11889.58 0 0 1-4.424 4.853c-1.572 1.628-3.282 3.218-5.018 4.893-1.745 1.662-3.502 3.432-5.49 5.023l-6.021 5.047c-2.111 1.653-4.363 3.226-6.623 4.899-9.169 6.472-19.718 12.805-31.671 17.869-11.917 5.107-25.137 9.123-39.146 11.367-3.516.507-7.004 1.114-10.719 1.336-1.834.148-3.674.319-5.521.438l-2.773.192-2.611.027-5.237.045-2.63.012-1.585-.006-1.378-.074-5.521-.302-2.766-.157-2.764-.29a202.304 202.304 0 0 1-43.748-9.26 193.358 193.358 0 0 1-40.221-18.991c-12.467-7.743-23.632-16.999-33.41-26.861-9.758-9.893-18.135-20.455-24.833-31.222a187.62 187.62 0 0 1-15.97-31.794c-4.006-10.258-6.601-20.021-8.441-28.721-1.917-8.698-2.688-16.429-3.245-22.764-.396-6.374-.584-11.386-.485-14.752l.04-5.188a.85.85 0 0 1 .857-.844.86.86 0 0 1 .844.805zM393.625 225.021l-.297-4.979-.162-2.716-.093-1.565-.182-1.679c-.269-2.323-.534-4.99-.906-7.966l-.763-4.693-.408-2.516a34.227 34.227 0 0 0-.487-2.616c-.778-3.54-1.458-7.393-2.614-11.413l-.812-3.075a41.978 41.978 0 0 0-.908-3.147l-2.071-6.509c-1.604-4.392-3.258-9.013-5.353-13.684a178.146 178.146 0 0 0-15.844-28.827c-6.541-9.647-14.329-19.197-23.385-28.038l-1.683-1.677-1.766-1.605c-1.182-1.068-2.366-2.142-3.557-3.218-1.163-1.104-2.449-2.08-3.686-3.116l-3.75-3.083c-1.3-.972-2.604-1.946-3.91-2.924-1.324-.953-2.58-2.003-3.953-2.902l-4.075-2.768-2.042-1.389-2.112-1.291a179.101 179.101 0 0 0-35.961-17.193c-12.643-4.307-25.78-6.991-38.788-8.151-1.628-.128-3.24-.356-4.867-.403l-4.858-.205c-3.224-.204-6.444-.09-9.634-.125l-2.151-.002-2.495.128c-1.66.095-3.316.141-4.966.211l-2.47.097c-.809.042-1.532.143-2.3.21l-4.522.438c-2.979.166-6.046.719-9.053 1.084-3.023.336-5.975.917-8.906 1.449-1.462.28-2.93.501-4.374.794l-4.282.989-4.245.947c-1.396.353-2.766.767-4.137 1.143-2.735.781-5.465 1.47-8.073 2.398l-3.917 1.296c-1.3.42-2.588.844-3.827 1.363l-7.408 2.85a564.405 564.405 0 0 1-7.01 3.092c-1.163.477-2.267 1.042-3.361 1.598l-3.263 1.627-3.206 1.579a4807.3 4807.3 0 0 1-3.039 1.706c-1.992 1.14-4.003 2.158-5.868 3.29a478.807 478.807 0 0 1-5.419 3.344c-1.792 1.037-3.405 2.208-5.008 3.287l-4.64 3.135-7.955 5.898c-2.294 1.916-4.409 3.579-6.239 5.05-.934.718-1.729 1.45-2.471 2.111l-2.044 1.782-3.793 3.262-.025.022a.857.857 0 0 1-1.27-1.123s.969-1.457 2.861-4.161c.957-1.342 2.071-3.069 3.577-4.928 1.497-1.867 3.207-4.042 5.195-6.425a711.243 711.243 0 0 1 6.954-7.583l4.222-4.055c1.466-1.404 2.982-2.873 4.665-4.248a492.728 492.728 0 0 1 5.158-4.347c1.799-1.46 3.737-2.85 5.699-4.323l3.003-2.214 3.188-2.104a4521.47 4521.47 0 0 0 3.282-2.14c1.107-.723 2.227-1.456 3.411-2.104 9.235-5.625 19.942-10.626 31.724-14.697 1.475-.504 2.951-1.046 4.456-1.527a9356.8 9356.8 0 0 0 4.587-1.314l4.658-1.299c1.57-.402 3.17-.716 4.772-1.065l4.839-1.029a26.288 26.288 0 0 1 2.454-.433l2.478-.368c3.322-.481 6.616-1.035 10.133-1.254l5.236-.383c.866-.054 1.775-.143 2.61-.166l2.472-.042c1.65-.022 3.307-.069 4.97-.067l2.497-.011c-.163.003.397-.005.4-.001l.164.008.327.015.655.031 1.311.062c3.497.194 7.019.236 10.533.702l5.285.567c1.767.169 3.518.523 5.28.778a200.938 200.938 0 0 1 41.516 11.19 191.734 191.734 0 0 1 37.788 20.016l2.192 1.471 2.117 1.569 4.215 3.127c2.768 2.124 5.406 4.386 8.06 6.582l3.813 3.468c1.254 1.164 2.556 2.267 3.731 3.496l3.587 3.591 1.775 1.789 1.689 1.859c9.061 9.819 16.775 20.217 23.014 30.685a185.353 185.353 0 0 1 14.763 30.855c1.899 4.94 3.31 9.814 4.67 14.425l1.712 6.814c.297 1.098.526 2.196.731 3.282l.636 3.2c.923 4.179 1.378 8.165 1.943 11.813.151.911.247 1.811.318 2.695l.24 2.587.445 4.814c.173 3.065.257 5.808.365 8.183l.066 1.714-.015 1.567-.024 2.721-.045 4.987a.85.85 0 0 1-.857.843.852.852 0 0 1-.837-.8z"></path>
2001
- <circle fill="currentColor" cx="70.536" cy="110.694" r="36.011"></circle>
2002
- <circle fill="currentColor" cx="362.721" cy="309.694" r="36.012"></circle>
2003
- </svg>
2004
- </div>
2005
-
2006
- <!--
2007
- <script type="module" src="./toolbar.main.js"></script>
2008
- The script type module approach works too but
2009
- is slower than having a prebuilt file.
2010
- Because this will impact every page using jsenv let's
2011
- use the fatest solution for now.
2012
- The day browser support import maps the script
2013
- module approach wil be faster because
2014
- no compilation will be necessary
2015
- -->
2016
- <script type="systemjs-importmap">{
2017
- "imports": {}
2018
- }</script>
2019
- <script>
2020
- // here we should create something like window.toolbar = {}
2021
- // and a promise the toolbar injector can listen to act on the toolbar
2022
- // or we could just consider all communication should pass by postmessage
2023
- </script>
2024
- <script>System.register([], function () {
2025
- 'use strict';
2026
-
2027
- return {
2028
- execute: function () {
2029
- /* eslint-disable no-eq-null, eqeqeq */
2030
- function arrayLikeToArray(arr, len) {
2031
- if (len == null || len > arr.length) len = arr.length;
2032
- var arr2 = new Array(len);
2033
-
2034
- for (var i = 0; i < len; i++) {
2035
- arr2[i] = arr[i];
2036
- }
2037
-
2038
- return arr2;
2039
- }
2040
-
2041
- var arrayWithoutHoles = function (arr) {
2042
- if (Array.isArray(arr)) return arrayLikeToArray(arr);
2043
- };
2044
-
2045
- function _iterableToArray(iter) {
2046
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
2047
- }
2048
- /* eslint-disable consistent-return */
2049
-
2050
-
2051
- function unsupportedIterableToArray(o, minLen) {
2052
- if (!o) return;
2053
- if (typeof o === "string") return arrayLikeToArray(o, minLen);
2054
- var n = Object.prototype.toString.call(o).slice(8, -1);
2055
- if (n === "Object" && o.constructor) n = o.constructor.name;
2056
- if (n === "Map" || n === "Set") return Array.from(o);
2057
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
2058
- }
2059
-
2060
- var nonIterableSpread = function () {
2061
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2062
- };
2063
-
2064
- var _toConsumableArray = function (arr) {
2065
- return arrayWithoutHoles(arr) || _iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();
2066
- };
2067
-
2068
- var nativeTypeOf = function nativeTypeOf(obj) {
2069
- return typeof obj;
2070
- };
2071
-
2072
- var customTypeOf = function customTypeOf(obj) {
2073
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
2074
- };
2075
-
2076
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? nativeTypeOf : customTypeOf;
2077
-
2078
- var urlIsInsideOf = function urlIsInsideOf(url, otherUrl) {
2079
- var urlObject = new URL(url);
2080
- var otherUrlObject = new URL(otherUrl);
2081
-
2082
- if (urlObject.origin !== otherUrlObject.origin) {
2083
- return false;
2084
- }
2085
-
2086
- var urlPathname = urlObject.pathname;
2087
- var otherUrlPathname = otherUrlObject.pathname;
2088
-
2089
- if (urlPathname === otherUrlPathname) {
2090
- return false;
2091
- }
2092
-
2093
- var isInside = urlPathname.startsWith(otherUrlPathname);
2094
- return isInside;
2095
- };
2096
-
2097
- var getCommonPathname = function getCommonPathname(pathname, otherPathname) {
2098
- var firstDifferentCharacterIndex = findFirstDifferentCharacterIndex(pathname, otherPathname); // pathname and otherpathname are exactly the same
2099
-
2100
- if (firstDifferentCharacterIndex === -1) {
2101
- return pathname;
2102
- }
2103
-
2104
- var commonString = pathname.slice(0, firstDifferentCharacterIndex + 1); // the first different char is at firstDifferentCharacterIndex
2105
-
2106
- if (pathname.charAt(firstDifferentCharacterIndex) === "/") {
2107
- return commonString;
2108
- }
2109
-
2110
- if (otherPathname.charAt(firstDifferentCharacterIndex) === "/") {
2111
- return commonString;
2112
- }
2113
-
2114
- var firstDifferentSlashIndex = commonString.lastIndexOf("/");
2115
- return pathname.slice(0, firstDifferentSlashIndex + 1);
2116
- };
2117
-
2118
- var findFirstDifferentCharacterIndex = function findFirstDifferentCharacterIndex(string, otherString) {
2119
- var maxCommonLength = Math.min(string.length, otherString.length);
2120
- var i = 0;
2121
-
2122
- while (i < maxCommonLength) {
2123
- var char = string.charAt(i);
2124
- var otherChar = otherString.charAt(i);
2125
-
2126
- if (char !== otherChar) {
2127
- return i;
2128
- }
2129
-
2130
- i++;
2131
- }
2132
-
2133
- if (string.length === otherString.length) {
2134
- return -1;
2135
- } // they differ at maxCommonLength
2136
-
2137
-
2138
- return maxCommonLength;
2139
- };
2140
-
2141
- var pathnameToParentPathname = function pathnameToParentPathname(pathname) {
2142
- var slashLastIndex = pathname.lastIndexOf("/");
2143
-
2144
- if (slashLastIndex === -1) {
2145
- return "/";
2146
- }
2147
-
2148
- return pathname.slice(0, slashLastIndex + 1);
2149
- };
2150
-
2151
- var urlToRelativeUrl = function urlToRelativeUrl(url, baseUrl) {
2152
- var urlObject = new URL(url);
2153
- var baseUrlObject = new URL(baseUrl);
2154
-
2155
- if (urlObject.protocol !== baseUrlObject.protocol) {
2156
- var urlAsString = String(url);
2157
- return urlAsString;
2158
- }
2159
-
2160
- if (urlObject.username !== baseUrlObject.username || urlObject.password !== baseUrlObject.password || urlObject.host !== baseUrlObject.host) {
2161
- var afterUrlScheme = String(url).slice(urlObject.protocol.length);
2162
- return afterUrlScheme;
2163
- }
2164
-
2165
- var pathname = urlObject.pathname,
2166
- hash = urlObject.hash,
2167
- search = urlObject.search;
2168
-
2169
- if (pathname === "/") {
2170
- var baseUrlRessourceWithoutLeadingSlash = baseUrlObject.pathname.slice(1);
2171
- return baseUrlRessourceWithoutLeadingSlash;
2172
- }
2173
-
2174
- var basePathname = baseUrlObject.pathname;
2175
- var commonPathname = getCommonPathname(pathname, basePathname);
2176
-
2177
- if (!commonPathname) {
2178
- var _urlAsString = String(url);
2179
-
2180
- return _urlAsString;
2181
- }
2182
-
2183
- var specificPathname = pathname.slice(commonPathname.length);
2184
- var baseSpecificPathname = basePathname.slice(commonPathname.length);
2185
-
2186
- if (baseSpecificPathname.includes("/")) {
2187
- var baseSpecificParentPathname = pathnameToParentPathname(baseSpecificPathname);
2188
- var relativeDirectoriesNotation = baseSpecificParentPathname.replace(/.*?\//g, "../");
2189
-
2190
- var _relativeUrl = "".concat(relativeDirectoriesNotation).concat(specificPathname).concat(search).concat(hash);
2191
-
2192
- return _relativeUrl;
2193
- }
2194
-
2195
- var relativeUrl = "".concat(specificPathname).concat(search).concat(hash);
2196
- return relativeUrl;
2197
- };
2198
-
2199
- var objectWithoutPropertiesLoose = function (source, excluded) {
2200
- if (source === null) return {};
2201
- var target = {};
2202
- var sourceKeys = Object.keys(source);
2203
- var key;
2204
- var i;
2205
-
2206
- for (i = 0; i < sourceKeys.length; i++) {
2207
- key = sourceKeys[i];
2208
- if (excluded.indexOf(key) >= 0) continue;
2209
- target[key] = source[key];
2210
- }
2211
-
2212
- return target;
2213
- };
2214
-
2215
- var _objectWithoutProperties = function (source, excluded) {
2216
- if (source === null) return {};
2217
- var target = objectWithoutPropertiesLoose(source, excluded);
2218
- var key;
2219
- var i;
2220
-
2221
- if (Object.getOwnPropertySymbols) {
2222
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
2223
-
2224
- for (i = 0; i < sourceSymbolKeys.length; i++) {
2225
- key = sourceSymbolKeys[i];
2226
- if (excluded.indexOf(key) >= 0) continue;
2227
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
2228
- target[key] = source[key];
2229
- }
2230
- }
2231
-
2232
- return target;
2233
- };
2234
-
2235
- var updateIframeOverflowOnParentWindow = function updateIframeOverflowOnParentWindow() {
2236
- if (!window.parent) {
2237
- // can happen while parent iframe reloads
2238
- return;
2239
- }
2240
-
2241
- var aTooltipIsOpened = document.querySelector("[data-tooltip-visible]") || document.querySelector("[data-tooltip-auto-visible]");
2242
- var settingsAreOpened = document.querySelector("#settings[data-active]");
2243
-
2244
- if (aTooltipIsOpened || settingsAreOpened) {
2245
- enableIframeOverflowOnParentWindow();
2246
- } else {
2247
- disableIframeOverflowOnParentWindow();
2248
- }
2249
- };
2250
-
2251
- var iframeOverflowEnabled = false;
2252
-
2253
- var enableIframeOverflowOnParentWindow = function enableIframeOverflowOnParentWindow() {
2254
- if (iframeOverflowEnabled) return;
2255
- iframeOverflowEnabled = true;
2256
- var iframe = getToolbarIframe();
2257
- var transitionDuration = iframe.style.transitionDuration;
2258
- setStyles(iframe, {
2259
- "height": "100%",
2260
- "transition-duration": "0ms"
2261
- });
2262
-
2263
- if (transitionDuration) {
2264
- setTimeout(function () {
2265
- setStyles(iframe, {
2266
- "transition-duration": transitionDuration
2267
- });
2268
- });
2269
- }
2270
- };
2271
-
2272
- var disableIframeOverflowOnParentWindow = function disableIframeOverflowOnParentWindow() {
2273
- if (!iframeOverflowEnabled) return;
2274
- iframeOverflowEnabled = false;
2275
- var iframe = getToolbarIframe();
2276
- var transitionDuration = iframe.style.transitionDuration;
2277
- setStyles(iframe, {
2278
- "height": "40px",
2279
- "transition-duration": "0ms"
2280
- });
2281
-
2282
- if (transitionDuration) {
2283
- setTimeout(function () {
2284
- setStyles(iframe, {
2285
- "transition-duration": transitionDuration
2286
- });
2287
- });
2288
- }
2289
- };
2290
-
2291
- var getToolbarIframe = function getToolbarIframe() {
2292
- var iframes = Array.from(window.parent.document.querySelectorAll("iframe"));
2293
- return iframes.find(function (iframe) {
2294
- return iframe.contentWindow === window;
2295
- });
2296
- };
2297
-
2298
- var forceHideElement = function forceHideElement(element) {
2299
- element.setAttribute("data-force-hide", "");
2300
- };
2301
-
2302
- var removeForceHideElement = function removeForceHideElement(element) {
2303
- element.removeAttribute("data-force-hide");
2304
- };
2305
-
2306
- var setStyles = function setStyles(element, styles) {
2307
- var elementStyle = element.style;
2308
- var restoreStyles = Object.keys(styles).map(function (styleName) {
2309
- var restore;
2310
-
2311
- if (styleName in elementStyle) {
2312
- var currentStyle = elementStyle[styleName];
2313
-
2314
- restore = function restore() {
2315
- elementStyle[styleName] = currentStyle;
2316
- };
2317
- } else {
2318
- restore = function restore() {
2319
- delete elementStyle[styleName];
2320
- };
2321
- }
2322
-
2323
- elementStyle[styleName] = styles[styleName];
2324
- return restore;
2325
- });
2326
- return function () {
2327
- restoreStyles.forEach(function (restore) {
2328
- return restore();
2329
- });
2330
- };
2331
- };
2332
-
2333
- var toolbarSectionIsActive = function toolbarSectionIsActive(element) {
2334
- return element.hasAttribute("data-active");
2335
- };
2336
-
2337
- var activateToolbarSection = function activateToolbarSection(element) {
2338
- element.setAttribute("data-active", "");
2339
- };
2340
-
2341
- var deactivateToolbarSection = function deactivateToolbarSection(element) {
2342
- element.removeAttribute("data-active");
2343
- };
2344
-
2345
- var startJavaScriptAnimation = function startJavaScriptAnimation(_ref6) {
2346
- var _ref6$duration = _ref6.duration,
2347
- duration = _ref6$duration === void 0 ? 300 : _ref6$duration,
2348
- _ref6$timingFunction = _ref6.timingFunction,
2349
- timingFunction = _ref6$timingFunction === void 0 ? function (t) {
2350
- return t;
2351
- } : _ref6$timingFunction,
2352
- _ref6$onProgress = _ref6.onProgress,
2353
- onProgress = _ref6$onProgress === void 0 ? function () {} : _ref6$onProgress,
2354
- _ref6$onCancel = _ref6.onCancel,
2355
- onCancel = _ref6$onCancel === void 0 ? function () {} : _ref6$onCancel,
2356
- _ref6$onComplete = _ref6.onComplete,
2357
- onComplete = _ref6$onComplete === void 0 ? function () {} : _ref6$onComplete;
2358
-
2359
- if (isNaN(duration)) {
2360
- // console.warn(`duration must be a number, received ${duration}`)
2361
- return function () {};
2362
- }
2363
-
2364
- duration = parseInt(duration, 10);
2365
- var startMs = performance.now();
2366
- var currentRequestAnimationFrameId;
2367
- var done = false;
2368
- var rawProgress = 0;
2369
- var progress = 0;
2370
-
2371
- var handler = function handler() {
2372
- currentRequestAnimationFrameId = null;
2373
- var nowMs = performance.now();
2374
- rawProgress = Math.min((nowMs - startMs) / duration, 1);
2375
- progress = timingFunction(rawProgress);
2376
- done = rawProgress === 1;
2377
- onProgress({
2378
- done: done,
2379
- rawProgress: rawProgress,
2380
- progress: progress
2381
- });
2382
-
2383
- if (done) {
2384
- onComplete();
2385
- } else {
2386
- currentRequestAnimationFrameId = window.requestAnimationFrame(handler);
2387
- }
2388
- };
2389
-
2390
- handler();
2391
-
2392
- var stop = function stop() {
2393
- if (currentRequestAnimationFrameId) {
2394
- window.cancelAnimationFrame(currentRequestAnimationFrameId);
2395
- currentRequestAnimationFrameId = null;
2396
- }
2397
-
2398
- if (!done) {
2399
- done = true;
2400
- onCancel({
2401
- rawProgress: rawProgress,
2402
- progress: progress
2403
- });
2404
- }
2405
- };
2406
-
2407
- return stop;
2408
- }; // handle data-last-interaction attr on html (focusring)
2409
-
2410
-
2411
- window.addEventListener("mousedown", function (mousedownEvent) {
2412
- if (mousedownEvent.defaultPrevented) {
2413
- return;
2414
- }
2415
-
2416
- document.documentElement.setAttribute("data-last-interaction", "mouse");
2417
- });
2418
- window.addEventListener("touchstart", function (touchstartEvent) {
2419
- if (touchstartEvent.defaultPrevented) {
2420
- return;
2421
- }
2422
-
2423
- document.documentElement.setAttribute("data-last-interaction", "mouse");
2424
- });
2425
- window.addEventListener("keydown", function (keydownEvent) {
2426
- if (keydownEvent.defaultPrevented) {
2427
- return;
2428
- }
2429
-
2430
- document.documentElement.setAttribute("data-last-interaction", "keyboard");
2431
- });
2432
-
2433
- var setLinkHrefForParentWindow = function setLinkHrefForParentWindow(a, href) {
2434
- a.href = href;
2435
-
2436
- a.onclick = function (e) {
2437
- if (e.ctrlKey || e.metaKey) {
2438
- return;
2439
- }
2440
-
2441
- e.preventDefault();
2442
- window.parent.location.href = href;
2443
- };
2444
- };
2445
-
2446
- var createPreference = function createPreference(name) {
2447
- return {
2448
- has: function has() {
2449
- return localStorage.hasOwnProperty(name);
2450
- },
2451
- get: function get() {
2452
- return localStorage.hasOwnProperty(name) ? JSON.parse(localStorage.getItem(name)) : undefined;
2453
- },
2454
- set: function set(value) {
2455
- return localStorage.setItem(name, JSON.stringify(value));
2456
- }
2457
- };
2458
- };
2459
-
2460
- var toggleTooltip = function toggleTooltip(element) {
2461
- if (element.hasAttribute("data-tooltip-visible")) {
2462
- hideTooltip(element);
2463
- } else {
2464
- showTooltip(element);
2465
- }
2466
- };
2467
-
2468
- var hideTooltip = function hideTooltip(element) {
2469
- element.removeAttribute("data-tooltip-visible");
2470
- element.removeAttribute("data-tooltip-auto-visible");
2471
- updateIframeOverflowOnParentWindow();
2472
- };
2473
-
2474
- var showTooltip = function showTooltip(element) {
2475
- element.setAttribute("data-tooltip-visible", "");
2476
- updateIframeOverflowOnParentWindow();
2477
- };
2478
-
2479
- var autoShowTooltip = function autoShowTooltip(element) {
2480
- element.setAttribute("data-tooltip-auto-visible", "");
2481
- updateIframeOverflowOnParentWindow();
2482
- };
2483
-
2484
- var removeAutoShowTooltip = function removeAutoShowTooltip(element) {
2485
- element.removeAttribute("data-tooltip-auto-visible");
2486
- updateIframeOverflowOnParentWindow();
2487
- };
2488
-
2489
- var hideAllTooltip = function hideAllTooltip() {
2490
- var elementsWithTooltip = Array.from(document.querySelectorAll("[data-tooltip-visible]"));
2491
- elementsWithTooltip.forEach(function (elementWithTooltip) {
2492
- hideTooltip(elementWithTooltip);
2493
- });
2494
- };
2495
-
2496
- var enableVariant = function enableVariant(rootNode, variables) {
2497
- var nodesNotMatching = Array.from(rootNode.querySelectorAll("[".concat(attributeIndicatingACondition, "]")));
2498
- nodesNotMatching.forEach(function (nodeNotMatching) {
2499
- var conditionAttributeValue = nodeNotMatching.getAttribute(attributeIndicatingACondition);
2500
- var matches = testCondition(conditionAttributeValue, variables);
2501
-
2502
- if (matches) {
2503
- renameAttribute(nodeNotMatching, attributeIndicatingACondition, attributeIndicatingAMatch);
2504
- }
2505
- });
2506
- var nodesMatching = Array.from(rootNode.querySelectorAll("[".concat(attributeIndicatingAMatch, "]")));
2507
- nodesMatching.forEach(function (nodeMatching) {
2508
- var conditionAttributeValue = nodeMatching.getAttribute(attributeIndicatingAMatch);
2509
- var matches = testCondition(conditionAttributeValue, variables);
2510
-
2511
- if (!matches) {
2512
- renameAttribute(nodeMatching, attributeIndicatingAMatch, attributeIndicatingACondition);
2513
- }
2514
- });
2515
- };
2516
-
2517
- var testCondition = function testCondition(conditionAttributeValue, variables) {
2518
- var condition = parseCondition(conditionAttributeValue);
2519
- return Object.keys(variables).some(function (key) {
2520
- if (condition.key !== key) {
2521
- return false;
2522
- } // the condition do not specify a value, any value is ok
2523
-
2524
-
2525
- if (condition.value === undefined) {
2526
- return true;
2527
- }
2528
-
2529
- if (condition.value === variables[key]) {
2530
- return true;
2531
- }
2532
-
2533
- return false;
2534
- });
2535
- };
2536
-
2537
- var parseCondition = function parseCondition(conditionAttributeValue) {
2538
- var colonIndex = conditionAttributeValue.indexOf(":");
2539
-
2540
- if (colonIndex === -1) {
2541
- return {
2542
- key: conditionAttributeValue,
2543
- value: undefined
2544
- };
2545
- }
2546
-
2547
- return {
2548
- key: conditionAttributeValue.slice(0, colonIndex),
2549
- value: conditionAttributeValue.slice(colonIndex + 1)
2550
- };
2551
- };
2552
-
2553
- var attributeIndicatingACondition = "data-when";
2554
- var attributeIndicatingAMatch = "data-when-active";
2555
-
2556
- var renameAttribute = function renameAttribute(node, name, newName) {
2557
- node.setAttribute(newName, node.getAttribute(name));
2558
- node.removeAttribute(name);
2559
- };
2560
-
2561
- var renderToolbarSettings = function renderToolbarSettings() {
2562
- document.querySelector("#settings-button").onclick = toggleSettings;
2563
- document.querySelector("#button-close-settings").onclick = toggleSettings;
2564
- };
2565
-
2566
- var toggleSettings = function toggleSettings() {
2567
- if (settingsAreVisible()) {
2568
- hideSettings();
2569
- } else {
2570
- showSettings();
2571
- }
2572
- };
2573
-
2574
- var enableWarningStyle = function enableWarningStyle() {
2575
- enableVariant(document.querySelector("#settings-button"), {
2576
- has_warning: "yes"
2577
- });
2578
- };
2579
-
2580
- var disableWarningStyle = function disableWarningStyle() {
2581
- enableVariant(document.querySelector("#settings-button"), {
2582
- has_warning: "no"
2583
- });
2584
- };
2585
-
2586
- var settingsAreVisible = function settingsAreVisible() {
2587
- return toolbarSectionIsActive(document.querySelector("#settings"));
2588
- };
2589
-
2590
- var hideSettings = function hideSettings() {
2591
- deactivateToolbarSection(document.querySelector("#settings"));
2592
- updateIframeOverflowOnParentWindow();
2593
- };
2594
-
2595
- var showSettings = function showSettings() {
2596
- activateToolbarSection(document.querySelector("#settings"));
2597
- updateIframeOverflowOnParentWindow();
2598
- };
2599
-
2600
- var _defineProperty = function (obj, key, value) {
2601
- // Shortcircuit the slow defineProperty path when possible.
2602
- // We are trying to avoid issues where setters defined on the
2603
- // prototype cause side effects under the fast path of simple
2604
- // assignment. By checking for existence of the property with
2605
- // the in operator, we can optimize most of this overhead away.
2606
- if (key in obj) {
2607
- Object.defineProperty(obj, key, {
2608
- value: value,
2609
- enumerable: true,
2610
- configurable: true,
2611
- writable: true
2612
- });
2613
- } else {
2614
- obj[key] = value;
2615
- }
2616
-
2617
- return obj;
2618
- }; // filters on symbol properties only. Returned string properties are always
2619
- // enumerable. It is good to use in objectSpread.
2620
-
2621
-
2622
- function ownKeys(object, enumerableOnly) {
2623
- var keys = Object.keys(object);
2624
-
2625
- if (Object.getOwnPropertySymbols) {
2626
- var symbols = Object.getOwnPropertySymbols(object);
2627
-
2628
- if (enumerableOnly) {
2629
- symbols = symbols.filter(function (sym) {
2630
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
2631
- });
2632
- }
2633
-
2634
- keys.push.apply(keys, symbols);
2635
- }
2636
-
2637
- return keys;
2638
- }
2639
-
2640
- function _objectSpread2(target) {
2641
- for (var i = 1; i < arguments.length; i++) {
2642
- var source = arguments[i] != null ? arguments[i] : {};
2643
-
2644
- if (i % 2) {
2645
- ownKeys(Object(source), true).forEach(function (key) {
2646
- _defineProperty(target, key, source[key]);
2647
- });
2648
- } else if (Object.getOwnPropertyDescriptors) {
2649
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
2650
- } else {
2651
- ownKeys(Object(source)).forEach(function (key) {
2652
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2653
- });
2654
- }
2655
- }
2656
-
2657
- return target;
2658
- }
2659
-
2660
- var _excluded$1 = ["clickToFocus", "clickToClose"];
2661
-
2662
- function _async$9(f) {
2663
- return function () {
2664
- for (var args = [], i = 0; i < arguments.length; i++) {
2665
- args[i] = arguments[i];
2666
- }
2667
-
2668
- try {
2669
- return Promise.resolve(f.apply(this, args));
2670
- } catch (e) {
2671
- return Promise.reject(e);
2672
- }
2673
- };
2674
- }
2675
-
2676
- function _await$a(value, then, direct) {
2677
- if (direct) {
2678
- return then ? then(value) : value;
2679
- }
2680
-
2681
- if (!value || !value.then) {
2682
- value = Promise.resolve(value);
2683
- }
2684
-
2685
- return then ? value.then(then) : value;
2686
- }
2687
-
2688
- var notificationAvailable = typeof window.Notification === "function";
2689
- var notificationPreference = createPreference("notification");
2690
- var arrayOfOpenedNotifications = [];
2691
-
2692
- var renderToolbarNotification = function renderToolbarNotification() {
2693
- if (!notificationAvailable) {
2694
- applyNotificationNotAvailableEffects();
2695
- return;
2696
- }
2697
-
2698
- updatePermission();
2699
- };
2700
-
2701
- var updatePermission = function updatePermission() {
2702
- var notifPermission = Notification.permission;
2703
-
2704
- if (notifPermission === "default") {
2705
- applyNotificationDefaultEffects();
2706
- return;
2707
- }
2708
-
2709
- if (notifPermission === "denied") {
2710
- applyNotificationDeniedEffects();
2711
- return;
2712
- }
2713
-
2714
- if (notifPermission === "granted") {
2715
- applyNotificationGrantedEffects();
2716
- return;
2717
- }
2718
- };
2719
-
2720
- var notifCheckbox = document.querySelector("#toggle-notifs");
2721
-
2722
- var applyNotificationNotAvailableEffects = function applyNotificationNotAvailableEffects() {
2723
- var notifSetting = document.querySelector(".settings-notification");
2724
- notifSetting.setAttribute("data-disabled", "true");
2725
- notifSetting.setAttribute("title", "Notification not available in the browser");
2726
- notifCheckbox.disabled = true;
2727
- };
2728
-
2729
- var applyNotificationDefaultEffects = function applyNotificationDefaultEffects() {
2730
- applyNotificationNOTGrantedEffects();
2731
- var notifSetting = document.querySelector(".settings-notification");
2732
- notifSetting.removeAttribute("data-disabled");
2733
- notifSetting.removeAttribute("title");
2734
- };
2735
-
2736
- var applyNotificationDeniedEffects = function applyNotificationDeniedEffects() {
2737
- applyNotificationNOTGrantedEffects();
2738
- var notifSetting = document.querySelector(".settings-notification");
2739
- notifSetting.setAttribute("data-disabled", "true");
2740
- notifSetting.setAttribute("title", "Notification denied");
2741
- };
2742
-
2743
- var applyNotificationGrantedEffects = function applyNotificationGrantedEffects() {
2744
- enableVariant(document.querySelector(".notification-text"), {
2745
- notif_granted: "yes"
2746
- });
2747
- notifCheckbox.disabled = false;
2748
- notifCheckbox.checked = getNotificationPreference();
2749
-
2750
- notifCheckbox.onchange = function () {
2751
- setNotificationPreference(notifCheckbox.checked);
2752
-
2753
- if (!notifCheckbox.checked) {
2754
- // slice because arrayOfOpenedNotifications can be mutated while looping
2755
- arrayOfOpenedNotifications.slice().forEach(function (notification) {
2756
- notification.close();
2757
- });
2758
- }
2759
- };
2760
- };
2761
-
2762
- var applyNotificationNOTGrantedEffects = function applyNotificationNOTGrantedEffects() {
2763
- enableVariant(document.querySelector(".notification-text"), {
2764
- notif_granted: "no"
2765
- });
2766
- notifCheckbox.disabled = true;
2767
- notifCheckbox.checked = false;
2768
-
2769
- document.querySelector("a.request_notification_permission").onclick = function () {
2770
- requestPermission().then(function () {
2771
- setNotificationPreference(true);
2772
- updatePermission();
2773
- });
2774
- };
2775
- };
2776
-
2777
- var notifyExecutionResult = function notifyExecutionResult(executedFileRelativeUrl, execution, previousExecution) {
2778
- var notificationEnabled = getNotificationPreference();
2779
- if (!notificationEnabled) return;
2780
- var notificationOptions = {
2781
- lang: "en",
2782
- icon: getFaviconHref(),
2783
- clickToFocus: true,
2784
- clickToClose: true
2785
- };
2786
-
2787
- if (execution.status === "errored") {
2788
- if (previousExecution) {
2789
- if (previousExecution.status === "completed") {
2790
- notify("Broken", _objectSpread2(_objectSpread2({}, notificationOptions), {}, {
2791
- body: "".concat(executedFileRelativeUrl, " execution now failing.")
2792
- }));
2793
- } else {
2794
- notify("Still failing", _objectSpread2(_objectSpread2({}, notificationOptions), {}, {
2795
- body: "".concat(executedFileRelativeUrl, " execution still failing.")
2796
- }));
2797
- }
2798
- } else {
2799
- notify("Failing", _objectSpread2(_objectSpread2({}, notificationOptions), {}, {
2800
- body: "".concat(executedFileRelativeUrl, " execution failed.")
2801
- }));
2802
- }
2803
- } else if (previousExecution && previousExecution.status === "errored") {
2804
- notify("Fixed", _objectSpread2(_objectSpread2({}, notificationOptions), {}, {
2805
- body: "".concat(executedFileRelativeUrl, " execution fixed.")
2806
- }));
2807
- }
2808
- };
2809
-
2810
- var getNotificationPreference = function getNotificationPreference() {
2811
- return notificationPreference.has() ? notificationPreference.get() : true;
2812
- };
2813
-
2814
- var setNotificationPreference = function setNotificationPreference(value) {
2815
- return notificationPreference.set(value);
2816
- };
2817
-
2818
- var getFaviconHref = function getFaviconHref() {
2819
- var link = document.querySelector('link[rel="icon"]');
2820
- return link ? link.href : undefined;
2821
- };
2822
-
2823
- var permission = "default";
2824
- var notify = notificationAvailable ? _async$9(function (title) {
2825
- var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2826
-
2827
- var _ref$clickToFocus = _ref.clickToFocus,
2828
- clickToFocus = _ref$clickToFocus === void 0 ? false : _ref$clickToFocus,
2829
- _ref$clickToClose = _ref.clickToClose,
2830
- clickToClose = _ref$clickToClose === void 0 ? false : _ref$clickToClose,
2831
- options = _objectWithoutProperties(_ref, _excluded$1);
2832
-
2833
- if (permission !== "granted") {
2834
- return null;
2835
- }
2836
-
2837
- var notification = new Notification(title, options);
2838
- arrayOfOpenedNotifications.push(notification);
2839
-
2840
- notification.onclick = function () {
2841
- // but if the user navigated inbetween
2842
- // focusing window will show something else
2843
- // in that case it could be great to do something
2844
- // maybe like showing a message saying this execution
2845
- // is no longer visible
2846
- // we could also navigauate to this file execution but
2847
- // there is no guarantee re-executing the file would give same output
2848
- // and it would also trigger an other notification
2849
- if (clickToFocus) window.focus();
2850
- if (clickToClose) notification.close();
2851
- };
2852
-
2853
- notification.onclose = function () {
2854
- var index = arrayOfOpenedNotifications.indexOf(notification);
2855
-
2856
- if (index > -1) {
2857
- arrayOfOpenedNotifications.splice(index, 1);
2858
- }
2859
- };
2860
-
2861
- return notification;
2862
- }) : function () {};
2863
- var requestPromise;
2864
- var requestPermission = notificationAvailable ? _async$9(function () {
2865
- if (requestPromise) return requestPromise;
2866
- requestPromise = Notification.requestPermission();
2867
- return _await$a(requestPromise, function (_requestPromise) {
2868
- permission = _requestPromise;
2869
- requestPromise = undefined;
2870
- return permission;
2871
- });
2872
- }) : function () {
2873
- return Promise.resolve("default");
2874
- };
2875
- var DARK_THEME = "dark";
2876
- var LIGHT_THEME = "light";
2877
- var themePreference = createPreference("theme");
2878
-
2879
- var renderToolbarTheme = function renderToolbarTheme() {
2880
- var theme = getThemePreference();
2881
- var checkbox = document.querySelector("#checkbox-dark-theme");
2882
- checkbox.checked = theme === DARK_THEME;
2883
- setTheme(theme);
2884
-
2885
- checkbox.onchange = function () {
2886
- if (checkbox.checked) {
2887
- setThemePreference(DARK_THEME);
2888
- setTheme(DARK_THEME);
2889
- } else {
2890
- setThemePreference(LIGHT_THEME);
2891
- setTheme(LIGHT_THEME);
2892
- }
2893
- };
2894
- };
2895
-
2896
- var getThemePreference = function getThemePreference() {
2897
- return themePreference.has() ? themePreference.get() : DARK_THEME;
2898
- };
2899
-
2900
- var setThemePreference = function setThemePreference(value) {
2901
- themePreference.set(value);
2902
- setTheme(value);
2903
- };
2904
-
2905
- var setTheme = function setTheme(theme) {
2906
- document.querySelector("html").setAttribute("data-theme", theme);
2907
- };
2908
-
2909
- var animationPreference = createPreference("animation");
2910
-
2911
- var renderToolbarAnimation = function renderToolbarAnimation() {
2912
- var animCheckbox = document.querySelector("#toggle-anims");
2913
- animCheckbox.checked = getAnimationPreference();
2914
-
2915
- animCheckbox.onchange = function () {
2916
- setAnimationPreference(animCheckbox.checked);
2917
- onPreferenceChange(animCheckbox.checked);
2918
- };
2919
-
2920
- onPreferenceChange(); // enable toolbar transition only after first render
2921
-
2922
- setTimeout(function () {
2923
- document.querySelector("#toolbar").setAttribute("data-animate", "");
2924
- });
2925
- };
2926
-
2927
- var onPreferenceChange = function onPreferenceChange() {
2928
- var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getAnimationPreference();
2929
-
2930
- if (value) {
2931
- enableAnimation();
2932
- } else {
2933
- disableAnimation();
2934
- }
2935
- };
2936
-
2937
- var getAnimationPreference = function getAnimationPreference() {
2938
- return animationPreference.has() ? animationPreference.get() : true;
2939
- };
2940
-
2941
- var setAnimationPreference = function setAnimationPreference(value) {
2942
- return animationPreference.set(value);
2943
- };
2944
-
2945
- var enableAnimation = function enableAnimation() {
2946
- document.documentElement.removeAttribute("data-animation-disabled");
2947
- };
2948
-
2949
- var disableAnimation = function disableAnimation() {
2950
- document.documentElement.setAttribute("data-animation-disabled", "");
2951
- };
2952
-
2953
- var createHorizontalBreakpoint = function createHorizontalBreakpoint(breakpointValue) {
2954
- return createBreakpoint(windowWidthMeasure, breakpointValue);
2955
- };
2956
-
2957
- var createMeasure = function createMeasure(_ref) {
2958
- var compute = _ref.compute,
2959
- register = _ref.register;
2960
- var currentValue = compute();
2961
-
2962
- var get = function get() {
2963
- return compute();
2964
- };
2965
-
2966
- var changed = createSignal();
2967
-
2968
- var unregister = function unregister() {};
2969
-
2970
- if (register) {
2971
- unregister = register(function () {
2972
- var value = compute();
2973
-
2974
- if (value !== currentValue) {
2975
- var previousValue = value;
2976
- currentValue = value;
2977
- changed.notify(value, previousValue);
2978
- }
2979
- });
2980
- }
2981
-
2982
- return {
2983
- get: get,
2984
- changed: changed,
2985
- unregister: unregister
2986
- };
2987
- };
2988
-
2989
- var createSignal = function createSignal() {
2990
- var callbackArray = [];
2991
-
2992
- var listen = function listen(callback) {
2993
- callbackArray.push(callback);
2994
- return function () {
2995
- var index = callbackArray.indexOf(callback);
2996
-
2997
- if (index > -1) {
2998
- callbackArray.splice(index, 1);
2999
- }
3000
- };
3001
- };
3002
-
3003
- var notify = function notify() {
3004
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
3005
- args[_key] = arguments[_key];
3006
- }
3007
-
3008
- callbackArray.slice().forEach(function (callback) {
3009
- callback.apply(void 0, args);
3010
- });
3011
- };
3012
-
3013
- return {
3014
- listen: listen,
3015
- notify: notify
3016
- };
3017
- };
3018
-
3019
- var windowWidthMeasure = createMeasure({
3020
- name: "window-width",
3021
- compute: function compute() {
3022
- return window.innerWidth;
3023
- },
3024
- register: function register(onchange) {
3025
- window.addEventListener("resize", onchange);
3026
- window.addEventListener("orientationchange", onchange);
3027
- return function () {
3028
- window.removeEventListener("resize", onchange);
3029
- window.removeEventListener("orientationchange", onchange);
3030
- };
3031
- }
3032
- });
3033
-
3034
- var createBreakpoint = function createBreakpoint(measure, breakpointValue) {
3035
- var getBreakpointState = function getBreakpointState() {
3036
- var value = measure.get();
3037
-
3038
- if (value < breakpointValue) {
3039
- return "below";
3040
- }
3041
-
3042
- if (value > breakpointValue) {
3043
- return "above";
3044
- }
3045
-
3046
- return "equals";
3047
- };
3048
-
3049
- var currentBreakpointState = getBreakpointState();
3050
-
3051
- var isAbove = function isAbove() {
3052
- return measure.get() > breakpointValue;
3053
- };
3054
-
3055
- var isBelow = function isBelow() {
3056
- return measure.get() < breakpointValue;
3057
- };
3058
-
3059
- var breakpointChanged = createSignal();
3060
- measure.changed.listen(function () {
3061
- var breakpointState = getBreakpointState();
3062
-
3063
- if (breakpointState !== currentBreakpointState) {
3064
- var breakpointStatePrevious = currentBreakpointState;
3065
- currentBreakpointState = breakpointState;
3066
- breakpointChanged.notify(breakpointState, breakpointStatePrevious);
3067
- }
3068
- });
3069
- return {
3070
- isAbove: isAbove,
3071
- isBelow: isBelow,
3072
- changed: breakpointChanged
3073
- };
3074
- }; // const windowScrollTop = createMeasure({
3075
- // name: "window-scroll-top",
3076
- // compute: () => window.scrollTop,
3077
- // register: (onchange) => {
3078
- // window.addEventListener("scroll", onchange)
3079
- // return () => {
3080
- // window.removeEventListener("scroll", onchange)
3081
- // }
3082
- // },
3083
- // })
3084
-
3085
-
3086
- var WINDOW_MEDIUM_WIDTH = 570;
3087
-
3088
- var renderExecutionInToolbar = function renderExecutionInToolbar(_ref) {
3089
- var executedFileRelativeUrl = _ref.executedFileRelativeUrl; // reset file execution indicator ui
3090
-
3091
- applyExecutionIndicator();
3092
- removeForceHideElement(document.querySelector("#execution-indicator")); // apply responsive design on fileInput if needed + add listener on resize screen
3093
-
3094
- var input = document.querySelector("#file-input");
3095
- var fileWidthBreakpoint = createHorizontalBreakpoint(WINDOW_MEDIUM_WIDTH);
3096
-
3097
- var handleFileWidthBreakpoint = function handleFileWidthBreakpoint() {
3098
- resizeInput(input, fileWidthBreakpoint);
3099
- };
3100
-
3101
- handleFileWidthBreakpoint();
3102
- fileWidthBreakpoint.changed.listen(handleFileWidthBreakpoint);
3103
- input.value = executedFileRelativeUrl;
3104
- resizeInput(input, fileWidthBreakpoint);
3105
- activateToolbarSection(document.querySelector("#file"));
3106
- removeForceHideElement(document.querySelector("#file"));
3107
-
3108
- window.parent.__jsenv__.executionResultPromise.then(function (_ref2) {
3109
- var status = _ref2.status,
3110
- startTime = _ref2.startTime,
3111
- endTime = _ref2.endTime;
3112
- var execution = {
3113
- status: status,
3114
- startTime: startTime,
3115
- endTime: endTime
3116
- };
3117
- applyExecutionIndicator(execution);
3118
- var executionStorageKey = executedFileRelativeUrl;
3119
- var previousExecution = sessionStorage.hasOwnProperty(executionStorageKey) ? JSON.parse(sessionStorage.getItem(executionStorageKey)) : undefined;
3120
- notifyExecutionResult(executedFileRelativeUrl, execution, previousExecution);
3121
- sessionStorage.setItem(executedFileRelativeUrl, JSON.stringify(execution));
3122
- });
3123
- };
3124
-
3125
- var applyExecutionIndicator = function applyExecutionIndicator() {
3126
- var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
3127
- _ref3$status = _ref3.status,
3128
- status = _ref3$status === void 0 ? "running" : _ref3$status,
3129
- startTime = _ref3.startTime,
3130
- endTime = _ref3.endTime;
3131
-
3132
- var executionIndicator = document.querySelector("#execution-indicator");
3133
- enableVariant(executionIndicator, {
3134
- execution: status
3135
- });
3136
- var variantNode = executionIndicator.querySelector("[data-when-active]");
3137
-
3138
- variantNode.querySelector("button").onclick = function () {
3139
- return toggleTooltip(executionIndicator);
3140
- };
3141
-
3142
- variantNode.querySelector(".tooltip").textContent = computeText({
3143
- status: status,
3144
- startTime: startTime,
3145
- endTime: endTime
3146
- });
3147
- };
3148
-
3149
- var computeText = function computeText(_ref4) {
3150
- var status = _ref4.status,
3151
- startTime = _ref4.startTime,
3152
- endTime = _ref4.endTime;
3153
-
3154
- if (status === "completed") {
3155
- return "Execution completed in ".concat(endTime - startTime, "ms");
3156
- }
3157
-
3158
- if (status === "errored") {
3159
- return "Execution failed in ".concat(endTime - startTime, "ms");
3160
- }
3161
-
3162
- if (status === "running") {
3163
- return "Executing...";
3164
- }
3165
-
3166
- return "";
3167
- };
3168
-
3169
- var resizeInput = function resizeInput(input, fileWidthBreakpoint) {
3170
- var size = fileWidthBreakpoint.isBelow() ? 20 : 40;
3171
-
3172
- if (input.value.length > size) {
3173
- input.style.width = "".concat(size, "ch");
3174
- } else {
3175
- input.style.width = "".concat(input.value.length, "ch");
3176
- }
3177
- };
3178
-
3179
- function _await$9(value, then, direct) {
3180
- if (direct) {
3181
- return then ? then(value) : value;
3182
- }
3183
-
3184
- if (!value || !value.then) {
3185
- value = Promise.resolve(value);
3186
- }
3187
-
3188
- return then ? value.then(then) : value;
3189
- }
3190
-
3191
- function _async$8(f) {
3192
- return function () {
3193
- for (var args = [], i = 0; i < arguments.length; i++) {
3194
- args[i] = arguments[i];
3195
- }
3196
-
3197
- try {
3198
- return Promise.resolve(f.apply(this, args));
3199
- } catch (e) {
3200
- return Promise.reject(e);
3201
- }
3202
- };
3203
- }
3204
-
3205
- function _call$1(body, then, direct) {
3206
- if (direct) {
3207
- return then ? then(body()) : body();
3208
- }
3209
-
3210
- try {
3211
- var result = Promise.resolve(body());
3212
- return then ? result.then(then) : result;
3213
- } catch (e) {
3214
- return Promise.reject(e);
3215
- }
3216
- }
3217
-
3218
- var fetchUsingXHR = _async$8(function (url) {
3219
- var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
3220
- signal = _ref.signal,
3221
- _ref$method = _ref.method,
3222
- method = _ref$method === void 0 ? "GET" : _ref$method,
3223
- _ref$credentials = _ref.credentials,
3224
- credentials = _ref$credentials === void 0 ? "same-origin" : _ref$credentials,
3225
- _ref$headers = _ref.headers,
3226
- headers = _ref$headers === void 0 ? {} : _ref$headers,
3227
- _ref$body = _ref.body,
3228
- body = _ref$body === void 0 ? null : _ref$body;
3229
-
3230
- var headersPromise = createPromiseAndHooks();
3231
- var bodyPromise = createPromiseAndHooks();
3232
- var xhr = new XMLHttpRequest();
3233
-
3234
- var failure = function failure(error) {
3235
- // if it was already resolved, we must reject the body promise
3236
- if (headersPromise.settled) {
3237
- bodyPromise.reject(error);
3238
- } else {
3239
- headersPromise.reject(error);
3240
- }
3241
- };
3242
-
3243
- var cleanup = function cleanup() {
3244
- xhr.ontimeout = null;
3245
- xhr.onerror = null;
3246
- xhr.onload = null;
3247
- xhr.onreadystatechange = null;
3248
- };
3249
-
3250
- xhr.ontimeout = function () {
3251
- cleanup();
3252
- failure(new Error("xhr request timeout on ".concat(url, ".")));
3253
- };
3254
-
3255
- xhr.onerror = function (error) {
3256
- cleanup(); // unfortunately with have no clue why it fails
3257
- // might be cors for instance
3258
-
3259
- failure(createRequestError(error, {
3260
- url: url
3261
- }));
3262
- };
3263
-
3264
- xhr.onload = function () {
3265
- cleanup();
3266
- bodyPromise.resolve();
3267
- };
3268
-
3269
- signal.addEventListener("abort", function () {
3270
- xhr.abort();
3271
- var abortError = new Error("aborted");
3272
- abortError.name = "AbortError";
3273
- failure(abortError);
3274
- });
3275
-
3276
- xhr.onreadystatechange = function () {
3277
- // https://developer.mozilla.org/fr/docs/Web/API/XMLHttpRequest/readyState
3278
- var readyState = xhr.readyState;
3279
-
3280
- if (readyState === 2) {
3281
- headersPromise.resolve();
3282
- } else if (readyState === 4) {
3283
- cleanup();
3284
- bodyPromise.resolve();
3285
- }
3286
- };
3287
-
3288
- xhr.open(method, url, true);
3289
- Object.keys(headers).forEach(function (key) {
3290
- xhr.setRequestHeader(key, headers[key]);
3291
- });
3292
- xhr.withCredentials = computeWithCredentials({
3293
- credentials: credentials,
3294
- url: url
3295
- });
3296
-
3297
- if ("responseType" in xhr && hasBlob) {
3298
- xhr.responseType = "blob";
3299
- }
3300
-
3301
- xhr.send(body);
3302
- return _await$9(headersPromise, function () {
3303
- // https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseURL
3304
- var responseUrl = "responseURL" in xhr ? xhr.responseURL : headers["x-request-url"];
3305
- var responseStatus = xhr.status;
3306
- var responseStatusText = xhr.statusText;
3307
- var responseHeaders = getHeadersFromXHR(xhr);
3308
-
3309
- var readBody = function readBody() {
3310
- return _await$9(bodyPromise, function () {
3311
- var status = xhr.status; // in Chrome on file:/// URLs, status is 0
3312
-
3313
- if (status === 0) {
3314
- responseStatus = 200;
3315
- }
3316
-
3317
- var body = "response" in xhr ? xhr.response : xhr.responseText;
3318
- return {
3319
- responseBody: body,
3320
- responseBodyType: detectBodyType(body)
3321
- };
3322
- });
3323
- };
3324
-
3325
- var text = function text() {
3326
- return _call$1(readBody, function (_ref2) {
3327
- var responseBody = _ref2.responseBody,
3328
- responseBodyType = _ref2.responseBodyType;
3329
-
3330
- if (responseBodyType === "blob") {
3331
- return blobToText(responseBody);
3332
- }
3333
-
3334
- if (responseBodyType === "formData") {
3335
- throw new Error("could not read FormData body as text");
3336
- }
3337
-
3338
- return responseBodyType === "dataView" ? arrayBufferToText(responseBody.buffer) : responseBodyType === "arrayBuffer" ? arrayBufferToText(responseBody) : String(responseBody);
3339
- });
3340
- };
3341
-
3342
- var json = function json() {
3343
- return _call$1(text, JSON.parse);
3344
- };
3345
-
3346
- var blob = _async$8(function () {
3347
- if (!hasBlob) {
3348
- throw new Error("blob not supported");
3349
- }
3350
-
3351
- return _call$1(readBody, function (_ref3) {
3352
- var responseBody = _ref3.responseBody,
3353
- responseBodyType = _ref3.responseBodyType;
3354
-
3355
- if (responseBodyType === "blob") {
3356
- return responseBody;
3357
- }
3358
-
3359
- if (responseBodyType === "dataView") {
3360
- return new Blob([cloneBuffer(responseBody.buffer)]);
3361
- }
3362
-
3363
- if (responseBodyType === "arrayBuffer") {
3364
- return new Blob([cloneBuffer(responseBody)]);
3365
- }
3366
-
3367
- if (responseBodyType === "formData") {
3368
- throw new Error("could not read FormData body as blob");
3369
- }
3370
-
3371
- return new Blob([String(responseBody)]);
3372
- });
3373
- });
3374
-
3375
- var arrayBuffer = function arrayBuffer() {
3376
- return _call$1(readBody, function (_ref4) {
3377
- var responseBody = _ref4.responseBody,
3378
- responseBodyType = _ref4.responseBodyType;
3379
- return responseBodyType === "arrayBuffer" ? cloneBuffer(responseBody) : _call$1(blob, blobToArrayBuffer);
3380
- });
3381
- };
3382
-
3383
- var formData = _async$8(function () {
3384
- if (!hasFormData) {
3385
- throw new Error("formData not supported");
3386
- }
3387
-
3388
- return _call$1(text, textToFormData);
3389
- });
3390
-
3391
- return {
3392
- url: responseUrl,
3393
- status: responseStatus,
3394
- statusText: responseStatusText,
3395
- headers: responseHeaders,
3396
- text: text,
3397
- json: json,
3398
- blob: blob,
3399
- arrayBuffer: arrayBuffer,
3400
- formData: formData
3401
- };
3402
- });
3403
- });
3404
-
3405
- var canUseBlob = function canUseBlob() {
3406
- if (typeof window.FileReader !== "function") return false;
3407
- if (typeof window.Blob !== "function") return false;
3408
-
3409
- try {
3410
- // eslint-disable-next-line no-new
3411
- new Blob();
3412
- return true;
3413
- } catch (e) {
3414
- return false;
3415
- }
3416
- };
3417
-
3418
- var hasBlob = canUseBlob();
3419
- var hasFormData = typeof window.FormData === "function";
3420
- var hasArrayBuffer = typeof window.ArrayBuffer === "function";
3421
- var hasSearchParams = typeof window.URLSearchParams === "function";
3422
-
3423
- var createRequestError = function createRequestError(error, _ref5) {
3424
- var url = _ref5.url;
3425
- return new Error("error during xhr request on ".concat(url, ".\n--- error stack ---\n").concat(error.stack));
3426
- };
3427
-
3428
- var createPromiseAndHooks = function createPromiseAndHooks() {
3429
- var resolve;
3430
- var reject;
3431
- var promise = new Promise(function (res, rej) {
3432
- resolve = function resolve(value) {
3433
- promise.settled = true;
3434
- res(value);
3435
- };
3436
-
3437
- reject = function reject(value) {
3438
- promise.settled = true;
3439
- rej(value);
3440
- };
3441
- });
3442
- promise.resolve = resolve;
3443
- promise.reject = reject;
3444
- return promise;
3445
- }; // https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch
3446
-
3447
-
3448
- var computeWithCredentials = function computeWithCredentials(_ref6) {
3449
- var credentials = _ref6.credentials,
3450
- url = _ref6.url;
3451
-
3452
- if (credentials === "same-origin") {
3453
- return originSameAsGlobalOrigin(url);
3454
- }
3455
-
3456
- return credentials === "include";
3457
- };
3458
-
3459
- var originSameAsGlobalOrigin = function originSameAsGlobalOrigin(url) {
3460
- // if we cannot read globalOrigin from window.location.origin, let's consider it's ok
3461
- if ((typeof window === "undefined" ? "undefined" : _typeof(window)) !== "object") return true;
3462
- if (_typeof(window.location) !== "object") return true;
3463
- var globalOrigin = window.location.origin;
3464
- if (globalOrigin === "null") return true;
3465
- return hrefToOrigin(url) === globalOrigin;
3466
- };
3467
-
3468
- var detectBodyType = function detectBodyType(body) {
3469
- if (!body) {
3470
- return "";
3471
- }
3472
-
3473
- if (typeof body === "string") {
3474
- return "text";
3475
- }
3476
-
3477
- if (hasBlob && Blob.prototype.isPrototypeOf(body)) {
3478
- return "blob";
3479
- }
3480
-
3481
- if (hasFormData && FormData.prototype.isPrototypeOf(body)) {
3482
- return "formData";
3483
- }
3484
-
3485
- if (hasArrayBuffer) {
3486
- if (hasBlob && isDataView(body)) {
3487
- return "dataView";
3488
- }
3489
-
3490
- if (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body)) {
3491
- return "arrayBuffer";
3492
- }
3493
- }
3494
-
3495
- if (hasSearchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
3496
- return "searchParams";
3497
- }
3498
-
3499
- return "";
3500
- }; // https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/getAllResponseHeaders#Example
3501
-
3502
-
3503
- var getHeadersFromXHR = function getHeadersFromXHR(xhr) {
3504
- var headerMap = {};
3505
- var headersString = xhr.getAllResponseHeaders();
3506
- if (headersString === "") return headerMap;
3507
- var lines = headersString.trim().split(/[\r\n]+/);
3508
- lines.forEach(function (line) {
3509
- var parts = line.split(": ");
3510
- var name = parts.shift();
3511
- var value = parts.join(": ");
3512
- headerMap[name.toLowerCase()] = value;
3513
- });
3514
- return headerMap;
3515
- };
3516
-
3517
- var hrefToOrigin = function hrefToOrigin(href) {
3518
- var scheme = hrefToScheme(href);
3519
-
3520
- if (scheme === "file") {
3521
- return "file://";
3522
- }
3523
-
3524
- if (scheme === "http" || scheme === "https") {
3525
- var secondProtocolSlashIndex = scheme.length + "://".length;
3526
- var pathnameSlashIndex = href.indexOf("/", secondProtocolSlashIndex);
3527
- if (pathnameSlashIndex === -1) return href;
3528
- return href.slice(0, pathnameSlashIndex);
3529
- }
3530
-
3531
- return href.slice(0, scheme.length + 1);
3532
- };
3533
-
3534
- var hrefToScheme = function hrefToScheme(href) {
3535
- var colonIndex = href.indexOf(":");
3536
- if (colonIndex === -1) return "";
3537
- return href.slice(0, colonIndex);
3538
- };
3539
-
3540
- var isDataView = function isDataView(obj) {
3541
- return obj && DataView.prototype.isPrototypeOf(obj);
3542
- };
3543
-
3544
- var isArrayBufferView = ArrayBuffer.isView || function () {
3545
- var viewClasses = ["[object Int8Array]", "[object Uint8Array]", "[object Uint8ClampedArray]", "[object Int16Array]", "[object Uint16Array]", "[object Int32Array]", "[object Uint32Array]", "[object Float32Array]", "[object Float64Array]"];
3546
- return function (value) {
3547
- return value && viewClasses.includes(Object.prototype.toString.call(value));
3548
- };
3549
- }();
3550
-
3551
- var textToFormData = function textToFormData(text) {
3552
- var form = new FormData();
3553
- text.trim().split("&").forEach(function (bytes) {
3554
- if (bytes) {
3555
- var split = bytes.split("=");
3556
- var name = split.shift().replace(/\+/g, " ");
3557
- var value = split.join("=").replace(/\+/g, " ");
3558
- form.append(decodeURIComponent(name), decodeURIComponent(value));
3559
- }
3560
- });
3561
- return form;
3562
- };
3563
-
3564
- var blobToArrayBuffer = _async$8(function (blob) {
3565
- var reader = new FileReader();
3566
- var promise = fileReaderReady(reader);
3567
- reader.readAsArrayBuffer(blob);
3568
- return promise;
3569
- });
3570
-
3571
- var blobToText = function blobToText(blob) {
3572
- var reader = new FileReader();
3573
- var promise = fileReaderReady(reader);
3574
- reader.readAsText(blob);
3575
- return promise;
3576
- };
3577
-
3578
- var arrayBufferToText = function arrayBufferToText(arrayBuffer) {
3579
- var view = new Uint8Array(arrayBuffer);
3580
- var chars = new Array(view.length);
3581
- var i = 0;
3582
-
3583
- while (i < view.length) {
3584
- chars[i] = String.fromCharCode(view[i]);
3585
- i++;
3586
- }
3587
-
3588
- return chars.join("");
3589
- };
3590
-
3591
- var fileReaderReady = function fileReaderReady(reader) {
3592
- return new Promise(function (resolve, reject) {
3593
- reader.onload = function () {
3594
- resolve(reader.result);
3595
- };
3596
-
3597
- reader.onerror = function () {
3598
- reject(reader.error);
3599
- };
3600
- });
3601
- };
3602
-
3603
- var cloneBuffer = function cloneBuffer(buffer) {
3604
- if (buffer.slice) {
3605
- return buffer.slice(0);
3606
- }
3607
-
3608
- var view = new Uint8Array(buffer.byteLength);
3609
- view.set(new Uint8Array(buffer));
3610
- return view.buffer;
3611
- };
3612
-
3613
- var _excluded = ["mode"];
3614
-
3615
- function _await$8(value, then, direct) {
3616
- if (direct) {
3617
- return then ? then(value) : value;
3618
- }
3619
-
3620
- if (!value || !value.then) {
3621
- value = Promise.resolve(value);
3622
- }
3623
-
3624
- return then ? value.then(then) : value;
3625
- }
3626
-
3627
- function _async$7(f) {
3628
- return function () {
3629
- for (var args = [], i = 0; i < arguments.length; i++) {
3630
- args[i] = arguments[i];
3631
- }
3632
-
3633
- try {
3634
- return Promise.resolve(f.apply(this, args));
3635
- } catch (e) {
3636
- return Promise.reject(e);
3637
- }
3638
- };
3639
- }
3640
-
3641
- var fetchNative = _async$7(function (url) {
3642
- var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
3643
-
3644
- var _ref$mode = _ref.mode,
3645
- mode = _ref$mode === void 0 ? "cors" : _ref$mode,
3646
- options = _objectWithoutProperties(_ref, _excluded);
3647
-
3648
- return _await$8(window.fetch(url, _objectSpread2({
3649
- mode: mode
3650
- }, options)), function (response) {
3651
- return {
3652
- url: response.url,
3653
- status: response.status,
3654
- statusText: "",
3655
- headers: responseToHeaders(response),
3656
- text: function text() {
3657
- return response.text();
3658
- },
3659
- json: function json() {
3660
- return response.json();
3661
- },
3662
- blob: function blob() {
3663
- return response.blob();
3664
- },
3665
- arrayBuffer: function arrayBuffer() {
3666
- return response.arrayBuffer();
3667
- },
3668
- formData: function formData() {
3669
- return response.formData();
3670
- }
3671
- };
3672
- });
3673
- });
3674
-
3675
- var responseToHeaders = function responseToHeaders(response) {
3676
- var headers = {};
3677
- response.headers.forEach(function (value, name) {
3678
- headers[name] = value;
3679
- });
3680
- return headers;
3681
- };
3682
-
3683
- var fetchUrl = typeof window.fetch === "function" && typeof window.AbortController === "function" ? fetchNative : fetchUsingXHR;
3684
-
3685
- function _await$7(value, then, direct) {
3686
- if (direct) {
3687
- return then ? then(value) : value;
3688
- }
3689
-
3690
- if (!value || !value.then) {
3691
- value = Promise.resolve(value);
3692
- }
3693
-
3694
- return then ? value.then(then) : value;
3695
- }
3696
-
3697
- function _async$6(f) {
3698
- return function () {
3699
- for (var args = [], i = 0; i < arguments.length; i++) {
3700
- args[i] = arguments[i];
3701
- }
3702
-
3703
- try {
3704
- return Promise.resolve(f.apply(this, args));
3705
- } catch (e) {
3706
- return Promise.reject(e);
3707
- }
3708
- };
3709
- }
3710
-
3711
- var fetchJson = _async$6(function (url) {
3712
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
3713
- return _await$7(fetchUrl(url, options), function (response) {
3714
- return _await$7(response.json());
3715
- });
3716
- });
3717
- /*
3718
- * Prefer window.navigator.userAgentData before resorting to
3719
- * window.navigator.userAgent because of
3720
- * https://blog.chromium.org/2021/09/user-agent-reduction-origin-trial-and-dates.html
3721
- */
3722
-
3723
-
3724
- var detectFromUserAgentData = function detectFromUserAgentData() {
3725
- var userAgentData = window.navigator.userAgentData;
3726
-
3727
- if (!userAgentData) {
3728
- return null;
3729
- }
3730
-
3731
- var brands = userAgentData.brands;
3732
- var i = 0;
3733
-
3734
- while (i < brands.length) {
3735
- var _brands$i = brands[i],
3736
- brand = _brands$i.brand,
3737
- version = _brands$i.version;
3738
- i++;
3739
-
3740
- if (brand === "chromium" || brand === "Google Chrome") {
3741
- return {
3742
- name: "chrome",
3743
- version: version
3744
- };
3745
- }
3746
- }
3747
-
3748
- return null;
3749
- };
3750
-
3751
- var firstMatch = function firstMatch(regexp, string) {
3752
- var match = string.match(regexp);
3753
- return match && match.length > 0 ? match[1] || undefined : undefined;
3754
- };
3755
-
3756
- var secondMatch = function secondMatch(regexp, string) {
3757
- var match = string.match(regexp);
3758
- return match && match.length > 1 ? match[2] || undefined : undefined;
3759
- };
3760
-
3761
- var userAgentToVersion = function userAgentToVersion(userAgent) {
3762
- return firstMatch(/version\/(\d+(\.?_?\d+)+)/i, userAgent) || undefined;
3763
- };
3764
-
3765
- var detectAndroid = function detectAndroid() {
3766
- return navigatorToBrowser$1(window.navigator);
3767
- };
3768
-
3769
- var navigatorToBrowser$1 = function navigatorToBrowser(_ref) {
3770
- var userAgent = _ref.userAgent,
3771
- appVersion = _ref.appVersion;
3772
-
3773
- if (/(android)/i.test(userAgent)) {
3774
- return {
3775
- name: "android",
3776
- version: firstMatch(/Android (\d+(\.?_?\d+)+)/i, appVersion)
3777
- };
3778
- }
3779
-
3780
- return null;
3781
- };
3782
-
3783
- var detectInternetExplorer = function detectInternetExplorer() {
3784
- return userAgentToBrowser$5(window.navigator.userAgent);
3785
- };
3786
-
3787
- var userAgentToBrowser$5 = function userAgentToBrowser(userAgent) {
3788
- if (/msie|trident/i.test(userAgent)) {
3789
- return {
3790
- name: "ie",
3791
- version: firstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i, userAgent)
3792
- };
3793
- }
3794
-
3795
- return null;
3796
- };
3797
-
3798
- var detectOpera = function detectOpera() {
3799
- return userAgentToBrowser$4(window.navigator.userAgent);
3800
- };
3801
-
3802
- var userAgentToBrowser$4 = function userAgentToBrowser(userAgent) {
3803
- // opera below 13
3804
- if (/opera/i.test(userAgent)) {
3805
- return {
3806
- name: "opera",
3807
- version: userAgentToVersion(userAgent) || firstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i, userAgent)
3808
- };
3809
- } // opera above 13
3810
-
3811
-
3812
- if (/opr\/|opios/i.test(userAgent)) {
3813
- return {
3814
- name: "opera",
3815
- version: firstMatch(/(?:opr|opios)[\s/](\S+)/i, userAgent) || userAgentToVersion(userAgent)
3816
- };
3817
- }
3818
-
3819
- return null;
3820
- };
3821
-
3822
- var detectEdge = function detectEdge() {
3823
- return userAgentToBrowser$3(window.navigator.userAgent);
3824
- };
3825
-
3826
- var userAgentToBrowser$3 = function userAgentToBrowser(userAgent) {
3827
- if (/edg([ea]|ios)/i.test(userAgent)) {
3828
- return {
3829
- name: "edge",
3830
- version: secondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i, userAgent)
3831
- };
3832
- }
3833
-
3834
- return null;
3835
- };
3836
-
3837
- var detectFirefox = function detectFirefox() {
3838
- return userAgentToBrowser$2(window.navigator.userAgent);
3839
- };
3840
-
3841
- var userAgentToBrowser$2 = function userAgentToBrowser(userAgent) {
3842
- if (/firefox|iceweasel|fxios/i.test(userAgent)) {
3843
- return {
3844
- name: "firefox",
3845
- version: firstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i, userAgent)
3846
- };
3847
- }
3848
-
3849
- return null;
3850
- };
3851
-
3852
- var detectChrome = function detectChrome() {
3853
- return userAgentToBrowser$1(window.navigator.userAgent);
3854
- };
3855
-
3856
- var userAgentToBrowser$1 = function userAgentToBrowser(userAgent) {
3857
- if (/chromium/i.test(userAgent)) {
3858
- return {
3859
- name: "chrome",
3860
- version: firstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i, userAgent) || userAgentToVersion(userAgent)
3861
- };
3862
- }
3863
-
3864
- if (/chrome|crios|crmo/i.test(userAgent)) {
3865
- return {
3866
- name: "chrome",
3867
- version: firstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i, userAgent)
3868
- };
3869
- }
3870
-
3871
- return null;
3872
- };
3873
-
3874
- var detectSafari = function detectSafari() {
3875
- return userAgentToBrowser(window.navigator.userAgent);
3876
- };
3877
-
3878
- var userAgentToBrowser = function userAgentToBrowser(userAgent) {
3879
- if (/safari|applewebkit/i.test(userAgent)) {
3880
- return {
3881
- name: "safari",
3882
- version: userAgentToVersion(userAgent)
3883
- };
3884
- }
3885
-
3886
- return null;
3887
- };
3888
-
3889
- var detectElectron = function detectElectron() {
3890
- return null;
3891
- }; // TODO
3892
-
3893
-
3894
- var detectIOS = function detectIOS() {
3895
- return navigatorToBrowser(window.navigator);
3896
- };
3897
-
3898
- var navigatorToBrowser = function navigatorToBrowser(_ref) {
3899
- var userAgent = _ref.userAgent,
3900
- appVersion = _ref.appVersion;
3901
-
3902
- if (/iPhone;/.test(userAgent)) {
3903
- return {
3904
- name: "ios",
3905
- version: firstMatch(/OS (\d+(\.?_?\d+)+)/i, appVersion)
3906
- };
3907
- }
3908
-
3909
- if (/iPad;/.test(userAgent)) {
3910
- return {
3911
- name: "ios",
3912
- version: firstMatch(/OS (\d+(\.?_?\d+)+)/i, appVersion)
3913
- };
3914
- }
3915
-
3916
- return null;
3917
- }; // https://github.com/Ahmdrza/detect-browser/blob/26254f85cf92795655a983bfd759d85f3de850c6/detect-browser.js#L1
3918
-
3919
-
3920
- var detectorCompose = function detectorCompose(detectors) {
3921
- return function () {
3922
- var i = 0;
3923
-
3924
- while (i < detectors.length) {
3925
- var _detector = detectors[i];
3926
- i++;
3927
-
3928
- var result = _detector();
3929
-
3930
- if (result) {
3931
- return result;
3932
- }
3933
- }
3934
-
3935
- return null;
3936
- };
3937
- };
3938
-
3939
- var detector = detectorCompose([detectFromUserAgentData, // keep this first
3940
- detectOpera, detectInternetExplorer, detectEdge, detectFirefox, detectChrome, detectSafari, detectElectron, detectIOS, detectAndroid]);
3941
-
3942
- var detectBrowser = function detectBrowser() {
3943
- var _ref = detector() || {},
3944
- _ref$name = _ref.name,
3945
- name = _ref$name === void 0 ? "other" : _ref$name,
3946
- _ref$version = _ref.version,
3947
- version = _ref$version === void 0 ? "unknown" : _ref$version;
3948
-
3949
- return {
3950
- name: normalizeName(name),
3951
- version: normalizeVersion(version)
3952
- };
3953
- };
3954
-
3955
- var normalizeName = function normalizeName(name) {
3956
- return name.toLowerCase();
3957
- };
3958
-
3959
- var normalizeVersion = function normalizeVersion(version) {
3960
- if (version.indexOf(".") > -1) {
3961
- var parts = version.split("."); // remove extraneous .
3962
-
3963
- return parts.slice(0, 3).join(".");
3964
- }
3965
-
3966
- if (version.indexOf("_") > -1) {
3967
- var _parts = version.split("_"); // remove extraneous _
3968
-
3969
-
3970
- return _parts.slice(0, 3).join("_");
3971
- }
3972
-
3973
- return version;
3974
- };
3975
-
3976
- var executeWithScriptModuleInjection = function executeWithScriptModuleInjection(code) {
3977
- var scriptModule = document.createElement("script");
3978
- scriptModule.type = "module";
3979
- var loadPromise = new Promise(function (resolve, reject) {
3980
- scriptModule.onload = function () {
3981
- document.body.removeChild(scriptModule);
3982
- resolve();
3983
- };
3984
-
3985
- scriptModule.onerror = function () {
3986
- document.body.removeChild(scriptModule);
3987
- reject();
3988
- };
3989
-
3990
- document.body.appendChild(scriptModule);
3991
- });
3992
- scriptModule.src = asBase64Url(code);
3993
- return loadPromise;
3994
- };
3995
-
3996
- var asBase64Url = function asBase64Url(text) {
3997
- var mimeType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "application/javascript";
3998
- return "data:".concat(mimeType, ";base64,").concat(window.btoa(text));
3999
- };
4000
-
4001
- function _await$6(value, then, direct) {
4002
- if (direct) {
4003
- return then ? then(value) : value;
4004
- }
4005
-
4006
- if (!value || !value.then) {
4007
- value = Promise.resolve(value);
4008
- }
4009
-
4010
- return then ? value.then(then) : value;
4011
- }
4012
-
4013
- function _catch$4(body, recover) {
4014
- try {
4015
- var result = body();
4016
- } catch (e) {
4017
- return recover(e);
4018
- }
4019
-
4020
- if (result && result.then) {
4021
- return result.then(void 0, recover);
4022
- }
4023
-
4024
- return result;
4025
- }
4026
-
4027
- function _async$5(f) {
4028
- return function () {
4029
- for (var args = [], i = 0; i < arguments.length; i++) {
4030
- args[i] = arguments[i];
4031
- }
4032
-
4033
- try {
4034
- return Promise.resolve(f.apply(this, args));
4035
- } catch (e) {
4036
- return Promise.reject(e);
4037
- }
4038
- };
4039
- }
4040
-
4041
- var supportsImportmap = _async$5(function () {
4042
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
4043
- _ref$remote = _ref.remote,
4044
- remote = _ref$remote === void 0 ? true : _ref$remote;
4045
-
4046
- var specifier = asBase64Url("export default false");
4047
- var importMap = {
4048
- imports: _defineProperty({}, specifier, asBase64Url("export default true"))
4049
- };
4050
- var importmapScript = document.createElement("script");
4051
- var importmapString = JSON.stringify(importMap, null, " ");
4052
- importmapScript.type = "importmap";
4053
-
4054
- if (remote) {
4055
- importmapScript.src = "data:application/json;base64,".concat(window.btoa(importmapString));
4056
- } else {
4057
- importmapScript.textContent = importmapString;
4058
- }
4059
-
4060
- document.body.appendChild(importmapScript);
4061
- return _catch$4(function () {
4062
- return _await$6(executeWithScriptModuleInjection("import supported from \"".concat(specifier, "\"; window.__jsenv_runtime_test_importmap__ = supported")), function () {
4063
- document.body.removeChild(importmapScript);
4064
- var supported = window.__jsenv_runtime_test_importmap__;
4065
- delete window.__jsenv_runtime_test_importmap__;
4066
- return supported;
4067
- });
4068
- }, function () {
4069
- document.body.removeChild(importmapScript);
4070
- return false;
4071
- });
4072
- });
4073
-
4074
- function _await$5(value, then, direct) {
4075
- if (direct) {
4076
- return then ? then(value) : value;
4077
- }
4078
-
4079
- if (!value || !value.then) {
4080
- value = Promise.resolve(value);
4081
- }
4082
-
4083
- return then ? value.then(then) : value;
4084
- }
4085
-
4086
- function _catch$3(body, recover) {
4087
- try {
4088
- var result = body();
4089
- } catch (e) {
4090
- return recover(e);
4091
- }
4092
-
4093
- if (result && result.then) {
4094
- return result.then(void 0, recover);
4095
- }
4096
-
4097
- return result;
4098
- }
4099
-
4100
- function _async$4(f) {
4101
- return function () {
4102
- for (var args = [], i = 0; i < arguments.length; i++) {
4103
- args[i] = arguments[i];
4104
- }
4105
-
4106
- try {
4107
- return Promise.resolve(f.apply(this, args));
4108
- } catch (e) {
4109
- return Promise.reject(e);
4110
- }
4111
- };
4112
- }
4113
-
4114
- var supportsDynamicImport = _async$4(function () {
4115
- var moduleSource = asBase64Url("export default 42");
4116
- return _catch$3(function () {
4117
- return _await$5(executeWithScriptModuleInjection("window.__jsenv_runtime_test_dynamic_import__ = import(".concat(JSON.stringify(moduleSource), ")")), function () {
4118
- return _await$5(window.__jsenv_runtime_test_dynamic_import__, function (namespace) {
4119
- delete window.__jsenv_runtime_test_dynamic_import__;
4120
- return namespace.default === 42;
4121
- });
4122
- });
4123
- }, function () {
4124
- return false;
4125
- });
4126
- });
4127
-
4128
- function _await$4(value, then, direct) {
4129
- if (direct) {
4130
- return then ? then(value) : value;
4131
- }
4132
-
4133
- if (!value || !value.then) {
4134
- value = Promise.resolve(value);
4135
- }
4136
-
4137
- return then ? value.then(then) : value;
4138
- }
4139
-
4140
- function _catch$2(body, recover) {
4141
- try {
4142
- var result = body();
4143
- } catch (e) {
4144
- return recover(e);
4145
- }
4146
-
4147
- if (result && result.then) {
4148
- return result.then(void 0, recover);
4149
- }
4150
-
4151
- return result;
4152
- }
4153
-
4154
- var supportsTopLevelAwait = function supportsTopLevelAwait() {
4155
- return _await$4(_catch$2(function () {
4156
- return _await$4(executeWithScriptModuleInjection("window.__jsenv_runtime_test_top_level_await__ = await Promise.resolve(42)"), function () {
4157
- var supported = window.__jsenv_runtime_test_top_level_await__ === 42;
4158
- delete window.__jsenv_runtime_test_top_level_await__;
4159
- return supported;
4160
- });
4161
- }, function () {
4162
- return false;
4163
- }));
4164
- };
4165
-
4166
- function _await$3(value, then, direct) {
4167
- if (direct) {
4168
- return then ? then(value) : value;
4169
- }
4170
-
4171
- if (!value || !value.then) {
4172
- value = Promise.resolve(value);
4173
- }
4174
-
4175
- return then ? value.then(then) : value;
4176
- }
4177
-
4178
- function _catch$1(body, recover) {
4179
- try {
4180
- var result = body();
4181
- } catch (e) {
4182
- return recover(e);
4183
- }
4184
-
4185
- if (result && result.then) {
4186
- return result.then(void 0, recover);
4187
- }
4188
-
4189
- return result;
4190
- }
4191
-
4192
- function _async$3(f) {
4193
- return function () {
4194
- for (var args = [], i = 0; i < arguments.length; i++) {
4195
- args[i] = arguments[i];
4196
- }
4197
-
4198
- try {
4199
- return Promise.resolve(f.apply(this, args));
4200
- } catch (e) {
4201
- return Promise.reject(e);
4202
- }
4203
- };
4204
- }
4205
-
4206
- var supportsJsonImportAssertions = _async$3(function () {
4207
- var jsonBase64Url = asBase64Url("42", "application/json");
4208
- var moduleSource = asBase64Url("import data from \"".concat(jsonBase64Url, "\" assert { type: \"json\" }\n export default data"));
4209
- return _catch$1(function () {
4210
- return _await$3(executeWithScriptModuleInjection("window.__jsenv_runtime_test_json_import_assertion__ = import(".concat(JSON.stringify(moduleSource), ")")), function () {
4211
- return _await$3(window.__jsenv_runtime_test_json_import_assertion__, function (namespace) {
4212
- var supported = namespace.default === 42;
4213
- delete window.__jsenv_runtime_test_json_import_assertion__;
4214
- return supported;
4215
- });
4216
- });
4217
- }, function () {
4218
- return false;
4219
- });
4220
- });
4221
-
4222
- function _await$2(value, then, direct) {
4223
- if (direct) {
4224
- return then ? then(value) : value;
4225
- }
4226
-
4227
- if (!value || !value.then) {
4228
- value = Promise.resolve(value);
4229
- }
4230
-
4231
- return then ? value.then(then) : value;
4232
- }
4233
-
4234
- function _catch(body, recover) {
4235
- try {
4236
- var result = body();
4237
- } catch (e) {
4238
- return recover(e);
4239
- }
4240
-
4241
- if (result && result.then) {
4242
- return result.then(void 0, recover);
4243
- }
4244
-
4245
- return result;
4246
- }
4247
-
4248
- function _async$2(f) {
4249
- return function () {
4250
- for (var args = [], i = 0; i < arguments.length; i++) {
4251
- args[i] = arguments[i];
4252
- }
4253
-
4254
- try {
4255
- return Promise.resolve(f.apply(this, args));
4256
- } catch (e) {
4257
- return Promise.reject(e);
4258
- }
4259
- };
4260
- }
4261
-
4262
- var supportsCssImportAssertions = _async$2(function () {
4263
- var cssBase64Url = asBase64Url("p { color: red; }", "text/css");
4264
- var moduleSource = asBase64Url("import css from \"".concat(cssBase64Url, "\" assert { type: \"css\" }\n export default css"));
4265
- return _catch(function () {
4266
- return _await$2(executeWithScriptModuleInjection("window.__jsenv_runtime_test_css_import_assertion__ = import(".concat(JSON.stringify(moduleSource), ")")), function () {
4267
- return _await$2(window.__jsenv_runtime_test_css_import_assertion__, function (namespace) {
4268
- return namespace.default instanceof CSSStyleSheet;
4269
- });
4270
- });
4271
- }, function () {
4272
- return false;
4273
- });
4274
- });
4275
-
4276
- var supportsNewStylesheet = function supportsNewStylesheet() {
4277
- try {
4278
- // eslint-disable-next-line no-new
4279
- new CSSStyleSheet();
4280
- return true;
4281
- } catch (e) {
4282
- return false;
4283
- }
4284
- };
4285
-
4286
- function _await$1(value, then, direct) {
4287
- if (direct) {
4288
- return then ? then(value) : value;
4289
- }
4290
-
4291
- if (!value || !value.then) {
4292
- value = Promise.resolve(value);
4293
- }
4294
-
4295
- return then ? value.then(then) : value;
4296
- }
4297
-
4298
- function _async$1(f) {
4299
- return function () {
4300
- for (var args = [], i = 0; i < arguments.length; i++) {
4301
- args[i] = arguments[i];
4302
- }
4303
-
4304
- try {
4305
- return Promise.resolve(f.apply(this, args));
4306
- } catch (e) {
4307
- return Promise.reject(e);
4308
- }
4309
- };
4310
- }
4311
-
4312
- function _call(body, then, direct) {
4313
- if (direct) {
4314
- return then ? then(body()) : body();
4315
- }
4316
-
4317
- try {
4318
- var result = Promise.resolve(body());
4319
- return then ? result.then(then) : result;
4320
- } catch (e) {
4321
- return Promise.reject(e);
4322
- }
4323
- }
4324
-
4325
- var scanBrowserRuntimeFeatures = _async$1(function () {
4326
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
4327
- _ref$coverageHandledF = _ref.coverageHandledFromOutside,
4328
- coverageHandledFromOutside = _ref$coverageHandledF === void 0 ? false : _ref$coverageHandledF,
4329
- _ref$forceCompilation = _ref.forceCompilation,
4330
- forceCompilation = _ref$forceCompilation === void 0 ? false : _ref$forceCompilation,
4331
- _ref$forceSource = _ref.forceSource,
4332
- forceSource = _ref$forceSource === void 0 ? false : _ref$forceSource;
4333
-
4334
- var jsenvCompileProfileUrl = "/__jsenv_compile_profile__";
4335
- return _await$1(fetchJson(jsenvCompileProfileUrl), function (_ref2) {
4336
- var jsenvDirectoryRelativeUrl = _ref2.jsenvDirectoryRelativeUrl,
4337
- inlineImportMapIntoHTML = _ref2.inlineImportMapIntoHTML,
4338
- availableCompileIds = _ref2.availableCompileIds;
4339
-
4340
- var _detectBrowser = detectBrowser(),
4341
- name = _detectBrowser.name,
4342
- version = _detectBrowser.version;
4343
-
4344
- return _await$1(detectSupportedFeatures({
4345
- coverageHandledFromOutside: coverageHandledFromOutside,
4346
- inlineImportMapIntoHTML: inlineImportMapIntoHTML
4347
- }), function (featuresReport) {
4348
- var runtimeReport = {
4349
- env: {
4350
- browser: true
4351
- },
4352
- name: name,
4353
- version: version,
4354
- featuresReport: featuresReport,
4355
- forceSource: forceSource,
4356
- forceCompilation: forceCompilation
4357
- };
4358
- return _await$1(fetchJson(jsenvCompileProfileUrl, {
4359
- method: "POST",
4360
- headers: {
4361
- "content-type": "application/json"
4362
- },
4363
- body: JSON.stringify(runtimeReport)
4364
- }), function (_ref3) {
4365
- var compileProfile = _ref3.compileProfile,
4366
- compileId = _ref3.compileId;
4367
- return {
4368
- jsenvDirectoryRelativeUrl: jsenvDirectoryRelativeUrl,
4369
- inlineImportMapIntoHTML: inlineImportMapIntoHTML,
4370
- availableCompileIds: availableCompileIds,
4371
- runtimeReport: runtimeReport,
4372
- compileProfile: compileProfile,
4373
- compileId: compileId
4374
- };
4375
- });
4376
- });
4377
- });
4378
- });
4379
-
4380
- var detectSupportedFeatures = _async$1(function (_ref4) {
4381
- var coverageHandledFromOutside = _ref4.coverageHandledFromOutside,
4382
- inlineImportMapIntoHTML = _ref4.inlineImportMapIntoHTML;
4383
- var featuresReport = {};
4384
- featuresReport["import_http"] = true;
4385
- featuresReport["coverage_js"] = coverageHandledFromOutside; // new CSSStyleSheet
4386
-
4387
- featuresReport["new_stylesheet"] = supportsNewStylesheet(); // importmap
4388
- // start testing importmap support first and not in paralell
4389
- // so that there is not module script loaded beore importmap is injected
4390
- // it would log an error in chrome console and return undefined
4391
-
4392
- return _await$1(supportsImportmap({
4393
- // chrome supports inline but not remote importmap
4394
- // https://github.com/WICG/import-maps/issues/235
4395
- // at this stage we won't know if the html file will use
4396
- // an importmap or not and if that importmap is inline or specified with an src
4397
- // so we should test if browser support local and remote importmap.
4398
- // But there exploring server can inline importmap by transforming html
4399
- // and in that case we can test only the local importmap support
4400
- // so we test importmap support and the remote one
4401
- remote: !inlineImportMapIntoHTML
4402
- }), function (_supportsImportmap) {
4403
- featuresReport.importmap = _supportsImportmap; // dynamic import
4404
-
4405
- return _call(supportsDynamicImport, function (_supportsDynamicImpor) {
4406
- featuresReport["import_dynamic"] = _supportsDynamicImpor; // top level await
4407
-
4408
- return _call(supportsTopLevelAwait, function (_supportsTopLevelAwai) {
4409
- featuresReport["top_level_await"] = _supportsTopLevelAwai; // import assertions
4410
-
4411
- return _call(supportsJsonImportAssertions, function (_supportsJsonImportAs) {
4412
- featuresReport["import_assertion_type_json"] = _supportsJsonImportAs;
4413
- return _call(supportsCssImportAssertions, function (_supportsCssImportAss) {
4414
- featuresReport["import_assertion_type_css"] = _supportsCssImportAss;
4415
- return featuresReport;
4416
- });
4417
- });
4418
- });
4419
- });
4420
- });
4421
- });
4422
-
4423
- var renderCompilationInToolbar = function renderCompilationInToolbar(_ref) {
4424
- var compileGroup = _ref.compileGroup;
4425
- var browserSupportRootNode = document.querySelector("#browser_support");
4426
- var filesCompilationRootNode = document.querySelector("#files_compilation");
4427
- removeForceHideElement(browserSupportRootNode);
4428
- removeForceHideElement(filesCompilationRootNode);
4429
- scanBrowserRuntimeFeatures().then(function (_ref2) {
4430
- var jsenvDirectoryRelativeUrl = _ref2.jsenvDirectoryRelativeUrl,
4431
- inlineImportMapIntoHTML = _ref2.inlineImportMapIntoHTML,
4432
- compileProfile = _ref2.compileProfile,
4433
- compileId = _ref2.compileId,
4434
- runtimeReport = _ref2.runtimeReport;
4435
- var browserSupport = compileId ? "no" : inlineImportMapIntoHTML ? "partial" : "full";
4436
- enableVariant(browserSupportRootNode, {
4437
- browserSupport: browserSupport
4438
- });
4439
-
4440
- if (browserSupport === "no") {
4441
- browserSupportRootNode.querySelector("a.browser_support_read_more_link").onclick = function () {
4442
- // eslint-disable-next-line no-alert
4443
- window.alert("Source files needs to be compiled to be executable in this browser because: ".concat(listWhatIsMissing({
4444
- compileProfile: compileProfile
4445
- })));
4446
- };
4447
- } else if (browserSupport === "partial") {
4448
- browserSupportRootNode.querySelector("a.browser_support_read_more_link").onclick = function () {
4449
- // eslint-disable-next-line no-alert
4450
- window.alert("Source files (except html) can be executed directly in this browser because: ".concat(listWhatIsSupported({
4451
- inlineImportMapIntoHTML: inlineImportMapIntoHTML
4452
- })));
4453
- };
4454
- } else if (browserSupport === "full") {
4455
- browserSupportRootNode.querySelector("a.browser_support_read_more_link").onclick = function () {
4456
- // eslint-disable-next-line no-alert
4457
- window.alert("Source files can be executed directly in this browser because: ".concat(listWhatIsSupported({
4458
- inlineImportMapIntoHTML: inlineImportMapIntoHTML
4459
- })));
4460
- };
4461
- }
4462
-
4463
- var actualCompileId = compileGroup.compileId;
4464
- var expectedCompiledId = compileId;
4465
- var shouldSwitchCompileId = expectedCompiledId && actualCompileId && actualCompileId !== expectedCompiledId;
4466
- var shouldCompile = !actualCompileId && browserSupport === "no";
4467
- var filesCompilation = shouldSwitchCompileId ? "mismatch" : actualCompileId ? "yes" : inlineImportMapIntoHTML ? "html_only" : "no";
4468
- var hasWarning = shouldCompile || shouldSwitchCompileId;
4469
- enableVariant(filesCompilationRootNode, {
4470
- filesCompilation: filesCompilation,
4471
- compilation_link: shouldSwitchCompileId ? "mismatch" : actualCompileId ? "source" : expectedCompiledId ? "compiled" : "force"
4472
- });
4473
-
4474
- if (filesCompilation === "yes") {
4475
- document.querySelector(".files_compilation_text").innerHTML = "Files shown are compiled for ".concat(runtimeReport.name, "@").concat(runtimeReport.version);
4476
- }
4477
-
4478
- setLinkHrefForParentWindow(filesCompilationRootNode.querySelector("a.link_to_source_files"), "/".concat(compileGroup.fileRelativeUrl));
4479
- setLinkHrefForParentWindow(filesCompilationRootNode.querySelector("a.link_to_compiled_files"), "/".concat(jsenvDirectoryRelativeUrl).concat(expectedCompiledId, "/").concat(compileGroup.fileRelativeUrl));
4480
- setLinkHrefForParentWindow(filesCompilationRootNode.querySelector("a.link_to_compilation_forced_files"), "/".concat(jsenvDirectoryRelativeUrl, "force/").concat(compileGroup.fileRelativeUrl));
4481
- setLinkHrefForParentWindow(filesCompilationRootNode.querySelector("a.link_to_appropriate_files"), "/".concat(jsenvDirectoryRelativeUrl).concat(expectedCompiledId, "/").concat(compileGroup.fileRelativeUrl));
4482
-
4483
- if (hasWarning) {
4484
- enableWarningStyle();
4485
- document.querySelector(".files_compilation_text").setAttribute("data-warning", "");
4486
- document.querySelector(".browser_support_text").setAttribute("data-warning", "");
4487
- document.querySelector("#settings-button").setAttribute("data-warning", "");
4488
- } else {
4489
- disableWarningStyle();
4490
- document.querySelector(".files_compilation_text").removeAttribute("data-warning");
4491
- document.querySelector(".browser_support_text").removeAttribute("data-warning");
4492
- document.querySelector("#settings-button").removeAttribute("data-warning");
4493
- }
4494
- });
4495
- };
4496
-
4497
- var listWhatIsSupported = function listWhatIsSupported(_ref3) {
4498
- var inlineImportMapIntoHTML = _ref3.inlineImportMapIntoHTML;
4499
- var parts = [];
4500
-
4501
- if (inlineImportMapIntoHTML) {
4502
- parts.push("importmaps are supported (only when inlined in html files)");
4503
- } else {
4504
- parts.push("importmaps are supported");
4505
- }
4506
-
4507
- parts.push("dynamic imports are supported");
4508
- parts.push("top level await is supported");
4509
- parts.push("all features are natively supported");
4510
- return "\n- ".concat(parts.join("\n- "));
4511
- };
4512
-
4513
- var listWhatIsMissing = function listWhatIsMissing(_ref4) {
4514
- var compileProfile = _ref4.compileProfile;
4515
- var parts = [];
4516
- var missingFeatures = compileProfile.missingFeatures;
4517
-
4518
- if (missingFeatures.importmap) {
4519
- parts.push("importmaps are not supported");
4520
- }
4521
-
4522
- if (missingFeatures.dynamicImport) {
4523
- parts.push("dynamic imports are not supported");
4524
- }
4525
-
4526
- if (missingFeatures.topLevelAwait) {
4527
- parts.push("top level await is not supported");
4528
- }
4529
-
4530
- var missingFeatureNames = Object.keys(missingFeatures).filter(function (name) {
4531
- return name !== "importmap" && name !== "dynamicImport" && name !== "topLevelAwait" && name !== "custom_compiler_patterns";
4532
- });
4533
- var missingFeatureCount = missingFeatureNames.length;
4534
-
4535
- if (missingFeatureCount > 0) {
4536
- parts.push("".concat(missingFeatureCount, " features are missing: ").concat(missingFeatureNames));
4537
- }
4538
-
4539
- var custom_compiler_patterns = missingFeatures.custom_compiler_patterns;
4540
-
4541
- if (custom_compiler_patterns) {
4542
- parts.push("".concat(custom_compiler_patterns.length, " custom compilers enabled: ").concat(custom_compiler_patterns));
4543
- }
4544
-
4545
- return "\n- ".concat(parts.join("\n- "));
4546
- };
4547
-
4548
- var livereloadingAvailableOnServer = false;
4549
- var parentEventSourceClient = window.parent.__jsenv_event_source_client__;
4550
-
4551
- var initToolbarEventSource = function initToolbarEventSource(_ref) {
4552
- var livereloading = _ref.livereloading;
4553
- removeForceHideElement(document.querySelector("#eventsource-indicator"));
4554
- livereloadingAvailableOnServer = livereloading;
4555
-
4556
- if (!livereloadingAvailableOnServer) {
4557
- disableLivereloadSetting();
4558
- }
4559
-
4560
- parentEventSourceClient.setConnectionStatusChangeCallback(function () {
4561
- updateEventSourceIndicator();
4562
- });
4563
- var livereloadCheckbox = document.querySelector("#toggle-livereload");
4564
- livereloadCheckbox.checked = parentEventSourceClient.isLivereloadEnabled();
4565
-
4566
- livereloadCheckbox.onchange = function () {
4567
- parentEventSourceClient.setLivereloadPreference(livereloadCheckbox.checked);
4568
- updateEventSourceIndicator();
4569
- };
4570
-
4571
- updateEventSourceIndicator();
4572
- };
4573
-
4574
- var updateEventSourceIndicator = function updateEventSourceIndicator() {
4575
- var eventSourceIndicator = document.querySelector("#eventsource-indicator");
4576
- var fileChanges = parentEventSourceClient.getFileChanges();
4577
- var changeCount = Object.keys(fileChanges).length;
4578
- var eventSourceConnectionState = parentEventSourceClient.getConnectionStatus();
4579
- enableVariant(eventSourceIndicator, {
4580
- eventsource: eventSourceConnectionState,
4581
- livereload: parentEventSourceClient.isLivereloadEnabled() ? "on" : "off",
4582
- changes: changeCount > 0 ? "yes" : "no"
4583
- });
4584
- var variantNode = document.querySelector("#eventsource-indicator > [data-when-active]");
4585
-
4586
- variantNode.querySelector("button").onclick = function () {
4587
- toggleTooltip(eventSourceIndicator);
4588
- };
4589
-
4590
- if (eventSourceConnectionState === "connecting") {
4591
- variantNode.querySelector("a").onclick = function () {
4592
- parentEventSourceClient.disconnect();
4593
- };
4594
- } else if (eventSourceConnectionState === "connected") {
4595
- removeAutoShowTooltip(eventSourceIndicator);
4596
-
4597
- if (changeCount) {
4598
- var changeLink = variantNode.querySelector(".eventsource-changes-link");
4599
- changeLink.innerHTML = changeCount;
4600
-
4601
- changeLink.onclick = function () {
4602
- console.log(JSON.stringify(fileChanges, null, " "), fileChanges); // eslint-disable-next-line no-alert
4603
-
4604
- window.parent.alert(JSON.stringify(fileChanges, null, " "));
4605
- };
4606
-
4607
- variantNode.querySelector(".eventsource-reload-link").onclick = function () {
4608
- parentEventSourceClient.reloadIfNeeded();
4609
- };
4610
- }
4611
- } else if (eventSourceConnectionState === "disconnected") {
4612
- autoShowTooltip(eventSourceIndicator);
4613
-
4614
- variantNode.querySelector("a").onclick = function () {
4615
- parentEventSourceClient.connect();
4616
- };
4617
- }
4618
- };
4619
-
4620
- var disableLivereloadSetting = function disableLivereloadSetting() {
4621
- document.querySelector(".settings-livereload").setAttribute("data-disabled", "true");
4622
- document.querySelector(".settings-livereload").setAttribute("title", "Livereload not available: disabled by server");
4623
- document.querySelector("#toggle-livereload").disabled = true;
4624
- };
4625
-
4626
- var WINDOW_SMALL_WIDTH = 420;
4627
-
4628
- var makeToolbarResponsive = function makeToolbarResponsive() {
4629
- // apply responsive design on toolbar icons if needed + add listener on resize screen
4630
- // ideally we should listen breakpoint once, for now restore toolbar
4631
- var overflowMenuBreakpoint = createHorizontalBreakpoint(WINDOW_SMALL_WIDTH);
4632
-
4633
- var handleOverflowMenuBreakpoint = function handleOverflowMenuBreakpoint() {
4634
- responsiveToolbar(overflowMenuBreakpoint);
4635
- };
4636
-
4637
- handleOverflowMenuBreakpoint();
4638
- overflowMenuBreakpoint.changed.listen(handleOverflowMenuBreakpoint); // overflow menu
4639
-
4640
- document.querySelector("#overflow-menu-button").onclick = function () {
4641
- return toggleOverflowMenu();
4642
- };
4643
- };
4644
-
4645
- var responsiveToolbar = function responsiveToolbar(overflowMenuBreakpoint) {
4646
- // close all tooltips in case opened
4647
- hideTooltip(document.querySelector("#eventsource-indicator"));
4648
- hideTooltip(document.querySelector("#execution-indicator")); // close settings box in case opened
4649
-
4650
- deactivateToolbarSection(document.querySelector("#settings"));
4651
-
4652
- if (overflowMenuBreakpoint.isBelow()) {
4653
- enableOverflow();
4654
- } else {
4655
- disableOverflow();
4656
- }
4657
- };
4658
-
4659
- var moves = [];
4660
-
4661
- var enableOverflow = function enableOverflow() {
4662
- // move elements from toolbar to overflow menu
4663
- var responsiveToolbarElements = document.querySelectorAll("[data-responsive-toolbar-element]");
4664
- var overflowMenu = document.querySelector("#overflow-menu"); // keep a placeholder element to know where to move them back
4665
-
4666
- moves = Array.from(responsiveToolbarElements).map(function (element) {
4667
- var placeholder = document.createElement("div");
4668
- placeholder.style.display = "none";
4669
- placeholder.setAttribute("data-placeholder", "");
4670
- element.parentNode.replaceChild(placeholder, element);
4671
- overflowMenu.appendChild(element);
4672
- return {
4673
- element: element,
4674
- placeholder: placeholder
4675
- };
4676
- });
4677
- document.querySelector("#toolbar").setAttribute("data-overflow-menu-enabled", "");
4678
- removeForceHideElement(document.querySelector("#overflow-menu-button"));
4679
- };
4680
-
4681
- var disableOverflow = function disableOverflow() {
4682
- // close overflow menu in case it's open & unselect toggleOverflowMenu button in case it's selected
4683
- hideOverflowMenu();
4684
- deactivateToolbarSection(document.querySelector("#overflow-menu"));
4685
- moves.forEach(function (_ref) {
4686
- var element = _ref.element,
4687
- placeholder = _ref.placeholder;
4688
- placeholder.parentNode.replaceChild(element, placeholder);
4689
- });
4690
- moves = [];
4691
- document.querySelector("#toolbar").removeAttribute("data-overflow-menu-enabled");
4692
- forceHideElement(document.querySelector("#overflow-menu-button"));
4693
- };
4694
-
4695
- var toggleOverflowMenu = function toggleOverflowMenu() {
4696
- if (overflowMenuIsVisible()) {
4697
- hideOverflowMenu();
4698
- } else {
4699
- showOverflowMenu();
4700
- }
4701
- };
4702
-
4703
- var overflowMenuIsVisible = function overflowMenuIsVisible() {
4704
- var toolbar = document.querySelector("#toolbar");
4705
- return toolbar.hasAttribute("data-overflow-menu-visible");
4706
- };
4707
-
4708
- var showOverflowMenu = function showOverflowMenu() {
4709
- var toolbar = document.querySelector("#toolbar");
4710
- document.querySelector("#overflow-menu").setAttribute("data-animate", "");
4711
- toolbar.setAttribute("data-overflow-menu-visible", "");
4712
- };
4713
-
4714
- var hideOverflowMenu = function hideOverflowMenu() {
4715
- var toolbar = document.querySelector("#toolbar");
4716
- toolbar.removeAttribute("data-overflow-menu-visible");
4717
- document.querySelector("#overflow-menu").removeAttribute("data-animate");
4718
- };
4719
-
4720
- function _await(value, then, direct) {
4721
- if (direct) {
4722
- return then ? then(value) : value;
4723
- }
4724
-
4725
- if (!value || !value.then) {
4726
- value = Promise.resolve(value);
4727
- }
4728
-
4729
- return then ? value.then(then) : value;
4730
- }
4731
-
4732
- var toolbarVisibilityPreference = createPreference("toolbar");
4733
-
4734
- function _async(f) {
4735
- return function () {
4736
- for (var args = [], i = 0; i < arguments.length; i++) {
4737
- args[i] = arguments[i];
4738
- }
4739
-
4740
- try {
4741
- return Promise.resolve(f.apply(this, args));
4742
- } catch (e) {
4743
- return Promise.reject(e);
4744
- }
4745
- };
4746
- }
4747
-
4748
- var renderToolbar = _async(function (_ref) {
4749
- var exploringJSON = _ref.exploringJSON;
4750
- var executedFileCompiledUrl = window.parent.location.href;
4751
- var compileServerOrigin = window.parent.location.origin; // this should not block the whole toolbar rendering + interactivity
4752
-
4753
- var jsenvDirectoryRelativeUrl = exploringJSON.jsenvDirectoryRelativeUrl,
4754
- livereloading = exploringJSON.livereloading;
4755
- var compileGroup = getCompileGroup({
4756
- executedFileCompiledUrl: executedFileCompiledUrl,
4757
- jsenvDirectoryRelativeUrl: jsenvDirectoryRelativeUrl,
4758
- compileServerOrigin: compileServerOrigin
4759
- });
4760
- var executedFileRelativeUrl = compileGroup.fileRelativeUrl;
4761
- var toolbarOverlay = document.querySelector("#toolbar-overlay");
4762
-
4763
- toolbarOverlay.onclick = function () {
4764
- hideAllTooltip();
4765
- hideSettings();
4766
- };
4767
-
4768
- var toolbarVisible = toolbarVisibilityPreference.has() ? toolbarVisibilityPreference.get() : true;
4769
-
4770
- if (toolbarVisible) {
4771
- showToolbar({
4772
- animate: false
4773
- });
4774
- } else {
4775
- hideToolbar({
4776
- animate: false
4777
- });
4778
- }
4779
-
4780
- setLinkHrefForParentWindow(document.querySelector(".toolbar-icon-wrapper"), "/");
4781
- renderToolbarNotification();
4782
- makeToolbarResponsive();
4783
- renderToolbarSettings();
4784
- renderToolbarAnimation();
4785
- renderToolbarTheme();
4786
- renderExecutionInToolbar({
4787
- executedFileRelativeUrl: executedFileRelativeUrl
4788
- });
4789
- renderCompilationInToolbar({
4790
- compileGroup: compileGroup
4791
- }); // this might become active but we need to detect this somehow
4792
-
4793
- deactivateToolbarSection(document.querySelector("#file-list-link"));
4794
- initToolbarEventSource({
4795
- executedFileRelativeUrl: executedFileRelativeUrl,
4796
- livereloading: livereloading
4797
- }); // if user click enter or space quickly while closing toolbar
4798
- // it will cancel the closing
4799
- // that's why I used toggleToolbar and not hideToolbar
4800
-
4801
- document.querySelector("#button-close-toolbar").onclick = function () {
4802
- return toogleToolbar();
4803
- };
4804
-
4805
- return _await();
4806
- });
4807
-
4808
- var toogleToolbar = function toogleToolbar() {
4809
- if (toolbarIsVisible()) {
4810
- hideToolbar();
4811
- } else {
4812
- showToolbar();
4813
- }
4814
- };
4815
-
4816
- var toolbarIsVisible = function toolbarIsVisible() {
4817
- return document.documentElement.hasAttribute("data-toolbar-visible");
4818
- };
4819
-
4820
- var hideToolbar = function hideToolbar() {
4821
- // toolbar hidden by default, nothing to do to hide it by default
4822
- sendEventToParent("toolbar-visibility-change", false);
4823
- }; // (by the way it might be cool to have the toolbar auto show when)
4824
- // it has something to say (being disconnected from livereload server)
4825
-
4826
-
4827
- var showToolbar = function showToolbar() {
4828
- var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
4829
- _ref2$animate = _ref2.animate,
4830
- animate = _ref2$animate === void 0 ? true : _ref2$animate;
4831
-
4832
- toolbarVisibilityPreference.set(true);
4833
-
4834
- if (animate) {
4835
- document.documentElement.setAttribute("data-toolbar-animation", "");
4836
- } else {
4837
- document.documentElement.removeAttribute("data-toolbar-animation");
4838
- }
4839
-
4840
- document.documentElement.setAttribute("data-toolbar-visible", "");
4841
- sendEventToParent("toolbar-visibility-change", true);
4842
- var toolbarIframe = getToolbarIframe();
4843
- var toolbarIframeParent = toolbarIframe.parentNode;
4844
- var parentWindow = window.parent;
4845
- var parentDocumentElement = parentWindow.document.compatMode === "CSS1Compat" ? parentWindow.document.documentElement : parentWindow.document.body;
4846
- var scrollYMax = parentDocumentElement.scrollHeight - parentWindow.innerHeight;
4847
- var scrollY = parentDocumentElement.scrollTop;
4848
- var scrollYRemaining = scrollYMax - scrollY;
4849
- setStyles(toolbarIframeParent, {
4850
- "transition-property": "padding-bottom",
4851
- "transition-duration": "300ms"
4852
- }); // maybe we should use js animation here because we would not conflict with css
4853
-
4854
- var restoreToolbarIframeParentStyles = setStyles(toolbarIframeParent, {
4855
- "scroll-padding-bottom": "40px",
4856
- // same here we should add 40px
4857
- "padding-bottom": "40px" // if there is already one we should add 40px
4858
-
4859
- });
4860
- var restoreToolbarIframeStyles = setStyles(toolbarIframe, {
4861
- height: "40px",
4862
- visibility: "visible"
4863
- });
4864
-
4865
- if (scrollYRemaining < 40 && scrollYMax > 0) {
4866
- var scrollEnd = scrollY + 40;
4867
- startJavaScriptAnimation({
4868
- duration: 300,
4869
- onProgress: function onProgress(_ref3) {
4870
- var progress = _ref3.progress;
4871
- var value = scrollY + (scrollEnd - scrollY) * progress;
4872
- parentDocumentElement.scrollTop = value;
4873
- }
4874
- });
4875
- }
4876
-
4877
- hideToolbar = function hideToolbar() {
4878
- restoreToolbarIframeParentStyles();
4879
- restoreToolbarIframeStyles();
4880
- hideTooltip(document.querySelector("#eventsource-indicator"));
4881
- hideTooltip(document.querySelector("#execution-indicator"));
4882
- toolbarVisibilityPreference.set(false);
4883
-
4884
- if (animate) {
4885
- document.documentElement.setAttribute("data-toolbar-animation", "");
4886
- } else {
4887
- document.documentElement.removeAttribute("data-toolbar-animation");
4888
- }
4889
-
4890
- document.documentElement.removeAttribute("data-toolbar-visible");
4891
- sendEventToParent("toolbar-visibility-change", false);
4892
- };
4893
- };
4894
-
4895
- var getCompileGroup = function getCompileGroup(_ref4) {
4896
- var executedFileCompiledUrl = _ref4.executedFileCompiledUrl,
4897
- jsenvDirectoryRelativeUrl = _ref4.jsenvDirectoryRelativeUrl,
4898
- compileServerOrigin = _ref4.compileServerOrigin;
4899
- var jsenvDirectoryServerUrl = new URL(jsenvDirectoryRelativeUrl, compileServerOrigin).href;
4900
-
4901
- if (urlIsInsideOf(executedFileCompiledUrl, jsenvDirectoryServerUrl)) {
4902
- var afterCompileDirectory = urlToRelativeUrl(executedFileCompiledUrl, jsenvDirectoryServerUrl);
4903
- var slashIndex = afterCompileDirectory.indexOf("/");
4904
- var fileRelativeUrl = afterCompileDirectory.slice(slashIndex + 1);
4905
- return {
4906
- fileRelativeUrl: fileRelativeUrl,
4907
- compileId: afterCompileDirectory.slice(0, slashIndex)
4908
- };
4909
- }
4910
-
4911
- return {
4912
- fileRelativeUrl: new URL(executedFileCompiledUrl).pathname.slice(1),
4913
- compileId: null
4914
- };
4915
- };
4916
-
4917
- var addExternalCommandCallback = function addExternalCommandCallback(command, callback) {
4918
- var messageEventCallback = function messageEventCallback(messageEvent) {
4919
- var data = messageEvent.data;
4920
-
4921
- if (_typeof(data) !== "object") {
4922
- return;
4923
- }
4924
-
4925
- var __jsenv__ = data.__jsenv__;
4926
-
4927
- if (!__jsenv__) {
4928
- return;
4929
- }
4930
-
4931
- if (__jsenv__.command !== command) {
4932
- return;
4933
- }
4934
-
4935
- callback.apply(void 0, _toConsumableArray(__jsenv__.args));
4936
- };
4937
-
4938
- window.addEventListener("message", messageEventCallback);
4939
- return function () {
4940
- window.removeEventListener("message", messageEventCallback);
4941
- };
4942
- };
4943
-
4944
- var sendEventToParent = function sendEventToParent(name, data) {
4945
- window.parent.postMessage({
4946
- __jsenv__: {
4947
- event: name,
4948
- data: data
4949
- }
4950
- }, "*");
4951
- };
4952
-
4953
- window.toolbar = {
4954
- show: showToolbar,
4955
- hide: function hide() {
4956
- return hideToolbar();
4957
- }
4958
- };
4959
- addExternalCommandCallback("renderToolbar", function (data) {
4960
- renderToolbar(data);
4961
- });
4962
- addExternalCommandCallback("showToolbar", function () {
4963
- showToolbar();
4964
- });
4965
- addExternalCommandCallback("hideToolbar", function () {
4966
- hideToolbar();
4967
- });
4968
- sendEventToParent("toolbar_ready");
4969
- }
4970
- };
4971
- });
4972
-
4973
- //# sourceMappingURL=toolbar_main_f54c1bb0.js.map</script>
4974
-
4975
-
4976
- </body></html>