native-fn 1.0.82 → 1.0.84

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.
Files changed (141) hide show
  1. package/dist/index.d.ts +8 -1
  2. package/dist/native.cjs +4 -10
  3. package/dist/native.min.cjs +1 -1
  4. package/dist/native.min.mjs +1 -1
  5. package/dist/native.mjs +4 -10
  6. package/dist/native.umd.js +4 -10
  7. package/dist/native.umd.min.js +1 -1
  8. package/dist/plugin/app/index.cjs +160 -270
  9. package/dist/plugin/app/index.min.cjs +1 -1
  10. package/dist/plugin/app/index.min.mjs +1 -1
  11. package/dist/plugin/app/index.mjs +160 -270
  12. package/dist/plugin/app/index.umd.js +160 -270
  13. package/dist/plugin/app/index.umd.min.js +1 -1
  14. package/dist/plugin/app/src/plugin/appearance/constants/index.d.ts +2 -2
  15. package/dist/plugin/app/src/plugin/appearance/types/appearance.d.ts +0 -6
  16. package/dist/plugin/app/src/plugin/dimension/constants/index.d.ts +4 -0
  17. package/dist/plugin/app/src/plugin/dimension/types/dimension.d.ts +9 -6
  18. package/dist/plugin/app/src/plugin/dimension/types/dimensions.d.ts +11 -0
  19. package/dist/plugin/app/src/plugin/dimension/types/index.d.ts +2 -2
  20. package/dist/plugin/app/src/plugin/platform/constants/index.d.ts +1 -0
  21. package/dist/plugin/app/src/plugin/platform/cores/index.d.ts +0 -10
  22. package/dist/plugin/app/src/plugin/platform/types/platform.d.ts +3 -19
  23. package/dist/plugin/app/src/types/listener-entry.d.ts +6 -0
  24. package/dist/plugin/app/src/utils/request.d.ts +1 -0
  25. package/dist/plugin/appearance/index.cjs +111 -223
  26. package/dist/plugin/appearance/index.d.ts +1 -7
  27. package/dist/plugin/appearance/index.min.cjs +1 -1
  28. package/dist/plugin/appearance/index.min.mjs +1 -1
  29. package/dist/plugin/appearance/index.mjs +111 -223
  30. package/dist/plugin/appearance/index.umd.js +111 -223
  31. package/dist/plugin/appearance/index.umd.min.js +1 -1
  32. package/dist/plugin/appearance/src/plugin/appearance/constants/index.d.ts +2 -2
  33. package/dist/plugin/appearance/src/plugin/appearance/types/appearance.d.ts +0 -6
  34. package/dist/plugin/appearance/src/plugin/dimension/constants/index.d.ts +4 -0
  35. package/dist/plugin/appearance/src/plugin/dimension/types/dimension.d.ts +9 -6
  36. package/dist/plugin/appearance/src/plugin/dimension/types/dimensions.d.ts +11 -0
  37. package/dist/plugin/appearance/src/plugin/dimension/types/index.d.ts +2 -2
  38. package/dist/plugin/appearance/src/plugin/platform/constants/index.d.ts +1 -0
  39. package/dist/plugin/appearance/src/plugin/platform/cores/index.d.ts +0 -10
  40. package/dist/plugin/appearance/src/plugin/platform/types/platform.d.ts +3 -19
  41. package/dist/plugin/appearance/src/types/listener-entry.d.ts +6 -0
  42. package/dist/plugin/appearance/src/utils/request.d.ts +1 -0
  43. package/dist/plugin/clipboard/index.cjs +61 -214
  44. package/dist/plugin/clipboard/index.min.cjs +1 -1
  45. package/dist/plugin/clipboard/index.min.mjs +1 -1
  46. package/dist/plugin/clipboard/index.mjs +61 -214
  47. package/dist/plugin/clipboard/index.umd.js +61 -214
  48. package/dist/plugin/clipboard/index.umd.min.js +1 -1
  49. package/dist/plugin/clipboard/src/plugin/appearance/constants/index.d.ts +2 -2
  50. package/dist/plugin/clipboard/src/plugin/appearance/types/appearance.d.ts +0 -6
  51. package/dist/plugin/clipboard/src/plugin/dimension/constants/index.d.ts +4 -0
  52. package/dist/plugin/clipboard/src/plugin/dimension/types/dimension.d.ts +9 -6
  53. package/dist/plugin/clipboard/src/plugin/dimension/types/dimensions.d.ts +11 -0
  54. package/dist/plugin/clipboard/src/plugin/dimension/types/index.d.ts +2 -2
  55. package/dist/plugin/clipboard/src/plugin/platform/constants/index.d.ts +1 -0
  56. package/dist/plugin/clipboard/src/plugin/platform/cores/index.d.ts +0 -10
  57. package/dist/plugin/clipboard/src/plugin/platform/types/platform.d.ts +3 -19
  58. package/dist/plugin/clipboard/src/types/listener-entry.d.ts +6 -0
  59. package/dist/plugin/clipboard/src/utils/request.d.ts +1 -0
  60. package/dist/plugin/dimension/index.cjs +981 -1
  61. package/dist/plugin/dimension/index.d.ts +9 -0
  62. package/dist/plugin/dimension/index.min.cjs +1 -1
  63. package/dist/plugin/dimension/index.min.mjs +1 -1
  64. package/dist/plugin/dimension/index.mjs +981 -1
  65. package/dist/plugin/dimension/index.umd.js +981 -1
  66. package/dist/plugin/dimension/index.umd.min.js +1 -1
  67. package/dist/plugin/dimension/src/plugin/appearance/constants/index.d.ts +2 -2
  68. package/dist/plugin/dimension/src/plugin/appearance/types/appearance.d.ts +0 -6
  69. package/dist/plugin/dimension/src/plugin/dimension/constants/index.d.ts +4 -0
  70. package/dist/plugin/dimension/src/plugin/dimension/types/dimension.d.ts +9 -6
  71. package/dist/plugin/dimension/src/plugin/dimension/types/dimensions.d.ts +11 -0
  72. package/dist/plugin/dimension/src/plugin/dimension/types/index.d.ts +2 -2
  73. package/dist/plugin/dimension/src/plugin/platform/constants/index.d.ts +1 -0
  74. package/dist/plugin/dimension/src/plugin/platform/cores/index.d.ts +0 -10
  75. package/dist/plugin/dimension/src/plugin/platform/types/platform.d.ts +3 -19
  76. package/dist/plugin/dimension/src/types/listener-entry.d.ts +6 -0
  77. package/dist/plugin/dimension/src/utils/request.d.ts +1 -0
  78. package/dist/plugin/fullscreen/index.cjs +54 -207
  79. package/dist/plugin/fullscreen/index.min.cjs +1 -1
  80. package/dist/plugin/fullscreen/index.min.mjs +1 -1
  81. package/dist/plugin/fullscreen/index.mjs +54 -207
  82. package/dist/plugin/fullscreen/index.umd.js +54 -207
  83. package/dist/plugin/fullscreen/index.umd.min.js +1 -1
  84. package/dist/plugin/fullscreen/src/plugin/appearance/constants/index.d.ts +2 -2
  85. package/dist/plugin/fullscreen/src/plugin/appearance/types/appearance.d.ts +0 -6
  86. package/dist/plugin/fullscreen/src/plugin/dimension/constants/index.d.ts +4 -0
  87. package/dist/plugin/fullscreen/src/plugin/dimension/types/dimension.d.ts +9 -6
  88. package/dist/plugin/fullscreen/src/plugin/dimension/types/dimensions.d.ts +11 -0
  89. package/dist/plugin/fullscreen/src/plugin/dimension/types/index.d.ts +2 -2
  90. package/dist/plugin/fullscreen/src/plugin/platform/constants/index.d.ts +1 -0
  91. package/dist/plugin/fullscreen/src/plugin/platform/cores/index.d.ts +0 -10
  92. package/dist/plugin/fullscreen/src/plugin/platform/types/platform.d.ts +3 -19
  93. package/dist/plugin/fullscreen/src/types/listener-entry.d.ts +6 -0
  94. package/dist/plugin/fullscreen/src/utils/request.d.ts +1 -0
  95. package/dist/plugin/platform/index.cjs +50 -203
  96. package/dist/plugin/platform/index.d.ts +4 -20
  97. package/dist/plugin/platform/index.min.cjs +1 -1
  98. package/dist/plugin/platform/index.min.mjs +1 -1
  99. package/dist/plugin/platform/index.mjs +50 -203
  100. package/dist/plugin/platform/index.umd.js +50 -203
  101. package/dist/plugin/platform/index.umd.min.js +1 -1
  102. package/dist/plugin/platform/src/plugin/appearance/constants/index.d.ts +2 -2
  103. package/dist/plugin/platform/src/plugin/appearance/types/appearance.d.ts +0 -6
  104. package/dist/plugin/platform/src/plugin/dimension/constants/index.d.ts +4 -0
  105. package/dist/plugin/platform/src/plugin/dimension/types/dimension.d.ts +9 -6
  106. package/dist/plugin/platform/src/plugin/dimension/types/dimensions.d.ts +11 -0
  107. package/dist/plugin/platform/src/plugin/dimension/types/index.d.ts +2 -2
  108. package/dist/plugin/platform/src/plugin/platform/constants/index.d.ts +1 -0
  109. package/dist/plugin/platform/src/plugin/platform/cores/index.d.ts +0 -10
  110. package/dist/plugin/platform/src/plugin/platform/types/platform.d.ts +3 -19
  111. package/dist/plugin/platform/src/types/listener-entry.d.ts +6 -0
  112. package/dist/plugin/platform/src/utils/request.d.ts +1 -0
  113. package/dist/plugin/theme/index.cjs +51 -204
  114. package/dist/plugin/theme/index.min.cjs +1 -1
  115. package/dist/plugin/theme/index.min.mjs +1 -1
  116. package/dist/plugin/theme/index.mjs +51 -204
  117. package/dist/plugin/theme/index.umd.js +51 -204
  118. package/dist/plugin/theme/index.umd.min.js +1 -1
  119. package/dist/plugin/theme/src/plugin/appearance/constants/index.d.ts +2 -2
  120. package/dist/plugin/theme/src/plugin/appearance/types/appearance.d.ts +0 -6
  121. package/dist/plugin/theme/src/plugin/dimension/constants/index.d.ts +4 -0
  122. package/dist/plugin/theme/src/plugin/dimension/types/dimension.d.ts +9 -6
  123. package/dist/plugin/theme/src/plugin/dimension/types/dimensions.d.ts +11 -0
  124. package/dist/plugin/theme/src/plugin/dimension/types/index.d.ts +2 -2
  125. package/dist/plugin/theme/src/plugin/platform/constants/index.d.ts +1 -0
  126. package/dist/plugin/theme/src/plugin/platform/cores/index.d.ts +0 -10
  127. package/dist/plugin/theme/src/plugin/platform/types/platform.d.ts +3 -19
  128. package/dist/plugin/theme/src/types/listener-entry.d.ts +6 -0
  129. package/dist/plugin/theme/src/utils/request.d.ts +1 -0
  130. package/dist/src/plugin/appearance/constants/index.d.ts +2 -2
  131. package/dist/src/plugin/appearance/types/appearance.d.ts +0 -6
  132. package/dist/src/plugin/dimension/constants/index.d.ts +4 -0
  133. package/dist/src/plugin/dimension/types/dimension.d.ts +9 -6
  134. package/dist/src/plugin/dimension/types/dimensions.d.ts +11 -0
  135. package/dist/src/plugin/dimension/types/index.d.ts +2 -2
  136. package/dist/src/plugin/platform/constants/index.d.ts +1 -0
  137. package/dist/src/plugin/platform/cores/index.d.ts +0 -10
  138. package/dist/src/plugin/platform/types/platform.d.ts +3 -19
  139. package/dist/src/types/listener-entry.d.ts +6 -0
  140. package/dist/src/utils/request.d.ts +1 -0
  141. package/package.json +1 -1
