native-fn 1.1.9 → 1.2.1
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.
- package/README.md +488 -146
- package/dist/index.d.ts +138 -119
- package/dist/native.cjs +661 -565
- package/dist/native.min.cjs +1 -1
- package/dist/native.min.mjs +1 -1
- package/dist/native.mjs +661 -565
- package/dist/native.umd.js +661 -565
- package/dist/native.umd.min.js +1 -1
- package/dist/plugin/appearance/index.cjs +8 -3
- package/dist/plugin/appearance/index.mjs +8 -3
- package/dist/plugin/appearance/src/errors/invalid-state-error.d.ts +2 -0
- package/dist/plugin/appearance/src/plugin/badge/types/badge.d.ts +1 -1
- package/dist/plugin/appearance/src/plugin/battery/types/battery.d.ts +1 -1
- package/dist/plugin/appearance/src/plugin/fullscreen/cores/index.d.ts +3 -3
- package/dist/plugin/appearance/src/plugin/fullscreen/types/fullscreen.d.ts +15 -6
- package/dist/plugin/appearance/src/plugin/geolocation/types/geolocation.d.ts +1 -1
- package/dist/plugin/appearance/src/plugin/open/types/open.d.ts +1 -1
- package/dist/plugin/appearance/src/plugin/permission/types/permission.d.ts +1 -0
- package/dist/plugin/appearance/src/plugin/pip/cores/index.d.ts +6 -6
- package/dist/plugin/appearance/src/plugin/pip/types/pip.d.ts +14 -5
- package/dist/plugin/appearance/src/plugin/vibration/types/vibration.d.ts +1 -1
- package/dist/plugin/appearance/src/types/subscription-manager.d.ts +1 -1
- package/dist/plugin/badge/index.cjs +2 -2
- package/dist/plugin/badge/index.d.ts +1 -1
- package/dist/plugin/badge/index.mjs +2 -2
- package/dist/plugin/badge/src/errors/invalid-state-error.d.ts +2 -0
- package/dist/plugin/badge/src/plugin/badge/types/badge.d.ts +1 -1
- package/dist/plugin/badge/src/plugin/battery/types/battery.d.ts +1 -1
- package/dist/plugin/badge/src/plugin/fullscreen/cores/index.d.ts +3 -3
- package/dist/plugin/badge/src/plugin/fullscreen/types/fullscreen.d.ts +15 -6
- package/dist/plugin/badge/src/plugin/geolocation/types/geolocation.d.ts +1 -1
- package/dist/plugin/badge/src/plugin/open/types/open.d.ts +1 -1
- package/dist/plugin/badge/src/plugin/permission/types/permission.d.ts +1 -0
- package/dist/plugin/badge/src/plugin/pip/cores/index.d.ts +6 -6
- package/dist/plugin/badge/src/plugin/pip/types/pip.d.ts +14 -5
- package/dist/plugin/badge/src/plugin/vibration/types/vibration.d.ts +1 -1
- package/dist/plugin/badge/src/types/subscription-manager.d.ts +1 -1
- package/dist/plugin/battery/index.cjs +3 -3
- package/dist/plugin/battery/index.d.ts +1 -1
- package/dist/plugin/battery/index.mjs +3 -3
- package/dist/plugin/battery/src/errors/invalid-state-error.d.ts +2 -0
- package/dist/plugin/battery/src/plugin/badge/types/badge.d.ts +1 -1
- package/dist/plugin/battery/src/plugin/battery/types/battery.d.ts +1 -1
- package/dist/plugin/battery/src/plugin/fullscreen/cores/index.d.ts +3 -3
- package/dist/plugin/battery/src/plugin/fullscreen/types/fullscreen.d.ts +15 -6
- package/dist/plugin/battery/src/plugin/geolocation/types/geolocation.d.ts +1 -1
- package/dist/plugin/battery/src/plugin/open/types/open.d.ts +1 -1
- package/dist/plugin/battery/src/plugin/permission/types/permission.d.ts +1 -0
- package/dist/plugin/battery/src/plugin/pip/cores/index.d.ts +6 -6
- package/dist/plugin/battery/src/plugin/pip/types/pip.d.ts +14 -5
- package/dist/plugin/battery/src/plugin/vibration/types/vibration.d.ts +1 -1
- package/dist/plugin/battery/src/types/subscription-manager.d.ts +1 -1
- package/dist/plugin/clipboard/src/errors/invalid-state-error.d.ts +2 -0
- package/dist/plugin/clipboard/src/plugin/badge/types/badge.d.ts +1 -1
- package/dist/plugin/clipboard/src/plugin/battery/types/battery.d.ts +1 -1
- package/dist/plugin/clipboard/src/plugin/fullscreen/cores/index.d.ts +3 -3
- package/dist/plugin/clipboard/src/plugin/fullscreen/types/fullscreen.d.ts +15 -6
- package/dist/plugin/clipboard/src/plugin/geolocation/types/geolocation.d.ts +1 -1
- package/dist/plugin/clipboard/src/plugin/open/types/open.d.ts +1 -1
- package/dist/plugin/clipboard/src/plugin/permission/types/permission.d.ts +1 -0
- package/dist/plugin/clipboard/src/plugin/pip/cores/index.d.ts +6 -6
- package/dist/plugin/clipboard/src/plugin/pip/types/pip.d.ts +14 -5
- package/dist/plugin/clipboard/src/plugin/vibration/types/vibration.d.ts +1 -1
- package/dist/plugin/clipboard/src/types/subscription-manager.d.ts +1 -1
- package/dist/plugin/dimension/src/errors/invalid-state-error.d.ts +2 -0
- package/dist/plugin/dimension/src/plugin/badge/types/badge.d.ts +1 -1
- package/dist/plugin/dimension/src/plugin/battery/types/battery.d.ts +1 -1
- package/dist/plugin/dimension/src/plugin/fullscreen/cores/index.d.ts +3 -3
- package/dist/plugin/dimension/src/plugin/fullscreen/types/fullscreen.d.ts +15 -6
- package/dist/plugin/dimension/src/plugin/geolocation/types/geolocation.d.ts +1 -1
- package/dist/plugin/dimension/src/plugin/open/types/open.d.ts +1 -1
- package/dist/plugin/dimension/src/plugin/permission/types/permission.d.ts +1 -0
- package/dist/plugin/dimension/src/plugin/pip/cores/index.d.ts +6 -6
- package/dist/plugin/dimension/src/plugin/pip/types/pip.d.ts +14 -5
- package/dist/plugin/dimension/src/plugin/vibration/types/vibration.d.ts +1 -1
- package/dist/plugin/dimension/src/types/subscription-manager.d.ts +1 -1
- package/dist/plugin/fullscreen/index.cjs +539 -266
- package/dist/plugin/fullscreen/index.d.ts +20 -10
- package/dist/plugin/fullscreen/index.mjs +539 -266
- package/dist/plugin/fullscreen/src/errors/invalid-state-error.d.ts +2 -0
- package/dist/plugin/fullscreen/src/plugin/badge/types/badge.d.ts +1 -1
- package/dist/plugin/fullscreen/src/plugin/battery/types/battery.d.ts +1 -1
- package/dist/plugin/fullscreen/src/plugin/fullscreen/cores/index.d.ts +3 -3
- package/dist/plugin/fullscreen/src/plugin/fullscreen/types/fullscreen.d.ts +15 -6
- package/dist/plugin/fullscreen/src/plugin/geolocation/types/geolocation.d.ts +1 -1
- package/dist/plugin/fullscreen/src/plugin/open/types/open.d.ts +1 -1
- package/dist/plugin/fullscreen/src/plugin/permission/types/permission.d.ts +1 -0
- package/dist/plugin/fullscreen/src/plugin/pip/cores/index.d.ts +6 -6
- package/dist/plugin/fullscreen/src/plugin/pip/types/pip.d.ts +14 -5
- package/dist/plugin/fullscreen/src/plugin/vibration/types/vibration.d.ts +1 -1
- package/dist/plugin/fullscreen/src/types/subscription-manager.d.ts +1 -1
- package/dist/plugin/geolocation/index.cjs +6 -0
- package/dist/plugin/geolocation/index.d.ts +1 -1
- package/dist/plugin/geolocation/index.mjs +6 -0
- package/dist/plugin/geolocation/src/errors/invalid-state-error.d.ts +2 -0
- package/dist/plugin/geolocation/src/plugin/badge/types/badge.d.ts +1 -1
- package/dist/plugin/geolocation/src/plugin/battery/types/battery.d.ts +1 -1
- package/dist/plugin/geolocation/src/plugin/fullscreen/cores/index.d.ts +3 -3
- package/dist/plugin/geolocation/src/plugin/fullscreen/types/fullscreen.d.ts +15 -6
- package/dist/plugin/geolocation/src/plugin/geolocation/types/geolocation.d.ts +1 -1
- package/dist/plugin/geolocation/src/plugin/open/types/open.d.ts +1 -1
- package/dist/plugin/geolocation/src/plugin/permission/types/permission.d.ts +1 -0
- package/dist/plugin/geolocation/src/plugin/pip/cores/index.d.ts +6 -6
- package/dist/plugin/geolocation/src/plugin/pip/types/pip.d.ts +14 -5
- package/dist/plugin/geolocation/src/plugin/vibration/types/vibration.d.ts +1 -1
- package/dist/plugin/geolocation/src/types/subscription-manager.d.ts +1 -1
- package/dist/plugin/notification/index.cjs +6 -0
- package/dist/plugin/notification/index.mjs +6 -0
- package/dist/plugin/notification/src/errors/invalid-state-error.d.ts +2 -0
- package/dist/plugin/notification/src/plugin/badge/types/badge.d.ts +1 -1
- package/dist/plugin/notification/src/plugin/battery/types/battery.d.ts +1 -1
- package/dist/plugin/notification/src/plugin/fullscreen/cores/index.d.ts +3 -3
- package/dist/plugin/notification/src/plugin/fullscreen/types/fullscreen.d.ts +15 -6
- package/dist/plugin/notification/src/plugin/geolocation/types/geolocation.d.ts +1 -1
- package/dist/plugin/notification/src/plugin/open/types/open.d.ts +1 -1
- package/dist/plugin/notification/src/plugin/permission/types/permission.d.ts +1 -0
- package/dist/plugin/notification/src/plugin/pip/cores/index.d.ts +6 -6
- package/dist/plugin/notification/src/plugin/pip/types/pip.d.ts +14 -5
- package/dist/plugin/notification/src/plugin/vibration/types/vibration.d.ts +1 -1
- package/dist/plugin/notification/src/types/subscription-manager.d.ts +1 -1
- package/dist/plugin/open/index.cjs +128 -123
- package/dist/plugin/open/index.d.ts +35 -35
- package/dist/plugin/open/index.mjs +128 -123
- package/dist/plugin/open/src/errors/invalid-state-error.d.ts +2 -0
- package/dist/plugin/open/src/plugin/badge/types/badge.d.ts +1 -1
- package/dist/plugin/open/src/plugin/battery/types/battery.d.ts +1 -1
- package/dist/plugin/open/src/plugin/fullscreen/cores/index.d.ts +3 -3
- package/dist/plugin/open/src/plugin/fullscreen/types/fullscreen.d.ts +15 -6
- package/dist/plugin/open/src/plugin/geolocation/types/geolocation.d.ts +1 -1
- package/dist/plugin/open/src/plugin/open/types/open.d.ts +1 -1
- package/dist/plugin/open/src/plugin/permission/types/permission.d.ts +1 -0
- package/dist/plugin/open/src/plugin/pip/cores/index.d.ts +6 -6
- package/dist/plugin/open/src/plugin/pip/types/pip.d.ts +14 -5
- package/dist/plugin/open/src/plugin/vibration/types/vibration.d.ts +1 -1
- package/dist/plugin/open/src/types/subscription-manager.d.ts +1 -1
- package/dist/plugin/permission/index.cjs +6 -0
- package/dist/plugin/permission/index.d.ts +1 -0
- package/dist/plugin/permission/index.mjs +6 -0
- package/dist/plugin/permission/src/errors/invalid-state-error.d.ts +2 -0
- package/dist/plugin/permission/src/plugin/badge/types/badge.d.ts +1 -1
- package/dist/plugin/permission/src/plugin/battery/types/battery.d.ts +1 -1
- package/dist/plugin/permission/src/plugin/fullscreen/cores/index.d.ts +3 -3
- package/dist/plugin/permission/src/plugin/fullscreen/types/fullscreen.d.ts +15 -6
- package/dist/plugin/permission/src/plugin/geolocation/types/geolocation.d.ts +1 -1
- package/dist/plugin/permission/src/plugin/open/types/open.d.ts +1 -1
- package/dist/plugin/permission/src/plugin/permission/types/permission.d.ts +1 -0
- package/dist/plugin/permission/src/plugin/pip/cores/index.d.ts +6 -6
- package/dist/plugin/permission/src/plugin/pip/types/pip.d.ts +14 -5
- package/dist/plugin/permission/src/plugin/vibration/types/vibration.d.ts +1 -1
- package/dist/plugin/permission/src/types/subscription-manager.d.ts +1 -1
- package/dist/plugin/pip/index.cjs +651 -268
- package/dist/plugin/pip/index.d.ts +22 -12
- package/dist/plugin/pip/index.mjs +651 -268
- package/dist/plugin/pip/src/errors/invalid-state-error.d.ts +2 -0
- package/dist/plugin/pip/src/plugin/badge/types/badge.d.ts +1 -1
- package/dist/plugin/pip/src/plugin/battery/types/battery.d.ts +1 -1
- package/dist/plugin/pip/src/plugin/fullscreen/cores/index.d.ts +3 -3
- package/dist/plugin/pip/src/plugin/fullscreen/types/fullscreen.d.ts +15 -6
- package/dist/plugin/pip/src/plugin/geolocation/types/geolocation.d.ts +1 -1
- package/dist/plugin/pip/src/plugin/open/types/open.d.ts +1 -1
- package/dist/plugin/pip/src/plugin/permission/types/permission.d.ts +1 -0
- package/dist/plugin/pip/src/plugin/pip/cores/index.d.ts +6 -6
- package/dist/plugin/pip/src/plugin/pip/types/pip.d.ts +14 -5
- package/dist/plugin/pip/src/plugin/vibration/types/vibration.d.ts +1 -1
- package/dist/plugin/pip/src/types/subscription-manager.d.ts +1 -1
- package/dist/plugin/platform/index.cjs +8 -3
- package/dist/plugin/platform/index.d.ts +5 -5
- package/dist/plugin/platform/index.mjs +8 -3
- package/dist/plugin/platform/src/errors/invalid-state-error.d.ts +2 -0
- package/dist/plugin/platform/src/plugin/badge/types/badge.d.ts +1 -1
- package/dist/plugin/platform/src/plugin/battery/types/battery.d.ts +1 -1
- package/dist/plugin/platform/src/plugin/fullscreen/cores/index.d.ts +3 -3
- package/dist/plugin/platform/src/plugin/fullscreen/types/fullscreen.d.ts +15 -6
- package/dist/plugin/platform/src/plugin/geolocation/types/geolocation.d.ts +1 -1
- package/dist/plugin/platform/src/plugin/open/types/open.d.ts +1 -1
- package/dist/plugin/platform/src/plugin/permission/types/permission.d.ts +1 -0
- package/dist/plugin/platform/src/plugin/pip/cores/index.d.ts +6 -6
- package/dist/plugin/platform/src/plugin/pip/types/pip.d.ts +14 -5
- package/dist/plugin/platform/src/plugin/vibration/types/vibration.d.ts +1 -1
- package/dist/plugin/platform/src/types/subscription-manager.d.ts +1 -1
- package/dist/plugin/theme/index.cjs +8 -3
- package/dist/plugin/theme/index.mjs +8 -3
- package/dist/plugin/theme/src/errors/invalid-state-error.d.ts +2 -0
- package/dist/plugin/theme/src/plugin/badge/types/badge.d.ts +1 -1
- package/dist/plugin/theme/src/plugin/battery/types/battery.d.ts +1 -1
- package/dist/plugin/theme/src/plugin/fullscreen/cores/index.d.ts +3 -3
- package/dist/plugin/theme/src/plugin/fullscreen/types/fullscreen.d.ts +15 -6
- package/dist/plugin/theme/src/plugin/geolocation/types/geolocation.d.ts +1 -1
- package/dist/plugin/theme/src/plugin/open/types/open.d.ts +1 -1
- package/dist/plugin/theme/src/plugin/permission/types/permission.d.ts +1 -0
- package/dist/plugin/theme/src/plugin/pip/cores/index.d.ts +6 -6
- package/dist/plugin/theme/src/plugin/pip/types/pip.d.ts +14 -5
- package/dist/plugin/theme/src/plugin/vibration/types/vibration.d.ts +1 -1
- package/dist/plugin/theme/src/types/subscription-manager.d.ts +1 -1
- package/dist/plugin/vibration/index.cjs +5 -5
- package/dist/plugin/vibration/index.d.ts +1 -1
- package/dist/plugin/vibration/index.mjs +5 -5
- package/dist/plugin/vibration/src/errors/invalid-state-error.d.ts +2 -0
- package/dist/plugin/vibration/src/plugin/badge/types/badge.d.ts +1 -1
- package/dist/plugin/vibration/src/plugin/battery/types/battery.d.ts +1 -1
- package/dist/plugin/vibration/src/plugin/fullscreen/cores/index.d.ts +3 -3
- package/dist/plugin/vibration/src/plugin/fullscreen/types/fullscreen.d.ts +15 -6
- package/dist/plugin/vibration/src/plugin/geolocation/types/geolocation.d.ts +1 -1
- package/dist/plugin/vibration/src/plugin/open/types/open.d.ts +1 -1
- package/dist/plugin/vibration/src/plugin/permission/types/permission.d.ts +1 -0
- package/dist/plugin/vibration/src/plugin/pip/cores/index.d.ts +6 -6
- package/dist/plugin/vibration/src/plugin/pip/types/pip.d.ts +14 -5
- package/dist/plugin/vibration/src/plugin/vibration/types/vibration.d.ts +1 -1
- package/dist/plugin/vibration/src/types/subscription-manager.d.ts +1 -1
- package/dist/src/errors/invalid-state-error.d.ts +2 -0
- package/dist/src/plugin/badge/types/badge.d.ts +1 -1
- package/dist/src/plugin/battery/types/battery.d.ts +1 -1
- package/dist/src/plugin/fullscreen/cores/index.d.ts +3 -3
- package/dist/src/plugin/fullscreen/types/fullscreen.d.ts +15 -6
- package/dist/src/plugin/geolocation/types/geolocation.d.ts +1 -1
- package/dist/src/plugin/open/types/open.d.ts +1 -1
- package/dist/src/plugin/permission/types/permission.d.ts +1 -0
- package/dist/src/plugin/pip/cores/index.d.ts +6 -6
- package/dist/src/plugin/pip/types/pip.d.ts +14 -5
- package/dist/src/plugin/vibration/types/vibration.d.ts +1 -1
- package/dist/src/types/subscription-manager.d.ts +1 -1
- package/package.json +21 -13
|
@@ -102,6 +102,7 @@ var HIGH_ENTROPY_BRAND_NAME_MAP = {
|
|
|
102
102
|
'HeadlessChrome': 'Chrome Headless',
|
|
103
103
|
'OperaMobile': 'Opera Mobi',
|
|
104
104
|
};
|
|
105
|
+
var RTL_LANGUAGES = ['ae', 'ar', 'arc', 'bcc', 'bqi', 'ckb', 'dv', 'fa', 'glk', 'he', 'iw', 'ku', 'mzn', 'nqo', 'pnb', 'ps', 'sd', 'ug', 'ur', 'yi'];
|
|
105
106
|
var OS_RESOLVER_MAP = [
|
|
106
107
|
[/windows nt (6\.[23]); arm/i, OS.Windows, resolveWindowsVersion],
|
|
107
108
|
[/windows (?:phone|mobile|iot)(?: os)?[\/ ]?([\d.]*( se)?)/i, OS.Windows, resolveWindowsVersion],
|
|
@@ -373,6 +374,9 @@ var parsedFromHighEntropyValuesOS = {};
|
|
|
373
374
|
var parsedFromHighEntropyValuesBrowser = {};
|
|
374
375
|
var parsedFromHighEntropyValuesEngine = {};
|
|
375
376
|
var parsedFromHighEntropyValuesDevice = null;
|
|
377
|
+
var parsedFromNavigatorGPU = {};
|
|
378
|
+
var cachedLocale = null;
|
|
379
|
+
var ready;
|
|
376
380
|
function resolveVersion(string, resolver) {
|
|
377
381
|
if (typeof resolver === 'function')
|
|
378
382
|
return resolver(string);
|
|
@@ -389,6 +393,38 @@ function normalizeBrand(entry) {
|
|
|
389
393
|
return { brand: entry, version: '' };
|
|
390
394
|
return { brand: entry.brand, version: entry.version };
|
|
391
395
|
}
|
|
396
|
+
function normalizeLocale(locale) {
|
|
397
|
+
if (locale === null || typeof locale === 'undefined')
|
|
398
|
+
return locale;
|
|
399
|
+
if (locale.length === 0)
|
|
400
|
+
return null;
|
|
401
|
+
locale = locale.replace(/_/g, '-');
|
|
402
|
+
if (locale === 'C' || locale.toLowerCase() === 'posix')
|
|
403
|
+
return 'en-US';
|
|
404
|
+
if (locale.indexOf('.') !== -1)
|
|
405
|
+
return normalizeLocale(locale.split('.')[0]);
|
|
406
|
+
if (locale.indexOf('@') !== -1)
|
|
407
|
+
return normalizeLocale(locale.split('@')[0]);
|
|
408
|
+
var parts = locale.split('-');
|
|
409
|
+
if (parts.length === 0)
|
|
410
|
+
return null;
|
|
411
|
+
parts[0] = parts[0].toLowerCase();
|
|
412
|
+
if (parts.length > 1 && parts[1].length === 2)
|
|
413
|
+
parts[1] = parts[1].toUpperCase();
|
|
414
|
+
if (parts.length > 2 && parts[1].length === 4) {
|
|
415
|
+
parts[1] = parts[1].charAt(0).toUpperCase() + parts[1].slice(1).toLowerCase();
|
|
416
|
+
}
|
|
417
|
+
return parts.join('-');
|
|
418
|
+
}
|
|
419
|
+
function invalidateCache() {
|
|
420
|
+
parsedCache = null;
|
|
421
|
+
cachedLocale = null;
|
|
422
|
+
parsedFromHighEntropyValuesOS = {};
|
|
423
|
+
parsedFromHighEntropyValuesBrowser = {};
|
|
424
|
+
parsedFromHighEntropyValuesEngine = {};
|
|
425
|
+
parsedFromHighEntropyValuesDevice = null;
|
|
426
|
+
parsedFromNavigatorGPU = {};
|
|
427
|
+
}
|
|
392
428
|
function getParsedCache() {
|
|
393
429
|
if (parsedCache !== null && parsedCache.userAgent === currentUserAgent)
|
|
394
430
|
return parsedCache;
|
|
@@ -467,6 +503,120 @@ function parseEngine() {
|
|
|
467
503
|
}
|
|
468
504
|
return result;
|
|
469
505
|
}
|
|
506
|
+
function getGPU() {
|
|
507
|
+
return {
|
|
508
|
+
architecture: parsedFromNavigatorGPU.architecture,
|
|
509
|
+
description: parsedFromNavigatorGPU.description,
|
|
510
|
+
device: parsedFromNavigatorGPU.device,
|
|
511
|
+
vendor: parsedFromNavigatorGPU.vendor,
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
function getLocale() {
|
|
515
|
+
if (cachedLocale !== null)
|
|
516
|
+
return cachedLocale;
|
|
517
|
+
var locale = {
|
|
518
|
+
language: null,
|
|
519
|
+
languages: [],
|
|
520
|
+
timezone: null,
|
|
521
|
+
offset: 0,
|
|
522
|
+
isRTL: false,
|
|
523
|
+
};
|
|
524
|
+
var isRTL = null;
|
|
525
|
+
function addLanguages(language) {
|
|
526
|
+
for (var i = 0; i < language.length; i++)
|
|
527
|
+
addLanguage(language[i]);
|
|
528
|
+
}
|
|
529
|
+
function addLanguage(language) {
|
|
530
|
+
language = normalizeLocale(language);
|
|
531
|
+
if (typeof language === 'string' && locale.languages.indexOf(language) === -1) {
|
|
532
|
+
if (locale.language === null)
|
|
533
|
+
locale.language = language;
|
|
534
|
+
locale.languages.push(language);
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
if (typeof Intl !== 'undefined') {
|
|
538
|
+
try {
|
|
539
|
+
addLanguage(Intl.DateTimeFormat().resolvedOptions().locale);
|
|
540
|
+
}
|
|
541
|
+
catch (_) {
|
|
542
|
+
}
|
|
543
|
+
try {
|
|
544
|
+
locale.timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
545
|
+
}
|
|
546
|
+
catch (_) {
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
if (typeof globalThis.navigator !== 'undefined') {
|
|
550
|
+
if (typeof globalThis.navigator.languages !== 'undefined')
|
|
551
|
+
addLanguages(globalThis.navigator.languages);
|
|
552
|
+
if (typeof globalThis.navigator.language !== 'undefined')
|
|
553
|
+
addLanguage(globalThis.navigator.language);
|
|
554
|
+
if (typeof globalThis.navigator.userLanguage !== 'undefined')
|
|
555
|
+
addLanguage(globalThis.navigator.userLanguage);
|
|
556
|
+
if (typeof globalThis.navigator.browserLanguage !== 'undefined')
|
|
557
|
+
addLanguage(globalThis.navigator.browserLanguage);
|
|
558
|
+
if (typeof globalThis.navigator.systemLanguage !== 'undefined')
|
|
559
|
+
addLanguage(globalThis.navigator.systemLanguage);
|
|
560
|
+
}
|
|
561
|
+
try {
|
|
562
|
+
locale.offset = new Date().getTimezoneOffset() * -1;
|
|
563
|
+
}
|
|
564
|
+
catch (_) {
|
|
565
|
+
}
|
|
566
|
+
if (typeof locale.language === 'string') {
|
|
567
|
+
if (typeof Intl !== 'undefined' && typeof Intl.Locale !== 'undefined') {
|
|
568
|
+
try {
|
|
569
|
+
var intlLocale = new Intl.Locale(locale.language);
|
|
570
|
+
if (typeof intlLocale.getTextInfo === 'function')
|
|
571
|
+
isRTL = intlLocale.getTextInfo().direction === 'rtl';
|
|
572
|
+
else if (typeof intlLocale.textInfo !== 'undefined')
|
|
573
|
+
isRTL = intlLocale.textInfo.direction === 'rtl';
|
|
574
|
+
}
|
|
575
|
+
catch (_) {
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
if (typeof isRTL !== 'boolean') {
|
|
579
|
+
var matched = /^([A-Za-z]{1,8})(?:[-_][A-Za-z0-9]{1,8})*$/.exec(locale.language);
|
|
580
|
+
if (matched !== null) {
|
|
581
|
+
var language = matched[1].toLowerCase();
|
|
582
|
+
for (var i = 0; i < RTL_LANGUAGES.length; i++) {
|
|
583
|
+
if (RTL_LANGUAGES[i] === language) {
|
|
584
|
+
isRTL = true;
|
|
585
|
+
break;
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
if (typeof isRTL === 'boolean')
|
|
592
|
+
locale.isRTL = isRTL;
|
|
593
|
+
cachedLocale = locale;
|
|
594
|
+
return cachedLocale;
|
|
595
|
+
}
|
|
596
|
+
function getDevice() {
|
|
597
|
+
if (currentUserAgent === USER_AGENT && parsedFromHighEntropyValuesDevice !== null)
|
|
598
|
+
return parsedFromHighEntropyValuesDevice;
|
|
599
|
+
var osName = getParsedCache().os.name;
|
|
600
|
+
if (osName === OS.iOS || osName === OS.Android)
|
|
601
|
+
return Devices.Mobile;
|
|
602
|
+
if (osName === OS.Windows || osName === OS.MacOS)
|
|
603
|
+
return Devices.Desktop;
|
|
604
|
+
return Devices.Unknown;
|
|
605
|
+
}
|
|
606
|
+
function getIsWebview() {
|
|
607
|
+
return /; ?wv|applewebkit(?!.*safari)/i.test(currentUserAgent);
|
|
608
|
+
}
|
|
609
|
+
function getIsNode() {
|
|
610
|
+
return typeof globalThis.process !== 'undefined' && typeof globalThis.process.versions !== 'undefined' && typeof globalThis.process.versions.node !== 'undefined';
|
|
611
|
+
}
|
|
612
|
+
function getIsStandalone() {
|
|
613
|
+
var osName = getParsedCache().os.name;
|
|
614
|
+
if (osName === OS.iOS)
|
|
615
|
+
return globalThis.navigator.standalone === true;
|
|
616
|
+
if (typeof globalThis.matchMedia === 'undefined')
|
|
617
|
+
return false;
|
|
618
|
+
return globalThis.matchMedia('(display-mode: standalone)').matches;
|
|
619
|
+
}
|
|
470
620
|
function parseFromHighEntropyValues() {
|
|
471
621
|
if (typeof globalThis.navigator === 'undefined' || typeof globalThis.navigator.userAgentData === 'undefined' || typeof globalThis.navigator.userAgentData.getHighEntropyValues === 'undefined')
|
|
472
622
|
return Promise.resolve();
|
|
@@ -504,10 +654,15 @@ function parseFromHighEntropyValues() {
|
|
|
504
654
|
parsedFromHighEntropyValuesEngine.version = brandVersion;
|
|
505
655
|
}
|
|
506
656
|
if (typeof platformVersion === 'string') {
|
|
507
|
-
if (getParsedCache().os.name === OS.Windows)
|
|
508
|
-
|
|
509
|
-
|
|
657
|
+
if (getParsedCache().os.name === OS.Windows) {
|
|
658
|
+
if (parseInt(platformVersion.split('.')[0], 10) >= 13)
|
|
659
|
+
parsedFromHighEntropyValuesOS.version = '11';
|
|
660
|
+
else
|
|
661
|
+
parsedFromHighEntropyValuesOS.version = '10';
|
|
662
|
+
}
|
|
663
|
+
else {
|
|
510
664
|
parsedFromHighEntropyValuesOS.version = platformVersion;
|
|
665
|
+
}
|
|
511
666
|
}
|
|
512
667
|
if (typeof platform === 'string') {
|
|
513
668
|
if (/android/i.test(platform))
|
|
@@ -537,28 +692,80 @@ function parseFromNavigatorGPU() {
|
|
|
537
692
|
.then(function (adapter) {
|
|
538
693
|
if (adapter !== null) {
|
|
539
694
|
var info = adapter.info;
|
|
540
|
-
info.architecture;
|
|
541
|
-
info.description;
|
|
542
|
-
info.device;
|
|
543
|
-
info.vendor;
|
|
695
|
+
parsedFromNavigatorGPU.architecture = info.architecture;
|
|
696
|
+
parsedFromNavigatorGPU.description = info.description;
|
|
697
|
+
parsedFromNavigatorGPU.device = info.device;
|
|
698
|
+
parsedFromNavigatorGPU.vendor = info.vendor;
|
|
544
699
|
}
|
|
545
700
|
})
|
|
546
701
|
.catch(function () {
|
|
547
702
|
});
|
|
548
703
|
}
|
|
549
|
-
Promise.all([
|
|
704
|
+
ready = Promise.all([
|
|
550
705
|
parseFromHighEntropyValues(),
|
|
551
706
|
parseFromNavigatorGPU(),
|
|
552
707
|
]).then(function () {
|
|
553
708
|
});
|
|
554
709
|
EventListener.add(globalThis, {
|
|
555
710
|
type: 'languagechange', callback: function () {
|
|
711
|
+
cachedLocale = null;
|
|
556
712
|
}
|
|
557
713
|
});
|
|
558
714
|
var Platform = {
|
|
715
|
+
get ready() {
|
|
716
|
+
return ready;
|
|
717
|
+
},
|
|
559
718
|
get os() {
|
|
560
719
|
return getParsedCache().os;
|
|
561
|
-
}
|
|
720
|
+
},
|
|
721
|
+
get engine() {
|
|
722
|
+
return getParsedCache().engine;
|
|
723
|
+
},
|
|
724
|
+
get browser() {
|
|
725
|
+
return getParsedCache().browser;
|
|
726
|
+
},
|
|
727
|
+
get userAgent() {
|
|
728
|
+
return currentUserAgent;
|
|
729
|
+
},
|
|
730
|
+
set userAgent(value) {
|
|
731
|
+
if (currentUserAgent === value)
|
|
732
|
+
return;
|
|
733
|
+
currentUserAgent = value;
|
|
734
|
+
invalidateCache();
|
|
735
|
+
if (value === USER_AGENT) {
|
|
736
|
+
ready = Promise.all([
|
|
737
|
+
parseFromHighEntropyValues(),
|
|
738
|
+
parseFromNavigatorGPU(),
|
|
739
|
+
]).then(function () {
|
|
740
|
+
});
|
|
741
|
+
}
|
|
742
|
+
},
|
|
743
|
+
get locale() {
|
|
744
|
+
return getLocale();
|
|
745
|
+
},
|
|
746
|
+
get device() {
|
|
747
|
+
return getDevice();
|
|
748
|
+
},
|
|
749
|
+
get gpu() {
|
|
750
|
+
return getGPU();
|
|
751
|
+
},
|
|
752
|
+
get isWebview() {
|
|
753
|
+
return getIsWebview();
|
|
754
|
+
},
|
|
755
|
+
get isNode() {
|
|
756
|
+
return getIsNode();
|
|
757
|
+
},
|
|
758
|
+
get isStandalone() {
|
|
759
|
+
return getIsStandalone();
|
|
760
|
+
},
|
|
761
|
+
Constants: {
|
|
762
|
+
OS: OS,
|
|
763
|
+
Engines: Engines,
|
|
764
|
+
Browsers: Browsers,
|
|
765
|
+
Devices: Devices,
|
|
766
|
+
},
|
|
767
|
+
Errors: {},
|
|
768
|
+
};
|
|
562
769
|
|
|
563
770
|
function createSubscriptionManager(attach, detach) {
|
|
564
771
|
var entries = [];
|
|
@@ -702,7 +909,20 @@ function createCustomError(name, Base) {
|
|
|
702
909
|
|
|
703
910
|
var NotSupportedError = createCustomError('NotSupportedError');
|
|
704
911
|
|
|
705
|
-
var
|
|
912
|
+
var InvalidStateError = createCustomError('InvalidStateError');
|
|
913
|
+
|
|
914
|
+
var videoElement = null;
|
|
915
|
+
var lastFallbackVideoElement = null;
|
|
916
|
+
var eventsBridged = false;
|
|
917
|
+
var FS_BRIDGE_KEY = (function () {
|
|
918
|
+
if (typeof Symbol === 'function') {
|
|
919
|
+
var existing = globalThis.__nativeFnFsBridgeKey__;
|
|
920
|
+
if (typeof existing === 'symbol')
|
|
921
|
+
return existing;
|
|
922
|
+
return globalThis.__nativeFnFsBridgeKey__ = Symbol('native.fn.fs.bridged');
|
|
923
|
+
}
|
|
924
|
+
return '__nativeFnFsBridged__';
|
|
925
|
+
}());
|
|
706
926
|
var API_VARIANTS = {
|
|
707
927
|
standard: {
|
|
708
928
|
enabled: 'fullscreenEnabled',
|
|
@@ -734,6 +954,40 @@ var API_VARIANTS = {
|
|
|
734
954
|
},
|
|
735
955
|
};
|
|
736
956
|
var api = detectApi();
|
|
957
|
+
var onChangeSubscriptionManager = createSubscriptionManager(attachOnChange, detachOnChange);
|
|
958
|
+
var onErrorSubscriptionManager = createSubscriptionManager(attachOnError, detachOnError);
|
|
959
|
+
var Fullscreen = {
|
|
960
|
+
get supported() {
|
|
961
|
+
return getSupported();
|
|
962
|
+
},
|
|
963
|
+
get element() {
|
|
964
|
+
return getElement();
|
|
965
|
+
},
|
|
966
|
+
get isActive() {
|
|
967
|
+
return getIsActive();
|
|
968
|
+
},
|
|
969
|
+
request: request,
|
|
970
|
+
exit: exit,
|
|
971
|
+
toggle: toggle,
|
|
972
|
+
onChange: onChange,
|
|
973
|
+
onError: onError,
|
|
974
|
+
Constants: {},
|
|
975
|
+
Errors: {
|
|
976
|
+
NotSupportedError: NotSupportedError,
|
|
977
|
+
InvalidStateError: InvalidStateError,
|
|
978
|
+
},
|
|
979
|
+
};
|
|
980
|
+
function getHTMLVideoElement() {
|
|
981
|
+
var selected = globalThis.document.querySelector('video');
|
|
982
|
+
if (selected !== null)
|
|
983
|
+
return selected;
|
|
984
|
+
if (videoElement === null)
|
|
985
|
+
return videoElement = globalThis.document.createElement('video');
|
|
986
|
+
return videoElement;
|
|
987
|
+
}
|
|
988
|
+
function hasStandardApi() {
|
|
989
|
+
return api !== null;
|
|
990
|
+
}
|
|
737
991
|
function detectApi() {
|
|
738
992
|
var element = globalThis.document.documentElement;
|
|
739
993
|
if (typeof globalThis.document.fullscreenEnabled !== 'undefined' || typeof globalThis.document.exitFullscreen !== 'undefined')
|
|
@@ -750,286 +1004,305 @@ function detectApi() {
|
|
|
750
1004
|
}
|
|
751
1005
|
return null;
|
|
752
1006
|
}
|
|
753
|
-
function
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
var pendingQueue = [];
|
|
758
|
-
var lastIntendedOperation = 'exit';
|
|
759
|
-
var onChangeSubscriptionManager = createSubscriptionManager(attachOnChange, detachOnChange);
|
|
760
|
-
var onErrorSubscriptionManager = createSubscriptionManager(attachOnError, detachOnError);
|
|
761
|
-
function getDefaultTarget() {
|
|
762
|
-
if (Platform.os.name === OS.iOS) {
|
|
763
|
-
var video = globalThis.document.querySelector('video');
|
|
764
|
-
if (video === null)
|
|
765
|
-
return undefined;
|
|
1007
|
+
function getDefaultTarget() {
|
|
1008
|
+
if (Platform.os.name === OS.iOS) {
|
|
1009
|
+
var video = globalThis.document.querySelector('video');
|
|
1010
|
+
if (video !== null)
|
|
766
1011
|
return video;
|
|
767
|
-
|
|
768
|
-
return globalThis.document.documentElement;
|
|
769
|
-
}
|
|
770
|
-
function bridgeEvents() {
|
|
771
|
-
if (eventsBridged)
|
|
772
|
-
return;
|
|
773
|
-
eventsBridged = true;
|
|
774
|
-
if (Platform.os.name === OS.iOS) {
|
|
775
|
-
bridgeIOSVideoEvents();
|
|
776
|
-
if (typeof globalThis.MutationObserver !== 'undefined') {
|
|
777
|
-
var observer = new MutationObserver(function () {
|
|
778
|
-
bridgeIOSVideoEvents();
|
|
779
|
-
});
|
|
780
|
-
observer.observe(globalThis.document.documentElement, {
|
|
781
|
-
childList: true,
|
|
782
|
-
subtree: true,
|
|
783
|
-
});
|
|
784
|
-
}
|
|
785
|
-
}
|
|
1012
|
+
return undefined;
|
|
786
1013
|
}
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
videos.forEach(function (video) {
|
|
792
|
-
if (video[FS_BRIDGED_KEY] === true || !(typeof video.webkitEnterFullscreen !== 'undefined' || typeof video.onwebkitbeginfullscreen !== 'undefined'))
|
|
793
|
-
return;
|
|
794
|
-
EventListener.add(video, {
|
|
795
|
-
type: 'webkitbeginfullscreen',
|
|
796
|
-
callback: onChangeSubscriptionManager.emit,
|
|
797
|
-
options: false,
|
|
798
|
-
});
|
|
799
|
-
EventListener.add(video, {
|
|
800
|
-
type: 'webkitendfullscreen',
|
|
801
|
-
callback: onChangeSubscriptionManager.emit,
|
|
802
|
-
options: false,
|
|
803
|
-
});
|
|
804
|
-
video[FS_BRIDGED_KEY] = true;
|
|
805
|
-
});
|
|
806
|
-
}
|
|
807
|
-
function attachOnChange() {
|
|
808
|
-
var events = ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange', 'MSFullscreenChange'];
|
|
809
|
-
for (var i = 0; i < events.length; i++) {
|
|
810
|
-
EventListener.add(globalThis.document, {
|
|
811
|
-
type: events[i],
|
|
812
|
-
callback: onChangeSubscriptionManager.emit,
|
|
813
|
-
options: false,
|
|
814
|
-
});
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
function detachOnChange() {
|
|
818
|
-
var events = ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange', 'MSFullscreenChange'];
|
|
819
|
-
for (var i = 0; i < events.length; i++) {
|
|
820
|
-
EventListener.remove(globalThis.document, {
|
|
821
|
-
type: events[i],
|
|
822
|
-
callback: onChangeSubscriptionManager.emit,
|
|
823
|
-
options: false,
|
|
824
|
-
});
|
|
825
|
-
}
|
|
826
|
-
}
|
|
827
|
-
function attachOnError() {
|
|
828
|
-
var events = ['fullscreenerror', 'webkitfullscreenerror', 'mozfullscreenerror', 'MSFullscreenError'];
|
|
829
|
-
for (var i = 0; i < events.length; i++) {
|
|
830
|
-
EventListener.add(globalThis.document, {
|
|
831
|
-
type: events[i],
|
|
832
|
-
callback: onErrorSubscriptionManager.emit,
|
|
833
|
-
options: false,
|
|
834
|
-
});
|
|
835
|
-
}
|
|
836
|
-
}
|
|
837
|
-
function detachOnError() {
|
|
838
|
-
var events = ['fullscreenerror', 'webkitfullscreenerror', 'mozfullscreenerror', 'MSFullscreenError'];
|
|
839
|
-
for (var i = 0; i < events.length; i++) {
|
|
840
|
-
EventListener.remove(globalThis.document, {
|
|
841
|
-
type: events[i],
|
|
842
|
-
callback: onErrorSubscriptionManager.emit,
|
|
843
|
-
options: false,
|
|
844
|
-
});
|
|
845
|
-
}
|
|
846
|
-
}
|
|
847
|
-
function getEnabled() {
|
|
848
|
-
if (api === null)
|
|
849
|
-
return (Platform.os.name === OS.iOS && globalThis.HTMLVideoElement.prototype.webkitSupportsFullscreen === true);
|
|
1014
|
+
return globalThis.document.documentElement;
|
|
1015
|
+
}
|
|
1016
|
+
function getSupported() {
|
|
1017
|
+
if (api !== null)
|
|
850
1018
|
return globalThis.document[api.enabled] === true;
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
return currentElement;
|
|
1019
|
+
if (Platform.os.name !== OS.iOS)
|
|
1020
|
+
return false;
|
|
1021
|
+
var video = getHTMLVideoElement();
|
|
1022
|
+
return video.webkitSupportsFullscreen === true || typeof video.webkitEnterFullscreen === 'function';
|
|
1023
|
+
}
|
|
1024
|
+
function getElement() {
|
|
1025
|
+
if (api === null) {
|
|
1026
|
+
if (lastFallbackVideoElement !== null && lastFallbackVideoElement.webkitDisplayingFullscreen === true)
|
|
1027
|
+
return lastFallbackVideoElement;
|
|
861
1028
|
return null;
|
|
862
1029
|
}
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
return
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
1030
|
+
var currentElement = globalThis.document[api.element];
|
|
1031
|
+
if (typeof currentElement !== 'undefined')
|
|
1032
|
+
return currentElement;
|
|
1033
|
+
return null;
|
|
1034
|
+
}
|
|
1035
|
+
function getIsActive() {
|
|
1036
|
+
return getElement() !== null;
|
|
1037
|
+
}
|
|
1038
|
+
function createEventPayload(nativeEvent, element, isActive) {
|
|
1039
|
+
return {
|
|
1040
|
+
nativeEvent: nativeEvent,
|
|
1041
|
+
element: element,
|
|
1042
|
+
isActive: isActive,
|
|
1043
|
+
};
|
|
1044
|
+
}
|
|
1045
|
+
function emitChange(nativeEvent, element, isActive) {
|
|
1046
|
+
onChangeSubscriptionManager.emit(createEventPayload(nativeEvent, element, isActive));
|
|
1047
|
+
}
|
|
1048
|
+
function emitError(nativeEvent, element, isActive) {
|
|
1049
|
+
onErrorSubscriptionManager.emit(createEventPayload(nativeEvent, element, isActive));
|
|
1050
|
+
}
|
|
1051
|
+
function onFullscreenChange(event) {
|
|
1052
|
+
var target = event.target;
|
|
1053
|
+
if (target instanceof globalThis.Element)
|
|
1054
|
+
emitChange(event, target, getIsActive());
|
|
1055
|
+
if (target instanceof globalThis.Document)
|
|
1056
|
+
emitChange(event, globalThis.document.documentElement, getIsActive());
|
|
1057
|
+
}
|
|
1058
|
+
function onFullscreenError(event) {
|
|
1059
|
+
var target = event.target;
|
|
1060
|
+
if (target instanceof globalThis.Element)
|
|
1061
|
+
emitError(event, target, getIsActive());
|
|
1062
|
+
if (target instanceof globalThis.Document)
|
|
1063
|
+
emitError(event, globalThis.document.documentElement, getIsActive());
|
|
1064
|
+
}
|
|
1065
|
+
function onIOSBeginFullscreen(event) {
|
|
1066
|
+
lastFallbackVideoElement = this;
|
|
1067
|
+
emitChange(event, this, true);
|
|
1068
|
+
}
|
|
1069
|
+
function onIOSEndFullscreen(event) {
|
|
1070
|
+
if (lastFallbackVideoElement === this)
|
|
1071
|
+
lastFallbackVideoElement = null;
|
|
1072
|
+
emitChange(event, this, false);
|
|
1073
|
+
}
|
|
1074
|
+
function bridgeSingleVideoNode(video) {
|
|
1075
|
+
if (video[FS_BRIDGE_KEY])
|
|
1076
|
+
return;
|
|
1077
|
+
if (typeof video.webkitEnterFullscreen === 'undefined' && typeof video.onwebkitbeginfullscreen === 'undefined')
|
|
1078
|
+
return;
|
|
1079
|
+
EventListener.add(video, { type: 'webkitbeginfullscreen', callback: onIOSBeginFullscreen, options: false });
|
|
1080
|
+
EventListener.add(video, { type: 'webkitendfullscreen', callback: onIOSEndFullscreen, options: false });
|
|
1081
|
+
video[FS_BRIDGE_KEY] = true;
|
|
1082
|
+
}
|
|
1083
|
+
function bridgeIOSVideoEvents() {
|
|
1084
|
+
var videos = globalThis.document.querySelectorAll('video');
|
|
1085
|
+
for (var i = 0; i < videos.length; i++)
|
|
1086
|
+
bridgeSingleVideoNode(videos[i]);
|
|
1087
|
+
}
|
|
1088
|
+
function bridgeEvents() {
|
|
1089
|
+
if (eventsBridged)
|
|
1090
|
+
return;
|
|
1091
|
+
eventsBridged = true;
|
|
1092
|
+
if (Platform.os.name !== OS.iOS)
|
|
1093
|
+
return;
|
|
1094
|
+
bridgeIOSVideoEvents();
|
|
1095
|
+
if (typeof globalThis.MutationObserver === 'undefined')
|
|
1096
|
+
return;
|
|
1097
|
+
var observer = new globalThis.MutationObserver(function (records) {
|
|
1098
|
+
if (lastFallbackVideoElement !== null) {
|
|
1099
|
+
var removed = false;
|
|
1100
|
+
for (var i = 0; i < records.length; i++) {
|
|
1101
|
+
var removedNodes = records[i].removedNodes;
|
|
1102
|
+
for (var j = 0; j < removedNodes.length; j++) {
|
|
1103
|
+
var node = removedNodes[j];
|
|
1104
|
+
if (node === lastFallbackVideoElement || (node.nodeType === Node.ELEMENT_NODE && node.contains(lastFallbackVideoElement))) {
|
|
1105
|
+
removed = true;
|
|
1106
|
+
break;
|
|
940
1107
|
}
|
|
941
1108
|
}
|
|
942
|
-
|
|
1109
|
+
if (removed)
|
|
1110
|
+
break;
|
|
943
1111
|
}
|
|
944
|
-
if (
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
1112
|
+
if (removed && !globalThis.document.contains(lastFallbackVideoElement))
|
|
1113
|
+
lastFallbackVideoElement = null;
|
|
1114
|
+
}
|
|
1115
|
+
for (var i = 0; i < records.length; i++) {
|
|
1116
|
+
var addedNodes = records[i].addedNodes;
|
|
1117
|
+
for (var j = 0; j < addedNodes.length; j++) {
|
|
1118
|
+
var node = addedNodes[j];
|
|
1119
|
+
if (node.nodeType !== Node.ELEMENT_NODE)
|
|
1120
|
+
continue;
|
|
1121
|
+
var element = node;
|
|
1122
|
+
if (element.tagName === 'VIDEO') {
|
|
1123
|
+
bridgeSingleVideoNode(element);
|
|
1124
|
+
continue;
|
|
1125
|
+
}
|
|
1126
|
+
var nested = element.querySelectorAll('video');
|
|
1127
|
+
for (var k = 0; k < nested.length; k++)
|
|
1128
|
+
bridgeSingleVideoNode(nested[k]);
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
});
|
|
1132
|
+
observer.observe(globalThis.document.documentElement, { childList: true, subtree: true });
|
|
1133
|
+
}
|
|
1134
|
+
function attachOnChange() {
|
|
1135
|
+
if (api != null)
|
|
1136
|
+
EventListener.add(globalThis.document, { type: api.events.change, callback: onFullscreenChange, options: false });
|
|
1137
|
+
if (Platform.os.name === OS.iOS)
|
|
1138
|
+
bridgeIOSVideoEvents();
|
|
1139
|
+
}
|
|
1140
|
+
function detachOnChange() {
|
|
1141
|
+
if (api != null)
|
|
1142
|
+
EventListener.remove(globalThis.document, { type: api.events.change, callback: onFullscreenChange, options: false });
|
|
1143
|
+
if (Platform.os.name !== OS.iOS)
|
|
1144
|
+
return;
|
|
1145
|
+
var videos = globalThis.document.querySelectorAll('video');
|
|
1146
|
+
for (var i = 0; i < videos.length; i++) {
|
|
1147
|
+
EventListener.remove(videos[i], { type: 'webkitbeginfullscreen', callback: onIOSBeginFullscreen, options: false });
|
|
1148
|
+
EventListener.remove(videos[i], { type: 'webkitendfullscreen', callback: onIOSEndFullscreen, options: false });
|
|
1149
|
+
videos[i][FS_BRIDGE_KEY] = false;
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
function attachOnError() {
|
|
1153
|
+
if (api != null)
|
|
1154
|
+
EventListener.add(globalThis.document, { type: api.events.error, callback: onFullscreenError, options: false });
|
|
1155
|
+
}
|
|
1156
|
+
function detachOnError() {
|
|
1157
|
+
if (api != null)
|
|
1158
|
+
EventListener.remove(globalThis.document, { type: api.events.error, callback: onFullscreenError, options: false });
|
|
1159
|
+
}
|
|
1160
|
+
function request(target, options) {
|
|
1161
|
+
return new Promise(function (resolve, reject) {
|
|
1162
|
+
if (typeof target === 'undefined')
|
|
1163
|
+
target = getDefaultTarget();
|
|
1164
|
+
if (typeof target === 'undefined')
|
|
1165
|
+
return reject(new NotSupportedError('Failed to enter fullscreen mode.'));
|
|
1166
|
+
if (getIsActive() && getElement() !== target && Platform.browser.name === Browsers.Safari && Platform.os.name === OS.iOS)
|
|
1167
|
+
return reject(new NotSupportedError('There is already a Fullscreen element in this document.'));
|
|
1168
|
+
var tagName = target.tagName.toLowerCase();
|
|
1169
|
+
var isIOSFullscreenActive = lastFallbackVideoElement !== null && lastFallbackVideoElement.webkitDisplayingFullscreen === true;
|
|
1170
|
+
if (api !== null) {
|
|
1171
|
+
var method = target[api.request];
|
|
1172
|
+
if (typeof method === 'function' && !isIOSFullscreenActive) {
|
|
1173
|
+
var result = method.call(target, options);
|
|
1174
|
+
if (typeof result !== 'undefined' && typeof result.then === 'function') {
|
|
1175
|
+
result
|
|
1176
|
+
.then(resolve)
|
|
1177
|
+
.catch(function () {
|
|
1178
|
+
try {
|
|
952
1179
|
if (Platform.os.name !== OS.iOS)
|
|
953
1180
|
return reject(new NotSupportedError('The "' + tagName + '" element does not support fullscreen requests.'));
|
|
954
1181
|
fallbackToIOSVideo();
|
|
1182
|
+
}
|
|
1183
|
+
catch (e) {
|
|
1184
|
+
reject(new NotSupportedError('The "' + tagName + '" element does not support fullscreen requests.'));
|
|
1185
|
+
}
|
|
1186
|
+
});
|
|
1187
|
+
return;
|
|
1188
|
+
}
|
|
1189
|
+
return resolve();
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
function fallbackToIOSVideo() {
|
|
1193
|
+
if (Platform.os.name === OS.iOS && typeof target !== 'undefined' && target.tagName.toUpperCase() === 'VIDEO') {
|
|
1194
|
+
var video_1 = target;
|
|
1195
|
+
if (video_1.webkitSupportsFullscreen && typeof video_1.webkitEnterFullscreen === 'function') {
|
|
1196
|
+
if (!hasStandardApi())
|
|
1197
|
+
bridgeSingleVideoNode(video_1);
|
|
1198
|
+
if (video_1.played.length === 0) {
|
|
1199
|
+
video_1.play()
|
|
1200
|
+
.then(function () {
|
|
1201
|
+
try {
|
|
1202
|
+
if (video_1.webkitSupportsFullscreen && typeof video_1.webkitEnterFullscreen === 'function')
|
|
1203
|
+
video_1.webkitEnterFullscreen();
|
|
1204
|
+
}
|
|
1205
|
+
catch (e) {
|
|
1206
|
+
return reject(new InvalidStateError('The object is in an invalid state.'));
|
|
1207
|
+
}
|
|
955
1208
|
});
|
|
956
|
-
return;
|
|
957
1209
|
}
|
|
1210
|
+
else {
|
|
1211
|
+
try {
|
|
1212
|
+
video_1.webkitEnterFullscreen();
|
|
1213
|
+
}
|
|
1214
|
+
catch (e) {
|
|
1215
|
+
return reject(new InvalidStateError('The object is in an invalid state.'));
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
lastFallbackVideoElement = video_1;
|
|
958
1219
|
return resolve();
|
|
959
1220
|
}
|
|
960
1221
|
}
|
|
961
|
-
|
|
962
|
-
}
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
if (typeof video.webkitExitFullscreen === 'function' && video.webkitDisplayingFullscreen === true) {
|
|
978
|
-
video.webkitExitFullscreen();
|
|
979
|
-
lastIOSVideo = null;
|
|
980
|
-
return resolve();
|
|
981
|
-
}
|
|
982
|
-
}
|
|
1222
|
+
reject(new NotSupportedError('The "' + tagName + '" element does not support fullscreen requests.'));
|
|
1223
|
+
}
|
|
1224
|
+
fallbackToIOSVideo();
|
|
1225
|
+
});
|
|
1226
|
+
}
|
|
1227
|
+
function exit() {
|
|
1228
|
+
return new Promise(function (resolve, reject) {
|
|
1229
|
+
if (api !== null) {
|
|
1230
|
+
var method = globalThis.document[api.exit];
|
|
1231
|
+
if (typeof method === 'function') {
|
|
1232
|
+
var result = method.call(globalThis.document);
|
|
1233
|
+
if (typeof result !== 'undefined' && typeof result.then === 'function') {
|
|
1234
|
+
result
|
|
1235
|
+
.then(resolve)
|
|
1236
|
+
.catch(resolve);
|
|
1237
|
+
return;
|
|
983
1238
|
}
|
|
1239
|
+
return resolve();
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
function fallbackToIOSVideo() {
|
|
1243
|
+
if (Platform.os.name !== OS.iOS) {
|
|
984
1244
|
reject(new NotSupportedError('Failed to exit fullscreen mode.'));
|
|
1245
|
+
return;
|
|
985
1246
|
}
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1247
|
+
var target = lastFallbackVideoElement;
|
|
1248
|
+
if (target !== null && typeof target.webkitExitFullscreen === 'function' && target.webkitDisplayingFullscreen === true) {
|
|
1249
|
+
target.webkitExitFullscreen();
|
|
1250
|
+
if (target.webkitDisplayingFullscreen)
|
|
1251
|
+
return reject(new NotSupportedError('Failed to exit fullscreen mode.'));
|
|
1252
|
+
lastFallbackVideoElement = null;
|
|
1253
|
+
return resolve();
|
|
1254
|
+
}
|
|
1255
|
+
var videos = globalThis.document.querySelectorAll('video');
|
|
1256
|
+
for (var i = 0; i < videos.length; i++) {
|
|
1257
|
+
var video = videos[i];
|
|
1258
|
+
if (typeof video.webkitExitFullscreen === 'function' && video.webkitDisplayingFullscreen === true) {
|
|
1259
|
+
video.webkitExitFullscreen();
|
|
1260
|
+
if (video.webkitDisplayingFullscreen)
|
|
1261
|
+
return reject(new NotSupportedError('Failed to exit fullscreen mode.'));
|
|
1262
|
+
lastFallbackVideoElement = null;
|
|
1000
1263
|
return resolve();
|
|
1001
1264
|
}
|
|
1002
1265
|
}
|
|
1003
|
-
|
|
1004
|
-
|
|
1266
|
+
if (getElement() === null)
|
|
1267
|
+
return resolve();
|
|
1268
|
+
reject(new NotSupportedError('Failed to exit fullscreen mode.'));
|
|
1269
|
+
}
|
|
1270
|
+
fallbackToIOSVideo();
|
|
1271
|
+
});
|
|
1272
|
+
}
|
|
1273
|
+
function toggle(target, options) {
|
|
1274
|
+
var current = getElement();
|
|
1275
|
+
if (typeof target !== 'undefined') {
|
|
1276
|
+
if (current === target)
|
|
1277
|
+
return this.exit();
|
|
1278
|
+
return this.request(target, options);
|
|
1005
1279
|
}
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1280
|
+
if (current !== null)
|
|
1281
|
+
return this.exit();
|
|
1282
|
+
return this.request(undefined, options);
|
|
1283
|
+
}
|
|
1284
|
+
function onChange(targetOrListener, listenerOrOptions, options) {
|
|
1285
|
+
if (typeof targetOrListener === 'function')
|
|
1286
|
+
return onChangeSubscriptionManager.subscribe(targetOrListener, listenerOrOptions);
|
|
1287
|
+
var target = targetOrListener;
|
|
1288
|
+
var listener = listenerOrOptions;
|
|
1289
|
+
function wrappedListener(payload) {
|
|
1290
|
+
if (payload.element === target)
|
|
1291
|
+
listener(payload);
|
|
1010
1292
|
}
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
exit: exit,
|
|
1024
|
-
toggle: toggle,
|
|
1025
|
-
onChange: onChangeSubscriptionManager.subscribe,
|
|
1026
|
-
onError: onErrorSubscriptionManager.subscribe,
|
|
1027
|
-
Constants: {},
|
|
1028
|
-
Errors: {
|
|
1029
|
-
NotSupportedError: NotSupportedError,
|
|
1030
|
-
},
|
|
1031
|
-
};
|
|
1293
|
+
return onChangeSubscriptionManager.subscribe(wrappedListener, options);
|
|
1294
|
+
}
|
|
1295
|
+
function onError(targetOrListener, listenerOrOptions, options) {
|
|
1296
|
+
if (typeof targetOrListener === 'function')
|
|
1297
|
+
return onErrorSubscriptionManager.subscribe(targetOrListener, listenerOrOptions);
|
|
1298
|
+
var target = targetOrListener;
|
|
1299
|
+
var listener = listenerOrOptions;
|
|
1300
|
+
function wrappedListener(payload) {
|
|
1301
|
+
if (payload.element === target)
|
|
1302
|
+
listener(payload);
|
|
1303
|
+
}
|
|
1304
|
+
return onErrorSubscriptionManager.subscribe(wrappedListener, options);
|
|
1032
1305
|
}
|
|
1033
|
-
|
|
1306
|
+
bridgeEvents();
|
|
1034
1307
|
|
|
1035
1308
|
module.exports = Fullscreen;
|