@jsenv/core 24.1.0-alpha.0 → 24.3.1

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 (180) hide show
  1. package/{license → LICENSE} +0 -0
  2. package/dist/browser_runtime/browser_runtime-fbd309a1.js +5137 -0
  3. package/dist/browser_runtime/browser_runtime-fbd309a1.js.map +1064 -0
  4. package/dist/{jsenv_browser_system.js → browser_system/browser_system-29eda202.js} +12 -12
  5. package/dist/{jsenv_browser_system.js.map → browser_system/browser_system-29eda202.js.map} +64 -64
  6. package/dist/build_manifest.js +12 -0
  7. package/dist/compile_proxy/assets/s.js-749702e8.map +242 -0
  8. package/dist/compile_proxy/compile_proxy-405777e6.html +2074 -0
  9. package/dist/compile_proxy/compile_proxy.html__inline__20-39c0801c.js.map +385 -0
  10. package/dist/event_source_client/event_source_client-9f14c8b9.js +356 -0
  11. package/dist/event_source_client/event_source_client-9f14c8b9.js.map +127 -0
  12. package/dist/redirector/assets/s.js-749702e8.map +242 -0
  13. package/dist/redirector/redirector-237cd168.html +2118 -0
  14. package/dist/redirector/redirector.html__inline__15-33acb0b9.js.map +390 -0
  15. package/dist/toolbar/assets/compilation.css-209d68b4.map +12 -0
  16. package/dist/toolbar/assets/eventsource.css-38cd0a36.map +12 -0
  17. package/dist/toolbar/assets/execution.css-0ebe522f.map +12 -0
  18. package/dist/toolbar/assets/focus.css-3f9c156d.map +12 -0
  19. package/dist/toolbar/assets/light-theme.css-78b19a80.map +12 -0
  20. package/dist/toolbar/assets/overflow-menu.css-d9688a1c.map +12 -0
  21. package/dist/toolbar/assets/s.js-749702e8.map +242 -0
  22. package/dist/toolbar/assets/settings.css-2b81b245.map +12 -0
  23. package/dist/toolbar/assets/toolbar.main.css-846920e9.map +28 -0
  24. package/dist/toolbar/assets/tooltip.css-03395ee6.map +12 -0
  25. package/dist/toolbar/toolbar-d3d98c2e.html +4778 -0
  26. package/dist/toolbar/toolbar.main-cab36c15.js.map +795 -0
  27. package/dist/toolbar_injector/assets/jsenv-logo-188b9ca6.svg +95 -0
  28. package/dist/{jsenv_toolbar_injector.js → toolbar_injector/toolbar_injector-01f71ce3.js} +62 -137
  29. package/dist/toolbar_injector/toolbar_injector-01f71ce3.js.map +294 -0
  30. package/main.js +0 -1
  31. package/package.json +4 -2
  32. package/readme.md +10 -7
  33. package/src/buildProject.js +8 -2
  34. package/src/dev_server.js +45 -102
  35. package/src/importUsingChildProcess.js +1 -1
  36. package/src/internal/{runtime/detectBrowser/detectBrowser.js → browser_detection/browser_detection.js} +0 -0
  37. package/src/internal/{runtime/detectBrowser → browser_detection}/detectAndroid.js +0 -0
  38. package/src/internal/{runtime/detectBrowser → browser_detection}/detectChrome.js +0 -0
  39. package/src/internal/{runtime/detectBrowser → browser_detection}/detectEdge.js +0 -0
  40. package/src/internal/{runtime/detectBrowser → browser_detection}/detectElectron.js +0 -0
  41. package/src/internal/{runtime/detectBrowser → browser_detection}/detectFirefox.js +0 -0
  42. package/src/internal/{runtime/detectBrowser → browser_detection}/detectIOS.js +0 -0
  43. package/src/internal/{runtime/detectBrowser → browser_detection}/detectInternetExplorer.js +0 -0
  44. package/src/internal/{runtime/detectBrowser → browser_detection}/detectOpera.js +0 -0
  45. package/src/internal/{runtime/detectBrowser → browser_detection}/detectSafari.js +0 -0
  46. package/src/internal/{runtime/detectBrowser → browser_detection}/util.js +0 -0
  47. package/src/internal/{runtime/createBrowserRuntime/scanBrowserRuntimeFeatures.js → browser_feature_detection/browser_feature_detection.js} +116 -81
  48. package/src/internal/browser_feature_detection/compile_proxy.html +27 -0
  49. package/src/internal/{browser-launcher → browser_launcher}/createSharing.js +0 -0
  50. package/src/internal/{browser-launcher → browser_launcher}/executeHtmlFile.js +7 -4
  51. package/src/internal/{browser-launcher → browser_launcher}/trackPageToNotify.js +0 -0
  52. package/src/internal/{browser-launcher/jsenv-browser-system.js → browser_runtime/browser_runtime.js} +4 -4
  53. package/src/internal/{runtime/createBrowserRuntime/createBrowserSystem.js → browser_runtime/browser_system.js} +3 -2
  54. package/src/internal/{runtime/createBrowserRuntime → browser_runtime}/createBrowserRuntime.js +7 -5
  55. package/src/internal/{browser-launcher → browser_runtime}/displayErrorInDocument.js +0 -0
  56. package/src/internal/{browser-launcher → browser_runtime}/displayErrorNotification.js +2 -4
  57. package/src/internal/{runtime/createBrowserRuntime → browser_runtime}/evalSource.js +2 -0
  58. package/src/internal/{runtime/createBrowserRuntime → browser_runtime}/makeNamespaceTransferable.js +0 -0
  59. package/src/internal/{browser-utils → browser_utils}/fetch-browser.js +2 -0
  60. package/src/internal/{browser-utils → browser_utils}/fetchAndEvalUsingFetch.js +3 -0
  61. package/src/internal/{browser-utils → browser_utils}/fetchAndEvalUsingScript.js +2 -0
  62. package/src/internal/{browser-utils → browser_utils}/fetchJson.js +0 -0
  63. package/src/internal/{browser-utils → browser_utils}/fetchUsingXHR.js +4 -4
  64. package/src/internal/building/buildUsingRollup.js +4 -0
  65. package/src/internal/building/createJsenvRollupPlugin.js +19 -9
  66. package/src/internal/building/css/applyPostCss.js +19 -8
  67. package/src/internal/building/css/moveCssUrls.js +44 -0
  68. package/src/internal/building/css/parseCssRessource.js +67 -17
  69. package/src/internal/building/css/parseCssUrls.js +29 -23
  70. package/src/internal/building/css/postcss_plugin_url_visitor.js +11 -20
  71. package/src/internal/building/css/replaceCssUrls.js +38 -19
  72. package/src/internal/building/css_module.js +6 -10
  73. package/src/internal/building/html/parseHtmlRessource.js +37 -11
  74. package/src/internal/building/parseRessource.js +3 -0
  75. package/src/internal/building/ressource_builder.js +12 -3
  76. package/src/internal/compiling/babel_plugin_import_assertions.js +1 -2
  77. package/src/internal/compiling/compile-directory/validateCache.js +0 -5
  78. package/src/internal/compiling/compileFile.js +17 -54
  79. package/src/internal/compiling/createCompiledFileService.js +2 -0
  80. package/src/internal/compiling/html_source_file_service.js +49 -13
  81. package/src/internal/compiling/jsenvCompilerForHtml.js +29 -12
  82. package/src/internal/compiling/startCompileServer.js +39 -33
  83. package/src/internal/dev_server/event_source_client/event_source_client.js +63 -0
  84. package/src/internal/{toolbar/eventsource/connectEventSource.js → dev_server/event_source_client/event_source_connection.js} +66 -88
  85. package/src/internal/dev_server/event_source_client/file_changes.js +82 -0
  86. package/src/internal/dev_server/event_source_client/livereload_preference.js +13 -0
  87. package/src/internal/{exploring → dev_server/exploring}/exploring.css +0 -0
  88. package/src/internal/{exploring → dev_server/exploring}/exploring.html +8 -3
  89. package/src/internal/{exploring → dev_server/exploring}/exploring.js +0 -0
  90. package/src/internal/{exploring → dev_server/exploring}/fetchExploringJson.js +4 -9
  91. package/src/internal/dev_server/redirector/redirector.html +48 -0
  92. package/src/internal/{toolbar → dev_server/toolbar}/animation/toolbar.animation.js +0 -0
  93. package/src/internal/{toolbar → dev_server/toolbar}/compilation/compilation.css +0 -0
  94. package/src/internal/{toolbar → dev_server/toolbar}/compilation/toolbar.compilation.js +4 -7
  95. package/src/internal/{toolbar → dev_server/toolbar}/eventsource/eventsource.css +0 -0
  96. package/src/internal/dev_server/toolbar/eventsource/toolbar.eventsource.js +83 -0
  97. package/src/internal/{toolbar → dev_server/toolbar}/execution/execution.css +0 -0
  98. package/src/internal/{toolbar → dev_server/toolbar}/execution/toolbar.execution.js +0 -0
  99. package/src/internal/{toolbar → dev_server/toolbar}/focus/focus.css +0 -0
  100. package/src/internal/{toolbar → dev_server/toolbar}/focus/toolbar.focus.js +0 -0
  101. package/src/internal/{toolbar → dev_server/toolbar}/jsenv-logo.svg +0 -0
  102. package/src/internal/dev_server/toolbar/notification/toolbar.notification.js +152 -0
  103. package/src/internal/{toolbar → dev_server/toolbar}/responsive/overflow-menu.css +0 -0
  104. package/src/internal/{toolbar → dev_server/toolbar}/responsive/toolbar.responsive.js +0 -0
  105. package/src/internal/{toolbar → dev_server/toolbar}/settings/settings.css +0 -0
  106. package/src/internal/{toolbar → dev_server/toolbar}/settings/toolbar.settings.js +0 -0
  107. package/src/internal/{toolbar → dev_server/toolbar}/theme/jsenv-theme.css +0 -0
  108. package/src/internal/{toolbar → dev_server/toolbar}/theme/light-theme.css +0 -0
  109. package/src/internal/{toolbar → dev_server/toolbar}/theme/toolbar.theme.js +0 -0
  110. package/src/internal/{toolbar → dev_server/toolbar}/toolbar.html +35 -42
  111. package/src/internal/{toolbar → dev_server/toolbar}/toolbar.injector.js +53 -125
  112. package/src/internal/{toolbar → dev_server/toolbar}/toolbar.main.css +0 -0
  113. package/src/internal/{toolbar → dev_server/toolbar}/toolbar.main.js +44 -31
  114. package/src/internal/{toolbar → dev_server/toolbar}/tooltip/tooltip.css +0 -0
  115. package/src/internal/{toolbar → dev_server/toolbar}/tooltip/tooltip.js +0 -0
  116. package/src/internal/{toolbar → dev_server/toolbar}/util/animation.js +0 -0
  117. package/src/internal/{toolbar → dev_server/toolbar}/util/dom.js +0 -0
  118. package/src/internal/{toolbar → dev_server/toolbar}/util/fetching.js +2 -2
  119. package/src/internal/{toolbar → dev_server/toolbar}/util/jsenvLogger.js +0 -0
  120. package/src/internal/{toolbar → dev_server/toolbar}/util/preferences.js +0 -0
  121. package/src/internal/{toolbar → dev_server/toolbar}/util/responsive.js +0 -0
  122. package/src/internal/{toolbar → dev_server/toolbar}/util/util.js +0 -0
  123. package/src/internal/{toolbar → dev_server/toolbar}/variant/variant.js +0 -0
  124. package/src/internal/generateGroupMap/one_runtime_compat.js +1 -1
  125. package/src/internal/generateGroupMap/runtime_compat_composition.js +1 -1
  126. package/src/internal/generateGroupMap/runtime_support.js +1 -1
  127. package/src/internal/jsenvInternalFiles.js +0 -84
  128. package/src/internal/jsenv_builds.js +19 -0
  129. package/src/internal/{runtime/node-feature-detect/feature-detect-dynamic-import.mjs → node_feature_detection/feature_detect_dynamic_import.mjs} +0 -0
  130. package/src/internal/{runtime/node-feature-detect/feature-detect-top-level-await.mjs → node_feature_detection/feature_detect_top_level_await.mjs} +0 -0
  131. package/src/internal/{runtime/node-feature-detect → node_feature_detection}/nodeSupportsDynamicImport.js +0 -0
  132. package/src/internal/node_feature_detection/nodeSupportsTopLevelAwait.js +16 -0
  133. package/src/internal/{runtime/createNodeRuntime/scanNodeRuntimeFeatures.js → node_feature_detection/node_feature_detection.js} +12 -13
  134. package/src/internal/{node-launcher → node_launcher}/createChildProcessOptions.js +0 -0
  135. package/src/internal/{node-launcher → node_launcher}/createControllableNodeProcess.js +9 -14
  136. package/src/internal/{node-launcher → node_launcher}/kill_process_tree.js +0 -0
  137. package/src/internal/{node-launcher → node_launcher}/processOptions.js +0 -0
  138. package/src/internal/{runtime/detectNode → node_runtime}/detectNode.js +0 -0
  139. package/src/internal/{runtime/createNodeRuntime → node_runtime}/evalSource.js +1 -1
  140. package/src/internal/{runtime/createNodeRuntime → node_runtime}/fetchSource.js +1 -1
  141. package/src/internal/{node-launcher → node_runtime}/nodeControllableFile.mjs +14 -11
  142. package/src/internal/{runtime/createNodeRuntime/createNodeExecutionWithDynamicImport.js → node_runtime/node_execution_dynamic_import.js} +34 -6
  143. package/src/internal/node_runtime/node_execution_performance.js +67 -0
  144. package/src/internal/{runtime/createNodeRuntime/createNodeExecutionWithSystemJs.js → node_runtime/node_execution_systemjs.js} +38 -24
  145. package/src/internal/{runtime/createNodeRuntime/createNodeSystem.js → node_runtime/node_system.js} +4 -4
  146. package/src/internal/runtime/computeCompileIdFromGroupId.js +1 -0
  147. package/src/internal/runtime/resolveGroup.js +1 -1
  148. package/src/internal/runtime/resolveRuntimeGroup.js +2 -2
  149. package/src/internal/{semantic-versioning → semantic_versioning}/findHighestVersion.js +0 -0
  150. package/src/internal/{semantic-versioning → semantic_versioning}/findLowestVersion.js +0 -0
  151. package/src/internal/{semantic-versioning → semantic_versioning}/index.js +0 -0
  152. package/src/internal/{semantic-versioning → semantic_versioning}/valueToVersion.js +0 -0
  153. package/src/internal/{semantic-versioning → semantic_versioning}/versionCompare.js +0 -0
  154. package/src/internal/{semantic-versioning → semantic_versioning}/versionIsAbove.js +0 -0
  155. package/src/internal/{semantic-versioning → semantic_versioning}/versionIsBelow.js +0 -0
  156. package/src/internal/{semantic-versioning → semantic_versioning}/versionIsEqual.js +0 -0
  157. package/src/launchBrowser.js +3 -3
  158. package/src/launchNode.js +33 -7
  159. package/src/requireUsingChildProcess.js +1 -1
  160. package/dist/jsenv_compile_proxy.js +0 -1339
  161. package/dist/jsenv_compile_proxy.js.map +0 -378
  162. package/dist/jsenv_exploring_index.js +0 -1092
  163. package/dist/jsenv_exploring_index.js.map +0 -353
  164. package/dist/jsenv_exploring_redirector.js +0 -1386
  165. package/dist/jsenv_exploring_redirector.js.map +0 -384
  166. package/dist/jsenv_toolbar.js +0 -3347
  167. package/dist/jsenv_toolbar.js.map +0 -846
  168. package/dist/jsenv_toolbar_injector.js.map +0 -320
  169. package/src/internal/browser-launcher/jsenv_compile_proxy.html +0 -13
  170. package/src/internal/browser-launcher/jsenv_compile_proxy.js +0 -5
  171. package/src/internal/exploring/exploring.redirector.html +0 -13
  172. package/src/internal/exploring/exploring.redirector.js +0 -28
  173. package/src/internal/node-launcher/node-js-file.js +0 -110
  174. package/src/internal/runtime/createNodeRuntime/createNodeRuntime.js +0 -32
  175. package/src/internal/runtime/node-feature-detect/nodeSupportsTopLevelAwait.js +0 -18
  176. package/src/internal/toolbar/backtolist/toolbar.backtolist.js +0 -33
  177. package/src/internal/toolbar/eventsource/connectCompileServerEventSource.js +0 -74
  178. package/src/internal/toolbar/eventsource/toolbar.eventsource.js +0 -239
  179. package/src/internal/toolbar/notification/toolbar.notification.js +0 -121
  180. package/src/nodeRuntime.js +0 -5
