es-module-shims 1.4.1 → 1.4.5

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