web-launch-kit 0.0.3 → 0.0.4

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.
@@ -2,24 +2,37 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var version$2 = "0.0.3";
5
+ var version$3 = "0.0.4";
6
+ var packageJSON$3 = {
7
+ version: version$3};
8
+
9
+ var version$2 = "0.0.5";
6
10
  var packageJSON$2 = {
7
11
  version: version$2};
8
12
 
9
- var version$1 = "0.0.4";
10
- var packageJSON$1 = {
11
- version: version$1};
12
-
13
- var NAVIGATOR$1 = globalThis.navigator;
14
- var USER_AGENT = typeof NAVIGATOR$1 !== 'undefined' ? NAVIGATOR$1.userAgent : '';
15
- var USER_AGENT_DATA = typeof NAVIGATOR$1 !== 'undefined' ? NAVIGATOR$1.userAgentData : undefined;
13
+ function getGlobal$3() {
14
+ if (typeof globalThis !== 'undefined')
15
+ return globalThis;
16
+ if (typeof self !== 'undefined')
17
+ return self;
18
+ if (typeof window !== 'undefined')
19
+ return window;
20
+ if (typeof global !== 'undefined')
21
+ return global;
22
+ return {};
23
+ }
24
+ var GLOBAL$5 = getGlobal$3();
25
+ var NAVIGATOR$1 = GLOBAL$5.navigator;
26
+ var USER_AGENT = typeof NAVIGATOR$1 !== 'undefined' && NAVIGATOR$1 !== null && typeof NAVIGATOR$1.userAgent === 'string' ? NAVIGATOR$1.userAgent : '';
27
+ var USER_AGENT_DATA = typeof NAVIGATOR$1 !== 'undefined' && NAVIGATOR$1 !== null ? NAVIGATOR$1.userAgentData : undefined;
16
28
  var OS_RESOLVER_MAP = [
17
- [/windows nt (6\.[23]); arm/i, 'windows', resolveWindowsVersion],
18
- [/windows (?:phone|mobile|iot)(?: os)?[\/ ]?([\d.]*( se)?)/i, 'windows', resolveWindowsVersion],
19
- [/windows[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i, 'windows', resolveWindowsVersion],
29
+ [/windows nt (6\.[23]); arm/i, 'windows', 'RT'],
30
+ [/windows (?:phone|mobile|iot)(?: os)?[\/ ]?([\d.]*( se)?)/i, 'windows'],
31
+ [/win 9x 4\.90/i, 'windows', 'ME'],
32
+ [/windows[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i, 'windows'],
20
33
  [/windows nt ?([\d.)]*)(?!.+xbox)/i, 'windows', resolveWindowsVersion],
21
34
  [/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d.;]*)/i, 'windows', resolveWindowsVersion],
22
- [/windows ce\/?([\d.]*)/i, 'windows', resolveWindowsVersion],
35
+ [/windows ce\/?([\d.]*)/i, 'windows'],
23
36
  [/[adehimnop]{4,7}\b(?:.*os (\w+) like mac|; opera)/i, 'ios', resolveUnderscoreVersion],
24
37
  [/(?:ios;fbsv|ios(?=.+ip(?:ad|hone))|ip(?:ad|hone)(?: |.+i(?:pad)?)os)[\/ ]([\w.]+)/i, 'ios', resolveUnderscoreVersion],
25
38
  [/cfnetwork\/.+darwin/i, 'ios', resolveUnderscoreVersion],
@@ -48,13 +61,14 @@ var BROWSER_RESOLVER_MAP = [
48
61
  [/samsungbrowser\/([\w.]+)/i, 'samsung'],
49
62
  [/headlesschrome(?:\/([\w.]+)| )/i, 'chrome'],
50
63
  [/wv\).+chrome\/([\w.]+).+edgw\//i, 'edge'],
51
- [/ wv\).+(chrome)\/([\w.]+)/i, 'chrome'],
64
+ [/ wv\).+chrome\/([\w.]+)/i, 'chrome'],
52
65
  [/chrome\/([\w.]+) mobile/i, 'chrome'],
53
66
  [/chrome\/v?([\w.]+)/i, 'chrome'],
54
67
  [/version\/([\w.,]+) .*mobile(?:\/\w+ | ?)safari/i, 'safari'],
55
68
  [/iphone .*mobile(?:\/\w+ | ?)safari/i, 'safari'],
56
69
  [/version\/([\w.,]+) .*safari/i, 'safari'],
57
70
  [/webkit.+?(?:mobile ?safari|safari)(\/[\w.]+)/i, 'safari', '1'],
71
+ [/(?:iphone|ipad|ipod).+applewebkit(?!.*safari)/i, 'safari'],
58
72
  [/(?:mobile|tablet);.*firefox\/([\w.-]+)/i, 'firefox'],
59
73
  [/mobile vr; rv:([\w.]+)\).+firefox/i, 'firefox'],
60
74
  [/firefox\/([\w.]+)/i, 'firefox'],