@@ -0,0 +1,2118 @@
1
+ <!DOCTYPE html><html><head>
2
+ <title>Jsenv redirector</title>
3
+ <meta name="viewport" content="width=device-width, initial-scale=1">
4
+ <meta charset="utf-8">
5
+ <link rel="icon" href="data:,">
6
+ <script id="jsenv_inject_systemjs">/*
7
+ * SJS 6.11.0
8
+ * Minimal SystemJS Build
9
+ */
10
+ (function () {
11
+ function errMsg(errCode, msg) {
12
+ return (msg || "") + " (SystemJS https://git.io/JvFET#" + errCode + ")";
13
+ }
14
+
15
+ var hasSymbol = typeof Symbol !== 'undefined';
16
+ var hasSelf = typeof self !== 'undefined';
17
+ var hasDocument = typeof document !== 'undefined';
18
+ var envGlobal = hasSelf ? self : global;
19
+ var baseUrl;
20
+
21
+ if (hasDocument) {
22
+ var baseEl = document.querySelector('base[href]');
23
+ if (baseEl) baseUrl = baseEl.href;
24
+ }
25
+
26
+ if (!baseUrl && typeof location !== 'undefined') {
27
+ baseUrl = location.href.split('#')[0].split('?')[0];
28
+ var lastSepIndex = baseUrl.lastIndexOf('/');
29
+ if (lastSepIndex !== -1) baseUrl = baseUrl.slice(0, lastSepIndex + 1);
30
+ }
31
+
32
+ var backslashRegEx = /\\/g;
33
+
34
+ function resolveIfNotPlainOrUrl(relUrl, parentUrl) {
35
+ if (relUrl.indexOf('\\') !== -1) relUrl = relUrl.replace(backslashRegEx, '/'); // protocol-relative
36
+
37
+ if (relUrl[0] === '/' && relUrl[1] === '/') {
38
+ return parentUrl.slice(0, parentUrl.indexOf(':') + 1) + relUrl;
39
+ } // relative-url
40
+ else if (relUrl[0] === '.' && (relUrl[1] === '/' || relUrl[1] === '.' && (relUrl[2] === '/' || relUrl.length === 2 && (relUrl += '/')) || relUrl.length === 1 && (relUrl += '/')) || relUrl[0] === '/') {
41
+ var parentProtocol = parentUrl.slice(0, parentUrl.indexOf(':') + 1); // Disabled, but these cases will give inconsistent results for deep backtracking
42
+ //if (parentUrl[parentProtocol.length] !== '/')
43
+ // throw Error('Cannot resolve');
44
+ // read pathname from parent URL
45
+ // pathname taken to be part after leading "/"
46
+
47
+ var pathname;
48
+
49
+ if (parentUrl[parentProtocol.length + 1] === '/') {
50
+ // resolving to a :// so we need to read out the auth and host
51
+ if (parentProtocol !== 'file:') {
52
+ pathname = parentUrl.slice(parentProtocol.length + 2);
53
+ pathname = pathname.slice(pathname.indexOf('/') + 1);
54
+ } else {
55
+ pathname = parentUrl.slice(8);
56
+ }
57
+ } else {
58
+ // resolving to :/ so pathname is the /... part
59
+ pathname = parentUrl.slice(parentProtocol.length + (parentUrl[parentProtocol.length] === '/'));
60
+ }
61
+
62
+ if (relUrl[0] === '/') return parentUrl.slice(0, parentUrl.length - pathname.length - 1) + relUrl; // join together and split for removal of .. and . segments
63
+ // looping the string instead of anything fancy for perf reasons
64
+ // '../../../../../z' resolved to 'x/y' is just 'z'
65
+
66
+ var segmented = pathname.slice(0, pathname.lastIndexOf('/') + 1) + relUrl;
67
+ var output = [];
68
+ var segmentIndex = -1;
69
+
70
+ for (var i = 0; i < segmented.length; i++) {
71
+ // busy reading a segment - only terminate on '/'
72
+ if (segmentIndex !== -1) {
73
+ if (segmented[i] === '/') {
74
+ output.push(segmented.slice(segmentIndex, i + 1));
75
+ segmentIndex = -1;
76
+ }
77
+ } // new segment - check if it is relative
78
+ else if (segmented[i] === '.') {
79
+ // ../ segment
80
+ if (segmented[i + 1] === '.' && (segmented[i + 2] === '/' || i + 2 === segmented.length)) {
81
+ output.pop();
82
+ i += 2;
83
+ } // ./ segment
84
+ else if (segmented[i + 1] === '/' || i + 1 === segmented.length) {
85
+ i += 1;
86
+ } else {
87
+ // the start of a new segment as below
88
+ segmentIndex = i;
89
+ }
90
+ } // it is the start of a new segment
91
+ else {
92
+ segmentIndex = i;
93
+ }
94
+ } // finish reading out the last segment
95
+
96
+
97
+ if (segmentIndex !== -1) output.push(segmented.slice(segmentIndex));
98
+ return parentUrl.slice(0, parentUrl.length - pathname.length) + output.join('');
99
+ }
100
+ }
101
+ /*
102
+ * Import maps implementation
103
+ *
104
+ * To make lookups fast we pre-resolve the entire import map
105
+ * and then match based on backtracked hash lookups
106
+ *
107
+ */
108
+
109
+
110
+ function resolveUrl(relUrl, parentUrl) {
111
+ return resolveIfNotPlainOrUrl(relUrl, parentUrl) || (relUrl.indexOf(':') !== -1 ? relUrl : resolveIfNotPlainOrUrl('./' + relUrl, parentUrl));
112
+ }
113
+
114
+ function resolveAndComposePackages(packages, outPackages, baseUrl, parentMap, parentUrl) {
115
+ for (var p in packages) {
116
+ var resolvedLhs = resolveIfNotPlainOrUrl(p, baseUrl) || p;
117
+ var rhs = packages[p]; // package fallbacks not currently supported
118
+
119
+ if (typeof rhs !== 'string') continue;
120
+ var mapped = resolveImportMap(parentMap, resolveIfNotPlainOrUrl(rhs, baseUrl) || rhs, parentUrl);
121
+
122
+ if (!mapped) {
123
+ targetWarning('W1', p, rhs);
124
+ } else outPackages[resolvedLhs] = mapped;
125
+ }
126
+ }
127
+
128
+ function resolveAndComposeImportMap(json, baseUrl, outMap) {
129
+ if (json.imports) resolveAndComposePackages(json.imports, outMap.imports, baseUrl, outMap, null);
130
+ var u;
131
+
132
+ for (u in json.scopes || {}) {
133
+ var resolvedScope = resolveUrl(u, baseUrl);
134
+ resolveAndComposePackages(json.scopes[u], outMap.scopes[resolvedScope] || (outMap.scopes[resolvedScope] = {}), baseUrl, outMap, resolvedScope);
135
+ }
136
+
137
+ for (u in json.depcache || {}) outMap.depcache[resolveUrl(u, baseUrl)] = json.depcache[u];
138
+
139
+ for (u in json.integrity || {}) outMap.integrity[resolveUrl(u, baseUrl)] = json.integrity[u];
140
+ }
141
+
142
+ function getMatch(path, matchObj) {
143
+ if (matchObj[path]) return path;
144
+ var sepIndex = path.length;
145
+
146
+ do {
147
+ var segment = path.slice(0, sepIndex + 1);
148
+ if (segment in matchObj) return segment;
149
+ } while ((sepIndex = path.lastIndexOf('/', sepIndex - 1)) !== -1);
150
+ }
151
+
152
+ function applyPackages(id, packages) {
153
+ var pkgName = getMatch(id, packages);
154
+
155
+ if (pkgName) {
156
+ var pkg = packages[pkgName];
157
+ if (pkg === null) return;
158
+
159
+ if (id.length > pkgName.length && pkg[pkg.length - 1] !== '/') {
160
+ targetWarning('W2', pkgName, pkg);
161
+ } else return pkg + id.slice(pkgName.length);
162
+ }
163
+ }
164
+
165
+ function targetWarning(code, match, target, msg) {
166
+ console.warn(errMsg(code, [target, match].join(', ')));
167
+ }
168
+
169
+ function resolveImportMap(importMap, resolvedOrPlain, parentUrl) {
170
+ var scopes = importMap.scopes;
171
+ var scopeUrl = parentUrl && getMatch(parentUrl, scopes);
172
+
173
+ while (scopeUrl) {
174
+ var packageResolution = applyPackages(resolvedOrPlain, scopes[scopeUrl]);
175
+ if (packageResolution) return packageResolution;
176
+ scopeUrl = getMatch(scopeUrl.slice(0, scopeUrl.lastIndexOf('/')), scopes);
177
+ }
178
+
179
+ return applyPackages(resolvedOrPlain, importMap.imports) || resolvedOrPlain.indexOf(':') !== -1 && resolvedOrPlain;
180
+ }
181
+ /*
182
+ * SystemJS Core
183
+ *
184
+ * Provides
185
+ * - System.import
186
+ * - System.register support for
187
+ * live bindings, function hoisting through circular references,
188
+ * reexports, dynamic import, import.meta.url, top-level await
189
+ * - System.getRegister to get the registration
190
+ * - Symbol.toStringTag support in Module objects
191
+ * - Hookable System.createContext to customize import.meta
192
+ * - System.onload(err, id, deps) handler for tracing / hot-reloading
193
+ *
194
+ * Core comes with no System.prototype.resolve or
195
+ * System.prototype.instantiate implementations
196
+ */
197
+
198
+
199
+ var toStringTag = hasSymbol && Symbol.toStringTag;
200
+ var REGISTRY = hasSymbol ? Symbol() : '@';
201
+
202
+ function SystemJS() {
203
+ this[REGISTRY] = {};
204
+ }
205
+
206
+ var systemJSPrototype = SystemJS.prototype;
207
+
208
+ systemJSPrototype.import = function (id, parentUrl) {
209
+ var loader = this;
210
+ return Promise.resolve(loader.prepareImport()).then(function () {
211
+ return loader.resolve(id, parentUrl);
212
+ }).then(function (id) {
213
+ var load = getOrCreateLoad(loader, id);
214
+ return load.C || topLevelLoad(loader, load);
215
+ });
216
+ }; // Hookable createContext function -> allowing eg custom import meta
217
+
218
+
219
+ systemJSPrototype.createContext = function (parentId) {
220
+ var loader = this;
221
+ return {
222
+ url: parentId,
223
+ resolve: function (id, parentUrl) {
224
+ return Promise.resolve(loader.resolve(id, parentUrl || parentId));
225
+ }
226
+ };
227
+ };
228
+
229
+ function loadToId(load) {
230
+ return load.id;
231
+ }
232
+
233
+ function triggerOnload(loader, load, err, isErrSource) {
234
+ loader.onload(err, load.id, load.d && load.d.map(loadToId), !!isErrSource);
235
+ if (err) throw err;
236
+ }
237
+
238
+ var lastRegister;
239
+
240
+ systemJSPrototype.register = function (deps, declare) {
241
+ lastRegister = [deps, declare];
242
+ };
243
+ /*
244
+ * getRegister provides the last anonymous System.register call
245
+ */
246
+
247
+
248
+ systemJSPrototype.getRegister = function () {
249
+ var _lastRegister = lastRegister;
250
+ lastRegister = undefined;
251
+ return _lastRegister;
252
+ };
253
+
254
+ function getOrCreateLoad(loader, id, firstParentUrl) {
255
+ var load = loader[REGISTRY][id];
256
+ if (load) return load;
257
+ var importerSetters = [];
258
+ var ns = Object.create(null);
259
+ if (toStringTag) Object.defineProperty(ns, toStringTag, {
260
+ value: 'Module'
261
+ });
262
+ var instantiatePromise = Promise.resolve().then(function () {
263
+ return loader.instantiate(id, firstParentUrl);
264
+ }).then(function (registration) {
265
+ if (!registration) throw Error(errMsg(2, id));
266
+
267
+ function _export(name, value) {
268
+ // note if we have hoisted exports (including reexports)
269
+ load.h = true;
270
+ var changed = false;
271
+
272
+ if (typeof name === 'string') {
273
+ if (!(name in ns) || ns[name] !== value) {
274
+ ns[name] = value;
275
+ changed = true;
276
+ }
277
+ } else {
278
+ for (var p in name) {
279
+ var value = name[p];
280
+
281
+ if (!(p in ns) || ns[p] !== value) {
282
+ ns[p] = value;
283
+ changed = true;
284
+ }
285
+ }
286
+
287
+ if (name && name.__esModule) {
288
+ ns.__esModule = name.__esModule;
289
+ }
290
+ }
291
+
292
+ if (changed) for (var i = 0; i < importerSetters.length; i++) {
293
+ var setter = importerSetters[i];
294
+ if (setter) setter(ns);
295
+ }
296
+ return value;
297
+ }
298
+
299
+ var declared = registration[1](_export, registration[1].length === 2 ? {
300
+ import: function (importId) {
301
+ return loader.import(importId, id);
302
+ },
303
+ meta: loader.createContext(id)
304
+ } : undefined);
305
+
306
+ load.e = declared.execute || function () {};
307
+
308
+ return [registration[0], declared.setters || []];
309
+ }, function (err) {
310
+ load.e = null;
311
+ load.er = err;
312
+ throw err;
313
+ });
314
+ var linkPromise = instantiatePromise.then(function (instantiation) {
315
+ return Promise.all(instantiation[0].map(function (dep, i) {
316
+ var setter = instantiation[1][i];
317
+ return Promise.resolve(loader.resolve(dep, id)).then(function (depId) {
318
+ var depLoad = getOrCreateLoad(loader, depId, id); // depLoad.I may be undefined for already-evaluated
319
+
320
+ return Promise.resolve(depLoad.I).then(function () {
321
+ if (setter) {
322
+ depLoad.i.push(setter); // only run early setters when there are hoisted exports of that module
323
+ // the timing works here as pending hoisted export calls will trigger through importerSetters
324
+
325
+ if (depLoad.h || !depLoad.I) setter(depLoad.n);
326
+ }
327
+
328
+ return depLoad;
329
+ });
330
+ });
331
+ })).then(function (depLoads) {
332
+ load.d = depLoads;
333
+ });
334
+ }); // Capital letter = a promise function
335
+
336
+ return load = loader[REGISTRY][id] = {
337
+ id: id,
338
+ // importerSetters, the setters functions registered to this dependency
339
+ // we retain this to add more later
340
+ i: importerSetters,
341
+ // module namespace object
342
+ n: ns,
343
+ // instantiate
344
+ I: instantiatePromise,
345
+ // link
346
+ L: linkPromise,
347
+ // whether it has hoisted exports
348
+ h: false,
349
+ // On instantiate completion we have populated:
350
+ // dependency load records
351
+ d: undefined,
352
+ // execution function
353
+ e: undefined,
354
+ // On execution we have populated:
355
+ // the execution error if any
356
+ er: undefined,
357
+ // in the case of TLA, the execution promise
358
+ E: undefined,
359
+ // On execution, L, I, E cleared
360
+ // Promise for top-level completion
361
+ C: undefined,
362
+ // parent instantiator / executor
363
+ p: undefined
364
+ };
365
+ }
366
+
367
+ function instantiateAll(loader, load, parent, loaded) {
368
+ if (!loaded[load.id]) {
369
+ loaded[load.id] = true; // load.L may be undefined for already-instantiated
370
+
371
+ return Promise.resolve(load.L).then(function () {
372
+ if (!load.p || load.p.e === null) load.p = parent;
373
+ return Promise.all(load.d.map(function (dep) {
374
+ return instantiateAll(loader, dep, parent, loaded);
375
+ }));
376
+ }).catch(function (err) {
377
+ if (load.er) throw err;
378
+ load.e = null;
379
+ throw err;
380
+ });
381
+ }
382
+ }
383
+
384
+ function topLevelLoad(loader, load) {
385
+ return load.C = instantiateAll(loader, load, load, {}).then(function () {
386
+ return postOrderExec(loader, load, {});
387
+ }).then(function () {
388
+ return load.n;
389
+ });
390
+ } // the closest we can get to call(undefined)
391
+
392
+
393
+ var nullContext = Object.freeze(Object.create(null)); // returns a promise if and only if a top-level await subgraph
394
+ // throws on sync errors
395
+
396
+ function postOrderExec(loader, load, seen) {
397
+ if (seen[load.id]) return;
398
+ seen[load.id] = true;
399
+
400
+ if (!load.e) {
401
+ if (load.er) throw load.er;
402
+ if (load.E) return load.E;
403
+ return;
404
+ } // deps execute first, unless circular
405
+
406
+
407
+ var depLoadPromises;
408
+ load.d.forEach(function (depLoad) {
409
+ try {
410
+ var depLoadPromise = postOrderExec(loader, depLoad, seen);
411
+ if (depLoadPromise) (depLoadPromises = depLoadPromises || []).push(depLoadPromise);
412
+ } catch (err) {
413
+ load.e = null;
414
+ load.er = err;
415
+ throw err;
416
+ }
417
+ });
418
+ if (depLoadPromises) return Promise.all(depLoadPromises).then(doExec);
419
+ return doExec();
420
+
421
+ function doExec() {
422
+ try {
423
+ var execPromise = load.e.call(nullContext);
424
+
425
+ if (execPromise) {
426
+ execPromise = execPromise.then(function () {
427
+ load.C = load.n;
428
+ load.E = null; // indicates completion
429
+
430
+ if (!true) ;
431
+ }, function (err) {
432
+ load.er = err;
433
+ load.E = null;
434
+ if (!true) ;
435
+ throw err;
436
+ });
437
+ return load.E = execPromise;
438
+ } // (should be a promise, but a minify optimization to leave out Promise.resolve)
439
+
440
+
441
+ load.C = load.n;
442
+ load.L = load.I = undefined;
443
+ } catch (err) {
444
+ load.er = err;
445
+ throw err;
446
+ } finally {
447
+ load.e = null;
448
+ }
449
+ }
450
+ }
451
+
452
+ envGlobal.System = new SystemJS();
453
+ /*
454
+ * SystemJS browser attachments for script and import map processing
455
+ */
456
+
457
+ var importMapPromise = Promise.resolve();
458
+ var importMap = {
459
+ imports: {},
460
+ scopes: {},
461
+ depcache: {},
462
+ integrity: {}
463
+ }; // Scripts are processed immediately, on the first System.import, and on DOMReady.
464
+ // Import map scripts are processed only once (by being marked) and in order for each phase.
465
+ // This is to avoid using DOM mutation observers in core, although that would be an alternative.
466
+
467
+ var processFirst = hasDocument;
468
+
469
+ systemJSPrototype.prepareImport = function (doProcessScripts) {
470
+ if (processFirst || doProcessScripts) {
471
+ processScripts();
472
+ processFirst = false;
473
+ }
474
+
475
+ return importMapPromise;
476
+ };
477
+
478
+ if (hasDocument) {
479
+ processScripts();
480
+ window.addEventListener('DOMContentLoaded', processScripts);
481
+ }
482
+
483
+ function processScripts() {
484
+ [].forEach.call(document.querySelectorAll('script'), function (script) {
485
+ if (script.sp) // sp marker = systemjs processed
486
+ return; // TODO: deprecate systemjs-module in next major now that we have auto import
487
+
488
+ if (script.type === 'systemjs-module') {
489
+ script.sp = true;
490
+ if (!script.src) return;
491
+ System.import(script.src.slice(0, 7) === 'import:' ? script.src.slice(7) : resolveUrl(script.src, baseUrl)).catch(function (e) {
492
+ // if there is a script load error, dispatch an "error" event
493
+ // on the script tag.
494
+ if (e.message.indexOf('https://git.io/JvFET#3') > -1) {
495
+ var event = document.createEvent('Event');
496
+ event.initEvent('error', false, false);
497
+ script.dispatchEvent(event);
498
+ }
499
+
500
+ return Promise.reject(e);
501
+ });
502
+ } else if (script.type === 'systemjs-importmap') {
503
+ script.sp = true;
504
+ var fetchPromise = script.src ? fetch(script.src, {
505
+ integrity: script.integrity
506
+ }).then(function (res) {
507
+ if (!res.ok) throw Error(res.status);
508
+ return res.text();
509
+ }).catch(function (err) {
510
+ err.message = errMsg('W4', script.src) + '\n' + err.message;
511
+ console.warn(err);
512
+
513
+ if (typeof script.onerror === 'function') {
514
+ script.onerror();
515
+ }
516
+
517
+ return '{}';
518
+ }) : script.innerHTML;
519
+ importMapPromise = importMapPromise.then(function () {
520
+ return fetchPromise;
521
+ }).then(function (text) {
522
+ extendImportMap(importMap, text, script.src || baseUrl);
523
+ });
524
+ }
525
+ });
526
+ }
527
+
528
+ function extendImportMap(importMap, newMapText, newMapUrl) {
529
+ var newMap = {};
530
+
531
+ try {
532
+ newMap = JSON.parse(newMapText);
533
+ } catch (err) {
534
+ console.warn(Error(errMsg('W5')));
535
+ }
536
+
537
+ resolveAndComposeImportMap(newMap, newMapUrl, importMap);
538
+ }
539
+ /*
540
+ * Script instantiation loading
541
+ */
542
+
543
+
544
+ if (hasDocument) {
545
+ window.addEventListener('error', function (evt) {
546
+ lastWindowErrorUrl = evt.filename;
547
+ lastWindowError = evt.error;
548
+ });
549
+ var baseOrigin = location.origin;
550
+ }
551
+
552
+ systemJSPrototype.createScript = function (url) {
553
+ var script = document.createElement('script');
554
+ script.async = true; // Only add cross origin for actual cross origin
555
+ // this is because Safari triggers for all
556
+ // - https://bugs.webkit.org/show_bug.cgi?id=171566
557
+
558
+ if (url.indexOf(baseOrigin + '/')) script.crossOrigin = 'anonymous';
559
+ var integrity = importMap.integrity[url];
560
+ if (integrity) script.integrity = integrity;
561
+ script.src = url;
562
+ return script;
563
+ }; // Auto imports -> script tags can be inlined directly for load phase
564
+
565
+
566
+ var lastAutoImportDeps, lastAutoImportTimeout;
567
+ var autoImportCandidates = {};
568
+ var systemRegister = systemJSPrototype.register;
569
+ var inlineScriptCount = 0;
570
+
571
+ systemJSPrototype.register = function (deps, declare) {
572
+ if (hasDocument && document.readyState === 'loading' && typeof deps !== 'string') {
573
+ var scripts = document.querySelectorAll('script[src]');
574
+ var lastScript = scripts[scripts.length - 1];
575
+ var lastAutoImportUrl;
576
+ lastAutoImportDeps = deps;
577
+
578
+ if (lastScript) {
579
+ lastAutoImportUrl = lastScript.src;
580
+ } else {
581
+ inlineScriptCount++;
582
+ lastAutoImportUrl = document.location.href + "__inline_script__" + inlineScriptCount;
583
+ } // if this is already a System load, then the instantiate has already begun
584
+ // so this re-import has no consequence
585
+
586
+
587
+ var loader = this;
588
+ lastAutoImportTimeout = setTimeout(function () {
589
+ autoImportCandidates[lastAutoImportUrl] = [deps, declare];
590
+ loader.import(lastAutoImportUrl);
591
+ });
592
+ } else {
593
+ lastAutoImportDeps = undefined;
594
+ }
595
+
596
+ return systemRegister.call(this, deps, declare);
597
+ };
598
+
599
+ var lastWindowErrorUrl, lastWindowError;
600
+
601
+ systemJSPrototype.instantiate = function (url, firstParentUrl) {
602
+ var autoImportRegistration = autoImportCandidates[url];
603
+
604
+ if (autoImportRegistration) {
605
+ delete autoImportCandidates[url];
606
+ return autoImportRegistration;
607
+ }
608
+
609
+ var loader = this;
610
+ return Promise.resolve(systemJSPrototype.createScript(url)).then(function (script) {
611
+ return new Promise(function (resolve, reject) {
612
+ script.addEventListener('error', function () {
613
+ reject(Error(errMsg(3, [url, firstParentUrl].join(', '))));
614
+ });
615
+ script.addEventListener('load', function () {
616
+ document.head.removeChild(script); // Note that if an error occurs that isn't caught by this if statement,
617
+ // that getRegister will return null and a "did not instantiate" error will be thrown.
618
+
619
+ if (lastWindowErrorUrl === url) {
620
+ reject(lastWindowError);
621
+ } else {
622
+ var register = loader.getRegister(url); // Clear any auto import registration for dynamic import scripts during load
623
+
624
+ if (register && register[0] === lastAutoImportDeps) clearTimeout(lastAutoImportTimeout);
625
+ resolve(register);
626
+ }
627
+ });
628
+ document.head.appendChild(script);
629
+ });
630
+ });
631
+ };
632
+ /*
633
+ * Fetch loader, sets up shouldFetch and fetch hooks
634
+ */
635
+
636
+
637
+ systemJSPrototype.shouldFetch = function () {
638
+ return false;
639
+ };
640
+
641
+ if (typeof fetch !== 'undefined') systemJSPrototype.fetch = fetch;
642
+ var instantiate = systemJSPrototype.instantiate;
643
+ var jsContentTypeRegEx = /^(text|application)\/(x-)?javascript(;|$)/;
644
+
645
+ systemJSPrototype.instantiate = function (url, parent) {
646
+ var loader = this;
647
+ if (!this.shouldFetch(url)) return instantiate.apply(this, arguments);
648
+ return this.fetch(url, {
649
+ credentials: 'same-origin',
650
+ integrity: importMap.integrity[url]
651
+ }).then(function (res) {
652
+ if (!res.ok) throw Error(errMsg(7, [res.status, res.statusText, url, parent].join(', ')));
653
+ var contentType = res.headers.get('content-type');
654
+ if (!contentType || !jsContentTypeRegEx.test(contentType)) throw Error(errMsg(4, contentType));
655
+ return res.text().then(function (source) {
656
+ if (source.indexOf('//# sourceURL=') < 0) source += '\n//# sourceURL=' + url;
657
+ (0, eval)(source);
658
+ return loader.getRegister(url);
659
+ });
660
+ });
661
+ };
662
+
663
+ systemJSPrototype.resolve = function (id, parentUrl) {
664
+ parentUrl = parentUrl || !true || baseUrl;
665
+ return resolveImportMap(importMap, resolveIfNotPlainOrUrl(id, parentUrl) || id, parentUrl) || throwUnresolved(id, parentUrl);
666
+ };
667
+
668
+ function throwUnresolved(id, parentUrl) {
669
+ throw Error(errMsg(8, [id, parentUrl].join(', ')));
670
+ }
671
+
672
+ var systemInstantiate = systemJSPrototype.instantiate;
673
+
674
+ systemJSPrototype.instantiate = function (url, firstParentUrl) {
675
+ var preloads = importMap.depcache[url];
676
+
677
+ if (preloads) {
678
+ for (var i = 0; i < preloads.length; i++) getOrCreateLoad(this, this.resolve(preloads[i], url), url);
679
+ }
680
+
681
+ return systemInstantiate.call(this, url, firstParentUrl);
682
+ };
683
+ /*
684
+ * Supports loading System.register in workers
685
+ */
686
+
687
+
688
+ if (hasSelf && typeof importScripts === 'function') systemJSPrototype.instantiate = function (url) {
689
+ var loader = this;
690
+ return Promise.resolve().then(function () {
691
+ importScripts(url);
692
+ return loader.getRegister(url);
693
+ });
694
+ };
695
+ })();
696
+ //# sourceMappingURL=assets/s.js-749702e8.map</script>
697
+ </head>
698
+
699
+ <body>
700
+ <script type="systemjs-importmap">
701
+ {
702
+ "imports": {}
703
+ }</script>
704
+ <script>System.register([], (function () {
705
+ 'use strict';
706
+ return {
707
+ execute: (function () {
708
+
709
+ var _defineProperty = (function (obj, key, value) {
710
+ // Shortcircuit the slow defineProperty path when possible.
711
+ // We are trying to avoid issues where setters defined on the
712
+ // prototype cause side effects under the fast path of simple
713
+ // assignment. By checking for existence of the property with
714
+ // the in operator, we can optimize most of this overhead away.
715
+ if (key in obj) {
716
+ Object.defineProperty(obj, key, {
717
+ value: value,
718
+ enumerable: true,
719
+ configurable: true,
720
+ writable: true
721
+ });
722
+ } else {
723
+ obj[key] = value;
724
+ }
725
+
726
+ return obj;
727
+ });
728
+
729
+ var createDetailedMessage = function createDetailedMessage(message) {
730
+ var details = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
731
+ var string = "".concat(message);
732
+ Object.keys(details).forEach(function (key) {
733
+ var value = details[key];
734
+ string += "\n--- ".concat(key, " ---\n").concat(Array.isArray(value) ? value.join("\n") : value);
735
+ });
736
+ return string;
737
+ };
738
+
739
+ var COMPILE_ID_OTHERWISE = "otherwise";
740
+
741
+ var computeCompileIdFromGroupId = function computeCompileIdFromGroupId(_ref) {
742
+ var groupId = _ref.groupId,
743
+ groupMap = _ref.groupMap;
744
+
745
+ if (typeof groupId === "undefined") {
746
+ if (COMPILE_ID_OTHERWISE in groupMap) {
747
+ return COMPILE_ID_OTHERWISE;
748
+ }
749
+
750
+ var keys = Object.keys(groupMap);
751
+
752
+ if (keys.length === 1) {
753
+ return keys[0];
754
+ }
755
+
756
+ throw new Error(createUnexpectedGroupIdMessage({
757
+ groupMap: groupMap
758
+ }));
759
+ }
760
+
761
+ if (groupId in groupMap === false) {
762
+ throw new Error(createUnexpectedGroupIdMessage({
763
+ groupId: groupId,
764
+ groupMap: groupMap
765
+ }));
766
+ }
767
+
768
+ return groupId;
769
+ };
770
+
771
+ var createUnexpectedGroupIdMessage = function createUnexpectedGroupIdMessage(_ref2) {
772
+ var _createDetailedMessag;
773
+
774
+ var compileId = _ref2.compileId,
775
+ groupMap = _ref2.groupMap;
776
+ return createDetailedMessage("unexpected groupId.", (_createDetailedMessag = {}, _defineProperty(_createDetailedMessag, "expected compiled id", Object.keys(groupMap)), _defineProperty(_createDetailedMessag, "received compile id", compileId), _createDetailedMessag));
777
+ };
778
+
779
+ var valueToVersion = function valueToVersion(value) {
780
+ if (typeof value === "number") {
781
+ return numberToVersion(value);
782
+ }
783
+
784
+ if (typeof value === "string") {
785
+ return stringToVersion(value);
786
+ }
787
+
788
+ throw new TypeError("version must be a number or a string, got ".concat(value));
789
+ };
790
+
791
+ var numberToVersion = function numberToVersion(number) {
792
+ return {
793
+ major: number,
794
+ minor: 0,
795
+ patch: 0
796
+ };
797
+ };
798
+
799
+ var stringToVersion = function stringToVersion(string) {
800
+ if (string.indexOf(".") > -1) {
801
+ var parts = string.split(".");
802
+ return {
803
+ major: Number(parts[0]),
804
+ minor: parts[1] ? Number(parts[1]) : 0,
805
+ patch: parts[2] ? Number(parts[2]) : 0
806
+ };
807
+ }
808
+
809
+ if (isNaN(string)) {
810
+ return {
811
+ major: 0,
812
+ minor: 0,
813
+ patch: 0
814
+ };
815
+ }
816
+
817
+ return {
818
+ major: Number(string),
819
+ minor: 0,
820
+ patch: 0
821
+ };
822
+ };
823
+
824
+ var versionCompare = function versionCompare(versionA, versionB) {
825
+ var semanticVersionA = valueToVersion(versionA);
826
+ var semanticVersionB = valueToVersion(versionB);
827
+ var majorDiff = semanticVersionA.major - semanticVersionB.major;
828
+
829
+ if (majorDiff > 0) {
830
+ return majorDiff;
831
+ }
832
+
833
+ if (majorDiff < 0) {
834
+ return majorDiff;
835
+ }
836
+
837
+ var minorDiff = semanticVersionA.minor - semanticVersionB.minor;
838
+
839
+ if (minorDiff > 0) {
840
+ return minorDiff;
841
+ }
842
+
843
+ if (minorDiff < 0) {
844
+ return minorDiff;
845
+ }
846
+
847
+ var patchDiff = semanticVersionA.patch - semanticVersionB.patch;
848
+
849
+ if (patchDiff > 0) {
850
+ return patchDiff;
851
+ }
852
+
853
+ if (patchDiff < 0) {
854
+ return patchDiff;
855
+ }
856
+
857
+ return 0;
858
+ };
859
+
860
+ var versionIsBelow = function versionIsBelow(versionSupposedBelow, versionSupposedAbove) {
861
+ return versionCompare(versionSupposedBelow, versionSupposedAbove) < 0;
862
+ };
863
+
864
+ var findHighestVersion = function findHighestVersion() {
865
+ for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) {
866
+ values[_key] = arguments[_key];
867
+ }
868
+
869
+ if (values.length === 0) throw new Error("missing argument");
870
+ return values.reduce(function (highestVersion, value) {
871
+ if (versionIsBelow(highestVersion, value)) {
872
+ return value;
873
+ }
874
+
875
+ return highestVersion;
876
+ });
877
+ };
878
+
879
+ var resolveGroup = function resolveGroup(_ref, groupMap) {
880
+ var name = _ref.name,
881
+ version = _ref.version;
882
+ return Object.keys(groupMap).find(function (compileIdCandidate) {
883
+ var minRuntimeVersions = groupMap[compileIdCandidate].minRuntimeVersions;
884
+ var versionForGroup = minRuntimeVersions[name];
885
+
886
+ if (!versionForGroup) {
887
+ return false;
888
+ }
889
+
890
+ var highestVersion = findHighestVersion(version, versionForGroup);
891
+ return highestVersion === version;
892
+ });
893
+ };
894
+
895
+ function ownKeys(object, enumerableOnly) {
896
+ var keys = Object.keys(object);
897
+
898
+ if (Object.getOwnPropertySymbols) {
899
+ var symbols = Object.getOwnPropertySymbols(object);
900
+
901
+ if (enumerableOnly) {
902
+ symbols = symbols.filter(function (sym) {
903
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
904
+ });
905
+ }
906
+
907
+ keys.push.apply(keys, symbols);
908
+ }
909
+
910
+ return keys;
911
+ }
912
+
913
+ function _objectSpread2(target) {
914
+ for (var i = 1; i < arguments.length; i++) {
915
+ var source = arguments[i] != null ? arguments[i] : {};
916
+
917
+ if (i % 2) {
918
+ ownKeys(Object(source), true).forEach(function (key) {
919
+ _defineProperty(target, key, source[key]);
920
+ });
921
+ } else if (Object.getOwnPropertyDescriptors) {
922
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
923
+ } else {
924
+ ownKeys(Object(source)).forEach(function (key) {
925
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
926
+ });
927
+ }
928
+ }
929
+
930
+ return target;
931
+ }
932
+
933
+ var objectWithoutPropertiesLoose = (function (source, excluded) {
934
+ if (source === null) return {};
935
+ var target = {};
936
+ var sourceKeys = Object.keys(source);
937
+ var key;
938
+ var i;
939
+
940
+ for (i = 0; i < sourceKeys.length; i++) {
941
+ key = sourceKeys[i];
942
+ if (excluded.indexOf(key) >= 0) continue;
943
+ target[key] = source[key];
944
+ }
945
+
946
+ return target;
947
+ });
948
+
949
+ var _objectWithoutProperties = (function (source, excluded) {
950
+ if (source === null) return {};
951
+ var target = objectWithoutPropertiesLoose(source, excluded);
952
+ var key;
953
+ var i;
954
+
955
+ if (Object.getOwnPropertySymbols) {
956
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
957
+
958
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
959
+ key = sourceSymbolKeys[i];
960
+ if (excluded.indexOf(key) >= 0) continue;
961
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
962
+ target[key] = source[key];
963
+ }
964
+ }
965
+
966
+ return target;
967
+ });
968
+
969
+ var nativeTypeOf = function nativeTypeOf(obj) {
970
+ return typeof obj;
971
+ };
972
+
973
+ var customTypeOf = function customTypeOf(obj) {
974
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
975
+ };
976
+
977
+ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? nativeTypeOf : customTypeOf;
978
+
979
+ /* eslint-env browser */
980
+ function _await$4(value, then, direct) {
981
+ if (direct) {
982
+ return then ? then(value) : value;
983
+ }
984
+
985
+ if (!value || !value.then) {
986
+ value = Promise.resolve(value);
987
+ }
988
+
989
+ return then ? value.then(then) : value;
990
+ }
991
+
992
+ function _async$4(f) {
993
+ return function () {
994
+ for (var args = [], i = 0; i < arguments.length; i++) {
995
+ args[i] = arguments[i];
996
+ }
997
+
998
+ try {
999
+ return Promise.resolve(f.apply(this, args));
1000
+ } catch (e) {
1001
+ return Promise.reject(e);
1002
+ }
1003
+ };
1004
+ }
1005
+
1006
+ function _call$1(body, then, direct) {
1007
+ if (direct) {
1008
+ return then ? then(body()) : body();
1009
+ }
1010
+
1011
+ try {
1012
+ var result = Promise.resolve(body());
1013
+ return then ? result.then(then) : result;
1014
+ } catch (e) {
1015
+ return Promise.reject(e);
1016
+ }
1017
+ }
1018
+
1019
+ var fetchUsingXHR = _async$4(function (url) {
1020
+ var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
1021
+ signal = _ref.signal,
1022
+ _ref$method = _ref.method,
1023
+ method = _ref$method === void 0 ? "GET" : _ref$method,
1024
+ _ref$credentials = _ref.credentials,
1025
+ credentials = _ref$credentials === void 0 ? "same-origin" : _ref$credentials,
1026
+ _ref$headers = _ref.headers,
1027
+ headers = _ref$headers === void 0 ? {} : _ref$headers,
1028
+ _ref$body = _ref.body,
1029
+ body = _ref$body === void 0 ? null : _ref$body;
1030
+
1031
+ var headersPromise = createPromiseAndHooks();
1032
+ var bodyPromise = createPromiseAndHooks();
1033
+ var xhr = new XMLHttpRequest();
1034
+
1035
+ var failure = function failure(error) {
1036
+ // if it was already resolved, we must reject the body promise
1037
+ if (headersPromise.settled) {
1038
+ bodyPromise.reject(error);
1039
+ } else {
1040
+ headersPromise.reject(error);
1041
+ }
1042
+ };
1043
+
1044
+ var cleanup = function cleanup() {
1045
+ xhr.ontimeout = null;
1046
+ xhr.onerror = null;
1047
+ xhr.onload = null;
1048
+ xhr.onreadystatechange = null;
1049
+ };
1050
+
1051
+ xhr.ontimeout = function () {
1052
+ cleanup();
1053
+ failure(new Error("xhr request timeout on ".concat(url, ".")));
1054
+ };
1055
+
1056
+ xhr.onerror = function (error) {
1057
+ cleanup(); // unfortunately with have no clue why it fails
1058
+ // might be cors for instance
1059
+
1060
+ failure(createRequestError(error, {
1061
+ url: url
1062
+ }));
1063
+ };
1064
+
1065
+ xhr.onload = function () {
1066
+ cleanup();
1067
+ bodyPromise.resolve();
1068
+ };
1069
+
1070
+ signal.addEventListener("abort", function () {
1071
+ xhr.abort();
1072
+ var abortError = new Error("aborted");
1073
+ abortError.name = "AbortError";
1074
+ failure(abortError);
1075
+ });
1076
+
1077
+ xhr.onreadystatechange = function () {
1078
+ // https://developer.mozilla.org/fr/docs/Web/API/XMLHttpRequest/readyState
1079
+ var readyState = xhr.readyState;
1080
+
1081
+ if (readyState === 2) {
1082
+ headersPromise.resolve();
1083
+ } else if (readyState === 4) {
1084
+ cleanup();
1085
+ bodyPromise.resolve();
1086
+ }
1087
+ };
1088
+
1089
+ xhr.open(method, url, true);
1090
+ Object.keys(headers).forEach(function (key) {
1091
+ xhr.setRequestHeader(key, headers[key]);
1092
+ });
1093
+ xhr.withCredentials = computeWithCredentials({
1094
+ credentials: credentials,
1095
+ url: url
1096
+ });
1097
+
1098
+ if ("responseType" in xhr && hasBlob) {
1099
+ xhr.responseType = "blob";
1100
+ }
1101
+
1102
+ xhr.send(body);
1103
+ return _await$4(headersPromise, function () {
1104
+ // https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseURL
1105
+ var responseUrl = "responseURL" in xhr ? xhr.responseURL : headers["x-request-url"];
1106
+ var responseStatus = xhr.status;
1107
+ var responseStatusText = xhr.statusText;
1108
+ var responseHeaders = getHeadersFromXHR(xhr);
1109
+
1110
+ var readBody = function readBody() {
1111
+ return _await$4(bodyPromise, function () {
1112
+ var status = xhr.status; // in Chrome on file:/// URLs, status is 0
1113
+
1114
+ if (status === 0) {
1115
+ responseStatus = 200;
1116
+ }
1117
+
1118
+ var body = "response" in xhr ? xhr.response : xhr.responseText;
1119
+ return {
1120
+ responseBody: body,
1121
+ responseBodyType: detectBodyType(body)
1122
+ };
1123
+ });
1124
+ };
1125
+
1126
+ var text = function text() {
1127
+ return _call$1(readBody, function (_ref2) {
1128
+ var responseBody = _ref2.responseBody,
1129
+ responseBodyType = _ref2.responseBodyType;
1130
+
1131
+ if (responseBodyType === "blob") {
1132
+ return blobToText(responseBody);
1133
+ }
1134
+
1135
+ if (responseBodyType === "formData") {
1136
+ throw new Error("could not read FormData body as text");
1137
+ }
1138
+
1139
+ return responseBodyType === "dataView" ? arrayBufferToText(responseBody.buffer) : responseBodyType === "arrayBuffer" ? arrayBufferToText(responseBody) : String(responseBody);
1140
+ });
1141
+ };
1142
+
1143
+ var json = function json() {
1144
+ return _call$1(text, JSON.parse);
1145
+ };
1146
+
1147
+ var blob = _async$4(function () {
1148
+ if (!hasBlob) {
1149
+ throw new Error("blob not supported");
1150
+ }
1151
+
1152
+ return _call$1(readBody, function (_ref3) {
1153
+ var responseBody = _ref3.responseBody,
1154
+ responseBodyType = _ref3.responseBodyType;
1155
+
1156
+ if (responseBodyType === "blob") {
1157
+ return responseBody;
1158
+ }
1159
+
1160
+ if (responseBodyType === "dataView") {
1161
+ return new Blob([cloneBuffer(responseBody.buffer)]);
1162
+ }
1163
+
1164
+ if (responseBodyType === "arrayBuffer") {
1165
+ return new Blob([cloneBuffer(responseBody)]);
1166
+ }
1167
+
1168
+ if (responseBodyType === "formData") {
1169
+ throw new Error("could not read FormData body as blob");
1170
+ }
1171
+
1172
+ return new Blob([String(responseBody)]);
1173
+ });
1174
+ });
1175
+
1176
+ var arrayBuffer = function arrayBuffer() {
1177
+ return _call$1(readBody, function (_ref4) {
1178
+ var responseBody = _ref4.responseBody,
1179
+ responseBodyType = _ref4.responseBodyType;
1180
+ return responseBodyType === "arrayBuffer" ? cloneBuffer(responseBody) : _call$1(blob, blobToArrayBuffer);
1181
+ });
1182
+ };
1183
+
1184
+ var formData = _async$4(function () {
1185
+ if (!hasFormData) {
1186
+ throw new Error("formData not supported");
1187
+ }
1188
+
1189
+ return _call$1(text, textToFormData);
1190
+ });
1191
+
1192
+ return {
1193
+ url: responseUrl,
1194
+ status: responseStatus,
1195
+ statusText: responseStatusText,
1196
+ headers: responseHeaders,
1197
+ text: text,
1198
+ json: json,
1199
+ blob: blob,
1200
+ arrayBuffer: arrayBuffer,
1201
+ formData: formData
1202
+ };
1203
+ });
1204
+ });
1205
+
1206
+ var canUseBlob = function canUseBlob() {
1207
+ if (typeof window.FileReader !== "function") return false;
1208
+ if (typeof window.Blob !== "function") return false;
1209
+
1210
+ try {
1211
+ // eslint-disable-next-line no-new
1212
+ new Blob();
1213
+ return true;
1214
+ } catch (e) {
1215
+ return false;
1216
+ }
1217
+ };
1218
+
1219
+ var hasBlob = canUseBlob();
1220
+ var hasFormData = typeof window.FormData === "function";
1221
+ var hasArrayBuffer = typeof window.ArrayBuffer === "function";
1222
+ var hasSearchParams = typeof window.URLSearchParams === "function";
1223
+
1224
+ var createRequestError = function createRequestError(error, _ref5) {
1225
+ var url = _ref5.url;
1226
+ return new Error("error during xhr request on ".concat(url, ".\n--- error stack ---\n").concat(error.stack));
1227
+ };
1228
+
1229
+ var createPromiseAndHooks = function createPromiseAndHooks() {
1230
+ var resolve;
1231
+ var reject;
1232
+ var promise = new Promise(function (res, rej) {
1233
+ resolve = function resolve(value) {
1234
+ promise.settled = true;
1235
+ res(value);
1236
+ };
1237
+
1238
+ reject = function reject(value) {
1239
+ promise.settled = true;
1240
+ rej(value);
1241
+ };
1242
+ });
1243
+ promise.resolve = resolve;
1244
+ promise.reject = reject;
1245
+ return promise;
1246
+ }; // https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch
1247
+
1248
+
1249
+ var computeWithCredentials = function computeWithCredentials(_ref6) {
1250
+ var credentials = _ref6.credentials,
1251
+ url = _ref6.url;
1252
+
1253
+ if (credentials === "same-origin") {
1254
+ return originSameAsGlobalOrigin(url);
1255
+ }
1256
+
1257
+ return credentials === "include";
1258
+ };
1259
+
1260
+ var originSameAsGlobalOrigin = function originSameAsGlobalOrigin(url) {
1261
+ // if we cannot read globalOrigin from window.location.origin, let's consider it's ok
1262
+ if ((typeof window === "undefined" ? "undefined" : _typeof(window)) !== "object") return true;
1263
+ if (_typeof(window.location) !== "object") return true;
1264
+ var globalOrigin = window.location.origin;
1265
+ if (globalOrigin === "null") return true;
1266
+ return hrefToOrigin(url) === globalOrigin;
1267
+ };
1268
+
1269
+ var detectBodyType = function detectBodyType(body) {
1270
+ if (!body) {
1271
+ return "";
1272
+ }
1273
+
1274
+ if (typeof body === "string") {
1275
+ return "text";
1276
+ }
1277
+
1278
+ if (hasBlob && Blob.prototype.isPrototypeOf(body)) {
1279
+ return "blob";
1280
+ }
1281
+
1282
+ if (hasFormData && FormData.prototype.isPrototypeOf(body)) {
1283
+ return "formData";
1284
+ }
1285
+
1286
+ if (hasArrayBuffer) {
1287
+ if (hasBlob && isDataView(body)) {
1288
+ return "dataView";
1289
+ }
1290
+
1291
+ if (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body)) {
1292
+ return "arrayBuffer";
1293
+ }
1294
+ }
1295
+
1296
+ if (hasSearchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
1297
+ return "searchParams";
1298
+ }
1299
+
1300
+ return "";
1301
+ }; // https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/getAllResponseHeaders#Example
1302
+
1303
+
1304
+ var getHeadersFromXHR = function getHeadersFromXHR(xhr) {
1305
+ var headerMap = {};
1306
+ var headersString = xhr.getAllResponseHeaders();
1307
+ if (headersString === "") return headerMap;
1308
+ var lines = headersString.trim().split(/[\r\n]+/);
1309
+ lines.forEach(function (line) {
1310
+ var parts = line.split(": ");
1311
+ var name = parts.shift();
1312
+ var value = parts.join(": ");
1313
+ headerMap[name.toLowerCase()] = value;
1314
+ });
1315
+ return headerMap;
1316
+ };
1317
+
1318
+ var hrefToOrigin = function hrefToOrigin(href) {
1319
+ var scheme = hrefToScheme(href);
1320
+
1321
+ if (scheme === "file") {
1322
+ return "file://";
1323
+ }
1324
+
1325
+ if (scheme === "http" || scheme === "https") {
1326
+ var secondProtocolSlashIndex = scheme.length + "://".length;
1327
+ var pathnameSlashIndex = href.indexOf("/", secondProtocolSlashIndex);
1328
+ if (pathnameSlashIndex === -1) return href;
1329
+ return href.slice(0, pathnameSlashIndex);
1330
+ }
1331
+
1332
+ return href.slice(0, scheme.length + 1);
1333
+ };
1334
+
1335
+ var hrefToScheme = function hrefToScheme(href) {
1336
+ var colonIndex = href.indexOf(":");
1337
+ if (colonIndex === -1) return "";
1338
+ return href.slice(0, colonIndex);
1339
+ };
1340
+
1341
+ var isDataView = function isDataView(obj) {
1342
+ return obj && DataView.prototype.isPrototypeOf(obj);
1343
+ };
1344
+
1345
+ var isArrayBufferView = ArrayBuffer.isView || function () {
1346
+ var viewClasses = ["[object Int8Array]", "[object Uint8Array]", "[object Uint8ClampedArray]", "[object Int16Array]", "[object Uint16Array]", "[object Int32Array]", "[object Uint32Array]", "[object Float32Array]", "[object Float64Array]"];
1347
+ return function (value) {
1348
+ return value && viewClasses.includes(Object.prototype.toString.call(value));
1349
+ };
1350
+ }();
1351
+
1352
+ var textToFormData = function textToFormData(text) {
1353
+ var form = new FormData();
1354
+ text.trim().split("&").forEach(function (bytes) {
1355
+ if (bytes) {
1356
+ var split = bytes.split("=");
1357
+ var name = split.shift().replace(/\+/g, " ");
1358
+ var value = split.join("=").replace(/\+/g, " ");
1359
+ form.append(decodeURIComponent(name), decodeURIComponent(value));
1360
+ }
1361
+ });
1362
+ return form;
1363
+ };
1364
+
1365
+ var blobToArrayBuffer = _async$4(function (blob) {
1366
+ var reader = new FileReader();
1367
+ var promise = fileReaderReady(reader);
1368
+ reader.readAsArrayBuffer(blob);
1369
+ return promise;
1370
+ });
1371
+
1372
+ var blobToText = function blobToText(blob) {
1373
+ var reader = new FileReader();
1374
+ var promise = fileReaderReady(reader);
1375
+ reader.readAsText(blob);
1376
+ return promise;
1377
+ };
1378
+
1379
+ var arrayBufferToText = function arrayBufferToText(arrayBuffer) {
1380
+ var view = new Uint8Array(arrayBuffer);
1381
+ var chars = new Array(view.length);
1382
+ var i = 0;
1383
+
1384
+ while (i < view.length) {
1385
+ chars[i] = String.fromCharCode(view[i]);
1386
+ i++;
1387
+ }
1388
+
1389
+ return chars.join("");
1390
+ };
1391
+
1392
+ var fileReaderReady = function fileReaderReady(reader) {
1393
+ return new Promise(function (resolve, reject) {
1394
+ reader.onload = function () {
1395
+ resolve(reader.result);
1396
+ };
1397
+
1398
+ reader.onerror = function () {
1399
+ reject(reader.error);
1400
+ };
1401
+ });
1402
+ };
1403
+
1404
+ var cloneBuffer = function cloneBuffer(buffer) {
1405
+ if (buffer.slice) {
1406
+ return buffer.slice(0);
1407
+ }
1408
+
1409
+ var view = new Uint8Array(buffer.byteLength);
1410
+ view.set(new Uint8Array(buffer));
1411
+ return view.buffer;
1412
+ };
1413
+
1414
+ var _excluded = ["mode"];
1415
+
1416
+ function _await$3(value, then, direct) {
1417
+ if (direct) {
1418
+ return then ? then(value) : value;
1419
+ }
1420
+
1421
+ if (!value || !value.then) {
1422
+ value = Promise.resolve(value);
1423
+ }
1424
+
1425
+ return then ? value.then(then) : value;
1426
+ }
1427
+
1428
+ var fetchNative = _async$3(function (url) {
1429
+ var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1430
+
1431
+ var _ref$mode = _ref.mode,
1432
+ mode = _ref$mode === void 0 ? "cors" : _ref$mode,
1433
+ options = _objectWithoutProperties(_ref, _excluded);
1434
+
1435
+ return _await$3(window.fetch(url, _objectSpread2({
1436
+ mode: mode
1437
+ }, options)), function (response) {
1438
+ return {
1439
+ url: response.url,
1440
+ status: response.status,
1441
+ statusText: "",
1442
+ headers: responseToHeaders(response),
1443
+ text: function text() {
1444
+ return response.text();
1445
+ },
1446
+ json: function json() {
1447
+ return response.json();
1448
+ },
1449
+ blob: function blob() {
1450
+ return response.blob();
1451
+ },
1452
+ arrayBuffer: function arrayBuffer() {
1453
+ return response.arrayBuffer();
1454
+ },
1455
+ formData: function formData() {
1456
+ return response.formData();
1457
+ }
1458
+ };
1459
+ });
1460
+ });
1461
+
1462
+ function _async$3(f) {
1463
+ return function () {
1464
+ for (var args = [], i = 0; i < arguments.length; i++) {
1465
+ args[i] = arguments[i];
1466
+ }
1467
+
1468
+ try {
1469
+ return Promise.resolve(f.apply(this, args));
1470
+ } catch (e) {
1471
+ return Promise.reject(e);
1472
+ }
1473
+ };
1474
+ }
1475
+
1476
+ var responseToHeaders = function responseToHeaders(response) {
1477
+ var headers = {};
1478
+ response.headers.forEach(function (value, name) {
1479
+ headers[name] = value;
1480
+ });
1481
+ return headers;
1482
+ };
1483
+
1484
+ var fetchUrl = typeof window.fetch === "function" && typeof window.AbortController === "function" ? fetchNative : fetchUsingXHR;
1485
+
1486
+ function _await$2(value, then, direct) {
1487
+ if (direct) {
1488
+ return then ? then(value) : value;
1489
+ }
1490
+
1491
+ if (!value || !value.then) {
1492
+ value = Promise.resolve(value);
1493
+ }
1494
+
1495
+ return then ? value.then(then) : value;
1496
+ }
1497
+
1498
+ function _async$2(f) {
1499
+ return function () {
1500
+ for (var args = [], i = 0; i < arguments.length; i++) {
1501
+ args[i] = arguments[i];
1502
+ }
1503
+
1504
+ try {
1505
+ return Promise.resolve(f.apply(this, args));
1506
+ } catch (e) {
1507
+ return Promise.reject(e);
1508
+ }
1509
+ };
1510
+ }
1511
+
1512
+ var fetchJson = _async$2(function (url) {
1513
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1514
+ return _await$2(fetchUrl(url, options), function (response) {
1515
+ return _await$2(response.json());
1516
+ });
1517
+ });
1518
+
1519
+ var firstMatch = function firstMatch(regexp, string) {
1520
+ var match = string.match(regexp);
1521
+ return match && match.length > 0 ? match[1] || undefined : undefined;
1522
+ };
1523
+ var secondMatch = function secondMatch(regexp, string) {
1524
+ var match = string.match(regexp);
1525
+ return match && match.length > 1 ? match[2] || undefined : undefined;
1526
+ };
1527
+ var userAgentToVersion = function userAgentToVersion(userAgent) {
1528
+ return firstMatch(/version\/(\d+(\.?_?\d+)+)/i, userAgent) || undefined;
1529
+ };
1530
+
1531
+ var detectAndroid = function detectAndroid() {
1532
+ return navigatorToBrowser$1(window.navigator);
1533
+ };
1534
+
1535
+ var navigatorToBrowser$1 = function navigatorToBrowser(_ref) {
1536
+ var userAgent = _ref.userAgent,
1537
+ appVersion = _ref.appVersion;
1538
+
1539
+ if (/(android)/i.test(userAgent)) {
1540
+ return {
1541
+ name: "android",
1542
+ version: firstMatch(/Android (\d+(\.?_?\d+)+)/i, appVersion)
1543
+ };
1544
+ }
1545
+
1546
+ return null;
1547
+ };
1548
+
1549
+ var detectInternetExplorer = function detectInternetExplorer() {
1550
+ return userAgentToBrowser$5(window.navigator.userAgent);
1551
+ };
1552
+
1553
+ var userAgentToBrowser$5 = function userAgentToBrowser(userAgent) {
1554
+ if (/msie|trident/i.test(userAgent)) {
1555
+ return {
1556
+ name: "ie",
1557
+ version: firstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i, userAgent)
1558
+ };
1559
+ }
1560
+
1561
+ return null;
1562
+ };
1563
+
1564
+ var detectOpera = function detectOpera() {
1565
+ return userAgentToBrowser$4(window.navigator.userAgent);
1566
+ };
1567
+
1568
+ var userAgentToBrowser$4 = function userAgentToBrowser(userAgent) {
1569
+ // opera below 13
1570
+ if (/opera/i.test(userAgent)) {
1571
+ return {
1572
+ name: "opera",
1573
+ version: userAgentToVersion(userAgent) || firstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i, userAgent)
1574
+ };
1575
+ } // opera above 13
1576
+
1577
+
1578
+ if (/opr\/|opios/i.test(userAgent)) {
1579
+ return {
1580
+ name: "opera",
1581
+ version: firstMatch(/(?:opr|opios)[\s/](\S+)/i, userAgent) || userAgentToVersion(userAgent)
1582
+ };
1583
+ }
1584
+
1585
+ return null;
1586
+ };
1587
+
1588
+ var detectEdge = function detectEdge() {
1589
+ return userAgentToBrowser$3(window.navigator.userAgent);
1590
+ };
1591
+
1592
+ var userAgentToBrowser$3 = function userAgentToBrowser(userAgent) {
1593
+ if (/edg([ea]|ios)/i.test(userAgent)) {
1594
+ return {
1595
+ name: "edge",
1596
+ version: secondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i, userAgent)
1597
+ };
1598
+ }
1599
+
1600
+ return null;
1601
+ };
1602
+
1603
+ var detectFirefox = function detectFirefox() {
1604
+ return userAgentToBrowser$2(window.navigator.userAgent);
1605
+ };
1606
+
1607
+ var userAgentToBrowser$2 = function userAgentToBrowser(userAgent) {
1608
+ if (/firefox|iceweasel|fxios/i.test(userAgent)) {
1609
+ return {
1610
+ name: "firefox",
1611
+ version: firstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i, userAgent)
1612
+ };
1613
+ }
1614
+
1615
+ return null;
1616
+ };
1617
+
1618
+ var detectChrome = function detectChrome() {
1619
+ return userAgentToBrowser$1(window.navigator.userAgent);
1620
+ };
1621
+
1622
+ var userAgentToBrowser$1 = function userAgentToBrowser(userAgent) {
1623
+ if (/chromium/i.test(userAgent)) {
1624
+ return {
1625
+ name: "chrome",
1626
+ version: firstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i, userAgent) || userAgentToVersion(userAgent)
1627
+ };
1628
+ }
1629
+
1630
+ if (/chrome|crios|crmo/i.test(userAgent)) {
1631
+ return {
1632
+ name: "chrome",
1633
+ version: firstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i, userAgent)
1634
+ };
1635
+ }
1636
+
1637
+ return null;
1638
+ };
1639
+
1640
+ var detectSafari = function detectSafari() {
1641
+ return userAgentToBrowser(window.navigator.userAgent);
1642
+ };
1643
+
1644
+ var userAgentToBrowser = function userAgentToBrowser(userAgent) {
1645
+ if (/safari|applewebkit/i.test(userAgent)) {
1646
+ return {
1647
+ name: "safari",
1648
+ version: userAgentToVersion(userAgent)
1649
+ };
1650
+ }
1651
+
1652
+ return null;
1653
+ };
1654
+
1655
+ var detectElectron = function detectElectron() {
1656
+ return null;
1657
+ }; // TODO
1658
+
1659
+ var detectIOS = function detectIOS() {
1660
+ return navigatorToBrowser(window.navigator);
1661
+ };
1662
+
1663
+ var navigatorToBrowser = function navigatorToBrowser(_ref) {
1664
+ var userAgent = _ref.userAgent,
1665
+ appVersion = _ref.appVersion;
1666
+
1667
+ if (/iPhone;/.test(userAgent)) {
1668
+ return {
1669
+ name: "ios",
1670
+ version: firstMatch(/OS (\d+(\.?_?\d+)+)/i, appVersion)
1671
+ };
1672
+ }
1673
+
1674
+ if (/iPad;/.test(userAgent)) {
1675
+ return {
1676
+ name: "ios",
1677
+ version: firstMatch(/OS (\d+(\.?_?\d+)+)/i, appVersion)
1678
+ };
1679
+ }
1680
+
1681
+ return null;
1682
+ };
1683
+
1684
+ // https://github.com/Ahmdrza/detect-browser/blob/26254f85cf92795655a983bfd759d85f3de850c6/detect-browser.js#L1
1685
+
1686
+ var detectorCompose = function detectorCompose(detectors) {
1687
+ return function () {
1688
+ var i = 0;
1689
+
1690
+ while (i < detectors.length) {
1691
+ var _detector = detectors[i];
1692
+ i++;
1693
+
1694
+ var result = _detector();
1695
+
1696
+ if (result) {
1697
+ return result;
1698
+ }
1699
+ }
1700
+
1701
+ return null;
1702
+ };
1703
+ };
1704
+
1705
+ var detector = detectorCompose([detectOpera, detectInternetExplorer, detectEdge, detectFirefox, detectChrome, detectSafari, detectElectron, detectIOS, detectAndroid]);
1706
+ var detectBrowser = function detectBrowser() {
1707
+ var _ref = detector() || {},
1708
+ _ref$name = _ref.name,
1709
+ name = _ref$name === void 0 ? "other" : _ref$name,
1710
+ _ref$version = _ref.version,
1711
+ version = _ref$version === void 0 ? "unknown" : _ref$version;
1712
+
1713
+ return {
1714
+ name: normalizeName(name),
1715
+ version: normalizeVersion(version)
1716
+ };
1717
+ };
1718
+
1719
+ var normalizeName = function normalizeName(name) {
1720
+ return name.toLowerCase();
1721
+ };
1722
+
1723
+ var normalizeVersion = function normalizeVersion(version) {
1724
+ if (version.indexOf(".") > -1) {
1725
+ var parts = version.split("."); // remove extraneous .
1726
+
1727
+ return parts.slice(0, 3).join(".");
1728
+ }
1729
+
1730
+ if (version.indexOf("_") > -1) {
1731
+ var _parts = version.split("_"); // remove extraneous _
1732
+
1733
+
1734
+ return _parts.slice(0, 3).join("_");
1735
+ }
1736
+
1737
+ return version;
1738
+ };
1739
+
1740
+ function _await$1(value, then, direct) {
1741
+ if (direct) {
1742
+ return then ? then(value) : value;
1743
+ }
1744
+
1745
+ if (!value || !value.then) {
1746
+ value = Promise.resolve(value);
1747
+ }
1748
+
1749
+ return then ? value.then(then) : value;
1750
+ }
1751
+
1752
+ function _async$1(f) {
1753
+ return function () {
1754
+ for (var args = [], i = 0; i < arguments.length; i++) {
1755
+ args[i] = arguments[i];
1756
+ }
1757
+
1758
+ try {
1759
+ return Promise.resolve(f.apply(this, args));
1760
+ } catch (e) {
1761
+ return Promise.reject(e);
1762
+ }
1763
+ };
1764
+ }
1765
+
1766
+ function _call(body, then, direct) {
1767
+ if (direct) {
1768
+ return then ? then(body()) : body();
1769
+ }
1770
+
1771
+ try {
1772
+ var result = Promise.resolve(body());
1773
+ return then ? result.then(then) : result;
1774
+ } catch (e) {
1775
+ return Promise.reject(e);
1776
+ }
1777
+ }
1778
+
1779
+ function _invoke(body, then) {
1780
+ var result = body();
1781
+
1782
+ if (result && result.then) {
1783
+ return result.then(then);
1784
+ }
1785
+
1786
+ return then(result);
1787
+ }
1788
+
1789
+ function _catch(body, recover) {
1790
+ try {
1791
+ var result = body();
1792
+ } catch (e) {
1793
+ return recover(e);
1794
+ }
1795
+
1796
+ if (result && result.then) {
1797
+ return result.then(void 0, recover);
1798
+ }
1799
+
1800
+ return result;
1801
+ }
1802
+
1803
+ var scanBrowserRuntimeFeatures = _async$1(function () {
1804
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1805
+ _ref$coverageHandledF = _ref.coverageHandledFromOutside,
1806
+ coverageHandledFromOutside = _ref$coverageHandledF === void 0 ? false : _ref$coverageHandledF,
1807
+ _ref$failFastOnFeatur = _ref.failFastOnFeatureDetection,
1808
+ failFastOnFeatureDetection = _ref$failFastOnFeatur === void 0 ? false : _ref$failFastOnFeatur;
1809
+
1810
+ return _await$1(fetchJson("/.jsenv/__compile_server_meta__.json"), function (_ref2) {
1811
+ var outDirectoryRelativeUrl = _ref2.outDirectoryRelativeUrl,
1812
+ inlineImportMapIntoHTML = _ref2.inlineImportMapIntoHTML,
1813
+ customCompilerPatterns = _ref2.customCompilerPatterns,
1814
+ compileServerGroupMap = _ref2.compileServerGroupMap;
1815
+ var browser = detectBrowser();
1816
+ var compileId = computeCompileIdFromGroupId({
1817
+ groupId: resolveGroup(browser, compileServerGroupMap),
1818
+ groupMap: compileServerGroupMap
1819
+ });
1820
+ var groupInfo = compileServerGroupMap[compileId];
1821
+ var featuresReport = {
1822
+ importmap: undefined,
1823
+ dynamicImport: undefined,
1824
+ topLevelAwait: undefined,
1825
+ jsonImportAssertions: undefined,
1826
+ cssImportAssertions: undefined,
1827
+ newStylesheet: undefined
1828
+ };
1829
+ return _await$1(detectSupportedFeatures({
1830
+ featuresReport: featuresReport,
1831
+ failFastOnFeatureDetection: failFastOnFeatureDetection,
1832
+ inlineImportMapIntoHTML: inlineImportMapIntoHTML
1833
+ }), function () {
1834
+ return _await$1(pluginRequiredNamesFromGroupInfo(groupInfo, {
1835
+ featuresReport: featuresReport,
1836
+ coverageHandledFromOutside: coverageHandledFromOutside
1837
+ }), function (pluginRequiredNameArray) {
1838
+ var canAvoidCompilation = customCompilerPatterns.length === 0 && pluginRequiredNameArray.length === 0 && featuresReport.importmap && featuresReport.dynamicImport && featuresReport.topLevelAwait;
1839
+ return {
1840
+ canAvoidCompilation: canAvoidCompilation,
1841
+ featuresReport: featuresReport,
1842
+ customCompilerPatterns: customCompilerPatterns,
1843
+ pluginRequiredNameArray: pluginRequiredNameArray,
1844
+ inlineImportMapIntoHTML: inlineImportMapIntoHTML,
1845
+ outDirectoryRelativeUrl: outDirectoryRelativeUrl,
1846
+ compileId: compileId,
1847
+ browser: browser
1848
+ };
1849
+ });
1850
+ });
1851
+ });
1852
+ });
1853
+
1854
+ var pluginRequiredNamesFromGroupInfo = _async$1(function (groupInfo, _ref3) {
1855
+ var featuresReport = _ref3.featuresReport,
1856
+ coverageHandledFromOutside = _ref3.coverageHandledFromOutside;
1857
+ var pluginRequiredNameArray = groupInfo.pluginRequiredNameArray;
1858
+ var requiredPluginNames = pluginRequiredNameArray.slice();
1859
+
1860
+ var markPluginAsSupported = function markPluginAsSupported(name) {
1861
+ var index = requiredPluginNames.indexOf(name);
1862
+
1863
+ if (index > -1) {
1864
+ requiredPluginNames.splice(index, 1);
1865
+ }
1866
+ }; // When instrumentation CAN be handed by playwright
1867
+ // https://playwright.dev/docs/api/class-chromiumcoverage#chromiumcoveragestartjscoverageoptions
1868
+ // coverageHandledFromOutside is true and "transform-instrument" becomes non mandatory
1869
+
1870
+
1871
+ if (coverageHandledFromOutside) {
1872
+ markPluginAsSupported("transform-instrument");
1873
+ }
1874
+
1875
+ return _invoke(function () {
1876
+ if (pluginRequiredNameArray.includes("transform-import-assertions")) {
1877
+ return _call(supportsJsonImportAssertions, function (jsonImportAssertions) {
1878
+ featuresReport.jsonImportAssertions = jsonImportAssertions;
1879
+ return _call(supportsCssImportAssertions, function (cssImportAssertions) {
1880
+ featuresReport.cssImportAssertions = cssImportAssertions;
1881
+
1882
+ if (jsonImportAssertions && cssImportAssertions) {
1883
+ markPluginAsSupported("transform-import-assertions");
1884
+ }
1885
+ });
1886
+ });
1887
+ }
1888
+ }, function () {
1889
+ if (pluginRequiredNameArray.includes("new-stylesheet-as-jsenv-import")) {
1890
+ var newStylesheet = supportsNewStylesheet();
1891
+ featuresReport.newStylesheet = newStylesheet;
1892
+ markPluginAsSupported("new-stylesheet-as-jsenv-import");
1893
+ }
1894
+
1895
+ return requiredPluginNames;
1896
+ });
1897
+ });
1898
+
1899
+ var detectSupportedFeatures = _async$1(function (_ref4) {
1900
+ var featuresReport = _ref4.featuresReport,
1901
+ failFastOnFeatureDetection = _ref4.failFastOnFeatureDetection,
1902
+ inlineImportMapIntoHTML = _ref4.inlineImportMapIntoHTML;
1903
+ // start testing importmap support first and not in paralell
1904
+ // so that there is not module script loaded beore importmap is injected
1905
+ // it would log an error in chrome console and return undefined
1906
+ return _await$1(supportsImportmap({
1907
+ // chrome supports inline but not remote importmap
1908
+ // https://github.com/WICG/import-maps/issues/235
1909
+ // at this stage we won't know if the html file will use
1910
+ // an importmap or not and if that importmap is inline or specified with an src
1911
+ // so we should test if browser support local and remote importmap.
1912
+ // But there exploring server can inline importmap by transforming html
1913
+ // and in that case we can test only the local importmap support
1914
+ // so we test importmap support and the remote one
1915
+ remote: !inlineImportMapIntoHTML
1916
+ }), function (importmap) {
1917
+ featuresReport.importmap = importmap;
1918
+
1919
+ if (!importmap && failFastOnFeatureDetection) {
1920
+ return;
1921
+ }
1922
+
1923
+ return _call(supportsDynamicImport, function (dynamicImport) {
1924
+ featuresReport.dynamicImport = dynamicImport;
1925
+
1926
+ if (!dynamicImport && failFastOnFeatureDetection) {
1927
+ return;
1928
+ }
1929
+
1930
+ return _call(supportsTopLevelAwait, function (topLevelAwait) {
1931
+ featuresReport.topLevelAwait = topLevelAwait;
1932
+ });
1933
+ });
1934
+ });
1935
+ });
1936
+
1937
+ var supportsImportmap = _async$1(function () {
1938
+ var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1939
+ _ref5$remote = _ref5.remote,
1940
+ remote = _ref5$remote === void 0 ? true : _ref5$remote;
1941
+
1942
+ var specifier = asBase64Url("export default false");
1943
+ var importMap = {
1944
+ imports: _defineProperty({}, specifier, asBase64Url("export default true"))
1945
+ };
1946
+ var importmapScript = document.createElement("script");
1947
+ var importmapString = JSON.stringify(importMap, null, " ");
1948
+ importmapScript.type = "importmap";
1949
+
1950
+ if (remote) {
1951
+ importmapScript.src = "data:application/json;base64,".concat(window.btoa(importmapString));
1952
+ } else {
1953
+ importmapScript.textContent = importmapString;
1954
+ }
1955
+
1956
+ document.body.appendChild(importmapScript);
1957
+ return _catch(function () {
1958
+ return _await$1(executeWithScriptModuleInjection("import supported from \"".concat(specifier, "\"; window.__jsenv_runtime_test_importmap__ = supported")), function () {
1959
+ document.body.removeChild(importmapScript);
1960
+ return window.__jsenv_runtime_test_importmap__;
1961
+ });
1962
+ }, function () {
1963
+ document.body.removeChild(importmapScript);
1964
+ return false;
1965
+ });
1966
+ });
1967
+
1968
+ var supportsDynamicImport = _async$1(function () {
1969
+ var moduleSource = asBase64Url("export default 42");
1970
+ return _catch(function () {
1971
+ return _await$1(executeWithScriptModuleInjection("window.__jsenv_runtime_test_dynamic_import__ = import(".concat(JSON.stringify(moduleSource), ")")), function () {
1972
+ return _await$1(window.__jsenv_runtime_test_dynamic_import__, function (namespace) {
1973
+ return namespace.default === 42;
1974
+ });
1975
+ });
1976
+ }, function () {
1977
+ return false;
1978
+ });
1979
+ });
1980
+
1981
+ var supportsNewStylesheet = function supportsNewStylesheet() {
1982
+ try {
1983
+ // eslint-disable-next-line no-new
1984
+ new CSSStyleSheet();
1985
+ return true;
1986
+ } catch (e) {
1987
+ return false;
1988
+ }
1989
+ };
1990
+
1991
+ var supportsTopLevelAwait = function supportsTopLevelAwait() {
1992
+ return _await$1(_catch(function () {
1993
+ return _await$1(executeWithScriptModuleInjection("window.__jsenv_runtime_test_top_level_await__ = await Promise.resolve(42)"), function () {
1994
+ return window.__jsenv_runtime_test_top_level_await__ === 42;
1995
+ });
1996
+ }, function () {
1997
+ return false;
1998
+ }));
1999
+ }; // to execute in a browser devtools
2000
+ // const featuresReport = {}
2001
+ // await detectSupportedFeatures({ featuresReport, inlineImportMapIntoHTML: true })
2002
+ // console.log(featuresReport)
2003
+
2004
+
2005
+ var supportsJsonImportAssertions = _async$1(function () {
2006
+ var jsonBase64Url = asBase64Url("42", "application/json");
2007
+ var moduleSource = asBase64Url("import data from \"".concat(jsonBase64Url, "\" assert { type: \"json\" }\nexport default data"));
2008
+ return _catch(function () {
2009
+ return _await$1(executeWithScriptModuleInjection("window.__jsenv_runtime_test_json_import_assertion__ = import(".concat(JSON.stringify(moduleSource), ")")), function () {
2010
+ return _await$1(window.__jsenv_runtime_test_json_import_assertion__, function (namespace) {
2011
+ return namespace.default === 42;
2012
+ });
2013
+ });
2014
+ }, function () {
2015
+ return false;
2016
+ });
2017
+ });
2018
+
2019
+ var supportsCssImportAssertions = _async$1(function () {
2020
+ var cssBase64Url = asBase64Url("p { color: red; }", "text/css");
2021
+ var moduleSource = asBase64Url("import css from \"".concat(cssBase64Url, "\" assert { type: \"css\" }\nexport default css"));
2022
+ return _catch(function () {
2023
+ return _await$1(executeWithScriptModuleInjection("window.__jsenv_runtime_test_css_import_assertion__ = import(".concat(JSON.stringify(moduleSource), ")")), function () {
2024
+ return _await$1(window.__jsenv_runtime_test_css_import_assertion__, function (namespace) {
2025
+ return namespace.default instanceof CSSStyleSheet;
2026
+ });
2027
+ });
2028
+ }, function () {
2029
+ return false;
2030
+ });
2031
+ });
2032
+
2033
+ var executeWithScriptModuleInjection = function executeWithScriptModuleInjection(code) {
2034
+ var scriptModule = document.createElement("script");
2035
+ scriptModule.type = "module";
2036
+ var loadPromise = new Promise(function (resolve, reject) {
2037
+ scriptModule.onload = function () {
2038
+ document.body.removeChild(scriptModule);
2039
+ resolve();
2040
+ };
2041
+
2042
+ scriptModule.onerror = function () {
2043
+ document.body.removeChild(scriptModule);
2044
+ reject();
2045
+ };
2046
+
2047
+ document.body.appendChild(scriptModule);
2048
+ });
2049
+ scriptModule.src = asBase64Url(code);
2050
+ return loadPromise;
2051
+ };
2052
+
2053
+ var asBase64Url = function asBase64Url(text) {
2054
+ var mimeType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "application/javascript";
2055
+ return "data:".concat(mimeType, ";base64,").concat(window.btoa(text));
2056
+ }; // const cssImportAssertions = await supportsCssImportAssertions()
2057
+ // console.log({ cssImportAssertions })
2058
+
2059
+ function _await(value, then, direct) {
2060
+ if (direct) {
2061
+ return then ? then(value) : value;
2062
+ }
2063
+
2064
+ if (!value || !value.then) {
2065
+ value = Promise.resolve(value);
2066
+ }
2067
+
2068
+ return then ? value.then(then) : value;
2069
+ }
2070
+
2071
+ var redirect = _async(function () {
2072
+ var redirectTarget = new URLSearchParams(window.location.search).get("redirect");
2073
+ return _await(scanBrowserRuntimeFeatures({
2074
+ failFastOnFeatureDetection: true
2075
+ }), function (browserRuntimeFeaturesReport) {
2076
+ var href = "".concat(getDirectoryUrl(browserRuntimeFeaturesReport)).concat(redirectTarget); // It's IMPORTANT to use location.replace and NOT location.href = url
2077
+ // otherwise it would break the back button
2078
+
2079
+ window.location.replace(href);
2080
+ });
2081
+ });
2082
+
2083
+ function _async(f) {
2084
+ return function () {
2085
+ for (var args = [], i = 0; i < arguments.length; i++) {
2086
+ args[i] = arguments[i];
2087
+ }
2088
+
2089
+ try {
2090
+ return Promise.resolve(f.apply(this, args));
2091
+ } catch (e) {
2092
+ return Promise.reject(e);
2093
+ }
2094
+ };
2095
+ }
2096
+
2097
+ var getDirectoryUrl = function getDirectoryUrl(_ref) {
2098
+ var canAvoidCompilation = _ref.canAvoidCompilation,
2099
+ outDirectoryRelativeUrl = _ref.outDirectoryRelativeUrl,
2100
+ compileId = _ref.compileId;
2101
+
2102
+ if (canAvoidCompilation) {
2103
+ return "/";
2104
+ }
2105
+
2106
+ return "/".concat(outDirectoryRelativeUrl).concat(compileId, "/");
2107
+ };
2108
+
2109
+ redirect();
2110
+
2111
+ })
2112
+ };
2113
+ }));
2114
+
2115
+ //# sourceMappingURL=redirector.html__inline__15-33acb0b9.js.map</script>
2116
+
2117
+
2118
+ </body></html>