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