Server : Apache/2.4.43 (Win64) OpenSSL/1.1.1g PHP/7.4.6
System : Windows NT USER-PC 6.1 build 7601 (Windows 7 Professional Edition Service Pack 1) AMD64
User : User ( 0)
PHP Version : 7.4.6
Disable Function : NONE
Directory :  C:/Program Files/Avast Software/Avast/gui_resources/1.0.663/
Upload File :
Current Directory [ Writeable ] Root Directory [ Writeable ]


Current File : C:/Program Files/Avast Software/Avast/gui_resources/1.0.663/napi.js
//{"name":"napi","version":"1.2.457","created":"2021-09-06T10:46:48.809Z"}
import{stringUtils as e}from"./libs.js";import{deepExtend as t}from"./libs.js";var n,i={exports:{}};n=i,function(e){var t=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};function i(){this._events={},this._conf&&r.call(this,this._conf)}function r(t){t?(this._conf=t,t.delimiter&&(this.delimiter=t.delimiter),this._maxListeners=t.maxListeners!==e?t.maxListeners:10,t.wildcard&&(this.wildcard=t.wildcard),t.newListener&&(this._newListener=t.newListener),t.removeListener&&(this._removeListener=t.removeListener),t.verboseMemoryLeak&&(this.verboseMemoryLeak=t.verboseMemoryLeak),this.wildcard&&(this.listenerTree={})):this._maxListeners=10}function o(e,t){var n="(node) warning: possible EventEmitter memory leak detected. "+e+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(n+=" Event name: "+t+"."),"undefined"!=typeof process&&process.emitWarning){var i=new Error(n);i.name="MaxListenersExceededWarning",i.emitter=this,i.count=e,process.emitWarning(i)}else console.error(n),console.trace&&console.trace()}function s(e){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,r.call(this,e)}function a(e,t,n,i){if(!n)return[];var r,o,s,l,c,u,h,d=[],f=t.length,p=t[i],m=t[i+1];if(i===f&&n._listeners){if("function"==typeof n._listeners)return e&&e.push(n._listeners),[n];for(r=0,o=n._listeners.length;r<o;r++)e&&e.push(n._listeners[r]);return[n]}if("*"===p||"**"===p||n[p]){if("*"===p){for(s in n)"_listeners"!==s&&n.hasOwnProperty(s)&&(d=d.concat(a(e,t,n[s],i+1)));return d}if("**"===p){for(s in(h=i+1===f||i+2===f&&"*"===m)&&n._listeners&&(d=d.concat(a(e,t,n,f))),n)"_listeners"!==s&&n.hasOwnProperty(s)&&("*"===s||"**"===s?(n[s]._listeners&&!h&&(d=d.concat(a(e,t,n[s],f))),d=d.concat(a(e,t,n[s],i))):d=s===m?d.concat(a(e,t,n[s],i+2)):d.concat(a(e,t,n[s],i)));return d}d=d.concat(a(e,t,n[p],i+1))}if((l=n["*"])&&a(e,t,l,i+1),c=n["**"])if(i<f)for(s in c._listeners&&a(e,t,c,f),c)"_listeners"!==s&&c.hasOwnProperty(s)&&(s===m?a(e,t,c[s],i+2):s===p?a(e,t,c[s],i+1):((u={})[s]=c[s],a(e,t,{"**":u},i+1)));else c._listeners?a(e,t,c,f):c["*"]&&c["*"]._listeners&&a(e,t,c["*"],f);return d}function l(t,n){for(var i=0,r=(t="string"==typeof t?t.split(this.delimiter):t.slice()).length;i+1<r;i++)if("**"===t[i]&&"**"===t[i+1])return;for(var s=this.listenerTree,a=t.shift();a!==e;){if(s[a]||(s[a]={}),s=s[a],0===t.length)return s._listeners?("function"==typeof s._listeners&&(s._listeners=[s._listeners]),s._listeners.push(n),!s._listeners.warned&&this._maxListeners>0&&s._listeners.length>this._maxListeners&&(s._listeners.warned=!0,o.call(this,s._listeners.length,a))):s._listeners=n,!0;a=t.shift()}return!0}s.EventEmitter2=s,s.prototype.delimiter=".",s.prototype.setMaxListeners=function(t){t!==e&&(this._maxListeners=t,this._conf||(this._conf={}),this._conf.maxListeners=t)},s.prototype.event="",s.prototype.once=function(e,t){return this._once(e,t,!1)},s.prototype.prependOnceListener=function(e,t){return this._once(e,t,!0)},s.prototype._once=function(e,t,n){return this._many(e,1,t,n),this},s.prototype.many=function(e,t,n){return this._many(e,t,n,!1)},s.prototype.prependMany=function(e,t,n){return this._many(e,t,n,!0)},s.prototype._many=function(e,t,n,i){var r=this;if("function"!=typeof n)throw new Error("many only accepts instances of Function");function o(){return 0==--t&&r.off(e,o),n.apply(this,arguments)}return o._origin=n,this._on(e,o,i),r},s.prototype.emit=function(){this._events||i.call(this);var e=arguments[0];if("newListener"===e&&!this._newListener&&!this._events.newListener)return!1;var t,n,r,o,s,l=arguments.length;if(this._all&&this._all.length){if(s=this._all.slice(),l>3)for(t=new Array(l),o=0;o<l;o++)t[o]=arguments[o];for(r=0,n=s.length;r<n;r++)switch(this.event=e,l){case 1:s[r].call(this,e);break;case 2:s[r].call(this,e,arguments[1]);break;case 3:s[r].call(this,e,arguments[1],arguments[2]);break;default:s[r].apply(this,t)}}if(this.wildcard){s=[];var c="string"==typeof e?e.split(this.delimiter):e.slice();a.call(this,s,c,this.listenerTree,0)}else{if("function"==typeof(s=this._events[e])){switch(this.event=e,l){case 1:s.call(this);break;case 2:s.call(this,arguments[1]);break;case 3:s.call(this,arguments[1],arguments[2]);break;default:for(t=new Array(l-1),o=1;o<l;o++)t[o-1]=arguments[o];s.apply(this,t)}return!0}s&&(s=s.slice())}if(s&&s.length){if(l>3)for(t=new Array(l-1),o=1;o<l;o++)t[o-1]=arguments[o];for(r=0,n=s.length;r<n;r++)switch(this.event=e,l){case 1:s[r].call(this);break;case 2:s[r].call(this,arguments[1]);break;case 3:s[r].call(this,arguments[1],arguments[2]);break;default:s[r].apply(this,t)}return!0}if(!this._all&&"error"===e)throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");return!!this._all},s.prototype.emitAsync=function(){this._events||i.call(this);var e=arguments[0];if("newListener"===e&&!this._newListener&&!this._events.newListener)return Promise.resolve([!1]);var t,n,r,o,s,l=[],c=arguments.length;if(this._all){if(c>3)for(t=new Array(c),o=1;o<c;o++)t[o]=arguments[o];for(r=0,n=this._all.length;r<n;r++)switch(this.event=e,c){case 1:l.push(this._all[r].call(this,e));break;case 2:l.push(this._all[r].call(this,e,arguments[1]));break;case 3:l.push(this._all[r].call(this,e,arguments[1],arguments[2]));break;default:l.push(this._all[r].apply(this,t))}}if(this.wildcard){s=[];var u="string"==typeof e?e.split(this.delimiter):e.slice();a.call(this,s,u,this.listenerTree,0)}else s=this._events[e];if("function"==typeof s)switch(this.event=e,c){case 1:l.push(s.call(this));break;case 2:l.push(s.call(this,arguments[1]));break;case 3:l.push(s.call(this,arguments[1],arguments[2]));break;default:for(t=new Array(c-1),o=1;o<c;o++)t[o-1]=arguments[o];l.push(s.apply(this,t))}else if(s&&s.length){if(s=s.slice(),c>3)for(t=new Array(c-1),o=1;o<c;o++)t[o-1]=arguments[o];for(r=0,n=s.length;r<n;r++)switch(this.event=e,c){case 1:l.push(s[r].call(this));break;case 2:l.push(s[r].call(this,arguments[1]));break;case 3:l.push(s[r].call(this,arguments[1],arguments[2]));break;default:l.push(s[r].apply(this,t))}}else if(!this._all&&"error"===e)return arguments[1]instanceof Error?Promise.reject(arguments[1]):Promise.reject("Uncaught, unspecified 'error' event.");return Promise.all(l)},s.prototype.on=function(e,t){return this._on(e,t,!1)},s.prototype.prependListener=function(e,t){return this._on(e,t,!0)},s.prototype.onAny=function(e){return this._onAny(e,!1)},s.prototype.prependAny=function(e){return this._onAny(e,!0)},s.prototype.addListener=s.prototype.on,s.prototype._onAny=function(e,t){if("function"!=typeof e)throw new Error("onAny only accepts instances of Function");return this._all||(this._all=[]),t?this._all.unshift(e):this._all.push(e),this},s.prototype._on=function(e,t,n){if("function"==typeof e)return this._onAny(e,t),this;if("function"!=typeof t)throw new Error("on only accepts instances of Function");return this._events||i.call(this),this._newListener&&this.emit("newListener",e,t),this.wildcard?(l.call(this,e,t),this):(this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),n?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&this._maxListeners>0&&this._events[e].length>this._maxListeners&&(this._events[e].warned=!0,o.call(this,this._events[e].length,e))):this._events[e]=t,this)},s.prototype.off=function(n,i){if("function"!=typeof i)throw new Error("removeListener only takes instances of Function");var r,o=[];if(this.wildcard){var s="string"==typeof n?n.split(this.delimiter):n.slice();o=a.call(this,null,s,this.listenerTree,0)}else{if(!this._events[n])return this;r=this._events[n],o.push({_listeners:r})}for(var l=0;l<o.length;l++){var c=o[l];if(r=c._listeners,t(r)){for(var u=-1,h=0,d=r.length;h<d;h++)if(r[h]===i||r[h].listener&&r[h].listener===i||r[h]._origin&&r[h]._origin===i){u=h;break}if(u<0)continue;return this.wildcard?c._listeners.splice(u,1):this._events[n].splice(u,1),0===r.length&&(this.wildcard?delete c._listeners:delete this._events[n]),this._removeListener&&this.emit("removeListener",n,i),this}(r===i||r.listener&&r.listener===i||r._origin&&r._origin===i)&&(this.wildcard?delete c._listeners:delete this._events[n],this._removeListener&&this.emit("removeListener",n,i))}return function t(n){if(n!==e){var i=Object.keys(n);for(var r in i){var o=i[r],s=n[o];s instanceof Function||"object"!=typeof s||null===s||(Object.keys(s).length>0&&t(n[o]),0===Object.keys(s).length&&delete n[o])}}}(this.listenerTree),this},s.prototype.offAny=function(e){var t,n=0,i=0;if(e&&this._all&&this._all.length>0){for(n=0,i=(t=this._all).length;n<i;n++)if(e===t[n])return t.splice(n,1),this._removeListener&&this.emit("removeListenerAny",e),this}else{if(t=this._all,this._removeListener)for(n=0,i=t.length;n<i;n++)this.emit("removeListenerAny",t[n]);this._all=[]}return this},s.prototype.removeListener=s.prototype.off,s.prototype.removeAllListeners=function(t){if(t===e)return!this._events||i.call(this),this;if(this.wildcard)for(var n="string"==typeof t?t.split(this.delimiter):t.slice(),r=a.call(this,null,n,this.listenerTree,0),o=0;o<r.length;o++)r[o]._listeners=null;else this._events&&(this._events[t]=null);return this},s.prototype.listeners=function(e){if(this.wildcard){var n=[],r="string"==typeof e?e.split(this.delimiter):e.slice();return a.call(this,n,r,this.listenerTree,0),n}return this._events||i.call(this),this._events[e]||(this._events[e]=[]),t(this._events[e])||(this._events[e]=[this._events[e]]),this._events[e]},s.prototype.eventNames=function(){return Object.keys(this._events)},s.prototype.listenerCount=function(e){return this.listeners(e).length},s.prototype.listenersAny=function(){return this._all?this._all:[]},n.exports=s}();const r=i.exports;class o extends r{constructor(e={wildcard:!0,maxListeners:1/0}){super(e)}on(e,t){return r.prototype.on.call(this,e,t),()=>{this.off(e,t)}}off(e,t){null==t?this.removeAllListeners(e):this.removeListener(e,t)}}let s,a=!1;const l={setEnabled:function(e){c();const t=Boolean(e);if(t===a)return;a=t,localStorage.__NITRO_DEBUGMODE=JSON.stringify(a),s.emit("enabledChanged",a)},isEnabled:u,subscribe:function(e){return e({enabled:a}),c(),s.on("enabledChanged",(()=>e({enabled:a})))},on:function(...e){return c(),s.on.apply(s,e)},debug:u()};function c(){s||(s=new o,a=Boolean(localStorage.__NITRO_DEBUGMODE&&JSON.parse(localStorage.__NITRO_DEBUGMODE)))}function u(){return c(),a}const h={on:function(...e){return p(),d.on.apply(d,e)},once:function(...e){return p(),d.once.apply(d,e)},emit:function(...e){return p(),d.emit.apply(d,e)},removeAllListeners:function(...e){return p(),d.removeAllListeners.apply(d,e)},emitEvent:function(...e){if(p(),console.groupCollapsed("%c 🚀 EVENT %c "+e[0]+" ","background: #0024bd; color: #FFF","background: #ffa800; color: #000000"),console.log("DATA "+e[0]+":",e[1]),console.groupEnd(),"BroadcastEvent"===e[2]){let t=[];if(e[1]&&"string"==typeof e[1]&&e[1].length)try{t=JSON.parse(e[1])}catch{}t.unshift(e[0]),d.emit.apply(d,t)}else{if(e[1]&&"string"==typeof e[1]&&e[1].length)try{e[1]=JSON.parse(e[1])}catch{}d.emit.apply(d,e)}f&&f.apply(window.app.avEvents,e)}};let d,f;function p(){d||(d=new o)}window.app.avEvents&&"function"==typeof window.app.avEvents.emitEvent&&(f=window.app.avEvents.emitEvent),window.app.avEvents=h;const m=/^\d+$/;let w;function v(e,t,n=!0){_("request",e,t);const i={init:performance.now()};return w?w(e,t).catch((i=>Promise.reject({code:"unauthorized",message:"Getting request permission failed",error:i,requestName:e,requestParams:n?t:"__hidden__"}))).then((r=>r?g(e,t,n,i):Promise.reject({code:"unauthorized",message:"Permission not granted",requestName:e,requestParams:n?t:"__hidden__"}))):g(e,t,n,i)}function g(e,t,n=!0,i){if(n&&(i.cond=performance.now()),"av.command"===e){const r=window.AvCommand(t);return n&&(i.cpp=performance.now()),n&&L({type:"request",requestName:e,requestParams:t,response:r},i),Promise.resolve(r)}return new Promise(((r,o)=>{window.app.asyncCall(e,(([s,a])=>{let l,c;n&&(i.cpp=performance.now());try{null!=a&&(c=JSON.parse(a))}catch(u){c={code:-1,message:u,data:a}}if(!c||"app.settings.Get"===e&&3===c.code)if(s&&"string"==typeof s)try{const r=JSON.parse(s);l=y(e,t,r),n&&(i.parse=performance.now()),c=null}catch(u){c={code:-1,message:u,data:s}}else l=y(e,t,s),n&&(i.parse=performance.now());c?(n&&L({type:"error",requestName:e,requestParams:t,response:c},i),o(c),_("error",e,c)):(n&&L({type:"request",requestName:e,requestParams:t,response:l},i),r(l),_("response",e,l))}),function(e,t){return"app.settings.Get"===e&&"string"==typeof t?{name:t}:t}(e,t))}))}function y(e,t,n){if("app.settings.Get"===e&&"string"==typeof t){let e=NaN;return"string"==typeof n.value&&m.test(n.value)&&(e=parseInt(n.value)),isNaN(e)?n.value:e}return n}function _(e,t,n){h.emit("qa.av."+e,t,n),h.emit("qa.av."+e+"."+t,n)}function b(e){if("object"==typeof e)try{return JSON.stringify(e,void 0,2)}catch(t){return e}return e}function L(e,t={}){if("error"===e.type||l.isEnabled())switch(e.type){case"request":!function(e,t={}){console.groupCollapsed("%c 🚀 REQUEST %c "+e.requestName+" %c in "+parseInt(t.cpp-t.init)+"ms ","background: #0024bd; color: #FFF","background: #00b81d; color: #FFF","background: #FFF; color: #009cff"),e.requestParams&&console.log(">",e.requestParams),e.response&&console.log("<",e.response),console.debug("⏲initialized at ",t.init,"ms"),console.debug("⏲condition check in",t.cond-t.init,"ms"),console.debug("⏲C++ processed in",t.cpp-t.cond,"ms"),console.debug("⏲parsed in",t.parse-t.cpp,"ms"),console.groupEnd()}(e,t);break;case"error":!function(e,t={}){console.group("%c 🚀 REQUEST %c "+e.requestName+" %c in "+parseInt(t.cpp-t.init)+"ms ","background: #0024bd; color: #FFF","background: #ff0000; color: #FFF","background: #FFF; color: #009cff");const n=b(e.requestParams),i=b(e.response);n&&console.log(">",n),i&&console.log("<",i),console.debug("⏲initialized at ",t.init,"ms"),console.debug("⏲condition check in",t.cond-t.init,"ms"),console.debug("⏲C++ processed in",t.cpp-t.cond,"ms"),console.debug("⏲parsed in",t.parse-t.cpp,"ms"),console.groupEnd()}(e,t)}}function E(e){w?console.warn("The request condition has already been set. For security reasons it is not possible to overwrite it."):w=e}function k(e,t={}){return h.emit("qa.av.request","fetch:"+e,t),0===e.indexOf("res://")||t.withCredentials?new Promise(((n,i)=>{const r=new XMLHttpRequest;r.withCredentials=t.withCredentials,r.onload=()=>{200===r.status?(n(r.responseText),h.emit("qa.av.response","fetch:"+e,r)):(i(new TypeError(r.status+" - "+r.statusText)),h.emit("qa.av.error","fetch:"+e,r))},r.onerror=()=>{const t=new TypeError("Local request failed");i(t),h.emit("qa.av.error","fetch:"+e,t)},r.open("GET",e),r.send(null)})):v("app.utils.HttpRequest",{url:e,method:t.method||"GET"}).then((e=>e.data))}const S={getView:function(){return M},setAccount:function(e){T=e},view:function(e,t){const n=["TRACK_VIEW",{label:e,lastScreen:M}];M=e,t&&(n[1].customData=t);T&&n.push(T);return v("app.TrackGA",[JSON.stringify(n)],l.isEnabled())},event:function(e,t,n,i,r){M=i||M,null!=n&&(n=String(n));const o=["TRACK_EVENT",{screenView:M,category:e,action:t,label:n}];r&&(o[1].customData=r);T&&o.push(T);return v("app.TrackGA",[JSON.stringify(o)],l.isEnabled())},timing:function(e,t,n="",i,r){const o=i||function(e){const t=(e,t)=>{const n=Math.floor(e/t)*t;return n+"-"+(n+t)+" seconds"},n=e/1e3;return n<30?t(n,1):n<60?t(n,5):n<180?t(n,30):"180+ seconds interval"}(t),s=["TRACK_TIMING",{category:e,variable:o,time:t,label:n}];r&&(s[1].customData=r);T&&s.push(T);return v("app.TrackGA",[JSON.stringify(s)],l.isEnabled())},ipm:function(e,t={}){v("app.utils.GetUrlParameters",e).then((n=>{t=Object.assign({action:3,elm:e},t);const i=Object.entries(t).map((([e,t])=>`&${e}=${t}`)).join(""),r=document.createElement("iframe");r.src=n+i,document.body.appendChild(r),setTimeout((()=>{document.body.removeChild(r)}),1e3)}))}};let M,T;const A={click:e=>{F("Toaster","Click",e?.label,e?.view,e?.custom)},automatedActivity:e=>{N("Toaster","AutomatedEvent",e?.label,e?.view,e?.custom)},view:e=>q(e?.view,e?.custom),close:e=>{F("Toaster","Click","Close",e?.view,e?.custom)}};let O;function q(e,t){C(2,{action:"view",view:e},t)}function F(e,t,n,i,r){C(1,{category:e,action:t,label:n,view:i},r)}function N(e,t,n,i,r){C(10,{category:e,action:t,label:n,view:i},r)}function C(t,n,i){null!=n.label&&(n.label=e.escapeHtml(String(n.label)).substr(0,100)),null==n.view&&(n.view=O),O=n.view;const r={category:5,id:t,data:{object:n}};var o;i&&(r.data.custom=(o=i,Object.keys(o).filter((e=>P.includes(e))).reduce(((e,t)=>(null!=o[t]?e[t]=o[t].toString():e[t]=null,e)),{}))),v("app.Burger.4.TrackMessage",r)}const P=["a1","a2","a3","a4","a5","a6","a7","a8","a9","a10","f1","f2","f3","f4","f5","f6","f7","f8","f9","f10"];const R={view:q,click:F,automatedActivity:N,setLastScreen:function(e){O=e||O},toaster:A},x={view:function(e,t){S.view(e,t),R.setLastScreen(S.getView());(["Dashboard","DashboardMessage","SmartScan","SmartScan/CleanReport","SalesBar"].includes(e)||e.startsWith("SmartScan step - "))&&R.view(e,t)},event:function(t,n,i,r,o){null!=i&&(i=e.piiStrip(String(i)));if(S.event(t,n,i,r,o),R.setLastScreen(S.getView()),"Smart Scan 2.0"===t){const e=function(e,t){if(!t)return null;if(void 0!==t.f1||void 0!==t.a1)return t;if("Smart Scan 2.0"===e){const e={};for(const n in t)e[j[n]]=String(t[n]);return e}return null}(t,o);R.automatedActivity(t,n,i,r,e)}else"DashboardMessage"===t&&R.click(t,n,i,r,o)},ipm:function(e,t={}){S.ipm(e,t)},timing:function(e,t,n="",i,r){S.timing(e,t,n,i,r)},getView:function(){return S.getView()},setAccount:function(e){S.setAccount(e)},click:function(e,t,n,i,r){R.click(e,t,n,i,r)},automatedActivity:function(e,t,n,i,r){R.automatedActivity(e,t,n,i,r)}},j={cd25:"f1",cd28:"f2",cd29:"f3",cd31:"f4",cd32:"f5",cd33:"f6",cd34:"f7"};const W={init:function(e={}){z?console.warn("The initialization of moduleManager is in progress or done and cannot be performed again"):z=v("app.utils.getModulesList").then((t=>{U=e.moduleMap||{},I=Object.assign({},t),G=I.metadata||{},delete I.metadata}));return z},getModuleDefs:function(){return J(),B(I)},getModuleMap:function(){return J(),B(U)},getMetadata:function(){return J(),B(G)},importModule:function(e,t="default",n={silent:!1}){let i;function r(e){n.silent||console.error("%c 🚀 NAPI MODULE ERROR %c "+i+"."+t+" ","background: #bd0000; color: #FFF","background: #999; color: #FFF",e)}J(),U&&U[e]?(i=U[e].moduleRedirect?U[e].moduleRedirect:"string"==typeof U[e]?U[e]:e,console.log("Redirecting module "+e+" to "+i)):i=e;h.emit("qa.av.request","module:"+i);if(I&&I[i]){const e="./"+i+".js",n=!D[i]&&Date.now();return import(e).then((e=>{if(e&&e[t]){if(h.emit("qa.av.response","module:"+i,e[t]),!D[i]){D[i]=!0;const t=e.metadata;console.log("%c 🚀 MODULE %c "+t.name+"#"+t.version+" ","background: #0024bd; color: #FFF","background: #999; color: #000","built at",t.created+",","loaded in",Date.now()-n+" ms")}return e[t]}throw'Export "'+t+'" not found in module "'+i+'".'})).catch((e=>{throw r(e),e}))}{const e="Module is not defined.";return r(e),Promise.reject(e)}}},D={};let I,U,G,z;function J(){if(!z)throw"moduleManager is not initalized"}function B(e){try{return t({},e)}catch(n){return console.warn("moduleManager: copying object failed",n),e}}const H={update:function(){return Q(!0)},isOnline:function(){return Q().then((()=>$))},isOnlineSync:function(){return Q(),$},on:function(...e){return Q(),V.on.apply(V,e)},subscribe:function(e){e({online:$}),Q();const t=V.on("online",(()=>e({online:$}))),n=V.on("offline",(()=>e({online:$})));return function(){t(),n()}}};let V,K,$=!0;function Q(e){return V||(V=new o),K&&!e||(K=v("app.anen.global.get_connectivity").then((e=>{$=Z(e),V.emit($?"online":"offline"),h.on("app.anen.global.connectivity_changed",(e=>{$=Z(e.connectivity),V.emit($?"online":"offline")}))})).catch(X)),K}function X(){$=window.navigator.onLine,V.emit($?"online":"offline"),window.addEventListener("online",(()=>{$=!0,V.emit("online")})),window.addEventListener("offline",(()=>{$=!1,V.emit("offline")}))}function Z(e){return 4==e.ipv4||4==e.ipv6||500==e.ipv4||500==e.ipv6}const Y={CLOSE_REASONS:{navigateToOtherWindow:"navigateToOtherWindow",error:"navigateToOtherWindow",actionPerformed:"navigateToOtherWindow"},close:function(e){return v("window.close",e)},minimize:function(){return v("window.minimize")},reload:function(){window.location.reload()},browse:function(e){return v("OpenUrl",{url:e})},open:function(e){let t={};t="string"==typeof e?{url:e}:e;t.type=t.type||"CEF",!1!==t.showTitlebar&&(t.url=location.protocol+"//"+location.host+"/MainWindow.html?module=MainLayout&view=window&url="+encodeURIComponent(t.url)+"&controls=close",t.title&&(t.url+="&title="+encodeURIComponent(t.title)));let n="";switch(t.windowType){case"modal":n="app.windowManager.ShowModal";break;case"window":n="app.windowManager.ShowWindow";break;case"modeless":default:n="app.windowManager.ShowModaless"}delete t.windowType,delete t.showTitlebar,t.width||t.width||(t.width=window.innerWidth,t.height=window.innerHeight);return v(n,t)},openMainWindow:function(e={}){return v("app.windowManager.ShowMainWindow",e)},focusMainWindow:function(){return v("app.windowManager.FocusMainWindow")},isInitialized:function(){return oe},init:se,resize:function(e,t){if(oe){const n=ae(),i={width:Math.min(e||n.width||960,window.screen.availWidth+1),height:Math.min(t||n.height||600,window.screen.availHeight+1)};return i.width>window.screen.availWidth&&i.height>window.screen.availHeight?(document.querySelector("body").style.overflow="auto",--i.width,--i.height):document.querySelector("body").style.overflow="hidden",i.width==window.innerWidth&&i.height==window.innerHeight?Promise.resolve():v("window.Resize",i).then((()=>le()))}return se({width:e,height:t})},broadcastEvent:function(e,...t){return v("app.windowManager.BroadcastEvent",{event:e,payload:JSON.stringify(t)}).catch((n=>{console.error("broadcasting event failed",e,t,n),h.emit.apply(h,[e].concat(t))}))},setTitle:function(e){document.querySelector("title").innerText=e},setCaption:le,getUrlParams:ae};let ee,te,ne=".nui_caption",ie=".nui_caption_client",re=null,oe=!1;function se(e={}){if(oe)return Promise.resolve();{const t=ae();return e.width=Math.min(e.width||t.width||window.innerWidth||960,window.screen.availWidth+1),e.height=Math.min(e.height||t.height||window.innerHeight||600,window.screen.availHeight+1),e.placement=e.placement||t.placement,e.width>window.screen.availWidth&&e.height>window.screen.availHeight?(document.querySelector("body").style.overflow="auto",--e.width,--e.height):document.querySelector("body").style.overflow="hidden",null==e.placement&&delete e.placement,oe=!0,v("window.OnLoad",e).then((()=>le()))}}function ae(){return ee||(ee=Object.fromEntries(new URLSearchParams(location.search))),ee}function le(e,t,n=!1){e&&!n&&(ne=e),t&&!n&&(ie=t);const i=((e,t)=>{let n=0;const i=()=>{const r=[],o=e=>{const t=[4];t[0]=parseInt(e.left),t[1]=parseInt(e.top),t[2]=parseInt(e.right),t[3]=parseInt(e.bottom),r.push(t)},s=document.querySelector(e);if(s){o(s.getBoundingClientRect());const e=document.querySelectorAll(t);for(let t=0;t<e.length;t++)o(e[t].getBoundingClientRect());te!==JSON.stringify(r)&&(v("window.setNoneClientAreas",r),te=JSON.stringify(r))}else n++,n<20?setTimeout(i,200):console.log("Caption error","no areas found with selectors ",e);return r};return i})(e||ne,t||ie);i(),null!=re&&window.removeEventListener("resize",re),re=((e,t)=>{let n,i;return(...r)=>{if(i){const o=Date.now()-i;clearTimeout(n),n=setTimeout((()=>{o>=t&&(e(r),i=Date.now())}),t-o)}else e(r),i=Date.now()}})(i,300),window.addEventListener("resize",re)}const ce={debugMode:l,EventEmitter:o,eventer:h,fetch:k,gaTracker:S,moduleManager:W,onlineChecker:H,serviceRequest:v,logServiceRequest:L,setRequestCond:E,windowApi:Y},ue=W.importModule;export{o as EventEmitter,R as burgerTracker,ce as debug,l as debugMode,h as eventer,k as fetch,S as gaTracker,ue as importModule,L as logServiceRequest,W as moduleManager,x as napiTracker,H as onlineChecker,v as serviceRequest,E as setRequestCond,Y as windowApi};const he={name:"napi",version:"1.2.457",created:"2021-09-06T10:46:48.809Z"};export{he as metadata};