native-fn
Version:
2 lines (1 loc) • 21.4 kB
JavaScript
;function e(e,r){if(void 0===r&&(r=!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"),r?(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 r(e){for(var r=[],t=1;t<arguments.length;t++)r[t-1]=arguments[t];for(var n="",o=0;o<r.length-2;o++){var i=r[o];void 0!==i&&(n=n+i.charAt(0).toUpperCase()+i.slice(1))}return n}function t(){this.returnValue=!1}function n(){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,r){void 0===r&&(r={callback:null,options:!1});var o=r.callback;if(void 0!==e&&null!==o){var i=m.withVender(e,r.type),a=r.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(r){void 0===r&&(r=globalThis.event),void 0!==r&&(r.currentTarget=e,"function"!=typeof r.preventDefault&&(r.preventDefault=t),"function"!=typeof r.stopPropagation&&(r.stopPropagation=n),"function"==typeof o?o.call(e,r):o&&"function"==typeof o.handleEvent&&o.handleEvent.call(e,r))}):void 0}},remove:function(e,r){void 0===r&&(r={callback:null,options:!1});var t=r.callback;if(void 0!==e&&null!==t){var n=m.withVender(e,r.type),o=r.options;if("function"==typeof e.removeEventListener)try{return e.removeEventListener(n,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(n,t)}catch(e){}if("function"!=typeof e.detachEvent);else{var i=t.__ieWrapper;void 0!==i&&(e.detachEvent("on"+n,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 n;n=t in d?d[t]:c.test(t)?[t,t.replace(c,r)]:[t];for(var o=0;o<u.length;o++)for(var i=0;i<n.length;i++){var a=u[o]+n[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 g=void 0!==globalThis.navigator&&"string"==typeof globalThis.navigator.userAgent?globalThis.navigator.userAgent:"",f={"Google Chrome":"Chrome","Microsoft Edge":"Edge","Microsoft Edge WebView2":"Edge WebView2","Android WebView":"Chrome WebView",HeadlessChrome:"Chrome Headless",OperaMobile:"Opera Mobi"},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:g,get readyState(){return v},get locale(){return function(){var e={language:null,languages:[],timezone:null,timezoneOffset:0};function r(e){for(var r=0;r<e.length;r++)t(e[r])}function t(r){"string"==typeof(r=P(r))&&-1===e.languages.indexOf(r)&&(null===e.language&&(e.language=r),e.languages.push(r))}if(b.crossPlatformFramework===s.ReactNative)try{var n=require("react-native").NativeModules;if(void 0!==n.SettingsManager){var o=n.SettingsManager;if(void 0!==o)if(void 0!==(a="function"==typeof o.getConstants?o.getConstants():o)&&void 0!==a.settings){var i=a.settings;"string"==typeof i.AppleLocale&&t(i.AppleLocale),Array.isArray(i.AppleLanguages)&&i.AppleLanguages.length>0&&r(i.AppleLanguages)}}if(void 0!==n.I18nManager){var a,l=n.I18nManager;if(void 0!==l)void 0!==(a="function"==typeof l.getConstants?l.getConstants():l)&&void 0!==a.localeIdentifier&&t(a.localeIdentifier)}}catch(e){}if(b.crossPlatformFramework===s.Electron)try{var c=require("electron").app;void 0!==c.getLocale&&t(c.getLocale()),void 0!==c.getSystemLocale&&t(c.getSystemLocale()),void 0!==c.getPreferredSystemLanguages&&r(c.getPreferredSystemLanguages())}catch(e){}if("undefined"!=typeof Intl){try{t(Intl.DateTimeFormat().resolvedOptions().locale)}catch(e){}try{e.timezone=Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){}}void 0!==globalThis.navigator&&(void 0!==globalThis.navigator.languages&&r(globalThis.navigator.languages),void 0!==globalThis.navigator.language&&t(globalThis.navigator.language),void 0!==globalThis.navigator.userLanguage&&t(globalThis.navigator.userLanguage),void 0!==globalThis.navigator.browserLanguage&&t(globalThis.navigator.browserLanguage),void 0!==globalThis.navigator.systemLanguage&&t(globalThis.navigator.systemLanguage));try{e.timezoneOffset=(new Date).getTimezoneOffset()}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 r=e.getContext("webgl2")||e.getContext("experimental-webgl")||e.getContext("webgl");if(null===r)return"";if(r instanceof WebGLRenderingContext||"getParameter"in r&&"function"==typeof r.getParameter){var t=r.getExtension("WEBGL_debug_renderer_info");return null===t?r.getParameter(r.RENDERER):r.getParameter(t.UNMASKED_RENDERER_WEBGL)}return""}()},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)}};function w(e){if(void 0===e)return"";var r={"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!==r?r:e}function y(e){return void 0===e?"":e.replace(/_/g,".")}var T=[[/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]],x=[[/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]],k=[[/\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]];function j(){h--,E()}function E(){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 C(e,r){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":r}function S(e,r){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:r}function L(e,r){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":r}function O(e,r){return"function"==typeof r?r(e):"string"==typeof r?r:void 0===e?"":e}function A(e){var r=e.split(".");return{major:parseInt(r[0]||"0"),minor:parseInt(r[1]||"0"),build:parseInt(r[2]||"0")}}function M(){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}}j()}function P(e){if(null==e)return e;if(0===e.length)return null;if("C"===(e=e.replace(/_/g,"-"))||"posix"===e.toLowerCase())return"en-US";if(-1!==e.indexOf("."))return P(e.split(".")[0]);if(-1!==e.indexOf("@"))return P(e.split("@")[0]);var r=e.split("-");return 0===r.length?null:(r[0]=r[0].toLowerCase(),r.length>1&&2===r[1].length&&(r[1]=r[1].toUpperCase()),r.length>2&&4===r[1].length&&(r[1]=r[1].charAt(0).toUpperCase()+r[1].slice(1).toLowerCase()),r.join("-"))}function D(e){return null!==e&&"object"==typeof e}function W(){return function(){if(void 0!==globalThis.isSecureContext)return globalThis.isSecureContext;var e=location.protocol,r=location.hostname;return"https:"===e||"localhost"===r||"127.0.0.1"===r||"[::1]"===r}()&&"undefined"!=typeof navigator&&"clipboard"in navigator}function N(r){return function(r){if(!globalThis.getSelection||!globalThis.document.createRange)return!1;var t=e("div");if(void 0===t)return!1;t.contentEditable="true",t.innerHTML=r,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 n=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",r),e.clipboardData.setData("text/plain",r))}catch(e){}};m.add(globalThis.document,{type:"copy",callback:i,options:{once:!0,capture:!0}});try{if(null===n)return F(t,n,i),!1;n.removeAllRanges(),o.selectNodeContents(t),n.addRange(o);var a=globalThis.document.execCommand("copy");return F(t,n,i),a}catch(e){return F(t,n,i),!1}}(r)||function(e){var r=window.clipboardData;if(void 0!==r&&"function"==typeof r.setData)try{return r.setData("Text",e)}catch(e){return!1}return!1}(r)}function I(){return function(){var r=e("div");if(void 0===r)return null;r.contentEditable="true",globalThis.document.body.appendChild(r),r.focus();var t=null,n=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:n,options:{once:!0,capture:!0}});try{return globalThis.document.execCommand("paste")||t||(t=r.innerHTML||r.textContent||null),V(r,n),t}catch(e){return V(r,n),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 F(e,r,t){null!==r&&r.removeAllRanges(),globalThis.document.body.removeChild(e),m.remove(globalThis.document,{type:"copy",callback:t})}function V(e,r){globalThis.document.body.removeChild(e),m.remove(globalThis.document,{type:"paste",callback:r})}!function(){(void 0!==globalThis.process&&void 0!==globalThis.process.versions&&void 0!==globalThis.process.versions.electron||/ electron\//i.test(g))&&(b.crossPlatformFramework=s.Electron),void 0!==globalThis.navigator&&"ReactNative"===globalThis.navigator.product&&(b.crossPlatformFramework=s.ReactNative);for(var e=0;e<T.length;e++){var r=(c=T[e])[0],t=c[1],n=c[2];if(null!==(u=b.userAgent.match(r))){b.os={name:t,version:O(u[1],n)};break}}for(b.os.name===o.iOS&&0===function(e,r){for(var t=e.split("."),n=r.split("."),o=Math.max(t.length,n.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<n.length?parseInt(n[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<x.length;e++){r=(c=x[e])[0];var a=c[1];n=c[2];if(null!==(u=b.userAgent.match(r))){b.engine={name:a,version:O(u[1],n)};break}}for(e=0;e<k.length;e++){r=(c=k[e])[0];var c,u,d=c[1];n=c[2];if(null!==(u=b.userAgent.match(r))){b.browser={name:d,version:O(u[1],n)};break}}if(b.crossPlatformFramework===s.ReactNative)try{t=(p=require("react-native").Platform).OS;var m=A(v=""+p.Version);switch(t){case"android":b.os={name:o.Android,version:L(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=(t=require("os")).platform();m=A(v=t.release());switch(p){case"win32":b.os={name:o.Windows,version:C(m,v)};break;case"darwin":b.os={name:o.MacOS,version:S(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&&(void 0!==globalThis.device?M():globalThis.document.addEventListener("deviceready",M,!1)),void 0!==globalThis.navigator&&void 0!==globalThis.navigator.userAgentData&&void 0!==globalThis.navigator.userAgentData.getHighEntropyValues&&(h++,globalThis.navigator.userAgentData.getHighEntropyValues(["brands","fullVersionList","mobile","model","platform","platformVersion","architecture","formFactors","bitness","uaFullVersion","wow64"]).then((function(e){try{for(var r=e.fullVersionList||e.brands||[],t=e.platformVersion,n=e.platform,a=b.browser.name,s=null,c=0;c<r.length;c++){var u=null==(g=r[c])?{brand:"",version:""}:"string"==typeof g?{brand:g,version:""}:{brand:g.brand,version:g.version},d=u.version,m=u.brand;/not.a.brand/i.test(m)||((null===s||/Chrom/.test(s)&&"Chromium"!==m||"Edge"===s&&/WebView2/.test(m))&&(m=f[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=d),s=m),"Chromium"===m&&(b.engine.version=d))}"string"==typeof t&&(b.os.name===o.Windows?b.os.version=parseInt(t.split(".")[0],10)>=13?"11":"10":b.os.version=t),"string"==typeof n&&(/android/i.test(n)?b.os.name=o.Android:/ios|iphone|ipad/i.test(n)?b.os.name=o.iOS:/windows|win32/i.test(n)?b.os.name=o.Windows:/macos|macintel/i.test(n)&&(b.os.name=o.MacOS)),!0===e.mobile&&(b.device=i.Mobile)}catch(e){}finally{j()}var g}))),E()}();var R={installed:!1,name:"Clipboard",module:{copy:function(e){var r=function(e){if(function(e){return D(e)&&void 0!==e.innerText}(e))return e.innerHTML;if(function(e){return D(e)||function(e){return Array.isArray(e)}(e)}(e))try{return JSON.stringify(e)}catch(r){return""+e}else if("string"!=typeof e)return""+e;return e}(e);if(b.crossPlatformFramework===s.Electron)return function(e){try{var r=require("electron");return new Promise((function(t){try{r.clipboard.writeText(e),r.clipboard.writeHTML(e),t(!0)}catch(e){t(!1)}}))}catch(e){return Promise.resolve(!1)}}(r);if(W()&&("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)}(r).then((function(e){return!!e||N(r)})).catch((function(){return N(r)}));return Promise.resolve(N(r))},paste:function(){if(b.crossPlatformFramework===s.Electron)return function(){try{var e=require("electron");return new Promise((function(r){try{var t=e.clipboard.readHTML();return r(t?t.replace(/<meta[^>]*\bcharset\b[^>]*>/i,""):e.clipboard.readText()||"")}catch(e){r("")}}))}catch(e){return Promise.resolve("")}}();if(W()&&("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 r=e[0],t=r.types,n=0;n<t.length;n++)if("text/html"===t[n])return r.getType("text/html").then((function(e){return e.text()})).catch((function(){return null}));for(n=0;n<t.length;n++)if("text/plain"===t[n])return r.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:{}};module.exports=R;