@@ -71,6 +85,18 @@ var ENGINE_RESOLVER_MAP = [
71
85
  [/tasman[\/ ]\(?([\w.]+)/i, 'tasman'],
72
86
  [/rv:([\w.]{1,9})\b.+gecko/i, 'gecko']
73
87
  ];
88
+ var IN_APP_BROWSER_RESOLVER_MAP = [
89
+ [/kakaotalk/i, 'kakaotalk'],
90
+ [/\bline\/[\d.]/i, 'line'],
91
+ [/instagram/i, 'instagram'],
92
+ [/\bfban\/|\bfbav\/|fb_iab/i, 'facebook'],
93
+ [/naver\(inapp/i, 'naver'],
94
+ [/daumapps/i, 'daum'],
95
+ [/\bband\/[\d.]/i, 'band'],
96
+ [/micromessenger/i, 'wechat'],
97
+ [/twitter for|twitterandroid/i, 'twitter'],
98
+ [/musical_ly|bytedancewebview|\btiktok/i, 'tiktok'],
99
+ ];
74
100
  var HIGH_ENTROPY_BRAND_NAME_MAP = {
75
101
  'Google Chrome': 'Chrome',
76
102
  'Microsoft Edge': 'Edge',
@@ -93,19 +119,18 @@ function resolveWindowsVersion(string) {
93
119
  return '';
94
120
  var mapped = {
95
121
  '4.90': 'ME',
96
- 'NT3.51': 'NT 3.11',
97
- 'NT4.0': 'NT 4.0',
98
- 'NT 5.0': '2000',
99
- 'NT 5.1': 'XP',
100
- 'NT 5.2': 'XP',
101
- 'NT 6.0': 'Vista',
102
- 'NT 6.1': '7',
103
- 'NT 6.2': '8',
104
- 'NT 6.3': '8.1',
105
- 'NT 6.4': '10',
106
- 'NT 10.0': '10',
107
- 'ARM': 'RT'
108
- }[string];
122
+ '3.51': 'NT 3.51',
123
+ '4.0': 'NT 4.0',
124
+ '5.0': '2000',
125
+ '5.1': 'XP',
126
+ '5.2': 'XP',
127
+ '6.0': 'Vista',
128
+ '6.1': '7',
129
+ '6.2': '8',
130
+ '6.3': '8.1',
131
+ '6.4': '10',
132
+ '10.0': '10'
133
+ }[string.replace(/[^\d.]/g, '')];
109
134
  if (typeof mapped !== 'undefined')
110
135
  return mapped;
111
136
  return string;
@@ -124,6 +149,28 @@ function resolveVersion(string, resolver) {
124
149
  return '';
125
150
  return string;
126
151
  }
152
+ function compareVersion(lhs, rhs) {
153
+ var pa = lhs.split('.');
154
+ var pb = rhs.split('.');
155
+ var length = Math.max(pa.length, pb.length);
156
+ for (var i = 0; i < length; i++) {
157
+ var a = void 0;
158
+ var b = void 0;
159
+ if (i < pa.length)
160
+ a = parseInt(pa[i], 10);
161
+ else
162
+ a = 0;
163
+ if (i < pb.length)
164
+ b = parseInt(pb[i], 10);
165
+ else
166
+ b = 0;
167
+ if (a > b)
168
+ return 1;
169
+ if (a < b)
170
+ return -1;
171
+ }
172
+ return 0;
173
+ }
127
174
  function parseOS() {
128
175
  var name = 'unknown';
129
176
  var version = '';
@@ -136,7 +183,7 @@ function parseOS() {
136
183
  break;
137
184
  }
138
185
  }
139
- if (name === 'ios' && PlatformKit.compareVersion(version, '18.6') === 0) {
186
+ if (name === 'ios' && compareVersion(version, '18.6') === 0) {
140
187
  var execs = /\) Version\/([\d.]+)/.exec(currentUserAgent);
141
188
  if (execs !== null) {
142
189
  var major = parseInt(execs[1].split('.')[0], 10);
@@ -149,7 +196,7 @@ function parseOS() {
149
196
  name = parsedFromHighEntropyValuesOSName;
150
197
  if (typeof parsedFromHighEntropyValuesOSVersion !== 'undefined')
151
198
  version = parsedFromHighEntropyValuesOSVersion;
152
- if (name === 'macos' && typeof globalThis.navigator.standalone !== 'undefined' && typeof globalThis.navigator.maxTouchPoints !== 'undefined' && globalThis.navigator.maxTouchPoints > 2)
199
+ if (name === 'macos' && typeof NAVIGATOR$1 !== 'undefined' && NAVIGATOR$1 !== null && typeof NAVIGATOR$1.standalone !== 'undefined' && typeof NAVIGATOR$1.maxTouchPoints === 'number' && NAVIGATOR$1.maxTouchPoints > 2)
153
200
  name = 'ios';
154
201
  }
155
202
  return {
@@ -201,6 +248,39 @@ function parseEngine() {
201
248
  version: version
202
249
  };
203
250
  }
251
+ function parseInAppBrowser() {
252
+ for (var i = 0; i < IN_APP_BROWSER_RESOLVER_MAP.length; i++) {
253
+ if (IN_APP_BROWSER_RESOLVER_MAP[i][0].test(currentUserAgent))
254
+ return IN_APP_BROWSER_RESOLVER_MAP[i][1];
255
+ }
256
+ return null;
257
+ }
258
+ function parseWebview() {
259
+ if (/; ?wv\)/i.test(currentUserAgent))
260
+ return true;
261
+ if (/\bversion\/[\d.]+ chrome\//i.test(currentUserAgent))
262
+ return true;
263
+ if (/\belectron\//i.test(currentUserAgent))
264
+ return true;
265
+ if (/(?:iphone|ipad|ipod)/i.test(currentUserAgent) && /applewebkit/i.test(currentUserAgent) && /safari/i.test(currentUserAgent) === false)
266
+ return true;
267
+ return parseInAppBrowser() !== null;
268
+ }
269
+ function parseDevice() {
270
+ if (currentUserAgent === USER_AGENT && parsedFromHighEntropyValuesDevice !== null)
271
+ return parsedFromHighEntropyValuesDevice;
272
+ var osName = getParsedCache().os.name;
273
+ if (osName === 'ios') {
274
+ if (/ipad/i.test(currentUserAgent) || /macintosh/i.test(currentUserAgent))
275
+ return 'tablet';
276
+ return 'mobile';
277
+ }
278
+ if (osName === 'android')
279
+ return /\bmobile\b/i.test(currentUserAgent) ? 'mobile' : 'tablet';
280
+ if (osName === 'windows' || osName === 'macos')
281
+ return 'desktop';
282
+ return 'unknown';
283
+ }
204
284
  function getParsedCache() {
205
285
  if (parsedCache !== null && parsedCache.userAgent === currentUserAgent)
206
286
  return parsedCache;
@@ -228,11 +308,31 @@ function normalizeBrand(entry) {
228
308
  return { brand: entry, version: '' };
229
309
  return { brand: entry.brand, version: entry.version };
230
310
  }
311
+ function resolvedThenable() {
312
+ if (typeof Promise === 'function')
313
+ return Promise.resolve();
314
+ var thenable = {
315
+ then: function (onFulfilled) {
316
+ if (typeof onFulfilled === 'function')
317
+ onFulfilled(undefined);
318
+ return thenable;
319
+ },
320
+ catch: function () {
321
+ return thenable;
322
+ },
323
+ finally: function (onFinally) {
324
+ if (typeof onFinally === 'function')
325
+ onFinally();
326
+ return thenable;
327
+ },
328
+ };
329
+ return thenable;
330
+ }
231
331
  function parseFromHighEntropyValues() {
232
332
  if (typeof USER_AGENT_DATA === 'undefined' || typeof USER_AGENT_DATA.getHighEntropyValues === 'undefined')
233
- return Promise.resolve();
333
+ return resolvedThenable();
234
334
  return USER_AGENT_DATA
235
- .getHighEntropyValues(['brands', 'fullVersionList', 'mobile', 'model', 'platform', 'platformVersion', 'architecture', 'formFactors', 'bitness', 'uaFullVersion', 'wow64'])
335
+ .getHighEntropyValues(['brands', 'fullVersionList', 'mobile', 'platform', 'platformVersion', 'formFactors'])
236
336
  .then(function (result) {
237
337
  try {
238
338
  var brands = result.fullVersionList || result.brands || [];
@@ -285,12 +385,26 @@ function parseFromHighEntropyValues() {
285
385
  else if (/macos|macintel/i.test(platform))
286
386
  parsedFromHighEntropyValuesOSName = 'macos';
287
387
  }
288
- if (result.mobile === true)
388
+ var formFactors = result.formFactors;
389
+ if (typeof formFactors !== 'undefined' && formFactors !== null && typeof formFactors.length === 'number') {
390
+ for (var i = 0; i < formFactors.length; i++) {
391
+ var formFactor = String(formFactors[i]).toLowerCase();
392
+ if (formFactor === 'tablet')
393
+ parsedFromHighEntropyValuesDevice = 'tablet';
394
+ else if (formFactor === 'mobile')
395
+ parsedFromHighEntropyValuesDevice = 'mobile';
396
+ else if (formFactor === 'desktop')
397
+ parsedFromHighEntropyValuesDevice = 'desktop';
398
+ }
399
+ }
400
+ if (parsedFromHighEntropyValuesDevice === null && result.mobile === true)
289
401
  parsedFromHighEntropyValuesDevice = 'mobile';
290
- parsedCache = null;
291
402
  }
292
403
  catch (_) {
293
404
  }
405
+ finally {
406
+ parsedCache = null;
407
+ }
294
408
  })
295
409
  .catch(function () {
296
410
  parsedCache = null;
@@ -298,15 +412,29 @@ function parseFromHighEntropyValues() {
298
412
  }
299
413
  ready = parseFromHighEntropyValues();
300
414
  var PlatformKit = {
301
- version: packageJSON$1.version,
415
+ version: packageJSON$2.version,
302
416
  get ready() {
303
417
  return ready;
304
418
  },
419
+ whenReady: function (callback) {
420
+ if (typeof callback !== 'function')
421
+ return;
422
+ ready.then(function () {
423
+ callback();
424
+ });
425
+ },
305
426
  set userAgent(userAgent) {
306
427
  if (currentUserAgent === userAgent)
307
428
  return;
308
429
  currentUserAgent = userAgent;
309
430
  invalidateCache();
431
+ ready = userAgent === USER_AGENT ? parseFromHighEntropyValues() : resolvedThenable();
432
+ },
433
+ reset: function () {
434
+ if (currentUserAgent === USER_AGENT)
435
+ return;
436
+ currentUserAgent = USER_AGENT;
437
+ invalidateCache();
310
438
  ready = parseFromHighEntropyValues();
311
439
  },
312
440
  get userAgent() {
@@ -322,65 +450,59 @@ var PlatformKit = {
322
450
  return getParsedCache().engine;
323
451
  },
324
452
  get device() {
325
- if (currentUserAgent === USER_AGENT && parsedFromHighEntropyValuesDevice !== null)
326
- return parsedFromHighEntropyValuesDevice;
327
- var osName = getParsedCache().os.name;
328
- if (osName === 'ios' || osName === 'android')
329
- return 'mobile';
330
- if (osName === 'windows' || osName === 'macos')
331
- return 'desktop';
332
- return 'unknown';
453
+ return parseDevice();
333
454
  },
334
455
  get webview() {
335
- return /; ?wv|applewebkit(?!.*safari)/i.test(currentUserAgent);
456
+ return parseWebview();
457
+ },
458
+ get inAppBrowser() {
459
+ return parseInAppBrowser();
336
460
  },
337
461
  get node() {
338
- return typeof globalThis.process !== 'undefined' && typeof globalThis.process.versions !== 'undefined' && typeof globalThis.process.versions.node !== 'undefined';
462
+ var nodeProcess = GLOBAL$5.process;
463
+ return typeof nodeProcess !== 'undefined' && nodeProcess !== null && typeof nodeProcess.versions !== 'undefined' && nodeProcess.versions !== null && typeof nodeProcess.versions.node !== 'undefined';
339
464
  },
340
465
  get standalone() {
341
466
  var osName = getParsedCache().os.name;
342
467
  if (osName === 'ios')
343
- return globalThis.navigator.standalone === true;
344
- if (typeof globalThis.matchMedia === 'undefined')
468
+ return typeof NAVIGATOR$1 !== 'undefined' && NAVIGATOR$1 !== null && NAVIGATOR$1.standalone === true;
469
+ if (typeof GLOBAL$5.matchMedia !== 'function')
345
470
  return false;
346
- return globalThis.matchMedia('(display-mode: standalone)').matches;
471
+ try {
472
+ return GLOBAL$5.matchMedia('(display-mode: standalone)').matches === true;
473
+ }
474
+ catch (_) {
475
+ return false;
476
+ }
347
477
  },
348
478
  compareVersion: function (lhs, rhs) {
349
- var pa = lhs.split('.');
350
- var pb = rhs.split('.');
351
- var length = Math.max(pa.length, pb.length);
352
- for (var i = 0; i < length; i++) {
353
- var a = void 0;
354
- var b = void 0;
355
- if (i < pa.length)
356
- a = parseInt(pa[i], 10);
357
- else
358
- a = 0;
359
- if (i < pb.length)
360
- b = parseInt(pb[i], 10);
361
- else
362
- b = 0;
363
- if (a > b)
364
- return 1;
365
- if (a < b)
366
- return -1;
367
- }
368
- return 0;
479
+ return compareVersion(lhs, rhs);
369
480
  }
370
481
  };
371
482
 
372
- var version = "0.0.1";
373
- var packageJSON = {
374
- version: version};
483
+ function getGlobal$2() {
484
+ if (typeof globalThis !== 'undefined')
485
+ return globalThis;
486
+ if (typeof self !== 'undefined')
487
+ return self;
488
+ if (typeof window !== 'undefined')
489
+ return window;
490
+ if (typeof global !== 'undefined')
491
+ return global;
492
+ return {};
493
+ }
494
+
495
+ var version$1 = "0.0.1";
496
+ var packageJSON$1 = {
497
+ version: version$1};
375
498
 
499
+ var GLOBAL$3 = getGlobal$2();
376
500
  var VENDORS = ['', 'webkit', 'moz', 'ms', 'MS', 'o', 'O'];
377
501
  // https://cordova.apache.org/docs/en/latest/cordova/events/events.html
378
502
  var CORDOVA_DOCUMENT_EVENTS = ['deviceready', 'pause', 'resume', 'backbutton', 'menubutton', 'searchbutton', 'startcallbutton', 'endcallbutton', 'volumedownbutton', 'volumeupbutton', 'activated', 'cordovacallbackerror'];
379
503
  // iOS `<video>` fullscreen events have no `on` attribute but are valid on any element exposing `webkitEnterFullscreen` — they must pass through untouched.
380
504
  var IOS_VIDEO_FULLSCREEN_EVENTS = ['webkitbeginfullscreen', 'webkitendfullscreen', 'webkitpresentationmodechanged'];
381
505
  var TYPE_ALIAS_MAP = {
382
- 'focus': ['focus', 'focusin'],
383
- 'blur': ['blur', 'focusout'],
384
506
  'wheel': ['wheel', 'mousewheel', 'DOMMouseScroll'],
385
507
  'fullscreenchange': ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange', 'MSFullscreenChange', 'msfullscreenchange'],
386
508
  'fullscreenerror': ['fullscreenerror', 'webkitfullscreenerror', 'mozfullscreenerror', 'MSFullscreenError', 'msfullscreenerror'],
@@ -428,10 +550,10 @@ function hasOnProperty(host, name) {
428
550
  }
429
551
  function probeHosts(target) {
430
552
  var hosts = [target];
431
- if (typeof globalThis.document !== 'undefined' && target !== globalThis.document)
432
- hosts.push(globalThis.document);
433
- if (target !== globalThis)
434
- hosts.push(globalThis);
553
+ if (typeof GLOBAL$3.document !== 'undefined' && target !== GLOBAL$3.document)
554
+ hosts.push(GLOBAL$3.document);
555
+ if (target !== GLOBAL$3)
556
+ hosts.push(GLOBAL$3);
435
557
  return hosts;
436
558
  }
437
559
  function extractVendorPrefix(name) {
@@ -442,9 +564,9 @@ function extractVendorPrefix(name) {
442
564
  return '';
443
565
  }
444
566
  function testStyleSupport(name, styleProperty) {
445
- if (typeof globalThis.document === 'undefined' || typeof globalThis.document.documentElement === 'undefined')
567
+ if (typeof GLOBAL$3.document === 'undefined' || typeof GLOBAL$3.document.documentElement === 'undefined')
446
568
  return false;
447
- var style = globalThis.document.documentElement.style;
569
+ var style = GLOBAL$3.document.documentElement.style;
448
570
  if (typeof style === 'undefined' || style === null)
449
571
  return false;
450
572
  var prefix = extractVendorPrefix(name);
@@ -456,9 +578,9 @@ function testStyleSupport(name, styleProperty) {
456
578
  return typeof asRecord(style)[property] !== 'undefined';
457
579
  }
458
580
  function testFullscreenSupport(name) {
459
- if (typeof globalThis.document === 'undefined' || typeof globalThis.document.documentElement === 'undefined')
581
+ if (typeof GLOBAL$3.document === 'undefined' || typeof GLOBAL$3.document.documentElement === 'undefined')
460
582
  return false;
461
- var element = globalThis.document.documentElement;
583
+ var element = GLOBAL$3.document.documentElement;
462
584
  var methods = FULLSCREEN_REQUEST_MAP[extractVendorPrefix(name)];
463
585
  if (typeof methods === 'undefined')
464
586
  return false;
@@ -484,7 +606,7 @@ function isEventTypeSupported(target, name) {
484
606
  return false;
485
607
  }
486
608
  function resolveEventType(target, type) {
487
- if (target === globalThis.document && CORDOVA_DOCUMENT_EVENTS.indexOf(type) > -1)
609
+ if (target === GLOBAL$3.document && CORDOVA_DOCUMENT_EVENTS.indexOf(type) > -1)
488
610
  return type;
489
611
  if (typeof asRecord(target)['webkitEnterFullscreen'] === 'function' && IOS_VIDEO_FULLSCREEN_EVENTS.indexOf(type) > -1)
490
612
  return type;
@@ -493,10 +615,10 @@ function resolveEventType(target, type) {
493
615
  if (isEventTypeSupported(target, candidates[i]))
494
616
  return candidates[i];
495
617
  }
618
+ var hosts = probeHosts(target);
496
619
  for (var i = 1; i < VENDORS.length; i++) {
497
620
  for (var j = 0; j < candidates.length; j++) {
498
621
  var name_1 = VENDORS[i] + candidates[j];
499
- var hosts = probeHosts(target);
500
622
  for (var k = 0; k < hosts.length; k++) {
501
623
  if (hasOnProperty(hosts[k], name_1))
502
624
  return name_1;
@@ -506,6 +628,7 @@ function resolveEventType(target, type) {
506
628
  return type;
507
629
  }
508
630
 
631
+ var GLOBAL$2 = getGlobal$2();
509
632
  var SUPPORTED = {
510
633
  once: false,
511
634
  passive: false,
@@ -516,16 +639,16 @@ var SUPPORTED = {
516
639
  var NOOP$1 = function () {
517
640
  };
518
641
  function resolveProbeTarget() {
519
- if (typeof globalThis.document !== 'undefined' && typeof globalThis.document.createDocumentFragment === 'function') {
642
+ if (typeof GLOBAL$2.document !== 'undefined' && typeof GLOBAL$2.document.createDocumentFragment === 'function') {
520
643
  try {
521
- return globalThis.document.createDocumentFragment();
644
+ return GLOBAL$2.document.createDocumentFragment();
522
645
  }
523
646
  catch (_) {
524
647
  }
525
648
  }
526
- if (typeof globalThis.EventTarget === 'function') {
649
+ if (typeof GLOBAL$2.EventTarget === 'function') {
527
650
  try {
528
- return new globalThis.EventTarget();
651
+ return new GLOBAL$2.EventTarget();
529
652
  }
530
653
  catch (_) {
531
654
  }
@@ -596,6 +719,7 @@ function toNativeListenerOptions(normalized) {
596
719
  return normalized.capture;
597
720
  }
598
721
 
722
+ var GLOBAL$1$1 = getGlobal$2();
599
723
  var TOUCH_TYPES = ['touchstart', 'touchmove', 'touchend', 'touchcancel'];
600
724
  var POINTER_PHASE_MAP = {
601
725
  'pointerdown': 'start',
@@ -631,17 +755,17 @@ function findTouchIndex(identifier) {
631
755
  return -1;
632
756
  }
633
757
  function scrollOffsetX() {
634
- if (typeof globalThis.pageXOffset === 'number')
635
- return globalThis.pageXOffset;
636
- if (typeof globalThis.document !== 'undefined' && typeof globalThis.document.documentElement !== 'undefined')
637
- return globalThis.document.documentElement.scrollLeft;
758
+ if (typeof GLOBAL$1$1.pageXOffset === 'number')
759
+ return GLOBAL$1$1.pageXOffset;
760
+ if (typeof GLOBAL$1$1.document !== 'undefined' && typeof GLOBAL$1$1.document.documentElement !== 'undefined')
761
+ return GLOBAL$1$1.document.documentElement.scrollLeft;
638
762
  return 0;
639
763
  }
640
764
  function scrollOffsetY() {
641
- if (typeof globalThis.pageYOffset === 'number')
642
- return globalThis.pageYOffset;
643
- if (typeof globalThis.document !== 'undefined' && typeof globalThis.document.documentElement !== 'undefined')
644
- return globalThis.document.documentElement.scrollTop;
765
+ if (typeof GLOBAL$1$1.pageYOffset === 'number')
766
+ return GLOBAL$1$1.pageYOffset;
767
+ if (typeof GLOBAL$1$1.document !== 'undefined' && typeof GLOBAL$1$1.document.documentElement !== 'undefined')
768
+ return GLOBAL$1$1.document.documentElement.scrollTop;
645
769
  return 0;
646
770
  }
647
771
  function createSyntheticTouch(event, target) {
@@ -662,12 +786,20 @@ function createSyntheticTouch(event, target) {
662
786
  force: typeof event.pressure === 'number' ? event.pressure : 0,
663
787
  };
664
788
  }
665
- function defineTouchList(event, property, list) {
789
+ function defineTouchList(event, property, list, patches) {
790
+ var holder = event;
791
+ var had = false;
792
+ try {
793
+ had = Object.prototype.hasOwnProperty.call(event, property);
794
+ }
795
+ catch (_) {
796
+ }
797
+ patches.push({ property: property, had: had, previous: had ? holder[property] : undefined });
666
798
  try {
667
799
  Object.defineProperty(event, property, { value: list, configurable: true });
668
800
  }
669
801
  catch (_) {
670
- event[property] = list;
802
+ holder[property] = list;
671
803
  }
672
804
  }
673
805
  function filterByTarget(touches, target) {
@@ -678,7 +810,7 @@ function filterByTarget(touches, target) {
678
810
  }
679
811
  return filtered;
680
812
  }
681
- function synthesizeTouchEvent(event, resolvedType) {
813
+ function synthesizeTouchEvent(event, resolvedType, patches) {
682
814
  var phase = POINTER_PHASE_MAP[resolvedType];
683
815
  if (typeof phase === 'undefined')
684
816
  return;
@@ -697,9 +829,9 @@ function synthesizeTouchEvent(event, resolvedType) {
697
829
  if (index > -1)
698
830
  ACTIVE_TOUCHES.splice(index, 1);
699
831
  }
700
- defineTouchList(event, 'touches', createTouchList(ACTIVE_TOUCHES));
701
- defineTouchList(event, 'targetTouches', createTouchList(filterByTarget(ACTIVE_TOUCHES, originTarget)));
702
- defineTouchList(event, 'changedTouches', createTouchList([touch]));
832
+ defineTouchList(event, 'touches', createTouchList(ACTIVE_TOUCHES), patches);
833
+ defineTouchList(event, 'targetTouches', createTouchList(filterByTarget(ACTIVE_TOUCHES, originTarget)), patches);
834
+ defineTouchList(event, 'changedTouches', createTouchList([touch]), patches);
703
835
  }
704
836
 
705
837
  var KEY_CODE_MAP = {
@@ -806,21 +938,50 @@ var KEY_CODE_MAP = {
806
938
  226: 'IntlBackslash',
807
939
  };
808
940
 
941
+ var GLOBAL$4 = getGlobal$2();
809
942
  var LISTENER_STORE = [];
810
943
  var NOOP = function () {
811
944
  };
945
+ // Records live on the target itself, so they are collected with it and lookups only scan
946
+ // that target's own listeners. Targets that reject the expando fall back to LISTENER_STORE.
947
+ var STORE_KEY = '__webEventKitListeners__';
948
+ function resolveBucket(target, create) {
949
+ var holder = target;
950
+ try {
951
+ var existing = holder[STORE_KEY];
952
+ if (typeof existing !== 'undefined' && existing !== null)
953
+ return existing;
954
+ if (!create)
955
+ return LISTENER_STORE;
956
+ var bucket = [];
957
+ try {
958
+ Object.defineProperty(target, STORE_KEY, { value: bucket, configurable: true, enumerable: false, writable: true });
959
+ }
960
+ catch (_) {
961
+ holder[STORE_KEY] = bucket;
962
+ }
963
+ if (holder[STORE_KEY] !== bucket)
964
+ return LISTENER_STORE;
965
+ return bucket;
966
+ }
967
+ catch (_) {
968
+ return LISTENER_STORE;
969
+ }
970
+ }
812
971
  function findListenerRecord(target, type, callback, capture) {
813
- for (var i = 0; i < LISTENER_STORE.length; i++) {
814
- var record = LISTENER_STORE[i];
972
+ var bucket = resolveBucket(target, false);
973
+ for (var i = 0; i < bucket.length; i++) {
974
+ var record = bucket[i];
815
975
  if (record.target === target && record.type === type && record.callback === callback && record.capture === capture)
816
976
  return record;
817
977
  }
818
978
  return undefined;
819
979
  }
820
980
  function removeListenerRecord(record) {
821
- for (var i = 0; i < LISTENER_STORE.length; i++) {
822
- if (LISTENER_STORE[i] === record) {
823
- LISTENER_STORE.splice(i, 1);
981
+ var bucket = record.bucket;
982
+ for (var i = 0; i < bucket.length; i++) {
983
+ if (bucket[i] === record) {
984
+ bucket.splice(i, 1);
824
985
  return;
825
986
  }
826
987
  }
@@ -840,6 +1001,35 @@ function invokeCallback(callback, target, event) {
840
1001
  if (typeof callback === 'object' && callback !== null && typeof callback.handleEvent === 'function')
841
1002
  return callback.handleEvent(event);
842
1003
  }
1004
+ // The same Event object is handed to every listener, so any property this kit overrides has
1005
+ // to be put back before the next one runs — otherwise a `pointerdown` listener would observe
1006
+ // the `touchstart` type and synthetic touches written by a listener registered before it.
1007
+ function patchEventProperty(event, property, value, patches) {
1008
+ var holder = event;
1009
+ var had = false;
1010
+ try {
1011
+ had = Object.prototype.hasOwnProperty.call(event, property);
1012
+ }
1013
+ catch (_) {
1014
+ }
1015
+ patches.push({ property: property, had: had, previous: had ? holder[property] : undefined });
1016
+ defineEventProperty(event, property, value);
1017
+ }
1018
+ function restoreEventProperties(event, patches) {
1019
+ var holder = event;
1020
+ for (var i = patches.length - 1; i >= 0; i--) {
1021
+ var patch = patches[i];
1022
+ try {
1023
+ if (patch.had)
1024
+ defineEventProperty(event, patch.property, patch.previous);
1025
+ else
1026
+ delete holder[patch.property];
1027
+ }
1028
+ catch (_) {
1029
+ }
1030
+ }
1031
+ patches.length = 0;
1032
+ }
843
1033
  function defineEventProperty(event, property, value) {
844
1034
  try {
845
1035
  Object.defineProperty(event, property, { value: value, configurable: true });
@@ -872,7 +1062,7 @@ function fixKeyboardEvent(event) {
872
1062
  function createDispatcher(record) {
873
1063
  return function (event) {
874
1064
  if (typeof event === 'undefined')
875
- event = globalThis.event; // IE: implicit global event object
1065
+ event = GLOBAL$4.event; // IE: implicit global event object
876
1066
  if (typeof event === 'undefined' || event === null)
877
1067
  return;
878
1068
  if (record.released)
@@ -880,14 +1070,20 @@ function createDispatcher(record) {
880
1070
  fixLegacyEvent(event, record.target);
881
1071
  if (record.once)
882
1072
  releaseListenerRecord(record);
1073
+ var patches = [];
883
1074
  if (record.passive && !SUPPORTED_LISTENER_OPTIONS.passive)
884
- event.preventDefault = passivePreventDefault.bind(event);
1075
+ patchEventProperty(event, 'preventDefault', passivePreventDefault.bind(event), patches);
885
1076
  if (record.resolvedType !== record.type)
886
- defineEventProperty(event, 'type', record.type);
1077
+ patchEventProperty(event, 'type', record.type, patches);
887
1078
  if (record.touch)
888
- synthesizeTouchEvent(event, record.resolvedType);
1079
+ synthesizeTouchEvent(event, record.resolvedType, patches);
889
1080
  fixKeyboardEvent(event);
890
- invokeCallback(record.callback, record.target, event);
1081
+ try {
1082
+ invokeCallback(record.callback, record.target, event);
1083
+ }
1084
+ finally {
1085
+ restoreEventProperties(event, patches);
1086
+ }
891
1087
  };
892
1088
  }
893
1089
  function attachNativeListener(record) {
@@ -921,7 +1117,7 @@ function releaseListenerRecord(record) {
921
1117
  }
922
1118
  if (typeof record.signal !== 'undefined' && typeof record.onAbort === 'function' && typeof record.signal.removeEventListener === 'function') {
923
1119
  try {
924
- record.signal.removeEventListener('abort', record.onAbort);
1120
+ record.signal.removeEventListener('abort', record.onAbort, false);
925
1121
  }
926
1122
  catch (_) {
927
1123
  }
@@ -934,7 +1130,7 @@ function createEventPolyfill(type, init) {
934
1130
  }
935
1131
  catch (_) {
936
1132
  }
937
- var event = globalThis.document.createEvent('Event');
1133
+ var event = GLOBAL$4.document.createEvent('Event');
938
1134
  event.initEvent(type, typeof init !== 'undefined' && init.bubbles === true, typeof init !== 'undefined' && init.cancelable === true);
939
1135
  return event;
940
1136
  }
@@ -944,12 +1140,12 @@ function createCustomEventPolyfill(type, init) {
944
1140
  }
945
1141
  catch (_) {
946
1142
  }
947
- var event = globalThis.document.createEvent('CustomEvent');
1143
+ var event = GLOBAL$4.document.createEvent('CustomEvent');
948
1144
  event.initCustomEvent(type, typeof init !== 'undefined' && init.bubbles === true, typeof init !== 'undefined' && init.cancelable === true, typeof init !== 'undefined' && typeof init.detail !== 'undefined' ? init.detail : null);
949
1145
  return event;
950
1146
  }
951
1147
  var EventKit = {
952
- version: packageJSON.version,
1148
+ version: packageJSON$1.version,
953
1149
  utils: {
954
1150
  get supportedOptions() {
955
1151
  return {
@@ -973,15 +1169,16 @@ var EventKit = {
973
1169
  return NOOP;
974
1170
  var normalized = normalizeListenerOptions(options);
975
1171
  var existing = findListenerRecord(target, type, callback, normalized.capture);
976
- if (typeof existing !== 'undefined') {
977
- return function () {
978
- releaseListenerRecord(existing);
979
- };
980
- }
1172
+ // Native `addEventListener` ignores a duplicate registration, so hand back a releaser
1173
+ // that does nothing rather than one that would detach the first caller's listener.
1174
+ if (typeof existing !== 'undefined')
1175
+ return NOOP;
981
1176
  if (typeof normalized.signal !== 'undefined' && normalized.signal.aborted)
982
1177
  return NOOP;
983
1178
  var resolvedType = resolveEventType(target, type);
1179
+ var bucket = resolveBucket(target, true);
984
1180
  var record = {
1181
+ bucket: bucket,
985
1182
  target: target,
986
1183
  type: type,
987
1184
  callback: callback,
@@ -998,12 +1195,14 @@ var EventKit = {
998
1195
  record.wrapper = createDispatcher(record);
999
1196
  if (!attachNativeListener(record))
1000
1197
  return NOOP;
1001
- LISTENER_STORE.push(record);
1198
+ bucket.push(record);
1002
1199
  if (typeof record.signal !== 'undefined' && typeof record.signal.addEventListener === 'function') {
1003
1200
  record.onAbort = function () {
1004
1201
  releaseListenerRecord(record);
1005
1202
  };
1006
- record.signal.addEventListener('abort', record.onAbort, { once: true });
1203
+ // Engines without listener-options coerce `{once: true}` to capture, which would then
1204
+ // fail to match on removal; releaseListenerRecord detaches this anyway.
1205
+ record.signal.addEventListener('abort', record.onAbort, false);
1007
1206
  }
1008
1207
  return function () {
1009
1208
  releaseListenerRecord(record);
@@ -1028,9 +1227,22 @@ var EventKit = {
1028
1227
  },
1029
1228
  };
1030
1229
 
1230
+ function getGlobal$1() {
1231
+ if (typeof globalThis !== 'undefined')
1232
+ return globalThis;
1233
+ if (typeof self !== 'undefined')
1234
+ return self;
1235
+ if (typeof window !== 'undefined')
1236
+ return window;
1237
+ if (typeof global !== 'undefined')
1238
+ return global;
1239
+ return {};
1240
+ }
1241
+
1031
1242
  function createHiddenElement(tagName, focusable) {
1032
1243
  if (focusable === void 0) { focusable = true; }
1033
- var element = globalThis.document.createElement(tagName);
1244
+ var document = getGlobal$1().document;
1245
+ var element = document.createElement(tagName);
1034
1246
  if (typeof element.width !== 'undefined')
1035
1247
  element.width = '0';
1036
1248
  if (typeof element.height !== 'undefined')
@@ -1081,116 +1293,301 @@ function createHiddenElement(tagName, focusable) {
1081
1293
  return element;
1082
1294
  }
1083
1295
 
1084
- var RTL_LANGUAGES = ['ae', 'ar', 'arc', 'bcc', 'bqi', 'ckb', 'dv', 'fa', 'glk', 'he', 'iw', 'ku', 'mzn', 'nqo', 'pnb', 'ps', 'sd', 'ug', 'ur', 'yi'];
1085
- function normalizeLocale(locale) {
1086
- if (locale === null || typeof locale === 'undefined')
1087
- return locale;
1088
- if (locale.length === 0)
1296
+ var version = "0.0.5";
1297
+ var packageJSON = {
1298
+ version: version};
1299
+
1300
+ var RTL_LANGUAGES = ['ae', 'ar', 'arc', 'bcc', 'bqi', 'ckb', 'dv', 'fa', 'glk', 'he', 'iw', 'ji', 'ku', 'mzn', 'nqo', 'pnb', 'ps', 'sd', 'ug', 'ur', 'yi'];
1301
+ var RTL_SCRIPTS = ['Adlm', 'Arab', 'Aran', 'Hebr', 'Mand', 'Mend', 'Nkoo', 'Rohg', 'Samr', 'Syrc', 'Thaa', 'Yezi'];
1302
+ var LANGUAGE_PATTERN = /^[A-Za-z]{2,8}$/;
1303
+ var SCRIPT_PATTERN = /^[A-Za-z]{4}$/;
1304
+ var REGION_PATTERN = /^(?:[A-Za-z]{2}|[0-9]{3})$/;
1305
+ var VARIANT_PATTERN = /^(?:[A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3})$/;
1306
+ var SINGLETON_PATTERN = /^[A-Za-z0-9]$/;
1307
+ var EXTENSION_PATTERN = /^[A-Za-z0-9]{1,8}$/;
1308
+ function getGlobal() {
1309
+ if (typeof globalThis !== 'undefined')
1310
+ return globalThis;
1311
+ if (typeof self !== 'undefined')
1312
+ return self;
1313
+ if (typeof window !== 'undefined')
1314
+ return window;
1315
+ if (typeof global !== 'undefined')
1316
+ return global;
1317
+ return {};
1318
+ }
1319
+ function freeze(values) {
1320
+ return typeof Object.freeze === 'function' ? Object.freeze(values) : values;
1321
+ }
1322
+ function contains(values, value) {
1323
+ for (var i = 0; i < values.length; i++) {
1324
+ if (values[i] === value)
1325
+ return true;
1326
+ }
1327
+ return false;
1328
+ }
1329
+ function getIntlLocaleConstructor() {
1330
+ if (typeof Intl === 'undefined')
1331
+ return undefined;
1332
+ var constructor = Intl.Locale;
1333
+ return typeof constructor === 'function' ? constructor : undefined;
1334
+ }
1335
+ function parseTag(raw) {
1336
+ if (raw === null || typeof raw !== 'string')
1089
1337
  return null;
1090
- locale = locale.replace(/_/g, '-');
1091
- if (locale === 'C' || locale.toLowerCase() === 'posix')
1092
- return 'en-US';
1093
- if (locale.indexOf('.') !== -1)
1094
- return normalizeLocale(locale.split('.')[0]);
1095
- if (locale.indexOf('@') !== -1)
1096
- return normalizeLocale(locale.split('@')[0]);
1097
- var parts = locale.split('-');
1098
- if (parts.length === 0)
1338
+ var value = raw.replace(/_/g, '-');
1339
+ if (value.length === 0)
1099
1340
  return null;
1100
- parts[0] = parts[0].toLowerCase();
1101
- if (parts.length > 1 && parts[1].length === 2)
1102
- parts[1] = parts[1].toUpperCase();
1103
- if (parts.length > 2 && parts[1].length === 4)
1104
- parts[1] = parts[1].charAt(0).toUpperCase() + parts[1].slice(1).toLowerCase();
1105
- return parts.join('-');
1341
+ if (value === 'C' || value.toLowerCase() === 'posix')
1342
+ value = 'en-US';
1343
+ var dot = value.indexOf('.');
1344
+ if (dot !== -1)
1345
+ value = value.slice(0, dot);
1346
+ var at = value.indexOf('@');
1347
+ if (at !== -1)
1348
+ value = value.slice(0, at);
1349
+ if (value.length === 0)
1350
+ return null;
1351
+ var segments = value.split('-');
1352
+ if (LANGUAGE_PATTERN.test(segments[0]) === false)
1353
+ return null;
1354
+ var language = segments[0].toLowerCase();
1355
+ var index = 1;
1356
+ var script = null;
1357
+ if (index < segments.length && SCRIPT_PATTERN.test(segments[index])) {
1358
+ script = segments[index].charAt(0).toUpperCase() + segments[index].slice(1).toLowerCase();
1359
+ index++;
1360
+ }
1361
+ var region = null;
1362
+ if (index < segments.length && REGION_PATTERN.test(segments[index])) {
1363
+ region = segments[index].toUpperCase();
1364
+ index++;
1365
+ }
1366
+ var variants = [];
1367
+ while (index < segments.length && VARIANT_PATTERN.test(segments[index])) {
1368
+ variants.push(segments[index].toLowerCase());
1369
+ index++;
1370
+ }
1371
+ var extensions = [];
1372
+ while (index < segments.length) {
1373
+ var singleton = segments[index];
1374
+ if (SINGLETON_PATTERN.test(singleton) === false)
1375
+ return null;
1376
+ var isPrivateUse = singleton.toLowerCase() === 'x';
1377
+ var parts = [singleton.toLowerCase()];
1378
+ index++;
1379
+ while (index < segments.length) {
1380
+ var segment = segments[index];
1381
+ if (EXTENSION_PATTERN.test(segment) === false)
1382
+ return null;
1383
+ if (segment.length === 1 && isPrivateUse === false)
1384
+ break;
1385
+ parts.push(segment.toLowerCase());
1386
+ index++;
1387
+ }
1388
+ if (parts.length < 2)
1389
+ return null;
1390
+ extensions.push(parts.join('-'));
1391
+ }
1392
+ var base = [language];
1393
+ if (script !== null)
1394
+ base.push(script);
1395
+ if (region !== null)
1396
+ base.push(region);
1397
+ for (var i = 0; i < variants.length; i++)
1398
+ base.push(variants[i]);
1399
+ var baseName = base.join('-');
1400
+ return {
1401
+ tag: extensions.length === 0 ? baseName : baseName + '-' + extensions.join('-'),
1402
+ baseName: baseName,
1403
+ language: language,
1404
+ script: script,
1405
+ region: region,
1406
+ variants: freeze(variants),
1407
+ extensions: freeze(extensions),
1408
+ };
1106
1409
  }
1410
+ function isRTL(subtags) {
1411
+ if (subtags.script !== null)
1412
+ return contains(RTL_SCRIPTS, subtags.script);
1413
+ return contains(RTL_LANGUAGES, subtags.language);
1414
+ }
1415
+ function expandTag(tag) {
1416
+ var parsed = parseTag(tag);
1417
+ if (parsed === null)
1418
+ return freeze([]);
1419
+ var segments = parsed.baseName.split('-');
1420
+ var chain = [];
1421
+ for (var i = segments.length; i > 0; i--)
1422
+ chain.push(segments.slice(0, i).join('-'));
1423
+ return freeze(chain);
1424
+ }
1425
+ function toLookupKey(tag) {
1426
+ var parsed = parseTag(tag);
1427
+ return (parsed === null ? tag : parsed.baseName).toLowerCase();
1428
+ }
1429
+ function lookupTag(supported, preferred, fallback) {
1430
+ if (supported === null || typeof supported === 'undefined' || typeof supported.length !== 'number')
1431
+ return fallback;
1432
+ var keys = [];
1433
+ for (var i = 0; i < supported.length; i++)
1434
+ keys.push(toLookupKey(supported[i]));
1435
+ for (var i = 0; i < preferred.length; i++) {
1436
+ var chain = expandTag(preferred[i]);
1437
+ for (var j = 0; j < chain.length; j++) {
1438
+ var candidate = chain[j].toLowerCase();
1439
+ var prefix = candidate + '-';
1440
+ for (var k = 0; k < keys.length; k++) {
1441
+ if (keys[k] === candidate)
1442
+ return supported[k];
1443
+ }
1444
+ for (var k = 0; k < keys.length; k++) {
1445
+ if (keys[k].indexOf(prefix) === 0)
1446
+ return supported[k];
1447
+ }
1448
+ }
1449
+ }
1450
+ return fallback;
1451
+ }
1452
+ function resolveDirection(primary) {
1453
+ if (primary === null)
1454
+ return false;
1455
+ var IntlLocale = getIntlLocaleConstructor();
1456
+ if (typeof IntlLocale !== 'undefined') {
1457
+ try {
1458
+ var intlLocale = new IntlLocale(primary.tag);
1459
+ if (typeof intlLocale.getTextInfo === 'function')
1460
+ return intlLocale.getTextInfo().direction === 'rtl';
1461
+ if (typeof intlLocale.textInfo !== 'undefined')
1462
+ return intlLocale.textInfo.direction === 'rtl';
1463
+ }
1464
+ catch (_) {
1465
+ }
1466
+ }
1467
+ return isRTL(primary);
1468
+ }
1469
+ var subtags = null;
1107
1470
  var language = null;
1108
- var languages = [];
1471
+ var languages = freeze([]);
1472
+ var fallbacks = freeze([]);
1109
1473
  var timezone = null;
1110
1474
  var offset = 0;
1111
- var isRTLResolved = null;
1112
- function addLanguages(langs) {
1113
- for (var i = 0; i < langs.length; i++)
1114
- addLanguage(langs[i]);
1115
- }
1116
- function addLanguage(lang) {
1117
- lang = normalizeLocale(lang);
1118
- if (typeof lang === 'string' && languages.indexOf(lang) === -1) {
1119
- if (language === null)
1120
- language = lang;
1121
- languages.push(lang);
1475
+ var rtl = false;
1476
+ function resolveLanguages(candidates) {
1477
+ var resolved = [];
1478
+ var primary = null;
1479
+ for (var i = 0; i < candidates.length; i++) {
1480
+ var parsed = parseTag(candidates[i]);
1481
+ if (parsed === null)
1482
+ continue;
1483
+ if (contains(resolved, parsed.baseName))
1484
+ continue;
1485
+ if (primary === null)
1486
+ primary = parsed;
1487
+ resolved.push(parsed.baseName);
1488
+ }
1489
+ subtags = primary;
1490
+ language = primary === null ? null : primary.baseName;
1491
+ languages = freeze(resolved);
1492
+ fallbacks = primary === null ? freeze([]) : expandTag(primary.baseName);
1493
+ rtl = resolveDirection(primary);
1494
+ }
1495
+ function collectEnvironmentLanguages() {
1496
+ var candidates = [];
1497
+ var navigatorLike = getGlobal().navigator;
1498
+ if (typeof navigatorLike !== 'undefined' && navigatorLike !== null) {
1499
+ if (typeof navigatorLike.languages !== 'undefined' && navigatorLike.languages !== null) {
1500
+ for (var i = 0; i < navigatorLike.languages.length; i++)
1501
+ candidates.push(navigatorLike.languages[i]);
1502
+ }
1503
+ candidates.push(navigatorLike.language);
1504
+ candidates.push(navigatorLike.userLanguage);
1505
+ candidates.push(navigatorLike.browserLanguage);
1506
+ candidates.push(navigatorLike.systemLanguage);
1507
+ }
1508
+ if (typeof Intl !== 'undefined') {
1509
+ try {
1510
+ candidates.push(Intl.DateTimeFormat().resolvedOptions().locale);
1511
+ }
1512
+ catch (_) {
1513
+ }
1122
1514
  }
1515
+ return candidates;
1123
1516
  }
1517
+ var ENVIRONMENT_LANGUAGES = collectEnvironmentLanguages();
1518
+ resolveLanguages(ENVIRONMENT_LANGUAGES);
1124
1519
  if (typeof Intl !== 'undefined') {
1125
- try {
1126
- addLanguage(Intl.DateTimeFormat().resolvedOptions().locale);
1127
- }
1128
- catch (_) {
1129
- }
1130
1520
  try {
1131
1521
  timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
1132
1522
  }
1133
1523
  catch (_) {
1134
1524
  }
1135
1525
  }
1136
- if (typeof globalThis.navigator !== 'undefined') {
1137
- if (typeof globalThis.navigator.languages !== 'undefined')
1138
- addLanguages(globalThis.navigator.languages);
1139
- if (typeof globalThis.navigator.language !== 'undefined')
1140
- addLanguage(globalThis.navigator.language);
1141
- if (typeof globalThis.navigator.userLanguage !== 'undefined')
1142
- addLanguage(globalThis.navigator.userLanguage);
1143
- if (typeof globalThis.navigator.browserLanguage !== 'undefined')
1144
- addLanguage(globalThis.navigator.browserLanguage);
1145
- if (typeof globalThis.navigator.systemLanguage !== 'undefined')
1146
- addLanguage(globalThis.navigator.systemLanguage);
1147
- }
1148
1526
  try {
1149
1527
  offset = new Date().getTimezoneOffset() * -1;
1150
1528
  }
1151
1529
  catch (_) {
1152
1530
  }
1153
- if (typeof language === 'string') {
1154
- if (typeof Intl !== 'undefined' && typeof Intl.Locale !== 'undefined') {
1155
- try {
1156
- var intlLocale = new Intl.Locale(language);
1157
- if (typeof intlLocale.getTextInfo === 'function')
1158
- isRTLResolved = intlLocale.getTextInfo().direction === 'rtl';
1159
- else if (typeof intlLocale.textInfo !== 'undefined')
1160
- isRTLResolved = intlLocale.textInfo.direction === 'rtl';
1161
- }
1162
- catch (_) {
1163
- }
1164
- }
1165
- if (typeof isRTLResolved !== 'boolean') {
1166
- var matched = /^([A-Za-z]{1,8})(?:[-_][A-Za-z0-9]{1,8})*$/.exec(language);
1167
- if (matched !== null) {
1168
- var lang = matched[1].toLowerCase();
1169
- for (var i = 0; i < RTL_LANGUAGES.length; i++) {
1170
- if (RTL_LANGUAGES[i] === lang) {
1171
- isRTLResolved = true;
1172
- break;
1173
- }
1174
- }
1175
- }
1176
- }
1177
- }
1178
1531
  var LocaleKit = {
1179
- languages: languages};
1532
+ version: packageJSON.version,
1533
+ get language() {
1534
+ return language;
1535
+ },
1536
+ get languages() {
1537
+ return languages;
1538
+ },
1539
+ set languages(value) {
1540
+ resolveLanguages(typeof value === 'string' ? [value] : value);
1541
+ },
1542
+ get subtags() {
1543
+ return subtags;
1544
+ },
1545
+ get fallbacks() {
1546
+ return fallbacks;
1547
+ },
1548
+ get timezone() {
1549
+ return timezone;
1550
+ },
1551
+ get offset() {
1552
+ return offset;
1553
+ },
1554
+ get rtl() {
1555
+ return rtl;
1556
+ },
1557
+ reset: function () {
1558
+ resolveLanguages(ENVIRONMENT_LANGUAGES);
1559
+ },
1560
+ parse: function (tag) {
1561
+ return parseTag(tag);
1562
+ },
1563
+ expand: function (tag) {
1564
+ return expandTag(tag);
1565
+ },
1566
+ lookup: function (supported, fallback) {
1567
+ return lookupTag(supported, languages, typeof fallback === 'undefined' ? null : fallback);
1568
+ },
1569
+ };
1570
+ if (typeof Object.freeze === 'function')
1571
+ Object.freeze(LocaleKit);
1180
1572
 
1573
+ var GLOBAL$1 = getGlobal$1();
1574
+ var CACHE_PREFIX = 'web-launch-kit:';
1181
1575
  var TRACK_ID = 'track-id';
1182
- var BUNDLE_ID = 'bundle-id';
1576
+ var PRODUCT_ID = 'product-id';
1183
1577
  var TRACK_ID_CACHE_TTL = 1000 * 60 * 60;
1578
+ function toCacheKey(mode, query) {
1579
+ return CACHE_PREFIX + mode + ':' + query;
1580
+ }
1184
1581
  var idCache = (function () {
1185
1582
  var supportsLocalStorage;
1186
1583
  try {
1187
- if (typeof globalThis.localStorage === 'undefined') {
1584
+ if (typeof GLOBAL$1.localStorage === 'undefined' || GLOBAL$1.localStorage === null) {
1188
1585
  supportsLocalStorage = false;
1189
1586
  }
1190
1587
  else {
1191
1588
  var key = '__id_cache_test__';
1192
- globalThis.localStorage.setItem(key, '');
1193
- globalThis.localStorage.removeItem(key);
1589
+ GLOBAL$1.localStorage.setItem(key, '');
1590
+ GLOBAL$1.localStorage.removeItem(key);
1194
1591
  supportsLocalStorage = true;
1195
1592
  }
1196
1593
  }
@@ -1201,7 +1598,7 @@ var idCache = (function () {
1201
1598
  return {
1202
1599
  get: function (mode, query) {
1203
1600
  try {
1204
- var item = globalThis.localStorage.getItem(mode + ':' + query);
1601
+ var item = GLOBAL$1.localStorage.getItem(toCacheKey(mode, query));
1205
1602
  if (item == null)
1206
1603
  return undefined;
1207
1604
  var split = item.split('|');
@@ -1209,7 +1606,7 @@ var idCache = (function () {
1209
1606
  return undefined;
1210
1607
  var expiry = +split[0];
1211
1608
  if (isNotANumber(expiry) || expiry < getNow()) {
1212
- globalThis.localStorage.removeItem(mode + ':' + query);
1609
+ GLOBAL$1.localStorage.removeItem(toCacheKey(mode, query));
1213
1610
  return undefined;
1214
1611
  }
1215
1612
  return split[1];
@@ -1220,7 +1617,7 @@ var idCache = (function () {
1220
1617
  },
1221
1618
  set: function (mode, query, id) {
1222
1619
  try {
1223
- globalThis.localStorage.setItem(mode + ':' + query, getNow() + TRACK_ID_CACHE_TTL + '|' + id);
1620
+ GLOBAL$1.localStorage.setItem(toCacheKey(mode, query), getNow() + TRACK_ID_CACHE_TTL + '|' + id);
1224
1621
  }
1225
1622
  catch (_) {
1226
1623
  return;
@@ -1228,11 +1625,11 @@ var idCache = (function () {
1228
1625
  }
1229
1626
  };
1230
1627
  }
1231
- if (typeof globalThis.Map !== 'undefined') {
1232
- var cache_1 = new Map();
1628
+ if (typeof GLOBAL$1.Map !== 'undefined') {
1629
+ var cache_1 = new GLOBAL$1.Map();
1233
1630
  return {
1234
1631
  get: function (mode, query) {
1235
- var item = cache_1.get(mode + ':' + query);
1632
+ var item = cache_1.get(toCacheKey(mode, query));
1236
1633
  if (typeof item === 'undefined')
1237
1634
  return undefined;
1238
1635
  var split = item.split('|');
@@ -1240,20 +1637,20 @@ var idCache = (function () {
1240
1637
  return undefined;
1241
1638
  var expiry = +split[0];
1242
1639
  if (isNotANumber(expiry) || expiry < getNow()) {
1243
- cache_1.delete(mode + ':' + query);
1640
+ cache_1.delete(toCacheKey(mode, query));
1244
1641
  return undefined;
1245
1642
  }
1246
1643
  return split[1];
1247
1644
  },
1248
1645
  set: function (mode, query, id) {
1249
- cache_1.set(mode + ':' + query, getNow() + TRACK_ID_CACHE_TTL + '|' + id);
1646
+ cache_1.set(toCacheKey(mode, query), getNow() + TRACK_ID_CACHE_TTL + '|' + id);
1250
1647
  },
1251
1648
  };
1252
1649
  }
1253
1650
  var cache = Object.create(null);
1254
1651
  return {
1255
1652
  get: function (mode, query) {
1256
- var item = cache[mode + ':' + query];
1653
+ var item = cache[toCacheKey(mode, query)];
1257
1654
  if (typeof item === 'undefined')
1258
1655
  return undefined;
1259
1656
  var split = item.split('|');
@@ -1262,17 +1659,17 @@ var idCache = (function () {
1262
1659
  var expiry = +split[0];
1263
1660
  if (isNotANumber(expiry) || expiry < getNow()) {
1264
1661
  try {
1265
- delete cache[mode + ':' + query];
1662
+ delete cache[toCacheKey(mode, query)];
1266
1663
  }
1267
1664
  catch (_) {
1268
- cache[mode + ':' + query] = undefined;
1665
+ cache[toCacheKey(mode, query)] = undefined;
1269
1666
  }
1270
1667
  return undefined;
1271
1668
  }
1272
1669
  return split[1];
1273
1670
  },
1274
1671
  set: function (mode, query, id) {
1275
- cache[mode + ':' + query] = getNow() + TRACK_ID_CACHE_TTL + '|' + id;
1672
+ cache[toCacheKey(mode, query)] = getNow() + TRACK_ID_CACHE_TTL + '|' + id;
1276
1673
  }
1277
1674
  };
1278
1675
  })();
@@ -1286,8 +1683,8 @@ function getNow() {
1286
1683
  }
1287
1684
  function requestGet(url, async) {
1288
1685
  if (async === void 0) { async = false; }
1289
- if (typeof globalThis.fetch === 'function' && async) {
1290
- return globalThis.fetch(url)
1686
+ if (typeof GLOBAL$1.fetch === 'function' && async) {
1687
+ return GLOBAL$1.fetch(url)
1291
1688
  .then(function (response) {
1292
1689
  return response.json();
1293
1690
  })
@@ -1330,10 +1727,10 @@ function resolveGetProductIdURL(packageFamilyName) {
1330
1727
  if (locale === candidate)
1331
1728
  break;
1332
1729
  }
1333
- return 'https://displaycatalog.md.mp.microsoft.com/v7.0/products/lookup?value=' + globalThis.encodeURIComponent(packageFamilyName) + '&market=' + globalThis.encodeURIComponent(country) + '&languages=' + globalThis.encodeURIComponent(locale) + '&alternateId=PackageFamilyName';
1730
+ return 'https://displaycatalog.md.mp.microsoft.com/v7.0/products/lookup?value=' + encodeURIComponent(packageFamilyName) + '&market=' + encodeURIComponent(country) + '&languages=' + encodeURIComponent(locale) + '&alternateId=PackageFamilyName';
1334
1731
  }
1335
1732
  function resolveGetTrackIdURL(bundleId) {
1336
- return 'https://itunes.apple.com/lookup?bundleId=' + globalThis.encodeURIComponent(bundleId);
1733
+ return 'https://itunes.apple.com/lookup?bundleId=' + encodeURIComponent(bundleId);
1337
1734
  }
1338
1735
  function parseGetProductIdResponse(response) {
1339
1736
  if (typeof response === 'undefined')
@@ -1359,14 +1756,14 @@ function parseGetTrackIdResponse(response) {
1359
1756
  return '' + result.trackId;
1360
1757
  }
1361
1758
  function getProductId(packageFamilyName) {
1362
- var cache = idCache.get(BUNDLE_ID, packageFamilyName);
1759
+ var cache = idCache.get(PRODUCT_ID, packageFamilyName);
1363
1760
  if (typeof cache !== 'undefined')
1364
1761
  return cache;
1365
1762
  try {
1366
1763
  var productId = parseGetProductIdResponse(requestGet(resolveGetProductIdURL(packageFamilyName)));
1367
1764
  if (typeof productId === 'undefined')
1368
1765
  return undefined;
1369
- idCache.set(BUNDLE_ID, packageFamilyName, productId);
1766
+ idCache.set(PRODUCT_ID, packageFamilyName, productId);
1370
1767
  return productId;
1371
1768
  }
1372
1769
  catch (_) {
@@ -1389,7 +1786,7 @@ function getTrackId(bundleId) {
1389
1786
  }
1390
1787
  }
1391
1788
  function getProductIdAsync(packageFamilyName) {
1392
- var cache = idCache.get(BUNDLE_ID, packageFamilyName);
1789
+ var cache = idCache.get(PRODUCT_ID, packageFamilyName);
1393
1790
  if (typeof cache !== 'undefined')
1394
1791
  return Promise.resolve(cache);
1395
1792
  try {
@@ -1398,7 +1795,7 @@ function getProductIdAsync(packageFamilyName) {
1398
1795
  .then(function (productId) {
1399
1796
  if (typeof productId === 'undefined')
1400
1797
  return undefined;
1401
- idCache.set(BUNDLE_ID, packageFamilyName, productId);
1798
+ idCache.set(PRODUCT_ID, packageFamilyName, productId);
1402
1799
  return productId;
1403
1800
  });
1404
1801
  }
@@ -1426,15 +1823,16 @@ function getTrackIdAsync(bundleId) {
1426
1823
  }
1427
1824
 
1428
1825
  function getTopmostWindow() {
1826
+ var globalLike = getGlobal$1();
1429
1827
  try {
1430
- if (globalThis.top !== null && globalThis.top !== globalThis.window) {
1431
- void globalThis.top.location.href;
1432
- return globalThis.top;
1828
+ if (typeof globalLike.top !== 'undefined' && globalLike.top !== null && globalLike.top !== globalLike.window) {
1829
+ void globalLike.top.location.href;
1830
+ return globalLike.top;
1433
1831
  }
1434
1832
  }
1435
1833
  catch (_) {
1436
1834
  }
1437
- return globalThis;
1835
+ return globalLike;
1438
1836
  }
1439
1837
 
1440
1838
  exports.SettingType = void 0;
@@ -1505,7 +1903,8 @@ var IOS_DEFAULT_TIMEOUT = 2000;
1505
1903
  var WINDOWS_DEFAULT_TIMEOUT = 750;
1506
1904
  var MACOS_DEFAULT_TIMEOUT = 750;
1507
1905
  var DEFAULT_TIMEOUT = 750;
1508
- var NAVIGATOR = globalThis.navigator;
1906
+ var GLOBAL = getGlobal$1();
1907
+ var NAVIGATOR = GLOBAL.navigator;
1509
1908
  var CLEANUP_INPUT_ELEMENT = null;
1510
1909
  function createTypeGuard(tag) {
1511
1910
  return function (value) {
@@ -1565,7 +1964,7 @@ function isDocumentHidden() {
1565
1964
  return true;
1566
1965
  }
1567
1966
  function dispatchClickEvent(element, view) {
1568
- if (view === void 0) { view = globalThis; }
1967
+ if (view === void 0) { view = GLOBAL; }
1569
1968
  var fake;
1570
1969
  try {
1571
1970
  fake = new MouseEvent('click', {
@@ -1575,7 +1974,7 @@ function dispatchClickEvent(element, view) {
1575
1974
  });
1576
1975
  }
1577
1976
  catch (_) {
1578
- fake = globalThis.document.createEvent('MouseEvents');
1977
+ fake = GLOBAL.document.createEvent('MouseEvents');
1579
1978
  fake.initMouseEvent('click', true, true, view, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
1580
1979
  }
1581
1980
  element.dispatchEvent(fake);
@@ -1603,11 +2002,14 @@ function restoreFocus() {
1603
2002
  focus(top);
1604
2003
  if (hasFocus(topDocument))
1605
2004
  return true;
1606
- if (topDocument.body.tabIndex < 0)
1607
- topDocument.body.tabIndex = -1;
2005
+ var hadBodyTabIndex = topDocument.body.hasAttribute('tabindex');
2006
+ if (!hadBodyTabIndex)
2007
+ topDocument.body.setAttribute('tabindex', '-1');
1608
2008
  focus(topDocument.body);
1609
2009
  if (hasFocus(topDocument))
1610
2010
  return true;
2011
+ if (!hadBodyTabIndex)
2012
+ topDocument.body.removeAttribute('tabindex');
1611
2013
  var input = undefined;
1612
2014
  try {
1613
2015
  input = createHiddenElement('input');
@@ -1649,7 +2051,7 @@ function stripURL(value) {
1649
2051
  function resolveFocusEventConfig() {
1650
2052
  var top = getTopmostWindow();
1651
2053
  var topDocument = top.document;
1652
- if (typeof globalThis.cordova !== 'undefined') {
2054
+ if (typeof GLOBAL.cordova !== 'undefined') {
1653
2055
  return {
1654
2056
  focus: {
1655
2057
  target: topDocument,
@@ -1687,7 +2089,7 @@ function resolveFocusEventConfig() {
1687
2089
  };
1688
2090
  }
1689
2091
  }
1690
- else if (typeof globalThis.document.addEventListener === 'function') {
2092
+ else if (typeof GLOBAL.document.addEventListener === 'function') {
1691
2093
  return {
1692
2094
  focus: {
1693
2095
  target: top,
@@ -1727,12 +2129,12 @@ function openURL(tried, url, timeout) {
1727
2129
  var anchor = undefined;
1728
2130
  var iframe = undefined;
1729
2131
  function open() {
1730
- if (typeof globalThis.cordova !== 'undefined') {
1731
- if (typeof globalThis.cordova.InAppBrowser !== 'undefined') {
1732
- globalThis.cordova.InAppBrowser.open(url, '_system');
2132
+ if (typeof GLOBAL.cordova !== 'undefined' && GLOBAL.cordova !== null) {
2133
+ if (typeof GLOBAL.cordova.InAppBrowser !== 'undefined') {
2134
+ GLOBAL.cordova.InAppBrowser.open(url, '_system');
1733
2135
  }
1734
- else {
1735
- globalThis.open(url, '_system');
2136
+ else if (typeof GLOBAL.open === 'function') {
2137
+ GLOBAL.open(url, '_system');
1736
2138
  }
1737
2139
  return;
1738
2140
  }
@@ -1762,7 +2164,7 @@ function openURL(tried, url, timeout) {
1762
2164
  iframe = createHiddenElement('iframe');
1763
2165
  iframe.src = url;
1764
2166
  topDocument.body.appendChild(iframe);
1765
- globalThis.setTimeout(function () {
2167
+ setTimeout(function () {
1766
2168
  if (typeof iframe !== 'undefined') {
1767
2169
  try {
1768
2170
  topDocument.body.removeChild(iframe);
@@ -1826,7 +2228,7 @@ function openURL(tried, url, timeout) {
1826
2228
  timeoutId = undefined;
1827
2229
  }
1828
2230
  if (typeof config.blur.target !== 'undefined' && typeof config.blur.type !== 'undefined')
1829
- EventKit.remove(config.blur.target, config.blur.type, onfocus);
2231
+ EventKit.remove(config.blur.target, config.blur.type, onblur);
1830
2232
  if (typeof config.focus.target !== 'undefined' && typeof config.focus.type !== 'undefined')
1831
2233
  EventKit.add(config.focus.target, config.focus.type, onfocus);
1832
2234
  }
@@ -1839,7 +2241,7 @@ function openURL(tried, url, timeout) {
1839
2241
  else
1840
2242
  onfocus();
1841
2243
  }
1842
- timeoutId = globalThis.setTimeout(function () {
2244
+ timeoutId = setTimeout(function () {
1843
2245
  done(false);
1844
2246
  }, timeout);
1845
2247
  if (typeof config.blur.target !== 'undefined' && typeof config.blur.type !== 'undefined')
@@ -2047,13 +2449,22 @@ function isFullyBlockedInAppBrowser() {
2047
2449
  function isPartnerAppOnly() {
2048
2450
  return /weibo.*weibo__[\d.]+/i.test(PlatformKit.userAgent);
2049
2451
  }
2452
+ function canOpenWindowsSetting(version) {
2453
+ if (version.length === 0)
2454
+ return false;
2455
+ if (/^\d/.test(version) === false)
2456
+ return false;
2457
+ if (version === '95' || version === '98' || version === '2000')
2458
+ return false;
2459
+ return PlatformKit.compareVersion(version, '10') >= 0;
2460
+ }
2050
2461
  function canOpenSetting() {
2051
2462
  var os = PlatformKit.os.name;
2052
2463
  var version = PlatformKit.os.version;
2053
2464
  return !(os === 'unknown'
2054
2465
  || (os === 'android' && !canOpenIntent())
2055
2466
  || os === 'ios'
2056
- || (os === 'windows' && (version === 'Vista' || version === 'XP' || version === '2000' || version === 'NT 4.0' || version === 'NT 3.11' || version === 'ME' || PlatformKit.compareVersion(version, '10') < 0))
2467
+ || (os === 'windows' && !canOpenWindowsSetting(version))
2057
2468
  || (os === 'macos' && PlatformKit.compareVersion(version, '10.10') < 0));
2058
2469
  }
2059
2470
  function parseIntentURL(intent) {
@@ -2082,7 +2493,7 @@ function parseIntentURL(intent) {
2082
2493
  if (typeof extras['S.browser_fallback_url'] !== 'undefined') {
2083
2494
  var fallback = extras['S.browser_fallback_url'];
2084
2495
  try {
2085
- fallback = globalThis.decodeURIComponent(fallback);
2496
+ fallback = decodeURIComponent(fallback);
2086
2497
  }
2087
2498
  catch (_) {
2088
2499
  }
@@ -2102,9 +2513,9 @@ function createIntentURL(scheme, packageName, fallback) {
2102
2513
  if (typeof packageName !== 'undefined')
2103
2514
  intent += 'package=' + packageName + ';';
2104
2515
  if (typeof fallback !== 'undefined' && typeof fallback === 'string')
2105
- intent += 'S.browser_fallback_url=' + globalThis.encodeURIComponent(fallback) + ';';
2516
+ intent += 'S.browser_fallback_url=' + encodeURIComponent(fallback) + ';';
2106
2517
  else if (typeof packageName !== 'undefined')
2107
- intent += 'S.browser_fallback_url=' + globalThis.encodeURIComponent(createAppStoreURL(packageName, 'android')) + ';';
2518
+ intent += 'S.browser_fallback_url=' + encodeURIComponent(createAppStoreURL(packageName, 'android')) + ';';
2108
2519
  return intent + 'end';
2109
2520
  }
2110
2521
  function createAppStoreURL(id, os) {
@@ -2136,7 +2547,7 @@ function createWebStoreURL(id, os) {
2136
2547
  }
2137
2548
  }
2138
2549
  function escapeURIComponentString(value) {
2139
- return globalThis.encodeURIComponent(value)
2550
+ return encodeURIComponent(value)
2140
2551
  .replace(/[!'()*]/g, function (char) {
2141
2552
  return '%' + char.charCodeAt(0).toString(16);
2142
2553
  });
@@ -2205,10 +2616,10 @@ function isUserActivationActive() {
2205
2616
  return typeof NAVIGATOR !== 'undefined' && typeof NAVIGATOR.userActivation !== 'undefined' && NAVIGATOR.userActivation.isActive;
2206
2617
  }
2207
2618
  function canShowDirectoryPicker() {
2208
- return typeof globalThis.showDirectoryPicker === 'function';
2619
+ return typeof GLOBAL.showDirectoryPicker === 'function';
2209
2620
  }
2210
2621
  function canShowOpenFilePicker() {
2211
- return typeof globalThis.showOpenFilePicker === 'function';
2622
+ return typeof GLOBAL.showOpenFilePicker === 'function';
2212
2623
  }
2213
2624
  function isFileSystemFileHandle(handle) {
2214
2625
  return handle.kind === 'file';
@@ -2276,7 +2687,7 @@ function resolveFile(module) {
2276
2687
  resolve(fileListToArray(module.files));
2277
2688
  }
2278
2689
  function onfocus() {
2279
- globalThis.setTimeout(function () {
2690
+ setTimeout(function () {
2280
2691
  if (module.value.length > 0)
2281
2692
  done(true);
2282
2693
  else
@@ -2306,7 +2717,7 @@ function resolveFile(module) {
2306
2717
  EventKit.add(config.focus.target, config.focus.type, onfocus);
2307
2718
  if (typeof config.visibilitychange.target !== 'undefined' && typeof config.visibilitychange.type !== 'undefined')
2308
2719
  EventKit.add(config.visibilitychange.target, config.visibilitychange.type, onvisibilitychange);
2309
- globalThis.setTimeout(function () {
2720
+ setTimeout(function () {
2310
2721
  EventKit.add(topDocument, 'click', onclick);
2311
2722
  }, 100);
2312
2723
  CLEANUP_INPUT_ELEMENT = function () {
@@ -2391,7 +2802,7 @@ function walk(directory, basePath) {
2391
2802
  }
2392
2803
  var LaunchKit = {
2393
2804
  SettingType: exports.SettingType,
2394
- version: packageJSON$2.version,
2805
+ version: packageJSON$3.version,
2395
2806
  utils: {
2396
2807
  get canOpenIntent() {
2397
2808
  return canOpenIntent();
@@ -2439,7 +2850,12 @@ var LaunchKit = {
2439
2850
  }
2440
2851
  else {
2441
2852
  tried[index] = '[function fallback]';
2442
- url();
2853
+ try {
2854
+ url();
2855
+ }
2856
+ catch (_) {
2857
+ return openURLSequential(index + 1);
2858
+ }
2443
2859
  resolve(by);
2444
2860
  }
2445
2861
  }
@@ -2612,7 +3028,7 @@ var LaunchKit = {
2612
3028
  option.id = options.id;
2613
3029
  if (typeof options.startIn !== 'undefined')
2614
3030
  option.startIn = options.startIn;
2615
- module = globalThis.showDirectoryPicker(option);
3031
+ module = GLOBAL.showDirectoryPicker(option);
2616
3032
  }
2617
3033
  else {
2618
3034
  var input = createHiddenElement('input');
@@ -2650,7 +3066,7 @@ var LaunchKit = {
2650
3066
  }
2651
3067
  }
2652
3068
  }
2653
- module = globalThis.showOpenFilePicker(option);
3069
+ module = GLOBAL.showOpenFilePicker(option);
2654
3070
  }
2655
3071
  else {
2656
3072
  var input = createHiddenElement('input');