@@ -26,7 +26,7 @@ function createCustomError(name, Base) {
26
26
  else
27
27
  error.__proto__ = CustomError.prototype;
28
28
  error.name = name;
29
- if (message !== undefined)
29
+ if (typeof message !== 'undefined')
30
30
  error.message = message;
31
31
  if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
32
32
  try {
@@ -209,7 +209,7 @@ function capitalize(_) {
209
209
  var result = '';
210
210
  for (var i = 0; i < groups.length - 2; i++) {
211
211
  var arg = groups[i];
212
- if (arg !== undefined)
212
+ if (typeof arg !== 'undefined')
213
213
  result = result + arg.charAt(0).toUpperCase() + arg.slice(1);
214
214
  }
215
215
  return result;
@@ -233,7 +233,7 @@ var EventListenerUtils = {
233
233
  add: function (target, eventListenerOptions) {
234
234
  if (eventListenerOptions === void 0) { eventListenerOptions = { callback: null, options: false }; }
235
235
  var callback = eventListenerOptions.callback;
236
- if (target === undefined || callback === null)
236
+ if (typeof target === 'undefined' || callback === null)
237
237
  return;
238
238
  var type = EventListenerUtils.withVender(target, eventListenerOptions.type);
239
239
  var options = eventListenerOptions.options;
@@ -261,9 +261,9 @@ var EventListenerUtils = {
261
261
  }
262
262
  }
263
263
  function wrapper(event) {
264
- if (event === undefined)
264
+ if (typeof event === 'undefined')
265
265
  event = globalThis.event;
266
- if (event === undefined)
266
+ if (typeof event === 'undefined')
267
267
  return;
268
268
  event.currentTarget = target;
269
269
  if (typeof event.preventDefault !== 'function')
@@ -284,7 +284,7 @@ var EventListenerUtils = {
284
284
  remove: function (target, eventListenerOptions) {
285
285
  if (eventListenerOptions === void 0) { eventListenerOptions = { callback: null, options: false }; }
286
286
  var callback = eventListenerOptions.callback;
287
- if (target === undefined || callback === null)
287
+ if (typeof target === 'undefined' || callback === null)
288
288
  return;
289
289
  var type = EventListenerUtils.withVender(target, eventListenerOptions.type);
290
290
  var options = eventListenerOptions.options;
@@ -313,7 +313,7 @@ var EventListenerUtils = {
313
313
  }
314
314
  if (typeof target.detachEvent === 'function') {
315
315
  var wrapper = callback.__ieWrapper;
316
- if (wrapper !== undefined) {
316
+ if (typeof wrapper !== 'undefined') {
317
317
  target.detachEvent('on' + type, wrapper);
318
318
  delete callback.__ieWrapper;
319
319
  }
@@ -321,7 +321,7 @@ var EventListenerUtils = {
321
321
  }
322
322
  },
323
323
  withVender: function (target, type) {
324
- if (type === undefined)
324
+ if (typeof type === 'undefined')
325
325
  return '';
326
326
  if (target === globalThis.document && ['deviceready', 'pause', 'resume', 'backbutton', 'menubutton', 'searchbutton', 'startcallbutton', 'endcallbutton', 'volumedownbutton', 'volumeupbutton', 'activated', 'cordovacallbackerror'].indexOf(type) > -1)
327
327
  return type;
@@ -392,6 +392,14 @@ var CrossPlatformFramework;
392
392
  CrossPlatformFramework["Cordova"] = "Cordova";
393
393
  })(CrossPlatformFramework || (CrossPlatformFramework = {}));
394
394
  var USER_AGENT = typeof globalThis.navigator !== 'undefined' && typeof globalThis.navigator.userAgent === 'string' ? globalThis.navigator.userAgent : '';
395
+ var HIGH_ENTROPY_BRAND_NAME_MAP = {
396
+ 'Google Chrome': 'Chrome',
397
+ 'Microsoft Edge': 'Edge',
398
+ 'Microsoft Edge WebView2': 'Edge WebView2',
399
+ 'Android WebView': 'Chrome WebView',
400
+ 'HeadlessChrome': 'Chrome Headless',
401
+ 'OperaMobile': 'Opera Mobi',
402
+ };
395
403
 
396
404
  var readyState = 'loading';
397
405
  var readyCallback = [];
@@ -405,15 +413,9 @@ var Platform = {
405
413
  get readyState() {
406
414
  return readyState;
407
415
  },
408
- get network() {
409
- return getNetwork();
410
- },
411
416
  get locale() {
412
417
  return getLocale();
413
418
  },
414
- get dimension() {
415
- return getDimension();
416
- },
417
419
  get device() {
418
420
  if (this.os.name === OS.iOS || this.os.name === OS.Android)
419
421
  return Devices.Mobile;
@@ -428,7 +430,7 @@ var Platform = {
428
430
  return /; ?wv|applewebkit(?!.*safari)/i.test(this.userAgent);
429
431
  },
430
432
  get isNode() {
431
- return typeof globalThis.process !== 'undefined' && typeof globalThis.process.versions !== 'undefined' && globalThis.process.versions.node !== undefined;
433
+ return typeof globalThis.process !== 'undefined' && typeof globalThis.process.versions !== 'undefined' && typeof globalThis.process.versions.node !== 'undefined';
432
434
  },
433
435
  get isStandalone() {
434
436
  if (this.os.name === OS.iOS)
@@ -450,6 +452,33 @@ var Platform = {
450
452
  }
451
453
  }
452
454
  };
455
+ function resolveWindowsVersion(string) {
456
+ if (typeof string === 'undefined')
457
+ return '';
458
+ var mapped = {
459
+ '4.90': 'ME',
460
+ 'NT3.51': 'NT 3.11',
461
+ 'NT4.0': 'NT 4.0',
462
+ 'NT 5.0': '2000',
463
+ 'NT 5.1': 'XP',
464
+ 'NT 5.2': 'XP',
465
+ 'NT 6.0': 'Vista',
466
+ 'NT 6.1': '7',
467
+ 'NT 6.2': '8',
468
+ 'NT 6.3': '8.1',
469
+ 'NT 6.4': '10',
470
+ 'NT 10.0': '10',
471
+ 'ARM': 'RT'
472
+ }[string];
473
+ if (typeof mapped !== 'undefined')
474
+ return mapped;
475
+ return string;
476
+ }
477
+ function resolveUnderscoreVersion(string) {
478
+ if (typeof string === 'undefined')
479
+ return '';
480
+ return string.replace(/_/g, '.');
481
+ }
453
482
  var OS_RESOLVER_MAP = [
454
483
  [/windows nt (6\.[23]); arm/i, OS.Windows, resolveWindowsVersion],
455
484
  [/windows (?:phone|mobile|iot)(?: os)?[\/ ]?([\d.]*( se)?)/i, OS.Windows, resolveWindowsVersion],
@@ -508,14 +537,6 @@ var BROWSER_RESOLVER_MAP = [
508
537
  [/mobile vr; rv:([\w.]+)\).+firefox/i, Browsers.Firefox],
509
538
  [/firefox\/([\w.]+)/i, Browsers.Firefox],
510
539
  ];
511
- var HIGH_ENTROPY_BRAND_NAME_MAP = {
512
- 'Google Chrome': 'Chrome',
513
- 'Microsoft Edge': 'Edge',
514
- 'Microsoft Edge WebView2': 'Edge WebView2',
515
- 'Android WebView': 'Chrome WebView',
516
- 'HeadlessChrome': 'Chrome Headless',
517
- 'OperaMobile': 'Opera Mobi',
518
- };
519
540
  function incrementPendingTasks() {
520
541
  pendingTasks++;
521
542
  }
@@ -536,33 +557,6 @@ function checkReady() {
536
557
  readyCallback.length = 0;
537
558
  }
538
559
  }
539
- function resolveWindowsVersion(string) {
540
- if (string === undefined)
541
- return '';
542
- var mapped = {
543
- '4.90': 'ME',
544
- 'NT3.51': 'NT 3.11',
545
- 'NT4.0': 'NT 4.0',
546
- 'NT 5.0': '2000',
547
- 'NT 5.1': 'XP',
548
- 'NT 5.2': 'XP',
549
- 'NT 6.0': 'Vista',
550
- 'NT 6.1': '7',
551
- 'NT 6.2': '8',
552
- 'NT 6.3': '8.1',
553
- 'NT 6.4': '10',
554
- 'NT 10.0': '10',
555
- 'ARM': 'RT'
556
- }[string];
557
- if (mapped !== undefined)
558
- return mapped;
559
- return string;
560
- }
561
- function resolveUnderscoreVersion(string) {
562
- if (string === undefined)
563
- return '';
564
- return string.replace(/_/g, '.');
565
- }
566
560
  function resolveSemanticWindowsVersion(version, defaultValue) {
567
561
  if (version.major === 10 && version.minor === 0 && version.build >= 22000)
568
562
  return '11';
@@ -699,12 +693,12 @@ function resolveVersion(string, resolver) {
699
693
  return resolver(string);
700
694
  if (typeof resolver === 'string')
701
695
  return resolver;
702
- if (string === undefined)
696
+ if (typeof string === 'undefined')
703
697
  return '';
704
698
  return string;
705
699
  }
706
700
  function normalizeBrand(entry) {
707
- if (entry === null || entry === undefined)
701
+ if (entry === null || typeof entry === 'undefined')
708
702
  return { brand: '', version: '' };
709
703
  if (typeof entry === 'string')
710
704
  return { brand: entry, version: '' };
@@ -758,102 +752,13 @@ function getRenderer() {
758
752
  return '';
759
753
  }
760
754
  }
761
- function getNetwork() {
762
- var network = {
763
- isOnline: null,
764
- effectiveType: null,
765
- type: null,
766
- downlink: null,
767
- rtt: null,
768
- saveData: null,
769
- };
770
- if (typeof globalThis.navigator !== 'undefined') {
771
- if (typeof globalThis.navigator.onLine !== 'undefined')
772
- network.isOnline = globalThis.navigator.onLine;
773
- var connection = globalThis.navigator.connection || globalThis.navigator.mozConnection || globalThis.navigator.webkitConnection;
774
- if (typeof connection !== 'undefined') {
775
- if (typeof connection.effectiveType !== 'undefined')
776
- network.effectiveType = connection.effectiveType;
777
- if (typeof connection.type !== 'undefined')
778
- network.type = connection.type;
779
- if (typeof connection.downlink !== 'undefined')
780
- network.downlink = connection.downlink;
781
- if (typeof connection.rtt !== 'undefined')
782
- network.rtt = connection.rtt;
783
- if (typeof connection.saveData !== 'undefined')
784
- network.saveData = connection.saveData;
785
- return network;
786
- }
787
- }
788
- if (Platform.isNode) {
789
- try {
790
- var os = require('os');
791
- var networkInterfaces = os.networkInterfaces();
792
- var networkInterfaceNames = Object.keys(networkInterfaces);
793
- for (var i = 0; i < networkInterfaceNames.length; i++) {
794
- var name_1 = networkInterfaceNames[i];
795
- var networkInterface = networkInterfaces[name_1];
796
- for (var j = 0; j < networkInterface.length; j++) {
797
- var address = networkInterface[j];
798
- if (!address.internal && address.family === 'IPv4')
799
- network.isOnline = true;
800
- }
801
- if (network.isOnline)
802
- break;
803
- }
804
- }
805
- catch (_) {
806
- }
807
- try {
808
- var childProcess = require('child_process');
809
- if (Platform.os.name === OS.Windows) {
810
- try {
811
- var output = childProcess.execSync('netsh wlan show interfaces', { encoding: 'utf8', timeout: 5000 });
812
- if (output.includes('State') && output.includes('connected'))
813
- network.type = 'wifi';
814
- }
815
- catch (_) {
816
- }
817
- if (network.type === null) {
818
- try {
819
- var output = childProcess.execSync('ipconfig', { encoding: 'utf8', timeout: 5000 });
820
- if (output.includes('Ethernet adapter'))
821
- network.type = 'ethernet';
822
- }
823
- catch (_) {
824
- }
825
- }
826
- if (network.type === null)
827
- network.type = 'other';
828
- }
829
- else if (Platform.os.name === OS.MacOS) {
830
- try {
831
- var output = childProcess.execSync('networksetup -listallhardwareports', { encoding: 'utf8', timeout: 5000 });
832
- var activeInterface = childProcess.execSync('route -n get default | grep interface', { encoding: 'utf8', timeout: 5000 });
833
- if (activeInterface.includes('en0') && output.includes('Wi-Fi'))
834
- network.type = 'wifi';
835
- else if (activeInterface.includes('en') || output.includes('Ethernet'))
836
- network.type = 'ethernet';
837
- else
838
- network.type = 'other';
839
- }
840
- catch (_) {
841
- network.type = 'other';
842
- }
843
- }
844
- }
845
- catch (_) {
846
- }
847
- }
848
- return network;
849
- }
850
755
  function normalizeLocale(locale) {
851
- if (locale === null || locale === undefined)
756
+ if (locale === null || typeof locale === 'undefined')
852
757
  return locale;
853
758
  if (locale.length === 0)
854
759
  return null;
855
760
  locale = locale.replace(/_/g, '-');
856
- if (locale === 'C' || locale === 'posix' || locale === 'POSIX')
761
+ if (locale === 'C' || locale.toLowerCase() === 'posix')
857
762
  return 'en-US';
858
763
  if (locale.indexOf('.') !== -1)
859
764
  return normalizeLocale(locale.split('.')[0]);
@@ -871,9 +776,9 @@ function normalizeLocale(locale) {
871
776
  }
872
777
  function getLocale() {
873
778
  var locale = {
874
- language: '',
779
+ language: null,
875
780
  languages: [],
876
- timezone: '',
781
+ timezone: null,
877
782
  timezoneOffset: 0,
878
783
  };
879
784
  function addLanguages(language) {
@@ -883,7 +788,7 @@ function getLocale() {
883
788
  function addLanguage(language) {
884
789
  language = normalizeLocale(language);
885
790
  if (typeof language === "string" && locale.languages.indexOf(language) === -1) {
886
- if (locale.language.length === 0)
791
+ if (locale.language === null)
887
792
  locale.language = language;
888
793
  locale.languages.push(language);
889
794
  }
@@ -941,6 +846,11 @@ function getLocale() {
941
846
  }
942
847
  catch (_) {
943
848
  }
849
+ try {
850
+ locale.timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
851
+ }
852
+ catch (_) {
853
+ }
944
854
  }
945
855
  if (typeof globalThis.navigator !== 'undefined') {
946
856
  if (typeof globalThis.navigator.languages !== 'undefined')
@@ -954,13 +864,6 @@ function getLocale() {
954
864
  if (typeof globalThis.navigator.systemLanguage !== 'undefined')
955
865
  addLanguage(globalThis.navigator.systemLanguage);
956
866
  }
957
- try {
958
- if (typeof Intl !== 'undefined') {
959
- locale.timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
960
- }
961
- }
962
- catch (_) {
963
- }
964
867
  try {
965
868
  locale.timezoneOffset = new Date().getTimezoneOffset();
966
869
  }
@@ -968,63 +871,8 @@ function getLocale() {
968
871
  }
969
872
  return locale;
970
873
  }
971
- function getDimension() {
972
- var dimension = {
973
- innerWidth: -1,
974
- innerHeight: -1,
975
- outerWidth: -1,
976
- outerHeight: -1,
977
- scale: 1,
978
- };
979
- if (typeof globalThis.innerWidth !== 'undefined') {
980
- dimension.innerWidth = globalThis.innerWidth;
981
- dimension.innerHeight = globalThis.innerHeight;
982
- dimension.outerWidth = globalThis.outerWidth;
983
- dimension.outerHeight = globalThis.outerHeight;
984
- dimension.scale = globalThis.devicePixelRatio || 1;
985
- return dimension;
986
- }
987
- if (Platform.crossPlatformFramework === CrossPlatformFramework.ReactNative) {
988
- try {
989
- var reactNative = require('react-native');
990
- var dimensions = reactNative.Dimensions;
991
- var pixelRatio = reactNative.PixelRatio;
992
- var screenDimensions = dimensions.get('screen');
993
- var windowDimensions = dimensions.get('window');
994
- dimension.innerWidth = screenDimensions.width;
995
- dimension.innerHeight = screenDimensions.height;
996
- dimension.outerWidth = windowDimensions.width;
997
- dimension.outerHeight = windowDimensions.height;
998
- dimension.scale = pixelRatio.get();
999
- return dimension;
1000
- }
1001
- catch (_) {
1002
- }
1003
- }
1004
- if (Platform.crossPlatformFramework === CrossPlatformFramework.Electron) {
1005
- try {
1006
- var electron = require('electron');
1007
- var screen_1 = electron.screen;
1008
- var browserWindow = electron.BrowserWindow;
1009
- var focusedWindow = browserWindow.getFocusedWindow() || browserWindow.getAllWindows()[0];
1010
- if (focusedWindow !== undefined) {
1011
- var contentSize = focusedWindow.getContentSize();
1012
- var size = focusedWindow.getSize();
1013
- dimension.innerWidth = contentSize[0];
1014
- dimension.innerHeight = contentSize[1];
1015
- dimension.outerWidth = size[0];
1016
- dimension.outerHeight = size[1];
1017
- dimension.scale = screen_1.getDisplayMatching(focusedWindow.getBounds()).scaleFactor;
1018
- }
1019
- return dimension;
1020
- }
1021
- catch (_) {
1022
- }
1023
- }
1024
- return dimension;
1025
- }
1026
874
  function init() {
1027
- if ((typeof globalThis.process !== 'undefined' && typeof globalThis.process.versions !== 'undefined' && globalThis.process.versions.electron !== undefined) || (/ electron\//i.test(USER_AGENT)))
875
+ if ((typeof globalThis.process !== 'undefined' && typeof globalThis.process.versions !== 'undefined' && typeof globalThis.process.versions.electron !== 'undefined') || (/ electron\//i.test(USER_AGENT)))
1028
876
  Platform.crossPlatformFramework = CrossPlatformFramework.Electron;
1029
877
  if (typeof globalThis.navigator !== 'undefined' && globalThis.navigator.product === 'ReactNative')
1030
878
  Platform.crossPlatformFramework = CrossPlatformFramework.ReactNative;
@@ -1220,8 +1068,7 @@ function init() {
1220
1068
  finally {
1221
1069
  decrementPendingTasks();
1222
1070
  }
1223
- })
1224
- .catch(decrementPendingTasks);
1071
+ });
1225
1072
  }
1226
1073
  checkReady();
1227
1074
  }
@@ -1243,16 +1090,7 @@ function getTrackId(bundle) {
1243
1090
  xhr.send();
1244
1091
  if (xhr.status === 200) {
1245
1092
  try {
1246
- var response = JSON.parse(xhr.response);
1247
- if (response.results === undefined)
1248
- return undefined;
1249
- var results = response.results;
1250
- if (!Array.isArray(results) || results.length === 0)
1251
- return undefined;
1252
- var result = results[0];
1253
- if (result === undefined)
1254
- return undefined;
1255
- return result.trackId;
1093
+ return parseLookupBundleIdResponse(JSON.parse(xhr.response));
1256
1094
  }
1257
1095
  catch (_) {
1258
1096
  return undefined;
@@ -1264,22 +1102,51 @@ function getTrackId(bundle) {
1264
1102
  return undefined;
1265
1103
  }
1266
1104
  }
1105
+ function getTrackIdAsync(bundle) {
1106
+ return new Promise(function (resolve) {
1107
+ fetch('https://itunes.apple.com/lookup?bundleId=' + bundle)
1108
+ .then(function (response) {
1109
+ response
1110
+ .json()
1111
+ .then(function (response) {
1112
+ resolve(parseLookupBundleIdResponse(response));
1113
+ })
1114
+ .catch(function () {
1115
+ resolve(undefined);
1116
+ });
1117
+ })
1118
+ .catch(function () {
1119
+ resolve(undefined);
1120
+ });
1121
+ });
1122
+ }
1123
+ function parseLookupBundleIdResponse(response) {
1124
+ if (typeof response.results === 'undefined')
1125
+ return undefined;
1126
+ var results = response.results;
1127
+ if (results.length === 0)
1128
+ return undefined;
1129
+ var result = results[0];
1130
+ if (typeof result === 'undefined')
1131
+ return undefined;
1132
+ return "" + result.trackId;
1133
+ }
1267
1134
  function createIntentURL(scheme, packageName, fallback) {
1268
1135
  var split = scheme.split('://');
1269
1136
  var prefix = split[0];
1270
1137
  var suffix = split[1];
1271
1138
  var intent = 'intent://';
1272
- if (suffix !== undefined)
1139
+ if (typeof suffix !== 'undefined')
1273
1140
  intent = intent + suffix;
1274
1141
  intent = intent + '#Intent;'
1275
1142
  + 'scheme=' + prefix + ';'
1276
1143
  + 'action=android.intent.action.VIEW;'
1277
1144
  + 'category=android.intent.category.BROWSABLE;';
1278
- if (packageName !== undefined)
1145
+ if (typeof packageName !== 'undefined')
1279
1146
  intent = intent + 'package=' + packageName + ';';
1280
- if (fallback !== undefined && typeof fallback === 'string')
1147
+ if (typeof fallback !== 'undefined' && typeof fallback === 'string')
1281
1148
  intent = intent + 'S.browser_fallback_url=' + fallback + ';';
1282
- else if (packageName !== undefined)
1149
+ else if (typeof packageName !== 'undefined')
1283
1150
  intent = intent + 'S.browser_fallback_url=' + createAppStoreURL(packageName, OS.Android) + ';';
1284
1151
  return intent + 'end';
1285
1152
  }
@@ -1297,16 +1164,16 @@ function parseIntentURL(intent) {
1297
1164
  if (index !== -1)
1298
1165
  extras[part.substring(0, index)] = part.substring(index + 1);
1299
1166
  }
1300
- if (extras['scheme'] !== undefined)
1167
+ if (typeof extras['scheme'] !== 'undefined')
1301
1168
  parsed.scheme = (extras['scheme'] + '://' + host);
1302
- if (extras['package'] !== undefined)
1169
+ if (typeof extras['package'] !== 'undefined')
1303
1170
  parsed.packageName = extras['package'];
1304
- if (extras['S.browser_fallback_url'] !== undefined)
1171
+ if (typeof extras['S.browser_fallback_url'] !== 'undefined')
1305
1172
  parsed.fallback = extras['S.browser_fallback_url'];
1306
1173
  return parsed;
1307
1174
  }
1308
1175
  function createAppStoreURL(packageName, os) {
1309
- if (packageName === undefined)
1176
+ if (typeof packageName === 'undefined')
1310
1177
  return undefined;
1311
1178
  switch (os) {
1312
1179
  case OS.Android:
@@ -1322,7 +1189,7 @@ function createAppStoreURL(packageName, os) {
1322
1189
  }
1323
1190
  }
1324
1191
  function createWebStoreURL(packageName, os) {
1325
- if (packageName === undefined)
1192
+ if (typeof packageName === 'undefined')
1326
1193
  return undefined;
1327
1194
  switch (os) {
1328
1195
  case OS.Android:
@@ -1387,7 +1254,7 @@ function openURLViaHref(url, index) {
1387
1254
  return;
1388
1255
  }
1389
1256
  a = createHiddenElement('a');
1390
- if (a === undefined)
1257
+ if (typeof a === 'undefined')
1391
1258
  return;
1392
1259
  a.href = url;
1393
1260
  topDocument.body.appendChild(a);
@@ -1397,7 +1264,7 @@ function openURLViaHref(url, index) {
1397
1264
  catch (_) {
1398
1265
  }
1399
1266
  finally {
1400
- if (a !== undefined) {
1267
+ if (typeof a !== 'undefined') {
1401
1268
  try {
1402
1269
  topDocument.body.removeChild(a);
1403
1270
  }
@@ -1412,12 +1279,12 @@ function openURLViaIframe(url) {
1412
1279
  var iframe = undefined;
1413
1280
  try {
1414
1281
  iframe = createHiddenElement('iframe');
1415
- if (iframe === undefined)
1282
+ if (typeof iframe === 'undefined')
1416
1283
  return;
1417
1284
  iframe.src = url;
1418
1285
  topDocument.body.appendChild(iframe);
1419
1286
  globalThis.setTimeout(function () {
1420
- if (iframe !== undefined) {
1287
+ if (typeof iframe !== 'undefined') {
1421
1288
  try {
1422
1289
  topDocument.body.removeChild(iframe);
1423
1290
  }
@@ -1441,13 +1308,13 @@ function isDocumentHidden() {
1441
1308
  return true;
1442
1309
  if (topDocument.msVisibilityState === 'hidden')
1443
1310
  return true;
1444
- if (topDocument.hidden !== undefined)
1311
+ if (typeof topDocument.hidden !== 'undefined')
1445
1312
  return topDocument.hidden;
1446
- if (topDocument.webkitHidden !== undefined)
1313
+ if (typeof topDocument.webkitHidden !== 'undefined')
1447
1314
  return topDocument.webkitHidden;
1448
- if (topDocument.mozHidden !== undefined)
1315
+ if (typeof topDocument.mozHidden !== 'undefined')
1449
1316
  return topDocument.mozHidden;
1450
- if (topDocument.msHidden !== undefined)
1317
+ if (typeof topDocument.msHidden !== 'undefined')
1451
1318
  return topDocument.msHidden;
1452
1319
  if (typeof topDocument.hasFocus === 'function')
1453
1320
  return !topDocument.hasFocus();
@@ -1484,7 +1351,7 @@ function restoreFocus() {
1484
1351
  var input = undefined;
1485
1352
  try {
1486
1353
  input = createHiddenElement('input');
1487
- if (input === undefined)
1354
+ if (typeof input === 'undefined')
1488
1355
  return false;
1489
1356
  input.type = 'text';
1490
1357
  input.readOnly = true;
@@ -1501,7 +1368,7 @@ function restoreFocus() {
1501
1368
  catch (_) {
1502
1369
  }
1503
1370
  finally {
1504
- if (input !== undefined) {
1371
+ if (typeof input !== 'undefined') {
1505
1372
  try {
1506
1373
  input.blur();
1507
1374
  }
@@ -1591,7 +1458,7 @@ function tryOpenURL(url, index, timeout) {
1591
1458
  var timeoutId;
1592
1459
  var resolved = false;
1593
1460
  function cleanup() {
1594
- if (timeoutId !== undefined) {
1461
+ if (typeof timeoutId !== 'undefined') {
1595
1462
  clearTimeout(timeoutId);
1596
1463
  timeoutId = undefined;
1597
1464
  }
@@ -1602,14 +1469,14 @@ function tryOpenURL(url, index, timeout) {
1602
1469
  }
1603
1470
  catch (_) {
1604
1471
  }
1605
- if (a !== undefined) {
1472
+ if (typeof a !== 'undefined') {
1606
1473
  try {
1607
1474
  topDocument.body.removeChild(a);
1608
1475
  }
1609
1476
  catch (_) {
1610
1477
  }
1611
1478
  }
1612
- if (iframe !== undefined) {
1479
+ if (typeof iframe !== 'undefined') {
1613
1480
  try {
1614
1481
  topDocument.body.removeChild(iframe);
1615
1482
  }
@@ -1633,7 +1500,7 @@ function tryOpenURL(url, index, timeout) {
1633
1500
  }
1634
1501
  }
1635
1502
  function onBlur() {
1636
- if (timeoutId !== undefined) {
1503
+ if (typeof timeoutId !== 'undefined') {
1637
1504
  clearTimeout(timeoutId);
1638
1505
  timeoutId = undefined;
1639
1506
  }
@@ -1676,7 +1543,7 @@ function open(options) {
1676
1543
  var timeout;
1677
1544
  if (Platform.os.name === OS.Android) {
1678
1545
  var option = options[OS.Android] || options['android'];
1679
- if (option === undefined)
1546
+ if (typeof option === 'undefined')
1680
1547
  return Promise.reject(getURLOpenError(tried));
1681
1548
  timeout = option.timeout;
1682
1549
  infos.scheme = urlToString(option.scheme);
@@ -1687,21 +1554,21 @@ function open(options) {
1687
1554
  infos.webStore = createWebStoreURL(infos.packageName, OS.Android);
1688
1555
  infos.allowAppStore = option.allowAppStore;
1689
1556
  infos.allowWebStore = option.allowWebStore;
1690
- if (infos.intent !== undefined && (infos.scheme === undefined || infos.packageName === undefined || infos.fallback === undefined)) {
1557
+ if (typeof infos.intent !== 'undefined' && (typeof infos.scheme === 'undefined' || typeof infos.packageName === 'undefined' || typeof infos.fallback === 'undefined')) {
1691
1558
  var parsed = parseIntentURL(infos.intent);
1692
- if (parsed.scheme !== undefined && infos.scheme === undefined)
1559
+ if (typeof parsed.scheme !== 'undefined' && typeof infos.scheme === 'undefined')
1693
1560
  infos.scheme = parsed.scheme;
1694
- if (parsed.packageName !== undefined && infos.packageName === undefined)
1561
+ if (typeof parsed.packageName !== 'undefined' && typeof infos.packageName === 'undefined')
1695
1562
  infos.packageName = parsed.packageName;
1696
- if (parsed.fallback !== undefined && infos.fallback === undefined)
1563
+ if (typeof parsed.fallback !== 'undefined' && typeof infos.fallback === 'undefined')
1697
1564
  infos.fallback = parsed.fallback;
1698
1565
  }
1699
- if (infos.scheme !== undefined && infos.intent === undefined)
1566
+ if (typeof infos.scheme !== 'undefined' && typeof infos.intent === 'undefined')
1700
1567
  infos.intent = createIntentURL(infos.scheme, infos.packageName, infos.fallback);
1701
1568
  }
1702
1569
  else if (Platform.os.name === OS.iOS) {
1703
1570
  var option = options[OS.iOS] || options['ios'];
1704
- if (option === undefined)
1571
+ if (typeof option === 'undefined')
1705
1572
  return Promise.reject(getURLOpenError(tried));
1706
1573
  timeout = option.timeout;
1707
1574
  infos.scheme = urlToString(option.scheme);
@@ -1713,12 +1580,12 @@ function open(options) {
1713
1580
  infos.webStore = createWebStoreURL(infos.trackId, OS.iOS);
1714
1581
  infos.allowAppStore = option.allowAppStore;
1715
1582
  infos.allowWebStore = option.allowWebStore;
1716
- if (infos.bundleId !== undefined && infos.trackId === undefined)
1583
+ if (typeof infos.bundleId !== 'undefined' && typeof infos.trackId === 'undefined')
1717
1584
  infos.trackId = getTrackId(infos.bundleId);
1718
1585
  }
1719
1586
  else if (Platform.os.name === OS.Windows) {
1720
1587
  var option = options[OS.Windows] || options['windows'];
1721
- if (option === undefined)
1588
+ if (typeof option === 'undefined')
1722
1589
  return Promise.reject(getURLOpenError(tried));
1723
1590
  timeout = option.timeout;
1724
1591
  infos.scheme = urlToString(option.scheme);
@@ -1730,20 +1597,43 @@ function open(options) {
1730
1597
  infos.allowWebStore = option.allowWebStore;
1731
1598
  }
1732
1599
  else if (Platform.os.name === OS.MacOS) {
1733
- var option = options[OS.MacOS] || options['mac'];
1734
- if (option === undefined)
1600
+ var option_1 = options[OS.MacOS] || options['mac'];
1601
+ if (typeof option_1 === 'undefined')
1735
1602
  return Promise.reject(getURLOpenError(tried));
1736
- timeout = option.timeout;
1737
- infos.scheme = urlToString(option.scheme);
1738
- infos.bundleId = option.bundleId;
1739
- infos.trackId = option.trackId;
1740
- infos.fallback = urlToString(option.fallback);
1603
+ timeout = option_1.timeout;
1604
+ infos.scheme = urlToString(option_1.scheme);
1605
+ infos.bundleId = option_1.bundleId;
1606
+ infos.trackId = option_1.trackId;
1607
+ infos.fallback = urlToString(option_1.fallback);
1741
1608
  infos.appStore = createAppStoreURL(infos.trackId, OS.MacOS);
1742
1609
  infos.webStore = createWebStoreURL(infos.trackId, OS.MacOS);
1743
- infos.allowAppStore = option.allowAppStore;
1744
- infos.allowWebStore = option.allowWebStore;
1745
- if (infos.bundleId !== undefined && infos.trackId === undefined)
1746
- infos.trackId = getTrackId(infos.bundleId);
1610
+ infos.allowAppStore = option_1.allowAppStore;
1611
+ infos.allowWebStore = option_1.allowWebStore;
1612
+ if (typeof infos.bundleId !== 'undefined' && typeof infos.trackId === 'undefined') {
1613
+ if (Platform.crossPlatformFramework === CrossPlatformFramework.Electron) {
1614
+ if (option_1.electronTrackIdTried !== true) {
1615
+ var self_1 = this;
1616
+ return new Promise(function (resolve) {
1617
+ if (typeof infos.bundleId !== 'undefined') {
1618
+ getTrackIdAsync(infos.bundleId)
1619
+ .then(function (trackId) {
1620
+ option_1.trackId = trackId;
1621
+ option_1.scheme = infos.scheme;
1622
+ option_1.bundleId = infos.bundleId;
1623
+ option_1.fallback = infos.fallback;
1624
+ option_1.allowAppStore = infos.allowAppStore;
1625
+ option_1.allowWebStore = infos.allowWebStore;
1626
+ option_1.electronTrackIdTried = true;
1627
+ resolve(self_1.open({ mac: option_1 }));
1628
+ });
1629
+ }
1630
+ });
1631
+ }
1632
+ }
1633
+ else {
1634
+ infos.trackId = getTrackId(infos.bundleId);
1635
+ }
1636
+ }
1747
1637
  }
1748
1638
  pushURL(urls, infos.intent, AppOpenState.Intent, canOpenIntentURL());
1749
1639
  pushURL(urls, infos.universal, AppOpenState.Universal, canOpenUniversalURL());
@@ -1751,7 +1641,7 @@ function open(options) {
1751
1641
  pushURL(urls, infos.fallback, AppOpenState.Fallback);
1752
1642
  pushURL(urls, infos.appStore, AppOpenState.Store, infos.allowAppStore);
1753
1643
  pushURL(urls, infos.webStore, AppOpenState.Store, infos.allowWebStore);
1754
- if (timeout === undefined)
1644
+ if (typeof timeout === 'undefined')
1755
1645
  timeout = getDefaultTimeoutByOS(os);
1756
1646
  return new Promise(function (resolve, reject) {
1757
1647
  function openURLSequential(index) {
@@ -1892,15 +1782,15 @@ function normalize(value) {
1892
1782
  var key = keys[i];
1893
1783
  result[key] = stringifiableToString(value[key]);
1894
1784
  }
1895
- if (result.to === undefined)
1785
+ if (typeof result.to === 'undefined')
1896
1786
  result.to = '';
1897
- if (result.cc === undefined)
1787
+ if (typeof result.cc === 'undefined')
1898
1788
  result.cc = '';
1899
- if (result.bcc === undefined)
1789
+ if (typeof result.bcc === 'undefined')
1900
1790
  result.bcc = '';
1901
- if (result.subject === undefined)
1791
+ if (typeof result.subject === 'undefined')
1902
1792
  result.subject = '';
1903
- if (result.body === undefined)
1793
+ if (typeof result.body === 'undefined')
1904
1794
  result.body = '';
1905
1795
  return result;
1906
1796
  }