PageSourceSearch

https://www.ni.com/niassets/js/niua.min.js

js ni.com collected 2026-09-24 09:18:53 UTC 4,391 bytes, 1 lines download raw bytes

1var NIUA=class NIUA{static#timer;static#niupSessionUpdateTime;static#niupLastActivityTime;constructor(e){this.appConfig=e}static getNIUA(e){return e.hasOwnProperty("minutesBeforeExpire")||(e.minutesBeforeExpire=5),e.hasOwnProperty("apikey")||(e.apikey="there_is_no_apikey"),new NIUA(e)}async ready(){console.log("NIUA instance has been initialized.")}isIE(){var e=navigator.userAgent;return-1<e.indexOf("MSIE ")||-1<e.indexOf("Trident/")}getCookie(e){var t,i=e+"=";for(t of document.cookie.split(";"))if((t=t.trimStart()).startsWith(i))return t.slice(i.length);return null}async getSession(){var e=this.getCookie("profile_id");return null!=e?{loggedIn:!0,profileId:e}:{loggedIn:!1}}async#makeCachedRequest(e,t){var i=sessionStorage.getItem(t);if(i)try{var s=JSON.parse(i),a=Date.now()-60*this.appConfig.minutesBeforeExpire*1e3;if(parseInt(s.timestamp)>=a)return s}catch(e){console.log("Ignoring cached value for %s because it couldn't be parsed: %o",t,e)}i={response:await this.getResponse(e),timestamp:Date.now()};return sessionStorage.setItem(t,JSON.stringify(i)),i}async getEmail(){if(null==this.getCookie("profile_id"))return{response:{email:"user_not_logged_in",success:!1},timestamp:Date.now()};try{var e=await this.#makeCachedRequest("details","NIUA_details"),t=e.response;return{response:{email:t.email,success:t.success},timestamp:e.timestamp}}catch(e){return console.log(e),{response:{email:"webservice_error",success:!1},timestamp:Date.now()}}}#makeFailureObject(){return{response:{success:!1},timestamp:Date.now()}}async getMonogram(){var e=await this.getDetails(),t=e.response;return t?.success?{response:{monogram:t.monogram,success:t.success},timestamp:e.timestamp}:e}async getDetails(){if(null==this.getCookie("profile_id"))return sessionStorage.removeItem("NIUA_details"),this.#makeFailureObject();try{return await this.#makeCachedRequest("details","NIUA_details")}catch(e){return console.log(e),this.#makeFailureObject()}}getEnvFromUrl(){for(var e of["-test2","-test","-dev2","-dev"])if(location.hostname.includes(e))return e;return""}async getResponse(e){null==e&&(e="email");e=await fetch("//flux"+this.getEnvFromUrl()+".ni.com/niuadataservice/1/resources/"+e,{credentials:"include",headers:{...this.getAuthorizationHeaders(),...this.#getApiKeyHeaders()}});if(e.ok)return e.json();throw await e.json()}createNIAuthToken(){var e,t,i,s=this.getCookie("profile_id");return null!=s?(e=this.getCookie("rma")??"",t=this.getCookie("rmac")??"",i=this.getCookie("upsid")??"","1|"+btoa(s+"|"+e+"|"+t+"|"+i)):null}addAuthorization(e){this.#addHeadersToXhr(e,this.getAuthorizationHeaders())}#addHeadersToXhr(e,t){for(var[i,s]of Object.entries(t))e.setRequestHeader(i,s)}getAuthorizationHeaders(){var e=this.createNIAuthToken();return e?{"X-NI-Auth-Token":e}:{}}addApiKey(e){this.#addHeadersToXhr(e,this.#getApiKeyHeaders())}#getApiKeyHeaders(){return null!=this.appConfig.apikey?{"X-NI-API-KEY":this.appConfig.apikey}:{}}async callUpdateSession(e){e=await fetch("//flux"+this.getEnvFromUrl()+".ni.com/niuadataservice/1/resources/updateSession",{method:"POST",body:JSON.stringify(e),credentials:"include",headers:{...this.getAuthorizationHeaders(),...this.#getApiKeyHeaders(),"Content-Type":"application/json; charset=utf-8",Accept:"application/json"}});if(e.ok)return e.json();throw await e.json()}async updateSession(){NIUA.#niupSessionUpdateTime=Date.now();var e=this.getCookie("upsid");if(null!=e){e={upsid:e,timestamp:NIUA.#niupLastActivityTime};try{var t=await this.callUpdateSession(e);this.setTimer(t.relativeTimeout)}catch(e){console.log(e)}}}setNIUPActivity(){NIUA.#niupLastActivityTime=Date.now()}setTimer(e){let t;var i=this.updateSession.bind(this);null==NIUA.#timer?(t=60*(e-1)*1e3,NIUA.#timer=setTimeout(i,t)):0<(t=NIUA.#niupLastActivityTime+30*(e-1)*1e3-NIUA.#niupSessionUpdateTime)&&(NIUA.#timer=setTimeout(i,t))}};NIUA.sessionReady=(async()=>{"loading"===document.readyState&&await new Promise(e=>document.addEventListener("DOMContentLoaded",e,{once:!0})),NIUA.prototype.getCookie("profile_id")||sessionStorage.removeItem("NIUA_details");var e=NIUA.getNIUA({minutesBeforeExpire:2,apikey:"3b7c1d3b-275d-4683-a459-36e3d1d21776"}),t=(e.setNIUPActivity(),e.setNIUPActivity.bind(e));window.addEventListener("click",t),window.addEventListener("touchstart",t),window.addEventListener("keypress",t),await e.updateSession()})(),window.dispatchEvent(new Event("NIUAloaded"));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.