web-launch-kit 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,14 +2,14 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var version$1 = "0.0.1";
5
+ var version$2 = "0.0.3";
6
+ var packageJSON$2 = {
7
+ version: version$2};
8
+
9
+ var version$1 = "0.0.4";
6
10
  var packageJSON$1 = {
7
11
  version: version$1};
8
12
 
9
- var version = "0.0.4";
10
- var packageJSON = {
11
- version: version};
12
-
13
13
  var NAVIGATOR$1 = globalThis.navigator;
14
14
  var USER_AGENT = typeof NAVIGATOR$1 !== 'undefined' ? NAVIGATOR$1.userAgent : '';
15
15
  var USER_AGENT_DATA = typeof NAVIGATOR$1 !== 'undefined' ? NAVIGATOR$1.userAgentData : undefined;
@@ -298,7 +298,7 @@ function parseFromHighEntropyValues() {
298
298
  }
299
299
  ready = parseFromHighEntropyValues();
300
300
  var PlatformKit = {
301
- version: packageJSON.version,
301
+ version: packageJSON$1.version,
302
302
  get ready() {
303
303
  return ready;
304
304
  },
@@ -369,6 +369,665 @@ var PlatformKit = {
369
369
  }
370
370
  };
371
371
 
372
+ var version = "0.0.1";
373
+ var packageJSON = {
374
+ version: version};
375
+
376
+ var VENDORS = ['', 'webkit', 'moz', 'ms', 'MS', 'o', 'O'];
377
+ // https://cordova.apache.org/docs/en/latest/cordova/events/events.html
378
+ var CORDOVA_DOCUMENT_EVENTS = ['deviceready', 'pause', 'resume', 'backbutton', 'menubutton', 'searchbutton', 'startcallbutton', 'endcallbutton', 'volumedownbutton', 'volumeupbutton', 'activated', 'cordovacallbackerror'];
379
+ // iOS `<video>` fullscreen events have no `on` attribute but are valid on any element exposing `webkitEnterFullscreen` — they must pass through untouched.
380
+ var IOS_VIDEO_FULLSCREEN_EVENTS = ['webkitbeginfullscreen', 'webkitendfullscreen', 'webkitpresentationmodechanged'];
381
+ var TYPE_ALIAS_MAP = {
382
+ 'focus': ['focus', 'focusin'],
383
+ 'blur': ['blur', 'focusout'],
384
+ 'wheel': ['wheel', 'mousewheel', 'DOMMouseScroll'],
385
+ 'fullscreenchange': ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange', 'MSFullscreenChange', 'msfullscreenchange'],
386
+ 'fullscreenerror': ['fullscreenerror', 'webkitfullscreenerror', 'mozfullscreenerror', 'MSFullscreenError', 'msfullscreenerror'],
387
+ 'pointerdown': ['pointerdown', 'MSPointerDown'],
388
+ 'pointermove': ['pointermove', 'MSPointerMove'],
389
+ 'pointerup': ['pointerup', 'MSPointerUp'],
390
+ 'pointercancel': ['pointercancel', 'MSPointerCancel'],
391
+ 'pointerover': ['pointerover', 'MSPointerOver'],
392
+ 'pointerout': ['pointerout', 'MSPointerOut'],
393
+ 'pointerenter': ['pointerenter', 'MSPointerEnter', 'mouseenter'],
394
+ 'pointerleave': ['pointerleave', 'MSPointerLeave', 'mouseleave'],
395
+ 'gotpointercapture': ['gotpointercapture', 'MSGotPointerCapture'],
396
+ 'lostpointercapture': ['lostpointercapture', 'MSLostPointerCapture'],
397
+ 'pointerlockchange': ['pointerlockchange', 'webkitpointerlockchange', 'mozpointerlockchange', 'mspointerlockchange'],
398
+ 'pointerlockerror': ['pointerlockerror', 'webkitpointerlockerror', 'mozpointerlockerror', 'mspointerlockerror'],
399
+ 'touchstart': ['touchstart', 'pointerdown', 'MSPointerDown'],
400
+ 'touchmove': ['touchmove', 'pointermove', 'MSPointerMove'],
401
+ 'touchend': ['touchend', 'pointerup', 'MSPointerUp'],
402
+ 'touchcancel': ['touchcancel', 'pointercancel', 'MSPointerCancel'],
403
+ 'transitionrun': ['transitionrun', 'webkitTransitionRun'],
404
+ 'transitionstart': ['transitionstart', 'webkitTransitionStart'],
405
+ 'transitionend': ['transitionend', 'webkitTransitionEnd', 'oTransitionEnd', 'otransitionend', 'MSTransitionEnd'],
406
+ 'animationstart': ['animationstart', 'webkitAnimationStart', 'oanimationstart', 'MSAnimationStart'],
407
+ 'animationiteration': ['animationiteration', 'webkitAnimationIteration', 'oanimationiteration', 'MSAnimationIteration'],
408
+ 'animationend': ['animationend', 'webkitAnimationEnd', 'oanimationend', 'MSAnimationEnd'],
409
+ 'visibilitychange': ['visibilitychange', 'webkitvisibilitychange', 'mozvisibilitychange', 'msvisibilitychange'],
410
+ };
411
+ var FULLSCREEN_REQUEST_MAP = {
412
+ '': ['requestFullscreen'],
413
+ 'webkit': ['webkitRequestFullscreen', 'webkitRequestFullScreen'],
414
+ 'moz': ['mozRequestFullScreen', 'mozRequestFullscreen'],
415
+ 'ms': ['msRequestFullscreen'],
416
+ 'MS': ['msRequestFullscreen'],
417
+ };
418
+ function asRecord(value) {
419
+ return value;
420
+ }
421
+ function hasOnProperty(host, name) {
422
+ if (typeof host === 'undefined' || host === null)
423
+ return false;
424
+ if (typeof asRecord(host)['on' + name] !== 'undefined')
425
+ return true;
426
+ var lower = name.toLowerCase();
427
+ return lower !== name && typeof asRecord(host)['on' + lower] !== 'undefined';
428
+ }
429
+ function probeHosts(target) {
430
+ 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);
435
+ return hosts;
436
+ }
437
+ function extractVendorPrefix(name) {
438
+ for (var i = 1; i < VENDORS.length; i++) {
439
+ if (name.indexOf(VENDORS[i]) === 0)
440
+ return VENDORS[i];
441
+ }
442
+ return '';
443
+ }
444
+ function testStyleSupport(name, styleProperty) {
445
+ if (typeof globalThis.document === 'undefined' || typeof globalThis.document.documentElement === 'undefined')
446
+ return false;
447
+ var style = globalThis.document.documentElement.style;
448
+ if (typeof style === 'undefined' || style === null)
449
+ return false;
450
+ var prefix = extractVendorPrefix(name);
451
+ var property;
452
+ if (prefix === '')
453
+ property = styleProperty;
454
+ else
455
+ property = prefix + styleProperty.charAt(0).toUpperCase() + styleProperty.slice(1);
456
+ return typeof asRecord(style)[property] !== 'undefined';
457
+ }
458
+ function testFullscreenSupport(name) {
459
+ if (typeof globalThis.document === 'undefined' || typeof globalThis.document.documentElement === 'undefined')
460
+ return false;
461
+ var element = globalThis.document.documentElement;
462
+ var methods = FULLSCREEN_REQUEST_MAP[extractVendorPrefix(name)];
463
+ if (typeof methods === 'undefined')
464
+ return false;
465
+ for (var i = 0; i < methods.length; i++) {
466
+ if (typeof asRecord(element)[methods[i]] === 'function')
467
+ return true;
468
+ }
469
+ return false;
470
+ }
471
+ function isEventTypeSupported(target, name) {
472
+ var hosts = probeHosts(target);
473
+ for (var i = 0; i < hosts.length; i++) {
474
+ if (hasOnProperty(hosts[i], name))
475
+ return true;
476
+ }
477
+ var lower = name.toLowerCase();
478
+ if (lower.indexOf('transition') > -1)
479
+ return testStyleSupport(name, 'transition');
480
+ if (lower.indexOf('animation') > -1)
481
+ return testStyleSupport(name, 'animation');
482
+ if (lower.indexOf('fullscreen') > -1)
483
+ return testFullscreenSupport(name);
484
+ return false;
485
+ }
486
+ function resolveEventType(target, type) {
487
+ if (target === globalThis.document && CORDOVA_DOCUMENT_EVENTS.indexOf(type) > -1)
488
+ return type;
489
+ if (typeof asRecord(target)['webkitEnterFullscreen'] === 'function' && IOS_VIDEO_FULLSCREEN_EVENTS.indexOf(type) > -1)
490
+ return type;
491
+ var candidates = typeof TYPE_ALIAS_MAP[type] !== 'undefined' ? TYPE_ALIAS_MAP[type] : [type];
492
+ for (var i = 0; i < candidates.length; i++) {
493
+ if (isEventTypeSupported(target, candidates[i]))
494
+ return candidates[i];
495
+ }
496
+ for (var i = 1; i < VENDORS.length; i++) {
497
+ for (var j = 0; j < candidates.length; j++) {
498
+ var name_1 = VENDORS[i] + candidates[j];
499
+ var hosts = probeHosts(target);
500
+ for (var k = 0; k < hosts.length; k++) {
501
+ if (hasOnProperty(hosts[k], name_1))
502
+ return name_1;
503
+ }
504
+ }
505
+ }
506
+ return type;
507
+ }
508
+
509
+ var SUPPORTED = {
510
+ once: false,
511
+ passive: false,
512
+ capture: false,
513
+ some: false,
514
+ all: false,
515
+ };
516
+ var NOOP$1 = function () {
517
+ };
518
+ function resolveProbeTarget() {
519
+ if (typeof globalThis.document !== 'undefined' && typeof globalThis.document.createDocumentFragment === 'function') {
520
+ try {
521
+ return globalThis.document.createDocumentFragment();
522
+ }
523
+ catch (_) {
524
+ }
525
+ }
526
+ if (typeof globalThis.EventTarget === 'function') {
527
+ try {
528
+ return new globalThis.EventTarget();
529
+ }
530
+ catch (_) {
531
+ }
532
+ }
533
+ return undefined;
534
+ }
535
+ (function detectSupportedListenerOptions() {
536
+ var probe = resolveProbeTarget();
537
+ if (typeof probe === 'undefined' || typeof probe.addEventListener !== 'function')
538
+ return;
539
+ var options = {};
540
+ try {
541
+ Object.defineProperty(options, 'once', {
542
+ get: function () {
543
+ SUPPORTED.once = true;
544
+ return false;
545
+ },
546
+ });
547
+ Object.defineProperty(options, 'passive', {
548
+ get: function () {
549
+ SUPPORTED.passive = true;
550
+ return false;
551
+ },
552
+ });
553
+ Object.defineProperty(options, 'capture', {
554
+ get: function () {
555
+ SUPPORTED.capture = true;
556
+ return false;
557
+ },
558
+ });
559
+ probe.addEventListener('test', NOOP$1, options);
560
+ probe.removeEventListener('test', NOOP$1, options);
561
+ }
562
+ catch (_) {
563
+ }
564
+ SUPPORTED.some = SUPPORTED.once || SUPPORTED.passive || SUPPORTED.capture;
565
+ SUPPORTED.all = SUPPORTED.once && SUPPORTED.passive && SUPPORTED.capture;
566
+ })();
567
+ var SUPPORTED_LISTENER_OPTIONS = SUPPORTED;
568
+ function normalizeListenerOptions(options) {
569
+ if (typeof options === 'boolean')
570
+ return { capture: options, once: false, passive: false, signal: undefined };
571
+ if (typeof options === 'object' && options !== null) {
572
+ return {
573
+ capture: options.capture === true,
574
+ once: options.once === true,
575
+ passive: options.passive === true,
576
+ signal: options.signal,
577
+ };
578
+ }
579
+ return {
580
+ capture: Boolean(options),
581
+ once: false,
582
+ passive: false,
583
+ signal: undefined
584
+ };
585
+ }
586
+ function toNativeListenerOptions(normalized) {
587
+ if (SUPPORTED.passive)
588
+ return {
589
+ capture: normalized.capture,
590
+ passive: normalized.passive
591
+ };
592
+ if (SUPPORTED.capture)
593
+ return {
594
+ capture: normalized.capture
595
+ };
596
+ return normalized.capture;
597
+ }
598
+
599
+ var TOUCH_TYPES = ['touchstart', 'touchmove', 'touchend', 'touchcancel'];
600
+ var POINTER_PHASE_MAP = {
601
+ 'pointerdown': 'start',
602
+ 'MSPointerDown': 'start',
603
+ 'pointermove': 'move',
604
+ 'MSPointerMove': 'move',
605
+ 'pointerup': 'end',
606
+ 'MSPointerUp': 'end',
607
+ 'pointercancel': 'cancel',
608
+ 'MSPointerCancel': 'cancel',
609
+ };
610
+ var ACTIVE_TOUCHES = [];
611
+ function isTouchEventType(type) {
612
+ return TOUCH_TYPES.indexOf(type) > -1;
613
+ }
614
+ function isPointerEventType(type) {
615
+ return typeof POINTER_PHASE_MAP[type] !== 'undefined';
616
+ }
617
+ function createTouchList(touches) {
618
+ var list = touches.slice();
619
+ list.item = function (index) {
620
+ if (index >= 0 && index < list.length)
621
+ return list[index];
622
+ return null;
623
+ };
624
+ return list;
625
+ }
626
+ function findTouchIndex(identifier) {
627
+ for (var i = 0; i < ACTIVE_TOUCHES.length; i++) {
628
+ if (ACTIVE_TOUCHES[i].identifier === identifier)
629
+ return i;
630
+ }
631
+ return -1;
632
+ }
633
+ 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;
638
+ return 0;
639
+ }
640
+ 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;
645
+ return 0;
646
+ }
647
+ function createSyntheticTouch(event, target) {
648
+ var clientX = typeof event.clientX === 'number' ? event.clientX : 0;
649
+ var clientY = typeof event.clientY === 'number' ? event.clientY : 0;
650
+ return {
651
+ identifier: typeof event.pointerId === 'number' ? event.pointerId : 0,
652
+ target: target,
653
+ screenX: typeof event.screenX === 'number' ? event.screenX : 0,
654
+ screenY: typeof event.screenY === 'number' ? event.screenY : 0,
655
+ clientX: clientX,
656
+ clientY: clientY,
657
+ pageX: typeof event.pageX === 'number' ? event.pageX : clientX + scrollOffsetX(),
658
+ pageY: typeof event.pageY === 'number' ? event.pageY : clientY + scrollOffsetY(),
659
+ radiusX: typeof event.width === 'number' ? event.width / 2 : 0,
660
+ radiusY: typeof event.height === 'number' ? event.height / 2 : 0,
661
+ rotationAngle: typeof event.rotation === 'number' ? event.rotation : 0,
662
+ force: typeof event.pressure === 'number' ? event.pressure : 0,
663
+ };
664
+ }
665
+ function defineTouchList(event, property, list) {
666
+ try {
667
+ Object.defineProperty(event, property, { value: list, configurable: true });
668
+ }
669
+ catch (_) {
670
+ event[property] = list;
671
+ }
672
+ }
673
+ function filterByTarget(touches, target) {
674
+ var filtered = [];
675
+ for (var i = 0; i < touches.length; i++) {
676
+ if (touches[i].target === target)
677
+ filtered.push(touches[i]);
678
+ }
679
+ return filtered;
680
+ }
681
+ function synthesizeTouchEvent(event, resolvedType) {
682
+ var phase = POINTER_PHASE_MAP[resolvedType];
683
+ if (typeof phase === 'undefined')
684
+ return;
685
+ var pointerEvent = event;
686
+ var eventTarget = event.target;
687
+ var index = findTouchIndex(typeof pointerEvent.pointerId === 'number' ? pointerEvent.pointerId : 0);
688
+ var originTarget = index > -1 ? ACTIVE_TOUCHES[index].target : eventTarget;
689
+ var touch = createSyntheticTouch(pointerEvent, originTarget);
690
+ if (phase === 'start' || phase === 'move') {
691
+ if (index > -1)
692
+ ACTIVE_TOUCHES[index] = touch;
693
+ else
694
+ ACTIVE_TOUCHES.push(touch);
695
+ }
696
+ else {
697
+ if (index > -1)
698
+ ACTIVE_TOUCHES.splice(index, 1);
699
+ }
700
+ defineTouchList(event, 'touches', createTouchList(ACTIVE_TOUCHES));
701
+ defineTouchList(event, 'targetTouches', createTouchList(filterByTarget(ACTIVE_TOUCHES, originTarget)));
702
+ defineTouchList(event, 'changedTouches', createTouchList([touch]));
703
+ }
704
+
705
+ var KEY_CODE_MAP = {
706
+ 8: 'Backspace',
707
+ 9: 'Tab',
708
+ 12: 'Numpad5',
709
+ 13: 'Enter',
710
+ 16: 'ShiftLeft',
711
+ 17: 'ControlLeft',
712
+ 18: 'AltLeft',
713
+ 19: 'Pause',
714
+ 20: 'CapsLock',
715
+ 27: 'Escape',
716
+ 32: 'Space',
717
+ 33: 'PageUp',
718
+ 34: 'PageDown',
719
+ 35: 'End',
720
+ 36: 'Home',
721
+ 37: 'ArrowLeft',
722
+ 38: 'ArrowUp',
723
+ 39: 'ArrowRight',
724
+ 40: 'ArrowDown',
725
+ 45: 'Insert',
726
+ 46: 'Delete',
727
+ 48: 'Digit0',
728
+ 49: 'Digit1',
729
+ 50: 'Digit2',
730
+ 51: 'Digit3',
731
+ 52: 'Digit4',
732
+ 53: 'Digit5',
733
+ 54: 'Digit6',
734
+ 55: 'Digit7',
735
+ 56: 'Digit8',
736
+ 57: 'Digit9',
737
+ 65: 'KeyA',
738
+ 66: 'KeyB',
739
+ 67: 'KeyC',
740
+ 68: 'KeyD',
741
+ 69: 'KeyE',
742
+ 70: 'KeyF',
743
+ 71: 'KeyG',
744
+ 72: 'KeyH',
745
+ 73: 'KeyI',
746
+ 74: 'KeyJ',
747
+ 75: 'KeyK',
748
+ 76: 'KeyL',
749
+ 77: 'KeyM',
750
+ 78: 'KeyN',
751
+ 79: 'KeyO',
752
+ 80: 'KeyP',
753
+ 81: 'KeyQ',
754
+ 82: 'KeyR',
755
+ 83: 'KeyS',
756
+ 84: 'KeyT',
757
+ 85: 'KeyU',
758
+ 86: 'KeyV',
759
+ 87: 'KeyW',
760
+ 88: 'KeyX',
761
+ 89: 'KeyY',
762
+ 90: 'KeyZ',
763
+ 91: 'MetaLeft',
764
+ 92: 'MetaRight',
765
+ 93: 'ContextMenu',
766
+ 96: 'Numpad0',
767
+ 97: 'Numpad1',
768
+ 98: 'Numpad2',
769
+ 99: 'Numpad3',
770
+ 100: 'Numpad4',
771
+ 101: 'Numpad5',
772
+ 102: 'Numpad6',
773
+ 103: 'Numpad7',
774
+ 104: 'Numpad8',
775
+ 105: 'Numpad9',
776
+ 106: 'NumpadMultiply',
777
+ 107: 'NumpadAdd',
778
+ 109: 'NumpadSubtract',
779
+ 110: 'NumpadDecimal',
780
+ 111: 'NumpadDivide',
781
+ 112: 'F1',
782
+ 113: 'F2',
783
+ 114: 'F3',
784
+ 115: 'F4',
785
+ 116: 'F5',
786
+ 117: 'F6',
787
+ 118: 'F7',
788
+ 119: 'F8',
789
+ 120: 'F9',
790
+ 121: 'F10',
791
+ 122: 'F11',
792
+ 123: 'F12',
793
+ 144: 'NumLock',
794
+ 145: 'ScrollLock',
795
+ 186: 'Semicolon',
796
+ 187: 'Equal',
797
+ 188: 'Comma',
798
+ 189: 'Minus',
799
+ 190: 'Period',
800
+ 191: 'Slash',
801
+ 192: 'Backquote',
802
+ 219: 'BracketLeft',
803
+ 220: 'Backslash',
804
+ 221: 'BracketRight',
805
+ 222: 'Quote',
806
+ 226: 'IntlBackslash',
807
+ };
808
+
809
+ var LISTENER_STORE = [];
810
+ var NOOP = function () {
811
+ };
812
+ function findListenerRecord(target, type, callback, capture) {
813
+ for (var i = 0; i < LISTENER_STORE.length; i++) {
814
+ var record = LISTENER_STORE[i];
815
+ if (record.target === target && record.type === type && record.callback === callback && record.capture === capture)
816
+ return record;
817
+ }
818
+ return undefined;
819
+ }
820
+ 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);
824
+ return;
825
+ }
826
+ }
827
+ }
828
+ function preventDefaultPolyfill() {
829
+ this.returnValue = false;
830
+ }
831
+ function stopPropagationPolyfill() {
832
+ this.cancelBubble = true;
833
+ }
834
+ function passivePreventDefault() {
835
+ // Per spec, preventDefault() inside a passive listener does nothing.
836
+ }
837
+ function invokeCallback(callback, target, event) {
838
+ if (typeof callback === 'function')
839
+ return callback.call(target, event);
840
+ if (typeof callback === 'object' && callback !== null && typeof callback.handleEvent === 'function')
841
+ return callback.handleEvent(event);
842
+ }
843
+ function defineEventProperty(event, property, value) {
844
+ try {
845
+ Object.defineProperty(event, property, { value: value, configurable: true });
846
+ }
847
+ catch (_) {
848
+ try {
849
+ event[property] = value;
850
+ }
851
+ catch (__) {
852
+ }
853
+ }
854
+ }
855
+ function fixLegacyEvent(event, target) {
856
+ if (typeof event.currentTarget === 'undefined' || event.currentTarget === null)
857
+ defineEventProperty(event, 'currentTarget', target);
858
+ if ((typeof event.target === 'undefined' || event.target === null) && typeof event.srcElement !== 'undefined')
859
+ defineEventProperty(event, 'target', event.srcElement);
860
+ if (typeof event.preventDefault !== 'function')
861
+ event.preventDefault = preventDefaultPolyfill.bind(event);
862
+ if (typeof event.stopPropagation !== 'function')
863
+ event.stopPropagation = stopPropagationPolyfill.bind(event);
864
+ }
865
+ function fixKeyboardEvent(event) {
866
+ if (typeof event.keyCode === 'number' && typeof event.code === 'undefined') {
867
+ var code = KEY_CODE_MAP[event.keyCode];
868
+ if (typeof code === 'string')
869
+ defineEventProperty(event, 'code', code);
870
+ }
871
+ }
872
+ function createDispatcher(record) {
873
+ return function (event) {
874
+ if (typeof event === 'undefined')
875
+ event = globalThis.event; // IE: implicit global event object
876
+ if (typeof event === 'undefined' || event === null)
877
+ return;
878
+ if (record.released)
879
+ return;
880
+ fixLegacyEvent(event, record.target);
881
+ if (record.once)
882
+ releaseListenerRecord(record);
883
+ if (record.passive && !SUPPORTED_LISTENER_OPTIONS.passive)
884
+ event.preventDefault = passivePreventDefault.bind(event);
885
+ if (record.resolvedType !== record.type)
886
+ defineEventProperty(event, 'type', record.type);
887
+ if (record.touch)
888
+ synthesizeTouchEvent(event, record.resolvedType);
889
+ fixKeyboardEvent(event);
890
+ invokeCallback(record.callback, record.target, event);
891
+ };
892
+ }
893
+ function attachNativeListener(record) {
894
+ var target = record.target;
895
+ if (typeof target.addEventListener === 'function') {
896
+ target.addEventListener(record.resolvedType, record.wrapper, toNativeListenerOptions(record));
897
+ return true;
898
+ }
899
+ if (typeof target.attachEvent === 'function') {
900
+ target.attachEvent('on' + record.resolvedType, record.wrapper);
901
+ return true;
902
+ }
903
+ return false;
904
+ }
905
+ function detachNativeListener(record) {
906
+ var target = record.target;
907
+ if (typeof target.removeEventListener === 'function')
908
+ return target.removeEventListener(record.resolvedType, record.wrapper, toNativeListenerOptions(record));
909
+ if (typeof target.detachEvent === 'function')
910
+ return target.detachEvent('on' + record.resolvedType, record.wrapper);
911
+ }
912
+ function releaseListenerRecord(record) {
913
+ if (record.released)
914
+ return;
915
+ record.released = true;
916
+ removeListenerRecord(record);
917
+ try {
918
+ detachNativeListener(record);
919
+ }
920
+ catch (_) {
921
+ }
922
+ if (typeof record.signal !== 'undefined' && typeof record.onAbort === 'function' && typeof record.signal.removeEventListener === 'function') {
923
+ try {
924
+ record.signal.removeEventListener('abort', record.onAbort);
925
+ }
926
+ catch (_) {
927
+ }
928
+ }
929
+ record.onAbort = undefined;
930
+ }
931
+ function createEventPolyfill(type, init) {
932
+ try {
933
+ return new Event(type, init);
934
+ }
935
+ catch (_) {
936
+ }
937
+ var event = globalThis.document.createEvent('Event');
938
+ event.initEvent(type, typeof init !== 'undefined' && init.bubbles === true, typeof init !== 'undefined' && init.cancelable === true);
939
+ return event;
940
+ }
941
+ function createCustomEventPolyfill(type, init) {
942
+ try {
943
+ return new CustomEvent(type, init);
944
+ }
945
+ catch (_) {
946
+ }
947
+ var event = globalThis.document.createEvent('CustomEvent');
948
+ 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
+ return event;
950
+ }
951
+ var EventKit = {
952
+ version: packageJSON.version,
953
+ utils: {
954
+ get supportedOptions() {
955
+ return {
956
+ once: SUPPORTED_LISTENER_OPTIONS.once,
957
+ passive: SUPPORTED_LISTENER_OPTIONS.passive,
958
+ capture: SUPPORTED_LISTENER_OPTIONS.capture,
959
+ some: SUPPORTED_LISTENER_OPTIONS.some,
960
+ all: SUPPORTED_LISTENER_OPTIONS.all,
961
+ };
962
+ },
963
+ resolveType: resolveEventType,
964
+ createEvent: createEventPolyfill,
965
+ createCustomEvent: createCustomEventPolyfill,
966
+ },
967
+ add: function (target, type, callback, options) {
968
+ if (typeof target === 'undefined' || target === null)
969
+ return NOOP;
970
+ if (typeof type !== 'string' || type.length === 0)
971
+ return NOOP;
972
+ if (typeof callback !== 'function' && (typeof callback !== 'object' || callback === null))
973
+ return NOOP;
974
+ var normalized = normalizeListenerOptions(options);
975
+ var existing = findListenerRecord(target, type, callback, normalized.capture);
976
+ if (typeof existing !== 'undefined') {
977
+ return function () {
978
+ releaseListenerRecord(existing);
979
+ };
980
+ }
981
+ if (typeof normalized.signal !== 'undefined' && normalized.signal.aborted)
982
+ return NOOP;
983
+ var resolvedType = resolveEventType(target, type);
984
+ var record = {
985
+ target: target,
986
+ type: type,
987
+ callback: callback,
988
+ wrapper: NOOP,
989
+ resolvedType: resolvedType,
990
+ capture: normalized.capture,
991
+ once: normalized.once,
992
+ passive: normalized.passive,
993
+ signal: normalized.signal,
994
+ onAbort: undefined,
995
+ touch: isTouchEventType(type) && isPointerEventType(resolvedType),
996
+ released: false,
997
+ };
998
+ record.wrapper = createDispatcher(record);
999
+ if (!attachNativeListener(record))
1000
+ return NOOP;
1001
+ LISTENER_STORE.push(record);
1002
+ if (typeof record.signal !== 'undefined' && typeof record.signal.addEventListener === 'function') {
1003
+ record.onAbort = function () {
1004
+ releaseListenerRecord(record);
1005
+ };
1006
+ record.signal.addEventListener('abort', record.onAbort, { once: true });
1007
+ }
1008
+ return function () {
1009
+ releaseListenerRecord(record);
1010
+ };
1011
+ },
1012
+ remove: function (target, type, callback, options) {
1013
+ if (typeof target === 'undefined' || target === null)
1014
+ return;
1015
+ if (typeof type !== 'string' || type.length === 0)
1016
+ return;
1017
+ if (typeof callback !== 'function' && (typeof callback !== 'object' || callback === null))
1018
+ return;
1019
+ var normalized = normalizeListenerOptions(options);
1020
+ var record = findListenerRecord(target, type, callback, normalized.capture);
1021
+ if (typeof record !== 'undefined')
1022
+ return releaseListenerRecord(record);
1023
+ var resolvedType = resolveEventType(target, type);
1024
+ if (typeof target.removeEventListener === 'function')
1025
+ return target.removeEventListener(resolvedType, callback, toNativeListenerOptions(normalized));
1026
+ if (typeof target.detachEvent === 'function' && typeof callback === 'function')
1027
+ return target.detachEvent('on' + resolvedType, callback);
1028
+ },
1029
+ };
1030
+
372
1031
  function createHiddenElement(tagName, focusable) {
373
1032
  if (focusable === void 0) { focusable = true; }
374
1033
  var element = globalThis.document.createElement(tagName);
@@ -778,101 +1437,6 @@ function getTopmostWindow() {
778
1437
  return globalThis;
779
1438
  }
780
1439
 
781
- var IE_WRAPPER_STORE = [];
782
- var VENDORS = ['', 'webkit', 'moz', 'ms', 'MS', 'o', 'O'];
783
- var LEGACY_TYPE_MAP = {
784
- 'focus': ['focus', 'focusin'],
785
- 'blur': ['blur', 'focusout'],
786
- };
787
- function resolveVendor(target, type) {
788
- var types;
789
- var legacy = LEGACY_TYPE_MAP[type];
790
- if (typeof legacy !== 'undefined')
791
- types = legacy;
792
- else
793
- types = [type];
794
- for (var i = 0; i < VENDORS.length; i++) {
795
- for (var j = 0; j < types.length; j++) {
796
- var name_1 = VENDORS[i] + types[j];
797
- if (typeof target['on' + name_1] !== 'undefined')
798
- return name_1;
799
- }
800
- }
801
- return type;
802
- }
803
- function findIEWrapper(target, type, callback) {
804
- for (var i = 0; i < IE_WRAPPER_STORE.length; i++) {
805
- var wrapper = IE_WRAPPER_STORE[i];
806
- if (wrapper.target === target && wrapper.type === type && wrapper.callback === callback)
807
- return wrapper.wrapper;
808
- }
809
- return undefined;
810
- }
811
- function setIEWrapper(target, type, callback, wrapper) {
812
- IE_WRAPPER_STORE.push({ target: target, type: type, callback: callback, wrapper: wrapper });
813
- }
814
- function removeIEWrapper(target, type, callback) {
815
- for (var i = 0; i < IE_WRAPPER_STORE.length; i++) {
816
- var wrapper = IE_WRAPPER_STORE[i];
817
- if (wrapper.target === target && wrapper.type === type && wrapper.callback === callback) {
818
- IE_WRAPPER_STORE.splice(i, 1);
819
- return wrapper.wrapper;
820
- }
821
- }
822
- return undefined;
823
- }
824
- function preventDefaultPolyfill() {
825
- this.returnValue = false;
826
- }
827
- function stopPropagationPolyfill() {
828
- this.cancelBubble = true;
829
- }
830
- function addEvent(target, type, callback) {
831
- if (typeof target === 'undefined' || typeof type === 'undefined')
832
- return;
833
- type = resolveVendor(target, type);
834
- if (typeof target.addEventListener === 'function') {
835
- return target.addEventListener(type, callback);
836
- }
837
- if (typeof target.attachEvent === 'function') {
838
- var existing = findIEWrapper(target, type, callback);
839
- if (typeof existing === 'function')
840
- return;
841
- var wrapper = function (event) {
842
- if (typeof event === 'undefined')
843
- event = globalThis.event;
844
- if (typeof event === 'undefined')
845
- return;
846
- try {
847
- Object.defineProperty(event, 'currentTarget', { value: target, configurable: true });
848
- }
849
- catch (_) {
850
- }
851
- if (typeof event.preventDefault !== 'function')
852
- event.preventDefault = preventDefaultPolyfill.bind(event);
853
- if (typeof event.stopPropagation !== 'function')
854
- event.stopPropagation = stopPropagationPolyfill.bind(event);
855
- callback.call(target, event);
856
- };
857
- setIEWrapper(target, type, callback, wrapper);
858
- return target.attachEvent('on' + type, wrapper);
859
- }
860
- }
861
- function removeEvent(target, type, callback) {
862
- if (typeof target === 'undefined' || typeof type === 'undefined')
863
- return;
864
- type = resolveVendor(target, type);
865
- if (typeof target.removeEventListener === 'function') {
866
- return target.removeEventListener(type, callback);
867
- }
868
- if (typeof target.detachEvent === 'function') {
869
- var wrapper = removeIEWrapper(target, type, callback);
870
- if (typeof wrapper === 'function')
871
- target.detachEvent('on' + type, wrapper);
872
- return;
873
- }
874
- }
875
-
876
1440
  exports.SettingType = void 0;
877
1441
  (function (SettingType) {
878
1442
  SettingType["General"] = "general";
@@ -940,7 +1504,7 @@ var ANDROID_DEFAULT_TIMEOUT = 1000;
940
1504
  var IOS_DEFAULT_TIMEOUT = 2000;
941
1505
  var WINDOWS_DEFAULT_TIMEOUT = 750;
942
1506
  var MACOS_DEFAULT_TIMEOUT = 750;
943
- var SETTING_DEFAULT_TIMEOUT = 750;
1507
+ var DEFAULT_TIMEOUT = 750;
944
1508
  var NAVIGATOR = globalThis.navigator;
945
1509
  var CLEANUP_INPUT_ELEMENT = null;
946
1510
  function createTypeGuard(tag) {
@@ -974,7 +1538,7 @@ function getDefaultTimeout() {
974
1538
  case 'macos':
975
1539
  return MACOS_DEFAULT_TIMEOUT;
976
1540
  default:
977
- return WINDOWS_DEFAULT_TIMEOUT;
1541
+ return DEFAULT_TIMEOUT;
978
1542
  }
979
1543
  }
980
1544
  function isDocumentHidden() {
@@ -1080,7 +1644,7 @@ function restoreFocus() {
1080
1644
  return hasFocus(topDocument);
1081
1645
  }
1082
1646
  function stripURL(value) {
1083
- return typeof value === 'undefined' ? undefined : isURL(value) ? value.toString() : value;
1647
+ return isURL(value) ? value.toString() : value;
1084
1648
  }
1085
1649
  function resolveFocusEventConfig() {
1086
1650
  var top = getTopmostWindow();
@@ -1222,9 +1786,12 @@ function openURL(tried, url, timeout) {
1222
1786
  timeoutId = undefined;
1223
1787
  }
1224
1788
  try {
1225
- removeEvent(config.blur.target, config.blur.type, onblur);
1226
- removeEvent(config.focus.target, config.focus.type, onfocus);
1227
- removeEvent(config.visibilitychange.target, config.visibilitychange.type, onvisibilitychange);
1789
+ if (typeof config.blur.target !== 'undefined' && typeof config.blur.type !== 'undefined')
1790
+ EventKit.remove(config.blur.target, config.blur.type, onblur);
1791
+ if (typeof config.focus.target !== 'undefined' && typeof config.focus.type !== 'undefined')
1792
+ EventKit.remove(config.focus.target, config.focus.type, onfocus);
1793
+ if (typeof config.visibilitychange.target !== 'undefined' && typeof config.visibilitychange.type !== 'undefined')
1794
+ EventKit.remove(config.visibilitychange.target, config.visibilitychange.type, onvisibilitychange);
1228
1795
  }
1229
1796
  catch (_) {
1230
1797
  }
@@ -1258,8 +1825,10 @@ function openURL(tried, url, timeout) {
1258
1825
  clearTimeout(timeoutId);
1259
1826
  timeoutId = undefined;
1260
1827
  }
1261
- removeEvent(config.blur.target, config.blur.type, onblur);
1262
- addEvent(config.focus.target, config.focus.type, onfocus);
1828
+ if (typeof config.blur.target !== 'undefined' && typeof config.blur.type !== 'undefined')
1829
+ EventKit.remove(config.blur.target, config.blur.type, onfocus);
1830
+ if (typeof config.focus.target !== 'undefined' && typeof config.focus.type !== 'undefined')
1831
+ EventKit.add(config.focus.target, config.focus.type, onfocus);
1263
1832
  }
1264
1833
  function onfocus() {
1265
1834
  done(true);
@@ -1273,8 +1842,10 @@ function openURL(tried, url, timeout) {
1273
1842
  timeoutId = globalThis.setTimeout(function () {
1274
1843
  done(false);
1275
1844
  }, timeout);
1276
- addEvent(config.blur.target, config.blur.type, onblur);
1277
- addEvent(config.visibilitychange.target, config.visibilitychange.type, onvisibilitychange);
1845
+ if (typeof config.blur.target !== 'undefined' && typeof config.blur.type !== 'undefined')
1846
+ EventKit.add(config.blur.target, config.blur.type, onblur);
1847
+ if (typeof config.visibilitychange.target !== 'undefined' && typeof config.visibilitychange.type !== 'undefined')
1848
+ EventKit.add(config.visibilitychange.target, config.visibilitychange.type, onvisibilitychange);
1278
1849
  if (!hasFocus(topDocument))
1279
1850
  restoreFocus();
1280
1851
  try {
@@ -1294,6 +1865,8 @@ function resolveOptions(option) {
1294
1865
  var fallback;
1295
1866
  var allowAppStore;
1296
1867
  var allowWebStore;
1868
+ var allowScheme;
1869
+ var assumeAllowedInApp;
1297
1870
  var timeout;
1298
1871
  var intent;
1299
1872
  var packageName;
@@ -1310,8 +1883,10 @@ function resolveOptions(option) {
1310
1883
  scheme = stripURL(option.android.scheme);
1311
1884
  fallback = stripURL(option.android.fallback);
1312
1885
  packageName = option.android.packageName;
1886
+ assumeAllowedInApp = option.android.assumeAllowedInApp === true;
1313
1887
  allowAppStore = option.android.allowAppStore;
1314
1888
  allowWebStore = option.android.allowWebStore;
1889
+ allowScheme = canOpenScheme(assumeAllowedInApp);
1315
1890
  timeout = option.android.timeout;
1316
1891
  if (typeof intent !== 'undefined' && (typeof scheme === 'undefined' || typeof packageName === 'undefined' || typeof fallback === 'undefined')) {
1317
1892
  var parsed = parseIntentURL(intent);
@@ -1328,12 +1903,12 @@ function resolveOptions(option) {
1328
1903
  timeout = ANDROID_DEFAULT_TIMEOUT;
1329
1904
  if (typeof intent !== 'undefined' && canOpenIntent())
1330
1905
  resolved.push(['intent', intent]);
1331
- if (typeof scheme !== 'undefined')
1906
+ if (typeof scheme !== 'undefined' && allowScheme)
1332
1907
  resolved.push(['scheme', scheme]);
1333
1908
  if (typeof fallback !== 'undefined')
1334
1909
  resolved.push(['fallback', fallback]);
1335
1910
  if (typeof packageName !== 'undefined') {
1336
- if (allowAppStore)
1911
+ if (allowAppStore && allowScheme)
1337
1912
  resolved.push(['store', createAppStoreURL(packageName, os)]);
1338
1913
  if (allowWebStore)
1339
1914
  resolved.push(['store', createWebStoreURL(packageName, os)]);
@@ -1347,21 +1922,23 @@ function resolveOptions(option) {
1347
1922
  fallback = stripURL(option.ios.fallback);
1348
1923
  bundleId = option.ios.bundleId;
1349
1924
  trackId = option.ios.trackId;
1925
+ assumeAllowedInApp = option.ios.assumeAllowedInApp === true;
1350
1926
  allowAppStore = option.ios.allowAppStore;
1351
1927
  allowWebStore = option.ios.allowWebStore;
1928
+ allowScheme = canOpenScheme(assumeAllowedInApp);
1352
1929
  timeout = option.ios.timeout;
1353
1930
  if (typeof bundleId !== 'undefined' && typeof trackId === 'undefined')
1354
1931
  trackId = getTrackId(bundleId);
1355
1932
  if (typeof timeout === 'undefined')
1356
1933
  timeout = IOS_DEFAULT_TIMEOUT;
1357
- if (typeof universal !== 'undefined' && canOpenUniversal())
1934
+ if (typeof universal !== 'undefined' && canOpenUniversal(assumeAllowedInApp))
1358
1935
  resolved.push(['universal', universal]);
1359
- if (typeof scheme !== 'undefined')
1936
+ if (typeof scheme !== 'undefined' && allowScheme)
1360
1937
  resolved.push(['scheme', scheme]);
1361
1938
  if (typeof fallback !== 'undefined')
1362
1939
  resolved.push(['fallback', fallback]);
1363
1940
  if (typeof trackId !== 'undefined') {
1364
- if (allowAppStore)
1941
+ if (allowAppStore && allowScheme)
1365
1942
  resolved.push(['store', createAppStoreURL(trackId, os)]);
1366
1943
  if (allowWebStore)
1367
1944
  resolved.push(['store', createWebStoreURL(trackId, os)]);
@@ -1434,10 +2011,41 @@ function canOpenIntent() {
1434
2011
  return false;
1435
2012
  if (browser === 'opera' && PlatformKit.compareVersion(version, '14.0') < 0)
1436
2013
  return false;
1437
- return !(/(?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/[\w.]+;/i.test(PlatformKit.userAgent) || /instagram[\/ ][-\w.]+/i.test(PlatformKit.userAgent) || /micromessenger\/([\w.]+)/i.test(PlatformKit.userAgent) || /musical_ly(?:.+app_?version\/|_)[\w.]+/i.test(PlatformKit.userAgent) || /ultralite app_version\/[\w.]+/i.test(PlatformKit.userAgent));
2014
+ if (isFullyBlockedInAppBrowser() || isPartnerAppOnly())
2015
+ return false;
2016
+ return !(/(?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/[\w.]+;/i.test(PlatformKit.userAgent) || /instagram[\/ ][-\w.]+/i.test(PlatformKit.userAgent) || /musical_ly(?:.+app_?version\/|_)[\w.]+/i.test(PlatformKit.userAgent) || /ultralite app_version\/[\w.]+/i.test(PlatformKit.userAgent));
1438
2017
  }
1439
- function canOpenUniversal() {
1440
- return PlatformKit.os.name === 'ios' && PlatformKit.compareVersion(PlatformKit.os.version, '9.0') >= 0;
2018
+ function canOpenUniversal(assumeAllowedInApp) {
2019
+ if (assumeAllowedInApp === void 0) { assumeAllowedInApp = false; }
2020
+ if (PlatformKit.os.name !== 'ios' || PlatformKit.compareVersion(PlatformKit.os.version, '9.0') < 0)
2021
+ return false;
2022
+ if (isPartnerAppOnly() && !assumeAllowedInApp)
2023
+ return false;
2024
+ var userAgent = PlatformKit.userAgent;
2025
+ var wechat = userAgent.match(/micromessenger\/(\d+(?:\.\d+)*)/i);
2026
+ if (wechat !== null && PlatformKit.compareVersion(wechat[1], '7.0.5') < 0)
2027
+ return false;
2028
+ if (/ qq\/[\d.]+/i.test(userAgent) || /m?qqbrowser\/[\d.]+/i.test(userAgent) || /ucbrowser\/[\d.]+/i.test(userAgent))
2029
+ return false;
2030
+ return !/qzone\/.*_qz_[\d.]+/i.test(userAgent);
2031
+ }
2032
+ function canOpenScheme(assumeAllowedInApp) {
2033
+ if (assumeAllowedInApp === void 0) { assumeAllowedInApp = false; }
2034
+ var os = PlatformKit.os.name;
2035
+ if (os === 'android')
2036
+ return !isFullyBlockedInAppBrowser() && (!isPartnerAppOnly() || assumeAllowedInApp);
2037
+ if (os === 'ios')
2038
+ return !/micromessenger\/[\w.]+/i.test(PlatformKit.userAgent) && (!isPartnerAppOnly() || assumeAllowedInApp);
2039
+ return true;
2040
+ }
2041
+ function isFullyBlockedInAppBrowser() {
2042
+ if (PlatformKit.os.name !== 'android')
2043
+ return false;
2044
+ var userAgent = PlatformKit.userAgent;
2045
+ return /micromessenger\/[\w.]+/i.test(userAgent) || / qq\/[\d.]+/i.test(userAgent) || /qzone\/.*_qz_[\d.]+/i.test(userAgent) || /baiduboxapp\/[\d.]+/i.test(userAgent);
2046
+ }
2047
+ function isPartnerAppOnly() {
2048
+ return /weibo.*weibo__[\d.]+/i.test(PlatformKit.userAgent);
1441
2049
  }
1442
2050
  function canOpenSetting() {
1443
2051
  var os = PlatformKit.os.name;
@@ -1544,6 +2152,18 @@ function escapeURIComponentMailAddressString(value) {
1544
2152
  function encodeMailBody(value) {
1545
2153
  return escapeURIComponentString(value.replace(/\r\n|\n|\r/g, '\r\n'));
1546
2154
  }
2155
+ function encodeMapValue(value) {
2156
+ if (isArray(value))
2157
+ return value[0] + ',' + value[1];
2158
+ return escapeURIComponentString(value);
2159
+ }
2160
+ function encodeBingRoutePoint(value) {
2161
+ if (typeof value === 'undefined')
2162
+ return '';
2163
+ if (isArray(value))
2164
+ return 'pos.' + value[0] + '_' + value[1];
2165
+ return escapeURIComponentString(value);
2166
+ }
1547
2167
  function toArray(value) {
1548
2168
  return typeof value === 'undefined' ? [] : typeof value === 'string' ? [value] : value;
1549
2169
  }
@@ -1682,10 +2302,12 @@ function resolveFile(module) {
1682
2302
  }
1683
2303
  else {
1684
2304
  module.onclick = function () {
1685
- addEvent(config.focus.target, config.focus.type, onfocus);
1686
- addEvent(config.visibilitychange.target, config.visibilitychange.type, onvisibilitychange);
2305
+ if (typeof config.focus.target !== 'undefined' && typeof config.focus.type !== 'undefined')
2306
+ EventKit.add(config.focus.target, config.focus.type, onfocus);
2307
+ if (typeof config.visibilitychange.target !== 'undefined' && typeof config.visibilitychange.type !== 'undefined')
2308
+ EventKit.add(config.visibilitychange.target, config.visibilitychange.type, onvisibilitychange);
1687
2309
  globalThis.setTimeout(function () {
1688
- addEvent(topDocument, 'click', onclick);
2310
+ EventKit.add(topDocument, 'click', onclick);
1689
2311
  }, 100);
1690
2312
  CLEANUP_INPUT_ELEMENT = function () {
1691
2313
  done(false);
@@ -1695,9 +2317,11 @@ function resolveFile(module) {
1695
2317
  function cleanup() {
1696
2318
  CLEANUP_INPUT_ELEMENT = null;
1697
2319
  try {
1698
- removeEvent(config.focus.target, config.focus.type, onfocus);
1699
- removeEvent(config.visibilitychange.target, config.visibilitychange.type, onvisibilitychange);
1700
- removeEvent(topDocument, 'click', onclick);
2320
+ if (typeof config.focus.target !== 'undefined' && typeof config.focus.type !== 'undefined')
2321
+ EventKit.remove(config.focus.target, config.focus.type, onfocus);
2322
+ if (typeof config.visibilitychange.target !== 'undefined' && typeof config.visibilitychange.type !== 'undefined')
2323
+ EventKit.remove(config.visibilitychange.target, config.visibilitychange.type, onvisibilitychange);
2324
+ EventKit.remove(topDocument, 'click', onclick);
1701
2325
  }
1702
2326
  catch (_) {
1703
2327
  }
@@ -1767,7 +2391,7 @@ function walk(directory, basePath) {
1767
2391
  }
1768
2392
  var LaunchKit = {
1769
2393
  SettingType: exports.SettingType,
1770
- version: packageJSON$1.version,
2394
+ version: packageJSON$2.version,
1771
2395
  utils: {
1772
2396
  get canOpenIntent() {
1773
2397
  return canOpenIntent();
@@ -1790,12 +2414,12 @@ var LaunchKit = {
1790
2414
  catch (error) {
1791
2415
  return Promise.reject(error);
1792
2416
  }
1793
- var tried = [];
1794
2417
  var urls = resolved[0];
1795
2418
  var timeout = resolved[1];
1796
2419
  if (urls.length === 0)
1797
2420
  return Promise.reject(new Error('No openable URL candidates were resolved for the current OS ("' + PlatformKit.os.name + '"). Provide at least one of: scheme, intent, universal, fallback, or store id for this platform.'));
1798
2421
  return new Promise(function (resolve, reject) {
2422
+ var tried = [];
1799
2423
  function openURLSequential(index) {
1800
2424
  if (index === void 0) { index = 0; }
1801
2425
  if (index >= urls.length)
@@ -1867,6 +2491,112 @@ var LaunchKit = {
1867
2491
  url += '?' + joining(params, undefined, '&');
1868
2492
  return openURL(0, url, getDefaultTimeout());
1869
2493
  },
2494
+ map: function (options) {
2495
+ if (options === void 0) { options = {}; }
2496
+ var params = [];
2497
+ var urls = [];
2498
+ var url = '';
2499
+ switch (PlatformKit.os.name) {
2500
+ case 'android':
2501
+ if (typeof options.coordinate !== 'undefined') {
2502
+ url = 'geo:' + options.coordinate[0] + ',' + options.coordinate[1];
2503
+ }
2504
+ else if (typeof options.query !== 'undefined') {
2505
+ url = 'geo:0,0';
2506
+ params.push('q=' + escapeURIComponentString(options.query));
2507
+ }
2508
+ else {
2509
+ url = 'geo:0,0';
2510
+ }
2511
+ if (typeof options.zoom !== 'undefined')
2512
+ params.push('z=' + options.zoom);
2513
+ if (params.length > 0)
2514
+ url = url + '?' + joining(params, undefined, '&');
2515
+ urls.push(url);
2516
+ break;
2517
+ case 'ios':
2518
+ case 'macos':
2519
+ if (typeof options.directions !== 'undefined') {
2520
+ if (typeof options.directions.destination !== 'undefined')
2521
+ params.push('daddr=' + encodeMapValue(options.directions.destination));
2522
+ if (typeof options.directions.origin !== 'undefined')
2523
+ params.push('saddr=' + encodeMapValue(options.directions.origin));
2524
+ }
2525
+ else if (typeof options.coordinate !== 'undefined') {
2526
+ params.push('ll=' + options.coordinate[0] + ',' + options.coordinate[1]);
2527
+ if (typeof options.label !== 'undefined')
2528
+ params.push('q=' + escapeURIComponentString(options.label));
2529
+ }
2530
+ else if (typeof options.query !== 'undefined') {
2531
+ params.push('q=' + escapeURIComponentString(options.query));
2532
+ }
2533
+ if (typeof options.zoom !== 'undefined')
2534
+ params.push('z=' + options.zoom);
2535
+ urls.push('maps://?' + joining(params, undefined, '&'));
2536
+ break;
2537
+ case 'windows':
2538
+ if (typeof options.directions !== 'undefined') {
2539
+ params.push('rtp=' + encodeBingRoutePoint(options.directions.origin) + '~' + encodeBingRoutePoint(options.directions.destination));
2540
+ }
2541
+ else if (typeof options.coordinate !== 'undefined') {
2542
+ params.push('cp=' + options.coordinate[0] + '~' + options.coordinate[1]);
2543
+ if (typeof options.label !== 'undefined')
2544
+ params.push('q=' + escapeURIComponentString(options.label));
2545
+ }
2546
+ else if (typeof options.query !== 'undefined') {
2547
+ params.push('where=' + escapeURIComponentString(options.query));
2548
+ }
2549
+ if (typeof options.zoom !== 'undefined')
2550
+ params.push('lvl=' + options.zoom);
2551
+ urls.push('bingmaps:?' + joining(params, undefined, '&'));
2552
+ }
2553
+ if (typeof options.fallback !== 'undefined') {
2554
+ urls.push(stripURL(options.fallback));
2555
+ }
2556
+ else {
2557
+ var params_1 = ['api=1'];
2558
+ if (typeof options.directions !== 'undefined') {
2559
+ params_1.push('destination=' + encodeMapValue(options.directions.destination));
2560
+ if (typeof options.directions.origin !== 'undefined')
2561
+ params_1.push('origin=' + encodeMapValue(options.directions.origin));
2562
+ urls.push('https://www.google.com/maps/dir/?' + joining(params_1, undefined, '&'));
2563
+ }
2564
+ else {
2565
+ if (typeof options.coordinate !== 'undefined')
2566
+ params_1.push('query=' + options.coordinate[0] + ',' + options.coordinate[1]);
2567
+ else if (typeof options.query !== 'undefined')
2568
+ params_1.push('query=' + escapeURIComponentString(options.query));
2569
+ if (typeof options.zoom !== 'undefined')
2570
+ params_1.push('zoom=' + options.zoom);
2571
+ urls.push('https://www.google.com/maps/search/?' + joining(params_1, undefined, '&'));
2572
+ }
2573
+ }
2574
+ return new Promise(function (resolve, reject) {
2575
+ var tried = [];
2576
+ function openURLSequential(index) {
2577
+ if (index === void 0) { index = 0; }
2578
+ if (index >= urls.length)
2579
+ return reject(new Error('Failed to open a map using all available URLs.\n\nAttempted URLs:\n' + joining(tried, undefined, '\n↓\n')));
2580
+ var url = urls[index];
2581
+ if (typeof url === 'string') {
2582
+ tried[index] = url;
2583
+ return openURL(index, url, getDefaultTimeout())
2584
+ .then(function () {
2585
+ resolve();
2586
+ })
2587
+ .catch(function () {
2588
+ openURLSequential(index + 1);
2589
+ });
2590
+ }
2591
+ else {
2592
+ tried[index] = '[function fallback]';
2593
+ url();
2594
+ resolve();
2595
+ }
2596
+ }
2597
+ return openURLSequential();
2598
+ });
2599
+ },
1870
2600
  filepicker: function (options) {
1871
2601
  if (options === void 0) { options = {}; }
1872
2602
  var module;
@@ -1969,7 +2699,7 @@ var LaunchKit = {
1969
2699
  if (index === void 0) { index = 0; }
1970
2700
  if (index >= urls.length)
1971
2701
  return reject(new Error('Failed to open the "' + type + '" settings pane using all available URLs.\n\nAttempted URLs:\n' + joining(urls, undefined, '\n↓\n')));
1972
- return openURL(index, urls[index], SETTING_DEFAULT_TIMEOUT)
2702
+ return openURL(index, urls[index], DEFAULT_TIMEOUT)
1973
2703
  .then(function () {
1974
2704
  resolve();
1975
2705
  })