es-module-shims 1.5.2 → 1.5.3

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.
@@ -1,836 +1,835 @@
1
- /* ES Module Shims 1.5.2 */
1
+ /* ES Module Shims 1.5.3 */
2
2
  (function () {
3
3
 
4
- const noop = () => {};
5
-
6
- const optionsScript = document.querySelector('script[type=esms-options]');
7
-
8
- const esmsInitOptions = optionsScript ? JSON.parse(optionsScript.innerHTML) : {};
9
- Object.assign(esmsInitOptions, self.esmsInitOptions || {});
10
-
11
- let shimMode = !!esmsInitOptions.shimMode;
12
-
13
- const importHook = globalHook(shimMode && esmsInitOptions.onimport);
14
- const resolveHook = globalHook(shimMode && esmsInitOptions.resolve);
15
- let fetchHook = esmsInitOptions.fetch ? globalHook(esmsInitOptions.fetch) : fetch;
16
- const metaHook = esmsInitOptions.meta ? globalHook(shimModule && esmsInitOptions.meta) : noop;
17
-
18
- const skip = esmsInitOptions.skip ? new RegExp(esmsInitOptions.skip) : null;
19
-
20
- let nonce = esmsInitOptions.nonce;
21
-
22
- const mapOverrides = esmsInitOptions.mapOverrides;
23
-
24
- if (!nonce) {
25
- const nonceElement = document.querySelector('script[nonce]');
26
- if (nonceElement)
27
- nonce = nonceElement.nonce || nonceElement.getAttribute('nonce');
28
- }
29
-
30
- const onerror = globalHook(esmsInitOptions.onerror || noop);
31
- const onpolyfill = esmsInitOptions.onpolyfill ? globalHook(esmsInitOptions.onpolyfill) : () => console.log('%c^^ Module TypeError above is polyfilled and can be ignored ^^', 'font-weight:900;color:#391');
32
-
33
- const { revokeBlobURLs, noLoadEventRetriggers, enforceIntegrity } = esmsInitOptions;
34
-
35
- function globalHook (name) {
36
- return typeof name === 'string' ? self[name] : name;
37
- }
38
-
39
- const enable = Array.isArray(esmsInitOptions.polyfillEnable) ? esmsInitOptions.polyfillEnable : [];
40
- const cssModulesEnabled = enable.includes('css-modules');
41
- const jsonModulesEnabled = enable.includes('json-modules');
42
-
43
- function setShimMode () {
44
- shimMode = true;
45
- }
46
-
47
- const edge = !!navigator.userAgent.match(/Edge\/\d+\.\d+/);
48
-
49
- const baseUrl = document.baseURI;
50
-
51
- function createBlob (source, type = 'text/javascript') {
52
- return URL.createObjectURL(new Blob([source], { type }));
53
- }
54
-
55
- const eoop = err => setTimeout(() => { throw err });
56
-
57
- const throwError = err => { (window.reportError || window.safari && console.error || eoop)(err), void onerror(err); };
58
-
59
- function fromParent (parent) {
60
- return parent ? ` imported from ${parent}` : '';
61
- }
62
-
63
- const backslashRegEx = /\\/g;
64
-
65
- function isURL (url) {
66
- if (url.indexOf(':') === -1) return false;
67
- try {
68
- new URL(url);
69
- return true;
70
- }
71
- catch (_) {
72
- return false;
73
- }
74
- }
75
-
76
- /*
77
- * Import maps implementation
78
- *
79
- * To make lookups fast we pre-resolve the entire import map
80
- * and then match based on backtracked hash lookups
81
- *
82
- */
83
- function resolveUrl (relUrl, parentUrl) {
84
- return resolveIfNotPlainOrUrl(relUrl, parentUrl) || (isURL(relUrl) ? relUrl : resolveIfNotPlainOrUrl('./' + relUrl, parentUrl));
85
- }
86
-
87
- function resolveIfNotPlainOrUrl (relUrl, parentUrl) {
88
- // strip off any trailing query params or hashes
89
- const queryHashIndex = parentUrl.indexOf('?', parentUrl.indexOf('#') === -1 ? parentUrl.indexOf('#') : parentUrl.length);
90
- if (queryHashIndex !== -1)
91
- parentUrl = parentUrl.slice(0, queryHashIndex);
92
- if (relUrl.indexOf('\\') !== -1)
93
- relUrl = relUrl.replace(backslashRegEx, '/');
94
- // protocol-relative
95
- if (relUrl[0] === '/' && relUrl[1] === '/') {
96
- return parentUrl.slice(0, parentUrl.indexOf(':') + 1) + relUrl;
97
- }
98
- // relative-url
99
- else if (relUrl[0] === '.' && (relUrl[1] === '/' || relUrl[1] === '.' && (relUrl[2] === '/' || relUrl.length === 2 && (relUrl += '/')) ||
100
- relUrl.length === 1 && (relUrl += '/')) ||
101
- relUrl[0] === '/') {
102
- const parentProtocol = parentUrl.slice(0, parentUrl.indexOf(':') + 1);
103
- // Disabled, but these cases will give inconsistent results for deep backtracking
104
- //if (parentUrl[parentProtocol.length] !== '/')
105
- // throw new Error('Cannot resolve');
106
- // read pathname from parent URL
107
- // pathname taken to be part after leading "/"
108
- let pathname;
109
- if (parentUrl[parentProtocol.length + 1] === '/') {
110
- // resolving to a :// so we need to read out the auth and host
111
- if (parentProtocol !== 'file:') {
112
- pathname = parentUrl.slice(parentProtocol.length + 2);
113
- pathname = pathname.slice(pathname.indexOf('/') + 1);
114
- }
115
- else {
116
- pathname = parentUrl.slice(8);
117
- }
118
- }
119
- else {
120
- // resolving to :/ so pathname is the /... part
121
- pathname = parentUrl.slice(parentProtocol.length + (parentUrl[parentProtocol.length] === '/'));
122
- }
123
-
124
- if (relUrl[0] === '/')
125
- return parentUrl.slice(0, parentUrl.length - pathname.length - 1) + relUrl;
126
-
127
- // join together and split for removal of .. and . segments
128
- // looping the string instead of anything fancy for perf reasons
129
- // '../../../../../z' resolved to 'x/y' is just 'z'
130
- const segmented = pathname.slice(0, pathname.lastIndexOf('/') + 1) + relUrl;
131
-
132
- const output = [];
133
- let segmentIndex = -1;
134
- for (let i = 0; i < segmented.length; i++) {
135
- // busy reading a segment - only terminate on '/'
136
- if (segmentIndex !== -1) {
137
- if (segmented[i] === '/') {
138
- output.push(segmented.slice(segmentIndex, i + 1));
139
- segmentIndex = -1;
140
- }
141
- continue;
142
- }
143
- // new segment - check if it is relative
144
- else if (segmented[i] === '.') {
145
- // ../ segment
146
- if (segmented[i + 1] === '.' && (segmented[i + 2] === '/' || i + 2 === segmented.length)) {
147
- output.pop();
148
- i += 2;
149
- continue;
150
- }
151
- // ./ segment
152
- else if (segmented[i + 1] === '/' || i + 1 === segmented.length) {
153
- i += 1;
154
- continue;
155
- }
156
- }
157
- // it is the start of a new segment
158
- while (segmented[i] === '/') i++;
159
- segmentIndex = i;
160
- }
161
- // finish reading out the last segment
162
- if (segmentIndex !== -1)
163
- output.push(segmented.slice(segmentIndex));
164
- return parentUrl.slice(0, parentUrl.length - pathname.length) + output.join('');
165
- }
166
- }
167
-
168
- function resolveAndComposeImportMap (json, baseUrl, parentMap) {
169
- const outMap = { imports: Object.assign({}, parentMap.imports), scopes: Object.assign({}, parentMap.scopes) };
170
-
171
- if (json.imports)
172
- resolveAndComposePackages(json.imports, outMap.imports, baseUrl, parentMap);
173
-
174
- if (json.scopes)
175
- for (let s in json.scopes) {
176
- const resolvedScope = resolveUrl(s, baseUrl);
177
- resolveAndComposePackages(json.scopes[s], outMap.scopes[resolvedScope] || (outMap.scopes[resolvedScope] = {}), baseUrl, parentMap);
178
- }
179
-
180
- return outMap;
181
- }
182
-
183
- function getMatch (path, matchObj) {
184
- if (matchObj[path])
185
- return path;
186
- let sepIndex = path.length;
187
- do {
188
- const segment = path.slice(0, sepIndex + 1);
189
- if (segment in matchObj)
190
- return segment;
191
- } while ((sepIndex = path.lastIndexOf('/', sepIndex - 1)) !== -1)
192
- }
193
-
194
- function applyPackages (id, packages) {
195
- const pkgName = getMatch(id, packages);
196
- if (pkgName) {
197
- const pkg = packages[pkgName];
198
- if (pkg === null) return;
199
- return pkg + id.slice(pkgName.length);
200
- }
201
- }
202
-
203
-
204
- function resolveImportMap (importMap, resolvedOrPlain, parentUrl) {
205
- let scopeUrl = parentUrl && getMatch(parentUrl, importMap.scopes);
206
- while (scopeUrl) {
207
- const packageResolution = applyPackages(resolvedOrPlain, importMap.scopes[scopeUrl]);
208
- if (packageResolution)
209
- return packageResolution;
210
- scopeUrl = getMatch(scopeUrl.slice(0, scopeUrl.lastIndexOf('/')), importMap.scopes);
211
- }
212
- return applyPackages(resolvedOrPlain, importMap.imports) || resolvedOrPlain.indexOf(':') !== -1 && resolvedOrPlain;
213
- }
214
-
215
- function resolveAndComposePackages (packages, outPackages, baseUrl, parentMap) {
216
- for (let p in packages) {
217
- const resolvedLhs = resolveIfNotPlainOrUrl(p, baseUrl) || p;
218
- if ((!shimMode || !mapOverrides) && outPackages[resolvedLhs] && (outPackages[resolvedLhs] !== packages[resolvedLhs])) {
219
- throw Error(`Rejected map override "${resolvedLhs}" from ${outPackages[resolvedLhs]} to ${packages[resolvedLhs]}.`);
220
- }
221
- let target = packages[p];
222
- if (typeof target !== 'string')
223
- continue;
224
- const mapped = resolveImportMap(parentMap, resolveIfNotPlainOrUrl(target, baseUrl) || target, baseUrl);
225
- if (mapped) {
226
- outPackages[resolvedLhs] = mapped;
227
- continue;
228
- }
229
- console.warn(`Mapping "${p}" -> "${packages[p]}" does not resolve`);
230
- }
231
- }
232
-
233
- let err;
234
- window.addEventListener('error', _err => err = _err);
235
- function dynamicImportScript (url, { errUrl = url } = {}) {
236
- err = undefined;
237
- const src = createBlob(`import*as m from'${url}';self._esmsi=m`);
238
- const s = Object.assign(document.createElement('script'), { type: 'module', src });
239
- s.setAttribute('nonce', nonce);
240
- s.setAttribute('noshim', '');
241
- const p = new Promise((resolve, reject) => {
242
- // Safari is unique in supporting module script error events
243
- s.addEventListener('error', cb);
244
- s.addEventListener('load', cb);
245
-
246
- function cb (_err) {
247
- document.head.removeChild(s);
248
- if (self._esmsi) {
249
- resolve(self._esmsi, baseUrl);
250
- self._esmsi = undefined;
251
- }
252
- else {
253
- reject(!(_err instanceof Event) && _err || err && err.error || new Error(`Error loading or executing the graph of ${errUrl} (check the console for ${src}).`));
254
- err = undefined;
255
- }
256
- }
257
- });
258
- document.head.appendChild(s);
259
- return p;
260
- }
261
-
262
- let dynamicImport = dynamicImportScript;
263
-
264
- const supportsDynamicImportCheck = dynamicImportScript(createBlob('export default u=>import(u)')).then(_dynamicImport => {
265
- if (_dynamicImport)
266
- dynamicImport = _dynamicImport.default;
267
- return !!_dynamicImport;
4
+ const noop = () => {};
5
+
6
+ const optionsScript = document.querySelector('script[type=esms-options]');
7
+
8
+ const esmsInitOptions = optionsScript ? JSON.parse(optionsScript.innerHTML) : {};
9
+ Object.assign(esmsInitOptions, self.esmsInitOptions || {});
10
+
11
+ let shimMode = !!esmsInitOptions.shimMode;
12
+
13
+ const importHook = globalHook(shimMode && esmsInitOptions.onimport);
14
+ const resolveHook = globalHook(shimMode && esmsInitOptions.resolve);
15
+ let fetchHook = esmsInitOptions.fetch ? globalHook(esmsInitOptions.fetch) : fetch;
16
+ const metaHook = esmsInitOptions.meta ? globalHook(shimModule && esmsInitOptions.meta) : noop;
17
+
18
+ const skip = esmsInitOptions.skip ? new RegExp(esmsInitOptions.skip) : null;
19
+
20
+ let nonce = esmsInitOptions.nonce;
21
+
22
+ const mapOverrides = esmsInitOptions.mapOverrides;
23
+
24
+ if (!nonce) {
25
+ const nonceElement = document.querySelector('script[nonce]');
26
+ if (nonceElement)
27
+ nonce = nonceElement.nonce || nonceElement.getAttribute('nonce');
28
+ }
29
+
30
+ const onerror = globalHook(esmsInitOptions.onerror || noop);
31
+ const onpolyfill = esmsInitOptions.onpolyfill ? globalHook(esmsInitOptions.onpolyfill) : () => console.log('%c^^ Module TypeError above is polyfilled and can be ignored ^^', 'font-weight:900;color:#391');
32
+
33
+ const { revokeBlobURLs, noLoadEventRetriggers, enforceIntegrity } = esmsInitOptions;
34
+
35
+ function globalHook (name) {
36
+ return typeof name === 'string' ? self[name] : name;
37
+ }
38
+
39
+ const enable = Array.isArray(esmsInitOptions.polyfillEnable) ? esmsInitOptions.polyfillEnable : [];
40
+ const cssModulesEnabled = enable.includes('css-modules');
41
+ const jsonModulesEnabled = enable.includes('json-modules');
42
+
43
+ function setShimMode () {
44
+ shimMode = true;
45
+ }
46
+
47
+ const edge = !navigator.userAgentData && !!navigator.userAgent.match(/Edge\/\d+\.\d+/);
48
+
49
+ const baseUrl = document.baseURI;
50
+
51
+ function createBlob (source, type = 'text/javascript') {
52
+ return URL.createObjectURL(new Blob([source], { type }));
53
+ }
54
+
55
+ const eoop = err => setTimeout(() => { throw err });
56
+
57
+ const throwError = err => { (window.reportError || window.safari && console.error || eoop)(err), void onerror(err); };
58
+
59
+ function fromParent (parent) {
60
+ return parent ? ` imported from ${parent}` : '';
61
+ }
62
+
63
+ const backslashRegEx = /\\/g;
64
+
65
+ function isURL (url) {
66
+ if (url.indexOf(':') === -1) return false;
67
+ try {
68
+ new URL(url);
69
+ return true;
70
+ }
71
+ catch (_) {
72
+ return false;
73
+ }
74
+ }
75
+
76
+ /*
77
+ * Import maps implementation
78
+ *
79
+ * To make lookups fast we pre-resolve the entire import map
80
+ * and then match based on backtracked hash lookups
81
+ *
82
+ */
83
+ function resolveUrl (relUrl, parentUrl) {
84
+ return resolveIfNotPlainOrUrl(relUrl, parentUrl) || (isURL(relUrl) ? relUrl : resolveIfNotPlainOrUrl('./' + relUrl, parentUrl));
85
+ }
86
+
87
+ function resolveIfNotPlainOrUrl (relUrl, parentUrl) {
88
+ // strip off any trailing query params or hashes
89
+ const queryHashIndex = parentUrl.indexOf('?', parentUrl.indexOf('#') === -1 ? parentUrl.indexOf('#') : parentUrl.length);
90
+ if (queryHashIndex !== -1)
91
+ parentUrl = parentUrl.slice(0, queryHashIndex);
92
+ if (relUrl.indexOf('\\') !== -1)
93
+ relUrl = relUrl.replace(backslashRegEx, '/');
94
+ // protocol-relative
95
+ if (relUrl[0] === '/' && relUrl[1] === '/') {
96
+ return parentUrl.slice(0, parentUrl.indexOf(':') + 1) + relUrl;
97
+ }
98
+ // relative-url
99
+ else if (relUrl[0] === '.' && (relUrl[1] === '/' || relUrl[1] === '.' && (relUrl[2] === '/' || relUrl.length === 2 && (relUrl += '/')) ||
100
+ relUrl.length === 1 && (relUrl += '/')) ||
101
+ relUrl[0] === '/') {
102
+ const parentProtocol = parentUrl.slice(0, parentUrl.indexOf(':') + 1);
103
+ // Disabled, but these cases will give inconsistent results for deep backtracking
104
+ //if (parentUrl[parentProtocol.length] !== '/')
105
+ // throw new Error('Cannot resolve');
106
+ // read pathname from parent URL
107
+ // pathname taken to be part after leading "/"
108
+ let pathname;
109
+ if (parentUrl[parentProtocol.length + 1] === '/') {
110
+ // resolving to a :// so we need to read out the auth and host
111
+ if (parentProtocol !== 'file:') {
112
+ pathname = parentUrl.slice(parentProtocol.length + 2);
113
+ pathname = pathname.slice(pathname.indexOf('/') + 1);
114
+ }
115
+ else {
116
+ pathname = parentUrl.slice(8);
117
+ }
118
+ }
119
+ else {
120
+ // resolving to :/ so pathname is the /... part
121
+ pathname = parentUrl.slice(parentProtocol.length + (parentUrl[parentProtocol.length] === '/'));
122
+ }
123
+
124
+ if (relUrl[0] === '/')
125
+ return parentUrl.slice(0, parentUrl.length - pathname.length - 1) + relUrl;
126
+
127
+ // join together and split for removal of .. and . segments
128
+ // looping the string instead of anything fancy for perf reasons
129
+ // '../../../../../z' resolved to 'x/y' is just 'z'
130
+ const segmented = pathname.slice(0, pathname.lastIndexOf('/') + 1) + relUrl;
131
+
132
+ const output = [];
133
+ let segmentIndex = -1;
134
+ for (let i = 0; i < segmented.length; i++) {
135
+ // busy reading a segment - only terminate on '/'
136
+ if (segmentIndex !== -1) {
137
+ if (segmented[i] === '/') {
138
+ output.push(segmented.slice(segmentIndex, i + 1));
139
+ segmentIndex = -1;
140
+ }
141
+ continue;
142
+ }
143
+ // new segment - check if it is relative
144
+ else if (segmented[i] === '.') {
145
+ // ../ segment
146
+ if (segmented[i + 1] === '.' && (segmented[i + 2] === '/' || i + 2 === segmented.length)) {
147
+ output.pop();
148
+ i += 2;
149
+ continue;
150
+ }
151
+ // ./ segment
152
+ else if (segmented[i + 1] === '/' || i + 1 === segmented.length) {
153
+ i += 1;
154
+ continue;
155
+ }
156
+ }
157
+ // it is the start of a new segment
158
+ while (segmented[i] === '/') i++;
159
+ segmentIndex = i;
160
+ }
161
+ // finish reading out the last segment
162
+ if (segmentIndex !== -1)
163
+ output.push(segmented.slice(segmentIndex));
164
+ return parentUrl.slice(0, parentUrl.length - pathname.length) + output.join('');
165
+ }
166
+ }
167
+
168
+ function resolveAndComposeImportMap (json, baseUrl, parentMap) {
169
+ const outMap = { imports: Object.assign({}, parentMap.imports), scopes: Object.assign({}, parentMap.scopes) };
170
+
171
+ if (json.imports)
172
+ resolveAndComposePackages(json.imports, outMap.imports, baseUrl, parentMap);
173
+
174
+ if (json.scopes)
175
+ for (let s in json.scopes) {
176
+ const resolvedScope = resolveUrl(s, baseUrl);
177
+ resolveAndComposePackages(json.scopes[s], outMap.scopes[resolvedScope] || (outMap.scopes[resolvedScope] = {}), baseUrl, parentMap);
178
+ }
179
+
180
+ return outMap;
181
+ }
182
+
183
+ function getMatch (path, matchObj) {
184
+ if (matchObj[path])
185
+ return path;
186
+ let sepIndex = path.length;
187
+ do {
188
+ const segment = path.slice(0, sepIndex + 1);
189
+ if (segment in matchObj)
190
+ return segment;
191
+ } while ((sepIndex = path.lastIndexOf('/', sepIndex - 1)) !== -1)
192
+ }
193
+
194
+ function applyPackages (id, packages) {
195
+ const pkgName = getMatch(id, packages);
196
+ if (pkgName) {
197
+ const pkg = packages[pkgName];
198
+ if (pkg === null) return;
199
+ return pkg + id.slice(pkgName.length);
200
+ }
201
+ }
202
+
203
+
204
+ function resolveImportMap (importMap, resolvedOrPlain, parentUrl) {
205
+ let scopeUrl = parentUrl && getMatch(parentUrl, importMap.scopes);
206
+ while (scopeUrl) {
207
+ const packageResolution = applyPackages(resolvedOrPlain, importMap.scopes[scopeUrl]);
208
+ if (packageResolution)
209
+ return packageResolution;
210
+ scopeUrl = getMatch(scopeUrl.slice(0, scopeUrl.lastIndexOf('/')), importMap.scopes);
211
+ }
212
+ return applyPackages(resolvedOrPlain, importMap.imports) || resolvedOrPlain.indexOf(':') !== -1 && resolvedOrPlain;
213
+ }
214
+
215
+ function resolveAndComposePackages (packages, outPackages, baseUrl, parentMap) {
216
+ for (let p in packages) {
217
+ const resolvedLhs = resolveIfNotPlainOrUrl(p, baseUrl) || p;
218
+ if ((!shimMode || !mapOverrides) && outPackages[resolvedLhs] && (outPackages[resolvedLhs] !== packages[resolvedLhs])) {
219
+ throw Error(`Rejected map override "${resolvedLhs}" from ${outPackages[resolvedLhs]} to ${packages[resolvedLhs]}.`);
220
+ }
221
+ let target = packages[p];
222
+ if (typeof target !== 'string')
223
+ continue;
224
+ const mapped = resolveImportMap(parentMap, resolveIfNotPlainOrUrl(target, baseUrl) || target, baseUrl);
225
+ if (mapped) {
226
+ outPackages[resolvedLhs] = mapped;
227
+ continue;
228
+ }
229
+ console.warn(`Mapping "${p}" -> "${packages[p]}" does not resolve`);
230
+ }
231
+ }
232
+
233
+ let err;
234
+ window.addEventListener('error', _err => err = _err);
235
+ function dynamicImportScript (url, { errUrl = url } = {}) {
236
+ err = undefined;
237
+ const src = createBlob(`import*as m from'${url}';self._esmsi=m`);
238
+ const s = Object.assign(document.createElement('script'), { type: 'module', src });
239
+ s.setAttribute('nonce', nonce);
240
+ s.setAttribute('noshim', '');
241
+ const p = new Promise((resolve, reject) => {
242
+ // Safari is unique in supporting module script error events
243
+ s.addEventListener('error', cb);
244
+ s.addEventListener('load', cb);
245
+
246
+ function cb (_err) {
247
+ document.head.removeChild(s);
248
+ if (self._esmsi) {
249
+ resolve(self._esmsi, baseUrl);
250
+ self._esmsi = undefined;
251
+ }
252
+ else {
253
+ reject(!(_err instanceof Event) && _err || err && err.error || new Error(`Error loading or executing the graph of ${errUrl} (check the console for ${src}).`));
254
+ err = undefined;
255
+ }
256
+ }
257
+ });
258
+ document.head.appendChild(s);
259
+ return p;
260
+ }
261
+
262
+ let dynamicImport = dynamicImportScript;
263
+
264
+ const supportsDynamicImportCheck = dynamicImportScript(createBlob('export default u=>import(u)')).then(_dynamicImport => {
265
+ if (_dynamicImport)
266
+ dynamicImport = _dynamicImport.default;
267
+ return !!_dynamicImport;
268
268
  }, noop);
269
269
 
270
- // support browsers without dynamic import support (eg Firefox 6x)
271
- let supportsJsonAssertions = false;
272
- let supportsCssAssertions = false;
273
-
274
- let supportsImportMeta = false;
275
- let supportsImportMaps = false;
276
-
277
- let supportsDynamicImport = false;
278
-
279
- const featureDetectionPromise = Promise.resolve(supportsDynamicImportCheck).then(_supportsDynamicImport => {
280
- if (!_supportsDynamicImport)
281
- return;
282
- supportsDynamicImport = true;
283
-
284
- return Promise.all([
285
- dynamicImport(createBlob('import.meta')).then(() => supportsImportMeta = true, noop),
286
- cssModulesEnabled && dynamicImport(createBlob('import"data:text/css,{}"assert{type:"css"}')).then(() => supportsCssAssertions = true, noop),
287
- jsonModulesEnabled && dynamicImport(createBlob('import"data:text/json,{}"assert{type:"json"}')).then(() => supportsJsonAssertions = true, noop),
288
- new Promise(resolve => {
289
- self._$s = v => {
290
- document.head.removeChild(iframe);
291
- if (v) supportsImportMaps = true;
292
- delete self._$s;
293
- resolve();
294
- };
295
- const iframe = document.createElement('iframe');
296
- iframe.style.display = 'none';
297
- iframe.srcdoc = `<script type=importmap nonce="${nonce}">{"imports":{"x":"data:text/javascript,"}}<${''}/script><script nonce="${nonce}">import('x').then(()=>1,()=>0).then(v=>parent._$s(v))<${''}/script>`;
298
- document.head.appendChild(iframe);
299
- })
300
- ]);
270
+ // support browsers without dynamic import support (eg Firefox 6x)
271
+ let supportsJsonAssertions = false;
272
+ let supportsCssAssertions = false;
273
+
274
+ let supportsImportMeta = false;
275
+ let supportsImportMaps = false;
276
+
277
+ let supportsDynamicImport = false;
278
+
279
+ const featureDetectionPromise = Promise.resolve(supportsDynamicImportCheck).then(_supportsDynamicImport => {
280
+ if (!_supportsDynamicImport)
281
+ return;
282
+ supportsDynamicImport = true;
283
+
284
+ return Promise.all([
285
+ dynamicImport(createBlob('import.meta')).then(() => supportsImportMeta = true, noop),
286
+ cssModulesEnabled && dynamicImport(createBlob('import"data:text/css,{}"assert{type:"css"}')).then(() => supportsCssAssertions = true, noop),
287
+ jsonModulesEnabled && dynamicImport(createBlob('import"data:text/json,{}"assert{type:"json"}')).then(() => supportsJsonAssertions = true, noop),
288
+ new Promise(resolve => {
289
+ self._$s = v => {
290
+ document.head.removeChild(iframe);
291
+ if (v) supportsImportMaps = true;
292
+ delete self._$s;
293
+ resolve();
294
+ };
295
+ const iframe = document.createElement('iframe');
296
+ iframe.style.display = 'none';
297
+ iframe.srcdoc = `<script type=importmap nonce="${nonce}">{"imports":{"x":"data:text/javascript,"}}<${''}/script><script nonce="${nonce}">import('x').then(()=>1,()=>0).then(v=>parent._$s(v))<${''}/script>`;
298
+ document.head.appendChild(iframe);
299
+ })
300
+ ]);
301
301
  });
302
302
 
303
303
  /* es-module-lexer 0.10.4 */
304
304
  let e,a,r,s=2<<18;const i=1===new Uint8Array(new Uint16Array([1]).buffer)[0]?function(e,a){const r=e.length;let s=0;for(;s<r;)a[s]=e.charCodeAt(s++);}:function(e,a){const r=e.length;let s=0;for(;s<r;){const r=e.charCodeAt(s);a[s++]=(255&r)<<8|r>>>8;}},t="xportmportlassetafromssertvoyiedeleinstantyreturdebuggeawaithrwhileforifcatcfinallels";let c$1,f,n;function parse(k,l="@"){c$1=k,f=l;const u=2*c$1.length+(2<<18);if(u>s||!e){for(;u>s;)s*=2;a=new ArrayBuffer(s),i(t,new Uint16Array(a,16,85)),e=function(e,a,r){"use asm";var s=new e.Int8Array(r),i=new e.Int16Array(r),t=new e.Int32Array(r),c=new e.Uint8Array(r),f=new e.Uint16Array(r),n=992;function b(e){e=e|0;var a=0,r=0,c=0,b=0,u=0,w=0,v=0;v=n;n=n+11520|0;u=v+2048|0;s[763]=1;i[377]=0;i[378]=0;i[379]=0;i[380]=-1;t[57]=t[2];s[764]=0;t[56]=0;s[762]=0;t[58]=v+10496;t[59]=v+2304;t[60]=v;s[765]=0;e=(t[3]|0)+-2|0;t[61]=e;a=e+(t[54]<<1)|0;t[62]=a;e:while(1){r=e+2|0;t[61]=r;if(e>>>0>=a>>>0){b=18;break}a:do{switch(i[r>>1]|0){case 9:case 10:case 11:case 12:case 13:case 32:break;case 101:{if((((i[379]|0)==0?D(r)|0:0)?(m(e+4|0,16,10)|0)==0:0)?(k(),(s[763]|0)==0):0){b=9;break e}else b=17;break}case 105:{if(D(r)|0?(m(e+4|0,26,10)|0)==0:0){l();b=17;}else b=17;break}case 59:{b=17;break}case 47:switch(i[e+4>>1]|0){case 47:{j();break a}case 42:{y(1);break a}default:{b=16;break e}}default:{b=16;break e}}}while(0);if((b|0)==17){b=0;t[57]=t[61];}e=t[61]|0;a=t[62]|0;}if((b|0)==9){e=t[61]|0;t[57]=e;b=19;}else if((b|0)==16){s[763]=0;t[61]=e;b=19;}else if((b|0)==18)if(!(s[762]|0)){e=r;b=19;}else e=0;do{if((b|0)==19){e:while(1){a=e+2|0;t[61]=a;c=a;if(e>>>0>=(t[62]|0)>>>0){b=75;break}a:do{switch(i[a>>1]|0){case 9:case 10:case 11:case 12:case 13:case 32:break;case 101:{if(((i[379]|0)==0?D(a)|0:0)?(m(e+4|0,16,10)|0)==0:0){k();b=74;}else b=74;break}case 105:{if(D(a)|0?(m(e+4|0,26,10)|0)==0:0){l();b=74;}else b=74;break}case 99:{if((D(a)|0?(m(e+4|0,36,8)|0)==0:0)?M(i[e+12>>1]|0)|0:0){s[765]=1;b=74;}else b=74;break}case 40:{r=t[57]|0;c=t[59]|0;b=i[379]|0;i[379]=b+1<<16>>16;t[c+((b&65535)<<2)>>2]=r;b=74;break}case 41:{a=i[379]|0;if(!(a<<16>>16)){b=36;break e}a=a+-1<<16>>16;i[379]=a;r=i[378]|0;if(r<<16>>16!=0?(w=t[(t[60]|0)+((r&65535)+-1<<2)>>2]|0,(t[w+20>>2]|0)==(t[(t[59]|0)+((a&65535)<<2)>>2]|0)):0){a=w+4|0;if(!(t[a>>2]|0))t[a>>2]=c;t[w+12>>2]=e+4;i[378]=r+-1<<16>>16;b=74;}else b=74;break}case 123:{b=t[57]|0;c=t[51]|0;e=b;do{if((i[b>>1]|0)==41&(c|0)!=0?(t[c+4>>2]|0)==(b|0):0){a=t[52]|0;t[51]=a;if(!a){t[47]=0;break}else {t[a+28>>2]=0;break}}}while(0);r=i[379]|0;b=r&65535;s[u+b>>0]=s[765]|0;s[765]=0;c=t[59]|0;i[379]=r+1<<16>>16;t[c+(b<<2)>>2]=e;b=74;break}case 125:{e=i[379]|0;if(!(e<<16>>16)){b=49;break e}r=e+-1<<16>>16;i[379]=r;a=i[380]|0;if(e<<16>>16!=a<<16>>16)if(a<<16>>16!=-1&(r&65535)<(a&65535)){b=53;break e}else {b=74;break a}else {c=t[58]|0;b=(i[377]|0)+-1<<16>>16;i[377]=b;i[380]=i[c+((b&65535)<<1)>>1]|0;h();b=74;break a}}case 39:{d(39);b=74;break}case 34:{d(34);b=74;break}case 47:switch(i[e+4>>1]|0){case 47:{j();break a}case 42:{y(1);break a}default:{a=t[57]|0;r=i[a>>1]|0;r:do{if(!(U(r)|0)){switch(r<<16>>16){case 41:if(q(t[(t[59]|0)+(f[379]<<2)>>2]|0)|0){b=71;break r}else {b=68;break r}case 125:break;default:{b=68;break r}}e=f[379]|0;if(!(p(t[(t[59]|0)+(e<<2)>>2]|0)|0)?(s[u+e>>0]|0)==0:0)b=68;else b=71;}else switch(r<<16>>16){case 46:if(((i[a+-2>>1]|0)+-48&65535)<10){b=68;break r}else {b=71;break r}case 43:if((i[a+-2>>1]|0)==43){b=68;break r}else {b=71;break r}case 45:if((i[a+-2>>1]|0)==45){b=68;break r}else {b=71;break r}default:{b=71;break r}}}while(0);r:do{if((b|0)==68){b=0;if(!(o(a)|0)){switch(r<<16>>16){case 0:{b=71;break r}case 47:break;default:{e=1;break r}}if(!(s[764]|0))e=1;else b=71;}else b=71;}}while(0);if((b|0)==71){g();e=0;}s[764]=e;b=74;break a}}case 96:{h();b=74;break}default:b=74;}}while(0);if((b|0)==74){b=0;t[57]=t[61];}e=t[61]|0;}if((b|0)==36){L();e=0;break}else if((b|0)==49){L();e=0;break}else if((b|0)==53){L();e=0;break}else if((b|0)==75){e=(i[380]|0)==-1&(i[379]|0)==0&(s[762]|0)==0&(i[378]|0)==0;break}}}while(0);n=v;return e|0}function k(){var e=0,a=0,r=0,c=0,f=0,n=0;f=t[61]|0;n=f+12|0;t[61]=n;a=w(1)|0;e=t[61]|0;if(!((e|0)==(n|0)?!(I(a)|0):0))c=3;e:do{if((c|0)==3){a:do{switch(a<<16>>16){case 100:{B(e,e+14|0);break e}case 97:{t[61]=e+10;w(1)|0;e=t[61]|0;c=6;break}case 102:{c=6;break}case 99:{if((m(e+2|0,36,8)|0)==0?(r=e+10|0,$(i[r>>1]|0)|0):0){t[61]=r;f=w(1)|0;n=t[61]|0;E(f)|0;B(n,t[61]|0);t[61]=(t[61]|0)+-2;break e}e=e+4|0;t[61]=e;c=13;break}case 108:case 118:{c=13;break}case 123:{t[61]=e+2;e=w(1)|0;r=t[61]|0;while(1){if(N(e)|0){d(e);e=(t[61]|0)+2|0;t[61]=e;}else {E(e)|0;e=t[61]|0;}w(1)|0;e=C(r,e)|0;if(e<<16>>16==44){t[61]=(t[61]|0)+2;e=w(1)|0;}a=r;r=t[61]|0;if(e<<16>>16==125){c=32;break}if((r|0)==(a|0)){c=29;break}if(r>>>0>(t[62]|0)>>>0){c=31;break}}if((c|0)==29){L();break e}else if((c|0)==31){L();break e}else if((c|0)==32){t[61]=r+2;c=34;break a}break}case 42:{t[61]=e+2;w(1)|0;c=t[61]|0;C(c,c)|0;c=34;break}default:{}}}while(0);if((c|0)==6){t[61]=e+16;e=w(1)|0;if(e<<16>>16==42){t[61]=(t[61]|0)+2;e=w(1)|0;}n=t[61]|0;E(e)|0;B(n,t[61]|0);t[61]=(t[61]|0)+-2;break}else if((c|0)==13){e=e+4|0;t[61]=e;s[763]=0;a:while(1){t[61]=e+2;n=w(1)|0;e=t[61]|0;switch((E(n)|0)<<16>>16){case 91:case 123:{c=15;break a}default:{}}a=t[61]|0;if((a|0)==(e|0))break e;B(e,a);switch((w(1)|0)<<16>>16){case 61:{c=19;break a}case 44:break;default:{c=20;break a}}e=t[61]|0;}if((c|0)==15){t[61]=(t[61]|0)+-2;break}else if((c|0)==19){t[61]=(t[61]|0)+-2;break}else if((c|0)==20){t[61]=(t[61]|0)+-2;break}}else if((c|0)==34)a=w(1)|0;e=t[61]|0;if(a<<16>>16==102?(m(e+2|0,52,6)|0)==0:0){t[61]=e+8;u(f,w(1)|0);break}t[61]=e+-2;}}while(0);return}function l(){var e=0,a=0,r=0,c=0,f=0;f=t[61]|0;a=f+12|0;t[61]=a;e:do{switch((w(1)|0)<<16>>16){case 40:{e=t[61]|0;a=t[59]|0;r=i[379]|0;i[379]=r+1<<16>>16;t[a+((r&65535)<<2)>>2]=e;if((i[t[57]>>1]|0)!=46){e=t[61]|0;t[61]=e+2;r=w(1)|0;v(f,t[61]|0,0,e);e=t[51]|0;a=t[60]|0;f=i[378]|0;i[378]=f+1<<16>>16;t[a+((f&65535)<<2)>>2]=e;switch(r<<16>>16){case 39:{d(39);break}case 34:{d(34);break}default:{t[61]=(t[61]|0)+-2;break e}}e=(t[61]|0)+2|0;t[61]=e;switch((w(1)|0)<<16>>16){case 44:{t[61]=(t[61]|0)+2;w(1)|0;r=t[51]|0;t[r+4>>2]=e;f=t[61]|0;t[r+16>>2]=f;s[r+24>>0]=1;t[61]=f+-2;break e}case 41:{i[379]=(i[379]|0)+-1<<16>>16;f=t[51]|0;t[f+4>>2]=e;t[f+12>>2]=(t[61]|0)+2;s[f+24>>0]=1;i[378]=(i[378]|0)+-1<<16>>16;break e}default:{t[61]=(t[61]|0)+-2;break e}}}break}case 46:{t[61]=(t[61]|0)+2;if(((w(1)|0)<<16>>16==109?(e=t[61]|0,(m(e+2|0,44,6)|0)==0):0)?(i[t[57]>>1]|0)!=46:0)v(f,f,e+8|0,2);break}case 42:case 39:case 34:{c=16;break}case 123:{e=t[61]|0;if(i[379]|0){t[61]=e+-2;break e}while(1){if(e>>>0>=(t[62]|0)>>>0)break;e=w(1)|0;if(!(N(e)|0)){if(e<<16>>16==125){c=31;break}}else d(e);e=(t[61]|0)+2|0;t[61]=e;}if((c|0)==31)t[61]=(t[61]|0)+2;w(1)|0;e=t[61]|0;if(m(e,50,8)|0){L();break e}t[61]=e+8;e=w(1)|0;if(N(e)|0){u(f,e);break e}else {L();break e}}default:if((t[61]|0)!=(a|0))c=16;}}while(0);do{if((c|0)==16){if(i[379]|0){t[61]=(t[61]|0)+-2;break}e=t[62]|0;a=t[61]|0;while(1){if(a>>>0>=e>>>0){c=23;break}r=i[a>>1]|0;if(N(r)|0){c=21;break}c=a+2|0;t[61]=c;a=c;}if((c|0)==21){u(f,r);break}else if((c|0)==23){L();break}}}while(0);return}function u(e,a){e=e|0;a=a|0;var r=0,s=0;r=(t[61]|0)+2|0;switch(a<<16>>16){case 39:{d(39);s=5;break}case 34:{d(34);s=5;break}default:L();}do{if((s|0)==5){v(e,r,t[61]|0,1);t[61]=(t[61]|0)+2;s=(w(0)|0)<<16>>16==97;a=t[61]|0;if(s?(m(a+2|0,58,10)|0)==0:0){t[61]=a+12;if((w(1)|0)<<16>>16!=123){t[61]=a;break}e=t[61]|0;r=e;e:while(1){t[61]=r+2;r=w(1)|0;switch(r<<16>>16){case 39:{d(39);t[61]=(t[61]|0)+2;r=w(1)|0;break}case 34:{d(34);t[61]=(t[61]|0)+2;r=w(1)|0;break}default:r=E(r)|0;}if(r<<16>>16!=58){s=16;break}t[61]=(t[61]|0)+2;switch((w(1)|0)<<16>>16){case 39:{d(39);break}case 34:{d(34);break}default:{s=20;break e}}t[61]=(t[61]|0)+2;switch((w(1)|0)<<16>>16){case 125:{s=25;break e}case 44:break;default:{s=24;break e}}t[61]=(t[61]|0)+2;if((w(1)|0)<<16>>16==125){s=25;break}r=t[61]|0;}if((s|0)==16){t[61]=a;break}else if((s|0)==20){t[61]=a;break}else if((s|0)==24){t[61]=a;break}else if((s|0)==25){s=t[51]|0;t[s+16>>2]=e;t[s+12>>2]=(t[61]|0)+2;break}}t[61]=a+-2;}}while(0);return}function o(e){e=e|0;e:do{switch(i[e>>1]|0){case 100:switch(i[e+-2>>1]|0){case 105:{e=S(e+-4|0,68,2)|0;break e}case 108:{e=S(e+-4|0,72,3)|0;break e}default:{e=0;break e}}case 101:{switch(i[e+-2>>1]|0){case 115:break;case 116:{e=S(e+-4|0,78,4)|0;break e}default:{e=0;break e}}switch(i[e+-4>>1]|0){case 108:{e=O(e+-6|0,101)|0;break e}case 97:{e=O(e+-6|0,99)|0;break e}default:{e=0;break e}}}case 102:{if((i[e+-2>>1]|0)==111?(i[e+-4>>1]|0)==101:0)switch(i[e+-6>>1]|0){case 99:{e=S(e+-8|0,86,6)|0;break e}case 112:{e=S(e+-8|0,98,2)|0;break e}default:{e=0;break e}}else e=0;break}case 110:{e=e+-2|0;if(O(e,105)|0)e=1;else e=S(e,102,5)|0;break}case 111:{e=O(e+-2|0,100)|0;break}case 114:{e=S(e+-2|0,112,7)|0;break}case 116:{e=S(e+-2|0,126,4)|0;break}case 119:switch(i[e+-2>>1]|0){case 101:{e=O(e+-4|0,110)|0;break e}case 111:{e=S(e+-4|0,134,3)|0;break e}default:{e=0;break e}}default:e=0;}}while(0);return e|0}function h(){var e=0,a=0,r=0;a=t[62]|0;r=t[61]|0;e:while(1){e=r+2|0;if(r>>>0>=a>>>0){a=8;break}switch(i[e>>1]|0){case 96:{a=9;break e}case 36:{if((i[r+4>>1]|0)==123){a=6;break e}break}case 92:{e=r+4|0;break}default:{}}r=e;}if((a|0)==6){t[61]=r+4;e=i[380]|0;a=t[58]|0;r=i[377]|0;i[377]=r+1<<16>>16;i[a+((r&65535)<<1)>>1]=e;r=(i[379]|0)+1<<16>>16;i[379]=r;i[380]=r;}else if((a|0)==8){t[61]=e;L();}else if((a|0)==9)t[61]=e;return}function w(e){e=e|0;var a=0,r=0,s=0;r=t[61]|0;e:do{a=i[r>>1]|0;a:do{if(a<<16>>16!=47)if(e)if(M(a)|0)break;else break e;else if(z(a)|0)break;else break e;else switch(i[r+2>>1]|0){case 47:{j();break a}case 42:{y(e);break a}default:{a=47;break e}}}while(0);s=t[61]|0;r=s+2|0;t[61]=r;}while(s>>>0<(t[62]|0)>>>0);return a|0}function d(e){e=e|0;var a=0,r=0,s=0,c=0;c=t[62]|0;a=t[61]|0;while(1){s=a+2|0;if(a>>>0>=c>>>0){a=9;break}r=i[s>>1]|0;if(r<<16>>16==e<<16>>16){a=10;break}if(r<<16>>16==92){r=a+4|0;if((i[r>>1]|0)==13){a=a+6|0;a=(i[a>>1]|0)==10?a:r;}else a=r;}else if(T(r)|0){a=9;break}else a=s;}if((a|0)==9){t[61]=s;L();}else if((a|0)==10)t[61]=s;return}function v(e,a,r,i){e=e|0;a=a|0;r=r|0;i=i|0;var c=0,f=0;c=t[55]|0;t[55]=c+32;f=t[51]|0;t[((f|0)==0?188:f+28|0)>>2]=c;t[52]=f;t[51]=c;t[c+8>>2]=e;if(2==(i|0))e=r;else e=1==(i|0)?r+2|0:0;t[c+12>>2]=e;t[c>>2]=a;t[c+4>>2]=r;t[c+16>>2]=0;t[c+20>>2]=i;s[c+24>>0]=1==(i|0)&1;t[c+28>>2]=0;return}function A(){var e=0,a=0,r=0;r=t[62]|0;a=t[61]|0;e:while(1){e=a+2|0;if(a>>>0>=r>>>0){a=6;break}switch(i[e>>1]|0){case 13:case 10:{a=6;break e}case 93:{a=7;break e}case 92:{e=a+4|0;break}default:{}}a=e;}if((a|0)==6){t[61]=e;L();e=0;}else if((a|0)==7){t[61]=e;e=93;}return e|0}function C(e,a){e=e|0;a=a|0;var r=0,s=0;r=t[61]|0;s=i[r>>1]|0;if(s<<16>>16==97){t[61]=r+4;r=w(1)|0;e=t[61]|0;if(N(r)|0){d(r);a=(t[61]|0)+2|0;t[61]=a;}else {E(r)|0;a=t[61]|0;}s=w(1)|0;r=t[61]|0;}if((r|0)!=(e|0))B(e,a);return s|0}function g(){var e=0,a=0,r=0;e:while(1){e=t[61]|0;a=e+2|0;t[61]=a;if(e>>>0>=(t[62]|0)>>>0){r=7;break}switch(i[a>>1]|0){case 13:case 10:{r=7;break e}case 47:break e;case 91:{A()|0;break}case 92:{t[61]=e+4;break}default:{}}}if((r|0)==7)L();return}function p(e){e=e|0;switch(i[e>>1]|0){case 62:{e=(i[e+-2>>1]|0)==61;break}case 41:case 59:{e=1;break}case 104:{e=S(e+-2|0,160,4)|0;break}case 121:{e=S(e+-2|0,168,6)|0;break}case 101:{e=S(e+-2|0,180,3)|0;break}default:e=0;}return e|0}function y(e){e=e|0;var a=0,r=0,s=0,c=0,f=0;c=(t[61]|0)+2|0;t[61]=c;r=t[62]|0;while(1){a=c+2|0;if(c>>>0>=r>>>0)break;s=i[a>>1]|0;if(!e?T(s)|0:0)break;if(s<<16>>16==42?(i[c+4>>1]|0)==47:0){f=8;break}c=a;}if((f|0)==8){t[61]=a;a=c+4|0;}t[61]=a;return}function m(e,a,r){e=e|0;a=a|0;r=r|0;var i=0,t=0;e:do{if(!r)e=0;else {while(1){i=s[e>>0]|0;t=s[a>>0]|0;if(i<<24>>24!=t<<24>>24)break;r=r+-1|0;if(!r){e=0;break e}else {e=e+1|0;a=a+1|0;}}e=(i&255)-(t&255)|0;}}while(0);return e|0}function I(e){e=e|0;e:do{switch(e<<16>>16){case 38:case 37:case 33:{e=1;break}default:if((e&-8)<<16>>16==40|(e+-58&65535)<6)e=1;else {switch(e<<16>>16){case 91:case 93:case 94:{e=1;break e}default:{}}e=(e+-123&65535)<4;}}}while(0);return e|0}function U(e){e=e|0;e:do{switch(e<<16>>16){case 38:case 37:case 33:break;default:if(!((e+-58&65535)<6|(e+-40&65535)<7&e<<16>>16!=41)){switch(e<<16>>16){case 91:case 94:break e;default:{}}return e<<16>>16!=125&(e+-123&65535)<4|0}}}while(0);return 1}function x(e){e=e|0;var a=0,r=0,s=0,c=0;r=n;n=n+16|0;s=r;t[s>>2]=0;t[54]=e;a=t[3]|0;c=a+(e<<1)|0;e=c+2|0;i[c>>1]=0;t[s>>2]=e;t[55]=e;t[47]=0;t[51]=0;t[49]=0;t[48]=0;t[53]=0;t[50]=0;n=r;return a|0}function S(e,a,r){e=e|0;a=a|0;r=r|0;var s=0,c=0;s=e+(0-r<<1)|0;c=s+2|0;e=t[3]|0;if(c>>>0>=e>>>0?(m(c,a,r<<1)|0)==0:0)if((c|0)==(e|0))e=1;else e=$(i[s>>1]|0)|0;else e=0;return e|0}function O(e,a){e=e|0;a=a|0;var r=0;r=t[3]|0;if(r>>>0<=e>>>0?(i[e>>1]|0)==a<<16>>16:0)if((r|0)==(e|0))r=1;else r=$(i[e+-2>>1]|0)|0;else r=0;return r|0}function $(e){e=e|0;e:do{if((e+-9&65535)<5)e=1;else {switch(e<<16>>16){case 32:case 160:{e=1;break e}default:{}}e=e<<16>>16!=46&(I(e)|0);}}while(0);return e|0}function j(){var e=0,a=0,r=0;e=t[62]|0;r=t[61]|0;e:while(1){a=r+2|0;if(r>>>0>=e>>>0)break;switch(i[a>>1]|0){case 13:case 10:break e;default:r=a;}}t[61]=a;return}function B(e,a){e=e|0;a=a|0;var r=0,s=0;r=t[55]|0;t[55]=r+12;s=t[53]|0;t[((s|0)==0?192:s+8|0)>>2]=r;t[53]=r;t[r>>2]=e;t[r+4>>2]=a;t[r+8>>2]=0;return}function E(e){e=e|0;while(1){if(M(e)|0)break;if(I(e)|0)break;e=(t[61]|0)+2|0;t[61]=e;e=i[e>>1]|0;if(!(e<<16>>16)){e=0;break}}return e|0}function P(){var e=0;e=t[(t[49]|0)+20>>2]|0;switch(e|0){case 1:{e=-1;break}case 2:{e=-2;break}default:e=e-(t[3]|0)>>1;}return e|0}function q(e){e=e|0;if(!(S(e,140,5)|0)?!(S(e,150,3)|0):0)e=S(e,156,2)|0;else e=1;return e|0}function z(e){e=e|0;switch(e<<16>>16){case 160:case 32:case 12:case 11:case 9:{e=1;break}default:e=0;}return e|0}function D(e){e=e|0;if((t[3]|0)==(e|0))e=1;else e=$(i[e+-2>>1]|0)|0;return e|0}function F(){var e=0;e=t[(t[49]|0)+12>>2]|0;if(!e)e=-1;else e=e-(t[3]|0)>>1;return e|0}function G(){var e=0;e=t[(t[49]|0)+16>>2]|0;if(!e)e=-1;else e=e-(t[3]|0)>>1;return e|0}function H(){var e=0;e=t[(t[49]|0)+4>>2]|0;if(!e)e=-1;else e=e-(t[3]|0)>>1;return e|0}function J(){var e=0;e=t[49]|0;e=t[((e|0)==0?188:e+28|0)>>2]|0;t[49]=e;return (e|0)!=0|0}function K(){var e=0;e=t[50]|0;e=t[((e|0)==0?192:e+8|0)>>2]|0;t[50]=e;return (e|0)!=0|0}function L(){s[762]=1;t[56]=(t[61]|0)-(t[3]|0)>>1;t[61]=(t[62]|0)+2;return}function M(e){e=e|0;return (e|128)<<16>>16==160|(e+-9&65535)<5|0}function N(e){e=e|0;return e<<16>>16==39|e<<16>>16==34|0}function Q(){return (t[(t[49]|0)+8>>2]|0)-(t[3]|0)>>1|0}function R(){return (t[(t[50]|0)+4>>2]|0)-(t[3]|0)>>1|0}function T(e){e=e|0;return e<<16>>16==13|e<<16>>16==10|0}function V(){return (t[t[49]>>2]|0)-(t[3]|0)>>1|0}function W(){return (t[t[50]>>2]|0)-(t[3]|0)>>1|0}function X(){return c[(t[49]|0)+24>>0]|0|0}function Y(e){e=e|0;t[3]=e;return}function Z(){return (s[763]|0)!=0|0}function _(){return t[56]|0}function ee(e){e=e|0;n=e+992+15&-16;return 992}return {su:ee,ai:G,e:_,ee:R,es:W,f:Z,id:P,ie:H,ip:X,is:V,p:b,re:K,ri:J,sa:x,se:F,ses:Y,ss:Q}}("undefined"!=typeof self?self:global,{},a),r=e.su(2*c$1.length+(2<<17));}const h=c$1.length+1;e.ses(r),e.sa(h-1),i(c$1,new Uint16Array(a,r,h)),e.p()||(n=e.e(),o());const w=[],d=[];for(;e.ri();){const a=e.is(),r=e.ie(),s=e.ai(),i=e.id(),t=e.ss(),f=e.se();let n;e.ip()&&(n=b(-1===i?a:a+1,c$1.charCodeAt(-1===i?a-1:a))),w.push({n:n,s:a,e:r,ss:t,se:f,d:i,a:s});}for(;e.re();){const a=e.es(),r=c$1.charCodeAt(a);d.push(34===r||39===r?b(a+1,r):c$1.slice(e.es(),e.ee()));}return [w,d,!!e.f()]}function b(e,a){n=e;let r="",s=n;for(;;){n>=c$1.length&&o();const e=c$1.charCodeAt(n);if(e===a)break;92===e?(r+=c$1.slice(s,n),r+=k(),s=n):(8232===e||8233===e||u(e)&&o(),++n);}return r+=c$1.slice(s,n++),r}function k(){let e=c$1.charCodeAt(++n);switch(++n,e){case 110:return "\n";case 114:return "\r";case 120:return String.fromCharCode(l(2));case 117:return function(){let e;123===c$1.charCodeAt(n)?(++n,e=l(c$1.indexOf("}",n)-n),++n,e>1114111&&o()):e=l(4);return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}();case 116:return "\t";case 98:return "\b";case 118:return "\v";case 102:return "\f";case 13:10===c$1.charCodeAt(n)&&++n;case 10:return "";case 56:case 57:o();default:if(e>=48&&e<=55){let a=c$1.substr(n-1,3).match(/^[0-7]+/)[0],r=parseInt(a,8);return r>255&&(a=a.slice(0,-1),r=parseInt(a,8)),n+=a.length-1,e=c$1.charCodeAt(n),"0"===a&&56!==e&&57!==e||o(),String.fromCharCode(r)}return u(e)?"":String.fromCharCode(e)}}function l(e){const a=n;let r=0,s=0;for(let a=0;a<e;++a,++n){let e,i=c$1.charCodeAt(n);if(95!==i){if(i>=97)e=i-97+10;else if(i>=65)e=i-65+10;else {if(!(i>=48&&i<=57))break;e=i-48;}if(e>=16)break;s=i,r=16*r+e;}else 95!==s&&0!==a||o(),s=i;}return 95!==s&&n-a===e||o(),r}function u(e){return 13===e||10===e}function o(){throw Object.assign(Error(`Parse error ${f}:${c$1.slice(0,n).split("\n").length}:${n-c$1.lastIndexOf("\n",n-1)}`),{idx:n})}
305
305
 
306
- async function _resolve (id, parentUrl) {
307
- const urlResolved = resolveIfNotPlainOrUrl(id, parentUrl);
308
- return {
309
- r: resolveImportMap(importMap, urlResolved || id, parentUrl) || throwUnresolved(id, parentUrl),
310
- // b = bare specifier
311
- b: !urlResolved && !isURL(id)
312
- };
313
- }
314
-
315
- const resolve = resolveHook ? async (id, parentUrl) => {
316
- let result = resolveHook(id, parentUrl, defaultResolve);
317
- // will be deprecated in next major
318
- if (result && result.then)
319
- result = await result;
320
- return result ? { r: result, b: !resolveIfNotPlainOrUrl(id, parentUrl) && !isURL(id) } : _resolve(id, parentUrl);
321
- } : _resolve;
322
-
323
- // importShim('mod');
324
- // importShim('mod', { opts });
325
- // importShim('mod', { opts }, parentUrl);
326
- // importShim('mod', parentUrl);
327
- async function importShim (id, ...args) {
328
- // parentUrl if present will be the last argument
329
- let parentUrl = args[args.length - 1];
330
- if (typeof parentUrl !== 'string')
331
- parentUrl = baseUrl;
332
- // needed for shim check
333
- await initPromise;
334
- if (importHook) await importHook(id, typeof args[1] !== 'string' ? args[1] : {}, parentUrl);
335
- if (acceptingImportMaps || shimMode || !baselinePassthrough) {
336
- processImportMaps();
337
- if (!shimMode)
338
- acceptingImportMaps = false;
339
- }
340
- await importMapPromise;
341
- return topLevelLoad((await resolve(id, parentUrl)).r, { credentials: 'same-origin' });
342
- }
343
-
344
- self.importShim = importShim;
345
-
346
- function defaultResolve (id, parentUrl) {
347
- return resolveImportMap(importMap, resolveIfNotPlainOrUrl(id, parentUrl) || id, parentUrl) || throwUnresolved(id, parentUrl);
348
- }
349
-
350
- function throwUnresolved (id, parentUrl) {
351
- throw Error(`Unable to resolve specifier '${id}'${fromParent(parentUrl)}`);
352
- }
353
-
354
- const resolveSync = (id, parentUrl = baseUrl) => {
355
- parentUrl = `${parentUrl}`;
356
- const result = resolveHook && resolveHook(id, parentUrl, defaultResolve);
357
- return result && !result.then ? result : defaultResolve(id, parentUrl);
358
- };
359
-
360
- function metaResolve (id, parentUrl = this.url) {
361
- return resolveSync(id, parentUrl);
362
- }
363
-
364
- importShim.resolve = resolveSync;
365
- importShim.getImportMap = () => JSON.parse(JSON.stringify(importMap));
366
-
367
- const registry = importShim._r = {};
368
-
369
- async function loadAll (load, seen) {
370
- if (load.b || seen[load.u])
371
- return;
372
- seen[load.u] = 1;
373
- await load.L;
374
- await Promise.all(load.d.map(dep => loadAll(dep, seen)));
375
- if (!load.n)
376
- load.n = load.d.some(dep => dep.n);
377
- }
378
-
379
- let importMap = { imports: {}, scopes: {} };
380
- let importMapSrcOrLazy = false;
381
- let baselinePassthrough;
382
-
383
- const initPromise = featureDetectionPromise.then(() => {
384
- // shim mode is determined on initialization, no late shim mode
385
- if (!shimMode) {
386
- if (document.querySelectorAll('script[type=module-shim],script[type=importmap-shim],link[rel=modulepreload-shim]').length) {
387
- setShimMode();
388
- }
389
- else {
390
- let seenScript = false;
391
- for (const script of document.querySelectorAll('script[type=module],script[type=importmap]')) {
392
- if (!seenScript) {
393
- if (script.type === 'module')
394
- seenScript = true;
395
- }
396
- else if (script.type === 'importmap') {
397
- importMapSrcOrLazy = true;
398
- break;
399
- }
400
- }
401
- }
402
- }
403
- baselinePassthrough = esmsInitOptions.polyfillEnable !== true && supportsDynamicImport && supportsImportMeta && supportsImportMaps && (!jsonModulesEnabled || supportsJsonAssertions) && (!cssModulesEnabled || supportsCssAssertions) && !importMapSrcOrLazy && !false;
404
- if (shimMode || !baselinePassthrough) {
405
- new MutationObserver(mutations => {
406
- for (const mutation of mutations) {
407
- if (mutation.type !== 'childList') continue;
408
- for (const node of mutation.addedNodes) {
409
- if (node.tagName === 'SCRIPT') {
410
- if (node.type === (shimMode ? 'module-shim' : 'module'))
411
- processScript(node);
412
- if (node.type === (shimMode ? 'importmap-shim' : 'importmap'))
413
- processImportMap(node);
414
- }
415
- else if (node.tagName === 'LINK' && node.rel === (shimMode ? 'modulepreload-shim' : 'modulepreload'))
416
- processPreload(node);
417
- }
418
- }
419
- }).observe(document, { childList: true, subtree: true });
420
- processImportMaps();
421
- processScriptsAndPreloads();
422
- return undefined;
423
- }
424
- });
425
- let importMapPromise = initPromise;
426
- let firstPolyfillLoad = true;
427
- let acceptingImportMaps = true;
428
-
429
- async function topLevelLoad (url, fetchOpts, source, nativelyLoaded, lastStaticLoadPromise) {
430
- if (!shimMode)
431
- acceptingImportMaps = false;
432
- await importMapPromise;
433
- if (importHook) await importHook(id, typeof args[1] !== 'string' ? args[1] : {}, parentUrl);
434
- // early analysis opt-out - no need to even fetch if we have feature support
435
- if (!shimMode && baselinePassthrough) {
436
- // for polyfill case, only dynamic import needs a return value here, and dynamic import will never pass nativelyLoaded
437
- if (nativelyLoaded)
438
- return null;
439
- await lastStaticLoadPromise;
440
- return dynamicImport(source ? createBlob(source) : url, { errUrl: url || source });
441
- }
442
- const load = getOrCreateLoad(url, fetchOpts, null, source);
443
- const seen = {};
444
- await loadAll(load, seen);
445
- lastLoad = undefined;
446
- resolveDeps(load, seen);
447
- await lastStaticLoadPromise;
448
- if (source && !shimMode && !load.n && !false) {
449
- const module = await dynamicImport(createBlob(source), { errUrl: source });
450
- if (revokeBlobURLs) revokeObjectURLs(Object.keys(seen));
451
- return module;
452
- }
453
- if (firstPolyfillLoad && !shimMode && load.n && nativelyLoaded) {
454
- onpolyfill();
455
- firstPolyfillLoad = false;
456
- }
457
- const module = await dynamicImport(!shimMode && !load.n && nativelyLoaded ? load.u : load.b, { errUrl: load.u });
458
- // if the top-level load is a shell, run its update function
459
- if (load.s)
460
- (await dynamicImport(load.s)).u$_(module);
461
- if (revokeBlobURLs) revokeObjectURLs(Object.keys(seen));
462
- // when tla is supported, this should return the tla promise as an actual handle
463
- // so readystate can still correspond to the sync subgraph exec completions
464
- return module;
465
- }
466
-
467
- function revokeObjectURLs(registryKeys) {
468
- let batch = 0;
469
- const keysLength = registryKeys.length;
470
- const schedule = self.requestIdleCallback ? self.requestIdleCallback : self.requestAnimationFrame;
471
- schedule(cleanup);
472
- function cleanup() {
473
- const batchStartIndex = batch * 100;
474
- if (batchStartIndex > keysLength) return
475
- for (const key of registryKeys.slice(batchStartIndex, batchStartIndex + 100)) {
476
- const load = registry[key];
477
- if (load) URL.revokeObjectURL(load.b);
478
- }
479
- batch++;
480
- schedule(cleanup);
481
- }
482
- }
483
-
484
- function urlJsString (url) {
485
- return `'${url.replace(/'/g, "\\'")}'`;
486
- }
487
-
488
- let lastLoad;
489
- function resolveDeps (load, seen) {
490
- if (load.b || !seen[load.u])
491
- return;
492
- seen[load.u] = 0;
493
-
494
- for (const dep of load.d)
495
- resolveDeps(dep, seen);
496
-
497
- const [imports] = load.a;
498
-
499
- // "execution"
500
- const source = load.S;
501
-
502
- // edge doesnt execute sibling in order, so we fix this up by ensuring all previous executions are explicit dependencies
503
- let resolvedSource = edge && lastLoad ? `import '${lastLoad}';` : '';
504
-
505
- if (!imports.length) {
506
- resolvedSource += source;
507
- }
508
- else {
509
- // once all deps have loaded we can inline the dependency resolution blobs
510
- // and define this blob
511
- let lastIndex = 0, depIndex = 0, dynamicImportEndStack = [];
512
- function pushStringTo (originalIndex) {
513
- while (dynamicImportEndStack[dynamicImportEndStack.length - 1] < originalIndex) {
514
- const dynamicImportEnd = dynamicImportEndStack.pop();
515
- resolvedSource += `${source.slice(lastIndex, dynamicImportEnd)}, ${urlJsString(load.r)}`;
516
- lastIndex = dynamicImportEnd;
517
- }
518
- resolvedSource += source.slice(lastIndex, originalIndex);
519
- lastIndex = originalIndex;
520
- }
521
- for (const { s: start, ss: statementStart, se: statementEnd, d: dynamicImportIndex } of imports) {
522
- // dependency source replacements
523
- if (dynamicImportIndex === -1) {
524
- let depLoad = load.d[depIndex++], blobUrl = depLoad.b, cycleShell = !blobUrl;
525
- if (cycleShell) {
526
- // circular shell creation
527
- if (!(blobUrl = depLoad.s)) {
528
- blobUrl = depLoad.s = createBlob(`export function u$_(m){${
529
- depLoad.a[1].map(
530
- name => name === 'default' ? `d$_=m.default` : `${name}=m.${name}`
531
- ).join(',')
532
- }}${
533
- depLoad.a[1].map(name =>
534
- name === 'default' ? `let d$_;export{d$_ as default}` : `export let ${name}`
535
- ).join(';')
536
- }\n//# sourceURL=${depLoad.r}?cycle`);
537
- }
538
- }
539
-
540
- pushStringTo(start - 1);
541
- resolvedSource += `/*${source.slice(start - 1, statementEnd)}*/${urlJsString(blobUrl)}`;
542
-
543
- // circular shell execution
544
- if (!cycleShell && depLoad.s) {
545
- resolvedSource += `;import*as m$_${depIndex} from'${depLoad.b}';import{u$_ as u$_${depIndex}}from'${depLoad.s}';u$_${depIndex}(m$_${depIndex})`;
546
- depLoad.s = undefined;
547
- }
548
- lastIndex = statementEnd;
549
- }
550
- // import.meta
551
- else if (dynamicImportIndex === -2) {
552
- load.m = { url: load.r, resolve: metaResolve };
553
- metaHook(load.m, load.u);
554
- pushStringTo(start);
555
- resolvedSource += `importShim._r[${urlJsString(load.u)}].m`;
556
- lastIndex = statementEnd;
557
- }
558
- // dynamic import
559
- else {
560
- pushStringTo(statementStart + 6);
561
- resolvedSource += `Shim(`;
562
- dynamicImportEndStack.push(statementEnd - 1);
563
- lastIndex = start;
564
- }
565
- }
566
-
567
- pushStringTo(source.length);
568
- }
569
-
570
- let hasSourceURL = false;
571
- resolvedSource = resolvedSource.replace(sourceMapURLRegEx, (match, isMapping, url) => (hasSourceURL = !isMapping, match.replace(url, () => new URL(url, load.r))));
572
- if (!hasSourceURL)
573
- resolvedSource += '\n//# sourceURL=' + load.r;
574
-
575
- load.b = lastLoad = createBlob(resolvedSource);
576
- load.S = undefined;
577
- }
578
-
579
- // ; and // trailer support added for Ruby on Rails 7 source maps compatibility
580
- // https://github.com/guybedford/es-module-shims/issues/228
581
- const sourceMapURLRegEx = /\n\/\/# source(Mapping)?URL=([^\n]+)\s*((;|\/\/[^#][^\n]*)\s*)*$/;
582
-
583
- const jsContentType = /^(text|application)\/(x-)?javascript(;|$)/;
584
- const jsonContentType = /^(text|application)\/json(;|$)/;
585
- const cssContentType = /^(text|application)\/css(;|$)/;
586
-
587
- const cssUrlRegEx = /url\(\s*(?:(["'])((?:\\.|[^\n\\"'])+)\1|((?:\\.|[^\s,"'()\\])+))\s*\)/g;
588
-
589
- // restrict in-flight fetches to a pool of 100
590
- let p = [];
591
- let c = 0;
592
- function pushFetchPool () {
593
- if (++c > 100)
594
- return new Promise(r => p.push(r));
595
- }
596
- function popFetchPool () {
597
- c--;
598
- if (p.length)
599
- p.shift()();
600
- }
601
-
602
- async function doFetch (url, fetchOpts, parent) {
603
- if (enforceIntegrity && !fetchOpts.integrity)
604
- throw Error(`No integrity for ${url}${fromParent(parent)}.`);
605
- const poolQueue = pushFetchPool();
606
- if (poolQueue) await poolQueue;
607
- try {
608
- var res = await fetchHook(url, fetchOpts);
609
- }
610
- catch (e) {
611
- e.message = `Unable to fetch ${url}${fromParent(parent)} - see network log for details.\n` + e.message;
612
- throw e;
613
- }
614
- finally {
615
- popFetchPool();
616
- }
617
- if (!res.ok)
618
- throw Error(`${res.status} ${res.statusText} ${res.url}${fromParent(parent)}`);
619
- return res;
620
- }
621
-
622
- async function fetchModule (url, fetchOpts, parent) {
623
- const res = await doFetch(url, fetchOpts, parent);
624
- const contentType = res.headers.get('content-type');
625
- if (jsContentType.test(contentType))
626
- return { r: res.url, s: await res.text(), t: 'js' };
627
- else if (jsonContentType.test(contentType))
628
- return { r: res.url, s: `export default ${await res.text()}`, t: 'json' };
629
- else if (cssContentType.test(contentType)) {
630
- return { r: res.url, s: `var s=new CSSStyleSheet();s.replaceSync(${
631
- JSON.stringify((await res.text()).replace(cssUrlRegEx, (_match, quotes = '', relUrl1, relUrl2) => `url(${quotes}${resolveUrl(relUrl1 || relUrl2, url)}${quotes})`))
632
- });export default s;`, t: 'css' };
633
- }
634
- else
635
- throw Error(`Unsupported Content-Type "${contentType}" loading ${url}${fromParent(parent)}. Modules must be served with a valid MIME type like application/javascript.`);
636
- }
637
-
638
- function getOrCreateLoad (url, fetchOpts, parent, source) {
639
- let load = registry[url];
640
- if (load && !source)
641
- return load;
642
-
643
- load = {
644
- // url
645
- u: url,
646
- // response url
647
- r: source ? url : undefined,
648
- // fetchPromise
649
- f: undefined,
650
- // source
651
- S: undefined,
652
- // linkPromise
653
- L: undefined,
654
- // analysis
655
- a: undefined,
656
- // deps
657
- d: undefined,
658
- // blobUrl
659
- b: undefined,
660
- // shellUrl
661
- s: undefined,
662
- // needsShim
663
- n: false,
664
- // type
665
- t: null,
666
- // meta
667
- m: null
668
- };
669
- if (registry[url]) {
670
- let i = 0;
671
- while (registry[load.u + ++i]);
672
- load.u += i;
673
- }
674
- registry[load.u] = load;
675
-
676
- load.f = (async () => {
677
- if (!source) {
678
- // preload fetch options override fetch options (race)
679
- let t;
680
- ({ r: load.r, s: source, t } = await (fetchCache[url] || fetchModule(url, fetchOpts, parent)));
681
- if (t && !shimMode) {
682
- if (t === 'css' && !cssModulesEnabled || t === 'json' && !jsonModulesEnabled)
683
- throw Error(`${t}-modules require <script type="esms-options">{ "polyfillEnable": ["${t}-modules"] }<${''}/script>`);
684
- if (t === 'css' && !supportsCssAssertions || t === 'json' && !supportsJsonAssertions)
685
- load.n = true;
686
- }
687
- }
688
- try {
689
- load.a = parse(source, load.u);
690
- }
691
- catch (e) {
692
- throwError(e);
693
- load.a = [[], [], false];
694
- }
695
- load.S = source;
696
- return load;
697
- })();
698
-
699
- load.L = load.f.then(async () => {
700
- let childFetchOpts = fetchOpts;
701
- load.d = (await Promise.all(load.a[0].map(async ({ n, d }) => {
702
- if (d >= 0 && !supportsDynamicImport || d === 2 && !supportsImportMeta)
703
- load.n = true;
704
- if (!n) return;
705
- const { r, b } = await resolve(n, load.r || load.u);
706
- if (b && (!supportsImportMaps || importMapSrcOrLazy))
707
- load.n = true;
708
- if (d !== -1) return;
709
- if (skip && skip.test(r)) return { b: r };
710
- if (childFetchOpts.integrity)
711
- childFetchOpts = Object.assign({}, childFetchOpts, { integrity: undefined });
712
- return getOrCreateLoad(r, childFetchOpts, load.r).f;
713
- }))).filter(l => l);
714
- });
715
-
716
- return load;
717
- }
718
-
719
- function processScriptsAndPreloads () {
720
- for (const script of document.querySelectorAll(shimMode ? 'script[type=module-shim]' : 'script[type=module]'))
721
- processScript(script);
722
- for (const link of document.querySelectorAll(shimMode ? 'link[rel=modulepreload-shim]' : 'link[rel=modulepreload]'))
723
- processPreload(link);
724
- }
725
-
726
- function processImportMaps () {
727
- for (const script of document.querySelectorAll(shimMode ? 'script[type="importmap-shim"]' : 'script[type="importmap"]'))
728
- processImportMap(script);
729
- }
730
-
731
- function getFetchOpts (script) {
732
- const fetchOpts = {};
733
- if (script.integrity)
734
- fetchOpts.integrity = script.integrity;
735
- if (script.referrerpolicy)
736
- fetchOpts.referrerPolicy = script.referrerpolicy;
737
- if (script.crossorigin === 'use-credentials')
738
- fetchOpts.credentials = 'include';
739
- else if (script.crossorigin === 'anonymous')
740
- fetchOpts.credentials = 'omit';
741
- else
742
- fetchOpts.credentials = 'same-origin';
743
- return fetchOpts;
744
- }
745
-
746
- let lastStaticLoadPromise = Promise.resolve();
747
-
748
- let domContentLoadedCnt = 1;
749
- function domContentLoadedCheck () {
750
- if (--domContentLoadedCnt === 0 && !noLoadEventRetriggers)
751
- document.dispatchEvent(new Event('DOMContentLoaded'));
752
- }
753
- // this should always trigger because we assume es-module-shims is itself a domcontentloaded requirement
754
- document.addEventListener('DOMContentLoaded', async () => {
755
- await initPromise;
756
- domContentLoadedCheck();
757
- if (shimMode || !baselinePassthrough) {
758
- processImportMaps();
759
- processScriptsAndPreloads();
760
- }
761
- });
762
-
763
- let readyStateCompleteCnt = 1;
764
- if (document.readyState === 'complete') {
765
- readyStateCompleteCheck();
766
- }
767
- else {
768
- document.addEventListener('readystatechange', async () => {
769
- processImportMaps();
770
- await initPromise;
771
- readyStateCompleteCheck();
772
- });
773
- }
774
- function readyStateCompleteCheck () {
775
- if (--readyStateCompleteCnt === 0 && !noLoadEventRetriggers)
776
- document.dispatchEvent(new Event('readystatechange'));
777
- }
778
-
779
- function processImportMap (script) {
780
- if (script.ep) // ep marker = script processed
781
- return;
782
- // empty inline scripts sometimes show before domready
783
- if (!script.src && !script.innerHTML)
784
- return;
785
- script.ep = true;
786
- // we dont currently support multiple, external or dynamic imports maps in polyfill mode to match native
787
- if (script.src) {
788
- if (!shimMode)
789
- return;
790
- importMapSrcOrLazy = true;
791
- }
792
- if (acceptingImportMaps) {
793
- importMapPromise = importMapPromise
794
- .then(async () => {
795
- importMap = resolveAndComposeImportMap(script.src ? await (await doFetch(script.src, getFetchOpts(script))).json() : JSON.parse(script.innerHTML), script.src || baseUrl, importMap);
796
- })
797
- .catch(throwError);
798
- if (!shimMode)
799
- acceptingImportMaps = false;
800
- }
801
- }
802
-
803
- function processScript (script) {
804
- if (script.ep) // ep marker = script processed
805
- return;
806
- if (script.getAttribute('noshim') !== null)
807
- return;
808
- // empty inline scripts sometimes show before domready
809
- if (!script.src && !script.innerHTML)
810
- return;
811
- script.ep = true;
812
- // does this load block readystate complete
813
- const isReadyScript = readyStateCompleteCnt > 0;
814
- // does this load block DOMContentLoaded
815
- const isDomContentLoadedScript = domContentLoadedCnt > 0;
816
- if (isReadyScript) readyStateCompleteCnt++;
817
- if (isDomContentLoadedScript) domContentLoadedCnt++;
818
- const blocks = script.getAttribute('async') === null && isReadyScript;
819
- const loadPromise = topLevelLoad(script.src || baseUrl, getFetchOpts(script), !script.src && script.innerHTML, !shimMode, blocks && lastStaticLoadPromise).catch(throwError);
820
- if (blocks)
821
- lastStaticLoadPromise = loadPromise.then(readyStateCompleteCheck);
822
- if (isDomContentLoadedScript)
823
- loadPromise.then(domContentLoadedCheck);
824
- }
825
-
826
- const fetchCache = {};
827
- function processPreload (link) {
828
- if (link.ep) // ep marker = processed
829
- return;
830
- link.ep = true;
831
- if (fetchCache[link.href])
832
- return;
833
- fetchCache[link.href] = fetchModule(link.href, getFetchOpts(link));
834
- }
835
-
836
- }());
306
+ async function _resolve (id, parentUrl) {
307
+ const urlResolved = resolveIfNotPlainOrUrl(id, parentUrl);
308
+ return {
309
+ r: resolveImportMap(importMap, urlResolved || id, parentUrl) || throwUnresolved(id, parentUrl),
310
+ // b = bare specifier
311
+ b: !urlResolved && !isURL(id)
312
+ };
313
+ }
314
+
315
+ const resolve = resolveHook ? async (id, parentUrl) => {
316
+ let result = resolveHook(id, parentUrl, defaultResolve);
317
+ // will be deprecated in next major
318
+ if (result && result.then)
319
+ result = await result;
320
+ return result ? { r: result, b: !resolveIfNotPlainOrUrl(id, parentUrl) && !isURL(id) } : _resolve(id, parentUrl);
321
+ } : _resolve;
322
+
323
+ // importShim('mod');
324
+ // importShim('mod', { opts });
325
+ // importShim('mod', { opts }, parentUrl);
326
+ // importShim('mod', parentUrl);
327
+ async function importShim (id, ...args) {
328
+ // parentUrl if present will be the last argument
329
+ let parentUrl = args[args.length - 1];
330
+ if (typeof parentUrl !== 'string')
331
+ parentUrl = baseUrl;
332
+ // needed for shim check
333
+ await initPromise;
334
+ if (importHook) await importHook(id, typeof args[1] !== 'string' ? args[1] : {}, parentUrl);
335
+ if (acceptingImportMaps || shimMode || !baselinePassthrough) {
336
+ processImportMaps();
337
+ if (!shimMode)
338
+ acceptingImportMaps = false;
339
+ }
340
+ await importMapPromise;
341
+ return topLevelLoad((await resolve(id, parentUrl)).r, { credentials: 'same-origin' });
342
+ }
343
+
344
+ self.importShim = importShim;
345
+
346
+ function defaultResolve (id, parentUrl) {
347
+ return resolveImportMap(importMap, resolveIfNotPlainOrUrl(id, parentUrl) || id, parentUrl) || throwUnresolved(id, parentUrl);
348
+ }
349
+
350
+ function throwUnresolved (id, parentUrl) {
351
+ throw Error(`Unable to resolve specifier '${id}'${fromParent(parentUrl)}`);
352
+ }
353
+
354
+ const resolveSync = (id, parentUrl = baseUrl) => {
355
+ parentUrl = `${parentUrl}`;
356
+ const result = resolveHook && resolveHook(id, parentUrl, defaultResolve);
357
+ return result && !result.then ? result : defaultResolve(id, parentUrl);
358
+ };
359
+
360
+ function metaResolve (id, parentUrl = this.url) {
361
+ return resolveSync(id, parentUrl);
362
+ }
363
+
364
+ importShim.resolve = resolveSync;
365
+ importShim.getImportMap = () => JSON.parse(JSON.stringify(importMap));
366
+
367
+ const registry = importShim._r = {};
368
+
369
+ async function loadAll (load, seen) {
370
+ if (load.b || seen[load.u])
371
+ return;
372
+ seen[load.u] = 1;
373
+ await load.L;
374
+ await Promise.all(load.d.map(dep => loadAll(dep, seen)));
375
+ if (!load.n)
376
+ load.n = load.d.some(dep => dep.n);
377
+ }
378
+
379
+ let importMap = { imports: {}, scopes: {} };
380
+ let importMapSrcOrLazy = false;
381
+ let baselinePassthrough;
382
+
383
+ const initPromise = featureDetectionPromise.then(() => {
384
+ // shim mode is determined on initialization, no late shim mode
385
+ if (!shimMode) {
386
+ if (document.querySelectorAll('script[type=module-shim],script[type=importmap-shim],link[rel=modulepreload-shim]').length) {
387
+ setShimMode();
388
+ }
389
+ else {
390
+ let seenScript = false;
391
+ for (const script of document.querySelectorAll('script[type=module],script[type=importmap]')) {
392
+ if (!seenScript) {
393
+ if (script.type === 'module')
394
+ seenScript = true;
395
+ }
396
+ else if (script.type === 'importmap') {
397
+ importMapSrcOrLazy = true;
398
+ break;
399
+ }
400
+ }
401
+ }
402
+ }
403
+ baselinePassthrough = esmsInitOptions.polyfillEnable !== true && supportsDynamicImport && supportsImportMeta && supportsImportMaps && (!jsonModulesEnabled || supportsJsonAssertions) && (!cssModulesEnabled || supportsCssAssertions) && !importMapSrcOrLazy && !false;
404
+ if (shimMode || !baselinePassthrough) {
405
+ new MutationObserver(mutations => {
406
+ for (const mutation of mutations) {
407
+ if (mutation.type !== 'childList') continue;
408
+ for (const node of mutation.addedNodes) {
409
+ if (node.tagName === 'SCRIPT') {
410
+ if (node.type === (shimMode ? 'module-shim' : 'module'))
411
+ processScript(node);
412
+ if (node.type === (shimMode ? 'importmap-shim' : 'importmap'))
413
+ processImportMap(node);
414
+ }
415
+ else if (node.tagName === 'LINK' && node.rel === (shimMode ? 'modulepreload-shim' : 'modulepreload'))
416
+ processPreload(node);
417
+ }
418
+ }
419
+ }).observe(document, { childList: true, subtree: true });
420
+ processImportMaps();
421
+ processScriptsAndPreloads();
422
+ return undefined;
423
+ }
424
+ });
425
+ let importMapPromise = initPromise;
426
+ let firstPolyfillLoad = true;
427
+ let acceptingImportMaps = true;
428
+
429
+ async function topLevelLoad (url, fetchOpts, source, nativelyLoaded, lastStaticLoadPromise) {
430
+ if (!shimMode)
431
+ acceptingImportMaps = false;
432
+ await importMapPromise;
433
+ if (importHook) await importHook(id, typeof args[1] !== 'string' ? args[1] : {}, parentUrl);
434
+ // early analysis opt-out - no need to even fetch if we have feature support
435
+ if (!shimMode && baselinePassthrough) {
436
+ // for polyfill case, only dynamic import needs a return value here, and dynamic import will never pass nativelyLoaded
437
+ if (nativelyLoaded)
438
+ return null;
439
+ await lastStaticLoadPromise;
440
+ return dynamicImport(source ? createBlob(source) : url, { errUrl: url || source });
441
+ }
442
+ const load = getOrCreateLoad(url, fetchOpts, null, source);
443
+ const seen = {};
444
+ await loadAll(load, seen);
445
+ lastLoad = undefined;
446
+ resolveDeps(load, seen);
447
+ await lastStaticLoadPromise;
448
+ if (source && !shimMode && !load.n && !false) {
449
+ const module = await dynamicImport(createBlob(source), { errUrl: source });
450
+ if (revokeBlobURLs) revokeObjectURLs(Object.keys(seen));
451
+ return module;
452
+ }
453
+ if (firstPolyfillLoad && !shimMode && load.n && nativelyLoaded) {
454
+ onpolyfill();
455
+ firstPolyfillLoad = false;
456
+ }
457
+ const module = await dynamicImport(!shimMode && !load.n && nativelyLoaded ? load.u : load.b, { errUrl: load.u });
458
+ // if the top-level load is a shell, run its update function
459
+ if (load.s)
460
+ (await dynamicImport(load.s)).u$_(module);
461
+ if (revokeBlobURLs) revokeObjectURLs(Object.keys(seen));
462
+ // when tla is supported, this should return the tla promise as an actual handle
463
+ // so readystate can still correspond to the sync subgraph exec completions
464
+ return module;
465
+ }
466
+
467
+ function revokeObjectURLs(registryKeys) {
468
+ let batch = 0;
469
+ const keysLength = registryKeys.length;
470
+ const schedule = self.requestIdleCallback ? self.requestIdleCallback : self.requestAnimationFrame;
471
+ schedule(cleanup);
472
+ function cleanup() {
473
+ const batchStartIndex = batch * 100;
474
+ if (batchStartIndex > keysLength) return
475
+ for (const key of registryKeys.slice(batchStartIndex, batchStartIndex + 100)) {
476
+ const load = registry[key];
477
+ if (load) URL.revokeObjectURL(load.b);
478
+ }
479
+ batch++;
480
+ schedule(cleanup);
481
+ }
482
+ }
483
+
484
+ function urlJsString (url) {
485
+ return `'${url.replace(/'/g, "\\'")}'`;
486
+ }
487
+
488
+ let lastLoad;
489
+ function resolveDeps (load, seen) {
490
+ if (load.b || !seen[load.u])
491
+ return;
492
+ seen[load.u] = 0;
493
+
494
+ for (const dep of load.d)
495
+ resolveDeps(dep, seen);
496
+
497
+ const [imports] = load.a;
498
+
499
+ // "execution"
500
+ const source = load.S;
501
+
502
+ // edge doesnt execute sibling in order, so we fix this up by ensuring all previous executions are explicit dependencies
503
+ let resolvedSource = edge && lastLoad ? `import '${lastLoad}';` : '';
504
+
505
+ if (!imports.length) {
506
+ resolvedSource += source;
507
+ }
508
+ else {
509
+ // once all deps have loaded we can inline the dependency resolution blobs
510
+ // and define this blob
511
+ let lastIndex = 0, depIndex = 0, dynamicImportEndStack = [];
512
+ function pushStringTo (originalIndex) {
513
+ while (dynamicImportEndStack[dynamicImportEndStack.length - 1] < originalIndex) {
514
+ const dynamicImportEnd = dynamicImportEndStack.pop();
515
+ resolvedSource += `${source.slice(lastIndex, dynamicImportEnd)}, ${urlJsString(load.r)}`;
516
+ lastIndex = dynamicImportEnd;
517
+ }
518
+ resolvedSource += source.slice(lastIndex, originalIndex);
519
+ lastIndex = originalIndex;
520
+ }
521
+ for (const { s: start, ss: statementStart, se: statementEnd, d: dynamicImportIndex } of imports) {
522
+ // dependency source replacements
523
+ if (dynamicImportIndex === -1) {
524
+ let depLoad = load.d[depIndex++], blobUrl = depLoad.b, cycleShell = !blobUrl;
525
+ if (cycleShell) {
526
+ // circular shell creation
527
+ if (!(blobUrl = depLoad.s)) {
528
+ blobUrl = depLoad.s = createBlob(`export function u$_(m){${
529
+ depLoad.a[1].map(
530
+ name => name === 'default' ? `d$_=m.default` : `${name}=m.${name}`
531
+ ).join(',')
532
+ }}${
533
+ depLoad.a[1].map(name =>
534
+ name === 'default' ? `let d$_;export{d$_ as default}` : `export let ${name}`
535
+ ).join(';')
536
+ }\n//# sourceURL=${depLoad.r}?cycle`);
537
+ }
538
+ }
539
+
540
+ pushStringTo(start - 1);
541
+ resolvedSource += `/*${source.slice(start - 1, statementEnd)}*/${urlJsString(blobUrl)}`;
542
+
543
+ // circular shell execution
544
+ if (!cycleShell && depLoad.s) {
545
+ resolvedSource += `;import*as m$_${depIndex} from'${depLoad.b}';import{u$_ as u$_${depIndex}}from'${depLoad.s}';u$_${depIndex}(m$_${depIndex})`;
546
+ depLoad.s = undefined;
547
+ }
548
+ lastIndex = statementEnd;
549
+ }
550
+ // import.meta
551
+ else if (dynamicImportIndex === -2) {
552
+ load.m = { url: load.r, resolve: metaResolve };
553
+ metaHook(load.m, load.u);
554
+ pushStringTo(start);
555
+ resolvedSource += `importShim._r[${urlJsString(load.u)}].m`;
556
+ lastIndex = statementEnd;
557
+ }
558
+ // dynamic import
559
+ else {
560
+ pushStringTo(statementStart + 6);
561
+ resolvedSource += `Shim(`;
562
+ dynamicImportEndStack.push(statementEnd - 1);
563
+ lastIndex = start;
564
+ }
565
+ }
566
+
567
+ pushStringTo(source.length);
568
+ }
569
+
570
+ let hasSourceURL = false;
571
+ resolvedSource = resolvedSource.replace(sourceMapURLRegEx, (match, isMapping, url) => (hasSourceURL = !isMapping, match.replace(url, () => new URL(url, load.r))));
572
+ if (!hasSourceURL)
573
+ resolvedSource += '\n//# sourceURL=' + load.r;
574
+
575
+ load.b = lastLoad = createBlob(resolvedSource);
576
+ load.S = undefined;
577
+ }
578
+
579
+ // ; and // trailer support added for Ruby on Rails 7 source maps compatibility
580
+ // https://github.com/guybedford/es-module-shims/issues/228
581
+ const sourceMapURLRegEx = /\n\/\/# source(Mapping)?URL=([^\n]+)\s*((;|\/\/[^#][^\n]*)\s*)*$/;
582
+
583
+ const jsContentType = /^(text|application)\/(x-)?javascript(;|$)/;
584
+ const jsonContentType = /^(text|application)\/json(;|$)/;
585
+ const cssContentType = /^(text|application)\/css(;|$)/;
586
+
587
+ const cssUrlRegEx = /url\(\s*(?:(["'])((?:\\.|[^\n\\"'])+)\1|((?:\\.|[^\s,"'()\\])+))\s*\)/g;
588
+
589
+ // restrict in-flight fetches to a pool of 100
590
+ let p = [];
591
+ let c = 0;
592
+ function pushFetchPool () {
593
+ if (++c > 100)
594
+ return new Promise(r => p.push(r));
595
+ }
596
+ function popFetchPool () {
597
+ c--;
598
+ if (p.length)
599
+ p.shift()();
600
+ }
601
+
602
+ async function doFetch (url, fetchOpts, parent) {
603
+ if (enforceIntegrity && !fetchOpts.integrity)
604
+ throw Error(`No integrity for ${url}${fromParent(parent)}.`);
605
+ const poolQueue = pushFetchPool();
606
+ if (poolQueue) await poolQueue;
607
+ try {
608
+ var res = await fetchHook(url, fetchOpts);
609
+ }
610
+ catch (e) {
611
+ e.message = `Unable to fetch ${url}${fromParent(parent)} - see network log for details.\n` + e.message;
612
+ throw e;
613
+ }
614
+ finally {
615
+ popFetchPool();
616
+ }
617
+ if (!res.ok)
618
+ throw Error(`${res.status} ${res.statusText} ${res.url}${fromParent(parent)}`);
619
+ return res;
620
+ }
621
+
622
+ async function fetchModule (url, fetchOpts, parent) {
623
+ const res = await doFetch(url, fetchOpts, parent);
624
+ const contentType = res.headers.get('content-type');
625
+ if (jsContentType.test(contentType))
626
+ return { r: res.url, s: await res.text(), t: 'js' };
627
+ else if (jsonContentType.test(contentType))
628
+ return { r: res.url, s: `export default ${await res.text()}`, t: 'json' };
629
+ else if (cssContentType.test(contentType)) {
630
+ return { r: res.url, s: `var s=new CSSStyleSheet();s.replaceSync(${
631
+ JSON.stringify((await res.text()).replace(cssUrlRegEx, (_match, quotes = '', relUrl1, relUrl2) => `url(${quotes}${resolveUrl(relUrl1 || relUrl2, url)}${quotes})`))
632
+ });export default s;`, t: 'css' };
633
+ }
634
+ else
635
+ throw Error(`Unsupported Content-Type "${contentType}" loading ${url}${fromParent(parent)}. Modules must be served with a valid MIME type like application/javascript.`);
636
+ }
637
+
638
+ function getOrCreateLoad (url, fetchOpts, parent, source) {
639
+ let load = registry[url];
640
+ if (load && !source)
641
+ return load;
642
+
643
+ load = {
644
+ // url
645
+ u: url,
646
+ // response url
647
+ r: source ? url : undefined,
648
+ // fetchPromise
649
+ f: undefined,
650
+ // source
651
+ S: undefined,
652
+ // linkPromise
653
+ L: undefined,
654
+ // analysis
655
+ a: undefined,
656
+ // deps
657
+ d: undefined,
658
+ // blobUrl
659
+ b: undefined,
660
+ // shellUrl
661
+ s: undefined,
662
+ // needsShim
663
+ n: false,
664
+ // type
665
+ t: null,
666
+ // meta
667
+ m: null
668
+ };
669
+ if (registry[url]) {
670
+ let i = 0;
671
+ while (registry[load.u + ++i]);
672
+ load.u += i;
673
+ }
674
+ registry[load.u] = load;
675
+
676
+ load.f = (async () => {
677
+ if (!source) {
678
+ // preload fetch options override fetch options (race)
679
+ let t;
680
+ ({ r: load.r, s: source, t } = await (fetchCache[url] || fetchModule(url, fetchOpts, parent)));
681
+ if (t && !shimMode) {
682
+ if (t === 'css' && !cssModulesEnabled || t === 'json' && !jsonModulesEnabled)
683
+ throw Error(`${t}-modules require <script type="esms-options">{ "polyfillEnable": ["${t}-modules"] }<${''}/script>`);
684
+ if (t === 'css' && !supportsCssAssertions || t === 'json' && !supportsJsonAssertions)
685
+ load.n = true;
686
+ }
687
+ }
688
+ try {
689
+ load.a = parse(source, load.u);
690
+ }
691
+ catch (e) {
692
+ throwError(e);
693
+ load.a = [[], [], false];
694
+ }
695
+ load.S = source;
696
+ return load;
697
+ })();
698
+
699
+ load.L = load.f.then(async () => {
700
+ let childFetchOpts = fetchOpts;
701
+ load.d = (await Promise.all(load.a[0].map(async ({ n, d }) => {
702
+ if (d >= 0 && !supportsDynamicImport || d === 2 && !supportsImportMeta)
703
+ load.n = true;
704
+ if (d !== -1 || !n) return;
705
+ const { r, b } = await resolve(n, load.r || load.u);
706
+ if (b && (!supportsImportMaps || importMapSrcOrLazy))
707
+ load.n = true;
708
+ if (skip && skip.test(r)) return { b: r };
709
+ if (childFetchOpts.integrity)
710
+ childFetchOpts = Object.assign({}, childFetchOpts, { integrity: undefined });
711
+ return getOrCreateLoad(r, childFetchOpts, load.r).f;
712
+ }))).filter(l => l);
713
+ });
714
+
715
+ return load;
716
+ }
717
+
718
+ function processScriptsAndPreloads () {
719
+ for (const script of document.querySelectorAll(shimMode ? 'script[type=module-shim]' : 'script[type=module]'))
720
+ processScript(script);
721
+ for (const link of document.querySelectorAll(shimMode ? 'link[rel=modulepreload-shim]' : 'link[rel=modulepreload]'))
722
+ processPreload(link);
723
+ }
724
+
725
+ function processImportMaps () {
726
+ for (const script of document.querySelectorAll(shimMode ? 'script[type="importmap-shim"]' : 'script[type="importmap"]'))
727
+ processImportMap(script);
728
+ }
729
+
730
+ function getFetchOpts (script) {
731
+ const fetchOpts = {};
732
+ if (script.integrity)
733
+ fetchOpts.integrity = script.integrity;
734
+ if (script.referrerpolicy)
735
+ fetchOpts.referrerPolicy = script.referrerpolicy;
736
+ if (script.crossorigin === 'use-credentials')
737
+ fetchOpts.credentials = 'include';
738
+ else if (script.crossorigin === 'anonymous')
739
+ fetchOpts.credentials = 'omit';
740
+ else
741
+ fetchOpts.credentials = 'same-origin';
742
+ return fetchOpts;
743
+ }
744
+
745
+ let lastStaticLoadPromise = Promise.resolve();
746
+
747
+ let domContentLoadedCnt = 1;
748
+ function domContentLoadedCheck () {
749
+ if (--domContentLoadedCnt === 0 && !noLoadEventRetriggers)
750
+ document.dispatchEvent(new Event('DOMContentLoaded'));
751
+ }
752
+ // this should always trigger because we assume es-module-shims is itself a domcontentloaded requirement
753
+ document.addEventListener('DOMContentLoaded', async () => {
754
+ await initPromise;
755
+ domContentLoadedCheck();
756
+ if (shimMode || !baselinePassthrough) {
757
+ processImportMaps();
758
+ processScriptsAndPreloads();
759
+ }
760
+ });
761
+
762
+ let readyStateCompleteCnt = 1;
763
+ if (document.readyState === 'complete') {
764
+ readyStateCompleteCheck();
765
+ }
766
+ else {
767
+ document.addEventListener('readystatechange', async () => {
768
+ processImportMaps();
769
+ await initPromise;
770
+ readyStateCompleteCheck();
771
+ });
772
+ }
773
+ function readyStateCompleteCheck () {
774
+ if (--readyStateCompleteCnt === 0 && !noLoadEventRetriggers)
775
+ document.dispatchEvent(new Event('readystatechange'));
776
+ }
777
+
778
+ function processImportMap (script) {
779
+ if (script.ep) // ep marker = script processed
780
+ return;
781
+ // empty inline scripts sometimes show before domready
782
+ if (!script.src && !script.innerHTML)
783
+ return;
784
+ script.ep = true;
785
+ // we dont currently support multiple, external or dynamic imports maps in polyfill mode to match native
786
+ if (script.src) {
787
+ if (!shimMode)
788
+ return;
789
+ importMapSrcOrLazy = true;
790
+ }
791
+ if (acceptingImportMaps) {
792
+ importMapPromise = importMapPromise
793
+ .then(async () => {
794
+ importMap = resolveAndComposeImportMap(script.src ? await (await doFetch(script.src, getFetchOpts(script))).json() : JSON.parse(script.innerHTML), script.src || baseUrl, importMap);
795
+ })
796
+ .catch(throwError);
797
+ if (!shimMode)
798
+ acceptingImportMaps = false;
799
+ }
800
+ }
801
+
802
+ function processScript (script) {
803
+ if (script.ep) // ep marker = script processed
804
+ return;
805
+ if (script.getAttribute('noshim') !== null)
806
+ return;
807
+ // empty inline scripts sometimes show before domready
808
+ if (!script.src && !script.innerHTML)
809
+ return;
810
+ script.ep = true;
811
+ // does this load block readystate complete
812
+ const isReadyScript = readyStateCompleteCnt > 0;
813
+ // does this load block DOMContentLoaded
814
+ const isDomContentLoadedScript = domContentLoadedCnt > 0;
815
+ if (isReadyScript) readyStateCompleteCnt++;
816
+ if (isDomContentLoadedScript) domContentLoadedCnt++;
817
+ const blocks = script.getAttribute('async') === null && isReadyScript;
818
+ const loadPromise = topLevelLoad(script.src || baseUrl, getFetchOpts(script), !script.src && script.innerHTML, !shimMode, blocks && lastStaticLoadPromise).catch(throwError);
819
+ if (blocks)
820
+ lastStaticLoadPromise = loadPromise.then(readyStateCompleteCheck);
821
+ if (isDomContentLoadedScript)
822
+ loadPromise.then(domContentLoadedCheck);
823
+ }
824
+
825
+ const fetchCache = {};
826
+ function processPreload (link) {
827
+ if (link.ep) // ep marker = processed
828
+ return;
829
+ link.ep = true;
830
+ if (fetchCache[link.href])
831
+ return;
832
+ fetchCache[link.href] = fetchModule(link.href, getFetchOpts(link));
833
+ }
834
+
835
+ })();