web-launch-kit 0.0.3 → 0.0.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.
@@ -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.5";
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')
470
+ return false;
471
+ try {
472
+ return GLOBAL$5.matchMedia('(display-mode: standalone)').matches === true;
473
+ }
474
+ catch (_) {
345
475
  return false;
346
- return globalThis.matchMedia('(display-mode: standalone)').matches;
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.3";
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,48 @@ 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
+ var STORE_KEY = '__webEventKitListeners__';
946
+ function resolveBucket(target, create) {
947
+ var holder = target;
948
+ try {
949
+ var existing = holder[STORE_KEY];
950
+ if (typeof existing !== 'undefined' && existing !== null)
951
+ return existing;
952
+ if (!create)
953
+ return LISTENER_STORE;
954
+ var bucket = [];
955
+ try {
956
+ Object.defineProperty(target, STORE_KEY, { value: bucket, configurable: true, enumerable: false, writable: true });
957
+ }
958
+ catch (_) {
959
+ holder[STORE_KEY] = bucket;
960
+ }
961
+ if (holder[STORE_KEY] !== bucket)
962
+ return LISTENER_STORE;
963
+ return bucket;
964
+ }
965
+ catch (_) {
966
+ return LISTENER_STORE;
967
+ }
968
+ }
812
969
  function findListenerRecord(target, type, callback, capture) {
813
- for (var i = 0; i < LISTENER_STORE.length; i++) {
814
- var record = LISTENER_STORE[i];
970
+ var bucket = resolveBucket(target, false);
971
+ for (var i = 0; i < bucket.length; i++) {
972
+ var record = bucket[i];
815
973
  if (record.target === target && record.type === type && record.callback === callback && record.capture === capture)
816
974
  return record;
817
975
  }
818
976
  return undefined;
819
977
  }
820
978
  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);
979
+ var bucket = record.bucket;
980
+ for (var i = 0; i < bucket.length; i++) {
981
+ if (bucket[i] === record) {
982
+ bucket.splice(i, 1);
824
983
  return;
825
984
  }
826
985
  }
@@ -840,6 +999,32 @@ function invokeCallback(callback, target, event) {
840
999
  if (typeof callback === 'object' && callback !== null && typeof callback.handleEvent === 'function')
841
1000
  return callback.handleEvent(event);
842
1001
  }
1002
+ function patchEventProperty(event, property, value, patches) {
1003
+ var holder = event;
1004
+ var had = false;
1005
+ try {
1006
+ had = Object.prototype.hasOwnProperty.call(event, property);
1007
+ }
1008
+ catch (_) {
1009
+ }
1010
+ patches.push({ property: property, had: had, previous: had ? holder[property] : undefined });
1011
+ defineEventProperty(event, property, value);
1012
+ }
1013
+ function restoreEventProperties(event, patches) {
1014
+ var holder = event;
1015
+ for (var i = patches.length - 1; i >= 0; i--) {
1016
+ var patch = patches[i];
1017
+ try {
1018
+ if (patch.had)
1019
+ defineEventProperty(event, patch.property, patch.previous);
1020
+ else
1021
+ delete holder[patch.property];
1022
+ }
1023
+ catch (_) {
1024
+ }
1025
+ }
1026
+ patches.length = 0;
1027
+ }
843
1028
  function defineEventProperty(event, property, value) {
844
1029
  try {
845
1030
  Object.defineProperty(event, property, { value: value, configurable: true });
@@ -872,7 +1057,7 @@ function fixKeyboardEvent(event) {
872
1057
  function createDispatcher(record) {
873
1058
  return function (event) {
874
1059
  if (typeof event === 'undefined')
875
- event = globalThis.event; // IE: implicit global event object
1060
+ event = GLOBAL$4.event; // IE: implicit global event object
876
1061
  if (typeof event === 'undefined' || event === null)
877
1062
  return;
878
1063
  if (record.released)
@@ -880,14 +1065,20 @@ function createDispatcher(record) {
880
1065
  fixLegacyEvent(event, record.target);
881
1066
  if (record.once)
882
1067
  releaseListenerRecord(record);
1068
+ var patches = [];
883
1069
  if (record.passive && !SUPPORTED_LISTENER_OPTIONS.passive)
884
- event.preventDefault = passivePreventDefault.bind(event);
1070
+ patchEventProperty(event, 'preventDefault', passivePreventDefault.bind(event), patches);
885
1071
  if (record.resolvedType !== record.type)
886
- defineEventProperty(event, 'type', record.type);
1072
+ patchEventProperty(event, 'type', record.type, patches);
887
1073
  if (record.touch)
888
- synthesizeTouchEvent(event, record.resolvedType);
1074
+ synthesizeTouchEvent(event, record.resolvedType, patches);
889
1075
  fixKeyboardEvent(event);
890
- invokeCallback(record.callback, record.target, event);
1076
+ try {
1077
+ invokeCallback(record.callback, record.target, event);
1078
+ }
1079
+ finally {
1080
+ restoreEventProperties(event, patches);
1081
+ }
891
1082
  };
892
1083
  }
893
1084
  function attachNativeListener(record) {
@@ -921,7 +1112,7 @@ function releaseListenerRecord(record) {
921
1112
  }
922
1113
  if (typeof record.signal !== 'undefined' && typeof record.onAbort === 'function' && typeof record.signal.removeEventListener === 'function') {
923
1114
  try {
924
- record.signal.removeEventListener('abort', record.onAbort);
1115
+ record.signal.removeEventListener('abort', record.onAbort, false);
925
1116
  }
926
1117
  catch (_) {
927
1118
  }
@@ -934,7 +1125,7 @@ function createEventPolyfill(type, init) {
934
1125
  }
935
1126
  catch (_) {
936
1127
  }
937
- var event = globalThis.document.createEvent('Event');
1128
+ var event = GLOBAL$4.document.createEvent('Event');
938
1129
  event.initEvent(type, typeof init !== 'undefined' && init.bubbles === true, typeof init !== 'undefined' && init.cancelable === true);
939
1130
  return event;
940
1131
  }
@@ -944,12 +1135,12 @@ function createCustomEventPolyfill(type, init) {
944
1135
  }
945
1136
  catch (_) {
946
1137
  }
947
- var event = globalThis.document.createEvent('CustomEvent');
1138
+ var event = GLOBAL$4.document.createEvent('CustomEvent');
948
1139
  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
1140
  return event;
950
1141
  }
951
1142
  var EventKit = {
952
- version: packageJSON.version,
1143
+ version: packageJSON$1.version,
953
1144
  utils: {
954
1145
  get supportedOptions() {
955
1146
  return {
@@ -973,15 +1164,14 @@ var EventKit = {
973
1164
  return NOOP;
974
1165
  var normalized = normalizeListenerOptions(options);
975
1166
  var existing = findListenerRecord(target, type, callback, normalized.capture);
976
- if (typeof existing !== 'undefined') {
977
- return function () {
978
- releaseListenerRecord(existing);
979
- };
980
- }
1167
+ if (typeof existing !== 'undefined')
1168
+ return NOOP;
981
1169
  if (typeof normalized.signal !== 'undefined' && normalized.signal.aborted)
982
1170
  return NOOP;
983
1171
  var resolvedType = resolveEventType(target, type);
1172
+ var bucket = resolveBucket(target, true);
984
1173
  var record = {
1174
+ bucket: bucket,
985
1175
  target: target,
986
1176
  type: type,
987
1177
  callback: callback,
@@ -998,12 +1188,12 @@ var EventKit = {
998
1188
  record.wrapper = createDispatcher(record);
999
1189
  if (!attachNativeListener(record))
1000
1190
  return NOOP;
1001
- LISTENER_STORE.push(record);
1191
+ bucket.push(record);
1002
1192
  if (typeof record.signal !== 'undefined' && typeof record.signal.addEventListener === 'function') {
1003
1193
  record.onAbort = function () {
1004
1194
  releaseListenerRecord(record);
1005
1195
  };
1006
- record.signal.addEventListener('abort', record.onAbort, { once: true });
1196
+ record.signal.addEventListener('abort', record.onAbort, false);
1007
1197
  }
1008
1198
  return function () {
1009
1199
  releaseListenerRecord(record);
@@ -1028,9 +1218,22 @@ var EventKit = {
1028
1218
  },
1029
1219
  };
1030
1220
 
1221
+ function getGlobal$1() {
1222
+ if (typeof globalThis !== 'undefined')
1223
+ return globalThis;
1224
+ if (typeof self !== 'undefined')
1225
+ return self;
1226
+ if (typeof window !== 'undefined')
1227
+ return window;
1228
+ if (typeof global !== 'undefined')
1229
+ return global;
1230
+ return {};
1231
+ }
1232
+
1031
1233
  function createHiddenElement(tagName, focusable) {
1032
1234
  if (focusable === void 0) { focusable = true; }
1033
- var element = globalThis.document.createElement(tagName);
1235
+ var document = getGlobal$1().document;
1236
+ var element = document.createElement(tagName);
1034
1237
  if (typeof element.width !== 'undefined')
1035
1238
  element.width = '0';
1036
1239
  if (typeof element.height !== 'undefined')
@@ -1081,116 +1284,301 @@ function createHiddenElement(tagName, focusable) {
1081
1284
  return element;
1082
1285
  }
1083
1286
 
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)
1287
+ var version = "0.0.5";
1288
+ var packageJSON = {
1289
+ version: version};
1290
+
1291
+ var RTL_LANGUAGES = ['ae', 'ar', 'arc', 'bcc', 'bqi', 'ckb', 'dv', 'fa', 'glk', 'he', 'iw', 'ji', 'ku', 'mzn', 'nqo', 'pnb', 'ps', 'sd', 'ug', 'ur', 'yi'];
1292
+ var RTL_SCRIPTS = ['Adlm', 'Arab', 'Aran', 'Hebr', 'Mand', 'Mend', 'Nkoo', 'Rohg', 'Samr', 'Syrc', 'Thaa', 'Yezi'];
1293
+ var LANGUAGE_PATTERN = /^[A-Za-z]{2,8}$/;
1294
+ var SCRIPT_PATTERN = /^[A-Za-z]{4}$/;
1295
+ var REGION_PATTERN = /^(?:[A-Za-z]{2}|[0-9]{3})$/;
1296
+ var VARIANT_PATTERN = /^(?:[A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3})$/;
1297
+ var SINGLETON_PATTERN = /^[A-Za-z0-9]$/;
1298
+ var EXTENSION_PATTERN = /^[A-Za-z0-9]{1,8}$/;
1299
+ function getGlobal() {
1300
+ if (typeof globalThis !== 'undefined')
1301
+ return globalThis;
1302
+ if (typeof self !== 'undefined')
1303
+ return self;
1304
+ if (typeof window !== 'undefined')
1305
+ return window;
1306
+ if (typeof global !== 'undefined')
1307
+ return global;
1308
+ return {};
1309
+ }
1310
+ function freeze(values) {
1311
+ return typeof Object.freeze === 'function' ? Object.freeze(values) : values;
1312
+ }
1313
+ function contains(values, value) {
1314
+ for (var i = 0; i < values.length; i++) {
1315
+ if (values[i] === value)
1316
+ return true;
1317
+ }
1318
+ return false;
1319
+ }
1320
+ function getIntlLocaleConstructor() {
1321
+ if (typeof Intl === 'undefined')
1322
+ return undefined;
1323
+ var constructor = Intl.Locale;
1324
+ return typeof constructor === 'function' ? constructor : undefined;
1325
+ }
1326
+ function parseTag(raw) {
1327
+ if (raw === null || typeof raw !== 'string')
1328
+ return null;
1329
+ var value = raw.replace(/_/g, '-');
1330
+ if (value.length === 0)
1089
1331
  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)
1332
+ if (value === 'C' || value.toLowerCase() === 'posix')
1333
+ value = 'en-US';
1334
+ var dot = value.indexOf('.');
1335
+ if (dot !== -1)
1336
+ value = value.slice(0, dot);
1337
+ var at = value.indexOf('@');
1338
+ if (at !== -1)
1339
+ value = value.slice(0, at);
1340
+ if (value.length === 0)
1099
1341
  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('-');
1342
+ var segments = value.split('-');
1343
+ if (LANGUAGE_PATTERN.test(segments[0]) === false)
1344
+ return null;
1345
+ var language = segments[0].toLowerCase();
1346
+ var index = 1;
1347
+ var script = null;
1348
+ if (index < segments.length && SCRIPT_PATTERN.test(segments[index])) {
1349
+ script = segments[index].charAt(0).toUpperCase() + segments[index].slice(1).toLowerCase();
1350
+ index++;
1351
+ }
1352
+ var region = null;
1353
+ if (index < segments.length && REGION_PATTERN.test(segments[index])) {
1354
+ region = segments[index].toUpperCase();
1355
+ index++;
1356
+ }
1357
+ var variants = [];
1358
+ while (index < segments.length && VARIANT_PATTERN.test(segments[index])) {
1359
+ variants.push(segments[index].toLowerCase());
1360
+ index++;
1361
+ }
1362
+ var extensions = [];
1363
+ while (index < segments.length) {
1364
+ var singleton = segments[index];
1365
+ if (SINGLETON_PATTERN.test(singleton) === false)
1366
+ return null;
1367
+ var isPrivateUse = singleton.toLowerCase() === 'x';
1368
+ var parts = [singleton.toLowerCase()];
1369
+ index++;
1370
+ while (index < segments.length) {
1371
+ var segment = segments[index];
1372
+ if (EXTENSION_PATTERN.test(segment) === false)
1373
+ return null;
1374
+ if (segment.length === 1 && isPrivateUse === false)
1375
+ break;
1376
+ parts.push(segment.toLowerCase());
1377
+ index++;
1378
+ }
1379
+ if (parts.length < 2)
1380
+ return null;
1381
+ extensions.push(parts.join('-'));
1382
+ }
1383
+ var base = [language];
1384
+ if (script !== null)
1385
+ base.push(script);
1386
+ if (region !== null)
1387
+ base.push(region);
1388
+ for (var i = 0; i < variants.length; i++)
1389
+ base.push(variants[i]);
1390
+ var baseName = base.join('-');
1391
+ return {
1392
+ tag: extensions.length === 0 ? baseName : baseName + '-' + extensions.join('-'),
1393
+ baseName: baseName,
1394
+ language: language,
1395
+ script: script,
1396
+ region: region,
1397
+ variants: freeze(variants),
1398
+ extensions: freeze(extensions),
1399
+ };
1106
1400
  }
1401
+ function isRTL(subtags) {
1402
+ if (subtags.script !== null)
1403
+ return contains(RTL_SCRIPTS, subtags.script);
1404
+ return contains(RTL_LANGUAGES, subtags.language);
1405
+ }
1406
+ function expandTag(tag) {
1407
+ var parsed = parseTag(tag);
1408
+ if (parsed === null)
1409
+ return freeze([]);
1410
+ var segments = parsed.baseName.split('-');
1411
+ var chain = [];
1412
+ for (var i = segments.length; i > 0; i--)
1413
+ chain.push(segments.slice(0, i).join('-'));
1414
+ return freeze(chain);
1415
+ }
1416
+ function toLookupKey(tag) {
1417
+ var parsed = parseTag(tag);
1418
+ return (parsed === null ? tag : parsed.baseName).toLowerCase();
1419
+ }
1420
+ function lookupTag(supported, preferred, fallback) {
1421
+ if (supported === null || typeof supported === 'undefined' || typeof supported.length !== 'number')
1422
+ return fallback;
1423
+ var keys = [];
1424
+ for (var i = 0; i < supported.length; i++)
1425
+ keys.push(toLookupKey(supported[i]));
1426
+ for (var i = 0; i < preferred.length; i++) {
1427
+ var chain = expandTag(preferred[i]);
1428
+ for (var j = 0; j < chain.length; j++) {
1429
+ var candidate = chain[j].toLowerCase();
1430
+ var prefix = candidate + '-';
1431
+ for (var k = 0; k < keys.length; k++) {
1432
+ if (keys[k] === candidate)
1433
+ return supported[k];
1434
+ }
1435
+ for (var k = 0; k < keys.length; k++) {
1436
+ if (keys[k].indexOf(prefix) === 0)
1437
+ return supported[k];
1438
+ }
1439
+ }
1440
+ }
1441
+ return fallback;
1442
+ }
1443
+ function resolveDirection(primary) {
1444
+ if (primary === null)
1445
+ return false;
1446
+ var IntlLocale = getIntlLocaleConstructor();
1447
+ if (typeof IntlLocale !== 'undefined') {
1448
+ try {
1449
+ var intlLocale = new IntlLocale(primary.tag);
1450
+ if (typeof intlLocale.getTextInfo === 'function')
1451
+ return intlLocale.getTextInfo().direction === 'rtl';
1452
+ if (typeof intlLocale.textInfo !== 'undefined')
1453
+ return intlLocale.textInfo.direction === 'rtl';
1454
+ }
1455
+ catch (_) {
1456
+ }
1457
+ }
1458
+ return isRTL(primary);
1459
+ }
1460
+ var subtags = null;
1107
1461
  var language = null;
1108
- var languages = [];
1462
+ var languages = freeze([]);
1463
+ var fallbacks = freeze([]);
1109
1464
  var timezone = null;
1110
1465
  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);
1466
+ var rtl = false;
1467
+ function resolveLanguages(candidates) {
1468
+ var resolved = [];
1469
+ var primary = null;
1470
+ for (var i = 0; i < candidates.length; i++) {
1471
+ var parsed = parseTag(candidates[i]);
1472
+ if (parsed === null)
1473
+ continue;
1474
+ if (contains(resolved, parsed.baseName))
1475
+ continue;
1476
+ if (primary === null)
1477
+ primary = parsed;
1478
+ resolved.push(parsed.baseName);
1479
+ }
1480
+ subtags = primary;
1481
+ language = primary === null ? null : primary.baseName;
1482
+ languages = freeze(resolved);
1483
+ fallbacks = primary === null ? freeze([]) : expandTag(primary.baseName);
1484
+ rtl = resolveDirection(primary);
1485
+ }
1486
+ function collectEnvironmentLanguages() {
1487
+ var candidates = [];
1488
+ var navigatorLike = getGlobal().navigator;
1489
+ if (typeof navigatorLike !== 'undefined' && navigatorLike !== null) {
1490
+ if (typeof navigatorLike.languages !== 'undefined' && navigatorLike.languages !== null) {
1491
+ for (var i = 0; i < navigatorLike.languages.length; i++)
1492
+ candidates.push(navigatorLike.languages[i]);
1493
+ }
1494
+ candidates.push(navigatorLike.language);
1495
+ candidates.push(navigatorLike.userLanguage);
1496
+ candidates.push(navigatorLike.browserLanguage);
1497
+ candidates.push(navigatorLike.systemLanguage);
1498
+ }
1499
+ if (typeof Intl !== 'undefined') {
1500
+ try {
1501
+ candidates.push(Intl.DateTimeFormat().resolvedOptions().locale);
1502
+ }
1503
+ catch (_) {
1504
+ }
1122
1505
  }
1506
+ return candidates;
1123
1507
  }
1508
+ var ENVIRONMENT_LANGUAGES = collectEnvironmentLanguages();
1509
+ resolveLanguages(ENVIRONMENT_LANGUAGES);
1124
1510
  if (typeof Intl !== 'undefined') {
1125
- try {
1126
- addLanguage(Intl.DateTimeFormat().resolvedOptions().locale);
1127
- }
1128
- catch (_) {
1129
- }
1130
1511
  try {
1131
1512
  timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
1132
1513
  }
1133
1514
  catch (_) {
1134
1515
  }
1135
1516
  }
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
1517
  try {
1149
1518
  offset = new Date().getTimezoneOffset() * -1;
1150
1519
  }
1151
1520
  catch (_) {
1152
1521
  }
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
1522
  var LocaleKit = {
1179
- languages: languages};
1523
+ version: packageJSON.version,
1524
+ get language() {
1525
+ return language;
1526
+ },
1527
+ get languages() {
1528
+ return languages;
1529
+ },
1530
+ set languages(value) {
1531
+ resolveLanguages(typeof value === 'string' ? [value] : value);
1532
+ },
1533
+ get subtags() {
1534
+ return subtags;
1535
+ },
1536
+ get fallbacks() {
1537
+ return fallbacks;
1538
+ },
1539
+ get timezone() {
1540
+ return timezone;
1541
+ },
1542
+ get offset() {
1543
+ return offset;
1544
+ },
1545
+ get rtl() {
1546
+ return rtl;
1547
+ },
1548
+ reset: function () {
1549
+ resolveLanguages(ENVIRONMENT_LANGUAGES);
1550
+ },
1551
+ parse: function (tag) {
1552
+ return parseTag(tag);
1553
+ },
1554
+ expand: function (tag) {
1555
+ return expandTag(tag);
1556
+ },
1557
+ lookup: function (supported, fallback) {
1558
+ return lookupTag(supported, languages, typeof fallback === 'undefined' ? null : fallback);
1559
+ },
1560
+ };
1561
+ if (typeof Object.freeze === 'function')
1562
+ Object.freeze(LocaleKit);
1180
1563
 
1564
+ var GLOBAL$1 = getGlobal$1();
1565
+ var CACHE_PREFIX = 'web-launch-kit:';
1181
1566
  var TRACK_ID = 'track-id';
1182
- var BUNDLE_ID = 'bundle-id';
1567
+ var PRODUCT_ID = 'product-id';
1183
1568
  var TRACK_ID_CACHE_TTL = 1000 * 60 * 60;
1569
+ function toCacheKey(mode, query) {
1570
+ return CACHE_PREFIX + mode + ':' + query;
1571
+ }
1184
1572
  var idCache = (function () {
1185
1573
  var supportsLocalStorage;
1186
1574
  try {
1187
- if (typeof globalThis.localStorage === 'undefined') {
1575
+ if (typeof GLOBAL$1.localStorage === 'undefined' || GLOBAL$1.localStorage === null) {
1188
1576
  supportsLocalStorage = false;
1189
1577
  }
1190
1578
  else {
1191
1579
  var key = '__id_cache_test__';
1192
- globalThis.localStorage.setItem(key, '');
1193
- globalThis.localStorage.removeItem(key);
1580
+ GLOBAL$1.localStorage.setItem(key, '');
1581
+ GLOBAL$1.localStorage.removeItem(key);
1194
1582
  supportsLocalStorage = true;
1195
1583
  }
1196
1584
  }
@@ -1201,7 +1589,7 @@ var idCache = (function () {
1201
1589
  return {
1202
1590
  get: function (mode, query) {
1203
1591
  try {
1204
- var item = globalThis.localStorage.getItem(mode + ':' + query);
1592
+ var item = GLOBAL$1.localStorage.getItem(toCacheKey(mode, query));
1205
1593
  if (item == null)
1206
1594
  return undefined;
1207
1595
  var split = item.split('|');
@@ -1209,7 +1597,7 @@ var idCache = (function () {
1209
1597
  return undefined;
1210
1598
  var expiry = +split[0];
1211
1599
  if (isNotANumber(expiry) || expiry < getNow()) {
1212
- globalThis.localStorage.removeItem(mode + ':' + query);
1600
+ GLOBAL$1.localStorage.removeItem(toCacheKey(mode, query));
1213
1601
  return undefined;
1214
1602
  }
1215
1603
  return split[1];
@@ -1220,7 +1608,7 @@ var idCache = (function () {
1220
1608
  },
1221
1609
  set: function (mode, query, id) {
1222
1610
  try {
1223
- globalThis.localStorage.setItem(mode + ':' + query, getNow() + TRACK_ID_CACHE_TTL + '|' + id);
1611
+ GLOBAL$1.localStorage.setItem(toCacheKey(mode, query), getNow() + TRACK_ID_CACHE_TTL + '|' + id);
1224
1612
  }
1225
1613
  catch (_) {
1226
1614
  return;
@@ -1228,11 +1616,11 @@ var idCache = (function () {
1228
1616
  }
1229
1617
  };
1230
1618
  }
1231
- if (typeof globalThis.Map !== 'undefined') {
1232
- var cache_1 = new Map();
1619
+ if (typeof GLOBAL$1.Map !== 'undefined') {
1620
+ var cache_1 = new GLOBAL$1.Map();
1233
1621
  return {
1234
1622
  get: function (mode, query) {
1235
- var item = cache_1.get(mode + ':' + query);
1623
+ var item = cache_1.get(toCacheKey(mode, query));
1236
1624
  if (typeof item === 'undefined')
1237
1625
  return undefined;
1238
1626
  var split = item.split('|');
@@ -1240,20 +1628,20 @@ var idCache = (function () {
1240
1628
  return undefined;
1241
1629
  var expiry = +split[0];
1242
1630
  if (isNotANumber(expiry) || expiry < getNow()) {
1243
- cache_1.delete(mode + ':' + query);
1631
+ cache_1.delete(toCacheKey(mode, query));
1244
1632
  return undefined;
1245
1633
  }
1246
1634
  return split[1];
1247
1635
  },
1248
1636
  set: function (mode, query, id) {
1249
- cache_1.set(mode + ':' + query, getNow() + TRACK_ID_CACHE_TTL + '|' + id);
1637
+ cache_1.set(toCacheKey(mode, query), getNow() + TRACK_ID_CACHE_TTL + '|' + id);
1250
1638
  },
1251
1639
  };
1252
1640
  }
1253
1641
  var cache = Object.create(null);
1254
1642
  return {
1255
1643
  get: function (mode, query) {
1256
- var item = cache[mode + ':' + query];
1644
+ var item = cache[toCacheKey(mode, query)];
1257
1645
  if (typeof item === 'undefined')
1258
1646
  return undefined;
1259
1647
  var split = item.split('|');
@@ -1262,17 +1650,17 @@ var idCache = (function () {
1262
1650
  var expiry = +split[0];
1263
1651
  if (isNotANumber(expiry) || expiry < getNow()) {
1264
1652
  try {
1265
- delete cache[mode + ':' + query];
1653
+ delete cache[toCacheKey(mode, query)];
1266
1654
  }
1267
1655
  catch (_) {
1268
- cache[mode + ':' + query] = undefined;
1656
+ cache[toCacheKey(mode, query)] = undefined;
1269
1657
  }
1270
1658
  return undefined;
1271
1659
  }
1272
1660
  return split[1];
1273
1661
  },
1274
1662
  set: function (mode, query, id) {
1275
- cache[mode + ':' + query] = getNow() + TRACK_ID_CACHE_TTL + '|' + id;
1663
+ cache[toCacheKey(mode, query)] = getNow() + TRACK_ID_CACHE_TTL + '|' + id;
1276
1664
  }
1277
1665
  };
1278
1666
  })();
@@ -1286,8 +1674,8 @@ function getNow() {
1286
1674
  }
1287
1675
  function requestGet(url, async) {
1288
1676
  if (async === void 0) { async = false; }
1289
- if (typeof globalThis.fetch === 'function' && async) {
1290
- return globalThis.fetch(url)
1677
+ if (typeof GLOBAL$1.fetch === 'function' && async) {
1678
+ return GLOBAL$1.fetch(url)
1291
1679
  .then(function (response) {
1292
1680
  return response.json();
1293
1681
  })
@@ -1330,10 +1718,10 @@ function resolveGetProductIdURL(packageFamilyName) {
1330
1718
  if (locale === candidate)
1331
1719
  break;
1332
1720
  }
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';
1721
+ return 'https://displaycatalog.md.mp.microsoft.com/v7.0/products/lookup?value=' + encodeURIComponent(packageFamilyName) + '&market=' + encodeURIComponent(country) + '&languages=' + encodeURIComponent(locale) + '&alternateId=PackageFamilyName';
1334
1722
  }
1335
1723
  function resolveGetTrackIdURL(bundleId) {
1336
- return 'https://itunes.apple.com/lookup?bundleId=' + globalThis.encodeURIComponent(bundleId);
1724
+ return 'https://itunes.apple.com/lookup?bundleId=' + encodeURIComponent(bundleId);
1337
1725
  }
1338
1726
  function parseGetProductIdResponse(response) {
1339
1727
  if (typeof response === 'undefined')
@@ -1359,14 +1747,14 @@ function parseGetTrackIdResponse(response) {
1359
1747
  return '' + result.trackId;
1360
1748
  }
1361
1749
  function getProductId(packageFamilyName) {
1362
- var cache = idCache.get(BUNDLE_ID, packageFamilyName);
1750
+ var cache = idCache.get(PRODUCT_ID, packageFamilyName);
1363
1751
  if (typeof cache !== 'undefined')
1364
1752
  return cache;
1365
1753
  try {
1366
1754
  var productId = parseGetProductIdResponse(requestGet(resolveGetProductIdURL(packageFamilyName)));
1367
1755
  if (typeof productId === 'undefined')
1368
1756
  return undefined;
1369
- idCache.set(BUNDLE_ID, packageFamilyName, productId);
1757
+ idCache.set(PRODUCT_ID, packageFamilyName, productId);
1370
1758
  return productId;
1371
1759
  }
1372
1760
  catch (_) {
@@ -1389,7 +1777,7 @@ function getTrackId(bundleId) {
1389
1777
  }
1390
1778
  }
1391
1779
  function getProductIdAsync(packageFamilyName) {
1392
- var cache = idCache.get(BUNDLE_ID, packageFamilyName);
1780
+ var cache = idCache.get(PRODUCT_ID, packageFamilyName);
1393
1781
  if (typeof cache !== 'undefined')
1394
1782
  return Promise.resolve(cache);
1395
1783
  try {
@@ -1398,7 +1786,7 @@ function getProductIdAsync(packageFamilyName) {
1398
1786
  .then(function (productId) {
1399
1787
  if (typeof productId === 'undefined')
1400
1788
  return undefined;
1401
- idCache.set(BUNDLE_ID, packageFamilyName, productId);
1789
+ idCache.set(PRODUCT_ID, packageFamilyName, productId);
1402
1790
  return productId;
1403
1791
  });
1404
1792
  }
@@ -1426,15 +1814,16 @@ function getTrackIdAsync(bundleId) {
1426
1814
  }
1427
1815
 
1428
1816
  function getTopmostWindow() {
1817
+ var globalLike = getGlobal$1();
1429
1818
  try {
1430
- if (globalThis.top !== null && globalThis.top !== globalThis.window) {
1431
- void globalThis.top.location.href;
1432
- return globalThis.top;
1819
+ if (typeof globalLike.top !== 'undefined' && globalLike.top !== null && globalLike.top !== globalLike.window) {
1820
+ void globalLike.top.location.href;
1821
+ return globalLike.top;
1433
1822
  }
1434
1823
  }
1435
1824
  catch (_) {
1436
1825
  }
1437
- return globalThis;
1826
+ return globalLike;
1438
1827
  }
1439
1828
 
1440
1829
  exports.SettingType = void 0;
@@ -1505,8 +1894,10 @@ var IOS_DEFAULT_TIMEOUT = 2000;
1505
1894
  var WINDOWS_DEFAULT_TIMEOUT = 750;
1506
1895
  var MACOS_DEFAULT_TIMEOUT = 750;
1507
1896
  var DEFAULT_TIMEOUT = 750;
1508
- var NAVIGATOR = globalThis.navigator;
1897
+ var GLOBAL = getGlobal$1();
1898
+ var NAVIGATOR = GLOBAL.navigator;
1509
1899
  var CLEANUP_INPUT_ELEMENT = null;
1900
+ var DEBUG = false;
1510
1901
  function createTypeGuard(tag) {
1511
1902
  return function (value) {
1512
1903
  return Object.prototype.toString.call(value) === '[object ' + tag + ']';
@@ -1565,7 +1956,7 @@ function isDocumentHidden() {
1565
1956
  return true;
1566
1957
  }
1567
1958
  function dispatchClickEvent(element, view) {
1568
- if (view === void 0) { view = globalThis; }
1959
+ if (view === void 0) { view = GLOBAL; }
1569
1960
  var fake;
1570
1961
  try {
1571
1962
  fake = new MouseEvent('click', {
@@ -1575,7 +1966,7 @@ function dispatchClickEvent(element, view) {
1575
1966
  });
1576
1967
  }
1577
1968
  catch (_) {
1578
- fake = globalThis.document.createEvent('MouseEvents');
1969
+ fake = GLOBAL.document.createEvent('MouseEvents');
1579
1970
  fake.initMouseEvent('click', true, true, view, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
1580
1971
  }
1581
1972
  element.dispatchEvent(fake);
@@ -1603,11 +1994,14 @@ function restoreFocus() {
1603
1994
  focus(top);
1604
1995
  if (hasFocus(topDocument))
1605
1996
  return true;
1606
- if (topDocument.body.tabIndex < 0)
1607
- topDocument.body.tabIndex = -1;
1997
+ var hadBodyTabIndex = topDocument.body.hasAttribute('tabindex');
1998
+ if (!hadBodyTabIndex)
1999
+ topDocument.body.setAttribute('tabindex', '-1');
1608
2000
  focus(topDocument.body);
1609
2001
  if (hasFocus(topDocument))
1610
2002
  return true;
2003
+ if (!hadBodyTabIndex)
2004
+ topDocument.body.removeAttribute('tabindex');
1611
2005
  var input = undefined;
1612
2006
  try {
1613
2007
  input = createHiddenElement('input');
@@ -1649,7 +2043,7 @@ function stripURL(value) {
1649
2043
  function resolveFocusEventConfig() {
1650
2044
  var top = getTopmostWindow();
1651
2045
  var topDocument = top.document;
1652
- if (typeof globalThis.cordova !== 'undefined') {
2046
+ if (typeof GLOBAL.cordova !== 'undefined') {
1653
2047
  return {
1654
2048
  focus: {
1655
2049
  target: topDocument,
@@ -1687,7 +2081,7 @@ function resolveFocusEventConfig() {
1687
2081
  };
1688
2082
  }
1689
2083
  }
1690
- else if (typeof globalThis.document.addEventListener === 'function') {
2084
+ else if (typeof GLOBAL.document.addEventListener === 'function') {
1691
2085
  return {
1692
2086
  focus: {
1693
2087
  target: top,
@@ -1727,12 +2121,12 @@ function openURL(tried, url, timeout) {
1727
2121
  var anchor = undefined;
1728
2122
  var iframe = undefined;
1729
2123
  function open() {
1730
- if (typeof globalThis.cordova !== 'undefined') {
1731
- if (typeof globalThis.cordova.InAppBrowser !== 'undefined') {
1732
- globalThis.cordova.InAppBrowser.open(url, '_system');
2124
+ if (typeof GLOBAL.cordova !== 'undefined' && GLOBAL.cordova !== null) {
2125
+ if (typeof GLOBAL.cordova.InAppBrowser !== 'undefined') {
2126
+ GLOBAL.cordova.InAppBrowser.open(url, '_system');
1733
2127
  }
1734
- else {
1735
- globalThis.open(url, '_system');
2128
+ else if (typeof GLOBAL.open === 'function') {
2129
+ GLOBAL.open(url, '_system');
1736
2130
  }
1737
2131
  return;
1738
2132
  }
@@ -1762,7 +2156,7 @@ function openURL(tried, url, timeout) {
1762
2156
  iframe = createHiddenElement('iframe');
1763
2157
  iframe.src = url;
1764
2158
  topDocument.body.appendChild(iframe);
1765
- globalThis.setTimeout(function () {
2159
+ setTimeout(function () {
1766
2160
  if (typeof iframe !== 'undefined') {
1767
2161
  try {
1768
2162
  topDocument.body.removeChild(iframe);
@@ -1777,7 +2171,8 @@ function openURL(tried, url, timeout) {
1777
2171
  }
1778
2172
  }
1779
2173
  return new Promise(function (resolve, reject) {
1780
- debugger;
2174
+ if (DEBUG)
2175
+ debugger;
1781
2176
  var timeoutId;
1782
2177
  var resolved = false;
1783
2178
  function cleanup() {
@@ -1826,7 +2221,7 @@ function openURL(tried, url, timeout) {
1826
2221
  timeoutId = undefined;
1827
2222
  }
1828
2223
  if (typeof config.blur.target !== 'undefined' && typeof config.blur.type !== 'undefined')
1829
- EventKit.remove(config.blur.target, config.blur.type, onfocus);
2224
+ EventKit.remove(config.blur.target, config.blur.type, onblur);
1830
2225
  if (typeof config.focus.target !== 'undefined' && typeof config.focus.type !== 'undefined')
1831
2226
  EventKit.add(config.focus.target, config.focus.type, onfocus);
1832
2227
  }
@@ -1839,7 +2234,7 @@ function openURL(tried, url, timeout) {
1839
2234
  else
1840
2235
  onfocus();
1841
2236
  }
1842
- timeoutId = globalThis.setTimeout(function () {
2237
+ timeoutId = setTimeout(function () {
1843
2238
  done(false);
1844
2239
  }, timeout);
1845
2240
  if (typeof config.blur.target !== 'undefined' && typeof config.blur.type !== 'undefined')
@@ -2047,13 +2442,22 @@ function isFullyBlockedInAppBrowser() {
2047
2442
  function isPartnerAppOnly() {
2048
2443
  return /weibo.*weibo__[\d.]+/i.test(PlatformKit.userAgent);
2049
2444
  }
2445
+ function canOpenWindowsSetting(version) {
2446
+ if (version.length === 0)
2447
+ return false;
2448
+ if (/^\d/.test(version) === false)
2449
+ return false;
2450
+ if (version === '95' || version === '98' || version === '2000')
2451
+ return false;
2452
+ return PlatformKit.compareVersion(version, '10') >= 0;
2453
+ }
2050
2454
  function canOpenSetting() {
2051
2455
  var os = PlatformKit.os.name;
2052
2456
  var version = PlatformKit.os.version;
2053
2457
  return !(os === 'unknown'
2054
2458
  || (os === 'android' && !canOpenIntent())
2055
2459
  || 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))
2460
+ || (os === 'windows' && !canOpenWindowsSetting(version))
2057
2461
  || (os === 'macos' && PlatformKit.compareVersion(version, '10.10') < 0));
2058
2462
  }
2059
2463
  function parseIntentURL(intent) {
@@ -2082,7 +2486,7 @@ function parseIntentURL(intent) {
2082
2486
  if (typeof extras['S.browser_fallback_url'] !== 'undefined') {
2083
2487
  var fallback = extras['S.browser_fallback_url'];
2084
2488
  try {
2085
- fallback = globalThis.decodeURIComponent(fallback);
2489
+ fallback = decodeURIComponent(fallback);
2086
2490
  }
2087
2491
  catch (_) {
2088
2492
  }
@@ -2102,9 +2506,9 @@ function createIntentURL(scheme, packageName, fallback) {
2102
2506
  if (typeof packageName !== 'undefined')
2103
2507
  intent += 'package=' + packageName + ';';
2104
2508
  if (typeof fallback !== 'undefined' && typeof fallback === 'string')
2105
- intent += 'S.browser_fallback_url=' + globalThis.encodeURIComponent(fallback) + ';';
2509
+ intent += 'S.browser_fallback_url=' + encodeURIComponent(fallback) + ';';
2106
2510
  else if (typeof packageName !== 'undefined')
2107
- intent += 'S.browser_fallback_url=' + globalThis.encodeURIComponent(createAppStoreURL(packageName, 'android')) + ';';
2511
+ intent += 'S.browser_fallback_url=' + encodeURIComponent(createAppStoreURL(packageName, 'android')) + ';';
2108
2512
  return intent + 'end';
2109
2513
  }
2110
2514
  function createAppStoreURL(id, os) {
@@ -2136,7 +2540,7 @@ function createWebStoreURL(id, os) {
2136
2540
  }
2137
2541
  }
2138
2542
  function escapeURIComponentString(value) {
2139
- return globalThis.encodeURIComponent(value)
2543
+ return encodeURIComponent(value)
2140
2544
  .replace(/[!'()*]/g, function (char) {
2141
2545
  return '%' + char.charCodeAt(0).toString(16);
2142
2546
  });
@@ -2205,10 +2609,10 @@ function isUserActivationActive() {
2205
2609
  return typeof NAVIGATOR !== 'undefined' && typeof NAVIGATOR.userActivation !== 'undefined' && NAVIGATOR.userActivation.isActive;
2206
2610
  }
2207
2611
  function canShowDirectoryPicker() {
2208
- return typeof globalThis.showDirectoryPicker === 'function';
2612
+ return typeof GLOBAL.showDirectoryPicker === 'function';
2209
2613
  }
2210
2614
  function canShowOpenFilePicker() {
2211
- return typeof globalThis.showOpenFilePicker === 'function';
2615
+ return typeof GLOBAL.showOpenFilePicker === 'function';
2212
2616
  }
2213
2617
  function isFileSystemFileHandle(handle) {
2214
2618
  return handle.kind === 'file';
@@ -2276,7 +2680,7 @@ function resolveFile(module) {
2276
2680
  resolve(fileListToArray(module.files));
2277
2681
  }
2278
2682
  function onfocus() {
2279
- globalThis.setTimeout(function () {
2683
+ setTimeout(function () {
2280
2684
  if (module.value.length > 0)
2281
2685
  done(true);
2282
2686
  else
@@ -2306,7 +2710,7 @@ function resolveFile(module) {
2306
2710
  EventKit.add(config.focus.target, config.focus.type, onfocus);
2307
2711
  if (typeof config.visibilitychange.target !== 'undefined' && typeof config.visibilitychange.type !== 'undefined')
2308
2712
  EventKit.add(config.visibilitychange.target, config.visibilitychange.type, onvisibilitychange);
2309
- globalThis.setTimeout(function () {
2713
+ setTimeout(function () {
2310
2714
  EventKit.add(topDocument, 'click', onclick);
2311
2715
  }, 100);
2312
2716
  CLEANUP_INPUT_ELEMENT = function () {
@@ -2391,7 +2795,13 @@ function walk(directory, basePath) {
2391
2795
  }
2392
2796
  var LaunchKit = {
2393
2797
  SettingType: exports.SettingType,
2394
- version: packageJSON$2.version,
2798
+ version: packageJSON$3.version,
2799
+ get debug() {
2800
+ return DEBUG;
2801
+ },
2802
+ set debug(value) {
2803
+ DEBUG = value === true;
2804
+ },
2395
2805
  utils: {
2396
2806
  get canOpenIntent() {
2397
2807
  return canOpenIntent();
@@ -2439,7 +2849,12 @@ var LaunchKit = {
2439
2849
  }
2440
2850
  else {
2441
2851
  tried[index] = '[function fallback]';
2442
- url();
2852
+ try {
2853
+ url();
2854
+ }
2855
+ catch (_) {
2856
+ return openURLSequential(index + 1);
2857
+ }
2443
2858
  resolve(by);
2444
2859
  }
2445
2860
  }
@@ -2612,7 +3027,7 @@ var LaunchKit = {
2612
3027
  option.id = options.id;
2613
3028
  if (typeof options.startIn !== 'undefined')
2614
3029
  option.startIn = options.startIn;
2615
- module = globalThis.showDirectoryPicker(option);
3030
+ module = GLOBAL.showDirectoryPicker(option);
2616
3031
  }
2617
3032
  else {
2618
3033
  var input = createHiddenElement('input');
@@ -2650,7 +3065,7 @@ var LaunchKit = {
2650
3065
  }
2651
3066
  }
2652
3067
  }
2653
- module = globalThis.showOpenFilePicker(option);
3068
+ module = GLOBAL.showOpenFilePicker(option);
2654
3069
  }
2655
3070
  else {
2656
3071
  var input = createHiddenElement('input');