native-fn 1.0.77 → 1.0.78
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/dist/native.cjs +1 -1
- package/dist/native.min.cjs +1 -1
- package/dist/native.min.mjs +1 -1
- package/dist/native.mjs +1 -1
- package/dist/native.umd.js +1 -1
- package/dist/native.umd.min.js +1 -1
- package/dist/plugin/app/index.cjs +95 -51
- package/dist/plugin/app/index.min.cjs +1 -1
- package/dist/plugin/app/index.min.mjs +1 -1
- package/dist/plugin/app/index.mjs +95 -51
- package/dist/plugin/app/index.umd.js +95 -51
- package/dist/plugin/app/index.umd.min.js +1 -1
- package/dist/plugin/app/src/plugin/platform/types/platform.d.ts +2 -0
- package/dist/plugin/appearance/index.cjs +95 -51
- package/dist/plugin/appearance/index.min.cjs +1 -1
- package/dist/plugin/appearance/index.min.mjs +1 -1
- package/dist/plugin/appearance/index.mjs +95 -51
- package/dist/plugin/appearance/index.umd.js +95 -51
- package/dist/plugin/appearance/index.umd.min.js +1 -1
- package/dist/plugin/appearance/src/plugin/platform/types/platform.d.ts +2 -0
- package/dist/plugin/clipboard/index.cjs +95 -51
- package/dist/plugin/clipboard/index.min.cjs +1 -1
- package/dist/plugin/clipboard/index.min.mjs +1 -1
- package/dist/plugin/clipboard/index.mjs +95 -51
- package/dist/plugin/clipboard/index.umd.js +95 -51
- package/dist/plugin/clipboard/index.umd.min.js +1 -1
- package/dist/plugin/clipboard/src/plugin/platform/types/platform.d.ts +2 -0
- package/dist/plugin/fullscreen/index.cjs +95 -51
- package/dist/plugin/fullscreen/index.min.cjs +1 -1
- package/dist/plugin/fullscreen/index.min.mjs +1 -1
- package/dist/plugin/fullscreen/index.mjs +95 -51
- package/dist/plugin/fullscreen/index.umd.js +95 -51
- package/dist/plugin/fullscreen/index.umd.min.js +1 -1
- package/dist/plugin/fullscreen/src/plugin/platform/types/platform.d.ts +2 -0
- package/dist/plugin/platform/index.cjs +95 -51
- package/dist/plugin/platform/index.d.ts +2 -0
- package/dist/plugin/platform/index.min.cjs +1 -1
- package/dist/plugin/platform/index.min.mjs +1 -1
- package/dist/plugin/platform/index.mjs +95 -51
- package/dist/plugin/platform/index.umd.js +95 -51
- package/dist/plugin/platform/index.umd.min.js +1 -1
- package/dist/plugin/platform/src/plugin/platform/types/platform.d.ts +2 -0
- package/dist/plugin/theme/index.cjs +95 -51
- package/dist/plugin/theme/index.min.cjs +1 -1
- package/dist/plugin/theme/index.min.mjs +1 -1
- package/dist/plugin/theme/index.mjs +95 -51
- package/dist/plugin/theme/index.umd.js +95 -51
- package/dist/plugin/theme/index.umd.min.js +1 -1
- package/dist/plugin/theme/src/plugin/platform/types/platform.d.ts +2 -0
- package/dist/src/plugin/platform/types/platform.d.ts +2 -0
- package/package.json +1 -1
|
@@ -284,12 +284,18 @@
|
|
|
284
284
|
})(CrossPlatformFramework || (CrossPlatformFramework = {}));
|
|
285
285
|
var USER_AGENT = typeof globalThis.navigator !== 'undefined' && typeof globalThis.navigator.userAgent === 'string' ? globalThis.navigator.userAgent : '';
|
|
286
286
|
|
|
287
|
+
var readyState = 'loading';
|
|
288
|
+
var readyCallback = [];
|
|
289
|
+
var pendingTasks = 0;
|
|
287
290
|
var Platform = {
|
|
288
291
|
os: { name: OS.Unknown, version: '' },
|
|
289
292
|
engine: { name: Engines.Unknown, version: '' },
|
|
290
293
|
browser: { name: Browsers.Unknown, version: '' },
|
|
291
294
|
crossPlatformFramework: CrossPlatformFramework.Unknown,
|
|
292
295
|
userAgent: USER_AGENT,
|
|
296
|
+
get readyState() {
|
|
297
|
+
return readyState;
|
|
298
|
+
},
|
|
293
299
|
get network() {
|
|
294
300
|
return getNetwork();
|
|
295
301
|
},
|
|
@@ -322,6 +328,18 @@
|
|
|
322
328
|
return false;
|
|
323
329
|
return globalThis.matchMedia('(display-mode: standalone)').matches;
|
|
324
330
|
},
|
|
331
|
+
onready: function (callback) {
|
|
332
|
+
if (this.readyState === 'complete') {
|
|
333
|
+
try {
|
|
334
|
+
callback(this);
|
|
335
|
+
}
|
|
336
|
+
catch (_) {
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
else {
|
|
340
|
+
readyCallback.push(callback);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
325
343
|
};
|
|
326
344
|
var OS_RESOLVER_MAP = [
|
|
327
345
|
[/windows nt (6\.[23]); arm/i, OS.Windows, resolveWindowsVersion],
|
|
@@ -389,6 +407,26 @@
|
|
|
389
407
|
'HeadlessChrome': 'Chrome Headless',
|
|
390
408
|
'OperaMobile': 'Opera Mobi',
|
|
391
409
|
};
|
|
410
|
+
function incrementPendingTasks() {
|
|
411
|
+
pendingTasks++;
|
|
412
|
+
}
|
|
413
|
+
function decrementPendingTasks() {
|
|
414
|
+
pendingTasks--;
|
|
415
|
+
checkReady();
|
|
416
|
+
}
|
|
417
|
+
function checkReady() {
|
|
418
|
+
if (pendingTasks === 0 && readyState === 'loading') {
|
|
419
|
+
readyState = 'complete';
|
|
420
|
+
for (var i = 0; i < readyCallback.length; i++) {
|
|
421
|
+
try {
|
|
422
|
+
readyCallback[i](Platform);
|
|
423
|
+
}
|
|
424
|
+
catch (_) {
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
readyCallback.length = 0;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
392
430
|
function resolveWindowsVersion(string) {
|
|
393
431
|
if (string === undefined)
|
|
394
432
|
return '';
|
|
@@ -589,6 +627,7 @@
|
|
|
589
627
|
break;
|
|
590
628
|
}
|
|
591
629
|
}
|
|
630
|
+
decrementPendingTasks();
|
|
592
631
|
}
|
|
593
632
|
function getRenderer() {
|
|
594
633
|
if (typeof globalThis.document === 'undefined')
|
|
@@ -698,9 +737,6 @@
|
|
|
698
737
|
}
|
|
699
738
|
return network;
|
|
700
739
|
}
|
|
701
|
-
function canUseHighEntropyValues(navigator) {
|
|
702
|
-
return typeof globalThis.navigator !== 'undefined' && typeof navigator.userAgentData !== 'undefined' && typeof navigator.userAgentData.getHighEntropyValues !== 'undefined';
|
|
703
|
-
}
|
|
704
740
|
function init() {
|
|
705
741
|
if ((typeof globalThis.process !== 'undefined' && typeof globalThis.process.versions !== 'undefined' && globalThis.process.versions.electron !== undefined) || (/ electron\//i.test(USER_AGENT)))
|
|
706
742
|
Platform.crossPlatformFramework = CrossPlatformFramework.Electron;
|
|
@@ -833,6 +869,7 @@
|
|
|
833
869
|
}
|
|
834
870
|
}
|
|
835
871
|
if (typeof globalThis.document !== 'undefined') {
|
|
872
|
+
incrementPendingTasks();
|
|
836
873
|
if (typeof globalThis.device !== 'undefined') {
|
|
837
874
|
parseOSFromCordova();
|
|
838
875
|
}
|
|
@@ -840,61 +877,68 @@
|
|
|
840
877
|
globalThis.document.addEventListener("deviceready", parseOSFromCordova, false);
|
|
841
878
|
}
|
|
842
879
|
}
|
|
843
|
-
if (
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
.userAgentData
|
|
847
|
-
.getHighEntropyValues(['brands', 'fullVersionList', 'mobile', 'model', 'platform', 'platformVersion', 'architecture', 'formFactors', 'bitness', 'uaFullVersion', 'wow64'])
|
|
880
|
+
if (typeof globalThis.navigator !== 'undefined' && typeof globalThis.navigator.userAgentData !== 'undefined' && typeof globalThis.navigator.userAgentData.getHighEntropyValues !== 'undefined') {
|
|
881
|
+
incrementPendingTasks();
|
|
882
|
+
globalThis.navigator.userAgentData.getHighEntropyValues(['brands', 'fullVersionList', 'mobile', 'model', 'platform', 'platformVersion', 'architecture', 'formFactors', 'bitness', 'uaFullVersion', 'wow64'])
|
|
848
883
|
.then(function (result) {
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
var
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
884
|
+
try {
|
|
885
|
+
var brands = result.fullVersionList || result.brands || [];
|
|
886
|
+
var platformVersion = result.platformVersion;
|
|
887
|
+
var platform = result.platform;
|
|
888
|
+
var browserName = Platform.browser.name;
|
|
889
|
+
var prevBrandName = null;
|
|
890
|
+
for (var i = 0; i < brands.length; i++) {
|
|
891
|
+
var brand = normalizeBrand(brands[i]);
|
|
892
|
+
var brandVersion = brand.version;
|
|
893
|
+
var brandName = brand.brand;
|
|
894
|
+
if (/not.a.brand/i.test(brandName))
|
|
895
|
+
continue;
|
|
896
|
+
if (prevBrandName === null || (/Chrom/.test(prevBrandName) && brandName !== 'Chromium') || (prevBrandName === 'Edge' && /WebView2/.test(brandName))) {
|
|
897
|
+
brandName = HIGH_ENTROPY_BRAND_NAME_MAP[brandName] || brandName;
|
|
898
|
+
prevBrandName = browserName;
|
|
899
|
+
if (prevBrandName === null || /Chrom/.test(prevBrandName) || !/Chrom/.test(brandName)) {
|
|
900
|
+
browserName = brandName;
|
|
901
|
+
if (browserName === 'Chrome' || browserName === 'Chrome WebView' || browserName === 'Chrome Headless')
|
|
902
|
+
Platform.browser.name = Browsers.Chrome;
|
|
903
|
+
else if (browserName === 'Edge' || browserName === 'Edge WebView2')
|
|
904
|
+
Platform.browser.name = Browsers.Edge;
|
|
905
|
+
else if (browserName === 'Opera Mobi')
|
|
906
|
+
Platform.browser.name = Browsers.Opera;
|
|
907
|
+
Platform.browser.version = brandVersion;
|
|
908
|
+
}
|
|
909
|
+
prevBrandName = brandName;
|
|
872
910
|
}
|
|
873
|
-
|
|
911
|
+
if (brandName === 'Chromium')
|
|
912
|
+
Platform.engine.version = brandVersion;
|
|
874
913
|
}
|
|
875
|
-
if (
|
|
876
|
-
Platform.
|
|
914
|
+
if (typeof platformVersion === 'string') {
|
|
915
|
+
if (Platform.os.name === OS.Windows)
|
|
916
|
+
Platform.os.version = parseInt(platformVersion.split('.')[0], 10) >= 13 ? '11' : '10';
|
|
917
|
+
else
|
|
918
|
+
Platform.os.version = platformVersion;
|
|
919
|
+
}
|
|
920
|
+
if (typeof platform === 'string') {
|
|
921
|
+
if (/android/i.test(platform))
|
|
922
|
+
Platform.os.name = OS.Android;
|
|
923
|
+
else if (/ios|iphone|ipad/i.test(platform))
|
|
924
|
+
Platform.os.name = OS.iOS;
|
|
925
|
+
else if (/windows|win32/i.test(platform))
|
|
926
|
+
Platform.os.name = OS.Windows;
|
|
927
|
+
else if (/macos|macintel/i.test(platform))
|
|
928
|
+
Platform.os.name = OS.MacOS;
|
|
929
|
+
}
|
|
930
|
+
if (result.mobile === true)
|
|
931
|
+
Platform.device = Devices.Mobile;
|
|
877
932
|
}
|
|
878
|
-
|
|
879
|
-
if (Platform.os.name === OS.Windows)
|
|
880
|
-
Platform.os.version = parseInt(platformVersion.split('.')[0], 10) >= 13 ? '11' : '10';
|
|
881
|
-
else
|
|
882
|
-
Platform.os.version = platformVersion;
|
|
933
|
+
catch (_) {
|
|
883
934
|
}
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
Platform.os.name = OS.Android;
|
|
887
|
-
else if (/ios|iphone|ipad/i.test(platform))
|
|
888
|
-
Platform.os.name = OS.iOS;
|
|
889
|
-
else if (/windows|win32/i.test(platform))
|
|
890
|
-
Platform.os.name = OS.Windows;
|
|
891
|
-
else if (/macos|macintel/i.test(platform))
|
|
892
|
-
Platform.os.name = OS.MacOS;
|
|
935
|
+
finally {
|
|
936
|
+
decrementPendingTasks();
|
|
893
937
|
}
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
});
|
|
938
|
+
})
|
|
939
|
+
.catch(decrementPendingTasks);
|
|
897
940
|
}
|
|
941
|
+
checkReady();
|
|
898
942
|
}
|
|
899
943
|
init();
|
|
900
944
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).Clipboard=n()}(this,(function(){"use strict";function e(e,n){if(void 0===n&&(n=!0),void 0!==globalThis.document){var t=globalThis.document.createElement(e);return"width"in t&&(t.width="0"),"height"in t&&(t.height="0"),"border"in t&&(t.border="0"),"frameBorder"in t&&(t.frameBorder="0"),"scrolling"in t&&(t.scrolling="no"),"cellPadding"in t&&(t.cellPadding="0"),"cellSpacing"in t&&(t.cellSpacing="0"),"frame"in t&&(t.frame="void"),"rules"in t&&(t.rules="none"),"noWrap"in t&&(t.noWrap=!0),t.tabIndex=-1,t.setAttribute("role","presentation"),n?(t.style.width="1px",t.style.height="1px"):(t.setAttribute("aria-hidden","true"),t.style.width="0",t.style.height="0",t.style.zIndex="-9999",t.style.display="none",t.style.visibility="hidden",t.style.pointerEvents="none"),t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.padding="0",t.style.margin="0",t.style.border="none",t.style.outline="none",t.style.clip="rect(1px, 1px, 1px, 1px)",t.style.clipPath="inset(50%)",t.style.overflow="hidden",t.style.whiteSpace="nowrap",t}}function n(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];for(var r="",o=0;o<n.length-2;o++){var i=n[o];void 0!==i&&(r=r+i.charAt(0).toUpperCase()+i.slice(1))}return r}function t(){this.returnValue=!1}function r(){this.cancelBubble=!0}var o,i,a,l,s,c=/(animation)(start|iteration|end|cancel)|(transition)(start|run|end|cancel)|(fullscreen)(change|error)|(lost|got)(pointer)(capture)|(pointer)(lock)(change|error)|(pointer)(cancel|down|enter|leave|move|out|over|up)/i,u=["","webkit","moz","ms","MS","o","O"],d={wheel:["wheel","mousewheel","DOMMouseScroll"],focus:["focus","focusin"],blur:["blur","focusout"],beforeinput:["beforeinput","textInput"]},m={useStd:void 0!==globalThis.document&&"function"==typeof globalThis.document.addEventListener,add:function(e,n){void 0===n&&(n={callback:null,options:!1});var o=n.callback;if(void 0!==e&&null!==o){var i=m.withVender(e,n.type),a=n.options;if("function"==typeof e.addEventListener)try{return e.addEventListener(i,o,a)}catch(e){}if("function"==typeof e.addListener)if("boolean"==typeof e.matches)try{return e.addListener(o)}catch(e){}else try{return e.addListener(i,o)}catch(e){}return"function"==typeof e.attachEvent?o.__ieWrapper?e.attachEvent("on"+i,o.__ieWrapper):e.attachEvent("on"+i,o.__ieWrapper=function(n){void 0===n&&(n=globalThis.event),void 0!==n&&(n.currentTarget=e,"function"!=typeof n.preventDefault&&(n.preventDefault=t),"function"!=typeof n.stopPropagation&&(n.stopPropagation=r),"function"==typeof o?o.call(e,n):o&&"function"==typeof o.handleEvent&&o.handleEvent.call(e,n))}):void 0}},remove:function(e,n){void 0===n&&(n={callback:null,options:!1});var t=n.callback;if(void 0!==e&&null!==t){var r=m.withVender(e,n.type),o=n.options;if("function"==typeof e.removeEventListener)try{return e.removeEventListener(r,t,o)}catch(e){}if("function"==typeof e.removeListener)if("boolean"==typeof e.matches)try{return e.removeListener(t)}catch(e){}else try{return e.removeListener(r,t)}catch(e){}if("function"!=typeof e.detachEvent);else{var i=t.__ieWrapper;void 0!==i&&(e.detachEvent("on"+r,i),delete t.__ieWrapper)}}},withVender:function(e,t){if(void 0===t)return"";if(e===globalThis.document&&["deviceready","pause","resume","backbutton","menubutton","searchbutton","startcallbutton","endcallbutton","volumedownbutton","volumeupbutton","activated","cordovacallbackerror"].indexOf(t)>-1)return t;if(void 0!==e.webkitEnterFullscreen&&["webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"].indexOf(t)>-1)return t;var r;r=t in d?d[t]:c.test(t)?[t,t.replace(c,n)]:[t];for(var o=0;o<u.length;o++)for(var i=0;i<r.length;i++){var a=u[o]+r[i];if(void 0!==e["on"+a])return a}return""}};!function(e){e.Unknown="Unknown",e.Android="Android",e.iOS="iOS",e.Windows="Windows",e.MacOS="MacOS"}(o||(o={})),function(e){e.Unknown="Unknown",e.Mobile="Mobile",e.Desktop="Desktop"}(i||(i={})),function(e){e.Unknown="Unknown",e.EdgeHTML="EdgeHTML",e.ArkWeb="ArkWeb",e.Blink="Blink",e.Presto="Presto",e.WebKit="WebKit",e.Trident="Trident",e.NetFront="NetFront",e.KHTML="KHTML",e.Tasman="Tasman",e.Gecko="Gecko"}(a||(a={})),function(e){e.Unknown="Unknown",e.Chrome="Chrome",e.Safari="Safari",e.Edge="Edge",e.Firefox="Firefox",e.Opera="Opera",e.IE="IE",e.SamsungInternet="SamsungInternet"}(l||(l={})),function(e){e.Unknown="Unknown",e.ReactNative="ReactNative",e.Electron="Electron",e.Cordova="Cordova"}(s||(s={}));var f=void 0!==globalThis.navigator&&"string"==typeof globalThis.navigator.userAgent?globalThis.navigator.userAgent:"",v={os:{name:o.Unknown,version:""},engine:{name:a.Unknown,version:""},browser:{name:l.Unknown,version:""},crossPlatformFramework:s.Unknown,userAgent:f,get network(){return function(){var e={isOnline:null,effectiveType:null,type:null,downlink:null,rtt:null,saveData:null};if(void 0!==globalThis.navigator){void 0!==globalThis.navigator.onLine&&(e.isOnline=globalThis.navigator.onLine);var n=globalThis.navigator.connection||globalThis.navigator.mozConnection||globalThis.navigator.webkitConnection;void 0!==n&&(void 0!==n.effectiveType&&(e.effectiveType=n.effectiveType),void 0!==n.type&&(e.type=n.type),void 0!==n.downlink&&(e.downlink=n.downlink),void 0!==n.rtt&&(e.rtt=n.rtt),void 0!==n.saveData&&(e.saveData=n.saveData))}if(v.isNode){try{for(var t=require("os").networkInterfaces(),r=Object.keys(t),i=0;i<r.length;i++){for(var a=t[r[i]],l=0;l<a.length;l++){var s=a[l];s.internal||"IPv4"!==s.family||(e.isOnline=!0)}if(e.isOnline)break}}catch(e){}try{var c=require("child_process");if(v.os.name===o.Windows){try{(u=c.execSync("netsh wlan show interfaces",{encoding:"utf8",timeout:5e3})).includes("State")&&u.includes("connected")&&(e.type="wifi")}catch(e){}if(null===e.type)try{(u=c.execSync("ipconfig",{encoding:"utf8",timeout:5e3})).includes("Ethernet adapter")&&(e.type="ethernet")}catch(e){}null===e.type&&(e.type="other")}else if(v.os.name===o.MacOS)try{var u=c.execSync("networksetup -listallhardwareports",{encoding:"utf8",timeout:5e3}),d=c.execSync("route -n get default | grep interface",{encoding:"utf8",timeout:5e3});d.includes("en0")&&u.includes("Wi-Fi")?e.type="wifi":d.includes("en")||u.includes("Ethernet")?e.type="ethernet":e.type="other"}catch(n){e.type="other"}}catch(e){}}return e}()},get device(){return this.os.name===o.iOS||this.os.name===o.Android?i.Mobile:this.os.name===o.Windows||this.os.name===o.MacOS?i.Desktop:i.Unknown},get renderer(){return function(){if(void 0===globalThis.document)return"";var e=globalThis.document.createElement("canvas");if("function"!=typeof e.getContext)return"";var n=e.getContext("webgl2")||e.getContext("experimental-webgl")||e.getContext("webgl");if(null===n)return"";if(n instanceof WebGLRenderingContext||"getParameter"in n&&"function"==typeof n.getParameter){var t=n.getExtension("WEBGL_debug_renderer_info");return null===t?n.getParameter(n.RENDERER):n.getParameter(t.UNMASKED_RENDERER_WEBGL)}return""}()},get isMobile(){return this.device===i.Mobile},get isDesktop(){return this.device===i.Desktop},get isWebview(){return/; ?wv|applewebkit(?!.*safari)/i.test(this.userAgent)},get isNode(){return void 0!==globalThis.process&&void 0!==globalThis.process.versions&&void 0!==globalThis.process.versions.node},get isStandalone(){return this.os.name===o.iOS?"standalone"in globalThis.navigator&&!!globalThis.navigator.standalone:"matchMedia"in globalThis&&globalThis.matchMedia("(display-mode: standalone)").matches}},p=[[/windows nt (6\.[23]); arm/i,o.Windows,w],[/windows (?:phone|mobile|iot)(?: os)?[\/ ]?([\d.]*( se)?)/i,o.Windows,w],[/windows[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i,o.Windows,w],[/windows nt ?([\d.)]*)(?!.+xbox)/i,o.Windows,w],[/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d.;]*)/i,o.Windows,w],[/windows ce\/?([\d.]*)/i,o.Windows,w],[/[adehimnop]{4,7}\b(?:.*os (\w+) like mac|; opera)/i,o.iOS,y],[/(?:ios;fbsv|ios(?=.+ip(?:ad|hone))|ip(?:ad|hone)(?: |.+i(?:pad)?)os)[\/ ]([\w.]+)/i,o.iOS,y],[/cfnetwork\/.+darwin/i,o.iOS,y],[/mac os x ?([\w. ]*)/i,o.MacOS,y],[/(?:macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i,o.MacOS,y],[/droid ([\w.]+)\b.+(android[- ]x86)/i,o.Android],[/android\w*[-\/.; ]?([\d.]*)/i,o.Android]],b=[[/windows.+ edge\/([\w.]+)/i,a.EdgeHTML],[/arkweb\/([\w.]+)/i,a.ArkWeb],[/webkit\/537\.36.+chrome\/(?!27)([\w.]+)/i,a.Blink],[/presto\/([\w.]+)/i,a.Presto],[/webkit\/([\w.]+)/i,a.WebKit],[/trident\/([\w.]+)/i,a.Trident],[/netfront\/([\w.]+)/i,a.NetFront],[/khtml[\/ ]\(?([\w.]+)/i,a.KHTML],[/tasman[\/ ]\(?([\w.]+)/i,a.Tasman],[/rv:([\w.]{1,9})\b.+gecko/i,a.Gecko]],h=[[/\b(?:crmo|crios)\/([\w.]+)/i,l.Chrome],[/webview.+edge\/([\w.]+)/i,l.Edge],[/edg(?:e|ios|a)?\/([\w.]+)/i,l.Edge],[/opera mini\/([-\w.]+)/i,l.Opera],[/opera [mobileta]{3,6}\b.+version\/([-\w.]+)/i,l.Opera],[/opera(?:.+version\/|[\/ ]+)([\w.]+)/i,l.Opera],[/opios[\/ ]+([\w.]+)/i,l.Opera],[/\bop(?:rg)?x\/([\w.]+)/i,l.Opera],[/\bopr\/([\w.]+)/i,l.Opera],[/iemobile(?:browser|boat|jet)[\/ ]?([\d.]*)/i,l.IE],[/(?:ms|\()ie ([\w.]+)/i,l.IE],[/trident.+rv[: ]([\w.]{1,9})\b.+like gecko/i,l.IE],[/\bfocus\/([\w.]+)/i,l.Firefox],[/\bopt\/([\w.]+)/i,l.Opera],[/coast\/([\w.]+)/i,l.Opera],[/fxios\/([\w.-]+)/i,l.Firefox],[/samsungbrowser\/([\w.]+)/i,l.SamsungInternet],[/headlesschrome(?:\/([\w.]+)| )/i,l.Chrome],[/wv\).+chrome\/([\w.]+).+edgw\//i,l.Edge],[/ wv\).+(chrome)\/([\w.]+)/i,l.Chrome],[/chrome\/([\w.]+) mobile/i,l.Chrome],[/chrome\/v?([\w.]+)/i,l.Chrome],[/version\/([\w.,]+) .*mobile(?:\/\w+ | ?)safari/i,l.Safari],[/iphone .*mobile(?:\/\w+ | ?)safari/i,l.Safari],[/version\/([\w.,]+) .*safari/i,l.Safari],[/webkit.+?(?:mobile ?safari|safari)(\/[\w.]+)/i,l.Safari,"1"],[/(?:mobile|tablet);.*firefox\/([\w.-]+)/i,l.Firefox],[/mobile vr; rv:([\w.]+)\).+firefox/i,l.Firefox],[/firefox\/([\w.]+)/i,l.Firefox]],g={"Google Chrome":"Chrome","Microsoft Edge":"Edge","Microsoft Edge WebView2":"Edge WebView2","Android WebView":"Chrome WebView",HeadlessChrome:"Chrome Headless",OperaMobile:"Opera Mobi"};function w(e){if(void 0===e)return"";var n={"4.90":"ME","NT3.51":"NT 3.11","NT4.0":"NT 4.0","NT 5.0":"2000","NT 5.1":"XP","NT 5.2":"XP","NT 6.0":"Vista","NT 6.1":"7","NT 6.2":"8","NT 6.3":"8.1","NT 6.4":"10","NT 10.0":"10",ARM:"RT"}[e];return void 0!==n?n:e}function y(e){return void 0===e?"":e.replace(/_/g,".")}function T(e,n){return 10===e.major&&0===e.minor&&e.build>=22e3?"11":10===e.major&&0===e.minor&&e.build<22e3?"10":6===e.major&&3===e.minor?"8.1":6===e.major&&2===e.minor?"8":6===e.major&&1===e.minor?"7":6===e.major&&0===e.minor?"Vista":5===e.major&&1===e.minor||5===e.major&&2===e.minor?"XP":5===e.major&&0===e.minor?"2000":4===e.major&&90===e.minor?"ME":4===e.major&&0===e.minor?"NT 4.0":3===e.major&&51===e.minor?"NT 3.11":n}function k(e,n){return e.major>=24?e.major-9+"."+e.minor+"."+e.build:23===e.major?"14."+e.minor+"."+e.build:22===e.major?"13."+e.minor+"."+e.build:21===e.major?"12."+e.minor+"."+e.build:20===e.major?"11."+e.minor+"."+e.build:19===e.major?"10.15."+e.minor:18===e.major?"10.14."+e.minor:17===e.major?"10.13."+e.minor:16===e.major?"10.12."+e.minor:15===e.major?"10.11."+e.minor:14===e.major?"10.10."+e.minor:13===e.major?"10.9."+e.minor:e.major>=5&&e.major<=12?"10."+(e.major-4)+"."+e.minor:n}function x(e,n){return e.major>=36?"16":35===e.major?"15":34===e.major?"14":33===e.major?"13":32===e.major?"12.1":31===e.major?"12":30===e.major?"11":29===e.major?"10":28===e.major?"9":27===e.major?"8.1":26===e.major?"8.0":25===e.major?"7.1":24===e.major?"7.0":23===e.major?"6.0":22===e.major?"5.1":21===e.major?"5.0":20===e.major||19===e.major?"4.4":18===e.major?"4.3":17===e.major?"4.2":16===e.major?"4.1":15===e.major?"4.0.3":14===e.major?"4.0":13===e.major?"3.2":12===e.major?"3.1":11===e.major?"3.0":10===e.major?"2.3.3":9===e.major?"2.3":8===e.major?"2.2":7===e.major?"2.1":6===e.major?"2.0.1":5===e.major?"2.0":4===e.major?"1.6":3===e.major?"1.5":2===e.major?"1.1":1===e.major?"1.0":n}function j(e,n){return"function"==typeof n?n(e):"string"==typeof n?n:void 0===e?"":e}function E(e){var n=e.split(".");return{major:parseInt(n[0]||"0"),minor:parseInt(n[1]||"0"),build:parseInt(n[2]||"0")}}function S(){if(v.crossPlatformFramework=s.Cordova,void 0!==globalThis.device)switch(globalThis.device.platform){case"Android":v.os={name:o.Android,version:globalThis.device.version};break;case"iOS":v.os={name:o.iOS,version:globalThis.device.version}}}function C(e){return null!==e&&"object"==typeof e}function O(){return function(){if(void 0!==globalThis.isSecureContext)return globalThis.isSecureContext;var e=location.protocol,n=location.hostname;return"https:"===e||"localhost"===n||"127.0.0.1"===n||"[::1]"===n}()&&"undefined"!=typeof navigator&&"clipboard"in navigator}function M(n){return function(n){if(!globalThis.getSelection||!globalThis.document.createRange)return!1;var t=e("div");if(void 0===t)return!1;t.contentEditable="true",t.innerHTML=n,t.style.whiteSpace="pre",t.style.userSelect="text",t.style.setProperty("-webkit-user-select","text"),t.style.setProperty("-moz-user-select","text"),t.style.setProperty("-ms-user-select","text"),globalThis.document.body.appendChild(t);var r=globalThis.getSelection(),o=globalThis.document.createRange(),i=function(e){try{null!==e.clipboardData&&"function"==typeof e.clipboardData.setData&&(e.preventDefault(),e.clipboardData.setData("text/html",n),e.clipboardData.setData("text/plain",n))}catch(e){}};m.add(globalThis.document,{type:"copy",callback:i,options:{once:!0,capture:!0}});try{if(null===r)return P(t,r,i),!1;r.removeAllRanges(),o.selectNodeContents(t),r.addRange(o);var a=globalThis.document.execCommand("copy");return P(t,r,i),a}catch(e){return P(t,r,i),!1}}(n)||function(e){var n=window.clipboardData;if(void 0!==n&&"function"==typeof n.setData)try{return n.setData("Text",e)}catch(e){return!1}return!1}(n)}function D(){return function(){var n=e("div");if(void 0===n)return null;n.contentEditable="true",globalThis.document.body.appendChild(n),n.focus();var t=null,r=function(e){try{null!==e.clipboardData&&"function"==typeof e.clipboardData.getData&&(e.preventDefault(),t=e.clipboardData.getData("text/html")||e.clipboardData.getData("text/plain")||null)}catch(e){}};m.add(globalThis.document,{type:"paste",callback:r,options:{once:!0,capture:!0}});try{return globalThis.document.execCommand("paste")||t||(t=n.innerHTML||n.textContent||null),W(n,r),t}catch(e){return W(n,r),null}}()||function(){var e=window.clipboardData;if(void 0!==e&&"function"==typeof e.getData)try{return e.getData("Text")||null}catch(e){return null}return null}()||""}function P(e,n,t){null!==n&&n.removeAllRanges(),globalThis.document.body.removeChild(e),m.remove(globalThis.document,{type:"copy",callback:t})}function W(e,n){globalThis.document.body.removeChild(e),m.remove(globalThis.document,{type:"paste",callback:n})}return function(){(void 0!==globalThis.process&&void 0!==globalThis.process.versions&&void 0!==globalThis.process.versions.electron||/ electron\//i.test(f))&&(v.crossPlatformFramework=s.Electron),void 0!==globalThis.navigator&&"ReactNative"===globalThis.navigator.product&&(v.crossPlatformFramework=s.ReactNative);for(var e=0;e<p.length;e++){var n=(c=p[e])[0],t=c[1],r=c[2];if(null!==(u=v.userAgent.match(n))){v.os={name:t,version:j(u[1],r)};break}}for(v.os.name===o.iOS&&0===function(e,n){for(var t=e.split("."),r=n.split("."),o=Math.max(t.length,r.length),i=0;i<o;i++){var a=void 0,l=void 0;if((a=i<t.length?parseInt(t[i],10):0)>(l=i<r.length?parseInt(r[i],10):0))return 1;if(a<l)return-1}return 0}(v.os.version,"18.6")&&null!==(m=/\) Version\/([\d.]+)/.exec(v.userAgent))&&parseInt(m[1].substring(0,2),10)>=26&&(v.os.version=m[1]),e=0;e<b.length;e++){n=(c=b[e])[0];var a=c[1];r=c[2];if(null!==(u=v.userAgent.match(n))){v.engine={name:a,version:j(u[1],r)};break}}for(e=0;e<h.length;e++){n=(c=h[e])[0];var c,u,d=c[1];r=c[2];if(null!==(u=v.userAgent.match(n))){v.browser={name:d,version:j(u[1],r)};break}}if(v.crossPlatformFramework===s.ReactNative)try{t=(y=require("react-native").Platform).OS;var m=E(w=""+y.Version);switch(t){case"android":v.os={name:o.Android,version:x(m,w)};break;case"ios":v.os={name:o.iOS,version:w};break;case"windows":v.os={name:o.Windows,version:T(m,w)};break;case"macos":v.os={name:o.MacOS,version:w}}}catch(e){}if(v.isNode)try{var w,y=(t=require("os")).platform();m=E(w=t.release());switch(y){case"win32":v.os={name:o.Windows,version:T(m,w)};break;case"darwin":v.os={name:o.MacOS,version:k(m,w)};break;case"android":v.os={name:o.Android,version:w};break;case"linux":/android/i.test(w)&&(v.os={name:o.Android,version:w})}}catch(e){}void 0!==globalThis.document&&(void 0!==globalThis.device?S():globalThis.document.addEventListener("deviceready",S,!1)),function(e){return void 0!==globalThis.navigator&&void 0!==e.userAgentData&&void 0!==e.userAgentData.getHighEntropyValues}(globalThis.navigator)&&globalThis.navigator.userAgentData.getHighEntropyValues(["brands","fullVersionList","mobile","model","platform","platformVersion","architecture","formFactors","bitness","uaFullVersion","wow64"]).then((function(e){for(var n,t=e.fullVersionList||e.brands||[],r=e.platformVersion,a=e.platform,s=v.browser.name,c=null,u=0;u<t.length;u++){var d=null==(n=t[u])?{brand:"",version:""}:"string"==typeof n?{brand:n,version:""}:{brand:n.brand,version:n.version},m=d.version,f=d.brand;/not.a.brand/i.test(f)||((null===c||/Chrom/.test(c)&&"Chromium"!==f||"Edge"===c&&/WebView2/.test(f))&&(f=g[f]||f,null!==(c=s)&&!/Chrom/.test(c)&&/Chrom/.test(f)||("Chrome"===(s=f)||"Chrome WebView"===s||"Chrome Headless"===s?v.browser.name=l.Chrome:"Edge"===s||"Edge WebView2"===s?v.browser.name=l.Edge:"Opera Mobi"===s&&(v.browser.name=l.Opera),v.browser.version=m),c=f),"Chromium"===f&&(v.engine.version=m))}"string"==typeof r&&(v.os.name===o.Windows?v.os.version=parseInt(r.split(".")[0],10)>=13?"11":"10":v.os.version=r),"string"==typeof a&&(/android/i.test(a)?v.os.name=o.Android:/ios|iphone|ipad/i.test(a)?v.os.name=o.iOS:/windows|win32/i.test(a)?v.os.name=o.Windows:/macos|macintel/i.test(a)&&(v.os.name=o.MacOS)),!0===e.mobile&&(v.device=i.Mobile)}))}(),{installed:!1,name:"Clipboard",module:{copy:function(e){var n=function(e){if(function(e){return C(e)&&void 0!==e.innerText}(e))return e.innerHTML;if(function(e){return C(e)||function(e){return Array.isArray(e)}(e)}(e))try{return JSON.stringify(e)}catch(n){return""+e}else if("string"!=typeof e)return""+e;return e}(e);if(v.crossPlatformFramework===s.Electron)return function(e){try{var n=require("electron");return new Promise((function(t){try{n.clipboard.writeText(e),n.clipboard.writeHTML(e),t(!0)}catch(e){t(!1)}}))}catch(e){return Promise.resolve(!1)}}(n);if(O()&&("write"in navigator.clipboard||"writeText"in navigator.clipboard))return function(e){try{if("ClipboardItem"in window&&"write"in navigator.clipboard)return navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([e],{type:"text/html"}),"text/plain":new Blob([e],{type:"text/plain"})})]).then((function(){return!0})).catch((function(){return!1}));if("writeText"in navigator.clipboard)return navigator.clipboard.writeText(e).then((function(){return!0})).catch((function(){return!1}))}catch(e){return Promise.resolve(!1)}return Promise.resolve(!1)}(n).then((function(e){return!!e||M(n)})).catch((function(){return M(n)}));return Promise.resolve(M(n))},paste:function(){if(v.crossPlatformFramework===s.Electron)return function(){try{var e=require("electron");return new Promise((function(n){try{var t=e.clipboard.readHTML();return n(t?t.replace(/<meta[^>]*\bcharset\b[^>]*>/i,""):e.clipboard.readText()||"")}catch(e){n("")}}))}catch(e){return Promise.resolve("")}}();if(O()&&("read"in navigator.clipboard||"readText"in navigator.clipboard))return function(){try{if("ClipboardItem"in window&&"read"in navigator.clipboard)return navigator.clipboard.read().then((function(e){if(0===e.length)return Promise.resolve(null);for(var n=e[0],t=n.types,r=0;r<t.length;r++)if("text/html"===t[r])return n.getType("text/html").then((function(e){return e.text()})).catch((function(){return null}));for(r=0;r<t.length;r++)if("text/plain"===t[r])return n.getType("text/plain").then((function(e){return e.text()})).catch((function(){return null}));return Promise.resolve(null)})).catch((function(){return null}));if("readText"in navigator.clipboard)return navigator.clipboard.readText().then((function(e){return e})).catch((function(){return null}))}catch(e){return Promise.resolve(null)}return Promise.resolve(null)}().then((function(e){return null!==e?e:D()})).catch((function(){return D()}));return Promise.resolve(D())}},Constants:{},Errors:{}}}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Clipboard=t()}(this,(function(){"use strict";function e(e,t){if(void 0===t&&(t=!0),void 0!==globalThis.document){var n=globalThis.document.createElement(e);return"width"in n&&(n.width="0"),"height"in n&&(n.height="0"),"border"in n&&(n.border="0"),"frameBorder"in n&&(n.frameBorder="0"),"scrolling"in n&&(n.scrolling="no"),"cellPadding"in n&&(n.cellPadding="0"),"cellSpacing"in n&&(n.cellSpacing="0"),"frame"in n&&(n.frame="void"),"rules"in n&&(n.rules="none"),"noWrap"in n&&(n.noWrap=!0),n.tabIndex=-1,n.setAttribute("role","presentation"),t?(n.style.width="1px",n.style.height="1px"):(n.setAttribute("aria-hidden","true"),n.style.width="0",n.style.height="0",n.style.zIndex="-9999",n.style.display="none",n.style.visibility="hidden",n.style.pointerEvents="none"),n.style.position="absolute",n.style.top="0",n.style.left="0",n.style.padding="0",n.style.margin="0",n.style.border="none",n.style.outline="none",n.style.clip="rect(1px, 1px, 1px, 1px)",n.style.clipPath="inset(50%)",n.style.overflow="hidden",n.style.whiteSpace="nowrap",n}}function t(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];for(var r="",o=0;o<t.length-2;o++){var i=t[o];void 0!==i&&(r=r+i.charAt(0).toUpperCase()+i.slice(1))}return r}function n(){this.returnValue=!1}function r(){this.cancelBubble=!0}var o,i,a,l,s,c=/(animation)(start|iteration|end|cancel)|(transition)(start|run|end|cancel)|(fullscreen)(change|error)|(lost|got)(pointer)(capture)|(pointer)(lock)(change|error)|(pointer)(cancel|down|enter|leave|move|out|over|up)/i,d=["","webkit","moz","ms","MS","o","O"],u={wheel:["wheel","mousewheel","DOMMouseScroll"],focus:["focus","focusin"],blur:["blur","focusout"],beforeinput:["beforeinput","textInput"]},m={useStd:void 0!==globalThis.document&&"function"==typeof globalThis.document.addEventListener,add:function(e,t){void 0===t&&(t={callback:null,options:!1});var o=t.callback;if(void 0!==e&&null!==o){var i=m.withVender(e,t.type),a=t.options;if("function"==typeof e.addEventListener)try{return e.addEventListener(i,o,a)}catch(e){}if("function"==typeof e.addListener)if("boolean"==typeof e.matches)try{return e.addListener(o)}catch(e){}else try{return e.addListener(i,o)}catch(e){}return"function"==typeof e.attachEvent?o.__ieWrapper?e.attachEvent("on"+i,o.__ieWrapper):e.attachEvent("on"+i,o.__ieWrapper=function(t){void 0===t&&(t=globalThis.event),void 0!==t&&(t.currentTarget=e,"function"!=typeof t.preventDefault&&(t.preventDefault=n),"function"!=typeof t.stopPropagation&&(t.stopPropagation=r),"function"==typeof o?o.call(e,t):o&&"function"==typeof o.handleEvent&&o.handleEvent.call(e,t))}):void 0}},remove:function(e,t){void 0===t&&(t={callback:null,options:!1});var n=t.callback;if(void 0!==e&&null!==n){var r=m.withVender(e,t.type),o=t.options;if("function"==typeof e.removeEventListener)try{return e.removeEventListener(r,n,o)}catch(e){}if("function"==typeof e.removeListener)if("boolean"==typeof e.matches)try{return e.removeListener(n)}catch(e){}else try{return e.removeListener(r,n)}catch(e){}if("function"!=typeof e.detachEvent);else{var i=n.__ieWrapper;void 0!==i&&(e.detachEvent("on"+r,i),delete n.__ieWrapper)}}},withVender:function(e,n){if(void 0===n)return"";if(e===globalThis.document&&["deviceready","pause","resume","backbutton","menubutton","searchbutton","startcallbutton","endcallbutton","volumedownbutton","volumeupbutton","activated","cordovacallbackerror"].indexOf(n)>-1)return n;if(void 0!==e.webkitEnterFullscreen&&["webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"].indexOf(n)>-1)return n;var r;r=n in u?u[n]:c.test(n)?[n,n.replace(c,t)]:[n];for(var o=0;o<d.length;o++)for(var i=0;i<r.length;i++){var a=d[o]+r[i];if(void 0!==e["on"+a])return a}return""}};!function(e){e.Unknown="Unknown",e.Android="Android",e.iOS="iOS",e.Windows="Windows",e.MacOS="MacOS"}(o||(o={})),function(e){e.Unknown="Unknown",e.Mobile="Mobile",e.Desktop="Desktop"}(i||(i={})),function(e){e.Unknown="Unknown",e.EdgeHTML="EdgeHTML",e.ArkWeb="ArkWeb",e.Blink="Blink",e.Presto="Presto",e.WebKit="WebKit",e.Trident="Trident",e.NetFront="NetFront",e.KHTML="KHTML",e.Tasman="Tasman",e.Gecko="Gecko"}(a||(a={})),function(e){e.Unknown="Unknown",e.Chrome="Chrome",e.Safari="Safari",e.Edge="Edge",e.Firefox="Firefox",e.Opera="Opera",e.IE="IE",e.SamsungInternet="SamsungInternet"}(l||(l={})),function(e){e.Unknown="Unknown",e.ReactNative="ReactNative",e.Electron="Electron",e.Cordova="Cordova"}(s||(s={}));var f=void 0!==globalThis.navigator&&"string"==typeof globalThis.navigator.userAgent?globalThis.navigator.userAgent:"",v="loading",p=[],h=0,b={os:{name:o.Unknown,version:""},engine:{name:a.Unknown,version:""},browser:{name:l.Unknown,version:""},crossPlatformFramework:s.Unknown,userAgent:f,get readyState(){return v},get network(){return function(){var e={isOnline:null,effectiveType:null,type:null,downlink:null,rtt:null,saveData:null};if(void 0!==globalThis.navigator){void 0!==globalThis.navigator.onLine&&(e.isOnline=globalThis.navigator.onLine);var t=globalThis.navigator.connection||globalThis.navigator.mozConnection||globalThis.navigator.webkitConnection;void 0!==t&&(void 0!==t.effectiveType&&(e.effectiveType=t.effectiveType),void 0!==t.type&&(e.type=t.type),void 0!==t.downlink&&(e.downlink=t.downlink),void 0!==t.rtt&&(e.rtt=t.rtt),void 0!==t.saveData&&(e.saveData=t.saveData))}if(b.isNode){try{for(var n=require("os").networkInterfaces(),r=Object.keys(n),i=0;i<r.length;i++){for(var a=n[r[i]],l=0;l<a.length;l++){var s=a[l];s.internal||"IPv4"!==s.family||(e.isOnline=!0)}if(e.isOnline)break}}catch(e){}try{var c=require("child_process");if(b.os.name===o.Windows){try{(d=c.execSync("netsh wlan show interfaces",{encoding:"utf8",timeout:5e3})).includes("State")&&d.includes("connected")&&(e.type="wifi")}catch(e){}if(null===e.type)try{(d=c.execSync("ipconfig",{encoding:"utf8",timeout:5e3})).includes("Ethernet adapter")&&(e.type="ethernet")}catch(e){}null===e.type&&(e.type="other")}else if(b.os.name===o.MacOS)try{var d=c.execSync("networksetup -listallhardwareports",{encoding:"utf8",timeout:5e3}),u=c.execSync("route -n get default | grep interface",{encoding:"utf8",timeout:5e3});u.includes("en0")&&d.includes("Wi-Fi")?e.type="wifi":u.includes("en")||d.includes("Ethernet")?e.type="ethernet":e.type="other"}catch(t){e.type="other"}}catch(e){}}return e}()},get device(){return this.os.name===o.iOS||this.os.name===o.Android?i.Mobile:this.os.name===o.Windows||this.os.name===o.MacOS?i.Desktop:i.Unknown},get renderer(){return function(){if(void 0===globalThis.document)return"";var e=globalThis.document.createElement("canvas");if("function"!=typeof e.getContext)return"";var t=e.getContext("webgl2")||e.getContext("experimental-webgl")||e.getContext("webgl");if(null===t)return"";if(t instanceof WebGLRenderingContext||"getParameter"in t&&"function"==typeof t.getParameter){var n=t.getExtension("WEBGL_debug_renderer_info");return null===n?t.getParameter(t.RENDERER):t.getParameter(n.UNMASKED_RENDERER_WEBGL)}return""}()},get isMobile(){return this.device===i.Mobile},get isDesktop(){return this.device===i.Desktop},get isWebview(){return/; ?wv|applewebkit(?!.*safari)/i.test(this.userAgent)},get isNode(){return void 0!==globalThis.process&&void 0!==globalThis.process.versions&&void 0!==globalThis.process.versions.node},get isStandalone(){return this.os.name===o.iOS?"standalone"in globalThis.navigator&&!!globalThis.navigator.standalone:"matchMedia"in globalThis&&globalThis.matchMedia("(display-mode: standalone)").matches},onready:function(e){if("complete"===this.readyState)try{e(this)}catch(e){}else p.push(e)}},g=[[/windows nt (6\.[23]); arm/i,o.Windows,E],[/windows (?:phone|mobile|iot)(?: os)?[\/ ]?([\d.]*( se)?)/i,o.Windows,E],[/windows[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i,o.Windows,E],[/windows nt ?([\d.)]*)(?!.+xbox)/i,o.Windows,E],[/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d.;]*)/i,o.Windows,E],[/windows ce\/?([\d.]*)/i,o.Windows,E],[/[adehimnop]{4,7}\b(?:.*os (\w+) like mac|; opera)/i,o.iOS,S],[/(?:ios;fbsv|ios(?=.+ip(?:ad|hone))|ip(?:ad|hone)(?: |.+i(?:pad)?)os)[\/ ]([\w.]+)/i,o.iOS,S],[/cfnetwork\/.+darwin/i,o.iOS,S],[/mac os x ?([\w. ]*)/i,o.MacOS,S],[/(?:macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i,o.MacOS,S],[/droid ([\w.]+)\b.+(android[- ]x86)/i,o.Android],[/android\w*[-\/.; ]?([\d.]*)/i,o.Android]],w=[[/windows.+ edge\/([\w.]+)/i,a.EdgeHTML],[/arkweb\/([\w.]+)/i,a.ArkWeb],[/webkit\/537\.36.+chrome\/(?!27)([\w.]+)/i,a.Blink],[/presto\/([\w.]+)/i,a.Presto],[/webkit\/([\w.]+)/i,a.WebKit],[/trident\/([\w.]+)/i,a.Trident],[/netfront\/([\w.]+)/i,a.NetFront],[/khtml[\/ ]\(?([\w.]+)/i,a.KHTML],[/tasman[\/ ]\(?([\w.]+)/i,a.Tasman],[/rv:([\w.]{1,9})\b.+gecko/i,a.Gecko]],y=[[/\b(?:crmo|crios)\/([\w.]+)/i,l.Chrome],[/webview.+edge\/([\w.]+)/i,l.Edge],[/edg(?:e|ios|a)?\/([\w.]+)/i,l.Edge],[/opera mini\/([-\w.]+)/i,l.Opera],[/opera [mobileta]{3,6}\b.+version\/([-\w.]+)/i,l.Opera],[/opera(?:.+version\/|[\/ ]+)([\w.]+)/i,l.Opera],[/opios[\/ ]+([\w.]+)/i,l.Opera],[/\bop(?:rg)?x\/([\w.]+)/i,l.Opera],[/\bopr\/([\w.]+)/i,l.Opera],[/iemobile(?:browser|boat|jet)[\/ ]?([\d.]*)/i,l.IE],[/(?:ms|\()ie ([\w.]+)/i,l.IE],[/trident.+rv[: ]([\w.]{1,9})\b.+like gecko/i,l.IE],[/\bfocus\/([\w.]+)/i,l.Firefox],[/\bopt\/([\w.]+)/i,l.Opera],[/coast\/([\w.]+)/i,l.Opera],[/fxios\/([\w.-]+)/i,l.Firefox],[/samsungbrowser\/([\w.]+)/i,l.SamsungInternet],[/headlesschrome(?:\/([\w.]+)| )/i,l.Chrome],[/wv\).+chrome\/([\w.]+).+edgw\//i,l.Edge],[/ wv\).+(chrome)\/([\w.]+)/i,l.Chrome],[/chrome\/([\w.]+) mobile/i,l.Chrome],[/chrome\/v?([\w.]+)/i,l.Chrome],[/version\/([\w.,]+) .*mobile(?:\/\w+ | ?)safari/i,l.Safari],[/iphone .*mobile(?:\/\w+ | ?)safari/i,l.Safari],[/version\/([\w.,]+) .*safari/i,l.Safari],[/webkit.+?(?:mobile ?safari|safari)(\/[\w.]+)/i,l.Safari,"1"],[/(?:mobile|tablet);.*firefox\/([\w.-]+)/i,l.Firefox],[/mobile vr; rv:([\w.]+)\).+firefox/i,l.Firefox],[/firefox\/([\w.]+)/i,l.Firefox]],T={"Google Chrome":"Chrome","Microsoft Edge":"Edge","Microsoft Edge WebView2":"Edge WebView2","Android WebView":"Chrome WebView",HeadlessChrome:"Chrome Headless",OperaMobile:"Opera Mobi"};function k(){h++}function x(){h--,j()}function j(){if(0===h&&"loading"===v){v="complete";for(var e=0;e<p.length;e++)try{p[e](b)}catch(e){}p.length=0}}function E(e){if(void 0===e)return"";var t={"4.90":"ME","NT3.51":"NT 3.11","NT4.0":"NT 4.0","NT 5.0":"2000","NT 5.1":"XP","NT 5.2":"XP","NT 6.0":"Vista","NT 6.1":"7","NT 6.2":"8","NT 6.3":"8.1","NT 6.4":"10","NT 10.0":"10",ARM:"RT"}[e];return void 0!==t?t:e}function S(e){return void 0===e?"":e.replace(/_/g,".")}function C(e,t){return 10===e.major&&0===e.minor&&e.build>=22e3?"11":10===e.major&&0===e.minor&&e.build<22e3?"10":6===e.major&&3===e.minor?"8.1":6===e.major&&2===e.minor?"8":6===e.major&&1===e.minor?"7":6===e.major&&0===e.minor?"Vista":5===e.major&&1===e.minor||5===e.major&&2===e.minor?"XP":5===e.major&&0===e.minor?"2000":4===e.major&&90===e.minor?"ME":4===e.major&&0===e.minor?"NT 4.0":3===e.major&&51===e.minor?"NT 3.11":t}function O(e,t){return e.major>=24?e.major-9+"."+e.minor+"."+e.build:23===e.major?"14."+e.minor+"."+e.build:22===e.major?"13."+e.minor+"."+e.build:21===e.major?"12."+e.minor+"."+e.build:20===e.major?"11."+e.minor+"."+e.build:19===e.major?"10.15."+e.minor:18===e.major?"10.14."+e.minor:17===e.major?"10.13."+e.minor:16===e.major?"10.12."+e.minor:15===e.major?"10.11."+e.minor:14===e.major?"10.10."+e.minor:13===e.major?"10.9."+e.minor:e.major>=5&&e.major<=12?"10."+(e.major-4)+"."+e.minor:t}function M(e,t){return e.major>=36?"16":35===e.major?"15":34===e.major?"14":33===e.major?"13":32===e.major?"12.1":31===e.major?"12":30===e.major?"11":29===e.major?"10":28===e.major?"9":27===e.major?"8.1":26===e.major?"8.0":25===e.major?"7.1":24===e.major?"7.0":23===e.major?"6.0":22===e.major?"5.1":21===e.major?"5.0":20===e.major||19===e.major?"4.4":18===e.major?"4.3":17===e.major?"4.2":16===e.major?"4.1":15===e.major?"4.0.3":14===e.major?"4.0":13===e.major?"3.2":12===e.major?"3.1":11===e.major?"3.0":10===e.major?"2.3.3":9===e.major?"2.3":8===e.major?"2.2":7===e.major?"2.1":6===e.major?"2.0.1":5===e.major?"2.0":4===e.major?"1.6":3===e.major?"1.5":2===e.major?"1.1":1===e.major?"1.0":t}function D(e,t){return"function"==typeof t?t(e):"string"==typeof t?t:void 0===e?"":e}function P(e){var t=e.split(".");return{major:parseInt(t[0]||"0"),minor:parseInt(t[1]||"0"),build:parseInt(t[2]||"0")}}function W(){if(b.crossPlatformFramework=s.Cordova,void 0!==globalThis.device)switch(globalThis.device.platform){case"Android":b.os={name:o.Android,version:globalThis.device.version};break;case"iOS":b.os={name:o.iOS,version:globalThis.device.version}}x()}function A(e){return null!==e&&"object"==typeof e}function N(){return function(){if(void 0!==globalThis.isSecureContext)return globalThis.isSecureContext;var e=location.protocol,t=location.hostname;return"https:"===e||"localhost"===t||"127.0.0.1"===t||"[::1]"===t}()&&"undefined"!=typeof navigator&&"clipboard"in navigator}function L(t){return function(t){if(!globalThis.getSelection||!globalThis.document.createRange)return!1;var n=e("div");if(void 0===n)return!1;n.contentEditable="true",n.innerHTML=t,n.style.whiteSpace="pre",n.style.userSelect="text",n.style.setProperty("-webkit-user-select","text"),n.style.setProperty("-moz-user-select","text"),n.style.setProperty("-ms-user-select","text"),globalThis.document.body.appendChild(n);var r=globalThis.getSelection(),o=globalThis.document.createRange(),i=function(e){try{null!==e.clipboardData&&"function"==typeof e.clipboardData.setData&&(e.preventDefault(),e.clipboardData.setData("text/html",t),e.clipboardData.setData("text/plain",t))}catch(e){}};m.add(globalThis.document,{type:"copy",callback:i,options:{once:!0,capture:!0}});try{if(null===r)return V(n,r,i),!1;r.removeAllRanges(),o.selectNodeContents(n),r.addRange(o);var a=globalThis.document.execCommand("copy");return V(n,r,i),a}catch(e){return V(n,r,i),!1}}(t)||function(e){var t=window.clipboardData;if(void 0!==t&&"function"==typeof t.setData)try{return t.setData("Text",e)}catch(e){return!1}return!1}(t)}function I(){return function(){var t=e("div");if(void 0===t)return null;t.contentEditable="true",globalThis.document.body.appendChild(t),t.focus();var n=null,r=function(e){try{null!==e.clipboardData&&"function"==typeof e.clipboardData.getData&&(e.preventDefault(),n=e.clipboardData.getData("text/html")||e.clipboardData.getData("text/plain")||null)}catch(e){}};m.add(globalThis.document,{type:"paste",callback:r,options:{once:!0,capture:!0}});try{return globalThis.document.execCommand("paste")||n||(n=t.innerHTML||t.textContent||null),F(t,r),n}catch(e){return F(t,r),null}}()||function(){var e=window.clipboardData;if(void 0!==e&&"function"==typeof e.getData)try{return e.getData("Text")||null}catch(e){return null}return null}()||""}function V(e,t,n){null!==t&&t.removeAllRanges(),globalThis.document.body.removeChild(e),m.remove(globalThis.document,{type:"copy",callback:n})}function F(e,t){globalThis.document.body.removeChild(e),m.remove(globalThis.document,{type:"paste",callback:t})}return function(){(void 0!==globalThis.process&&void 0!==globalThis.process.versions&&void 0!==globalThis.process.versions.electron||/ electron\//i.test(f))&&(b.crossPlatformFramework=s.Electron),void 0!==globalThis.navigator&&"ReactNative"===globalThis.navigator.product&&(b.crossPlatformFramework=s.ReactNative);for(var e=0;e<g.length;e++){var t=(c=g[e])[0],n=c[1],r=c[2];if(null!==(d=b.userAgent.match(t))){b.os={name:n,version:D(d[1],r)};break}}for(b.os.name===o.iOS&&0===function(e,t){for(var n=e.split("."),r=t.split("."),o=Math.max(n.length,r.length),i=0;i<o;i++){var a=void 0,l=void 0;if((a=i<n.length?parseInt(n[i],10):0)>(l=i<r.length?parseInt(r[i],10):0))return 1;if(a<l)return-1}return 0}(b.os.version,"18.6")&&null!==(m=/\) Version\/([\d.]+)/.exec(b.userAgent))&&parseInt(m[1].substring(0,2),10)>=26&&(b.os.version=m[1]),e=0;e<w.length;e++){t=(c=w[e])[0];var a=c[1];r=c[2];if(null!==(d=b.userAgent.match(t))){b.engine={name:a,version:D(d[1],r)};break}}for(e=0;e<y.length;e++){t=(c=y[e])[0];var c,d,u=c[1];r=c[2];if(null!==(d=b.userAgent.match(t))){b.browser={name:u,version:D(d[1],r)};break}}if(b.crossPlatformFramework===s.ReactNative)try{n=(p=require("react-native").Platform).OS;var m=P(v=""+p.Version);switch(n){case"android":b.os={name:o.Android,version:M(m,v)};break;case"ios":b.os={name:o.iOS,version:v};break;case"windows":b.os={name:o.Windows,version:C(m,v)};break;case"macos":b.os={name:o.MacOS,version:v}}}catch(e){}if(b.isNode)try{var v,p=(n=require("os")).platform();m=P(v=n.release());switch(p){case"win32":b.os={name:o.Windows,version:C(m,v)};break;case"darwin":b.os={name:o.MacOS,version:O(m,v)};break;case"android":b.os={name:o.Android,version:v};break;case"linux":/android/i.test(v)&&(b.os={name:o.Android,version:v})}}catch(e){}void 0!==globalThis.document&&(k(),void 0!==globalThis.device?W():globalThis.document.addEventListener("deviceready",W,!1)),void 0!==globalThis.navigator&&void 0!==globalThis.navigator.userAgentData&&void 0!==globalThis.navigator.userAgentData.getHighEntropyValues&&(k(),globalThis.navigator.userAgentData.getHighEntropyValues(["brands","fullVersionList","mobile","model","platform","platformVersion","architecture","formFactors","bitness","uaFullVersion","wow64"]).then((function(e){try{for(var t=e.fullVersionList||e.brands||[],n=e.platformVersion,r=e.platform,a=b.browser.name,s=null,c=0;c<t.length;c++){var d=null==(f=t[c])?{brand:"",version:""}:"string"==typeof f?{brand:f,version:""}:{brand:f.brand,version:f.version},u=d.version,m=d.brand;/not.a.brand/i.test(m)||((null===s||/Chrom/.test(s)&&"Chromium"!==m||"Edge"===s&&/WebView2/.test(m))&&(m=T[m]||m,null!==(s=a)&&!/Chrom/.test(s)&&/Chrom/.test(m)||("Chrome"===(a=m)||"Chrome WebView"===a||"Chrome Headless"===a?b.browser.name=l.Chrome:"Edge"===a||"Edge WebView2"===a?b.browser.name=l.Edge:"Opera Mobi"===a&&(b.browser.name=l.Opera),b.browser.version=u),s=m),"Chromium"===m&&(b.engine.version=u))}"string"==typeof n&&(b.os.name===o.Windows?b.os.version=parseInt(n.split(".")[0],10)>=13?"11":"10":b.os.version=n),"string"==typeof r&&(/android/i.test(r)?b.os.name=o.Android:/ios|iphone|ipad/i.test(r)?b.os.name=o.iOS:/windows|win32/i.test(r)?b.os.name=o.Windows:/macos|macintel/i.test(r)&&(b.os.name=o.MacOS)),!0===e.mobile&&(b.device=i.Mobile)}catch(e){}finally{x()}var f})).catch(x)),j()}(),{installed:!1,name:"Clipboard",module:{copy:function(e){var t=function(e){if(function(e){return A(e)&&void 0!==e.innerText}(e))return e.innerHTML;if(function(e){return A(e)||function(e){return Array.isArray(e)}(e)}(e))try{return JSON.stringify(e)}catch(t){return""+e}else if("string"!=typeof e)return""+e;return e}(e);if(b.crossPlatformFramework===s.Electron)return function(e){try{var t=require("electron");return new Promise((function(n){try{t.clipboard.writeText(e),t.clipboard.writeHTML(e),n(!0)}catch(e){n(!1)}}))}catch(e){return Promise.resolve(!1)}}(t);if(N()&&("write"in navigator.clipboard||"writeText"in navigator.clipboard))return function(e){try{if("ClipboardItem"in window&&"write"in navigator.clipboard)return navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([e],{type:"text/html"}),"text/plain":new Blob([e],{type:"text/plain"})})]).then((function(){return!0})).catch((function(){return!1}));if("writeText"in navigator.clipboard)return navigator.clipboard.writeText(e).then((function(){return!0})).catch((function(){return!1}))}catch(e){return Promise.resolve(!1)}return Promise.resolve(!1)}(t).then((function(e){return!!e||L(t)})).catch((function(){return L(t)}));return Promise.resolve(L(t))},paste:function(){if(b.crossPlatformFramework===s.Electron)return function(){try{var e=require("electron");return new Promise((function(t){try{var n=e.clipboard.readHTML();return t(n?n.replace(/<meta[^>]*\bcharset\b[^>]*>/i,""):e.clipboard.readText()||"")}catch(e){t("")}}))}catch(e){return Promise.resolve("")}}();if(N()&&("read"in navigator.clipboard||"readText"in navigator.clipboard))return function(){try{if("ClipboardItem"in window&&"read"in navigator.clipboard)return navigator.clipboard.read().then((function(e){if(0===e.length)return Promise.resolve(null);for(var t=e[0],n=t.types,r=0;r<n.length;r++)if("text/html"===n[r])return t.getType("text/html").then((function(e){return e.text()})).catch((function(){return null}));for(r=0;r<n.length;r++)if("text/plain"===n[r])return t.getType("text/plain").then((function(e){return e.text()})).catch((function(){return null}));return Promise.resolve(null)})).catch((function(){return null}));if("readText"in navigator.clipboard)return navigator.clipboard.readText().then((function(e){return e})).catch((function(){return null}))}catch(e){return Promise.resolve(null)}return Promise.resolve(null)}().then((function(e){return null!==e?e:I()})).catch((function(){return I()}));return Promise.resolve(I())}},Constants:{},Errors:{}}}));
|
|
@@ -8,11 +8,13 @@ export declare interface PlatformInstance {
|
|
|
8
8
|
network: Network;
|
|
9
9
|
renderer: string;
|
|
10
10
|
userAgent: string;
|
|
11
|
+
readyState: 'loading' | 'complete';
|
|
11
12
|
isNode: boolean;
|
|
12
13
|
isStandalone: boolean;
|
|
13
14
|
isMobile: boolean;
|
|
14
15
|
isDesktop: boolean;
|
|
15
16
|
isWebview: boolean;
|
|
17
|
+
onready(callback: (platform: PlatformInstance) => void): void;
|
|
16
18
|
}
|
|
17
19
|
export declare interface NameVersionPair<T> {
|
|
18
20
|
name: T;
|
|
@@ -71,12 +71,18 @@ var CrossPlatformFramework;
|
|
|
71
71
|
})(CrossPlatformFramework || (CrossPlatformFramework = {}));
|
|
72
72
|
var USER_AGENT = typeof globalThis.navigator !== 'undefined' && typeof globalThis.navigator.userAgent === 'string' ? globalThis.navigator.userAgent : '';
|
|
73
73
|
|
|
74
|
+
var readyState = 'loading';
|
|
75
|
+
var readyCallback = [];
|
|
76
|
+
var pendingTasks = 0;
|
|
74
77
|
var Platform = {
|
|
75
78
|
os: { name: OS.Unknown, version: '' },
|
|
76
79
|
engine: { name: Engines.Unknown, version: '' },
|
|
77
80
|
browser: { name: Browsers.Unknown, version: '' },
|
|
78
81
|
crossPlatformFramework: CrossPlatformFramework.Unknown,
|
|
79
82
|
userAgent: USER_AGENT,
|
|
83
|
+
get readyState() {
|
|
84
|
+
return readyState;
|
|
85
|
+
},
|
|
80
86
|
get network() {
|
|
81
87
|
return getNetwork();
|
|
82
88
|
},
|
|
@@ -109,6 +115,18 @@ var Platform = {
|
|
|
109
115
|
return false;
|
|
110
116
|
return globalThis.matchMedia('(display-mode: standalone)').matches;
|
|
111
117
|
},
|
|
118
|
+
onready: function (callback) {
|
|
119
|
+
if (this.readyState === 'complete') {
|
|
120
|
+
try {
|
|
121
|
+
callback(this);
|
|
122
|
+
}
|
|
123
|
+
catch (_) {
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
readyCallback.push(callback);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
112
130
|
};
|
|
113
131
|
var OS_RESOLVER_MAP = [
|
|
114
132
|
[/windows nt (6\.[23]); arm/i, OS.Windows, resolveWindowsVersion],
|
|
@@ -176,6 +194,26 @@ var HIGH_ENTROPY_BRAND_NAME_MAP = {
|
|
|
176
194
|
'HeadlessChrome': 'Chrome Headless',
|
|
177
195
|
'OperaMobile': 'Opera Mobi',
|
|
178
196
|
};
|
|
197
|
+
function incrementPendingTasks() {
|
|
198
|
+
pendingTasks++;
|
|
199
|
+
}
|
|
200
|
+
function decrementPendingTasks() {
|
|
201
|
+
pendingTasks--;
|
|
202
|
+
checkReady();
|
|
203
|
+
}
|
|
204
|
+
function checkReady() {
|
|
205
|
+
if (pendingTasks === 0 && readyState === 'loading') {
|
|
206
|
+
readyState = 'complete';
|
|
207
|
+
for (var i = 0; i < readyCallback.length; i++) {
|
|
208
|
+
try {
|
|
209
|
+
readyCallback[i](Platform);
|
|
210
|
+
}
|
|
211
|
+
catch (_) {
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
readyCallback.length = 0;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
179
217
|
function resolveWindowsVersion(string) {
|
|
180
218
|
if (string === undefined)
|
|
181
219
|
return '';
|
|
@@ -376,6 +414,7 @@ function parseOSFromCordova() {
|
|
|
376
414
|
break;
|
|
377
415
|
}
|
|
378
416
|
}
|
|
417
|
+
decrementPendingTasks();
|
|
379
418
|
}
|
|
380
419
|
function getRenderer() {
|
|
381
420
|
if (typeof globalThis.document === 'undefined')
|
|
@@ -485,9 +524,6 @@ function getNetwork() {
|
|
|
485
524
|
}
|
|
486
525
|
return network;
|
|
487
526
|
}
|
|
488
|
-
function canUseHighEntropyValues(navigator) {
|
|
489
|
-
return typeof globalThis.navigator !== 'undefined' && typeof navigator.userAgentData !== 'undefined' && typeof navigator.userAgentData.getHighEntropyValues !== 'undefined';
|
|
490
|
-
}
|
|
491
527
|
function init() {
|
|
492
528
|
if ((typeof globalThis.process !== 'undefined' && typeof globalThis.process.versions !== 'undefined' && globalThis.process.versions.electron !== undefined) || (/ electron\//i.test(USER_AGENT)))
|
|
493
529
|
Platform.crossPlatformFramework = CrossPlatformFramework.Electron;
|
|
@@ -620,6 +656,7 @@ function init() {
|
|
|
620
656
|
}
|
|
621
657
|
}
|
|
622
658
|
if (typeof globalThis.document !== 'undefined') {
|
|
659
|
+
incrementPendingTasks();
|
|
623
660
|
if (typeof globalThis.device !== 'undefined') {
|
|
624
661
|
parseOSFromCordova();
|
|
625
662
|
}
|
|
@@ -627,61 +664,68 @@ function init() {
|
|
|
627
664
|
globalThis.document.addEventListener("deviceready", parseOSFromCordova, false);
|
|
628
665
|
}
|
|
629
666
|
}
|
|
630
|
-
if (
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
.userAgentData
|
|
634
|
-
.getHighEntropyValues(['brands', 'fullVersionList', 'mobile', 'model', 'platform', 'platformVersion', 'architecture', 'formFactors', 'bitness', 'uaFullVersion', 'wow64'])
|
|
667
|
+
if (typeof globalThis.navigator !== 'undefined' && typeof globalThis.navigator.userAgentData !== 'undefined' && typeof globalThis.navigator.userAgentData.getHighEntropyValues !== 'undefined') {
|
|
668
|
+
incrementPendingTasks();
|
|
669
|
+
globalThis.navigator.userAgentData.getHighEntropyValues(['brands', 'fullVersionList', 'mobile', 'model', 'platform', 'platformVersion', 'architecture', 'formFactors', 'bitness', 'uaFullVersion', 'wow64'])
|
|
635
670
|
.then(function (result) {
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
var
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
671
|
+
try {
|
|
672
|
+
var brands = result.fullVersionList || result.brands || [];
|
|
673
|
+
var platformVersion = result.platformVersion;
|
|
674
|
+
var platform = result.platform;
|
|
675
|
+
var browserName = Platform.browser.name;
|
|
676
|
+
var prevBrandName = null;
|
|
677
|
+
for (var i = 0; i < brands.length; i++) {
|
|
678
|
+
var brand = normalizeBrand(brands[i]);
|
|
679
|
+
var brandVersion = brand.version;
|
|
680
|
+
var brandName = brand.brand;
|
|
681
|
+
if (/not.a.brand/i.test(brandName))
|
|
682
|
+
continue;
|
|
683
|
+
if (prevBrandName === null || (/Chrom/.test(prevBrandName) && brandName !== 'Chromium') || (prevBrandName === 'Edge' && /WebView2/.test(brandName))) {
|
|
684
|
+
brandName = HIGH_ENTROPY_BRAND_NAME_MAP[brandName] || brandName;
|
|
685
|
+
prevBrandName = browserName;
|
|
686
|
+
if (prevBrandName === null || /Chrom/.test(prevBrandName) || !/Chrom/.test(brandName)) {
|
|
687
|
+
browserName = brandName;
|
|
688
|
+
if (browserName === 'Chrome' || browserName === 'Chrome WebView' || browserName === 'Chrome Headless')
|
|
689
|
+
Platform.browser.name = Browsers.Chrome;
|
|
690
|
+
else if (browserName === 'Edge' || browserName === 'Edge WebView2')
|
|
691
|
+
Platform.browser.name = Browsers.Edge;
|
|
692
|
+
else if (browserName === 'Opera Mobi')
|
|
693
|
+
Platform.browser.name = Browsers.Opera;
|
|
694
|
+
Platform.browser.version = brandVersion;
|
|
695
|
+
}
|
|
696
|
+
prevBrandName = brandName;
|
|
659
697
|
}
|
|
660
|
-
|
|
698
|
+
if (brandName === 'Chromium')
|
|
699
|
+
Platform.engine.version = brandVersion;
|
|
700
|
+
}
|
|
701
|
+
if (typeof platformVersion === 'string') {
|
|
702
|
+
if (Platform.os.name === OS.Windows)
|
|
703
|
+
Platform.os.version = parseInt(platformVersion.split('.')[0], 10) >= 13 ? '11' : '10';
|
|
704
|
+
else
|
|
705
|
+
Platform.os.version = platformVersion;
|
|
661
706
|
}
|
|
662
|
-
if (
|
|
663
|
-
|
|
707
|
+
if (typeof platform === 'string') {
|
|
708
|
+
if (/android/i.test(platform))
|
|
709
|
+
Platform.os.name = OS.Android;
|
|
710
|
+
else if (/ios|iphone|ipad/i.test(platform))
|
|
711
|
+
Platform.os.name = OS.iOS;
|
|
712
|
+
else if (/windows|win32/i.test(platform))
|
|
713
|
+
Platform.os.name = OS.Windows;
|
|
714
|
+
else if (/macos|macintel/i.test(platform))
|
|
715
|
+
Platform.os.name = OS.MacOS;
|
|
716
|
+
}
|
|
717
|
+
if (result.mobile === true)
|
|
718
|
+
Platform.device = Devices.Mobile;
|
|
664
719
|
}
|
|
665
|
-
|
|
666
|
-
if (Platform.os.name === OS.Windows)
|
|
667
|
-
Platform.os.version = parseInt(platformVersion.split('.')[0], 10) >= 13 ? '11' : '10';
|
|
668
|
-
else
|
|
669
|
-
Platform.os.version = platformVersion;
|
|
720
|
+
catch (_) {
|
|
670
721
|
}
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
Platform.os.name = OS.Android;
|
|
674
|
-
else if (/ios|iphone|ipad/i.test(platform))
|
|
675
|
-
Platform.os.name = OS.iOS;
|
|
676
|
-
else if (/windows|win32/i.test(platform))
|
|
677
|
-
Platform.os.name = OS.Windows;
|
|
678
|
-
else if (/macos|macintel/i.test(platform))
|
|
679
|
-
Platform.os.name = OS.MacOS;
|
|
722
|
+
finally {
|
|
723
|
+
decrementPendingTasks();
|
|
680
724
|
}
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
});
|
|
725
|
+
})
|
|
726
|
+
.catch(decrementPendingTasks);
|
|
684
727
|
}
|
|
728
|
+
checkReady();
|
|
685
729
|
}
|
|
686
730
|
init();
|
|
687
731
|
|