Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@microsoft/applicationinsights-analytics-js

Package Overview
Dependencies
Maintainers
2
Versions
603
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@microsoft/applicationinsights-analytics-js - npm Package Compare versions

Comparing version 2.5.11 to 2.6.0

dist/applicationinsights-analytics-js.api.json

4

browser/applicationinsights-analytics-js.min.js
/*!
* Application Insights JavaScript SDK - Web Analytics, 2.5.11
* Application Insights JavaScript SDK - Web Analytics, 2.6.0
* Copyright (c) Microsoft and contributors. All rights reserved.
*/
var e=this,t=function(e){"use strict";var r="function",i="object",t="undefined",o="prototype",a="hasOwnProperty";function n(){return typeof globalThis!==t&&globalThis?globalThis:typeof self!==t&&self?self:typeof window!==t&&window?window:typeof global!==t&&global?global:null}function s(e){var t=Object.create;if(t)return t(e);if(null==e)return{};if((t=typeof e)!==i&&t!==r)throw new TypeError("Object prototype may only be an Object:"+e);function n(){}return n[o]=e,new n}var c,p,u=function(e,t){return(u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t[a](n)&&(e[n]=t[n])})(e,t)};nt=function(e,t){function n(){this.constructor=e}u(e,t),e[o]=null===t?s(t):(n[o]=t[o],new n)},(Be=wt=n()||{}).__assign||(Be.__assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object[o][a].call(t,i)&&(e[i]=t[i]);return e}),Be.__extends||(Be.__extends=nt),__assign=__assign||wt.__assign,__extends=__extends||wt.__extends,(pn=c={})[pn.LocalStorage=0]="LocalStorage",pn[pn.SessionStorage=1]="SessionStorage",(Ct=p=p||{})[Ct.Default=0]="Default",Ct[Ct.Required=1]="Required",Ct[Ct.Array=2]="Array",Ct[Ct.Hidden=4]="Hidden",(Lt={})[Lt.AI=0]="AI",Lt[Lt.AI_AND_W3C=1]="AI_AND_W3C",Lt[Lt.W3C=2]="W3C";var l=2,f=t,m=i,g=o,d="window",h="location",v="JSON",y=n;function x(e){var t=y();return t&&t[e]?t[e]:e===d&&_()?window:null}function _(){return typeof window===m&&window}function S(){return _()?window:x(d)}function T(){return typeof document===m&&document?document:x("document")}function I(){return typeof navigator===m&&navigator?navigator:x("navigator")}function w(){return typeof location===m&&location?location:x(h)}function N(){return x("performance")}function E(){return typeof JSON===m&&JSON||null!==x(v)}function C(){return E()?JSON||x(v):null}var b="attachEvent",D="addEventListener",P="detachEvent",k="removeEventListener",A=4294967296,L=4294967295,M=null,R=!1,O=123456789,U=987654321;function z(e){e<0&&(e>>>=0),O=123456789+e&L,U=987654321-e&L,R=!0}function V(){z(Math.random()*A^(new Date).getTime())}function G(e,t){return typeof e===t}function j(e){return G(e,t)||e===undefined}function q(e){return j(e)||null===e}function F(e,t){return e&&Object[o].hasOwnProperty.call(e,t)}function B(e){return G(e,i)}function K(e){return G(e,r)}function W(e,t,n,r){void 0===r&&(r=!1);var i=!1;if(!q(e))try{q(e[D])?q(e[b])||(e[b]("on"+t,n),i=!0):(e[D](t,n,r),i=!0)}catch(o){}return i}function H(e,t,n,r){if(void 0===r&&(r=!1),!q(e))try{q(e[k])?q(e[P])||e[P]("on"+t,n):e[k](t,n,r)}catch(i){}}function X(e,t){if(e&&B(e))for(var n in e)F(e,n)&&t.call(e,n,e[n])}var J=($.isDate=function(e){return"[object Date]"===Object[o].toString.call(e)},$.isArray=function(e){return"[object Array]"===Object[o].toString.call(e)},$.isError=function(e){return"[object Error]"===Object[o].toString.call(e)},$.isString=function(e){return G(e,"string")},$.isNumber=function(e){return G(e,"number")},$.isBoolean=function(e){return G(e,"boolean")},$.disableCookies=function(){$._canUseCookies=!1},$.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(Y,function(e){var t=0|$.randomValue(15);return("x"===e?t:3&t|8).toString(16)})},$.toISOString=function(e){if($.isDate(e)){var t=function(e){return 1===(e+="").length&&(e="0"+e),e};return e.getUTCFullYear()+"-"+t(1+e.getUTCMonth())+"-"+t(e.getUTCDate())+"T"+t(e.getUTCHours())+":"+t(e.getUTCMinutes())+":"+t(e.getUTCSeconds())+"."+((e.getUTCMilliseconds()/1e3).toFixed(3)+"").slice(2,5)+"Z"}},$.arrForEach=function(e,t,n){for(var r=e.length,i=0;i<r;i++)i in e&&t.call(n||e,e[i],i,e)},$.arrIndexOf=function(e,t,n){for(var r=e.length,i=Math.max(0<=(n=n||0)?n:r-Math.abs(n),0);i<r;i++)if(i in e&&e[i]===t)return i;return-1},$.arrMap=function(e,t,n){for(var r=e.length,i=n||e,o=Array(r),a=0;a<r;a++)a in e&&(o[a]=t.call(i,e[a],e));return o},$.arrReduce=function(e,t,n){var r,i=e.length,o=0;if(3<=arguments.length)r=n;else{for(;o<i&&!(o in e);)o++;r=e[o++]}for(;o<i;)o in e&&(r=t(r,e[o],o,e)),o++;return r},$.strTrim=function(e){return $.isString(e)?e.replace(/^\s+|\s+$/g,""):e},$.objKeys=function(e){var t=!{toString:null}.propertyIsEnumerable("toString");if(!(K(e)||B(e)&&null!==e))throw new TypeError("objKeys called on non-object");var n,r=[];for(n in e)F(e,n)&&r.push(n);if(t)for(var i=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],o=i.length,a=0;a<o;a++)F(e,i[a])&&r.push(i[a]);return r},$.addEventHandler=function(e,t){var n=!1,r=S();return r&&(n=W(r,e,t),n=W(r.body,e,t)||n),(r=T())&&(n=Z.Attach(r,e,t)||n),n},$.dateNow=function(){var e=Date;return e.now?e.now():(new e).getTime()},$.perfNow=function(){var e=N();return e&&e.now?e.now():$.dateNow()},$.newId=function(e){void 0===e&&(e=22);for(var t=$.random32()>>>0,n=0,r="";r.length<e;)r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[0|63&t],t>>>=6,5==++n&&(t=($.random32()<<2&4294967295|3&t)>>>0,n=0);return r},$.isIE=function(){var e;return null===M&&(e=((I()||{}).userAgent||"").toLowerCase(),M=!!~e.indexOf("msie")||!!~e.indexOf("trident/")),M},$.randomValue=function(e){return 0<e?Math.floor($.random32()/L*(e+1))>>>0:0},$.random32=function(e){var t=(t=x("crypto")||x("msCrypto"))&&t.getRandomValues?t.getRandomValues(new Uint32Array(1))[0]&L:$.isIE()?(R||V(),$.mwcRandom32()&L):Math.floor(A*Math.random()|0);return e||(t>>>=0),t},$.mwcRandomSeed=function(e){e?z(e):V()},$.mwcRandom32=function(e){var t=((U=36969*(65535&U)+(U>>16)&L)<<16)+(65535&(O=18e3*(65535&O)+(O>>16)&L))>>>0&L|0;return e||(t>>>=0),t},$.generateW3CId=function(){for(var e,t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],n="",r=0;r<4;r++)n+=t[15&(e=$.random32())]+t[e>>4&15]+t[e>>8&15]+t[e>>12&15]+t[e>>16&15]+t[e>>20&15]+t[e>>24&15]+t[e>>28&15];var i=t[8+(3&$.random32())|0];return n.substr(0,8)+n.substr(9,4)+"4"+n.substr(13,3)+i+n.substr(16,3)+n.substr(19,12)},$.isTypeof=G,$.isUndefined=j,$.isNullOrUndefined=q,$.hasOwnProperty=F,$.isFunction=K,$.isObject=B,$.objCreate=s,$.objDefineAccessors=function(e,t,n,r){var i=Object.defineProperty;if(i)try{var o={enumerable:!0,configurable:!0};return n&&(o.get=n),r&&(o.set=r),i(e,t,o),!0}catch(a){}return!1},$);function $(){}var Q,Y=/[xy]/g,Z=(ee.Attach=W,ee.AttachEvent=W,ee.Detach=H,ee.DetachEvent=H,ee);function ee(){}(Mt=Q={})[Mt.CRITICAL=1]="CRITICAL",Mt[Mt.WARNING=2]="WARNING";var te="constructor",ne="prototype",re="function",ie="_dynInstFuncs",oe="_isDynProxy",ae="_dynClass",se="_dynCls$",ce="_dynInstChk",ue=ce,le="_dfOpts",fe="_unknown_",ge="__proto__",pe="useBaseInst",de="setInstFuncs",me=Object.getPrototypeOf,he=0;function ve(e,t){return e&&Object[ne].hasOwnProperty.call(e,t)}function ye(e){return typeof e===re}function xe(e){return e&&(e===Object[ne]||e===Array[ne])}function _e(e){return xe(e)||e===Function[ne]}function Se(e){if(e){if(me)return me(e);if(e=e[ge]||e[ne]||e[te])return e}return null}function Te(e,t,n){return t!==te&&ye(e[t])&&(n||ve(e,t))}function Ie(e){throw new TypeError("DynamicProto: "+e)}function we(e,t){for(var n=e.length-1;0<=n;n--)if(e[n]===t)return 1}function Ne(e,t){return ve(e,ne)?e.name||t||fe:((e||{})[te]||{}).name||t||fe}function Ee(e,n,t,r){ve(e,ne)||Ie("theClass is an invalid class definition.");var i=e[ne];!function(e){for(var t=Se(n);t&&!_e(t);){if(t===e)return 1;t=Se(t)}}(i)&&Ie("["+Ne(e)+"] is not in class hierarchy of ["+Ne(n)+"]");var o=null;ve(i,ae)?o=i[ae]:(o=se+Ne(e,"_")+"$"+he,he++,i[ae]=o);var a=Ee[le],s=!!a[pe];s&&r&&r[pe]!==undefined&&(s=!!r[pe]),t(n,function(e,t,n,o){function r(e,t,n){var r,i=t[c];return i[oe]&&o&&!1!==(r=e[ie]||{})[ue]&&(i=(r[t[ae]]||{})[n]||i),function(){return i.apply(e,arguments)}}var i={};for(c in n)i[c]=r(t,n,c);for(var a=Se(e),s=[];a&&!_e(a)&&!we(s,a);){for(var c in a)!i[c]&&Te(a,c,!me)&&(i[c]=r(t,a,c));s.push(a),a=Se(a)}return i}(i,n,e=function(e){var t,n={};for(t in e)!n[t]&&Te(e,t,!1)&&(n[t]=e[t]);return n}(n),s)),(a=!!me&&!!a[de])&&r&&(a=!!r[de]),function(e,t,n,r,i){if(!xe(e)){var o,a=n[ie]=n[ie]||{},s=a[t]=a[t]||{};for(o in!1!==a[ue]&&(a[ue]=!!i),n)Te(n,o,!1)&&n[o]!==r[o]&&(s[o]=n[o],delete n[o],ve(e,o)&&(!e[o]||e[o][oe])||(e[o]=function(n,r){var i=function(){var e,t;return(function(e,t,n,r){var i=null;if(e&&ve(n,ae)){var o=e[ie]||{};if((i=(o[n[ae]]||{})[t])||Ie("Missing ["+t+"] "+re),!i[ce]&&!1!==o[ue]){for(var a=!ve(e,t),s=Se(e),c=[];a&&s&&!_e(s)&&!we(c,s);){var u=s[t];if(u){a=u===r;break}c.push(s),s=Se(s)}try{a&&(e[t]=i),i[ce]=1}catch(l){o[ue]=!1}}}return i}(this,r,n,i)||((t=n[e=r])===i&&(t=Se(n)[e]),ye(t)||Ie("["+e+"] is not a "+re),t)).apply(this,arguments)};return i[oe]=1,i}(e,o)))}}(i,o,n,e,!1!==a)}function Ce(e){return e?'"'+e.replace(/\"/g,"")+'"':""}Ee[le]={setInstFuncs:!0,useBaseInst:!0};var be=(De.dataType="MessageData",De);function De(e,t,n,r){void 0===n&&(n=!1),this.messageId=e,this.message=(n?"AI: ":"AI (Internal): ")+e,e="",E()&&(e=C().stringify(r)),e=(t?" message:"+Ce(t):"")+(r?" props:"+Ce(e):""),this.message+=e}var Pe=function Vn(i){this.identifier="DiagnosticLogger",this.queue=[];var s=0,c={};Ee(Vn,this,function(o){var n=J.isNullOrUndefined,a=J.isUndefined,r=J.isFunction;function e(e,t){return e=i[e],n(e)?t:e}n(i)&&(i={}),o.consoleLoggingLevel=function(){return e("loggingLevelConsole",0)},o.telemetryLoggingLevel=function(){return e("loggingLevelTelemetry",1)},o.maxInternalMessageLimit=function(){return e("maxMessageLimit",25)},o.enableDebugExceptions=function(){return e("enableDebugExceptions",!1)},o.throwInternal=function(e,t,n,r,i){if(void 0===i&&(i=!1),r=new be(t,n,i,r),o.enableDebugExceptions())throw r;!a(r)&&r&&(a(r.message)||(i?(i=+r.messageId,!c[i]&&o.consoleLoggingLevel()>=Q.WARNING&&(o.warnToConsole(r.message),c[i]=!0)):o.consoleLoggingLevel()>=Q.WARNING&&o.warnToConsole(r.message),o.logInternalMessage(e,r)))},o.warnToConsole=function(e){var t,n=typeof console!==f?console:x("console");n&&(t="log",n.warn&&(t="warn"),r(n[t])&&n[t](e))},o.resetInternalMessageCount=function(){s=0,c={}},o.logInternalMessage=function(e,t){var n,r;s>=o.maxInternalMessageLimit()||(n=!0,r="AITR_"+t.messageId,c[r]?n=!1:c[r]=!0,n&&(e<=o.telemetryLoggingLevel()&&(o.queue.push(t),s++),s===o.maxInternalMessageLimit()&&(t=new be(23,e="Internal events throttle limit per PageView reached for this app.",!1),o.queue.push(t),o.warnToConsole(e))))}})},ke="ctx",Ae=(Le.ParentContextKey="parent",Le.ChildrenContextKey="childEvts",Le);function Le(e,i,t){var n,o=this,a=!1;o.start=J.dateNow(),o.name=e,o.isAsync=t,o.isChildEvt=function(){return!1},J.isFunction(i)&&(a=J.objDefineAccessors(o,"payload",function(){return!n&&J.isFunction(i)&&(n=i(),i=null),n})),o.getCtx=function(e){return e?(e===Le.ParentContextKey||e===Le.ChildrenContextKey?o:o[ke]||{})[e]:null},o.setCtx=function(e,t){e&&(e===Le.ParentContextKey?(o[e]||(o.isChildEvt=function(){return!0}),o[e]=t):e===Le.ChildrenContextKey?o[e]=t:(o[ke]=o[ke]||{})[e]=t)},o.complete=function(){var e=0,t=o.getCtx(Le.ChildrenContextKey);if(J.isArray(t))for(var n=0;n<t.length;n++){var r=t[n];r&&(e+=r.time)}o.time=J.dateNow()-o.start,o.exTime=o.time-e,o.complete=function(){},!a&&J.isFunction(i)&&(o.payload=i())}}var Me=function Gn(t){this.ctx={},Ee(Gn,this,function(n){n.create=function(e,t,n){return new Ae(e,t,n)},n.fire=function(e){e&&(e.complete(),t&&t.perfEvent(e))},n.setCtx=function(e,t){e&&((n[ke]=n[ke]||{})[e]=t)},n.getCtx=function(e){return(n[ke]||{})[e]}})},Re="CoreUtils.doPerf";function Oe(e,t,n,r,i){if(e){var o=e;if(o&&J.isFunction(o.getPerfMgr)&&(o=o.getPerfMgr()),o){var a,s=void 0,c=o.getCtx(Re);try{if(s=o.create(t(),r,i))return c&&s.setCtx&&(s.setCtx(Ae.ParentContextKey,c),c.getCtx&&c.setCtx&&((a=c.getCtx(Ae.ChildrenContextKey))||(a=[],c.setCtx(Ae.ChildrenContextKey,a)),a.push(s))),o.setCtx(Re,s),n(s)}catch(u){s&&s.setCtx&&s.setCtx("exception",u)}finally{s&&o.fire(s),o.setCtx(Re,c)}}}return n()}var Ue=J.isFunction,ze=function(i,t){var o=this,a=null,s=Ue(i.processTelemetry),c=Ue(i.setNextPlugin);o._hasRun=!1,o.getPlugin=function(){return i},o.getNext=function(){return a},o.setNext=function(e){a=e},o.processTelemetry=function(n,r){r=r||t;var e=i?i.identifier:"TelemetryPluginChain";Oe(r?r.core():null,function(){return e+":processTelemetry"},function(){if(i&&s){o._hasRun=!0;try{r.setNext(a),c&&i.setNextPlugin(a),a&&(a._hasRun=!1),i.processTelemetry(n,r)}catch(t){var e=a&&a._hasRun;a&&e||r.diagLog().throwInternal(Q.CRITICAL,73,"Plugin ["+i.identifier+"] failed during processTelemetry - "+t),a&&!e&&a.processTelemetry(n,r)}}else a&&(o._hasRun=!0,a.processTelemetry(n,r))},function(){return{item:n}},!n.sync)}},Ve=J.isNullOrUndefined;function Ge(e,t){var n=[];if(e&&0<e.length)for(var r=null,i=0;i<e.length;i++){var o=e[i];o&&J.isFunction(o.processTelemetry)&&(o=new ze(o,t),n.push(o),r&&r.setNext(o),r=o)}return 0<n.length?n[0]:null}var je=function jn(e,i,n,t){var r,o,a,s,c=this,u=null;null!==t&&(e&&J.isFunction(e.getPlugin)?u=function(e,t,n){var r=[],i=!n;if(e)for(;e;){var o=e.getPlugin();!i&&o!==n||(i=!0,r.push(o)),e=e.getNext()}return i||r.push(n),Ge(r,t)}(e,c,t||e.getPlugin()):t?(r=c,a=e,s=!1,(o=t)&&e&&(a=[],J.arrForEach(e,function(e){!s&&e!==o||(s=!0,a.push(e))})),o&&!s&&(a=a||[]).push(o),u=Ge(a,r)):J.isUndefined(t)&&(u=Ge(e,c))),c.core=function(){return n},c.diagLog=function(){return(n||{}).logger||new Pe(i||{})},c.getCfg=function(){return i},c.getExtCfg=function(e,t){var n,r;return void 0===t&&(t={}),!i||(r=i.extensionConfig)&&e&&(n=r[e]),n||t},c.getConfig=function(e,t,n){var r;return void 0===n&&(n=!1),(e=c.getExtCfg(e,null))&&!Ve(e[t])?r=e[t]:i&&!Ve(i[t])&&(r=i[t]),Ve(r)?n:r},c.hasNext=function(){return null!=u},c.getNext=function(){return u},c.setNext=function(e){u=e},c.processNext=function(e){var t=u;t&&(u=t.getNext(),t.processTelemetry(e,c))},c.createNew=function(e,t){return void 0===e&&(e=null),new jn(e||u,i,n,t)}},qe=J.isFunction,Fe="getPlugin",Be=(Ke.prototype.initialize=function(e,t,n,r){this._baseTelInit(e,t,n,r)},Ke);function Ke(){var o=this,a=!1,s=null,c=null;o.core=null,o.diagLog=function(e){return o._getTelCtx(e).diagLog()},o.isInitialized=function(){return a},o.setInitialized=function(e){a=e},o.setNextPlugin=function(e){c=e},o.processNext=function(e,t){t?t.processNext(e):c&&qe(c.processTelemetry)&&c.processTelemetry(e,null)},o._getTelCtx=function(e){void 0===e&&(e=null);var t=e;return t||(e=s||new je(null,{},o.core),t=c&&c[Fe]?e.createNew(null,c[Fe]):e.createNew(null,c)),t},o._baseTelInit=function(e,t,n,r){e&&(e.extensionConfig=e.extensionConfig||[]),!r&&t&&(r=t.getProcessTelContext().getNext());var i=c;c&&c[Fe]&&(i=c[Fe]()),o.core=t,s=new je(r,e,t,i),a=!0}}var We=J.isFunction,He="processTelemetry",Xe="priority",Je="setNextPlugin",$e="isInitialized";function Qe(t,n){for(var e=[],r=null,i=t.getNext();i;){var o=i.getPlugin();o&&(r&&We(r[Je])&&We(o[He])&&r[Je](o),We(o[$e])&&o[$e]()||e.push(o),r=o,i=i.getNext())}J.arrForEach(e,function(e){e.initialize(t.getCfg(),t.core(),n,t.getNext())})}function Ye(e){return e.sort(function(e,t){var n=0,r=We(t[He]);return We(e[He])?n=r?e[Xe]-t[Xe]:1:r&&(n=-1),n})}var Ze,et=500,tt="Channel has invalid priority",nt=J.objDefineAccessors,rt=(Ze=Be,__extends(it,Ze),it._staticInit=(nt(it.prototype,"ChannelControls",it.prototype.getChannelControls),void nt(it.prototype,"channelQueue",it.prototype.getChannelControls)),it);function it(){var r=Ze.call(this)||this;r.identifier="ChannelControllerPlugin",r.priority=et;var c,u=J.arrForEach;function l(e){e&&0<e.length&&(e=e.sort(function(e,t){return e.priority-t.priority}),u(e,function(e){if(e.priority<et)throw Error(tt+e.identifier)}),c.push(e))}return Ee(it,r,function(a,s){a.setNextPlugin=function(e){},a.processTelemetry=function(t,n){c&&u(c,function(e){0<e.length&&r._getTelCtx(n).createNew(e).processNext(t)})},a.getChannelControls=function(){return c},a.initialize=function(t,n,r){var e,i,o;a.isInitialized()||(s.initialize(t,n,r),t.isCookieUseDisabled&&J.disableCookies(),i=r,c=[],(e=(t||{}).channels)&&u(e,l),i&&(o=[],u(i,function(e){e.priority>et&&o.push(e)}),l(o)),u(c,function(e){return Qe(new je(e,t,n),r)}))}}),r}var ot=J.arrForEach,at=J.isNullOrUndefined,st="_notificationManager",ct=function qn(e){this.listeners=[];var o=J.arrForEach,t=!!(e||{}).perfEvtsSendAll;Ee(qn,this,function(i){i.addNotificationListener=function(e){i.listeners.push(e)},i.removeNotificationListener=function(e){for(var t=J.arrIndexOf(i.listeners,e);-1<t;)i.listeners.splice(t,1),t=J.arrIndexOf(i.listeners,e)},i.eventsSent=function(t){o(i.listeners,function(e){e&&e.eventsSent&&setTimeout(function(){return e.eventsSent(t)},0)})},i.eventsDiscarded=function(t,n){o(i.listeners,function(e){e&&e.eventsDiscarded&&setTimeout(function(){return e.eventsDiscarded(t,n)},0)})},i.eventsSendRequest=function(n,r){o(i.listeners,function(e){if(e&&e.eventsSendRequest)if(r)setTimeout(function(){return e.eventsSendRequest(n,r)},0);else try{e.eventsSendRequest(n,r)}catch(t){}})},i.perfEvent=function(n){n&&(!t&&n.isChildEvt()||o(i.listeners,function(e){if(e&&e.perfEvent)if(n.isAsync)setTimeout(function(){return e.perfEvent(n)},0);else try{e.perfEvent(n)}catch(t){}}))}})},ut=function Fn(){var t,s,c,n,u=!1;Ee(Fn,this,function(a){a._extensions=[],s=new rt,a.logger=J.objCreate({throwInternal:function(e,t,n,r,i){void 0===i&&(i=!1)},warnToConsole:function(e){},resetInternalMessageCount:function(){}}),t=[],a.isInitialized=function(){return u},a.initialize=function(e,t,r,n){if(a.isInitialized())throw Error("Core should not be initialized more than once");if(!e||at(e.instrumentationKey))throw Error("Please provide instrumentation key");c=n,a[st]=n,a.config=e||{},e.extensions=at(e.extensions)?[]:e.extensions,(e.extensionConfig=at(e.extensionConfig)?{}:e.extensionConfig).NotificationManager=n,r&&(a.logger=r),(n=[]).push.apply(n,t.concat(e.extensions)),n=Ye(n);var i=[],o={};if(ot(n,function(e){if(at(e)||at(e.initialize))throw Error("Extensions must provide callback to initialize");var t=e.priority,n=e.identifier;e&&t&&(at(o[t])?o[t]=n:r.warnToConsole("Two extensions have same priority #"+t+" - "+o[t]+", "+n)),(!t||t<s.priority)&&i.push(e)}),n.push(s),i.push(s),n=Ye(n),a._extensions=n,Qe(new je([s],e,a),n),Qe(new je(i,e,a),n),a._extensions=i,0===a.getTransmissionControls().length)throw Error("No channels available");u=!0,a.releaseQueue()},a.getTransmissionControls=function(){return s.getChannelControls()},a.track=function(e){e.iKey||(e.iKey=a.config.instrumentationKey),e.time||(e.time=J.toISOString(new Date)),at(e.ver)&&(e.ver="4.0"),a.isInitialized()?a.getProcessTelContext().processNext(e):t.push(e)},a.getProcessTelContext=function(){var e=a._extensions,t=e;return e&&0!==e.length||(t=[s]),new je(t,a.config,a)},a.getNotifyMgr=function(){return c||(c=J.objCreate({addNotificationListener:function(e){},removeNotificationListener:function(e){},eventsSent:function(e){},eventsDiscarded:function(e,t){},eventsSendRequest:function(e,t){}}),a[st]=c),c},a.getPerfMgr=function(){return n||a.config&&a.config.enablePerfMgr&&(n=new Me(a.getNotifyMgr())),n},a.setPerfMgr=function(e){n=e},a.eventCnt=function(){return t.length},a.releaseQueue=function(){0<t.length&&(ot(t,function(e){a.getProcessTelContext().processNext(e)}),t=[])}})};__extends(function Bn(){var e=ut.call(this)||this;return Ee(Bn,e,function(n,i){function t(e){var t=n.getNotifyMgr();t&&t.eventsDiscarded([e],l)}n.initialize=function(e,t,n,r){i.initialize(e,t,n||new Pe(e),r||new ct(e))},n.track=function(e){Oe(n.getPerfMgr(),function(){return"AppInsightsCore:track"},function(){if(null===e)throw t(e),Error("Invalid telemetry item");!function(e){if(J.isNullOrUndefined(e.name))throw t(e),Error("telemetry name required")}(e),i.track(e)},function(){return{item:e}},!e.sync)},n.addNotificationListener=function(e){var t=n.getNotifyMgr();t&&t.addNotificationListener(e)},n.removeNotificationListener=function(e){var t=n.getNotifyMgr();t&&t.removeNotificationListener(e)},n.pollInternalLogs=function(t){var e=n.config.diagnosticLogInterval;return e&&0<e||(e=1e4),setInterval(function(){var e=n.logger?n.logger.queue:[];J.arrForEach(e,function(e){e={name:t||"InternalMessageId: "+e.messageId,iKey:n.config.instrumentationKey,time:J.toISOString(new Date),baseType:be.dataType,baseData:{message:e.message}},n.track(e)}),e.length=0},e)}}),e},ut);var lt=(ft.sanitizeKeyAndAddUniqueness=function(e,t,n){var r=t.length,i=ft.sanitizeKey(e,t);if(i.length!==r){for(var o=0,a=i;n[a]!==undefined;)o++,a=i.substring(0,ft.MAX_NAME_LENGTH-3)+ft.padNumber(o);i=a}return i},ft.sanitizeKey=function(e,t){var n;return t&&(t=ft.trim(t.toString())).length>ft.MAX_NAME_LENGTH&&(n=t.substring(0,ft.MAX_NAME_LENGTH),e.throwInternal(Q.WARNING,57,"name is too long. It has been truncated to "+ft.MAX_NAME_LENGTH+" characters.",{name:t},!0)),n||t},ft.sanitizeString=function(e,t,n){var r;return void 0===n&&(n=ft.MAX_STRING_LENGTH),t&&(n=n||ft.MAX_STRING_LENGTH,(t=ft.trim(t)).toString().length>n&&(r=t.toString().substring(0,n),e.throwInternal(Q.WARNING,61,"string value is too long. It has been truncated to "+n+" characters.",{value:t},!0))),r||t},ft.sanitizeUrl=function(e,t){return ft.sanitizeInput(e,t,ft.MAX_URL_LENGTH,66)},ft.sanitizeMessage=function(e,t){var n;return t&&t.length>ft.MAX_MESSAGE_LENGTH&&(n=t.substring(0,ft.MAX_MESSAGE_LENGTH),e.throwInternal(Q.WARNING,56,"message is too long, it has been truncated to "+ft.MAX_MESSAGE_LENGTH+" characters.",{message:t},!0)),n||t},ft.sanitizeException=function(e,t){var n;return t&&t.length>ft.MAX_EXCEPTION_LENGTH&&(n=t.substring(0,ft.MAX_EXCEPTION_LENGTH),e.throwInternal(Q.WARNING,52,"exception is too long, it has been truncated to "+ft.MAX_EXCEPTION_LENGTH+" characters.",{exception:t},!0)),n||t},ft.sanitizeProperties=function(r,e){var i;return e&&(i={},X(e,function(e,t){if(J.isObject(t)&&E())try{t=C().stringify(t)}catch(n){r.throwInternal(Q.WARNING,49,"custom property is not valid",{exception:n},!0)}t=ft.sanitizeString(r,t,ft.MAX_PROPERTY_LENGTH),e=ft.sanitizeKeyAndAddUniqueness(r,e,i),i[e]=t}),e=i),e},ft.sanitizeMeasurements=function(n,e){var r;return e&&(r={},X(e,function(e,t){e=ft.sanitizeKeyAndAddUniqueness(n,e,r),r[e]=t}),e=r),e},ft.sanitizeId=function(e,t){return t&&ft.sanitizeInput(e,t,ft.MAX_ID_LENGTH,69).toString()},ft.sanitizeInput=function(e,t,n,r){var i;return t&&(t=ft.trim(t)).length>n&&(i=t.substring(0,n),e.throwInternal(Q.WARNING,r,"input is too long, it has been truncated to "+n+" characters.",{data:t},!0)),i||t},ft.padNumber=function(e){return(e="00"+e).substr(e.length-3)},ft.trim=function(e){return J.isString(e)?e.replace(/^\s+|\s+$/g,""):e},ft.MAX_NAME_LENGTH=150,ft.MAX_ID_LENGTH=128,ft.MAX_PROPERTY_LENGTH=8192,ft.MAX_STRING_LENGTH=1024,ft.MAX_URL_LENGTH=2048,ft.MAX_MESSAGE_LENGTH=32768,ft.MAX_EXCEPTION_LENGTH=32768,ft);function ft(){}var gt=I(),pt=J.isString,dt=null,mt=(ht.createDomEvent=function(e){var t,n=null;return J.isFunction(Event)?n=new Event(e):(t=T())&&t.createEvent&&(n=t.createEvent("Event")).initEvent(e,!0,!0),n},ht.disableStorage=function(){ht._canUseLocalStorage=!1,ht._canUseSessionStorage=!1},ht._getLocalStorageObject=function(){return ht.canUseLocalStorage()?ht._getVerifiedStorageObject(c.LocalStorage):null},ht._getVerifiedStorageObject=function(e){var t,n,r=null;try{if(J.isNullOrUndefined(y()))return null;n=new Date,(r=x(e===c.LocalStorage?"localStorage":"sessionStorage")).setItem(n.toString(),n.toString()),t=r.getItem(n.toString())!==n.toString(),r.removeItem(n.toString()),t&&(r=null)}catch(i){r=null}return r},ht.isInternalApplicationInsightsEndpoint=function(e){return!!~ht._internalEndpoints.indexOf(e.toLowerCase())},ht.canUseLocalStorage=function(){return ht._canUseLocalStorage===undefined&&(ht._canUseLocalStorage=!!ht._getVerifiedStorageObject(c.LocalStorage)),ht._canUseLocalStorage},ht.getStorage=function(e,t){var n=ht._getLocalStorageObject();if(null!==n)try{return n.getItem(t)}catch(r){ht._canUseLocalStorage=!1,e.throwInternal(Q.WARNING,1,"Browser failed read of local storage. "+ht.getExceptionName(r),{exception:ht.dump(r)})}return null},ht.setStorage=function(e,t,n){var r=ht._getLocalStorageObject();if(null!==r)try{return r.setItem(t,n),!0}catch(i){ht._canUseLocalStorage=!1,e.throwInternal(Q.WARNING,3,"Browser failed write to local storage. "+ht.getExceptionName(i),{exception:ht.dump(i)})}return!1},ht.removeStorage=function(e,t){var n=ht._getLocalStorageObject();if(null!==n)try{return n.removeItem(t),!0}catch(r){ht._canUseLocalStorage=!1,e.throwInternal(Q.WARNING,5,"Browser failed removal of local storage item. "+ht.getExceptionName(r),{exception:ht.dump(r)})}return!1},ht._getSessionStorageObject=function(){return ht.canUseSessionStorage()?ht._getVerifiedStorageObject(c.SessionStorage):null},ht.canUseSessionStorage=function(){return ht._canUseSessionStorage===undefined&&(ht._canUseSessionStorage=!!ht._getVerifiedStorageObject(c.SessionStorage)),ht._canUseSessionStorage},ht.getSessionStorageKeys=function(){var t=[];return ht.canUseSessionStorage()&&X(x("sessionStorage"),function(e){t.push(e)}),t},ht.getSessionStorage=function(e,t){var n=ht._getSessionStorageObject();if(null!==n)try{return n.getItem(t)}catch(r){ht._canUseSessionStorage=!1,e.throwInternal(Q.WARNING,2,"Browser failed read of session storage. "+ht.getExceptionName(r),{exception:ht.dump(r)})}return null},ht.setSessionStorage=function(e,t,n){var r=ht._getSessionStorageObject();if(null!==r)try{return r.setItem(t,n),!0}catch(i){ht._canUseSessionStorage=!1,e.throwInternal(Q.WARNING,4,"Browser failed write to session storage. "+ht.getExceptionName(i),{exception:ht.dump(i)})}return!1},ht.removeSessionStorage=function(e,t){var n=ht._getSessionStorageObject();if(null!==n)try{return n.removeItem(t),!0}catch(r){ht._canUseSessionStorage=!1,e.throwInternal(Q.WARNING,6,"Browser failed removal of session storage item. "+ht.getExceptionName(r),{exception:ht.dump(r)})}return!1},ht.disableCookies=function(){J.disableCookies()},ht.canUseCookies=function(e){if(J._canUseCookies===undefined){J._canUseCookies=!1;try{J._canUseCookies=ht.document.cookie!==undefined}catch(t){e.throwInternal(Q.WARNING,68,"Cannot access document.cookie - "+ht.getExceptionName(t),{exception:ht.dump(t)})}}return J._canUseCookies},ht.disallowsSameSiteNone=function(e){return!(!pt(e)||!~e.indexOf("CPU iPhone OS 12")&&!~e.indexOf("iPad; CPU OS 12")&&!(~e.indexOf("Macintosh; Intel Mac OS X 10_14")&&~e.indexOf("Version/")&&~e.indexOf("Safari"))&&(!~e.indexOf("Macintosh; Intel Mac OS X 10_14")||(n=(t=e.length)-40,"AppleWebKit/605.1.15 (KHTML, like Gecko)"!=e.substring(0<=n?n:0,t)))&&!~e.indexOf("Chrome/5")&&!~e.indexOf("Chrome/6")&&(!~e.indexOf("UnrealEngine")||~e.indexOf("Chrome"))&&!~e.indexOf("UCBrowser/12")&&!~e.indexOf("UCBrowser/11"));var t,n},ht.setCookie=function(e,t,n,r){var i;ht.canUseCookies(e)&&(e=i="",r&&(i=";domain="+r),(r=w())&&"https:"===r.protocol&&(e=";secure",null===dt&&(dt=ht.disallowsSameSiteNone((I()||{}).userAgent)),dt||(n+=";SameSite=None")),ht.document.cookie=t+"="+n+i+";path=/"+e)},ht.stringToBoolOrDefault=function(e,t){return void 0===t&&(t=!1),e===undefined||null===e?t:"true"==e.toString().toLowerCase()},ht.getCookie=function(e,t){if(ht.canUseCookies(e)){var n="";if(t&&t.length)for(var r=t+"=",i=ht.document.cookie.split(";"),o=0;o<i.length;o++){var a=i[o];if((a=ht.trim(a))&&!a.indexOf(r)){n=a.substring(r.length,i[o].length);break}}return n}},ht.deleteCookie=function(e,t){ht.canUseCookies(e)&&(ht.document.cookie=t+"=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;")},ht.random32=function(){return J.random32(!0)},ht.getIEVersion=function(e){return void 0===e&&(e=null),~(e=e?e.toLowerCase():gt?(gt.userAgent||"").toLowerCase():"").indexOf("msie")?parseInt(e.split("msie")[1]):e.indexOf("trident/")&&(e=parseInt(e.split("trident/")[1]))?e+4:null},ht.msToTimeSpan=function(e){(isNaN(e)||e<0)&&(e=0);var t=""+(e=Math.round(e))%1e3,n=""+Math.floor(e/1e3)%60,r=""+Math.floor(e/6e4)%60,i=""+Math.floor(e/36e5)%24,e=Math.floor(e/864e5),t=1===t.length?"00"+t:2===t.length?"0"+t:t,n=n.length<2?"0"+n:n,r=r.length<2?"0"+r:r;return(0<e?e+".":"")+(i=i.length<2?"0"+i:i)+":"+r+":"+n+"."+t},ht.isCrossOriginError=function(e,t,n,r,i){return("Script error."===e||"Script error"===e)&&!i},ht.dump=function(e){var t=Object[g].toString.call(e),n="";return"[object Error]"===t?n="{ stack: '"+e.stack+"', message: '"+e.message+"', name: '"+e.name+"'":E()&&(n=C().stringify(e)),t+n},ht.getExceptionName=function(e){return"[object Error]"===Object[g].toString.call(e)?e.name:""},ht.addEventHandler=function(e,t){return Z.Attach(S(),e,t)},ht.IsBeaconApiSupported=function(){return"sendBeacon"in gt&&gt.sendBeacon},ht.getExtension=function(e,t){for(var n=null,r=0;!n&&r<e.length;)e[r]&&e[r].identifier===t&&(n=e[r]),r++;return n},ht.document=T()||{},ht._canUseLocalStorage=undefined,ht._canUseSessionStorage=undefined,ht._internalEndpoints=["https://dc.services.visualstudio.com/v2/track","https://breeze.aimon.applicationinsights.io/v2/track","https://dc-int.services.visualstudio.com/v2/track"],ht.NotSpecified="not_specified",ht.trim=J.strTrim,ht.newId=J.newId,ht.generateW3CId=J.generateW3CId,ht.isArray=J.isArray,ht.isError=J.isError,ht.isDate=J.isDate,ht.toISOStringForIE8=J.toISOString,ht);function ht(){}var vt=(yt.parseUrl=function(e){var t=yt._htmlAnchorIdx,n=yt._htmlAnchorElement,r=n[t];return yt.document.createElement?n[t]||(r=n[t]=yt.document.createElement("a")):r={host:yt.parseHost(e,!0)},r.href=e,++t>=n.length&&(t=0),yt._htmlAnchorIdx=t,r},yt.getAbsoluteUrl=function(e){var t;return(e=yt.parseUrl(e))&&(t=e.href),t},yt.getPathName=function(e){var t;return(e=yt.parseUrl(e))&&(t=e.pathname),t},yt.getCompleteUrl=function(e,t){return e?e.toUpperCase()+" "+t:t},yt.parseHost=function(e,t){return(e=yt.parseFullHost(e,t))&&null!=(t=e.match(/(www[0-9]?\.)?(.[^/:]+)(\:[\d]+)?/i))&&3<t.length&&pt(t[2])&&0<t[2].length?t[2]+(t[3]||""):e},yt.parseFullHost=function(e,t){var n=null;return!e||null!=(e=e.match(/(\w*):\/\/(.[^/:]+)(\:[\d]+)?/i))&&2<e.length&&pt(e[2])&&0<e[2].length&&(n=e[2]||"",t&&2<e.length&&(t=(e[1]||"").toLowerCase(),e=e[3]||"",("http"==t&&":80"===e||"https"==t&&":443"===e)&&(e=""),n+=e)),n},yt.document=T()||{},yt._htmlAnchorIdx=0,yt._htmlAnchorElement=[null,null,null,null,null],yt);function yt(){}var xt=(_t.ParseDependencyPath=function(e,t,n,r){var i,o,a,s=r,c=r,s=t&&0<t.length?(a=(i=vt.parseUrl(t)).host,s||(null!=i.pathname?("/"!=(o=0===i.pathname.length?"/":i.pathname)[0]&&(o="/"+o),c=i.pathname,lt.sanitizeString(e,n?n+" "+o:o)):lt.sanitizeString(e,t))):a=r;return{target:a,name:s,data:c}},_t);function _t(){}var St=(Tt.Now=function(){var e=N();return e&&e.now&&e.timing&&0<(e=e.now()+e.timing.navigationStart)?e:(new Date).getTime()},Tt.GetDuration=function(e,t){var n=null;return 0===e||0===t||J.isNullOrUndefined(e)||J.isNullOrUndefined(t)||(n=t-e),n},Tt);function Tt(){}var It,wt=(__extends(Nt,function(){}),Nt);function Nt(){return this}It=function(){this.ver=1,this.sampleRate=100,this.tags={}},__extends(function(e,t,n){var r=It.call(this)||this;return r.name=lt.sanitizeString(e,n)||mt.NotSpecified,r.data=t,r.time=J.toISOString(new Date),r.aiDataContract={time:p.Required,iKey:p.Required,name:p.Required,sampleRate:function(){return 100===r.sampleRate?p.Hidden:p.Required},tags:p.Required,data:p.Required},r},It);var Et,Ct=(Et=pn=function(){},__extends(bt,Et),bt);function bt(){var e=Et.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var Dt,Pt=(Dt=Ct,__extends(kt,Dt),kt.envelopeType="Microsoft.ApplicationInsights.{0}.Event",kt.dataType="EventData",kt);function kt(e,t,n,r){var i=Dt.call(this)||this;return i.aiDataContract={ver:p.Required,name:p.Required,properties:p.Default,measurements:p.Default},i.name=lt.sanitizeString(e,t)||mt.NotSpecified,i.properties=lt.sanitizeProperties(e,n),i.measurements=lt.sanitizeMeasurements(e,r),i}var At,Lt=function(){},Mt=(At=pn,__extends(Rt,At),Rt);function Rt(){var e=At.call(this)||this;return e.ver=2,e.exceptions=[],e.properties={},e.measurements={},e}var Ot,nt=function(){this.hasFullStack=!0,this.parsedStack=[]},Ut="error",zt=(Ot=Mt,__extends(Vt,Ot),Vt.CreateFromInterface=function(t,e,n,r){var i=e.exceptions&&J.arrMap(e.exceptions,function(e){return jt.CreateFromInterface(t,e)});return new Vt(t,__assign({},e,{exceptions:i}),n,r)},Vt.prototype.toInterface=function(){var e=this.exceptions,t=this.properties,n=this.measurements,r=this.severityLevel,i=(this.ver,this.problemGroup),o=this.id,a=this.isManual;return{ver:"4.0",exceptions:e instanceof Array&&J.arrMap(e,function(e){return e.toInterface()})||undefined,severityLevel:r,properties:t,measurements:n,problemGroup:i,id:o,isManual:a}},Vt.CreateSimpleException=function(e,t,n,r,i,o){return{exceptions:[{hasFullStack:!0,message:e,stack:i,typeName:t}]}},Vt.envelopeType="Microsoft.ApplicationInsights.{0}.Exception",Vt.dataType="ExceptionData",Vt);function Vt(e,t,n,r,i,o){var a,s=Ot.call(this)||this;return s.aiDataContract={ver:p.Required,exceptions:p.Required,severityLevel:p.Default,properties:p.Default,measurements:p.Default},"ver"in(a=t)&&"exceptions"in a&&"properties"in a?(s.exceptions=t.exceptions,s.properties=t.properties,s.measurements=t.measurements,t.severityLevel&&(s.severityLevel=t.severityLevel),t.id&&(s.id=t.id),t.problemGroup&&(s.problemGroup=t.problemGroup),s.ver=2,J.isNullOrUndefined(t.isManual)||(s.isManual=t.isManual)):(s.exceptions=[new jt(e,t)],s.properties=lt.sanitizeProperties(e,n)||{},s.measurements=lt.sanitizeMeasurements(e,r),i&&(s.severityLevel=i),o&&(s.id=o)),s}var Gt,jt=(Gt=nt,__extends(qt,Gt),qt.prototype.toInterface=function(){var e=this.parsedStack instanceof Array&&J.arrMap(this.parsedStack,function(e){return e.toInterface()});return{id:this.id,outerId:this.outerId,typeName:this.typeName,message:this.message,hasFullStack:this.hasFullStack,stack:this.stack,parsedStack:e||undefined}},qt.CreateFromInterface=function(e,t){var n=t.parsedStack instanceof Array&&J.arrMap(t.parsedStack,function(e){return Bt.CreateFromInterface(e)})||t.parsedStack;return new qt(e,__assign({},t,{parsedStack:n}))},qt.parseStack=function(e){if(J.isString(e)){for(var t=e.split("\n"),n=[],r=0,i=0,o=0;o<=t.length;o++){var a=t[o];Bt.regex.test(a)&&(i+=(a=new Bt(t[o],r++)).sizeInBytes,n.push(a))}if(32768<i)for(var s=0,c=n.length-1,u=0,l=s,f=c;s<c;){if(32768<(u+=n[s].sizeInBytes+n[c].sizeInBytes)){var g=f-l+1;n.splice(l,g);break}l=s,f=c,s++,c--}}return n},qt);function qt(e,t){var n,r=Gt.call(this)||this;return r.aiDataContract={id:p.Default,outerId:p.Default,typeName:p.Required,message:p.Required,hasFullStack:p.Default,stack:p.Default,parsedStack:p.Array},"hasFullStack"in(n=t)&&"typeName"in n?(r.typeName=t.typeName,r.message=t.message,r.stack=t.stack,r.parsedStack=t.parsedStack,r.hasFullStack=t.hasFullStack):(n=t,mt.isError(n)||(n=n[Ut]||n.evt||n),r.typeName=lt.sanitizeString(e,function(e){var t="";if(e&&!(t=e.typeName||e.name||""))try{var n=/function (.{1,})\(/.exec(e.constructor.toString()),t=n&&1<n.length?n[1]:""}catch(r){}return t}(n))||mt.NotSpecified,r.message=lt.sanitizeMessage(e,t.message)||mt.NotSpecified,t=t.stack,r.parsedStack=qt.parseStack(t),r.stack=lt.sanitizeException(e,t),r.hasFullStack=mt.isArray(r.parsedStack)&&0<r.parsedStack.length),r}var Ft,Bt=(Ft=Lt,__extends(Kt,Ft),Kt.CreateFromInterface=function(e){return new Kt(e,null)},Kt.prototype.toInterface=function(){return{level:this.level,method:this.method,assembly:this.assembly,fileName:this.fileName,line:this.line}},Kt.regex=/^([\s]+at)?(.*?)(\@|\s\(|\s)([^\(\@\n]+):([0-9]+):([0-9]+)(\)?)$/,Kt.baseSize=58,Kt);function Kt(e,t){var n,r=Ft.call(this)||this;return r.sizeInBytes=0,r.aiDataContract={level:p.Required,method:p.Required,assembly:p.Default,fileName:p.Default,line:p.Default},"string"==typeof e?(n=e,r.level=t,r.method="<no_method>",r.assembly=mt.trim(n),r.fileName="",r.line=0,(n=n.match(Kt.regex))&&5<=n.length&&(r.method=mt.trim(n[2])||r.method,r.fileName=mt.trim(n[4]),r.line=parseInt(n[5])||0)):(r.level=e.level,r.method=e.method,r.assembly=e.assembly,r.fileName=e.fileName,r.line=e.line,r.sizeInBytes=0),r.sizeInBytes+=r.method.length,r.sizeInBytes+=r.fileName.length,r.sizeInBytes+=r.assembly.length,r.sizeInBytes+=Kt.baseSize,r.sizeInBytes+=r.level.toString().length,r.sizeInBytes+=r.line.toString().length,r}var Wt,Ht,nt=(Wt=pn,__extends(Xt,Wt),Xt);function Xt(){var e=Wt.call(this)||this;return e.ver=2,e.metrics=[],e.properties={},e.measurements={},e}(Lt=Ht={})[Lt.Measurement=0]="Measurement",Lt[Lt.Aggregation=1]="Aggregation";var Jt,$t=(Jt=function(){this.kind=Ht.Measurement},__extends(Qt,Jt),Qt);function Qt(){var e=Jt.apply(this,arguments)||this;return e.aiDataContract={name:p.Required,kind:p.Default,value:p.Required,count:p.Default,min:p.Default,max:p.Default,stdDev:p.Default},e}var Yt,Zt=(Yt=nt,__extends(en,Yt),en.envelopeType="Microsoft.ApplicationInsights.{0}.Metric",en.dataType="MetricData",en);function en(e,t,n,r,i,o,a,s){var c=Yt.call(this)||this;c.aiDataContract={ver:p.Required,metrics:p.Required,properties:p.Default};var u=new $t;return u.count=0<r?r:undefined,u.max=isNaN(o)||null===o?undefined:o,u.min=isNaN(i)||null===i?undefined:i,u.name=lt.sanitizeString(e,t)||mt.NotSpecified,u.value=n,c.metrics=[u],c.properties=lt.sanitizeProperties(e,a),c.measurements=lt.sanitizeMeasurements(e,s),c}var tn,nt=(tn=Ct,__extends(nn,tn),nn);function nn(){var e=tn.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var rn,on=(rn=nt,__extends(an,rn),an.envelopeType="Microsoft.ApplicationInsights.{0}.Pageview",an.dataType="PageviewData",an);function an(e,t,n,r,i,o,a){var s=rn.call(this)||this;return s.aiDataContract={ver:p.Required,name:p.Default,url:p.Default,duration:p.Default,properties:p.Default,measurements:p.Default,id:p.Default},s.id=lt.sanitizeId(e,a),s.url=lt.sanitizeUrl(e,n),s.name=lt.sanitizeString(e,t)||mt.NotSpecified,isNaN(r)||(s.duration=mt.msToTimeSpan(r)),s.properties=lt.sanitizeProperties(e,i),s.measurements=lt.sanitizeMeasurements(e,o),s}var sn,Ct=(sn=pn,__extends(cn,sn),cn);function cn(){var e=sn.call(this)||this;return e.ver=2,e.success=!0,e.properties={},e.measurements={},e}var un,ln=(un=Ct,__extends(fn,un),fn.envelopeType="Microsoft.ApplicationInsights.{0}.RemoteDependency",fn.dataType="RemoteDependencyData",fn);function fn(e,t,n,r,i,o,a,s,c,u,l,f){void 0===c&&(c="Ajax");var g=un.call(this)||this;return g.aiDataContract={id:p.Required,ver:p.Required,name:p.Default,resultCode:p.Default,duration:p.Default,success:p.Default,data:p.Default,target:p.Default,type:p.Default,properties:p.Default,measurements:p.Default,kind:p.Default,value:p.Default,count:p.Default,min:p.Default,max:p.Default,stdDev:p.Default,dependencyKind:p.Default,dependencySource:p.Default,commandName:p.Default,dependencyTypeName:p.Default},g.id=t,g.duration=mt.msToTimeSpan(i),g.success=o,g.resultCode=a+"",g.type=lt.sanitizeString(e,c),s=xt.ParseDependencyPath(e,n,s,r),g.data=lt.sanitizeUrl(e,r)||s.data,g.target=lt.sanitizeString(e,s.target),u&&(g.target=g.target+" | "+u),g.name=lt.sanitizeString(e,s.name),g.properties=lt.sanitizeProperties(e,l),g.measurements=lt.sanitizeMeasurements(e,f),g}var gn,pn=(gn=pn,__extends(dn,gn),dn);function dn(){var e=gn.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var mn,hn=(mn=pn,__extends(vn,mn),vn.envelopeType="Microsoft.ApplicationInsights.{0}.Message",vn.dataType="MessageData",vn);function vn(e,t,n,r,i){var o=mn.call(this)||this;return o.aiDataContract={ver:p.Required,message:p.Required,severityLevel:p.Default,properties:p.Default},t=t||mt.NotSpecified,o.message=lt.sanitizeMessage(e,t),o.properties=lt.sanitizeProperties(e,r),o.measurements=lt.sanitizeMeasurements(e,i),n&&(o.severityLevel=n),o}var yn,nt=(yn=nt,__extends(xn,yn),xn);function xn(){var e=yn.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var _n,Sn,Tn,In=(_n=nt,__extends(wn,_n),wn.envelopeType="Microsoft.ApplicationInsights.{0}.PageviewPerformance",wn.dataType="PageviewPerformanceData",wn);function wn(e,t,n,r,i,o,a){var s=_n.call(this)||this;return s.aiDataContract={ver:p.Required,name:p.Default,url:p.Default,duration:p.Default,perfTotal:p.Default,networkConnect:p.Default,sentRequest:p.Default,receivedResponse:p.Default,domProcessing:p.Default,properties:p.Default,measurements:p.Default},s.url=lt.sanitizeUrl(e,n),s.name=lt.sanitizeString(e,t)||mt.NotSpecified,s.properties=lt.sanitizeProperties(e,i),s.measurements=lt.sanitizeMeasurements(e,o),a&&(s.domProcessing=a.domProcessing,s.duration=a.duration,s.networkConnect=a.networkConnect,s.perfTotal=a.perfTotal,s.receivedResponse=a.receivedResponse,s.sentRequest=a.sentRequest),s}Sn=wt,__extends(function(e,t){var n=Sn.call(this)||this;return n.aiDataContract={baseType:p.Required,baseData:p.Required},n.baseType=e,n.baseData=t,n},Sn),(wt=Tn={})[wt.Verbose=0]="Verbose",wt[wt.Information=1]="Information",wt[wt.Warning=2]="Warning",wt[wt.Error=3]="Error",wt[wt.Critical=4]="Critical";var Nn=(En.create=function(e,t,n,r,i,o){if(n=lt.sanitizeString(r,n)||mt.NotSpecified,J.isNullOrUndefined(e)||J.isNullOrUndefined(t)||J.isNullOrUndefined(n))throw Error("Input doesn't contain all required fields");var a={name:n,time:J.toISOString(new Date),iKey:"",ext:o||{},tags:[],data:{},baseType:t,baseData:e};return J.isNullOrUndefined(i)||X(i,function(e,t){a.data[e]=t}),a},En);function En(){}var Cn=function Kn(h,v,t,y){Ee(Kn,this,function(e){var l,n=J.arrForEach,f=J.isNullOrUndefined,g=null,p=[],d=!1;function m(){t&&n(t.getTransmissionControls(),function(e){n(e,function(e){return e.flush(!0)})})}t&&(l=t.logger),e.trackPageView=function(r,i){var o=r.name;!f(o)&&"string"==typeof o||(e=T(),o=r.name=e&&e.title||"");var e,a=r.uri;if(!f(a)&&"string"==typeof a||(e=w(),a=r.uri=e&&e.href||""),!y.isPerformanceTimingSupported())return h.sendPageViewInternal(r,i),m(),void l.throwInternal(Q.WARNING,25,"trackPageView: navigation timing API used for calculation of page duration is not supported in this browser. This page view will be collected without duration and timing info.");var s,t,c=!1,u=y.getPerformanceTiming().navigationStart;0<u&&(s=St.GetDuration(u,+new Date),y.shouldCollectDuration(s)||(s=undefined)),f(i)||f(i.duration)||(t=i.duration),!v&&isNaN(t)||(isNaN(t)&&((i=i||{}).duration=s),h.sendPageViewInternal(r,i),m(),c=!0),i=i||{},t=function(){var e,t=!1;try{y.isPerformanceTimingDataReady()?(t=!0,e={name:o,uri:a},y.populatePageViewPerformanceEvent(e),e.isValid||c?(c||(i.duration=e.durationMs,h.sendPageViewInternal(r,i)),d||(h.sendPageViewPerformanceInternal(e,i),d=!0)):(i.duration=s,h.sendPageViewInternal(r,i))):0<u&&6e4<St.GetDuration(u,+new Date)&&(t=!0,c||(i.duration=6e4,h.sendPageViewInternal(r,i)))}catch(n){l.throwInternal(Q.CRITICAL,38,"trackPageView failed on page load calculation: "+mt.getExceptionName(n),{exception:mt.dump(n)})}return t},p.push(t),g=g||setInterval(function(){var e=p.slice(0),t=!1;p=[],n(e,function(e){e()?t=!0:p.push(e)}),0===p.length&&(clearInterval(g),g=null),t&&m()},100)}})},bn=(Dn.prototype.trackPreviousPageVisit=function(e,t){try{var n=this.restartPageVisitTimer(e,t);n&&this.pageVisitTimeTrackingHandler(n.pageName,n.pageUrl,n.pageVisitTime)}catch(r){this._logger.warnToConsole("Auto track page visit time failed, metric will not be collected: "+mt.dump(r))}},Dn.prototype.restartPageVisitTimer=function(e,t){try{var n=this.stopPageVisitTimer();return this.startPageVisitTimer(e,t),n}catch(r){return this._logger.warnToConsole("Call to restart failed: "+mt.dump(r)),null}},Dn.prototype.startPageVisitTimer=function(e,t){try{if(mt.canUseSessionStorage()){if(null!=mt.getSessionStorage(this._logger,this.prevPageVisitDataKeyName))throw Error("Cannot call startPageVisit consecutively without first calling stopPageVisit");var n=new Pn(e,t),n=C().stringify(n);mt.setSessionStorage(this._logger,this.prevPageVisitDataKeyName,n)}}catch(r){this._logger.warnToConsole("Call to start failed: "+mt.dump(r))}},Dn.prototype.stopPageVisitTimer=function(){try{if(mt.canUseSessionStorage()){var e=J.dateNow(),t=mt.getSessionStorage(this._logger,this.prevPageVisitDataKeyName);return t&&E()?((t=C().parse(t)).pageVisitTime=e-t.pageVisitStartTime,mt.removeSessionStorage(this._logger,this.prevPageVisitDataKeyName),t):null}return null}catch(n){return this._logger.warnToConsole("Stop page visit timer failed: "+mt.dump(n)),null}},Dn);function Dn(e,t){this.prevPageVisitDataKeyName="prevPageVisitData",this.pageVisitTimeTrackingHandler=t,this._logger=e}var Pn=function(e,t){this.pageVisitStartTime=J.dateNow(),this.pageName=e,this.pageUrl=t},kn=(An.prototype.populatePageViewPerformanceEvent=function(e){e.isValid=!1;var t,n,r,i,o=this.getPerformanceNavigationTiming(),a=this.getPerformanceTiming();(o||a)&&(a=o?(t=o.duration,n=St.GetDuration(o.startTime,o.connectEnd),r=St.GetDuration(o.requestStart,o.responseStart),i=St.GetDuration(o.responseStart,o.responseEnd),St.GetDuration(o.responseEnd,o.loadEventEnd)):(t=St.GetDuration(a.navigationStart,a.loadEventEnd),n=St.GetDuration(a.navigationStart,a.connectEnd),r=St.GetDuration(a.requestStart,a.responseStart),i=St.GetDuration(a.responseStart,a.responseEnd),St.GetDuration(a.responseEnd,a.loadEventEnd)),0===t?this._logger.throwInternal(Q.WARNING,10,"error calculating page view performance.",{total:t,network:n,request:r,response:i,dom:a}):this.shouldCollectDuration(t,n,r,i,a)?t<Math.floor(n)+Math.floor(r)+Math.floor(i)+Math.floor(a)?this._logger.throwInternal(Q.WARNING,8,"client performance math error.",{total:t,network:n,request:r,response:i,dom:a}):(e.durationMs=t,e.perfTotal=e.duration=mt.msToTimeSpan(t),e.networkConnect=mt.msToTimeSpan(n),e.sentRequest=mt.msToTimeSpan(r),e.receivedResponse=mt.msToTimeSpan(i),e.domProcessing=mt.msToTimeSpan(a),e.isValid=!0):this._logger.throwInternal(Q.WARNING,45,"Invalid page load duration value. Browser perf data won't be sent.",{total:t,network:n,request:r,response:i,dom:a}))},An.prototype.getPerformanceTiming=function(){return this.isPerformanceTimingSupported()?N().timing:null},An.prototype.getPerformanceNavigationTiming=function(){return this.isPerformanceNavigationTimingSupported()?N().getEntriesByType("navigation")[0]:null},An.prototype.isPerformanceNavigationTimingSupported=function(){var e=N();return e&&e.getEntriesByType&&0<e.getEntriesByType("navigation").length},An.prototype.isPerformanceTimingSupported=function(){var e=N();return e&&e.timing},An.prototype.isPerformanceTimingDataReady=function(){var e=N();return(e=e?e.timing:0)&&0<e.domainLookupStart&&0<e.navigationStart&&0<e.responseStart&&0<e.requestStart&&0<e.loadEventEnd&&0<e.responseEnd&&0<e.connectEnd&&0<e.domLoading},An.prototype.shouldCollectDuration=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=["googlebot","adsbot-google","apis-google","mediapartners-google"],r=(I()||{}).userAgent,i=!1;if(r)for(var o=0;o<n.length;o++)i=i||!!~r.toLowerCase().indexOf(n[o]);if(i)return!1;for(o=0;o<e.length;o++)if(e[o]<0||e[o]>=this.MAX_DURATION_ALLOWED)return!1;return!0},An);function An(e){this.MAX_DURATION_ALLOWED=36e5,e&&(this._logger=e.logger)}var Ln="duration";function Mn(e,t){e&&e.dispatchEvent&&t&&e.dispatchEvent(t)}var Rn,Be=(Rn=Be,__extends(On,Rn),On.getDefaultConfig=function(e){return(e=e||{}).sessionRenewalMs=18e5,e.sessionExpirationMs=864e5,e.disableExceptionTracking=mt.stringToBoolOrDefault(e.disableExceptionTracking),e.autoTrackPageVisitTime=mt.stringToBoolOrDefault(e.autoTrackPageVisitTime),e.overridePageViewDuration=mt.stringToBoolOrDefault(e.overridePageViewDuration),e.enableUnhandledPromiseRejectionTracking=mt.stringToBoolOrDefault(e.enableUnhandledPromiseRejectionTracking),(isNaN(e.samplingPercentage)||e.samplingPercentage<=0||100<=e.samplingPercentage)&&(e.samplingPercentage=100),e.isCookieUseDisabled=mt.stringToBoolOrDefault(e.isCookieUseDisabled),e.isStorageUseDisabled=mt.stringToBoolOrDefault(e.isStorageUseDisabled),e.isBrowserLinkTrackingEnabled=mt.stringToBoolOrDefault(e.isBrowserLinkTrackingEnabled),e.enableAutoRouteTracking=mt.stringToBoolOrDefault(e.enableAutoRouteTracking),e.namePrefix=e.namePrefix||"",e},On.prototype.processTelemetry=function(o,a){var s=this;Oe(this.core,function(){return s.identifier+":processTelemetry"},function(){var e=!1,t=s._telemetryInitializers.length;a=s._getTelCtx(a);for(var n=0;n<t;++n){var r=s._telemetryInitializers[n];if(r)try{if(!1===r.call(null,o)){e=!0;break}}catch(i){a.diagLog().throwInternal(Q.CRITICAL,64,"One of telemetry initializers failed, telemetry item will not be sent: "+mt.getExceptionName(i),{exception:mt.dump(i)},!0)}}e||s.processNext(o,a)},function(){return{item:o}},!o.sync)},On.prototype.trackEvent=function(e,t){try{var n=Nn.create(e,Pt.dataType,Pt.envelopeType,this.diagLog(),t);this.core.track(n)}catch(r){this.diagLog().throwInternal(Q.WARNING,39,"trackTrace failed, trace will not be collected: "+mt.getExceptionName(r),{exception:mt.dump(r)})}},On.prototype.startTrackEvent=function(e){try{this._eventTracking.start(e)}catch(t){this.diagLog().throwInternal(Q.CRITICAL,29,"startTrackEvent failed, event will not be collected: "+mt.getExceptionName(t),{exception:mt.dump(t)})}},On.prototype.stopTrackEvent=function(e,t,n){try{this._eventTracking.stop(e,undefined,t)}catch(r){this.diagLog().throwInternal(Q.CRITICAL,30,"stopTrackEvent failed, event will not be collected: "+mt.getExceptionName(r),{exception:mt.dump(r)})}},On.prototype.trackTrace=function(e,t){try{var n=Nn.create(e,hn.dataType,hn.envelopeType,this.diagLog(),t);this.core.track(n)}catch(r){this.diagLog().throwInternal(Q.WARNING,39,"trackTrace failed, trace will not be collected: "+mt.getExceptionName(r),{exception:mt.dump(r)})}},On.prototype.trackMetric=function(e,t){try{var n=Nn.create(e,Zt.dataType,Zt.envelopeType,this.diagLog(),t);this.core.track(n)}catch(r){this.diagLog().throwInternal(Q.CRITICAL,36,"trackMetric failed, metric will not be collected: "+mt.getExceptionName(r),{exception:mt.dump(r)})}},On.prototype.trackPageView=function(e,t){try{var n=e||{};this._pageViewManager.trackPageView(n,__assign({},n.properties,n.measurements,t)),this.config.autoTrackPageVisitTime&&this._pageVisitTimeManager.trackPreviousPageVisit(n.name,n.uri)}catch(r){this.diagLog().throwInternal(Q.CRITICAL,37,"trackPageView failed, page view will not be collected: "+mt.getExceptionName(r),{exception:mt.dump(r)})}},On.prototype.sendPageViewInternal=function(e,t,n){var r=T();r&&(e.refUri=e.refUri===undefined?r.referrer:e.refUri),n=Nn.create(e,on.dataType,on.envelopeType,this.diagLog(),t,n),this.core.track(n),this._trackAjaxAttempts=0},On.prototype.sendPageViewPerformanceInternal=function(e,t,n){n=Nn.create(e,In.dataType,In.envelopeType,this.diagLog(),t,n),this.core.track(n)},On.prototype.trackPageViewPerformance=function(e,t){try{this._pageViewPerformanceManager.populatePageViewPerformanceEvent(e),this.sendPageViewPerformanceInternal(e,t)}catch(n){this.diagLog().throwInternal(Q.CRITICAL,37,"trackPageViewPerformance failed, page view will not be collected: "+mt.getExceptionName(n),{exception:mt.dump(n)})}},On.prototype.startTrackPage=function(e){try{var t;"string"!=typeof e&&(e=(t=T())&&t.title||""),this._pageTracking.start(e)}catch(n){this.diagLog().throwInternal(Q.CRITICAL,31,"startTrackPage failed, page view may not be collected: "+mt.getExceptionName(n),{exception:mt.dump(n)})}},On.prototype.stopTrackPage=function(e,t,n,r){try{var i;"string"!=typeof e&&(e=(i=T())&&i.title||""),"string"!=typeof t&&(t=(i=w())&&i.href||""),this._pageTracking.stop(e,t,n,r),this.config.autoTrackPageVisitTime&&this._pageVisitTimeManager.trackPreviousPageVisit(e,t)}catch(o){this.diagLog().throwInternal(Q.CRITICAL,32,"stopTrackPage failed, page view will not be collected: "+mt.getExceptionName(o),{exception:mt.dump(o)})}},On.prototype.sendExceptionInternal=function(e,t,n){e=new zt(this.diagLog(),e.exception||Error(mt.NotSpecified),e.properties,e.measurements,e.severityLevel,e.id).toInterface(),n=Nn.create(e,zt.dataType,zt.envelopeType,this.diagLog(),t,n),this.core.track(n)},On.prototype.trackException=function(e,t){try{this.sendExceptionInternal(e,t)}catch(n){this.diagLog().throwInternal(Q.CRITICAL,35,"trackException failed, exception will not be collected: "+mt.getExceptionName(n),{exception:mt.dump(n)})}},On.prototype._onerror=function(e){try{var t,n={url:e&&e.url||(T()||{}).URL,lineNumber:e.lineNumber,columnNumber:e.columnNumber,message:e.message};mt.isCrossOriginError(e.message,e.url,e.lineNumber,e.columnNumber,e.error)?this._sendCORSException(n.url):(mt.isError(e.error)||(t="window.onerror@"+n.url+":"+e.lineNumber+":"+(e.columnNumber||0),e.error=Error(e.message),e.error.stack=t),this.trackException({exception:e.error,severityLevel:Tn.Error},n))}catch(i){var r=e.error?e.error.name+", "+e.error.message:"null";this.diagLog().throwInternal(Q.CRITICAL,11,"_onError threw exception while logging error, error will not be collected: "+mt.getExceptionName(i),{exception:mt.dump(i),errorString:r})}},On.prototype.addTelemetryInitializer=function(e){this._telemetryInitializers.push(e)},On.prototype.initialize=function(e,t,n,r){var o=this;if(!this.isInitialized()){if(J.isNullOrUndefined(t))throw Error("Error initializing");Rn.prototype.initialize.call(this,e,t,n,r),this.setInitialized(!1);var i=this._getTelCtx(),a=this.identifier;this._globalconfig={instrumentationKey:e.instrumentationKey,endpointUrl:e.endpointUrl||"https://dc.services.visualstudio.com/v2/track"},this.config=i.getExtCfg(a),(t=On.getDefaultConfig())!==undefined&&(X(t,function(e,t){o.config[e]=i.getConfig(a,e,t)}),this._globalconfig&&X(t,function(e,t){o._globalconfig[e]===undefined&&(o._globalconfig[e]=t)})),this.config.isCookieUseDisabled&&mt.disableCookies(),this.config.isStorageUseDisabled&&mt.disableStorage(),r={instrumentationKey:function(){return e.instrumentationKey},accountId:function(){return o.config.accountId||e.accountId},sessionRenewalMs:function(){return o.config.sessionRenewalMs||e.sessionRenewalMs},sessionExpirationMs:function(){return o.config.sessionExpirationMs||e.sessionExpirationMs},sampleRate:function(){return o.config.samplingPercentage||e.samplingPercentage},cookieDomain:function(){return o.config.cookieDomain||e.cookieDomain},sdkExtension:function(){return o.config.sdkExtension||e.sdkExtension},isBrowserLinkTrackingEnabled:function(){return o.config.isBrowserLinkTrackingEnabled||e.isBrowserLinkTrackingEnabled},appId:function(){return o.config.appId||e.appId}},this._pageViewPerformanceManager=new kn(this.core),this._pageViewManager=new Cn(this,this.config.overridePageViewDuration,this.core,this._pageViewPerformanceManager),this._pageVisitTimeManager=new bn(this.diagLog(),function(e,t,n){return o.trackPageVisitTime(e,t,n)}),this._telemetryInitializers=this._telemetryInitializers||[],this._addDefaultTelemetryInitializers(r),this._eventTracking=new Un(this.diagLog(),"trackEvent"),this._eventTracking.action=function(e,t,n,r){(r=r||{})[Ln]=n.toString(),o.trackEvent({name:e,properties:r})},this._pageTracking=new Un(this.diagLog(),"trackPageView"),this._pageTracking.action=function(e,t,n,r,i){J.isNullOrUndefined(r)&&(r={}),r[Ln]=n.toString(),i={name:e,uri:t,properties:r,measurements:i},o.sendPageViewInternal(i,r)};var s,c,u,l,f,g=S(),t=typeof history===m&&history?history:x("history"),p=w(),d=this;!1===this.config.disableExceptionTracking&&!this.config.autoExceptionInstrumented&&g&&(s=g.onerror,g.onerror=function(e,t,n,r,i){var o=s&&s(e,t,n,r,i);return!0!==o&&d._onerror({message:e,url:t,lineNumber:n,columnNumber:r,error:i}),o},this.config.autoExceptionInstrumented=!0),!1===this.config.disableExceptionTracking&&!0===this.config.enableUnhandledPromiseRejectionTracking&&!this.config.autoUnhandledPromiseInstrumented&&g&&(c=g[r="onunhandledrejection"],g[r]=function(e){var t=c&&c.call(g,e);return!0!==t&&d._onerror({message:e.reason.toString(),error:e.reason instanceof Error?e.reason:Error(e.reason.toString()),url:p?p.href:"",lineNumber:0,columnNumber:0}),t},this.config.autoUnhandledPromiseInstrumented=!0),!0===this.config.enableAutoRouteTracking&&t&&J.isFunction(t.pushState)&&J.isFunction(t.replaceState)&&g&&"undefined"!=typeof Event&&(u=this,J.arrForEach(n,function(e){"AppInsightsPropertiesPlugin"===e.identifier&&(o._properties=e)}),t.pushState=(f=t.pushState,function(){var e=f.apply(this,arguments);return Mn(g,mt.createDomEvent(u.config.namePrefix+"pushState")),Mn(g,mt.createDomEvent(u.config.namePrefix+"locationchange")),e}),t.replaceState=(l=t.replaceState,function(){var e=l.apply(this,arguments);return Mn(g,mt.createDomEvent(u.config.namePrefix+"replaceState")),Mn(g,mt.createDomEvent(u.config.namePrefix+"locationchange")),e}),g.addEventListener&&(g.addEventListener(u.config.namePrefix+"popstate",function(){Mn(g,mt.createDomEvent(u.config.namePrefix+"locationchange"))}),g.addEventListener(u.config.namePrefix+"locationchange",function(){u._properties&&u._properties.context&&u._properties.context.telemetryTrace&&(u._properties.context.telemetryTrace.traceID=mt.generateW3CId(),u._properties.context.telemetryTrace.name=p&&p.pathname||"_unknown_"),o._currUri&&(o._prevUri=o._currUri),o._currUri=p&&p.href||"",setTimeout((function(e){u.trackPageView({refUri:e,properties:{duration:0}})}).bind(o,o._prevUri),u.autoRoutePVDelay)}))),this.setInitialized(!0)}},On.prototype.trackPageVisitTime=function(e,t,n){t={PageName:e,PageUrl:t},this.trackMetric({name:"PageVisitTime",average:n,max:n,min:n,sampleCount:1},t)},On.prototype._addDefaultTelemetryInitializers=function(e){var r;e.isBrowserLinkTrackingEnabled()||(r=["/browserLinkSignalR/","/__browserLink/"],this._addTelemetryInitializer(function(e){if(e.baseType===ln.dataType){var t=e.baseData;if(t)for(var n=0;n<r.length;n++)if(t.target&&~t.target.indexOf(r[n]))return!1}return!0}))},On.prototype._addTelemetryInitializer=function(e){this._telemetryInitializers.push(e)},On.prototype._sendCORSException=function(e){var t={message:"Script error: The browser's same-origin policy prevents us from getting the details of this exception. Consider using the 'crossorigin' attribute.",url:e,lineNumber:0,columnNumber:0,error:undefined},e=Nn.create(t,zt.dataType,zt.envelopeType,this.diagLog(),{url:e});this.core.track(e)},On.Version="2.5.11",On);function On(){var e=Rn.call(this)||this;e.identifier="ApplicationInsightsAnalytics",e.priority=180,e.autoRoutePVDelay=500,e._trackAjaxAttempts=0;var t=w();return e._prevUri=t&&t.href||"",e}var Un=(zn.prototype.start=function(e){"undefined"!=typeof this._events[e]&&this._logger.throwInternal(Q.WARNING,62,"start was called more than once for this event without calling stop.",{name:this._name,key:e},!0),this._events[e]=+new Date},zn.prototype.stop=function(e,t,n,r){var i,o=this._events[e];isNaN(o)?this._logger.throwInternal(Q.WARNING,63,"stop was called without a corresponding start.",{name:this._name,key:e},!0):(i=+new Date,i=St.GetDuration(o,i),this.action(e,t,i,n,r)),delete this._events[e],this._events[e]=undefined},zn);function zn(e,t){this._name=t,this._events={},this._logger=e}e.ApplicationInsights=Be,function(e,t,n){var r=Object.defineProperty;if(r)try{return r(e,t,n)}catch(i){}typeof n.value!==undefined&&(e[t]=n.value)}(e,"__esModule",{value:!0})};"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e.Microsoft=e.Microsoft||{},e.Microsoft.ApplicationInsights=e.Microsoft.ApplicationInsights||{}));
var e=this,t=function(e){"use strict";var r="function",a="object",t="undefined",o="prototype",s="hasOwnProperty";function n(){return typeof globalThis!==t&&globalThis?globalThis:typeof self!==t&&self?self:typeof window!==t&&window?window:typeof global!==t&&global?global:null}var i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t[s](n)&&(e[n]=t[n])})(e,t)};Fe=function(e,t){function n(){this.constructor=e}i(e,t),e[o]=null===t?function(e){var t=Object.create;if(t)return t(e);if(null==e)return{};if((t=typeof e)!=a&&t!==r)throw new TypeError("Object prototype may only be an Object:"+e);function n(){}return n[o]=e,new n}(t):(n[o]=t[o],new n)},(ht=Mt=n()||{}).__assign||(ht.__assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object[o][s].call(t,i)&&(e[i]=t[i]);return e}),ht.__extends||(ht.__extends=Fe),__assign=__assign||Mt.__assign,__extends=__extends||Mt.__extends;var x,l="constructor",p="prototype",m="function",h="_dynInstFuncs",v="_isDynProxy",y="_dynClass",T="_dynCls$",I="_dynInstChk",w=I,S="_dfOpts",c="_unknown_",u="__proto__",N="useBaseInst",C="setInstFuncs",g=Object,P=g.getPrototypeOf,E=0;function _(e,t){return e&&g[p].hasOwnProperty.call(e,t)}function k(e){return e&&(e===g[p]||e===Array[p])}function b(e){return k(e)||e===Function[p]}function A(e){if(e){if(P)return P(e);if(e=e[u]||e[p]||e[l])return e}return null}function D(e,t){var n=[],r=g.getOwnPropertyNames;if(r)n=r(e);else for(var i in e)"string"==typeof i&&_(e,i)&&n.push(i);if(n&&0<n.length)for(var a=0;a<n.length;a++)t(n[a])}function L(e,t,n){return t!==l&&typeof e[t]===m&&(n||_(e,t))}function M(e){throw new TypeError("DynamicProto: "+e)}function R(e,t){for(var n=e.length-1;0<=n;n--)if(e[n]===t)return 1}function V(e,t){return _(e,p)?e.name||t||c:((e||{})[l]||{}).name||t||c}function z(e,n,t,r){_(e,p)||M("theClass is an invalid class definition.");var i=e[p];!function(e){for(var t=A(n);t&&!b(t);){if(t===e)return 1;t=A(t)}}(i)&&M("["+V(e)+"] is not in class hierarchy of ["+V(n)+"]");var a=null;_(i,y)?a=i[y]:(a=T+V(e,"_")+"$"+E,E++,i[y]=a);var o,s,l,c,u,g,f=z[S],d=!!f[N];d&&r&&r[N]!==undefined&&(d=!!r[N]),t(n,function(e,t,n,a){function r(e,t,n){var r,i=t[n];return i[v]&&a&&!1!==(r=e[h]||{})[w]&&(i=(r[t[y]]||{})[n]||i),function(){return i.apply(e,arguments)}}var i={};D(n,function(e){i[e]=r(t,n,e)});for(var o=A(e),s=[];o&&!b(o)&&!R(s,o);)D(o,function(e){!i[e]&&L(o,e,!P)&&(i[e]=r(t,o,e))}),s.push(o),o=A(o);return i}(i,n,(s={},D(o=n,function(e){!s[e]&&L(o,e,!1)&&(s[e]=o[e])}),e=s),d)),l=i,a=a,c=n,u=e,r=!1!==(f=(f=!!P&&!!f[C])&&r?!!r[C]:f),k(l)||(f=c[h]=c[h]||{},g=f[a]=f[a]||{},!1!==f[w]&&(f[w]=!!r),D(c,function(e){var n,r,i;L(c,e,!1)&&c[e]!==u[e]&&(g[e]=c[e],delete c[e],_(l,e)&&(!l[e]||l[e][v])||(l[e]=(n=l,r=e,(i=function(){var e,t;return(function(e,t,n,r){var i=null;if(e&&_(n,y)){var a=e[h]||{};if((i=(a[n[y]]||{})[t])||M("Missing ["+t+"] "+m),!i[I]&&!1!==a[w]){for(var o=!_(e,t),s=A(e),l=[];o&&s&&!b(s)&&!R(l,s);){var c=s[t];if(c){o=c===r;break}l.push(s),s=A(s)}try{o&&(e[t]=i),i[I]=1}catch(u){a[w]=!1}}}return i}(this,r,n,i)||(typeof(t=(t=n[e=r])===i?A(n)[e]:t)!==m&&M("["+e+"] is not a "+m),t)).apply(this,arguments)})[v]=1,i)))}))}z[S]={setInstFuncs:!0,useBaseInst:!0},(mt=x=x||{})[mt.CRITICAL=1]="CRITICAL",mt[mt.WARNING=2]="WARNING";var F={BrowserDoesNotSupportLocalStorage:0,BrowserCannotReadLocalStorage:1,BrowserCannotReadSessionStorage:2,BrowserCannotWriteLocalStorage:3,BrowserCannotWriteSessionStorage:4,BrowserFailedRemovalFromLocalStorage:5,BrowserFailedRemovalFromSessionStorage:6,CannotSendEmptyTelemetry:7,ClientPerformanceMathError:8,ErrorParsingAISessionCookie:9,ErrorPVCalc:10,ExceptionWhileLoggingError:11,FailedAddingTelemetryToBuffer:12,FailedMonitorAjaxAbort:13,FailedMonitorAjaxDur:14,FailedMonitorAjaxOpen:15,FailedMonitorAjaxRSC:16,FailedMonitorAjaxSend:17,FailedMonitorAjaxGetCorrelationHeader:18,FailedToAddHandlerForOnBeforeUnload:19,FailedToSendQueuedTelemetry:20,FailedToReportDataLoss:21,FlushFailed:22,MessageLimitPerPVExceeded:23,MissingRequiredFieldSpecification:24,NavigationTimingNotSupported:25,OnError:26,SessionRenewalDateIsZero:27,SenderNotInitialized:28,StartTrackEventFailed:29,StopTrackEventFailed:30,StartTrackFailed:31,StopTrackFailed:32,TelemetrySampledAndNotSent:33,TrackEventFailed:34,TrackExceptionFailed:35,TrackMetricFailed:36,TrackPVFailed:37,TrackPVFailedCalc:38,TrackTraceFailed:39,TransmissionFailed:40,FailedToSetStorageBuffer:41,FailedToRestoreStorageBuffer:42,InvalidBackendResponse:43,FailedToFixDepricatedValues:44,InvalidDurationValue:45,TelemetryEnvelopeInvalid:46,CreateEnvelopeError:47,CannotSerializeObject:48,CannotSerializeObjectNonSerializable:49,CircularReferenceDetected:50,ClearAuthContextFailed:51,ExceptionTruncated:52,IllegalCharsInName:53,ItemNotInArray:54,MaxAjaxPerPVExceeded:55,MessageTruncated:56,NameTooLong:57,SampleRateOutOfRange:58,SetAuthContextFailed:59,SetAuthContextFailedAccountName:60,StringValueTooLong:61,StartCalledMoreThanOnce:62,StopCalledWithoutStart:63,TelemetryInitializerFailed:64,TrackArgumentsNotSpecified:65,UrlTooLong:66,SessionStorageBufferFull:67,CannotAccessCookie:68,IdTooLong:69,InvalidEvent:70,FailedMonitorAjaxSetRequestHeader:71,SendBrowserInfoOnUserInit:72,PluginException:73,NotificationException:74,SnippetScriptLoadFailure:99,InvalidInstrumentationKey:100,CannotParseAiBlobValue:101,InvalidContentBlob:102,TrackPageActionEventFailed:103},f=(ht=Object)[o],d=f.hasOwnProperty,G=ht.defineProperty;function O(e){return f.toString.call(e)}function B(e){return e===undefined||typeof e===t}function U(e){return null===e||B(e)}function q(e){return typeof e===r}function W(e,t){if(e)for(var n in e)d.call(e,n)&&t.call(e,n,e[n])}function j(e,t){return!(!e||!t||!~e.indexOf(t))}function H(e){return"[object Array]"===O(e)}function X(e){return"[object Error]"===O(e)}function K(e){return"string"==typeof e}function J(e,t,n){for(var r=e.length,i=0;i<r&&!(i in e&&-1===t.call(n||e,e[i],i,e));i++);}function $(e,t,n){for(var r=e.length,i=n||e,a=Array(r),o=0;o<r;o++)o in e&&(a[o]=t.call(i,e[o],e));return a}function Y(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")}function Z(){var e=Date;return e.now?e.now():(new e).getTime()}function Q(e){return X(e)?e.name:""}({toString:null}).propertyIsEnumerable("toString");var ee=t,te=a,ne="window",re="document",ie="navigator",ae="history",oe="location",se="JSON",le="crypto",ce="msCrypto",ue="msie",ge="trident/",fe=null,de=null,pe=!1,me=n;function he(e){var t=me();return t&&t[e]?t[e]:e===ne&&ve()?window:null}function ve(){return typeof window===te&&window}function ye(){return typeof document===te&&document?document:he(re)}function Te(){return typeof navigator===te&&navigator?navigator:he(ie)}function Ie(e){return e&&pe&&(e=he("__mockLocation"))?e:typeof location===te&&location?location:he(oe)}function we(){return he("performance")}function Se(){return typeof JSON===te&&JSON||null!==he(se)}function xe(){return Se()?JSON||he(se):null}function Ne(e){var t=Object[o].toString.call(e),n="";return"[object Error]"===t?n="{ stack: '"+e.stack+"', message: '"+e.message+"', name: '"+e.name+"'":Se()&&(n=xe().stringify(e)),t+n}function Ce(e){return e?'"'+e.replace(/\"/g,"")+'"':""}var Pe=(Ee.dataType="MessageData",Ee);function Ee(e,t,n,r){void 0===n&&(n=!1),this.messageId=e,this.message=(n?"AI: ":"AI (Internal): ")+e,e="",Se()&&(e=xe().stringify(r)),e=(t?" message:"+Ce(t):"")+(r?" props:"+Ce(e):""),this.message+=e}var _e=function dn(n){this.identifier="DiagnosticLogger",this.queue=[];var i=0,o={};z(dn,this,function(a){function e(e,t){return U(e=n[e])?t:e}U(n)&&(n={}),a.consoleLoggingLevel=function(){return e("loggingLevelConsole",0)},a.telemetryLoggingLevel=function(){return e("loggingLevelTelemetry",1)},a.maxInternalMessageLimit=function(){return e("maxMessageLimit",25)},a.enableDebugExceptions=function(){return e("enableDebugExceptions",!1)},a.throwInternal=function(e,t,n,r,i){if(n=new Pe(t,n,i=void 0!==i&&i,r),a.enableDebugExceptions())throw n;B(n)||!n||B(n.message)||(r=a.consoleLoggingLevel(),i?(i=+n.messageId,!o[i]&&r>=x.WARNING&&(a.warnToConsole(n.message),o[i]=!0)):r>=x.WARNING&&a.warnToConsole(n.message),a.logInternalMessage(e,n))},a.warnToConsole=function(e){var t,n=typeof console!==ee?console:he("console");n&&(t="log",q(n[t=n.warn?"warn":t])&&n[t](e))},a.resetInternalMessageCount=function(){i=0,o={}},a.logInternalMessage=function(e,t){var n,r;i>=a.maxInternalMessageLimit()||(n=!0,r="AITR_"+t.messageId,o[r]?n=!1:o[r]=!0,n&&(e<=a.telemetryLoggingLevel()&&(a.queue.push(t),i++),i===a.maxInternalMessageLimit()&&(t=new Pe(F.MessageLimitPerPVExceeded,e="Internal events throttle limit per PageView reached for this app.",!1),a.queue.push(t),a.warnToConsole(e))))}})},ke="ctx",be=(Ae.ParentContextKey="parent",Ae.ChildrenContextKey="childEvts",Ae);function Ae(e,i,t){var r,a=this,o=!1;a.start=Z(),a.name=e,a.isAsync=t,a.isChildEvt=function(){return!1},q(i)&&(o=function(e){if(G)try{var t={enumerable:!0,configurable:!0,get:function(){return!r&&q(i)&&(r=i(),i=null),r}};return G(e,"payload",t),!0}catch(n){}return!1}(a)),a.getCtx=function(e){return e?(e===Ae.ParentContextKey||e===Ae.ChildrenContextKey?a:a[ke]||{})[e]:null},a.setCtx=function(e,t){e&&(e===Ae.ParentContextKey?(a[e]||(a.isChildEvt=function(){return!0}),a[e]=t):e===Ae.ChildrenContextKey?a[e]=t:(a[ke]=a[ke]||{})[e]=t)},a.complete=function(){var e=0,t=a.getCtx(Ae.ChildrenContextKey);if(H(t))for(var n=0;n<t.length;n++){var r=t[n];r&&(e+=r.time)}a.time=Z()-a.start,a.exTime=a.time-e,a.complete=function(){},!o&&q(i)&&(a.payload=i())}}var De="CoreUtils.doPerf";function Le(e,t,n,r,i){if(e){var a=e;if(a=a&&q(a.getPerfMgr)?a.getPerfMgr():a){var o,s=void 0,e=a.getCtx(De);try{if(s=a.create(t(),r,i))return e&&s.setCtx&&(s.setCtx(be.ParentContextKey,e),e.getCtx&&e.setCtx&&((o=e.getCtx(be.ChildrenContextKey))||(o=[],e.setCtx(be.ChildrenContextKey,o)),o.push(s))),a.setCtx(De,s),n(s)}catch(l){s&&s.setCtx&&s.setCtx("exception",l)}finally{s&&a.fire(s),a.setCtx(De,e)}}}return n()}var Me=function(i,t){var a=this,o=null,s=q(i.processTelemetry),l=q(i.setNextPlugin);a._hasRun=!1,a.getPlugin=function(){return i},a.getNext=function(){return o},a.setNext=function(e){o=e},a.processTelemetry=function(n,r){var e=i?i.identifier:"TelemetryPluginChain";Le((r=r||t)?r.core():null,function(){return e+":processTelemetry"},function(){if(i&&s){a._hasRun=!0;try{r.setNext(o),l&&i.setNextPlugin(o),o&&(o._hasRun=!1),i.processTelemetry(n,r)}catch(t){var e=o&&o._hasRun;o&&e||r.diagLog().throwInternal(x.CRITICAL,F.PluginException,"Plugin ["+i.identifier+"] failed during processTelemetry - "+t),o&&!e&&o.processTelemetry(n,r)}}else o&&(a._hasRun=!0,o.processTelemetry(n,r))},function(){return{item:n}},!n.sync)}};function Re(e,t){var n=[];if(e&&0<e.length)for(var r=null,i=0;i<e.length;i++){var a=e[i];a&&q(a.processTelemetry)&&(a=new Me(a,t),n.push(a),r&&r.setNext(a),r=a)}return 0<n.length?n[0]:null}var Ve=function pn(e,i,n,t){var r,a,o,s,l=this,c=null;null!==t&&(e&&q(e.getPlugin)?c=function(e,t,n){var r=[],i=!n;if(e)for(;e;){var a=e.getPlugin();!i&&a!==n||(i=!0,r.push(a)),e=e.getNext()}return i||r.push(n),Re(r,t)}(e,l,t||e.getPlugin()):t?(r=l,o=e,s=!1,(a=t)&&e&&(o=[],J(e,function(e){!s&&e!==a||(s=!0,o.push(e))})),a&&!s&&(o=o||[]).push(a),c=Re(o,r)):B(t)&&(c=Re(e,l))),l.core=function(){return n},l.diagLog=function(){return(n||{}).logger||new _e(i)},l.getCfg=function(){return i},l.getExtCfg=function(e,t){var n,r;return void 0===t&&(t={}),!i||(r=i.extensionConfig)&&e&&(n=r[e]),n||t},l.getConfig=function(e,t,n){var r;return void 0===n&&(n=!1),(e=l.getExtCfg(e,null))&&!U(e[t])?r=e[t]:i&&!U(i[t])&&(r=i[t]),U(r)?n:r},l.hasNext=function(){return null!=c},l.getNext=function(){return c},l.setNext=function(e){c=e},l.processNext=function(e){var t=c;t&&(c=t.getNext(),t.processTelemetry(e,l))},l.createNew=function(e,t){return new pn((e=void 0===e?null:e)||c,i,n,t)}},ze="getPlugin",Fe=(Ge.prototype.initialize=function(e,t,n,r){this._baseTelInit(e,t,n,r)},Ge);function Ge(){var s=this,l=!1,c=null,u=null;s.core=null,s.diagLog=function(e){return s._getTelCtx(e).diagLog()},s.isInitialized=function(){return l},s.setInitialized=function(e){l=e},s.setNextPlugin=function(e){u=e},s.processNext=function(e,t){t?t.processNext(e):u&&q(u.processTelemetry)&&u.processTelemetry(e,null)},s._getTelCtx=function(e){var t=e=void 0===e?null:e;return t||(e=c||new Ve(null,{},s.core),t=u&&u[ze]?e.createNew(null,u[ze]):e.createNew(null,u)),t},s._baseTelInit=function(e,t,n,r){var i,a;e&&(i="extensionConfig",o=a=[],!e||(o=e[i])!==a&&U(o)&&(e[i]=o=a)),!r&&t&&(r=t.getProcessTelContext().getNext());var o=u;u&&u[ze]&&(o=u[ze]()),s.core=t,c=new Ve(r,e,t,o),l=!0}}var Oe=4294967296,Be=4294967295,Ue=!1,qe=123456789,We=987654321;function je(e){var t=he(le)||he(ce),n=t&&t.getRandomValues?t.getRandomValues(new Uint32Array(1))[0]&Be:(!(n=Te())||n.userAgent===de&&null!==fe||(n=((de=n.userAgent)||"").toLowerCase(),fe=j(n,ue)||j(n,ge)),fe?(Ue||function(){try{var e=2147483647&Z();(t=(Math.random()*Oe^e)+e)<0&&(t>>>=0),qe=123456789+t&Be,We=987654321-t&Be,Ue=!0}catch(n){}var t}(),t=((We=36969*(65535&We)+(We>>16)&Be)<<16)+(65535&(qe=18e3*(65535&qe)+(qe>>16)&Be))>>>0&Be|0,(t>>>=0)&Be):Math.floor(Oe*Math.random()|0));return e||(n>>>=0),n}var He=(Xe.sanitizeKeyAndAddUniqueness=function(e,t,n){var r=t.length,i=Xe.sanitizeKey(e,t);if(i.length!==r){for(var a=0,o=i;n[o]!==undefined;)a++,o=i.substring(0,Xe.MAX_NAME_LENGTH-3)+Xe.padNumber(a);i=o}return i},Xe.sanitizeKey=function(e,t){var n;return t&&(t=Xe.trim(t.toString())).length>Xe.MAX_NAME_LENGTH&&(n=t.substring(0,Xe.MAX_NAME_LENGTH),e.throwInternal(x.WARNING,F.NameTooLong,"name is too long. It has been truncated to "+Xe.MAX_NAME_LENGTH+" characters.",{name:t},!0)),n||t},Xe.sanitizeString=function(e,t,n){var r;return void 0===n&&(n=Xe.MAX_STRING_LENGTH),t&&(n=n||Xe.MAX_STRING_LENGTH,(t=Xe.trim(t)).toString().length>n&&(r=t.toString().substring(0,n),e.throwInternal(x.WARNING,F.StringValueTooLong,"string value is too long. It has been truncated to "+n+" characters.",{value:t},!0))),r||t},Xe.sanitizeUrl=function(e,t){return Xe.sanitizeInput(e,t,Xe.MAX_URL_LENGTH,F.UrlTooLong)},Xe.sanitizeMessage=function(e,t){var n;return t&&t.length>Xe.MAX_MESSAGE_LENGTH&&(n=t.substring(0,Xe.MAX_MESSAGE_LENGTH),e.throwInternal(x.WARNING,F.MessageTruncated,"message is too long, it has been truncated to "+Xe.MAX_MESSAGE_LENGTH+" characters.",{message:t},!0)),n||t},Xe.sanitizeException=function(e,t){var n;return t&&t.length>Xe.MAX_EXCEPTION_LENGTH&&(n=t.substring(0,Xe.MAX_EXCEPTION_LENGTH),e.throwInternal(x.WARNING,F.ExceptionTruncated,"exception is too long, it has been truncated to "+Xe.MAX_EXCEPTION_LENGTH+" characters.",{exception:t},!0)),n||t},Xe.sanitizeProperties=function(r,e){var i;return e&&(i={},W(e,function(e,t){if(typeof t==a&&Se())try{t=xe().stringify(t)}catch(n){r.throwInternal(x.WARNING,F.CannotSerializeObjectNonSerializable,"custom property is not valid",{exception:n},!0)}t=Xe.sanitizeString(r,t,Xe.MAX_PROPERTY_LENGTH),e=Xe.sanitizeKeyAndAddUniqueness(r,e,i),i[e]=t}),e=i),e},Xe.sanitizeMeasurements=function(n,e){var r;return e&&(r={},W(e,function(e,t){e=Xe.sanitizeKeyAndAddUniqueness(n,e,r),r[e]=t}),e=r),e},Xe.sanitizeId=function(e,t){return t&&Xe.sanitizeInput(e,t,Xe.MAX_ID_LENGTH,F.IdTooLong).toString()},Xe.sanitizeInput=function(e,t,n,r){var i;return t&&(t=Xe.trim(t)).length>n&&(i=t.substring(0,n),e.throwInternal(x.WARNING,r,"input is too long, it has been truncated to "+n+" characters.",{data:t},!0)),i||t},Xe.padNumber=function(e){return(e="00"+e).substr(e.length-3)},Xe.trim=function(e){return K(e)?e.replace(/^\s+|\s+$/g,""):e},Xe.MAX_NAME_LENGTH=150,Xe.MAX_ID_LENGTH=128,Xe.MAX_PROPERTY_LENGTH=8192,Xe.MAX_STRING_LENGTH=1024,Xe.MAX_URL_LENGTH=2048,Xe.MAX_MESSAGE_LENGTH=32768,Xe.MAX_EXCEPTION_LENGTH=32768,Xe);function Xe(){}function Ke(e){var t,n=null;return q(Event)?n=new Event(e):(t=ye())&&t.createEvent&&(n=t.createEvent("Event")).initEvent(e,!0,!0),n}function Je(e,t){return void 0===t&&(t=!1),e===undefined||null===e?t:"true"==e.toString().toLowerCase()}function $e(e){var t=""+(e=Math.round(e=isNaN(e)||e<0?0:e))%1e3,n=""+Math.floor(e/1e3)%60,r=""+Math.floor(e/6e4)%60,i=""+Math.floor(e/36e5)%24,t=1===t.length?"00"+t:2===t.length?"0"+t:t,n=n.length<2?"0"+n:n,r=r.length<2?"0"+r:r;return(0<(e=Math.floor(e/864e5))?e+".":"")+(i=i.length<2?"0"+i:i)+":"+r+":"+n+"."+t}var Ye,Ze,Qe="not_specified";(Mt=Ye=Ye||{})[Mt.LocalStorage=0]="LocalStorage",Mt[Mt.SessionStorage=1]="SessionStorage",(mt=Ze=Ze||{})[mt.Default=0]="Default",mt[mt.Required=1]="Required",mt[mt.Array=2]="Array",mt[mt.Hidden=4]="Hidden",(ht={})[ht.AI=0]="AI",ht[ht.AI_AND_W3C=1]="AI_AND_W3C",ht[ht.W3C=2]="W3C";var et=undefined;function tt(e){try{if(U(me()))return null;var t=new Date,n=he(e===Ye.LocalStorage?"localStorage":"sessionStorage");n.setItem(t.toString(),t.toString());var r=n.getItem(t.toString())!==t.toString();if(n.removeItem(t.toString()),!r)return n}catch(i){}return null}function nt(){return rt()?tt(Ye.SessionStorage):null}function rt(){return et=et===undefined?!!tt(Ye.SessionStorage):et}function it(e,t){var n=nt();if(null!==n)try{return n.getItem(t)}catch(r){et=!1,e.throwInternal(x.WARNING,F.BrowserCannotReadSessionStorage,"Browser failed read of session storage. "+Q(r),{exception:Ne(r)})}return null}function at(e,t,n){var r=nt();if(null!==r)try{return r.setItem(t,n),1}catch(i){et=!1,e.throwInternal(x.WARNING,F.BrowserCannotWriteSessionStorage,"Browser failed write to session storage. "+Q(i),{exception:Ne(i)})}}function ot(e,t){var n=nt();if(null!==n)try{return n.removeItem(t),1}catch(r){et=!1,e.throwInternal(x.WARNING,F.BrowserFailedRemovalFromSessionStorage,"Browser failed removal of session storage item. "+Q(r),{exception:Ne(r)})}}var st=ye()||{},lt=0,ct=[null,null,null,null,null];function ut(e,t){return 0===e||0===t||U(e)||U(t)?null:t-e}var gt,ft=(gt=Mt=function(){this.ver=2,this.properties={},this.measurements={}},__extends(dt,gt),dt.envelopeType="Microsoft.ApplicationInsights.{0}.Event",dt.dataType="EventData",dt);function dt(e,t,n,r){var i=gt.call(this)||this;return i.aiDataContract={ver:Ze.Required,name:Ze.Required,properties:Ze.Default,measurements:Ze.Default},i.name=He.sanitizeString(e,t)||Qe,i.properties=He.sanitizeProperties(e,n),i.measurements=He.sanitizeMeasurements(e,r),i}var pt,mt=function(){},ht=function(){this.hasFullStack=!0,this.parsedStack=[]},vt="error",yt=(pt=function(){this.ver=2,this.exceptions=[],this.properties={},this.measurements={}},__extends(Tt,pt),Tt.CreateFromInterface=function(t,e,n,r){var i=e.exceptions&&$(e.exceptions,function(e){return wt.CreateFromInterface(t,e)});return new Tt(t,__assign({},e,{exceptions:i}),n,r)},Tt.prototype.toInterface=function(){var e=this.exceptions,t=this.properties,n=this.measurements,r=this.severityLevel;this.ver;var i=this.problemGroup,a=this.id,o=this.isManual;return{ver:"4.0",exceptions:e instanceof Array&&$(e,function(e){return e.toInterface()})||undefined,severityLevel:r,properties:t,measurements:n,problemGroup:i,id:a,isManual:o}},Tt.CreateSimpleException=function(e,t,n,r,i,a){return{exceptions:[{hasFullStack:!0,message:e,stack:i,typeName:t}]}},Tt.envelopeType="Microsoft.ApplicationInsights.{0}.Exception",Tt.dataType="ExceptionData",Tt);function Tt(e,t,n,r,i,a){var o,s=pt.call(this)||this;return s.aiDataContract={ver:Ze.Required,exceptions:Ze.Required,severityLevel:Ze.Default,properties:Ze.Default,measurements:Ze.Default},"ver"in(o=t)&&"exceptions"in o&&"properties"in o?(s.exceptions=t.exceptions,s.properties=t.properties,s.measurements=t.measurements,t.severityLevel&&(s.severityLevel=t.severityLevel),t.id&&(s.id=t.id),t.problemGroup&&(s.problemGroup=t.problemGroup),s.ver=2,U(t.isManual)||(s.isManual=t.isManual)):(s.exceptions=[new wt(e,t)],s.properties=He.sanitizeProperties(e,n)||{},s.measurements=He.sanitizeMeasurements(e,r),i&&(s.severityLevel=i),a&&(s.id=a)),s}var It,wt=(It=ht,__extends(St,It),St.prototype.toInterface=function(){var e=this.parsedStack instanceof Array&&$(this.parsedStack,function(e){return e.toInterface()});return{id:this.id,outerId:this.outerId,typeName:this.typeName,message:this.message,hasFullStack:this.hasFullStack,stack:this.stack,parsedStack:e||undefined}},St.CreateFromInterface=function(e,t){var n=t.parsedStack instanceof Array&&$(t.parsedStack,function(e){return Nt.CreateFromInterface(e)})||t.parsedStack;return new St(e,__assign({},t,{parsedStack:n}))},St.parseStack=function(e){if(K(e)){for(var t=e.split("\n"),n=[],r=0,i=0,a=0;a<=t.length;a++){var o=t[a];Nt.regex.test(o)&&(i+=(o=new Nt(t[a],r++)).sizeInBytes,n.push(o))}if(32768<i)for(var s=0,l=n.length-1,c=0,u=s,g=l;s<l;){if(32768<(c+=n[s].sizeInBytes+n[l].sizeInBytes)){n.splice(u,g-u+1);break}u=s,g=l,s++,l--}}return n},St);function St(e,t){var n,r=It.call(this)||this;return r.aiDataContract={id:Ze.Default,outerId:Ze.Default,typeName:Ze.Required,message:Ze.Required,hasFullStack:Ze.Default,stack:Ze.Default,parsedStack:Ze.Array},"hasFullStack"in(n=t)&&"typeName"in n?(r.typeName=t.typeName,r.message=t.message,r.stack=t.stack,r.parsedStack=t.parsedStack,r.hasFullStack=t.hasFullStack):(X(n=t)||(n=n[vt]||n.evt||n),r.typeName=He.sanitizeString(e,function(e){var t="";if(e&&!(t=e.typeName||e.name||""))try{var n=/function (.{1,})\(/.exec(e.constructor.toString()),t=n&&1<n.length?n[1]:""}catch(r){}return t}(n))||Qe,r.message=He.sanitizeMessage(e,t.message)||Qe,t=t.stack,r.parsedStack=St.parseStack(t),r.stack=He.sanitizeException(e,t),r.hasFullStack=H(r.parsedStack)&&0<r.parsedStack.length),r}var xt,Nt=(xt=mt,__extends(Ct,xt),Ct.CreateFromInterface=function(e){return new Ct(e,null)},Ct.prototype.toInterface=function(){return{level:this.level,method:this.method,assembly:this.assembly,fileName:this.fileName,line:this.line}},Ct.regex=/^([\s]+at)?(.*?)(\@|\s\(|\s)([^\(\@\n]+):([0-9]+):([0-9]+)(\)?)$/,Ct.baseSize=58,Ct);function Ct(e,t){var n,r=xt.call(this)||this;return r.sizeInBytes=0,r.aiDataContract={level:Ze.Required,method:Ze.Required,assembly:Ze.Default,fileName:Ze.Default,line:Ze.Default},"string"==typeof e?(n=e,r.level=t,r.method="<no_method>",r.assembly=Y(n),r.fileName="",r.line=0,(n=n.match(Ct.regex))&&5<=n.length&&(r.method=Y(n[2])||r.method,r.fileName=Y(n[4]),r.line=parseInt(n[5])||0)):(r.level=e.level,r.method=e.method,r.assembly=e.assembly,r.fileName=e.fileName,r.line=e.line,r.sizeInBytes=0),r.sizeInBytes+=r.method.length,r.sizeInBytes+=r.fileName.length,r.sizeInBytes+=r.assembly.length,r.sizeInBytes+=Ct.baseSize,r.sizeInBytes+=r.level.toString().length,r.sizeInBytes+=r.line.toString().length,r}var Pt,ht=function(){this.ver=2,this.metrics=[],this.properties={},this.measurements={}};(mt=Pt={})[mt.Measurement=0]="Measurement",mt[mt.Aggregation=1]="Aggregation";var Et,_t=(Et=function(){this.kind=Pt.Measurement},__extends(kt,Et),kt);function kt(){var e=Et.apply(this,arguments)||this;return e.aiDataContract={name:Ze.Required,kind:Ze.Default,value:Ze.Required,count:Ze.Default,min:Ze.Default,max:Ze.Default,stdDev:Ze.Default},e}var bt,At=(bt=ht,__extends(Dt,bt),Dt.envelopeType="Microsoft.ApplicationInsights.{0}.Metric",Dt.dataType="MetricData",Dt);function Dt(e,t,n,r,i,a,o,s){var l=bt.call(this)||this;l.aiDataContract={ver:Ze.Required,metrics:Ze.Required,properties:Ze.Default};var c=new _t;return c.count=0<r?r:undefined,c.max=isNaN(a)||null===a?undefined:a,c.min=isNaN(i)||null===i?undefined:i,c.name=He.sanitizeString(e,t)||Qe,c.value=n,l.metrics=[c],l.properties=He.sanitizeProperties(e,o),l.measurements=He.sanitizeMeasurements(e,s),l}var Lt,Mt=(Lt=Mt,__extends(Rt,Lt),Rt);function Rt(){var e=Lt.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var Vt,zt=(Vt=Mt,__extends(Ft,Vt),Ft.envelopeType="Microsoft.ApplicationInsights.{0}.Pageview",Ft.dataType="PageviewData",Ft);function Ft(e,t,n,r,i,a,o){var s=Vt.call(this)||this;return s.aiDataContract={ver:Ze.Required,name:Ze.Default,url:Ze.Default,duration:Ze.Default,properties:Ze.Default,measurements:Ze.Default,id:Ze.Default},s.id=He.sanitizeId(e,o),s.url=He.sanitizeUrl(e,n),s.name=He.sanitizeString(e,t)||Qe,isNaN(r)||(s.duration=$e(r)),s.properties=He.sanitizeProperties(e,i),s.measurements=He.sanitizeMeasurements(e,a),s}var Gt,Ot=(Gt=function(){this.ver=2,this.success=!0,this.properties={},this.measurements={}},__extends(Bt,Gt),Bt.envelopeType="Microsoft.ApplicationInsights.{0}.RemoteDependency",Bt.dataType="RemoteDependencyData",Bt);function Bt(e,t,n,r,i,a,o,s,l,c,u,g){void 0===l&&(l="Ajax");var f=Gt.call(this)||this;f.aiDataContract={id:Ze.Required,ver:Ze.Required,name:Ze.Default,resultCode:Ze.Default,duration:Ze.Default,success:Ze.Default,data:Ze.Default,target:Ze.Default,type:Ze.Default,properties:Ze.Default,measurements:Ze.Default,kind:Ze.Default,value:Ze.Default,count:Ze.Default,min:Ze.Default,max:Ze.Default,stdDev:Ze.Default,dependencyKind:Ze.Default,dependencySource:Ze.Default,commandName:Ze.Default,dependencyTypeName:Ze.Default},f.id=t,f.duration=$e(i),f.success=a,f.resultCode=o+"",f.type=He.sanitizeString(e,l);var d,p,m,h,v,y,T,I,w,S,o=(d=e,t=s,o=a=i=r,a=(l=n)&&0<l.length?(p=l,S=(w=ct)[I=lt],st.createElement?w[I]||(S=w[I]=st.createElement("a")):S={host:(y=!0,T=null,!(v=m=p)||null!=(v=v.match(/(\w*):\/\/(.[^/:]+)(\:[\d]+)?/i))&&2<v.length&&K(v[2])&&0<v[2].length&&(T=v[2]||"",y&&2<v.length&&(y=(v[1]||"").toLowerCase(),v=v[3]||"",T+=v="http"==y&&":80"===v||"https"==y&&":443"===v?"":v)),(m=T)&&null!=(h=m.match(/(www[0-9]?\.)?(.[^/:]+)(\:[\d]+)?/i))&&3<h.length&&K(h[2])&&0<h[2].length?h[2]+(h[3]||""):m)},S.href=p,++I>=w.length&&(I=0),lt=I,S=(s=S).host,a||(null!=s.pathname?("/"!=((n=0===s.pathname.length?"/":s.pathname)[0]||"")&&(n="/"+n),o=s.pathname,He.sanitizeString(d,t?t+" "+n:n)):He.sanitizeString(d,l))):S=i,{target:S,name:a,data:o});return f.data=He.sanitizeUrl(e,r)||o.data,f.target=He.sanitizeString(e,o.target),c&&(f.target=f.target+" | "+c),f.name=He.sanitizeString(e,o.name),f.properties=He.sanitizeProperties(e,u),f.measurements=He.sanitizeMeasurements(e,g),f}var Ut,qt=(Ut=function(){this.ver=2,this.properties={},this.measurements={}},__extends(Wt,Ut),Wt.envelopeType="Microsoft.ApplicationInsights.{0}.Message",Wt.dataType="MessageData",Wt);function Wt(e,t,n,r,i){var a=Ut.call(this)||this;return a.aiDataContract={ver:Ze.Required,message:Ze.Required,severityLevel:Ze.Default,properties:Ze.Default},a.message=He.sanitizeMessage(e,t=t||Qe),a.properties=He.sanitizeProperties(e,r),a.measurements=He.sanitizeMeasurements(e,i),n&&(a.severityLevel=n),a}var jt,Mt=(jt=Mt,__extends(Ht,jt),Ht);function Ht(){var e=jt.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var Xt,Kt,Jt=(Xt=Mt,__extends($t,Xt),$t.envelopeType="Microsoft.ApplicationInsights.{0}.PageviewPerformance",$t.dataType="PageviewPerformanceData",$t);function $t(e,t,n,r,i,a,o){var s=Xt.call(this)||this;return s.aiDataContract={ver:Ze.Required,name:Ze.Default,url:Ze.Default,duration:Ze.Default,perfTotal:Ze.Default,networkConnect:Ze.Default,sentRequest:Ze.Default,receivedResponse:Ze.Default,domProcessing:Ze.Default,properties:Ze.Default,measurements:Ze.Default},s.url=He.sanitizeUrl(e,n),s.name=He.sanitizeString(e,t)||Qe,s.properties=He.sanitizeProperties(e,i),s.measurements=He.sanitizeMeasurements(e,a),o&&(s.domProcessing=o.domProcessing,s.duration=o.duration,s.networkConnect=o.networkConnect,s.perfTotal=o.perfTotal,s.receivedResponse=o.receivedResponse,s.sentRequest=o.sentRequest),s}(Mt=Kt=Kt||{})[Mt.Verbose=0]="Verbose",Mt[Mt.Information=1]="Information",Mt[Mt.Warning=2]="Warning",Mt[Mt.Error=3]="Error",Mt[Mt.Critical=4]="Critical";var Yt=(Zt.create=function(e,t,n,r,i,a){if(n=He.sanitizeString(r,n)||Qe,U(e)||U(t)||U(n))throw Error("Input doesn't contain all required fields");var o={name:n,time:function(e){if("[object Date]"===O(e)){var t=function(e){return 1===(e=""+e).length?"0"+e:e};return e.getUTCFullYear()+"-"+t(1+e.getUTCMonth())+"-"+t(e.getUTCDate())+"T"+t(e.getUTCHours())+":"+t(e.getUTCMinutes())+":"+t(e.getUTCSeconds())+"."+(""+(e.getUTCMilliseconds()/1e3).toFixed(3)).slice(2,5)+"Z"}}(new Date),iKey:"",ext:a||{},tags:[],data:{},baseType:t,baseData:e};return U(i)||W(i,function(e,t){o.data[e]=t}),o},Zt);function Zt(){}var Qt="AppInsightsPropertiesPlugin",en="ApplicationInsightsAnalytics",tn=function mn(p,m,t,h){z(mn,this,function(e){var u,n=null,g=[],f=!1;function d(){t&&J(t.getTransmissionControls(),function(e){J(e,function(e){return e.flush(!0)})})}t&&(u=t.logger),e.trackPageView=function(r,i){var a=r.name;!U(a)&&"string"==typeof a||(e=ye(),a=r.name=e&&e.title||"");var e,o=r.uri;if(!U(o)&&"string"==typeof o||(e=Ie(),o=r.uri=e&&e.href||""),!h.isPerformanceTimingSupported())return p.sendPageViewInternal(r,i),d(),void u.throwInternal(x.WARNING,F.NavigationTimingNotSupported,"trackPageView: navigation timing API used for calculation of page duration is not supported in this browser. This page view will be collected without duration and timing info.");var s,t,l=!1,c=h.getPerformanceTiming().navigationStart;0<c&&(s=ut(c,+new Date),h.shouldCollectDuration(s)||(s=undefined)),U(i)||U(i.duration)||(t=i.duration),!m&&isNaN(t)||(isNaN(t)&&((i=i||{}).duration=s),p.sendPageViewInternal(r,i),d(),l=!0),i=i||{},g.push(t=function(){var e,t=!1;try{h.isPerformanceTimingDataReady()?(t=!0,e={name:a,uri:o},h.populatePageViewPerformanceEvent(e),e.isValid||l?(l||(i.duration=e.durationMs,p.sendPageViewInternal(r,i)),f||(p.sendPageViewPerformanceInternal(e,i),f=!0)):(i.duration=s,p.sendPageViewInternal(r,i))):0<c&&6e4<ut(c,+new Date)&&(t=!0,l||(i.duration=6e4,p.sendPageViewInternal(r,i)))}catch(n){u.throwInternal(x.CRITICAL,F.TrackPVFailedCalc,"trackPageView failed on page load calculation: "+Q(n),{exception:Ne(n)})}return t}),n=n||setInterval(function(){var e=g.slice(0),t=!1;g=[],J(e,function(e){e()?t=!0:g.push(e)}),0===g.length&&(clearInterval(n),n=null),t&&d()},100)}})},nn=(rn.prototype.trackPreviousPageVisit=function(e,t){try{var n=this.restartPageVisitTimer(e,t);n&&this.pageVisitTimeTrackingHandler(n.pageName,n.pageUrl,n.pageVisitTime)}catch(r){this._logger.warnToConsole("Auto track page visit time failed, metric will not be collected: "+Ne(r))}},rn.prototype.restartPageVisitTimer=function(e,t){try{var n=this.stopPageVisitTimer();return this.startPageVisitTimer(e,t),n}catch(r){return this._logger.warnToConsole("Call to restart failed: "+Ne(r)),null}},rn.prototype.startPageVisitTimer=function(e,t){try{var n,r;rt()&&(null!=it(this._logger,this.prevPageVisitDataKeyName)&&function(){throw Error("Cannot call startPageVisit consecutively without first calling stopPageVisit")}(),n=new an(e,t),r=xe().stringify(n),at(this._logger,this.prevPageVisitDataKeyName,r))}catch(i){this._logger.warnToConsole("Call to start failed: "+Ne(i))}},rn.prototype.stopPageVisitTimer=function(){try{if(rt()){var e=Z(),t=it(this._logger,this.prevPageVisitDataKeyName);if(t&&Se()){var n=xe().parse(t);return n.pageVisitTime=e-n.pageVisitStartTime,ot(this._logger,this.prevPageVisitDataKeyName),n}return null}return null}catch(r){return this._logger.warnToConsole("Stop page visit timer failed: "+Ne(r)),null}},rn);function rn(e,t){this.prevPageVisitDataKeyName="prevPageVisitData",this.pageVisitTimeTrackingHandler=t,this._logger=e}var an=function(e,t){this.pageVisitStartTime=Z(),this.pageName=e,this.pageUrl=t},on=(sn.prototype.populatePageViewPerformanceEvent=function(e){e.isValid=!1;var t,n,r,i,a=this.getPerformanceNavigationTiming(),o=this.getPerformanceTiming();(a||o)&&(o=a?(t=a.duration,n=ut(a.startTime,a.connectEnd),r=ut(a.requestStart,a.responseStart),i=ut(a.responseStart,a.responseEnd),ut(a.responseEnd,a.loadEventEnd)):(t=ut(o.navigationStart,o.loadEventEnd),n=ut(o.navigationStart,o.connectEnd),r=ut(o.requestStart,o.responseStart),i=ut(o.responseStart,o.responseEnd),ut(o.responseEnd,o.loadEventEnd)),0===t?this._logger.throwInternal(x.WARNING,F.ErrorPVCalc,"error calculating page view performance.",{total:t,network:n,request:r,response:i,dom:o}):this.shouldCollectDuration(t,n,r,i,o)?t<Math.floor(n)+Math.floor(r)+Math.floor(i)+Math.floor(o)?this._logger.throwInternal(x.WARNING,F.ClientPerformanceMathError,"client performance math error.",{total:t,network:n,request:r,response:i,dom:o}):(e.durationMs=t,e.perfTotal=e.duration=$e(t),e.networkConnect=$e(n),e.sentRequest=$e(r),e.receivedResponse=$e(i),e.domProcessing=$e(o),e.isValid=!0):this._logger.throwInternal(x.WARNING,F.InvalidDurationValue,"Invalid page load duration value. Browser perf data won't be sent.",{total:t,network:n,request:r,response:i,dom:o}))},sn.prototype.getPerformanceTiming=function(){return this.isPerformanceTimingSupported()?we().timing:null},sn.prototype.getPerformanceNavigationTiming=function(){return this.isPerformanceNavigationTimingSupported()?we().getEntriesByType("navigation")[0]:null},sn.prototype.isPerformanceNavigationTimingSupported=function(){var e=we();return e&&e.getEntriesByType&&0<e.getEntriesByType("navigation").length},sn.prototype.isPerformanceTimingSupported=function(){var e=we();return e&&e.timing},sn.prototype.isPerformanceTimingDataReady=function(){var e=we();return(e=e?e.timing:0)&&0<e.domainLookupStart&&0<e.navigationStart&&0<e.responseStart&&0<e.requestStart&&0<e.loadEventEnd&&0<e.responseEnd&&0<e.connectEnd&&0<e.domLoading},sn.prototype.shouldCollectDuration=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=["googlebot","adsbot-google","apis-google","mediapartners-google"],r=(Te()||{}).userAgent,i=!1;if(r)for(var a=0;a<n.length;a++)i=i||!!~r.toLowerCase().indexOf(n[a]);if(i)return!1;for(a=0;a<e.length;a++)if(e[a]<0||e[a]>=this.MAX_DURATION_ALLOWED)return!1;return!0},sn);function sn(e){this.MAX_DURATION_ALLOWED=36e5,e&&(this._logger=e.logger)}var ln="duration";function cn(e,t){e&&e.dispatchEvent&&t&&e.dispatchEvent(t)}var un,Fe=(un=Fe,__extends(gn,un),gn.getDefaultConfig=function(e){return(e=e||{}).sessionRenewalMs=18e5,e.sessionExpirationMs=864e5,e.disableExceptionTracking=Je(e.disableExceptionTracking),e.autoTrackPageVisitTime=Je(e.autoTrackPageVisitTime),e.overridePageViewDuration=Je(e.overridePageViewDuration),e.enableUnhandledPromiseRejectionTracking=Je(e.enableUnhandledPromiseRejectionTracking),(isNaN(e.samplingPercentage)||e.samplingPercentage<=0||100<=e.samplingPercentage)&&(e.samplingPercentage=100),e.isCookieUseDisabled=Je(e.isCookieUseDisabled),e.isStorageUseDisabled=Je(e.isStorageUseDisabled),e.isBrowserLinkTrackingEnabled=Je(e.isBrowserLinkTrackingEnabled),e.enableAutoRouteTracking=Je(e.enableAutoRouteTracking),e.namePrefix=e.namePrefix||"",e},gn.Version="2.6.0",gn);function gn(){var v,y,T,I,w,S=un.call(this)||this;return S.identifier=en,S.priority=180,S.autoRoutePVDelay=500,z(gn,S,function(m,h){var e=Ie(!0);I=e&&e.href||"",m.processTelemetry=function(a,o){Le(m.core,function(){return m.identifier+":processTelemetry"},function(){var e=!1,t=m._telemetryInitializers.length;o=m._getTelCtx(o);for(var n=0;n<t;++n){var r=m._telemetryInitializers[n];if(r)try{if(!1===r.call(null,a)){e=!0;break}}catch(i){o.diagLog().throwInternal(x.CRITICAL,F.TelemetryInitializerFailed,"One of telemetry initializers failed, telemetry item will not be sent: "+Q(i),{exception:Ne(i)},!0)}}e||m.processNext(a,o)},function(){return{item:a}},!a.sync)},m.trackEvent=function(e,t){try{var n=Yt.create(e,ft.dataType,ft.envelopeType,m.diagLog(),t);m.core.track(n)}catch(r){m.diagLog().throwInternal(x.WARNING,F.TrackTraceFailed,"trackTrace failed, trace will not be collected: "+Q(r),{exception:Ne(r)})}},m.startTrackEvent=function(e){try{v.start(e)}catch(t){m.diagLog().throwInternal(x.CRITICAL,F.StartTrackEventFailed,"startTrackEvent failed, event will not be collected: "+Q(t),{exception:Ne(t)})}},m.stopTrackEvent=function(e,t,n){try{v.stop(e,undefined,t)}catch(r){m.diagLog().throwInternal(x.CRITICAL,F.StopTrackEventFailed,"stopTrackEvent failed, event will not be collected: "+Q(r),{exception:Ne(r)})}},m.trackTrace=function(e,t){try{var n=Yt.create(e,qt.dataType,qt.envelopeType,m.diagLog(),t);m.core.track(n)}catch(r){m.diagLog().throwInternal(x.WARNING,F.TrackTraceFailed,"trackTrace failed, trace will not be collected: "+Q(r),{exception:Ne(r)})}},m.trackMetric=function(e,t){try{var n=Yt.create(e,At.dataType,At.envelopeType,m.diagLog(),t);m.core.track(n)}catch(r){m.diagLog().throwInternal(x.CRITICAL,F.TrackMetricFailed,"trackMetric failed, metric will not be collected: "+Q(r),{exception:Ne(r)})}},m.trackPageView=function(e,t){try{var n=e||{};m._pageViewManager.trackPageView(n,__assign({},n.properties,n.measurements,t)),m.config.autoTrackPageVisitTime&&m._pageVisitTimeManager.trackPreviousPageVisit(n.name,n.uri)}catch(r){m.diagLog().throwInternal(x.CRITICAL,F.TrackPVFailed,"trackPageView failed, page view will not be collected: "+Q(r),{exception:Ne(r)})}},m.sendPageViewInternal=function(e,t,n){var r=ye();r&&(e.refUri=e.refUri===undefined?r.referrer:e.refUri),n=Yt.create(e,zt.dataType,zt.envelopeType,m.diagLog(),t,n),m.core.track(n)},m.sendPageViewPerformanceInternal=function(e,t,n){n=Yt.create(e,Jt.dataType,Jt.envelopeType,m.diagLog(),t,n),m.core.track(n)},m.trackPageViewPerformance=function(e,t){try{m._pageViewPerformanceManager.populatePageViewPerformanceEvent(e),m.sendPageViewPerformanceInternal(e,t)}catch(n){m.diagLog().throwInternal(x.CRITICAL,F.TrackPVFailed,"trackPageViewPerformance failed, page view will not be collected: "+Q(n),{exception:Ne(n)})}},m.startTrackPage=function(e){try{var t;"string"!=typeof e&&(e=(t=ye())&&t.title||""),y.start(e)}catch(n){m.diagLog().throwInternal(x.CRITICAL,F.StartTrackFailed,"startTrackPage failed, page view may not be collected: "+Q(n),{exception:Ne(n)})}},m.stopTrackPage=function(e,t,n,r){try{var i,a;"string"!=typeof e&&(e=(i=ye())&&i.title||""),"string"!=typeof t&&(t=(a=Ie())&&a.href||""),y.stop(e,t,n,r),m.config.autoTrackPageVisitTime&&m._pageVisitTimeManager.trackPreviousPageVisit(e,t)}catch(o){m.diagLog().throwInternal(x.CRITICAL,F.StopTrackFailed,"stopTrackPage failed, page view will not be collected: "+Q(o),{exception:Ne(o)})}},m.sendExceptionInternal=function(e,t,n){e=new yt(m.diagLog(),e.exception||Error(Qe),e.properties,e.measurements,e.severityLevel,e.id).toInterface(),n=Yt.create(e,yt.dataType,yt.envelopeType,m.diagLog(),t,n),m.core.track(n)},m.trackException=function(e,t){try{m.sendExceptionInternal(e,t)}catch(n){m.diagLog().throwInternal(x.CRITICAL,F.TrackExceptionFailed,"trackException failed, exception will not be collected: "+Q(n),{exception:Ne(n)})}},m._onerror=function(e){try{var t,n={url:e&&e.url||(ye()||{}).URL,lineNumber:e.lineNumber,columnNumber:e.columnNumber,message:e.message},r=e.message;e.url,e.lineNumber,e.columnNumber,e.error||!K(r)||"Script error."!==r&&"Script error"!==r?(X(e.error)||(t="window.onerror@"+n.url+":"+e.lineNumber+":"+(e.columnNumber||0),e.error=Error(e.message),e.error.stack=t),m.trackException({exception:e.error,severityLevel:Kt.Error},n)):(a={message:"Script error: The browser's same-origin policy prevents us from getting the details of this exception. Consider using the 'crossorigin' attribute.",url:i=n.url,lineNumber:0,columnNumber:0,error:undefined},i=Yt.create(a,yt.dataType,yt.envelopeType,m.diagLog(),{url:i}),m.core.track(i))}catch(o){e=e.error?e.error.name+", "+e.error.message:"null",m.diagLog().throwInternal(x.CRITICAL,F.ExceptionWhileLoggingError,"_onError threw exception while logging error, error will not be collected: "+Q(o),{exception:Ne(o),errorString:e})}var i,a},m.addTelemetryInitializer=function(e){m._telemetryInitializers.push(e)},m.initialize=function(e,t,n,r){if(!m.isInitialized()){if(U(t))throw Error("Error initializing");h.initialize(e,t,n,r),m.setInitialized(!1);var i=m._getTelCtx(),a=m.identifier;m.config=i.getExtCfg(a),(t=gn.getDefaultConfig())!==undefined&&W(t,function(e,t){m.config[e]=i.getConfig(a,e,t),m.config[e]===undefined&&(m.config[e]=t)}),m.config.isStorageUseDisabled&&(et=!1),r={instrumentationKey:function(){return e.instrumentationKey},accountId:function(){return m.config.accountId||e.accountId},sessionRenewalMs:function(){return m.config.sessionRenewalMs||e.sessionRenewalMs},sessionExpirationMs:function(){return m.config.sessionExpirationMs||e.sessionExpirationMs},sampleRate:function(){return m.config.samplingPercentage||e.samplingPercentage},sdkExtension:function(){return m.config.sdkExtension||e.sdkExtension},isBrowserLinkTrackingEnabled:function(){return m.config.isBrowserLinkTrackingEnabled||e.isBrowserLinkTrackingEnabled},appId:function(){return m.config.appId||e.appId}},m._pageViewPerformanceManager=new on(m.core),m._pageViewManager=new tn(S,m.config.overridePageViewDuration,m.core,m._pageViewPerformanceManager),m._pageVisitTimeManager=new nn(m.diagLog(),function(e,t,n){m.trackMetric({name:"PageVisitTime",average:n,max:n,min:n,sampleCount:1},t={PageName:e,PageUrl:t})}),m._telemetryInitializers=m._telemetryInitializers||[],r.isBrowserLinkTrackingEnabled()||(p=["/browserLinkSignalR/","/__browserLink/"],m._telemetryInitializers.push(function(e){if(e.baseType===Ot.dataType){var t=e.baseData;if(t)for(var n=0;n<p.length;n++)if(t.target&&~t.target.indexOf(p[n]))return!1}return!0})),(v=new fn(m.diagLog(),"trackEvent")).action=function(e,t,n,r){(r=r||{})[ln]=n.toString(),m.trackEvent({name:e,properties:r})},(y=new fn(m.diagLog(),"trackPageView")).action=function(e,t,n,r,i){(r=U(r)?{}:r)[ln]=n.toString(),m.sendPageViewInternal({name:e,uri:t,properties:r,measurements:i},r)};var o,s,l,c,u,g=ve()?window:he(ne),t=typeof history===te&&history?history:he(ae),f=Ie(!0),d=S;!1===m.config.disableExceptionTracking&&!m.config.autoExceptionInstrumented&&g&&(o=g.onerror,g.onerror=function(e,t,n,r,i){var a=o&&o(e,t,n,r,i);return!0!==a&&d._onerror({message:e=e&&!K(e)?q(e.toString)?e.toString():JSON.stringify(e):e,url:t,lineNumber:n,columnNumber:r,error:i}),a},m.config.autoExceptionInstrumented=!0),!1===m.config.disableExceptionTracking&&!0===m.config.enableUnhandledPromiseRejectionTracking&&!m.config.autoUnhandledPromiseInstrumented&&g&&(s=g[r="onunhandledrejection"],g[r]=function(e){var t=s&&s.call(g,e);return!0!==t&&d._onerror({message:e.reason.toString(),error:e.reason instanceof Error?e.reason:Error(e.reason.toString()),url:f?f.href:"",lineNumber:0,columnNumber:0}),t},m.config.autoUnhandledPromiseInstrumented=!0),!0===m.config.enableAutoRouteTracking&&t&&q(t.pushState)&&q(t.replaceState)&&g&&"undefined"!=typeof Event&&(l=S,J(n,function(e){e.identifier===Qt&&(T=e)}),t.pushState=(u=t.pushState,function(){var e=u.apply(this,arguments);return cn(g,Ke(l.config.namePrefix+"pushState")),cn(g,Ke(l.config.namePrefix+"locationchange")),e}),t.replaceState=(c=t.replaceState,function(){var e=c.apply(this,arguments);return cn(g,Ke(l.config.namePrefix+"replaceState")),cn(g,Ke(l.config.namePrefix+"locationchange")),e}),g.addEventListener&&(g.addEventListener(l.config.namePrefix+"popstate",function(){cn(g,Ke(l.config.namePrefix+"locationchange"))}),g.addEventListener(l.config.namePrefix+"locationchange",function(){T&&T.context&&T.context.telemetryTrace&&(T.context.telemetryTrace.traceID=function(){for(var e,t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],n="",r=0;r<4;r++)n+=t[15&(e=je())]+t[e>>4&15]+t[e>>8&15]+t[e>>12&15]+t[e>>16&15]+t[e>>20&15]+t[e>>24&15]+t[e>>28&15];var i=t[8+(3&je())|0];return n.substr(0,8)+n.substr(9,4)+"4"+n.substr(13,3)+i+n.substr(16,3)+n.substr(19,12)}(),T.context.telemetryTrace.name=f&&f.pathname||"_unknown_"),w&&(I=w),w=f&&f.href||"",setTimeout((function(e){l.trackPageView({refUri:e,properties:{duration:0}})}).bind(S,I),l.autoRoutePVDelay)}))),m.setInitialized(!0)}var p}}),S}var fn=function(a,e){var o=this,s={};o.start=function(e){"undefined"!=typeof s[e]&&a.throwInternal(x.WARNING,F.StartCalledMoreThanOnce,"start was called more than once for this event without calling stop.",{name:e,key:e},!0),s[e]=+new Date},o.stop=function(e,t,n,r){var i=s[e];isNaN(i)?a.throwInternal(x.WARNING,F.StopCalledWithoutStart,"stop was called without a corresponding start.",{name:e,key:e},!0):(i=ut(i,+new Date),o.action(e,t,i,n,r)),delete s[e],s[e]=undefined}};e.ApplicationInsights=Fe,function(e,t,n){var r=Object.defineProperty;if(r)try{return r(e,t,n)}catch(i){}typeof n.value!==undefined&&(e[t]=n.value)}(e,"__esModule",{value:!0})};"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).Microsoft=e.Microsoft||{},e.Microsoft.ApplicationInsights=e.Microsoft.ApplicationInsights||{}));
//# sourceMappingURL=applicationinsights-analytics-js.min.js.map
/*!
* Application Insights JavaScript SDK - Web Analytics, 2.5.11
* Application Insights JavaScript SDK - Web Analytics, 2.6.0
* Copyright (c) Microsoft and contributors. All rights reserved.

@@ -4,0 +4,0 @@ */

/*!
* Application Insights JavaScript SDK - Web Analytics, 2.5.11
* Application Insights JavaScript SDK - Web Analytics, 2.6.0
* Copyright (c) Microsoft and contributors. All rights reserved.

@@ -4,0 +4,0 @@ */

/*!
* Application Insights JavaScript SDK - Web Analytics, 2.5.11
* Application Insights JavaScript SDK - Web Analytics, 2.6.0
* Copyright (c) Microsoft and contributors. All rights reserved.

@@ -9,7 +9,8 @@ */

*/
import { Util, PageViewPerformance, PageView, RemoteDependencyData, Event as EventTelemetry, TelemetryItemCreator, Metric, Exception, SeverityLevel, Trace, DateTimeUtils, PropertiesPluginIdentifier, AnalyticsPluginIdentifier } from "@microsoft/applicationinsights-common";
import { BaseTelemetryPlugin, CoreUtils, LoggingSeverity, _InternalMessageId, getWindow, getDocument, getHistory, getLocation, doPerf, objForEachKey } from "@microsoft/applicationinsights-core-js";
import { PageViewPerformance, PageView, RemoteDependencyData, Event as EventTelemetry, TelemetryItemCreator, Metric, Exception, SeverityLevel, Trace, dateTimeUtilsDuration, PropertiesPluginIdentifier, AnalyticsPluginIdentifier, stringToBoolOrDefault, createDomEvent, strNotSpecified, isCrossOriginError, utlDisableStorage } from "@microsoft/applicationinsights-common";
import { BaseTelemetryPlugin, LoggingSeverity, _InternalMessageId, getWindow, getDocument, getHistory, getLocation, doPerf, objForEachKey, isString, isFunction, isNullOrUndefined, arrForEach, generateW3CId, dumpObj, getExceptionName, isError } from "@microsoft/applicationinsights-core-js";
import { PageViewManager } from "./Telemetry/PageViewManager";
import { PageVisitTimeManager } from "./Telemetry/PageVisitTimeManager";
import { PageViewPerformanceManager } from './Telemetry/PageViewPerformanceManager';
import dynamicProto from "@microsoft/dynamicproto-js";
"use strict";

@@ -22,2 +23,14 @@ var durationProperty = "duration";

}
function _formatMessage(message) {
if (message && !isString(message)) {
// tslint:disable-next-line: prefer-conditional-expression
if (isFunction(message.toString)) {
message = message.toString();
}
else {
message = JSON.stringify(message);
}
}
return message;
}
var ApplicationInsights = /** @class */ (function (_super) {

@@ -30,521 +43,531 @@ __extends(ApplicationInsights, _super);

_this.autoRoutePVDelay = 500; // ms; Time to wait after a route change before triggering a pageview to allow DOM changes to take place
// Counts number of trackAjax invokations.
var _eventTracking;
var _pageTracking;
var _properties;
// Counts number of trackAjax invocations.
// By default we only monitor X ajax call per view to avoid too much load.
// Default value is set in config.
// This counter keeps increasing even after the limit is reached.
_this._trackAjaxAttempts = 0;
var location = getLocation();
_this._prevUri = location && location.href || "";
return _this;
}
ApplicationInsights.getDefaultConfig = function (config) {
if (!config) {
config = {};
}
// set default values
config.sessionRenewalMs = 30 * 60 * 1000;
config.sessionExpirationMs = 24 * 60 * 60 * 1000;
config.disableExceptionTracking = Util.stringToBoolOrDefault(config.disableExceptionTracking);
config.autoTrackPageVisitTime = Util.stringToBoolOrDefault(config.autoTrackPageVisitTime);
config.overridePageViewDuration = Util.stringToBoolOrDefault(config.overridePageViewDuration);
config.enableUnhandledPromiseRejectionTracking = Util.stringToBoolOrDefault(config.enableUnhandledPromiseRejectionTracking);
if (isNaN(config.samplingPercentage) || config.samplingPercentage <= 0 || config.samplingPercentage >= 100) {
config.samplingPercentage = 100;
}
config.isCookieUseDisabled = Util.stringToBoolOrDefault(config.isCookieUseDisabled);
config.isStorageUseDisabled = Util.stringToBoolOrDefault(config.isStorageUseDisabled);
config.isBrowserLinkTrackingEnabled = Util.stringToBoolOrDefault(config.isBrowserLinkTrackingEnabled);
config.enableAutoRouteTracking = Util.stringToBoolOrDefault(config.enableAutoRouteTracking);
config.namePrefix = config.namePrefix || "";
return config;
};
ApplicationInsights.prototype.processTelemetry = function (env, itemCtx) {
var _this = this;
doPerf(this.core, function () { return _this.identifier + ":processTelemetry"; }, function () {
var doNotSendItem = false;
var telemetryInitializersCount = _this._telemetryInitializers.length;
itemCtx = _this._getTelCtx(itemCtx);
for (var i = 0; i < telemetryInitializersCount; ++i) {
var telemetryInitializer = _this._telemetryInitializers[i];
if (telemetryInitializer) {
try {
if (telemetryInitializer.apply(null, [env]) === false) {
doNotSendItem = true;
break;
var _trackAjaxAttempts = 0;
// array with max length of 2 that store current url and previous url for SPA page route change trackPageview use.
var _prevUri; // Assigned in the constructor
var _currUri;
dynamicProto(ApplicationInsights, _this, function (_self, _base) {
var location = getLocation(true);
_prevUri = location && location.href || "";
_self.processTelemetry = function (env, itemCtx) {
doPerf(_self.core, function () { return _self.identifier + ":processTelemetry"; }, function () {
var doNotSendItem = false;
var telemetryInitializersCount = _self._telemetryInitializers.length;
itemCtx = _self._getTelCtx(itemCtx);
for (var i = 0; i < telemetryInitializersCount; ++i) {
var telemetryInitializer = _self._telemetryInitializers[i];
if (telemetryInitializer) {
try {
if (telemetryInitializer.apply(null, [env]) === false) {
doNotSendItem = true;
break;
}
}
catch (e) {
// log error but dont stop executing rest of the telemetry initializers
// doNotSendItem = true;
itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryInitializerFailed, "One of telemetry initializers failed, telemetry item will not be sent: " + getExceptionName(e), { exception: dumpObj(e) }, true);
}
}
}
catch (e) {
// log error but dont stop executing rest of the telemetry initializers
// doNotSendItem = true;
itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryInitializerFailed, "One of telemetry initializers failed, telemetry item will not be sent: " + Util.getExceptionName(e), { exception: Util.dump(e) }, true);
if (!doNotSendItem) {
_self.processNext(env, itemCtx);
}
}, function () { return ({ item: env }); }, !(env.sync));
};
_self.trackEvent = function (event, customProperties) {
try {
var telemetryItem = TelemetryItemCreator.create(event, EventTelemetry.dataType, EventTelemetry.envelopeType, _self.diagLog(), customProperties);
_self.core.track(telemetryItem);
}
}
if (!doNotSendItem) {
_this.processNext(env, itemCtx);
}
}, function () { return ({ item: env }); }, !(env.sync));
};
ApplicationInsights.prototype.trackEvent = function (event, customProperties) {
try {
var telemetryItem = TelemetryItemCreator.create(event, EventTelemetry.dataType, EventTelemetry.envelopeType, this.diagLog(), customProperties);
this.core.track(telemetryItem);
}
catch (e) {
this.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TrackTraceFailed, "trackTrace failed, trace will not be collected: " + Util.getExceptionName(e), { exception: Util.dump(e) });
}
};
/**
* Start timing an extended event. Call `stopTrackEvent` to log the event when it ends.
* @param name A string that identifies this event uniquely within the document.
*/
ApplicationInsights.prototype.startTrackEvent = function (name) {
try {
this._eventTracking.start(name);
}
catch (e) {
this.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.StartTrackEventFailed, "startTrackEvent failed, event will not be collected: " + Util.getExceptionName(e), { exception: Util.dump(e) });
}
};
/**
* Log an extended event that you started timing with `startTrackEvent`.
* @param name The string you used to identify this event in `startTrackEvent`.
* @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
* @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.
*/
ApplicationInsights.prototype.stopTrackEvent = function (name, properties, measurements) {
try {
this._eventTracking.stop(name, undefined, properties); // Todo: Fix to pass measurements once type is updated
}
catch (e) {
this.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.StopTrackEventFailed, "stopTrackEvent failed, event will not be collected: " + Util.getExceptionName(e), { exception: Util.dump(e) });
}
};
/**
* @description Log a diagnostic message
* @param {ITraceTelemetry} trace
* @param ICustomProperties.
* @memberof ApplicationInsights
*/
ApplicationInsights.prototype.trackTrace = function (trace, customProperties) {
try {
var telemetryItem = TelemetryItemCreator.create(trace, Trace.dataType, Trace.envelopeType, this.diagLog(), customProperties);
this.core.track(telemetryItem);
}
catch (e) {
this.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TrackTraceFailed, "trackTrace failed, trace will not be collected: " + Util.getExceptionName(e), { exception: Util.dump(e) });
}
};
/**
* @description Log a numeric value that is not associated with a specific event. Typically
* used to send regular reports of performance indicators. To send single measurement, just
* use the name and average fields of {@link IMetricTelemetry}. If you take measurements
* frequently, you can reduce the telemetry bandwidth by aggregating multiple measurements
* and sending the resulting average at intervals
* @param {IMetricTelemetry} metric input object argument. Only name and average are mandatory.
* @param {{[key: string]: any}} customProperties additional data used to filter metrics in the
* portal. Defaults to empty.
* @memberof ApplicationInsights
*/
ApplicationInsights.prototype.trackMetric = function (metric, customProperties) {
try {
var telemetryItem = TelemetryItemCreator.create(metric, Metric.dataType, Metric.envelopeType, this.diagLog(), customProperties);
this.core.track(telemetryItem);
}
catch (e) {
this.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TrackMetricFailed, "trackMetric failed, metric will not be collected: " + Util.getExceptionName(e), { exception: Util.dump(e) });
}
};
/**
* Logs that a page or other item was viewed.
* @param IPageViewTelemetry The string you used as the name in startTrackPage. Defaults to the document title.
* @param customProperties Additional data used to filter events and metrics. Defaults to empty.
* If a user wants to provide duration for pageLoad, it'll have to be in pageView.properties.duration
*/
ApplicationInsights.prototype.trackPageView = function (pageView, customProperties) {
try {
var inPv = pageView || {};
this._pageViewManager.trackPageView(inPv, __assign({}, inPv.properties, inPv.measurements, customProperties));
if (this.config.autoTrackPageVisitTime) {
this._pageVisitTimeManager.trackPreviousPageVisit(inPv.name, inPv.uri);
}
}
catch (e) {
this.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TrackPVFailed, "trackPageView failed, page view will not be collected: " + Util.getExceptionName(e), { exception: Util.dump(e) });
}
};
/**
* Create a page view telemetry item and send it to the SDK pipeline through the core.track API
* @param pageView Page view item to be sent
* @param properties Custom properties (Part C) that a user can add to the telemetry item
* @param systemProperties System level properties (Part A) that a user can add to the telemetry item
*/
ApplicationInsights.prototype.sendPageViewInternal = function (pageView, properties, systemProperties) {
var doc = getDocument();
if (doc) {
pageView.refUri = pageView.refUri === undefined ? doc.referrer : pageView.refUri;
}
var telemetryItem = TelemetryItemCreator.create(pageView, PageView.dataType, PageView.envelopeType, this.diagLog(), properties, systemProperties);
this.core.track(telemetryItem);
// reset ajaxes counter
this._trackAjaxAttempts = 0;
};
/**
* @ignore INTERNAL ONLY
* @param pageViewPerformance
* @param properties
*/
ApplicationInsights.prototype.sendPageViewPerformanceInternal = function (pageViewPerformance, properties, systemProperties) {
var telemetryItem = TelemetryItemCreator.create(pageViewPerformance, PageViewPerformance.dataType, PageViewPerformance.envelopeType, this.diagLog(), properties, systemProperties);
this.core.track(telemetryItem);
};
/**
* Send browser performance metrics.
* @param pageViewPerformance
* @param customProperties
*/
ApplicationInsights.prototype.trackPageViewPerformance = function (pageViewPerformance, customProperties) {
try {
this._pageViewPerformanceManager.populatePageViewPerformanceEvent(pageViewPerformance);
this.sendPageViewPerformanceInternal(pageViewPerformance, customProperties);
}
catch (e) {
this.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TrackPVFailed, "trackPageViewPerformance failed, page view will not be collected: " + Util.getExceptionName(e), { exception: Util.dump(e) });
}
};
/**
* Starts the timer for tracking a page load time. Use this instead of `trackPageView` if you want to control when the page view timer starts and stops,
* but don't want to calculate the duration yourself. This method doesn't send any telemetry. Call `stopTrackPage` to log the end of the page view
* and send the event.
* @param name A string that idenfities this item, unique within this HTML document. Defaults to the document title.
*/
ApplicationInsights.prototype.startTrackPage = function (name) {
try {
if (typeof name !== "string") {
catch (e) {
_self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TrackTraceFailed, "trackTrace failed, trace will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
}
};
/**
* Start timing an extended event. Call `stopTrackEvent` to log the event when it ends.
* @param name A string that identifies this event uniquely within the document.
*/
_self.startTrackEvent = function (name) {
try {
_eventTracking.start(name);
}
catch (e) {
_self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.StartTrackEventFailed, "startTrackEvent failed, event will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
}
};
/**
* Log an extended event that you started timing with `startTrackEvent`.
* @param name The string you used to identify this event in `startTrackEvent`.
* @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
* @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.
*/
_self.stopTrackEvent = function (name, properties, measurements) {
try {
_eventTracking.stop(name, undefined, properties); // Todo: Fix to pass measurements once type is updated
}
catch (e) {
_self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.StopTrackEventFailed, "stopTrackEvent failed, event will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
}
};
/**
* @description Log a diagnostic message
* @param {ITraceTelemetry} trace
* @param ICustomProperties.
* @memberof ApplicationInsights
*/
_self.trackTrace = function (trace, customProperties) {
try {
var telemetryItem = TelemetryItemCreator.create(trace, Trace.dataType, Trace.envelopeType, _self.diagLog(), customProperties);
_self.core.track(telemetryItem);
}
catch (e) {
_self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TrackTraceFailed, "trackTrace failed, trace will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
}
};
/**
* @description Log a numeric value that is not associated with a specific event. Typically
* used to send regular reports of performance indicators. To send single measurement, just
* use the name and average fields of {@link IMetricTelemetry}. If you take measurements
* frequently, you can reduce the telemetry bandwidth by aggregating multiple measurements
* and sending the resulting average at intervals
* @param {IMetricTelemetry} metric input object argument. Only name and average are mandatory.
* @param {{[key: string]: any}} customProperties additional data used to filter metrics in the
* portal. Defaults to empty.
* @memberof ApplicationInsights
*/
_self.trackMetric = function (metric, customProperties) {
try {
var telemetryItem = TelemetryItemCreator.create(metric, Metric.dataType, Metric.envelopeType, _self.diagLog(), customProperties);
_self.core.track(telemetryItem);
}
catch (e) {
_self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TrackMetricFailed, "trackMetric failed, metric will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
}
};
/**
* Logs that a page or other item was viewed.
* @param IPageViewTelemetry The string you used as the name in startTrackPage. Defaults to the document title.
* @param customProperties Additional data used to filter events and metrics. Defaults to empty.
* If a user wants to provide duration for pageLoad, it'll have to be in pageView.properties.duration
*/
_self.trackPageView = function (pageView, customProperties) {
try {
var inPv = pageView || {};
_self._pageViewManager.trackPageView(inPv, __assign({}, inPv.properties, inPv.measurements, customProperties));
if (_self.config.autoTrackPageVisitTime) {
_self._pageVisitTimeManager.trackPreviousPageVisit(inPv.name, inPv.uri);
}
}
catch (e) {
_self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TrackPVFailed, "trackPageView failed, page view will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
}
};
/**
* Create a page view telemetry item and send it to the SDK pipeline through the core.track API
* @param pageView Page view item to be sent
* @param properties Custom properties (Part C) that a user can add to the telemetry item
* @param systemProperties System level properties (Part A) that a user can add to the telemetry item
*/
_self.sendPageViewInternal = function (pageView, properties, systemProperties) {
var doc = getDocument();
name = doc && doc.title || "";
}
this._pageTracking.start(name);
}
catch (e) {
this.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.StartTrackFailed, "startTrackPage failed, page view may not be collected: " + Util.getExceptionName(e), { exception: Util.dump(e) });
}
};
/**
* Stops the timer that was started by calling `startTrackPage` and sends the pageview load time telemetry with the specified properties and measurements.
* The duration of the page view will be the time between calling `startTrackPage` and `stopTrackPage`.
* @param name The string you used as the name in startTrackPage. Defaults to the document title.
* @param url String - a relative or absolute URL that identifies the page or other item. Defaults to the window location.
* @param properties map[string, string] - additional data used to filter pages and metrics in the portal. Defaults to empty.
* @param measurements map[string, number] - metrics associated with this page, displayed in Metrics Explorer on the portal. Defaults to empty.
*/
ApplicationInsights.prototype.stopTrackPage = function (name, url, properties, measurement) {
try {
if (typeof name !== "string") {
var doc = getDocument();
name = doc && doc.title || "";
}
if (typeof url !== "string") {
var loc = getLocation();
url = loc && loc.href || "";
}
this._pageTracking.stop(name, url, properties, measurement);
if (this.config.autoTrackPageVisitTime) {
this._pageVisitTimeManager.trackPreviousPageVisit(name, url);
}
}
catch (e) {
this.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.StopTrackFailed, "stopTrackPage failed, page view will not be collected: " + Util.getExceptionName(e), { exception: Util.dump(e) });
}
};
/**
* @ignore INTERNAL ONLY
* @param exception
* @param properties
* @param systemProperties
*/
ApplicationInsights.prototype.sendExceptionInternal = function (exception, customProperties, systemProperties) {
var exceptionPartB = new Exception(this.diagLog(), exception.exception || new Error(Util.NotSpecified), exception.properties, exception.measurements, exception.severityLevel, exception.id).toInterface();
var telemetryItem = TelemetryItemCreator.create(exceptionPartB, Exception.dataType, Exception.envelopeType, this.diagLog(), customProperties, systemProperties);
this.core.track(telemetryItem);
};
/**
* Log an exception you have caught.
*
* @param {IExceptionTelemetry} exception Object which contains exception to be sent
* @param {{[key: string]: any}} customProperties Additional data used to filter pages and metrics in the portal. Defaults to empty.
*
* Any property of type double will be considered a measurement, and will be treated by Application Insights as a metric.
* @memberof ApplicationInsights
*/
ApplicationInsights.prototype.trackException = function (exception, customProperties) {
try {
this.sendExceptionInternal(exception, customProperties);
}
catch (e) {
this.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TrackExceptionFailed, "trackException failed, exception will not be collected: " + Util.getExceptionName(e), { exception: Util.dump(e) });
}
};
/**
* @description Custom error handler for Application Insights Analytics
* @param {IAutoExceptionTelemetry} exception
* @memberof ApplicationInsights
*/
ApplicationInsights.prototype._onerror = function (exception) {
try {
var properties_1 = {
url: (exception && exception.url) || (getDocument() || {}).URL,
lineNumber: exception.lineNumber,
columnNumber: exception.columnNumber,
message: exception.message
if (doc) {
pageView.refUri = pageView.refUri === undefined ? doc.referrer : pageView.refUri;
}
var telemetryItem = TelemetryItemCreator.create(pageView, PageView.dataType, PageView.envelopeType, _self.diagLog(), properties, systemProperties);
_self.core.track(telemetryItem);
// reset ajaxes counter
_trackAjaxAttempts = 0;
};
if (Util.isCrossOriginError(exception.message, exception.url, exception.lineNumber, exception.columnNumber, exception.error)) {
this._sendCORSException(properties_1.url);
}
else {
if (!Util.isError(exception.error)) {
var stack = "window.onerror@" + properties_1.url + ":" + exception.lineNumber + ":" + (exception.columnNumber || 0);
exception.error = new Error(exception.message);
exception.error.stack = stack;
/**
* @ignore INTERNAL ONLY
* @param pageViewPerformance
* @param properties
*/
_self.sendPageViewPerformanceInternal = function (pageViewPerformance, properties, systemProperties) {
var telemetryItem = TelemetryItemCreator.create(pageViewPerformance, PageViewPerformance.dataType, PageViewPerformance.envelopeType, _self.diagLog(), properties, systemProperties);
_self.core.track(telemetryItem);
};
/**
* Send browser performance metrics.
* @param pageViewPerformance
* @param customProperties
*/
_self.trackPageViewPerformance = function (pageViewPerformance, customProperties) {
try {
_self._pageViewPerformanceManager.populatePageViewPerformanceEvent(pageViewPerformance);
_self.sendPageViewPerformanceInternal(pageViewPerformance, customProperties);
}
this.trackException({ exception: exception.error, severityLevel: SeverityLevel.Error }, properties_1);
}
}
catch (e) {
var errorString = exception.error ?
(exception.error.name + ", " + exception.error.message)
: "null";
this.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.ExceptionWhileLoggingError, "_onError threw exception while logging error, error will not be collected: "
+ Util.getExceptionName(e), { exception: Util.dump(e), errorString: errorString });
}
};
ApplicationInsights.prototype.addTelemetryInitializer = function (telemetryInitializer) {
this._telemetryInitializers.push(telemetryInitializer);
};
ApplicationInsights.prototype.initialize = function (config, core, extensions, pluginChain) {
var _this = this;
if (this.isInitialized()) {
return;
}
if (CoreUtils.isNullOrUndefined(core)) {
throw Error("Error initializing");
}
_super.prototype.initialize.call(this, config, core, extensions, pluginChain);
this.setInitialized(false); // resetting the initialized state, just in case the following fails
var ctx = this._getTelCtx();
var identifier = this.identifier;
this._globalconfig = {
instrumentationKey: config.instrumentationKey,
endpointUrl: config.endpointUrl || "https://dc.services.visualstudio.com/v2/track"
};
this.config = ctx.getExtCfg(identifier);
// load default values if specified
var defaults = ApplicationInsights.getDefaultConfig();
if (defaults !== undefined) {
objForEachKey(defaults, function (field, value) {
// for each unspecified field, set the default value
_this.config[field] = ctx.getConfig(identifier, field, value);
});
if (this._globalconfig) {
objForEachKey(defaults, function (field, value) {
if (_this._globalconfig[field] === undefined) {
_this._globalconfig[field] = value;
catch (e) {
_self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TrackPVFailed, "trackPageViewPerformance failed, page view will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
}
};
/**
* Starts the timer for tracking a page load time. Use this instead of `trackPageView` if you want to control when the page view timer starts and stops,
* but don't want to calculate the duration yourself. This method doesn't send any telemetry. Call `stopTrackPage` to log the end of the page view
* and send the event.
* @param name A string that idenfities this item, unique within this HTML document. Defaults to the document title.
*/
_self.startTrackPage = function (name) {
try {
if (typeof name !== "string") {
var doc = getDocument();
name = doc && doc.title || "";
}
});
}
}
// Todo: move this out of static state
if (this.config.isCookieUseDisabled) {
Util.disableCookies();
}
// Todo: move this out of static state
if (this.config.isStorageUseDisabled) {
Util.disableStorage();
}
var configGetters = {
instrumentationKey: function () { return config.instrumentationKey; },
accountId: function () { return _this.config.accountId || config.accountId; },
sessionRenewalMs: function () { return _this.config.sessionRenewalMs || config.sessionRenewalMs; },
sessionExpirationMs: function () { return _this.config.sessionExpirationMs || config.sessionExpirationMs; },
sampleRate: function () { return _this.config.samplingPercentage || config.samplingPercentage; },
cookieDomain: function () { return _this.config.cookieDomain || config.cookieDomain; },
sdkExtension: function () { return _this.config.sdkExtension || config.sdkExtension; },
isBrowserLinkTrackingEnabled: function () { return _this.config.isBrowserLinkTrackingEnabled || config.isBrowserLinkTrackingEnabled; },
appId: function () { return _this.config.appId || config.appId; }
};
this._pageViewPerformanceManager = new PageViewPerformanceManager(this.core);
this._pageViewManager = new PageViewManager(this, this.config.overridePageViewDuration, this.core, this._pageViewPerformanceManager);
this._pageVisitTimeManager = new PageVisitTimeManager(this.diagLog(), function (pageName, pageUrl, pageVisitTime) { return _this.trackPageVisitTime(pageName, pageUrl, pageVisitTime); });
this._telemetryInitializers = this._telemetryInitializers || [];
this._addDefaultTelemetryInitializers(configGetters);
this._eventTracking = new Timing(this.diagLog(), "trackEvent");
this._eventTracking.action =
function (name, url, duration, properties) {
if (!properties) {
properties = {};
_pageTracking.start(name);
}
properties[durationProperty] = duration.toString();
_this.trackEvent({ name: name, properties: properties });
catch (e) {
_self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.StartTrackFailed, "startTrackPage failed, page view may not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
}
};
// initialize page view timing
this._pageTracking = new Timing(this.diagLog(), "trackPageView");
this._pageTracking.action = function (name, url, duration, properties, measurements) {
// duration must be a custom property in order for the collector to extract it
if (CoreUtils.isNullOrUndefined(properties)) {
properties = {};
}
properties[durationProperty] = duration.toString();
var pageViewItem = {
name: name,
uri: url,
properties: properties,
measurements: measurements
/**
* Stops the timer that was started by calling `startTrackPage` and sends the pageview load time telemetry with the specified properties and measurements.
* The duration of the page view will be the time between calling `startTrackPage` and `stopTrackPage`.
* @param name The string you used as the name in startTrackPage. Defaults to the document title.
* @param url String - a relative or absolute URL that identifies the page or other item. Defaults to the window location.
* @param properties map[string, string] - additional data used to filter pages and metrics in the portal. Defaults to empty.
* @param measurements map[string, number] - metrics associated with this page, displayed in Metrics Explorer on the portal. Defaults to empty.
*/
_self.stopTrackPage = function (name, url, properties, measurement) {
try {
if (typeof name !== "string") {
var doc = getDocument();
name = doc && doc.title || "";
}
if (typeof url !== "string") {
var loc = getLocation();
url = loc && loc.href || "";
}
_pageTracking.stop(name, url, properties, measurement);
if (_self.config.autoTrackPageVisitTime) {
_self._pageVisitTimeManager.trackPreviousPageVisit(name, url);
}
}
catch (e) {
_self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.StopTrackFailed, "stopTrackPage failed, page view will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
}
};
_this.sendPageViewInternal(pageViewItem, properties);
};
var _window = getWindow();
var _history = getHistory();
var _location = getLocation();
var instance = this;
if (this.config.disableExceptionTracking === false &&
!this.config.autoExceptionInstrumented && _window) {
// We want to enable exception auto collection and it has not been done so yet
var onerror_1 = "onerror";
var originalOnError_1 = _window[onerror_1];
_window.onerror = function (message, url, lineNumber, columnNumber, error) {
var handled = originalOnError_1 && originalOnError_1(message, url, lineNumber, columnNumber, error);
if (handled !== true) {
instance._onerror({
message: message,
url: url,
lineNumber: lineNumber,
columnNumber: columnNumber,
error: error
});
/**
* @ignore INTERNAL ONLY
* @param exception
* @param properties
* @param systemProperties
*/
_self.sendExceptionInternal = function (exception, customProperties, systemProperties) {
var exceptionPartB = new Exception(_self.diagLog(), exception.exception || new Error(strNotSpecified), exception.properties, exception.measurements, exception.severityLevel, exception.id).toInterface();
var telemetryItem = TelemetryItemCreator.create(exceptionPartB, Exception.dataType, Exception.envelopeType, _self.diagLog(), customProperties, systemProperties);
_self.core.track(telemetryItem);
};
/**
* Log an exception you have caught.
*
* @param {IExceptionTelemetry} exception Object which contains exception to be sent
* @param {{[key: string]: any}} customProperties Additional data used to filter pages and metrics in the portal. Defaults to empty.
*
* Any property of type double will be considered a measurement, and will be treated by Application Insights as a metric.
* @memberof ApplicationInsights
*/
_self.trackException = function (exception, customProperties) {
try {
_self.sendExceptionInternal(exception, customProperties);
}
return handled;
catch (e) {
_self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TrackExceptionFailed, "trackException failed, exception will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
}
};
this.config.autoExceptionInstrumented = true;
}
if (this.config.disableExceptionTracking === false &&
this.config.enableUnhandledPromiseRejectionTracking === true &&
!this.config.autoUnhandledPromiseInstrumented && _window) {
// We want to enable exception auto collection and it has not been done so yet
var onunhandledrejection = "onunhandledrejection";
var originalOnUnhandledRejection_1 = _window[onunhandledrejection];
_window[onunhandledrejection] = function (error) {
var handled = originalOnUnhandledRejection_1 && originalOnUnhandledRejection_1.call(_window, error);
if (handled !== true) {
instance._onerror({
message: error.reason.toString(),
error: error.reason instanceof Error ? error.reason : new Error(error.reason.toString()),
url: _location ? _location.href : "",
lineNumber: 0,
columnNumber: 0
});
/**
* @description Custom error handler for Application Insights Analytics
* @param {IAutoExceptionTelemetry} exception
* @memberof ApplicationInsights
*/
_self._onerror = function (exception) {
try {
var properties_1 = {
url: (exception && exception.url) || (getDocument() || {}).URL,
lineNumber: exception.lineNumber,
columnNumber: exception.columnNumber,
message: exception.message
};
if (isCrossOriginError(exception.message, exception.url, exception.lineNumber, exception.columnNumber, exception.error)) {
_sendCORSException(properties_1.url);
}
else {
if (!isError(exception.error)) {
var stack = "window.onerror@" + properties_1.url + ":" + exception.lineNumber + ":" + (exception.columnNumber || 0);
exception.error = new Error(exception.message);
exception.error.stack = stack;
}
_self.trackException({ exception: exception.error, severityLevel: SeverityLevel.Error }, properties_1);
}
}
return handled;
catch (e) {
var errorString = exception.error ?
(exception.error.name + ", " + exception.error.message)
: "null";
_self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.ExceptionWhileLoggingError, "_onError threw exception while logging error, error will not be collected: "
+ getExceptionName(e), { exception: dumpObj(e), errorString: errorString });
}
};
this.config.autoUnhandledPromiseInstrumented = true;
}
/**
* Create a custom "locationchange" event which is triggered each time the history object is changed
*/
if (this.config.enableAutoRouteTracking === true
&& _history && CoreUtils.isFunction(_history.pushState) && CoreUtils.isFunction(_history.replaceState)
&& _window
&& typeof Event !== "undefined") {
var _self_1 = this;
// Find the properties plugin
CoreUtils.arrForEach(extensions, function (extension) {
if (extension.identifier === PropertiesPluginIdentifier) {
_this._properties = extension;
_self.addTelemetryInitializer = function (telemetryInitializer) {
_self._telemetryInitializers.push(telemetryInitializer);
};
_self.initialize = function (config, core, extensions, pluginChain) {
if (_self.isInitialized()) {
return;
}
});
_history.pushState = (function (f) { return function pushState() {
var ret = f.apply(this, arguments);
_dispatchEvent(_window, Util.createDomEvent(_self_1.config.namePrefix + "pushState"));
_dispatchEvent(_window, Util.createDomEvent(_self_1.config.namePrefix + "locationchange"));
return ret;
}; })(_history.pushState);
_history.replaceState = (function (f) { return function replaceState() {
var ret = f.apply(this, arguments);
_dispatchEvent(_window, Util.createDomEvent(_self_1.config.namePrefix + "replaceState"));
_dispatchEvent(_window, Util.createDomEvent(_self_1.config.namePrefix + "locationchange"));
return ret;
}; })(_history.replaceState);
if (_window.addEventListener) {
_window.addEventListener(_self_1.config.namePrefix + "popstate", function () {
_dispatchEvent(_window, Util.createDomEvent(_self_1.config.namePrefix + "locationchange"));
});
_window.addEventListener(_self_1.config.namePrefix + "locationchange", function () {
if (_self_1._properties && _self_1._properties.context && _self_1._properties.context.telemetryTrace) {
_self_1._properties.context.telemetryTrace.traceID = Util.generateW3CId();
_self_1._properties.context.telemetryTrace.name = _location && _location.pathname || "_unknown_";
if (isNullOrUndefined(core)) {
throw Error("Error initializing");
}
_base.initialize(config, core, extensions, pluginChain);
_self.setInitialized(false); // resetting the initialized state, just in case the following fails
var ctx = _self._getTelCtx();
var identifier = _self.identifier;
_self.config = ctx.getExtCfg(identifier);
// load default values if specified
var defaults = ApplicationInsights.getDefaultConfig();
if (defaults !== undefined) {
objForEachKey(defaults, function (field, value) {
// for each unspecified field, set the default value
_self.config[field] = ctx.getConfig(identifier, field, value);
if (_self.config[field] === undefined) {
_self.config[field] = value;
}
});
}
// Todo: move this out of static state
if (_self.config.isStorageUseDisabled) {
utlDisableStorage();
}
var configGetters = {
instrumentationKey: function () { return config.instrumentationKey; },
accountId: function () { return _self.config.accountId || config.accountId; },
sessionRenewalMs: function () { return _self.config.sessionRenewalMs || config.sessionRenewalMs; },
sessionExpirationMs: function () { return _self.config.sessionExpirationMs || config.sessionExpirationMs; },
sampleRate: function () { return _self.config.samplingPercentage || config.samplingPercentage; },
sdkExtension: function () { return _self.config.sdkExtension || config.sdkExtension; },
isBrowserLinkTrackingEnabled: function () { return _self.config.isBrowserLinkTrackingEnabled || config.isBrowserLinkTrackingEnabled; },
appId: function () { return _self.config.appId || config.appId; }
};
_self._pageViewPerformanceManager = new PageViewPerformanceManager(_self.core);
_self._pageViewManager = new PageViewManager(_this, _self.config.overridePageViewDuration, _self.core, _self._pageViewPerformanceManager);
_self._pageVisitTimeManager = new PageVisitTimeManager(_self.diagLog(), function (pageName, pageUrl, pageVisitTime) { return trackPageVisitTime(pageName, pageUrl, pageVisitTime); });
_self._telemetryInitializers = _self._telemetryInitializers || [];
_addDefaultTelemetryInitializers(configGetters);
_eventTracking = new Timing(_self.diagLog(), "trackEvent");
_eventTracking.action =
function (name, url, duration, properties) {
if (!properties) {
properties = {};
}
properties[durationProperty] = duration.toString();
_self.trackEvent({ name: name, properties: properties });
};
// initialize page view timing
_pageTracking = new Timing(_self.diagLog(), "trackPageView");
_pageTracking.action = function (name, url, duration, properties, measurements) {
// duration must be a custom property in order for the collector to extract it
if (isNullOrUndefined(properties)) {
properties = {};
}
if (_this._currUri) {
_this._prevUri = _this._currUri;
_this._currUri = _location && _location.href || "";
properties[durationProperty] = duration.toString();
var pageViewItem = {
name: name,
uri: url,
properties: properties,
measurements: measurements
};
_self.sendPageViewInternal(pageViewItem, properties);
};
var _window = getWindow();
var _history = getHistory();
var _location = getLocation(true);
var instance = _this;
if (_self.config.disableExceptionTracking === false &&
!_self.config.autoExceptionInstrumented && _window) {
// We want to enable exception auto collection and it has not been done so yet
var onerror_1 = "onerror";
var originalOnError_1 = _window[onerror_1];
_window.onerror = function (message, url, lineNumber, columnNumber, error) {
var handled = originalOnError_1 && originalOnError_1(message, url, lineNumber, columnNumber, error);
if (handled !== true) {
instance._onerror({
message: _formatMessage(message),
url: url,
lineNumber: lineNumber,
columnNumber: columnNumber,
error: error
});
}
return handled;
};
_self.config.autoExceptionInstrumented = true;
}
if (_self.config.disableExceptionTracking === false &&
_self.config.enableUnhandledPromiseRejectionTracking === true &&
!_self.config.autoUnhandledPromiseInstrumented && _window) {
// We want to enable exception auto collection and it has not been done so yet
var onunhandledrejection = "onunhandledrejection";
var originalOnUnhandledRejection_1 = _window[onunhandledrejection];
_window[onunhandledrejection] = function (error) {
var handled = originalOnUnhandledRejection_1 && originalOnUnhandledRejection_1.call(_window, error);
if (handled !== true) {
instance._onerror({
message: error.reason.toString(),
error: error.reason instanceof Error ? error.reason : new Error(error.reason.toString()),
url: _location ? _location.href : "",
lineNumber: 0,
columnNumber: 0
});
}
return handled;
};
_self.config.autoUnhandledPromiseInstrumented = true;
}
/**
* Create a custom "locationchange" event which is triggered each time the history object is changed
*/
if (_self.config.enableAutoRouteTracking === true
&& _history && isFunction(_history.pushState) && isFunction(_history.replaceState)
&& _window
&& typeof Event !== "undefined") {
var _self_1 = _this;
// Find the properties plugin
arrForEach(extensions, function (extension) {
if (extension.identifier === PropertiesPluginIdentifier) {
_properties = extension;
}
});
_history.pushState = (function (f) { return function pushState() {
var ret = f.apply(this, arguments);
_dispatchEvent(_window, createDomEvent(_self_1.config.namePrefix + "pushState"));
_dispatchEvent(_window, createDomEvent(_self_1.config.namePrefix + "locationchange"));
return ret;
}; })(_history.pushState);
_history.replaceState = (function (f) { return function replaceState() {
var ret = f.apply(this, arguments);
_dispatchEvent(_window, createDomEvent(_self_1.config.namePrefix + "replaceState"));
_dispatchEvent(_window, createDomEvent(_self_1.config.namePrefix + "locationchange"));
return ret;
}; })(_history.replaceState);
if (_window.addEventListener) {
_window.addEventListener(_self_1.config.namePrefix + "popstate", function () {
_dispatchEvent(_window, createDomEvent(_self_1.config.namePrefix + "locationchange"));
});
_window.addEventListener(_self_1.config.namePrefix + "locationchange", function () {
if (_properties && _properties.context && _properties.context.telemetryTrace) {
_properties.context.telemetryTrace.traceID = generateW3CId();
_properties.context.telemetryTrace.name = _location && _location.pathname || "_unknown_";
}
if (_currUri) {
_prevUri = _currUri;
_currUri = _location && _location.href || "";
}
else {
_currUri = _location && _location.href || "";
}
setTimeout((function (uri) {
// todo: override start time so that it is not affected by autoRoutePVDelay
_self_1.trackPageView({ refUri: uri, properties: { duration: 0 } }); // SPA route change loading durations are undefined, so send 0
}).bind(_this, _prevUri), _self_1.autoRoutePVDelay);
});
}
else {
_this._currUri = _location && _location.href || "";
}
setTimeout((function (uri) {
// todo: override start time so that it is not affected by autoRoutePVDelay
_self_1.trackPageView({ refUri: uri, properties: { duration: 0 } }); // SPA route change loading durations are undefined, so send 0
}).bind(_this, _this._prevUri), _self_1.autoRoutePVDelay);
});
}
_self.setInitialized(true);
};
/**
* Log a page visit time
* @param pageName Name of page
* @param pageVisitDuration Duration of visit to the page in milleseconds
*/
function trackPageVisitTime(pageName, pageUrl, pageVisitTime) {
var properties = { PageName: pageName, PageUrl: pageUrl };
_self.trackMetric({
name: "PageVisitTime",
average: pageVisitTime,
max: pageVisitTime,
min: pageVisitTime,
sampleCount: 1
}, properties);
}
}
this.setInitialized(true);
};
/**
* Log a page visit time
* @param pageName Name of page
* @param pageVisitDuration Duration of visit to the page in milleseconds
*/
ApplicationInsights.prototype.trackPageVisitTime = function (pageName, pageUrl, pageVisitTime) {
var properties = { PageName: pageName, PageUrl: pageUrl };
this.trackMetric({
name: "PageVisitTime",
average: pageVisitTime,
max: pageVisitTime,
min: pageVisitTime,
sampleCount: 1
}, properties);
};
ApplicationInsights.prototype._addDefaultTelemetryInitializers = function (configGetters) {
if (!configGetters.isBrowserLinkTrackingEnabled()) {
var browserLinkPaths_1 = ['/browserLinkSignalR/', '/__browserLink/'];
var dropBrowserLinkRequests = function (envelope) {
if (envelope.baseType === RemoteDependencyData.dataType) {
var remoteData = envelope.baseData;
if (remoteData) {
for (var i = 0; i < browserLinkPaths_1.length; i++) {
if (remoteData.target && remoteData.target.indexOf(browserLinkPaths_1[i]) >= 0) {
return false;
function _addDefaultTelemetryInitializers(configGetters) {
if (!configGetters.isBrowserLinkTrackingEnabled()) {
var browserLinkPaths_1 = ['/browserLinkSignalR/', '/__browserLink/'];
var dropBrowserLinkRequests = function (envelope) {
if (envelope.baseType === RemoteDependencyData.dataType) {
var remoteData = envelope.baseData;
if (remoteData) {
for (var i = 0; i < browserLinkPaths_1.length; i++) {
if (remoteData.target && remoteData.target.indexOf(browserLinkPaths_1[i]) >= 0) {
return false;
}
}
}
}
}
return true;
};
_addTelemetryInitializer(dropBrowserLinkRequests);
}
return true;
};
this._addTelemetryInitializer(dropBrowserLinkRequests);
}
function _addTelemetryInitializer(telemetryInitializer) {
_self._telemetryInitializers.push(telemetryInitializer);
}
function _sendCORSException(url) {
var exception = {
message: "Script error: The browser's same-origin policy prevents us from getting the details of this exception. Consider using the 'crossorigin' attribute.",
url: url,
lineNumber: 0,
columnNumber: 0,
error: undefined
};
var telemetryItem = TelemetryItemCreator.create(exception, Exception.dataType, Exception.envelopeType, _self.diagLog(), { url: url });
_self.core.track(telemetryItem);
}
});
return _this;
}
ApplicationInsights.getDefaultConfig = function (config) {
if (!config) {
config = {};
}
// set default values
config.sessionRenewalMs = 30 * 60 * 1000;
config.sessionExpirationMs = 24 * 60 * 60 * 1000;
config.disableExceptionTracking = stringToBoolOrDefault(config.disableExceptionTracking);
config.autoTrackPageVisitTime = stringToBoolOrDefault(config.autoTrackPageVisitTime);
config.overridePageViewDuration = stringToBoolOrDefault(config.overridePageViewDuration);
config.enableUnhandledPromiseRejectionTracking = stringToBoolOrDefault(config.enableUnhandledPromiseRejectionTracking);
if (isNaN(config.samplingPercentage) || config.samplingPercentage <= 0 || config.samplingPercentage >= 100) {
config.samplingPercentage = 100;
}
config.isCookieUseDisabled = stringToBoolOrDefault(config.isCookieUseDisabled);
config.isStorageUseDisabled = stringToBoolOrDefault(config.isStorageUseDisabled);
config.isBrowserLinkTrackingEnabled = stringToBoolOrDefault(config.isBrowserLinkTrackingEnabled);
config.enableAutoRouteTracking = stringToBoolOrDefault(config.enableAutoRouteTracking);
config.namePrefix = config.namePrefix || "";
return config;
};
ApplicationInsights.prototype._addTelemetryInitializer = function (telemetryInitializer) {
this._telemetryInitializers.push(telemetryInitializer);
};
ApplicationInsights.prototype._sendCORSException = function (url) {
var exception = {
message: "Script error: The browser's same-origin policy prevents us from getting the details of this exception. Consider using the 'crossorigin' attribute.",
url: url,
lineNumber: 0,
columnNumber: 0,
error: undefined
};
var telemetryItem = TelemetryItemCreator.create(exception, Exception.dataType, Exception.envelopeType, this.diagLog(), { url: url });
this.core.track(telemetryItem);
};
ApplicationInsights.Version = "2.5.11"; // Not currently used anywhere
// Removed Stub for ApplicationInsights.prototype.processTelemetry.
// Removed Stub for ApplicationInsights.prototype.trackEvent.
// Removed Stub for ApplicationInsights.prototype.startTrackEvent.
// Removed Stub for ApplicationInsights.prototype.stopTrackEvent.
// Removed Stub for ApplicationInsights.prototype.trackTrace.
// Removed Stub for ApplicationInsights.prototype.trackMetric.
// Removed Stub for ApplicationInsights.prototype.trackPageView.
// Removed Stub for ApplicationInsights.prototype.sendPageViewInternal.
// Removed Stub for ApplicationInsights.prototype.sendPageViewPerformanceInternal.
// Removed Stub for ApplicationInsights.prototype.trackPageViewPerformance.
// Removed Stub for ApplicationInsights.prototype.startTrackPage.
// Removed Stub for ApplicationInsights.prototype.stopTrackPage.
// Removed Stub for ApplicationInsights.prototype.sendExceptionInternal.
// Removed Stub for ApplicationInsights.prototype.trackException.
// Removed Stub for ApplicationInsights.prototype._onerror.
// Removed Stub for ApplicationInsights.prototype.addTelemetryInitializer.
// Removed Stub for ApplicationInsights.prototype.initialize.
ApplicationInsights.Version = "2.6.0"; // Not currently used anywhere
return ApplicationInsights;

@@ -558,27 +581,26 @@ }(BaseTelemetryPlugin));

function Timing(logger, name) {
this._name = name;
this._events = {};
this._logger = logger;
var _self = this;
var _events = {};
_self.start = function (name) {
if (typeof _events[name] !== "undefined") {
logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.StartCalledMoreThanOnce, "start was called more than once for this event without calling stop.", { name: name, key: name }, true);
}
_events[name] = +new Date;
};
_self.stop = function (name, url, properties, measurements) {
var start = _events[name];
if (isNaN(start)) {
logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.StopCalledWithoutStart, "stop was called without a corresponding start.", { name: name, key: name }, true);
}
else {
var end = +new Date;
var duration = dateTimeUtilsDuration(start, end);
_self.action(name, url, duration, properties, measurements);
}
delete _events[name];
_events[name] = undefined;
};
}
Timing.prototype.start = function (name) {
if (typeof this._events[name] !== "undefined") {
this._logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.StartCalledMoreThanOnce, "start was called more than once for this event without calling stop.", { name: this._name, key: name }, true);
}
this._events[name] = +new Date;
};
Timing.prototype.stop = function (name, url, properties, measurements) {
var start = this._events[name];
if (isNaN(start)) {
this._logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.StopCalledWithoutStart, "stop was called without a corresponding start.", { name: this._name, key: name }, true);
}
else {
var end = +new Date;
var duration = DateTimeUtils.GetDuration(start, end);
this.action(name, url, duration, properties, measurements);
}
delete this._events[name];
this._events[name] = undefined;
};
return Timing;
}());
//# sourceMappingURL=ApplicationInsights.js.map
/*!
* Application Insights JavaScript SDK - Web Analytics, 2.5.11
* Application Insights JavaScript SDK - Web Analytics, 2.6.0
* Copyright (c) Microsoft and contributors. All rights reserved.

@@ -7,4 +7,4 @@ */

import { DateTimeUtils, Util } from '@microsoft/applicationinsights-common';
import { CoreUtils, LoggingSeverity, _InternalMessageId, getDocument, getLocation } from '@microsoft/applicationinsights-core-js';
import { dateTimeUtilsDuration } from '@microsoft/applicationinsights-common';
import { LoggingSeverity, _InternalMessageId, getDocument, getLocation, arrForEach, isNullOrUndefined, getExceptionName, dumpObj } from '@microsoft/applicationinsights-core-js';
import dynamicProto from "@microsoft/dynamicproto-js";

@@ -17,4 +17,2 @@ /**

dynamicProto(PageViewManager, this, function (_self) {
var arrForEach = CoreUtils.arrForEach;
var isNullOrUndefined = CoreUtils.isNullOrUndefined;
var intervalHandle = null;

@@ -87,3 +85,3 @@ var itemQueue = [];

if (start > 0) {
customDuration = DateTimeUtils.GetDuration(start, +new Date);
customDuration = dateTimeUtilsDuration(start, +new Date);
if (!pageViewPerformanceManager.shouldCollectDuration(customDuration)) {

@@ -146,3 +144,3 @@ customDuration = undefined;

}
else if (start > 0 && DateTimeUtils.GetDuration(start, +new Date) > maxDurationLimit) {
else if (start > 0 && dateTimeUtilsDuration(start, +new Date) > maxDurationLimit) {
// if performance timings are not ready but we exceeded the maximum duration limit, just log a page view telemetry

@@ -158,3 +156,3 @@ // with the maximum duration limit. Otherwise, keep waiting until performance timings are ready

catch (e) {
_logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TrackPVFailedCalc, "trackPageView failed on page load calculation: " + Util.getExceptionName(e), { exception: Util.dump(e) });
_logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TrackPVFailedCalc, "trackPageView failed on page load calculation: " + getExceptionName(e), { exception: dumpObj(e) });
}

@@ -161,0 +159,0 @@ return processed;

/*!
* Application Insights JavaScript SDK - Web Analytics, 2.5.11
* Application Insights JavaScript SDK - Web Analytics, 2.6.0
* Copyright (c) Microsoft and contributors. All rights reserved.

@@ -7,3 +7,3 @@ */

import { Util, DateTimeUtils } from '@microsoft/applicationinsights-common';
import { dateTimeUtilsDuration, msToTimeSpan } from '@microsoft/applicationinsights-common';
import { LoggingSeverity, _InternalMessageId, getNavigator, getPerformance } from '@microsoft/applicationinsights-core-js';

@@ -39,13 +39,13 @@ /**

var total = navigationTiming.duration;
var network = DateTimeUtils.GetDuration(navigationTiming.startTime, navigationTiming.connectEnd);
var request = DateTimeUtils.GetDuration(navigationTiming.requestStart, navigationTiming.responseStart);
var response = DateTimeUtils.GetDuration(navigationTiming.responseStart, navigationTiming.responseEnd);
var dom = DateTimeUtils.GetDuration(navigationTiming.responseEnd, navigationTiming.loadEventEnd);
var network = dateTimeUtilsDuration(navigationTiming.startTime, navigationTiming.connectEnd);
var request = dateTimeUtilsDuration(navigationTiming.requestStart, navigationTiming.responseStart);
var response = dateTimeUtilsDuration(navigationTiming.responseStart, navigationTiming.responseEnd);
var dom = dateTimeUtilsDuration(navigationTiming.responseEnd, navigationTiming.loadEventEnd);
}
else {
var total = DateTimeUtils.GetDuration(timing.navigationStart, timing.loadEventEnd);
var network = DateTimeUtils.GetDuration(timing.navigationStart, timing.connectEnd);
var request = DateTimeUtils.GetDuration(timing.requestStart, timing.responseStart);
var response = DateTimeUtils.GetDuration(timing.responseStart, timing.responseEnd);
var dom = DateTimeUtils.GetDuration(timing.responseEnd, timing.loadEventEnd);
var total = dateTimeUtilsDuration(timing.navigationStart, timing.loadEventEnd);
var network = dateTimeUtilsDuration(timing.navigationStart, timing.connectEnd);
var request = dateTimeUtilsDuration(timing.requestStart, timing.responseStart);
var response = dateTimeUtilsDuration(timing.responseStart, timing.responseEnd);
var dom = dateTimeUtilsDuration(timing.responseEnd, timing.loadEventEnd);
}

@@ -66,7 +66,7 @@ if (total === 0) {

// // convert to timespans
pageViewPerformance.perfTotal = pageViewPerformance.duration = Util.msToTimeSpan(total);
pageViewPerformance.networkConnect = Util.msToTimeSpan(network);
pageViewPerformance.sentRequest = Util.msToTimeSpan(request);
pageViewPerformance.receivedResponse = Util.msToTimeSpan(response);
pageViewPerformance.domProcessing = Util.msToTimeSpan(dom);
pageViewPerformance.perfTotal = pageViewPerformance.duration = msToTimeSpan(total);
pageViewPerformance.networkConnect = msToTimeSpan(network);
pageViewPerformance.sentRequest = msToTimeSpan(request);
pageViewPerformance.receivedResponse = msToTimeSpan(response);
pageViewPerformance.domProcessing = msToTimeSpan(dom);
pageViewPerformance.isValid = true;

@@ -73,0 +73,0 @@ }

/*!
* Application Insights JavaScript SDK - Web Analytics, 2.5.11
* Application Insights JavaScript SDK - Web Analytics, 2.6.0
* Copyright (c) Microsoft and contributors. All rights reserved.

@@ -7,4 +7,4 @@ */

import { Util } from '@microsoft/applicationinsights-common';
import { hasJSON, getJSON, CoreUtils } from '@microsoft/applicationinsights-core-js';
import { utlCanUseSessionStorage, utlGetSessionStorage, utlRemoveSessionStorage, utlSetSessionStorage } from '@microsoft/applicationinsights-common';
import { hasJSON, getJSON, dateNow, dumpObj, throwError } from '@microsoft/applicationinsights-core-js';
/**

@@ -39,3 +39,3 @@ * Used to track page visit durations

catch (e) {
this._logger.warnToConsole("Auto track page visit time failed, metric will not be collected: " + Util.dump(e));
this._logger.warnToConsole("Auto track page visit time failed, metric will not be collected: " + dumpObj(e));
}

@@ -55,3 +55,3 @@ };

catch (e) {
this._logger.warnToConsole("Call to restart failed: " + Util.dump(e));
this._logger.warnToConsole("Call to restart failed: " + dumpObj(e));
return null;

@@ -67,9 +67,9 @@ }

try {
if (Util.canUseSessionStorage()) {
if (Util.getSessionStorage(this._logger, this.prevPageVisitDataKeyName) != null) {
throw new Error("Cannot call startPageVisit consecutively without first calling stopPageVisit");
if (utlCanUseSessionStorage()) {
if (utlGetSessionStorage(this._logger, this.prevPageVisitDataKeyName) != null) {
throwError("Cannot call startPageVisit consecutively without first calling stopPageVisit");
}
var currPageVisitData = new PageVisitData(pageName, pageUrl);
var currPageVisitDataStr = getJSON().stringify(currPageVisitData);
Util.setSessionStorage(this._logger, this.prevPageVisitDataKeyName, currPageVisitDataStr);
utlSetSessionStorage(this._logger, this.prevPageVisitDataKeyName, currPageVisitDataStr);
}

@@ -79,3 +79,3 @@ }

// TODO: Remove this catch in next phase, since if start is called twice in a row the exception needs to be propagated out
this._logger.warnToConsole("Call to start failed: " + Util.dump(e));
this._logger.warnToConsole("Call to start failed: " + dumpObj(e));
}

@@ -89,7 +89,7 @@ };

try {
if (Util.canUseSessionStorage()) {
if (utlCanUseSessionStorage()) {
// Define end time of page's visit
var pageVisitEndTime = CoreUtils.dateNow();
var pageVisitEndTime = dateNow();
// Try to retrieve page name and start time from session storage
var pageVisitDataJsonStr = Util.getSessionStorage(this._logger, this.prevPageVisitDataKeyName);
var pageVisitDataJsonStr = utlGetSessionStorage(this._logger, this.prevPageVisitDataKeyName);
if (pageVisitDataJsonStr && hasJSON()) {

@@ -100,3 +100,3 @@ // if previous page data exists, set end time of visit

// Remove data from storage since we already used it
Util.removeSessionStorage(this._logger, this.prevPageVisitDataKeyName);
utlRemoveSessionStorage(this._logger, this.prevPageVisitDataKeyName);
// Return page visit data

@@ -112,3 +112,3 @@ return prevPageVisitData;

catch (e) {
this._logger.warnToConsole("Stop page visit timer failed: " + Util.dump(e));
this._logger.warnToConsole("Stop page visit timer failed: " + dumpObj(e));
return null;

@@ -122,3 +122,3 @@ }

function PageVisitData(pageName, pageUrl) {
this.pageVisitStartTime = CoreUtils.dateNow();
this.pageVisitStartTime = dateNow();
this.pageName = pageName;

@@ -125,0 +125,0 @@ this.pageUrl = pageUrl;

/*!
* Application Insights JavaScript SDK - Web Analytics, 2.5.11
* Application Insights JavaScript SDK - Web Analytics, 2.6.0
* Copyright (c) Microsoft and contributors. All rights reserved.
*/
var e=this,t=function(e){"use strict";var r="function",i="object",t="undefined",o="prototype",a="hasOwnProperty";function n(){return typeof globalThis!==t&&globalThis?globalThis:typeof self!==t&&self?self:typeof window!==t&&window?window:typeof global!==t&&global?global:null}function s(e){var t=Object.create;if(t)return t(e);if(null==e)return{};if((t=typeof e)!==i&&t!==r)throw new TypeError("Object prototype may only be an Object:"+e);function n(){}return n[o]=e,new n}var c,p,u=function(e,t){return(u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t[a](n)&&(e[n]=t[n])})(e,t)};nt=function(e,t){function n(){this.constructor=e}u(e,t),e[o]=null===t?s(t):(n[o]=t[o],new n)},(Be=wt=n()||{}).__assign||(Be.__assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object[o][a].call(t,i)&&(e[i]=t[i]);return e}),Be.__extends||(Be.__extends=nt),__assign=__assign||wt.__assign,__extends=__extends||wt.__extends,(pn=c={})[pn.LocalStorage=0]="LocalStorage",pn[pn.SessionStorage=1]="SessionStorage",(Ct=p=p||{})[Ct.Default=0]="Default",Ct[Ct.Required=1]="Required",Ct[Ct.Array=2]="Array",Ct[Ct.Hidden=4]="Hidden",(Lt={})[Lt.AI=0]="AI",Lt[Lt.AI_AND_W3C=1]="AI_AND_W3C",Lt[Lt.W3C=2]="W3C";var l=2,f=t,m=i,g=o,d="window",h="location",v="JSON",y=n;function x(e){var t=y();return t&&t[e]?t[e]:e===d&&_()?window:null}function _(){return typeof window===m&&window}function S(){return _()?window:x(d)}function T(){return typeof document===m&&document?document:x("document")}function I(){return typeof navigator===m&&navigator?navigator:x("navigator")}function w(){return typeof location===m&&location?location:x(h)}function N(){return x("performance")}function E(){return typeof JSON===m&&JSON||null!==x(v)}function C(){return E()?JSON||x(v):null}var b="attachEvent",D="addEventListener",P="detachEvent",k="removeEventListener",A=4294967296,L=4294967295,M=null,R=!1,O=123456789,U=987654321;function z(e){e<0&&(e>>>=0),O=123456789+e&L,U=987654321-e&L,R=!0}function V(){z(Math.random()*A^(new Date).getTime())}function G(e,t){return typeof e===t}function j(e){return G(e,t)||e===undefined}function q(e){return j(e)||null===e}function F(e,t){return e&&Object[o].hasOwnProperty.call(e,t)}function B(e){return G(e,i)}function K(e){return G(e,r)}function W(e,t,n,r){void 0===r&&(r=!1);var i=!1;if(!q(e))try{q(e[D])?q(e[b])||(e[b]("on"+t,n),i=!0):(e[D](t,n,r),i=!0)}catch(o){}return i}function H(e,t,n,r){if(void 0===r&&(r=!1),!q(e))try{q(e[k])?q(e[P])||e[P]("on"+t,n):e[k](t,n,r)}catch(i){}}function X(e,t){if(e&&B(e))for(var n in e)F(e,n)&&t.call(e,n,e[n])}var J=($.isDate=function(e){return"[object Date]"===Object[o].toString.call(e)},$.isArray=function(e){return"[object Array]"===Object[o].toString.call(e)},$.isError=function(e){return"[object Error]"===Object[o].toString.call(e)},$.isString=function(e){return G(e,"string")},$.isNumber=function(e){return G(e,"number")},$.isBoolean=function(e){return G(e,"boolean")},$.disableCookies=function(){$._canUseCookies=!1},$.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(Y,function(e){var t=0|$.randomValue(15);return("x"===e?t:3&t|8).toString(16)})},$.toISOString=function(e){if($.isDate(e)){var t=function(e){return 1===(e+="").length&&(e="0"+e),e};return e.getUTCFullYear()+"-"+t(1+e.getUTCMonth())+"-"+t(e.getUTCDate())+"T"+t(e.getUTCHours())+":"+t(e.getUTCMinutes())+":"+t(e.getUTCSeconds())+"."+((e.getUTCMilliseconds()/1e3).toFixed(3)+"").slice(2,5)+"Z"}},$.arrForEach=function(e,t,n){for(var r=e.length,i=0;i<r;i++)i in e&&t.call(n||e,e[i],i,e)},$.arrIndexOf=function(e,t,n){for(var r=e.length,i=Math.max(0<=(n=n||0)?n:r-Math.abs(n),0);i<r;i++)if(i in e&&e[i]===t)return i;return-1},$.arrMap=function(e,t,n){for(var r=e.length,i=n||e,o=Array(r),a=0;a<r;a++)a in e&&(o[a]=t.call(i,e[a],e));return o},$.arrReduce=function(e,t,n){var r,i=e.length,o=0;if(3<=arguments.length)r=n;else{for(;o<i&&!(o in e);)o++;r=e[o++]}for(;o<i;)o in e&&(r=t(r,e[o],o,e)),o++;return r},$.strTrim=function(e){return $.isString(e)?e.replace(/^\s+|\s+$/g,""):e},$.objKeys=function(e){var t=!{toString:null}.propertyIsEnumerable("toString");if(!(K(e)||B(e)&&null!==e))throw new TypeError("objKeys called on non-object");var n,r=[];for(n in e)F(e,n)&&r.push(n);if(t)for(var i=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],o=i.length,a=0;a<o;a++)F(e,i[a])&&r.push(i[a]);return r},$.addEventHandler=function(e,t){var n=!1,r=S();return r&&(n=W(r,e,t),n=W(r.body,e,t)||n),(r=T())&&(n=Z.Attach(r,e,t)||n),n},$.dateNow=function(){var e=Date;return e.now?e.now():(new e).getTime()},$.perfNow=function(){var e=N();return e&&e.now?e.now():$.dateNow()},$.newId=function(e){void 0===e&&(e=22);for(var t=$.random32()>>>0,n=0,r="";r.length<e;)r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[0|63&t],t>>>=6,5==++n&&(t=($.random32()<<2&4294967295|3&t)>>>0,n=0);return r},$.isIE=function(){var e;return null===M&&(e=((I()||{}).userAgent||"").toLowerCase(),M=!!~e.indexOf("msie")||!!~e.indexOf("trident/")),M},$.randomValue=function(e){return 0<e?Math.floor($.random32()/L*(e+1))>>>0:0},$.random32=function(e){var t=(t=x("crypto")||x("msCrypto"))&&t.getRandomValues?t.getRandomValues(new Uint32Array(1))[0]&L:$.isIE()?(R||V(),$.mwcRandom32()&L):Math.floor(A*Math.random()|0);return e||(t>>>=0),t},$.mwcRandomSeed=function(e){e?z(e):V()},$.mwcRandom32=function(e){var t=((U=36969*(65535&U)+(U>>16)&L)<<16)+(65535&(O=18e3*(65535&O)+(O>>16)&L))>>>0&L|0;return e||(t>>>=0),t},$.generateW3CId=function(){for(var e,t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],n="",r=0;r<4;r++)n+=t[15&(e=$.random32())]+t[e>>4&15]+t[e>>8&15]+t[e>>12&15]+t[e>>16&15]+t[e>>20&15]+t[e>>24&15]+t[e>>28&15];var i=t[8+(3&$.random32())|0];return n.substr(0,8)+n.substr(9,4)+"4"+n.substr(13,3)+i+n.substr(16,3)+n.substr(19,12)},$.isTypeof=G,$.isUndefined=j,$.isNullOrUndefined=q,$.hasOwnProperty=F,$.isFunction=K,$.isObject=B,$.objCreate=s,$.objDefineAccessors=function(e,t,n,r){var i=Object.defineProperty;if(i)try{var o={enumerable:!0,configurable:!0};return n&&(o.get=n),r&&(o.set=r),i(e,t,o),!0}catch(a){}return!1},$);function $(){}var Q,Y=/[xy]/g,Z=(ee.Attach=W,ee.AttachEvent=W,ee.Detach=H,ee.DetachEvent=H,ee);function ee(){}(Mt=Q={})[Mt.CRITICAL=1]="CRITICAL",Mt[Mt.WARNING=2]="WARNING";var te="constructor",ne="prototype",re="function",ie="_dynInstFuncs",oe="_isDynProxy",ae="_dynClass",se="_dynCls$",ce="_dynInstChk",ue=ce,le="_dfOpts",fe="_unknown_",ge="__proto__",pe="useBaseInst",de="setInstFuncs",me=Object.getPrototypeOf,he=0;function ve(e,t){return e&&Object[ne].hasOwnProperty.call(e,t)}function ye(e){return typeof e===re}function xe(e){return e&&(e===Object[ne]||e===Array[ne])}function _e(e){return xe(e)||e===Function[ne]}function Se(e){if(e){if(me)return me(e);if(e=e[ge]||e[ne]||e[te])return e}return null}function Te(e,t,n){return t!==te&&ye(e[t])&&(n||ve(e,t))}function Ie(e){throw new TypeError("DynamicProto: "+e)}function we(e,t){for(var n=e.length-1;0<=n;n--)if(e[n]===t)return 1}function Ne(e,t){return ve(e,ne)?e.name||t||fe:((e||{})[te]||{}).name||t||fe}function Ee(e,n,t,r){ve(e,ne)||Ie("theClass is an invalid class definition.");var i=e[ne];!function(e){for(var t=Se(n);t&&!_e(t);){if(t===e)return 1;t=Se(t)}}(i)&&Ie("["+Ne(e)+"] is not in class hierarchy of ["+Ne(n)+"]");var o=null;ve(i,ae)?o=i[ae]:(o=se+Ne(e,"_")+"$"+he,he++,i[ae]=o);var a=Ee[le],s=!!a[pe];s&&r&&r[pe]!==undefined&&(s=!!r[pe]),t(n,function(e,t,n,o){function r(e,t,n){var r,i=t[c];return i[oe]&&o&&!1!==(r=e[ie]||{})[ue]&&(i=(r[t[ae]]||{})[n]||i),function(){return i.apply(e,arguments)}}var i={};for(c in n)i[c]=r(t,n,c);for(var a=Se(e),s=[];a&&!_e(a)&&!we(s,a);){for(var c in a)!i[c]&&Te(a,c,!me)&&(i[c]=r(t,a,c));s.push(a),a=Se(a)}return i}(i,n,e=function(e){var t,n={};for(t in e)!n[t]&&Te(e,t,!1)&&(n[t]=e[t]);return n}(n),s)),(a=!!me&&!!a[de])&&r&&(a=!!r[de]),function(e,t,n,r,i){if(!xe(e)){var o,a=n[ie]=n[ie]||{},s=a[t]=a[t]||{};for(o in!1!==a[ue]&&(a[ue]=!!i),n)Te(n,o,!1)&&n[o]!==r[o]&&(s[o]=n[o],delete n[o],ve(e,o)&&(!e[o]||e[o][oe])||(e[o]=function(n,r){var i=function(){var e,t;return(function(e,t,n,r){var i=null;if(e&&ve(n,ae)){var o=e[ie]||{};if((i=(o[n[ae]]||{})[t])||Ie("Missing ["+t+"] "+re),!i[ce]&&!1!==o[ue]){for(var a=!ve(e,t),s=Se(e),c=[];a&&s&&!_e(s)&&!we(c,s);){var u=s[t];if(u){a=u===r;break}c.push(s),s=Se(s)}try{a&&(e[t]=i),i[ce]=1}catch(l){o[ue]=!1}}}return i}(this,r,n,i)||((t=n[e=r])===i&&(t=Se(n)[e]),ye(t)||Ie("["+e+"] is not a "+re),t)).apply(this,arguments)};return i[oe]=1,i}(e,o)))}}(i,o,n,e,!1!==a)}function Ce(e){return e?'"'+e.replace(/\"/g,"")+'"':""}Ee[le]={setInstFuncs:!0,useBaseInst:!0};var be=(De.dataType="MessageData",De);function De(e,t,n,r){void 0===n&&(n=!1),this.messageId=e,this.message=(n?"AI: ":"AI (Internal): ")+e,e="",E()&&(e=C().stringify(r)),e=(t?" message:"+Ce(t):"")+(r?" props:"+Ce(e):""),this.message+=e}var Pe=function Vn(i){this.identifier="DiagnosticLogger",this.queue=[];var s=0,c={};Ee(Vn,this,function(o){var n=J.isNullOrUndefined,a=J.isUndefined,r=J.isFunction;function e(e,t){return e=i[e],n(e)?t:e}n(i)&&(i={}),o.consoleLoggingLevel=function(){return e("loggingLevelConsole",0)},o.telemetryLoggingLevel=function(){return e("loggingLevelTelemetry",1)},o.maxInternalMessageLimit=function(){return e("maxMessageLimit",25)},o.enableDebugExceptions=function(){return e("enableDebugExceptions",!1)},o.throwInternal=function(e,t,n,r,i){if(void 0===i&&(i=!1),r=new be(t,n,i,r),o.enableDebugExceptions())throw r;!a(r)&&r&&(a(r.message)||(i?(i=+r.messageId,!c[i]&&o.consoleLoggingLevel()>=Q.WARNING&&(o.warnToConsole(r.message),c[i]=!0)):o.consoleLoggingLevel()>=Q.WARNING&&o.warnToConsole(r.message),o.logInternalMessage(e,r)))},o.warnToConsole=function(e){var t,n=typeof console!==f?console:x("console");n&&(t="log",n.warn&&(t="warn"),r(n[t])&&n[t](e))},o.resetInternalMessageCount=function(){s=0,c={}},o.logInternalMessage=function(e,t){var n,r;s>=o.maxInternalMessageLimit()||(n=!0,r="AITR_"+t.messageId,c[r]?n=!1:c[r]=!0,n&&(e<=o.telemetryLoggingLevel()&&(o.queue.push(t),s++),s===o.maxInternalMessageLimit()&&(t=new be(23,e="Internal events throttle limit per PageView reached for this app.",!1),o.queue.push(t),o.warnToConsole(e))))}})},ke="ctx",Ae=(Le.ParentContextKey="parent",Le.ChildrenContextKey="childEvts",Le);function Le(e,i,t){var n,o=this,a=!1;o.start=J.dateNow(),o.name=e,o.isAsync=t,o.isChildEvt=function(){return!1},J.isFunction(i)&&(a=J.objDefineAccessors(o,"payload",function(){return!n&&J.isFunction(i)&&(n=i(),i=null),n})),o.getCtx=function(e){return e?(e===Le.ParentContextKey||e===Le.ChildrenContextKey?o:o[ke]||{})[e]:null},o.setCtx=function(e,t){e&&(e===Le.ParentContextKey?(o[e]||(o.isChildEvt=function(){return!0}),o[e]=t):e===Le.ChildrenContextKey?o[e]=t:(o[ke]=o[ke]||{})[e]=t)},o.complete=function(){var e=0,t=o.getCtx(Le.ChildrenContextKey);if(J.isArray(t))for(var n=0;n<t.length;n++){var r=t[n];r&&(e+=r.time)}o.time=J.dateNow()-o.start,o.exTime=o.time-e,o.complete=function(){},!a&&J.isFunction(i)&&(o.payload=i())}}var Me=function Gn(t){this.ctx={},Ee(Gn,this,function(n){n.create=function(e,t,n){return new Ae(e,t,n)},n.fire=function(e){e&&(e.complete(),t&&t.perfEvent(e))},n.setCtx=function(e,t){e&&((n[ke]=n[ke]||{})[e]=t)},n.getCtx=function(e){return(n[ke]||{})[e]}})},Re="CoreUtils.doPerf";function Oe(e,t,n,r,i){if(e){var o=e;if(o&&J.isFunction(o.getPerfMgr)&&(o=o.getPerfMgr()),o){var a,s=void 0,c=o.getCtx(Re);try{if(s=o.create(t(),r,i))return c&&s.setCtx&&(s.setCtx(Ae.ParentContextKey,c),c.getCtx&&c.setCtx&&((a=c.getCtx(Ae.ChildrenContextKey))||(a=[],c.setCtx(Ae.ChildrenContextKey,a)),a.push(s))),o.setCtx(Re,s),n(s)}catch(u){s&&s.setCtx&&s.setCtx("exception",u)}finally{s&&o.fire(s),o.setCtx(Re,c)}}}return n()}var Ue=J.isFunction,ze=function(i,t){var o=this,a=null,s=Ue(i.processTelemetry),c=Ue(i.setNextPlugin);o._hasRun=!1,o.getPlugin=function(){return i},o.getNext=function(){return a},o.setNext=function(e){a=e},o.processTelemetry=function(n,r){r=r||t;var e=i?i.identifier:"TelemetryPluginChain";Oe(r?r.core():null,function(){return e+":processTelemetry"},function(){if(i&&s){o._hasRun=!0;try{r.setNext(a),c&&i.setNextPlugin(a),a&&(a._hasRun=!1),i.processTelemetry(n,r)}catch(t){var e=a&&a._hasRun;a&&e||r.diagLog().throwInternal(Q.CRITICAL,73,"Plugin ["+i.identifier+"] failed during processTelemetry - "+t),a&&!e&&a.processTelemetry(n,r)}}else a&&(o._hasRun=!0,a.processTelemetry(n,r))},function(){return{item:n}},!n.sync)}},Ve=J.isNullOrUndefined;function Ge(e,t){var n=[];if(e&&0<e.length)for(var r=null,i=0;i<e.length;i++){var o=e[i];o&&J.isFunction(o.processTelemetry)&&(o=new ze(o,t),n.push(o),r&&r.setNext(o),r=o)}return 0<n.length?n[0]:null}var je=function jn(e,i,n,t){var r,o,a,s,c=this,u=null;null!==t&&(e&&J.isFunction(e.getPlugin)?u=function(e,t,n){var r=[],i=!n;if(e)for(;e;){var o=e.getPlugin();!i&&o!==n||(i=!0,r.push(o)),e=e.getNext()}return i||r.push(n),Ge(r,t)}(e,c,t||e.getPlugin()):t?(r=c,a=e,s=!1,(o=t)&&e&&(a=[],J.arrForEach(e,function(e){!s&&e!==o||(s=!0,a.push(e))})),o&&!s&&(a=a||[]).push(o),u=Ge(a,r)):J.isUndefined(t)&&(u=Ge(e,c))),c.core=function(){return n},c.diagLog=function(){return(n||{}).logger||new Pe(i||{})},c.getCfg=function(){return i},c.getExtCfg=function(e,t){var n,r;return void 0===t&&(t={}),!i||(r=i.extensionConfig)&&e&&(n=r[e]),n||t},c.getConfig=function(e,t,n){var r;return void 0===n&&(n=!1),(e=c.getExtCfg(e,null))&&!Ve(e[t])?r=e[t]:i&&!Ve(i[t])&&(r=i[t]),Ve(r)?n:r},c.hasNext=function(){return null!=u},c.getNext=function(){return u},c.setNext=function(e){u=e},c.processNext=function(e){var t=u;t&&(u=t.getNext(),t.processTelemetry(e,c))},c.createNew=function(e,t){return void 0===e&&(e=null),new jn(e||u,i,n,t)}},qe=J.isFunction,Fe="getPlugin",Be=(Ke.prototype.initialize=function(e,t,n,r){this._baseTelInit(e,t,n,r)},Ke);function Ke(){var o=this,a=!1,s=null,c=null;o.core=null,o.diagLog=function(e){return o._getTelCtx(e).diagLog()},o.isInitialized=function(){return a},o.setInitialized=function(e){a=e},o.setNextPlugin=function(e){c=e},o.processNext=function(e,t){t?t.processNext(e):c&&qe(c.processTelemetry)&&c.processTelemetry(e,null)},o._getTelCtx=function(e){void 0===e&&(e=null);var t=e;return t||(e=s||new je(null,{},o.core),t=c&&c[Fe]?e.createNew(null,c[Fe]):e.createNew(null,c)),t},o._baseTelInit=function(e,t,n,r){e&&(e.extensionConfig=e.extensionConfig||[]),!r&&t&&(r=t.getProcessTelContext().getNext());var i=c;c&&c[Fe]&&(i=c[Fe]()),o.core=t,s=new je(r,e,t,i),a=!0}}var We=J.isFunction,He="processTelemetry",Xe="priority",Je="setNextPlugin",$e="isInitialized";function Qe(t,n){for(var e=[],r=null,i=t.getNext();i;){var o=i.getPlugin();o&&(r&&We(r[Je])&&We(o[He])&&r[Je](o),We(o[$e])&&o[$e]()||e.push(o),r=o,i=i.getNext())}J.arrForEach(e,function(e){e.initialize(t.getCfg(),t.core(),n,t.getNext())})}function Ye(e){return e.sort(function(e,t){var n=0,r=We(t[He]);return We(e[He])?n=r?e[Xe]-t[Xe]:1:r&&(n=-1),n})}var Ze,et=500,tt="Channel has invalid priority",nt=J.objDefineAccessors,rt=(Ze=Be,__extends(it,Ze),it._staticInit=(nt(it.prototype,"ChannelControls",it.prototype.getChannelControls),void nt(it.prototype,"channelQueue",it.prototype.getChannelControls)),it);function it(){var r=Ze.call(this)||this;r.identifier="ChannelControllerPlugin",r.priority=et;var c,u=J.arrForEach;function l(e){e&&0<e.length&&(e=e.sort(function(e,t){return e.priority-t.priority}),u(e,function(e){if(e.priority<et)throw Error(tt+e.identifier)}),c.push(e))}return Ee(it,r,function(a,s){a.setNextPlugin=function(e){},a.processTelemetry=function(t,n){c&&u(c,function(e){0<e.length&&r._getTelCtx(n).createNew(e).processNext(t)})},a.getChannelControls=function(){return c},a.initialize=function(t,n,r){var e,i,o;a.isInitialized()||(s.initialize(t,n,r),t.isCookieUseDisabled&&J.disableCookies(),i=r,c=[],(e=(t||{}).channels)&&u(e,l),i&&(o=[],u(i,function(e){e.priority>et&&o.push(e)}),l(o)),u(c,function(e){return Qe(new je(e,t,n),r)}))}}),r}var ot=J.arrForEach,at=J.isNullOrUndefined,st="_notificationManager",ct=function qn(e){this.listeners=[];var o=J.arrForEach,t=!!(e||{}).perfEvtsSendAll;Ee(qn,this,function(i){i.addNotificationListener=function(e){i.listeners.push(e)},i.removeNotificationListener=function(e){for(var t=J.arrIndexOf(i.listeners,e);-1<t;)i.listeners.splice(t,1),t=J.arrIndexOf(i.listeners,e)},i.eventsSent=function(t){o(i.listeners,function(e){e&&e.eventsSent&&setTimeout(function(){return e.eventsSent(t)},0)})},i.eventsDiscarded=function(t,n){o(i.listeners,function(e){e&&e.eventsDiscarded&&setTimeout(function(){return e.eventsDiscarded(t,n)},0)})},i.eventsSendRequest=function(n,r){o(i.listeners,function(e){if(e&&e.eventsSendRequest)if(r)setTimeout(function(){return e.eventsSendRequest(n,r)},0);else try{e.eventsSendRequest(n,r)}catch(t){}})},i.perfEvent=function(n){n&&(!t&&n.isChildEvt()||o(i.listeners,function(e){if(e&&e.perfEvent)if(n.isAsync)setTimeout(function(){return e.perfEvent(n)},0);else try{e.perfEvent(n)}catch(t){}}))}})},ut=function Fn(){var t,s,c,n,u=!1;Ee(Fn,this,function(a){a._extensions=[],s=new rt,a.logger=J.objCreate({throwInternal:function(e,t,n,r,i){void 0===i&&(i=!1)},warnToConsole:function(e){},resetInternalMessageCount:function(){}}),t=[],a.isInitialized=function(){return u},a.initialize=function(e,t,r,n){if(a.isInitialized())throw Error("Core should not be initialized more than once");if(!e||at(e.instrumentationKey))throw Error("Please provide instrumentation key");c=n,a[st]=n,a.config=e||{},e.extensions=at(e.extensions)?[]:e.extensions,(e.extensionConfig=at(e.extensionConfig)?{}:e.extensionConfig).NotificationManager=n,r&&(a.logger=r),(n=[]).push.apply(n,t.concat(e.extensions)),n=Ye(n);var i=[],o={};if(ot(n,function(e){if(at(e)||at(e.initialize))throw Error("Extensions must provide callback to initialize");var t=e.priority,n=e.identifier;e&&t&&(at(o[t])?o[t]=n:r.warnToConsole("Two extensions have same priority #"+t+" - "+o[t]+", "+n)),(!t||t<s.priority)&&i.push(e)}),n.push(s),i.push(s),n=Ye(n),a._extensions=n,Qe(new je([s],e,a),n),Qe(new je(i,e,a),n),a._extensions=i,0===a.getTransmissionControls().length)throw Error("No channels available");u=!0,a.releaseQueue()},a.getTransmissionControls=function(){return s.getChannelControls()},a.track=function(e){e.iKey||(e.iKey=a.config.instrumentationKey),e.time||(e.time=J.toISOString(new Date)),at(e.ver)&&(e.ver="4.0"),a.isInitialized()?a.getProcessTelContext().processNext(e):t.push(e)},a.getProcessTelContext=function(){var e=a._extensions,t=e;return e&&0!==e.length||(t=[s]),new je(t,a.config,a)},a.getNotifyMgr=function(){return c||(c=J.objCreate({addNotificationListener:function(e){},removeNotificationListener:function(e){},eventsSent:function(e){},eventsDiscarded:function(e,t){},eventsSendRequest:function(e,t){}}),a[st]=c),c},a.getPerfMgr=function(){return n||a.config&&a.config.enablePerfMgr&&(n=new Me(a.getNotifyMgr())),n},a.setPerfMgr=function(e){n=e},a.eventCnt=function(){return t.length},a.releaseQueue=function(){0<t.length&&(ot(t,function(e){a.getProcessTelContext().processNext(e)}),t=[])}})};__extends(function Bn(){var e=ut.call(this)||this;return Ee(Bn,e,function(n,i){function t(e){var t=n.getNotifyMgr();t&&t.eventsDiscarded([e],l)}n.initialize=function(e,t,n,r){i.initialize(e,t,n||new Pe(e),r||new ct(e))},n.track=function(e){Oe(n.getPerfMgr(),function(){return"AppInsightsCore:track"},function(){if(null===e)throw t(e),Error("Invalid telemetry item");!function(e){if(J.isNullOrUndefined(e.name))throw t(e),Error("telemetry name required")}(e),i.track(e)},function(){return{item:e}},!e.sync)},n.addNotificationListener=function(e){var t=n.getNotifyMgr();t&&t.addNotificationListener(e)},n.removeNotificationListener=function(e){var t=n.getNotifyMgr();t&&t.removeNotificationListener(e)},n.pollInternalLogs=function(t){var e=n.config.diagnosticLogInterval;return e&&0<e||(e=1e4),setInterval(function(){var e=n.logger?n.logger.queue:[];J.arrForEach(e,function(e){e={name:t||"InternalMessageId: "+e.messageId,iKey:n.config.instrumentationKey,time:J.toISOString(new Date),baseType:be.dataType,baseData:{message:e.message}},n.track(e)}),e.length=0},e)}}),e},ut);var lt=(ft.sanitizeKeyAndAddUniqueness=function(e,t,n){var r=t.length,i=ft.sanitizeKey(e,t);if(i.length!==r){for(var o=0,a=i;n[a]!==undefined;)o++,a=i.substring(0,ft.MAX_NAME_LENGTH-3)+ft.padNumber(o);i=a}return i},ft.sanitizeKey=function(e,t){var n;return t&&(t=ft.trim(t.toString())).length>ft.MAX_NAME_LENGTH&&(n=t.substring(0,ft.MAX_NAME_LENGTH),e.throwInternal(Q.WARNING,57,"name is too long. It has been truncated to "+ft.MAX_NAME_LENGTH+" characters.",{name:t},!0)),n||t},ft.sanitizeString=function(e,t,n){var r;return void 0===n&&(n=ft.MAX_STRING_LENGTH),t&&(n=n||ft.MAX_STRING_LENGTH,(t=ft.trim(t)).toString().length>n&&(r=t.toString().substring(0,n),e.throwInternal(Q.WARNING,61,"string value is too long. It has been truncated to "+n+" characters.",{value:t},!0))),r||t},ft.sanitizeUrl=function(e,t){return ft.sanitizeInput(e,t,ft.MAX_URL_LENGTH,66)},ft.sanitizeMessage=function(e,t){var n;return t&&t.length>ft.MAX_MESSAGE_LENGTH&&(n=t.substring(0,ft.MAX_MESSAGE_LENGTH),e.throwInternal(Q.WARNING,56,"message is too long, it has been truncated to "+ft.MAX_MESSAGE_LENGTH+" characters.",{message:t},!0)),n||t},ft.sanitizeException=function(e,t){var n;return t&&t.length>ft.MAX_EXCEPTION_LENGTH&&(n=t.substring(0,ft.MAX_EXCEPTION_LENGTH),e.throwInternal(Q.WARNING,52,"exception is too long, it has been truncated to "+ft.MAX_EXCEPTION_LENGTH+" characters.",{exception:t},!0)),n||t},ft.sanitizeProperties=function(r,e){var i;return e&&(i={},X(e,function(e,t){if(J.isObject(t)&&E())try{t=C().stringify(t)}catch(n){r.throwInternal(Q.WARNING,49,"custom property is not valid",{exception:n},!0)}t=ft.sanitizeString(r,t,ft.MAX_PROPERTY_LENGTH),e=ft.sanitizeKeyAndAddUniqueness(r,e,i),i[e]=t}),e=i),e},ft.sanitizeMeasurements=function(n,e){var r;return e&&(r={},X(e,function(e,t){e=ft.sanitizeKeyAndAddUniqueness(n,e,r),r[e]=t}),e=r),e},ft.sanitizeId=function(e,t){return t&&ft.sanitizeInput(e,t,ft.MAX_ID_LENGTH,69).toString()},ft.sanitizeInput=function(e,t,n,r){var i;return t&&(t=ft.trim(t)).length>n&&(i=t.substring(0,n),e.throwInternal(Q.WARNING,r,"input is too long, it has been truncated to "+n+" characters.",{data:t},!0)),i||t},ft.padNumber=function(e){return(e="00"+e).substr(e.length-3)},ft.trim=function(e){return J.isString(e)?e.replace(/^\s+|\s+$/g,""):e},ft.MAX_NAME_LENGTH=150,ft.MAX_ID_LENGTH=128,ft.MAX_PROPERTY_LENGTH=8192,ft.MAX_STRING_LENGTH=1024,ft.MAX_URL_LENGTH=2048,ft.MAX_MESSAGE_LENGTH=32768,ft.MAX_EXCEPTION_LENGTH=32768,ft);function ft(){}var gt=I(),pt=J.isString,dt=null,mt=(ht.createDomEvent=function(e){var t,n=null;return J.isFunction(Event)?n=new Event(e):(t=T())&&t.createEvent&&(n=t.createEvent("Event")).initEvent(e,!0,!0),n},ht.disableStorage=function(){ht._canUseLocalStorage=!1,ht._canUseSessionStorage=!1},ht._getLocalStorageObject=function(){return ht.canUseLocalStorage()?ht._getVerifiedStorageObject(c.LocalStorage):null},ht._getVerifiedStorageObject=function(e){var t,n,r=null;try{if(J.isNullOrUndefined(y()))return null;n=new Date,(r=x(e===c.LocalStorage?"localStorage":"sessionStorage")).setItem(n.toString(),n.toString()),t=r.getItem(n.toString())!==n.toString(),r.removeItem(n.toString()),t&&(r=null)}catch(i){r=null}return r},ht.isInternalApplicationInsightsEndpoint=function(e){return!!~ht._internalEndpoints.indexOf(e.toLowerCase())},ht.canUseLocalStorage=function(){return ht._canUseLocalStorage===undefined&&(ht._canUseLocalStorage=!!ht._getVerifiedStorageObject(c.LocalStorage)),ht._canUseLocalStorage},ht.getStorage=function(e,t){var n=ht._getLocalStorageObject();if(null!==n)try{return n.getItem(t)}catch(r){ht._canUseLocalStorage=!1,e.throwInternal(Q.WARNING,1,"Browser failed read of local storage. "+ht.getExceptionName(r),{exception:ht.dump(r)})}return null},ht.setStorage=function(e,t,n){var r=ht._getLocalStorageObject();if(null!==r)try{return r.setItem(t,n),!0}catch(i){ht._canUseLocalStorage=!1,e.throwInternal(Q.WARNING,3,"Browser failed write to local storage. "+ht.getExceptionName(i),{exception:ht.dump(i)})}return!1},ht.removeStorage=function(e,t){var n=ht._getLocalStorageObject();if(null!==n)try{return n.removeItem(t),!0}catch(r){ht._canUseLocalStorage=!1,e.throwInternal(Q.WARNING,5,"Browser failed removal of local storage item. "+ht.getExceptionName(r),{exception:ht.dump(r)})}return!1},ht._getSessionStorageObject=function(){return ht.canUseSessionStorage()?ht._getVerifiedStorageObject(c.SessionStorage):null},ht.canUseSessionStorage=function(){return ht._canUseSessionStorage===undefined&&(ht._canUseSessionStorage=!!ht._getVerifiedStorageObject(c.SessionStorage)),ht._canUseSessionStorage},ht.getSessionStorageKeys=function(){var t=[];return ht.canUseSessionStorage()&&X(x("sessionStorage"),function(e){t.push(e)}),t},ht.getSessionStorage=function(e,t){var n=ht._getSessionStorageObject();if(null!==n)try{return n.getItem(t)}catch(r){ht._canUseSessionStorage=!1,e.throwInternal(Q.WARNING,2,"Browser failed read of session storage. "+ht.getExceptionName(r),{exception:ht.dump(r)})}return null},ht.setSessionStorage=function(e,t,n){var r=ht._getSessionStorageObject();if(null!==r)try{return r.setItem(t,n),!0}catch(i){ht._canUseSessionStorage=!1,e.throwInternal(Q.WARNING,4,"Browser failed write to session storage. "+ht.getExceptionName(i),{exception:ht.dump(i)})}return!1},ht.removeSessionStorage=function(e,t){var n=ht._getSessionStorageObject();if(null!==n)try{return n.removeItem(t),!0}catch(r){ht._canUseSessionStorage=!1,e.throwInternal(Q.WARNING,6,"Browser failed removal of session storage item. "+ht.getExceptionName(r),{exception:ht.dump(r)})}return!1},ht.disableCookies=function(){J.disableCookies()},ht.canUseCookies=function(e){if(J._canUseCookies===undefined){J._canUseCookies=!1;try{J._canUseCookies=ht.document.cookie!==undefined}catch(t){e.throwInternal(Q.WARNING,68,"Cannot access document.cookie - "+ht.getExceptionName(t),{exception:ht.dump(t)})}}return J._canUseCookies},ht.disallowsSameSiteNone=function(e){return!(!pt(e)||!~e.indexOf("CPU iPhone OS 12")&&!~e.indexOf("iPad; CPU OS 12")&&!(~e.indexOf("Macintosh; Intel Mac OS X 10_14")&&~e.indexOf("Version/")&&~e.indexOf("Safari"))&&(!~e.indexOf("Macintosh; Intel Mac OS X 10_14")||(n=(t=e.length)-40,"AppleWebKit/605.1.15 (KHTML, like Gecko)"!=e.substring(0<=n?n:0,t)))&&!~e.indexOf("Chrome/5")&&!~e.indexOf("Chrome/6")&&(!~e.indexOf("UnrealEngine")||~e.indexOf("Chrome"))&&!~e.indexOf("UCBrowser/12")&&!~e.indexOf("UCBrowser/11"));var t,n},ht.setCookie=function(e,t,n,r){var i;ht.canUseCookies(e)&&(e=i="",r&&(i=";domain="+r),(r=w())&&"https:"===r.protocol&&(e=";secure",null===dt&&(dt=ht.disallowsSameSiteNone((I()||{}).userAgent)),dt||(n+=";SameSite=None")),ht.document.cookie=t+"="+n+i+";path=/"+e)},ht.stringToBoolOrDefault=function(e,t){return void 0===t&&(t=!1),e===undefined||null===e?t:"true"==e.toString().toLowerCase()},ht.getCookie=function(e,t){if(ht.canUseCookies(e)){var n="";if(t&&t.length)for(var r=t+"=",i=ht.document.cookie.split(";"),o=0;o<i.length;o++){var a=i[o];if((a=ht.trim(a))&&!a.indexOf(r)){n=a.substring(r.length,i[o].length);break}}return n}},ht.deleteCookie=function(e,t){ht.canUseCookies(e)&&(ht.document.cookie=t+"=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;")},ht.random32=function(){return J.random32(!0)},ht.getIEVersion=function(e){return void 0===e&&(e=null),~(e=e?e.toLowerCase():gt?(gt.userAgent||"").toLowerCase():"").indexOf("msie")?parseInt(e.split("msie")[1]):e.indexOf("trident/")&&(e=parseInt(e.split("trident/")[1]))?e+4:null},ht.msToTimeSpan=function(e){(isNaN(e)||e<0)&&(e=0);var t=""+(e=Math.round(e))%1e3,n=""+Math.floor(e/1e3)%60,r=""+Math.floor(e/6e4)%60,i=""+Math.floor(e/36e5)%24,e=Math.floor(e/864e5),t=1===t.length?"00"+t:2===t.length?"0"+t:t,n=n.length<2?"0"+n:n,r=r.length<2?"0"+r:r;return(0<e?e+".":"")+(i=i.length<2?"0"+i:i)+":"+r+":"+n+"."+t},ht.isCrossOriginError=function(e,t,n,r,i){return("Script error."===e||"Script error"===e)&&!i},ht.dump=function(e){var t=Object[g].toString.call(e),n="";return"[object Error]"===t?n="{ stack: '"+e.stack+"', message: '"+e.message+"', name: '"+e.name+"'":E()&&(n=C().stringify(e)),t+n},ht.getExceptionName=function(e){return"[object Error]"===Object[g].toString.call(e)?e.name:""},ht.addEventHandler=function(e,t){return Z.Attach(S(),e,t)},ht.IsBeaconApiSupported=function(){return"sendBeacon"in gt&&gt.sendBeacon},ht.getExtension=function(e,t){for(var n=null,r=0;!n&&r<e.length;)e[r]&&e[r].identifier===t&&(n=e[r]),r++;return n},ht.document=T()||{},ht._canUseLocalStorage=undefined,ht._canUseSessionStorage=undefined,ht._internalEndpoints=["https://dc.services.visualstudio.com/v2/track","https://breeze.aimon.applicationinsights.io/v2/track","https://dc-int.services.visualstudio.com/v2/track"],ht.NotSpecified="not_specified",ht.trim=J.strTrim,ht.newId=J.newId,ht.generateW3CId=J.generateW3CId,ht.isArray=J.isArray,ht.isError=J.isError,ht.isDate=J.isDate,ht.toISOStringForIE8=J.toISOString,ht);function ht(){}var vt=(yt.parseUrl=function(e){var t=yt._htmlAnchorIdx,n=yt._htmlAnchorElement,r=n[t];return yt.document.createElement?n[t]||(r=n[t]=yt.document.createElement("a")):r={host:yt.parseHost(e,!0)},r.href=e,++t>=n.length&&(t=0),yt._htmlAnchorIdx=t,r},yt.getAbsoluteUrl=function(e){var t;return(e=yt.parseUrl(e))&&(t=e.href),t},yt.getPathName=function(e){var t;return(e=yt.parseUrl(e))&&(t=e.pathname),t},yt.getCompleteUrl=function(e,t){return e?e.toUpperCase()+" "+t:t},yt.parseHost=function(e,t){return(e=yt.parseFullHost(e,t))&&null!=(t=e.match(/(www[0-9]?\.)?(.[^/:]+)(\:[\d]+)?/i))&&3<t.length&&pt(t[2])&&0<t[2].length?t[2]+(t[3]||""):e},yt.parseFullHost=function(e,t){var n=null;return!e||null!=(e=e.match(/(\w*):\/\/(.[^/:]+)(\:[\d]+)?/i))&&2<e.length&&pt(e[2])&&0<e[2].length&&(n=e[2]||"",t&&2<e.length&&(t=(e[1]||"").toLowerCase(),e=e[3]||"",("http"==t&&":80"===e||"https"==t&&":443"===e)&&(e=""),n+=e)),n},yt.document=T()||{},yt._htmlAnchorIdx=0,yt._htmlAnchorElement=[null,null,null,null,null],yt);function yt(){}var xt=(_t.ParseDependencyPath=function(e,t,n,r){var i,o,a,s=r,c=r,s=t&&0<t.length?(a=(i=vt.parseUrl(t)).host,s||(null!=i.pathname?("/"!=(o=0===i.pathname.length?"/":i.pathname)[0]&&(o="/"+o),c=i.pathname,lt.sanitizeString(e,n?n+" "+o:o)):lt.sanitizeString(e,t))):a=r;return{target:a,name:s,data:c}},_t);function _t(){}var St=(Tt.Now=function(){var e=N();return e&&e.now&&e.timing&&0<(e=e.now()+e.timing.navigationStart)?e:(new Date).getTime()},Tt.GetDuration=function(e,t){var n=null;return 0===e||0===t||J.isNullOrUndefined(e)||J.isNullOrUndefined(t)||(n=t-e),n},Tt);function Tt(){}var It,wt=(__extends(Nt,function(){}),Nt);function Nt(){return this}It=function(){this.ver=1,this.sampleRate=100,this.tags={}},__extends(function(e,t,n){var r=It.call(this)||this;return r.name=lt.sanitizeString(e,n)||mt.NotSpecified,r.data=t,r.time=J.toISOString(new Date),r.aiDataContract={time:p.Required,iKey:p.Required,name:p.Required,sampleRate:function(){return 100===r.sampleRate?p.Hidden:p.Required},tags:p.Required,data:p.Required},r},It);var Et,Ct=(Et=pn=function(){},__extends(bt,Et),bt);function bt(){var e=Et.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var Dt,Pt=(Dt=Ct,__extends(kt,Dt),kt.envelopeType="Microsoft.ApplicationInsights.{0}.Event",kt.dataType="EventData",kt);function kt(e,t,n,r){var i=Dt.call(this)||this;return i.aiDataContract={ver:p.Required,name:p.Required,properties:p.Default,measurements:p.Default},i.name=lt.sanitizeString(e,t)||mt.NotSpecified,i.properties=lt.sanitizeProperties(e,n),i.measurements=lt.sanitizeMeasurements(e,r),i}var At,Lt=function(){},Mt=(At=pn,__extends(Rt,At),Rt);function Rt(){var e=At.call(this)||this;return e.ver=2,e.exceptions=[],e.properties={},e.measurements={},e}var Ot,nt=function(){this.hasFullStack=!0,this.parsedStack=[]},Ut="error",zt=(Ot=Mt,__extends(Vt,Ot),Vt.CreateFromInterface=function(t,e,n,r){var i=e.exceptions&&J.arrMap(e.exceptions,function(e){return jt.CreateFromInterface(t,e)});return new Vt(t,__assign({},e,{exceptions:i}),n,r)},Vt.prototype.toInterface=function(){var e=this.exceptions,t=this.properties,n=this.measurements,r=this.severityLevel,i=(this.ver,this.problemGroup),o=this.id,a=this.isManual;return{ver:"4.0",exceptions:e instanceof Array&&J.arrMap(e,function(e){return e.toInterface()})||undefined,severityLevel:r,properties:t,measurements:n,problemGroup:i,id:o,isManual:a}},Vt.CreateSimpleException=function(e,t,n,r,i,o){return{exceptions:[{hasFullStack:!0,message:e,stack:i,typeName:t}]}},Vt.envelopeType="Microsoft.ApplicationInsights.{0}.Exception",Vt.dataType="ExceptionData",Vt);function Vt(e,t,n,r,i,o){var a,s=Ot.call(this)||this;return s.aiDataContract={ver:p.Required,exceptions:p.Required,severityLevel:p.Default,properties:p.Default,measurements:p.Default},"ver"in(a=t)&&"exceptions"in a&&"properties"in a?(s.exceptions=t.exceptions,s.properties=t.properties,s.measurements=t.measurements,t.severityLevel&&(s.severityLevel=t.severityLevel),t.id&&(s.id=t.id),t.problemGroup&&(s.problemGroup=t.problemGroup),s.ver=2,J.isNullOrUndefined(t.isManual)||(s.isManual=t.isManual)):(s.exceptions=[new jt(e,t)],s.properties=lt.sanitizeProperties(e,n)||{},s.measurements=lt.sanitizeMeasurements(e,r),i&&(s.severityLevel=i),o&&(s.id=o)),s}var Gt,jt=(Gt=nt,__extends(qt,Gt),qt.prototype.toInterface=function(){var e=this.parsedStack instanceof Array&&J.arrMap(this.parsedStack,function(e){return e.toInterface()});return{id:this.id,outerId:this.outerId,typeName:this.typeName,message:this.message,hasFullStack:this.hasFullStack,stack:this.stack,parsedStack:e||undefined}},qt.CreateFromInterface=function(e,t){var n=t.parsedStack instanceof Array&&J.arrMap(t.parsedStack,function(e){return Bt.CreateFromInterface(e)})||t.parsedStack;return new qt(e,__assign({},t,{parsedStack:n}))},qt.parseStack=function(e){if(J.isString(e)){for(var t=e.split("\n"),n=[],r=0,i=0,o=0;o<=t.length;o++){var a=t[o];Bt.regex.test(a)&&(i+=(a=new Bt(t[o],r++)).sizeInBytes,n.push(a))}if(32768<i)for(var s=0,c=n.length-1,u=0,l=s,f=c;s<c;){if(32768<(u+=n[s].sizeInBytes+n[c].sizeInBytes)){var g=f-l+1;n.splice(l,g);break}l=s,f=c,s++,c--}}return n},qt);function qt(e,t){var n,r=Gt.call(this)||this;return r.aiDataContract={id:p.Default,outerId:p.Default,typeName:p.Required,message:p.Required,hasFullStack:p.Default,stack:p.Default,parsedStack:p.Array},"hasFullStack"in(n=t)&&"typeName"in n?(r.typeName=t.typeName,r.message=t.message,r.stack=t.stack,r.parsedStack=t.parsedStack,r.hasFullStack=t.hasFullStack):(n=t,mt.isError(n)||(n=n[Ut]||n.evt||n),r.typeName=lt.sanitizeString(e,function(e){var t="";if(e&&!(t=e.typeName||e.name||""))try{var n=/function (.{1,})\(/.exec(e.constructor.toString()),t=n&&1<n.length?n[1]:""}catch(r){}return t}(n))||mt.NotSpecified,r.message=lt.sanitizeMessage(e,t.message)||mt.NotSpecified,t=t.stack,r.parsedStack=qt.parseStack(t),r.stack=lt.sanitizeException(e,t),r.hasFullStack=mt.isArray(r.parsedStack)&&0<r.parsedStack.length),r}var Ft,Bt=(Ft=Lt,__extends(Kt,Ft),Kt.CreateFromInterface=function(e){return new Kt(e,null)},Kt.prototype.toInterface=function(){return{level:this.level,method:this.method,assembly:this.assembly,fileName:this.fileName,line:this.line}},Kt.regex=/^([\s]+at)?(.*?)(\@|\s\(|\s)([^\(\@\n]+):([0-9]+):([0-9]+)(\)?)$/,Kt.baseSize=58,Kt);function Kt(e,t){var n,r=Ft.call(this)||this;return r.sizeInBytes=0,r.aiDataContract={level:p.Required,method:p.Required,assembly:p.Default,fileName:p.Default,line:p.Default},"string"==typeof e?(n=e,r.level=t,r.method="<no_method>",r.assembly=mt.trim(n),r.fileName="",r.line=0,(n=n.match(Kt.regex))&&5<=n.length&&(r.method=mt.trim(n[2])||r.method,r.fileName=mt.trim(n[4]),r.line=parseInt(n[5])||0)):(r.level=e.level,r.method=e.method,r.assembly=e.assembly,r.fileName=e.fileName,r.line=e.line,r.sizeInBytes=0),r.sizeInBytes+=r.method.length,r.sizeInBytes+=r.fileName.length,r.sizeInBytes+=r.assembly.length,r.sizeInBytes+=Kt.baseSize,r.sizeInBytes+=r.level.toString().length,r.sizeInBytes+=r.line.toString().length,r}var Wt,Ht,nt=(Wt=pn,__extends(Xt,Wt),Xt);function Xt(){var e=Wt.call(this)||this;return e.ver=2,e.metrics=[],e.properties={},e.measurements={},e}(Lt=Ht={})[Lt.Measurement=0]="Measurement",Lt[Lt.Aggregation=1]="Aggregation";var Jt,$t=(Jt=function(){this.kind=Ht.Measurement},__extends(Qt,Jt),Qt);function Qt(){var e=Jt.apply(this,arguments)||this;return e.aiDataContract={name:p.Required,kind:p.Default,value:p.Required,count:p.Default,min:p.Default,max:p.Default,stdDev:p.Default},e}var Yt,Zt=(Yt=nt,__extends(en,Yt),en.envelopeType="Microsoft.ApplicationInsights.{0}.Metric",en.dataType="MetricData",en);function en(e,t,n,r,i,o,a,s){var c=Yt.call(this)||this;c.aiDataContract={ver:p.Required,metrics:p.Required,properties:p.Default};var u=new $t;return u.count=0<r?r:undefined,u.max=isNaN(o)||null===o?undefined:o,u.min=isNaN(i)||null===i?undefined:i,u.name=lt.sanitizeString(e,t)||mt.NotSpecified,u.value=n,c.metrics=[u],c.properties=lt.sanitizeProperties(e,a),c.measurements=lt.sanitizeMeasurements(e,s),c}var tn,nt=(tn=Ct,__extends(nn,tn),nn);function nn(){var e=tn.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var rn,on=(rn=nt,__extends(an,rn),an.envelopeType="Microsoft.ApplicationInsights.{0}.Pageview",an.dataType="PageviewData",an);function an(e,t,n,r,i,o,a){var s=rn.call(this)||this;return s.aiDataContract={ver:p.Required,name:p.Default,url:p.Default,duration:p.Default,properties:p.Default,measurements:p.Default,id:p.Default},s.id=lt.sanitizeId(e,a),s.url=lt.sanitizeUrl(e,n),s.name=lt.sanitizeString(e,t)||mt.NotSpecified,isNaN(r)||(s.duration=mt.msToTimeSpan(r)),s.properties=lt.sanitizeProperties(e,i),s.measurements=lt.sanitizeMeasurements(e,o),s}var sn,Ct=(sn=pn,__extends(cn,sn),cn);function cn(){var e=sn.call(this)||this;return e.ver=2,e.success=!0,e.properties={},e.measurements={},e}var un,ln=(un=Ct,__extends(fn,un),fn.envelopeType="Microsoft.ApplicationInsights.{0}.RemoteDependency",fn.dataType="RemoteDependencyData",fn);function fn(e,t,n,r,i,o,a,s,c,u,l,f){void 0===c&&(c="Ajax");var g=un.call(this)||this;return g.aiDataContract={id:p.Required,ver:p.Required,name:p.Default,resultCode:p.Default,duration:p.Default,success:p.Default,data:p.Default,target:p.Default,type:p.Default,properties:p.Default,measurements:p.Default,kind:p.Default,value:p.Default,count:p.Default,min:p.Default,max:p.Default,stdDev:p.Default,dependencyKind:p.Default,dependencySource:p.Default,commandName:p.Default,dependencyTypeName:p.Default},g.id=t,g.duration=mt.msToTimeSpan(i),g.success=o,g.resultCode=a+"",g.type=lt.sanitizeString(e,c),s=xt.ParseDependencyPath(e,n,s,r),g.data=lt.sanitizeUrl(e,r)||s.data,g.target=lt.sanitizeString(e,s.target),u&&(g.target=g.target+" | "+u),g.name=lt.sanitizeString(e,s.name),g.properties=lt.sanitizeProperties(e,l),g.measurements=lt.sanitizeMeasurements(e,f),g}var gn,pn=(gn=pn,__extends(dn,gn),dn);function dn(){var e=gn.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var mn,hn=(mn=pn,__extends(vn,mn),vn.envelopeType="Microsoft.ApplicationInsights.{0}.Message",vn.dataType="MessageData",vn);function vn(e,t,n,r,i){var o=mn.call(this)||this;return o.aiDataContract={ver:p.Required,message:p.Required,severityLevel:p.Default,properties:p.Default},t=t||mt.NotSpecified,o.message=lt.sanitizeMessage(e,t),o.properties=lt.sanitizeProperties(e,r),o.measurements=lt.sanitizeMeasurements(e,i),n&&(o.severityLevel=n),o}var yn,nt=(yn=nt,__extends(xn,yn),xn);function xn(){var e=yn.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var _n,Sn,Tn,In=(_n=nt,__extends(wn,_n),wn.envelopeType="Microsoft.ApplicationInsights.{0}.PageviewPerformance",wn.dataType="PageviewPerformanceData",wn);function wn(e,t,n,r,i,o,a){var s=_n.call(this)||this;return s.aiDataContract={ver:p.Required,name:p.Default,url:p.Default,duration:p.Default,perfTotal:p.Default,networkConnect:p.Default,sentRequest:p.Default,receivedResponse:p.Default,domProcessing:p.Default,properties:p.Default,measurements:p.Default},s.url=lt.sanitizeUrl(e,n),s.name=lt.sanitizeString(e,t)||mt.NotSpecified,s.properties=lt.sanitizeProperties(e,i),s.measurements=lt.sanitizeMeasurements(e,o),a&&(s.domProcessing=a.domProcessing,s.duration=a.duration,s.networkConnect=a.networkConnect,s.perfTotal=a.perfTotal,s.receivedResponse=a.receivedResponse,s.sentRequest=a.sentRequest),s}Sn=wt,__extends(function(e,t){var n=Sn.call(this)||this;return n.aiDataContract={baseType:p.Required,baseData:p.Required},n.baseType=e,n.baseData=t,n},Sn),(wt=Tn={})[wt.Verbose=0]="Verbose",wt[wt.Information=1]="Information",wt[wt.Warning=2]="Warning",wt[wt.Error=3]="Error",wt[wt.Critical=4]="Critical";var Nn=(En.create=function(e,t,n,r,i,o){if(n=lt.sanitizeString(r,n)||mt.NotSpecified,J.isNullOrUndefined(e)||J.isNullOrUndefined(t)||J.isNullOrUndefined(n))throw Error("Input doesn't contain all required fields");var a={name:n,time:J.toISOString(new Date),iKey:"",ext:o||{},tags:[],data:{},baseType:t,baseData:e};return J.isNullOrUndefined(i)||X(i,function(e,t){a.data[e]=t}),a},En);function En(){}var Cn=function Kn(h,v,t,y){Ee(Kn,this,function(e){var l,n=J.arrForEach,f=J.isNullOrUndefined,g=null,p=[],d=!1;function m(){t&&n(t.getTransmissionControls(),function(e){n(e,function(e){return e.flush(!0)})})}t&&(l=t.logger),e.trackPageView=function(r,i){var o=r.name;!f(o)&&"string"==typeof o||(e=T(),o=r.name=e&&e.title||"");var e,a=r.uri;if(!f(a)&&"string"==typeof a||(e=w(),a=r.uri=e&&e.href||""),!y.isPerformanceTimingSupported())return h.sendPageViewInternal(r,i),m(),void l.throwInternal(Q.WARNING,25,"trackPageView: navigation timing API used for calculation of page duration is not supported in this browser. This page view will be collected without duration and timing info.");var s,t,c=!1,u=y.getPerformanceTiming().navigationStart;0<u&&(s=St.GetDuration(u,+new Date),y.shouldCollectDuration(s)||(s=undefined)),f(i)||f(i.duration)||(t=i.duration),!v&&isNaN(t)||(isNaN(t)&&((i=i||{}).duration=s),h.sendPageViewInternal(r,i),m(),c=!0),i=i||{},t=function(){var e,t=!1;try{y.isPerformanceTimingDataReady()?(t=!0,e={name:o,uri:a},y.populatePageViewPerformanceEvent(e),e.isValid||c?(c||(i.duration=e.durationMs,h.sendPageViewInternal(r,i)),d||(h.sendPageViewPerformanceInternal(e,i),d=!0)):(i.duration=s,h.sendPageViewInternal(r,i))):0<u&&6e4<St.GetDuration(u,+new Date)&&(t=!0,c||(i.duration=6e4,h.sendPageViewInternal(r,i)))}catch(n){l.throwInternal(Q.CRITICAL,38,"trackPageView failed on page load calculation: "+mt.getExceptionName(n),{exception:mt.dump(n)})}return t},p.push(t),g=g||setInterval(function(){var e=p.slice(0),t=!1;p=[],n(e,function(e){e()?t=!0:p.push(e)}),0===p.length&&(clearInterval(g),g=null),t&&m()},100)}})},bn=(Dn.prototype.trackPreviousPageVisit=function(e,t){try{var n=this.restartPageVisitTimer(e,t);n&&this.pageVisitTimeTrackingHandler(n.pageName,n.pageUrl,n.pageVisitTime)}catch(r){this._logger.warnToConsole("Auto track page visit time failed, metric will not be collected: "+mt.dump(r))}},Dn.prototype.restartPageVisitTimer=function(e,t){try{var n=this.stopPageVisitTimer();return this.startPageVisitTimer(e,t),n}catch(r){return this._logger.warnToConsole("Call to restart failed: "+mt.dump(r)),null}},Dn.prototype.startPageVisitTimer=function(e,t){try{if(mt.canUseSessionStorage()){if(null!=mt.getSessionStorage(this._logger,this.prevPageVisitDataKeyName))throw Error("Cannot call startPageVisit consecutively without first calling stopPageVisit");var n=new Pn(e,t),n=C().stringify(n);mt.setSessionStorage(this._logger,this.prevPageVisitDataKeyName,n)}}catch(r){this._logger.warnToConsole("Call to start failed: "+mt.dump(r))}},Dn.prototype.stopPageVisitTimer=function(){try{if(mt.canUseSessionStorage()){var e=J.dateNow(),t=mt.getSessionStorage(this._logger,this.prevPageVisitDataKeyName);return t&&E()?((t=C().parse(t)).pageVisitTime=e-t.pageVisitStartTime,mt.removeSessionStorage(this._logger,this.prevPageVisitDataKeyName),t):null}return null}catch(n){return this._logger.warnToConsole("Stop page visit timer failed: "+mt.dump(n)),null}},Dn);function Dn(e,t){this.prevPageVisitDataKeyName="prevPageVisitData",this.pageVisitTimeTrackingHandler=t,this._logger=e}var Pn=function(e,t){this.pageVisitStartTime=J.dateNow(),this.pageName=e,this.pageUrl=t},kn=(An.prototype.populatePageViewPerformanceEvent=function(e){e.isValid=!1;var t,n,r,i,o=this.getPerformanceNavigationTiming(),a=this.getPerformanceTiming();(o||a)&&(a=o?(t=o.duration,n=St.GetDuration(o.startTime,o.connectEnd),r=St.GetDuration(o.requestStart,o.responseStart),i=St.GetDuration(o.responseStart,o.responseEnd),St.GetDuration(o.responseEnd,o.loadEventEnd)):(t=St.GetDuration(a.navigationStart,a.loadEventEnd),n=St.GetDuration(a.navigationStart,a.connectEnd),r=St.GetDuration(a.requestStart,a.responseStart),i=St.GetDuration(a.responseStart,a.responseEnd),St.GetDuration(a.responseEnd,a.loadEventEnd)),0===t?this._logger.throwInternal(Q.WARNING,10,"error calculating page view performance.",{total:t,network:n,request:r,response:i,dom:a}):this.shouldCollectDuration(t,n,r,i,a)?t<Math.floor(n)+Math.floor(r)+Math.floor(i)+Math.floor(a)?this._logger.throwInternal(Q.WARNING,8,"client performance math error.",{total:t,network:n,request:r,response:i,dom:a}):(e.durationMs=t,e.perfTotal=e.duration=mt.msToTimeSpan(t),e.networkConnect=mt.msToTimeSpan(n),e.sentRequest=mt.msToTimeSpan(r),e.receivedResponse=mt.msToTimeSpan(i),e.domProcessing=mt.msToTimeSpan(a),e.isValid=!0):this._logger.throwInternal(Q.WARNING,45,"Invalid page load duration value. Browser perf data won't be sent.",{total:t,network:n,request:r,response:i,dom:a}))},An.prototype.getPerformanceTiming=function(){return this.isPerformanceTimingSupported()?N().timing:null},An.prototype.getPerformanceNavigationTiming=function(){return this.isPerformanceNavigationTimingSupported()?N().getEntriesByType("navigation")[0]:null},An.prototype.isPerformanceNavigationTimingSupported=function(){var e=N();return e&&e.getEntriesByType&&0<e.getEntriesByType("navigation").length},An.prototype.isPerformanceTimingSupported=function(){var e=N();return e&&e.timing},An.prototype.isPerformanceTimingDataReady=function(){var e=N();return(e=e?e.timing:0)&&0<e.domainLookupStart&&0<e.navigationStart&&0<e.responseStart&&0<e.requestStart&&0<e.loadEventEnd&&0<e.responseEnd&&0<e.connectEnd&&0<e.domLoading},An.prototype.shouldCollectDuration=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=["googlebot","adsbot-google","apis-google","mediapartners-google"],r=(I()||{}).userAgent,i=!1;if(r)for(var o=0;o<n.length;o++)i=i||!!~r.toLowerCase().indexOf(n[o]);if(i)return!1;for(o=0;o<e.length;o++)if(e[o]<0||e[o]>=this.MAX_DURATION_ALLOWED)return!1;return!0},An);function An(e){this.MAX_DURATION_ALLOWED=36e5,e&&(this._logger=e.logger)}var Ln="duration";function Mn(e,t){e&&e.dispatchEvent&&t&&e.dispatchEvent(t)}var Rn,Be=(Rn=Be,__extends(On,Rn),On.getDefaultConfig=function(e){return(e=e||{}).sessionRenewalMs=18e5,e.sessionExpirationMs=864e5,e.disableExceptionTracking=mt.stringToBoolOrDefault(e.disableExceptionTracking),e.autoTrackPageVisitTime=mt.stringToBoolOrDefault(e.autoTrackPageVisitTime),e.overridePageViewDuration=mt.stringToBoolOrDefault(e.overridePageViewDuration),e.enableUnhandledPromiseRejectionTracking=mt.stringToBoolOrDefault(e.enableUnhandledPromiseRejectionTracking),(isNaN(e.samplingPercentage)||e.samplingPercentage<=0||100<=e.samplingPercentage)&&(e.samplingPercentage=100),e.isCookieUseDisabled=mt.stringToBoolOrDefault(e.isCookieUseDisabled),e.isStorageUseDisabled=mt.stringToBoolOrDefault(e.isStorageUseDisabled),e.isBrowserLinkTrackingEnabled=mt.stringToBoolOrDefault(e.isBrowserLinkTrackingEnabled),e.enableAutoRouteTracking=mt.stringToBoolOrDefault(e.enableAutoRouteTracking),e.namePrefix=e.namePrefix||"",e},On.prototype.processTelemetry=function(o,a){var s=this;Oe(this.core,function(){return s.identifier+":processTelemetry"},function(){var e=!1,t=s._telemetryInitializers.length;a=s._getTelCtx(a);for(var n=0;n<t;++n){var r=s._telemetryInitializers[n];if(r)try{if(!1===r.call(null,o)){e=!0;break}}catch(i){a.diagLog().throwInternal(Q.CRITICAL,64,"One of telemetry initializers failed, telemetry item will not be sent: "+mt.getExceptionName(i),{exception:mt.dump(i)},!0)}}e||s.processNext(o,a)},function(){return{item:o}},!o.sync)},On.prototype.trackEvent=function(e,t){try{var n=Nn.create(e,Pt.dataType,Pt.envelopeType,this.diagLog(),t);this.core.track(n)}catch(r){this.diagLog().throwInternal(Q.WARNING,39,"trackTrace failed, trace will not be collected: "+mt.getExceptionName(r),{exception:mt.dump(r)})}},On.prototype.startTrackEvent=function(e){try{this._eventTracking.start(e)}catch(t){this.diagLog().throwInternal(Q.CRITICAL,29,"startTrackEvent failed, event will not be collected: "+mt.getExceptionName(t),{exception:mt.dump(t)})}},On.prototype.stopTrackEvent=function(e,t,n){try{this._eventTracking.stop(e,undefined,t)}catch(r){this.diagLog().throwInternal(Q.CRITICAL,30,"stopTrackEvent failed, event will not be collected: "+mt.getExceptionName(r),{exception:mt.dump(r)})}},On.prototype.trackTrace=function(e,t){try{var n=Nn.create(e,hn.dataType,hn.envelopeType,this.diagLog(),t);this.core.track(n)}catch(r){this.diagLog().throwInternal(Q.WARNING,39,"trackTrace failed, trace will not be collected: "+mt.getExceptionName(r),{exception:mt.dump(r)})}},On.prototype.trackMetric=function(e,t){try{var n=Nn.create(e,Zt.dataType,Zt.envelopeType,this.diagLog(),t);this.core.track(n)}catch(r){this.diagLog().throwInternal(Q.CRITICAL,36,"trackMetric failed, metric will not be collected: "+mt.getExceptionName(r),{exception:mt.dump(r)})}},On.prototype.trackPageView=function(e,t){try{var n=e||{};this._pageViewManager.trackPageView(n,__assign({},n.properties,n.measurements,t)),this.config.autoTrackPageVisitTime&&this._pageVisitTimeManager.trackPreviousPageVisit(n.name,n.uri)}catch(r){this.diagLog().throwInternal(Q.CRITICAL,37,"trackPageView failed, page view will not be collected: "+mt.getExceptionName(r),{exception:mt.dump(r)})}},On.prototype.sendPageViewInternal=function(e,t,n){var r=T();r&&(e.refUri=e.refUri===undefined?r.referrer:e.refUri),n=Nn.create(e,on.dataType,on.envelopeType,this.diagLog(),t,n),this.core.track(n),this._trackAjaxAttempts=0},On.prototype.sendPageViewPerformanceInternal=function(e,t,n){n=Nn.create(e,In.dataType,In.envelopeType,this.diagLog(),t,n),this.core.track(n)},On.prototype.trackPageViewPerformance=function(e,t){try{this._pageViewPerformanceManager.populatePageViewPerformanceEvent(e),this.sendPageViewPerformanceInternal(e,t)}catch(n){this.diagLog().throwInternal(Q.CRITICAL,37,"trackPageViewPerformance failed, page view will not be collected: "+mt.getExceptionName(n),{exception:mt.dump(n)})}},On.prototype.startTrackPage=function(e){try{var t;"string"!=typeof e&&(e=(t=T())&&t.title||""),this._pageTracking.start(e)}catch(n){this.diagLog().throwInternal(Q.CRITICAL,31,"startTrackPage failed, page view may not be collected: "+mt.getExceptionName(n),{exception:mt.dump(n)})}},On.prototype.stopTrackPage=function(e,t,n,r){try{var i;"string"!=typeof e&&(e=(i=T())&&i.title||""),"string"!=typeof t&&(t=(i=w())&&i.href||""),this._pageTracking.stop(e,t,n,r),this.config.autoTrackPageVisitTime&&this._pageVisitTimeManager.trackPreviousPageVisit(e,t)}catch(o){this.diagLog().throwInternal(Q.CRITICAL,32,"stopTrackPage failed, page view will not be collected: "+mt.getExceptionName(o),{exception:mt.dump(o)})}},On.prototype.sendExceptionInternal=function(e,t,n){e=new zt(this.diagLog(),e.exception||Error(mt.NotSpecified),e.properties,e.measurements,e.severityLevel,e.id).toInterface(),n=Nn.create(e,zt.dataType,zt.envelopeType,this.diagLog(),t,n),this.core.track(n)},On.prototype.trackException=function(e,t){try{this.sendExceptionInternal(e,t)}catch(n){this.diagLog().throwInternal(Q.CRITICAL,35,"trackException failed, exception will not be collected: "+mt.getExceptionName(n),{exception:mt.dump(n)})}},On.prototype._onerror=function(e){try{var t,n={url:e&&e.url||(T()||{}).URL,lineNumber:e.lineNumber,columnNumber:e.columnNumber,message:e.message};mt.isCrossOriginError(e.message,e.url,e.lineNumber,e.columnNumber,e.error)?this._sendCORSException(n.url):(mt.isError(e.error)||(t="window.onerror@"+n.url+":"+e.lineNumber+":"+(e.columnNumber||0),e.error=Error(e.message),e.error.stack=t),this.trackException({exception:e.error,severityLevel:Tn.Error},n))}catch(i){var r=e.error?e.error.name+", "+e.error.message:"null";this.diagLog().throwInternal(Q.CRITICAL,11,"_onError threw exception while logging error, error will not be collected: "+mt.getExceptionName(i),{exception:mt.dump(i),errorString:r})}},On.prototype.addTelemetryInitializer=function(e){this._telemetryInitializers.push(e)},On.prototype.initialize=function(e,t,n,r){var o=this;if(!this.isInitialized()){if(J.isNullOrUndefined(t))throw Error("Error initializing");Rn.prototype.initialize.call(this,e,t,n,r),this.setInitialized(!1);var i=this._getTelCtx(),a=this.identifier;this._globalconfig={instrumentationKey:e.instrumentationKey,endpointUrl:e.endpointUrl||"https://dc.services.visualstudio.com/v2/track"},this.config=i.getExtCfg(a),(t=On.getDefaultConfig())!==undefined&&(X(t,function(e,t){o.config[e]=i.getConfig(a,e,t)}),this._globalconfig&&X(t,function(e,t){o._globalconfig[e]===undefined&&(o._globalconfig[e]=t)})),this.config.isCookieUseDisabled&&mt.disableCookies(),this.config.isStorageUseDisabled&&mt.disableStorage(),r={instrumentationKey:function(){return e.instrumentationKey},accountId:function(){return o.config.accountId||e.accountId},sessionRenewalMs:function(){return o.config.sessionRenewalMs||e.sessionRenewalMs},sessionExpirationMs:function(){return o.config.sessionExpirationMs||e.sessionExpirationMs},sampleRate:function(){return o.config.samplingPercentage||e.samplingPercentage},cookieDomain:function(){return o.config.cookieDomain||e.cookieDomain},sdkExtension:function(){return o.config.sdkExtension||e.sdkExtension},isBrowserLinkTrackingEnabled:function(){return o.config.isBrowserLinkTrackingEnabled||e.isBrowserLinkTrackingEnabled},appId:function(){return o.config.appId||e.appId}},this._pageViewPerformanceManager=new kn(this.core),this._pageViewManager=new Cn(this,this.config.overridePageViewDuration,this.core,this._pageViewPerformanceManager),this._pageVisitTimeManager=new bn(this.diagLog(),function(e,t,n){return o.trackPageVisitTime(e,t,n)}),this._telemetryInitializers=this._telemetryInitializers||[],this._addDefaultTelemetryInitializers(r),this._eventTracking=new Un(this.diagLog(),"trackEvent"),this._eventTracking.action=function(e,t,n,r){(r=r||{})[Ln]=n.toString(),o.trackEvent({name:e,properties:r})},this._pageTracking=new Un(this.diagLog(),"trackPageView"),this._pageTracking.action=function(e,t,n,r,i){J.isNullOrUndefined(r)&&(r={}),r[Ln]=n.toString(),i={name:e,uri:t,properties:r,measurements:i},o.sendPageViewInternal(i,r)};var s,c,u,l,f,g=S(),t=typeof history===m&&history?history:x("history"),p=w(),d=this;!1===this.config.disableExceptionTracking&&!this.config.autoExceptionInstrumented&&g&&(s=g.onerror,g.onerror=function(e,t,n,r,i){var o=s&&s(e,t,n,r,i);return!0!==o&&d._onerror({message:e,url:t,lineNumber:n,columnNumber:r,error:i}),o},this.config.autoExceptionInstrumented=!0),!1===this.config.disableExceptionTracking&&!0===this.config.enableUnhandledPromiseRejectionTracking&&!this.config.autoUnhandledPromiseInstrumented&&g&&(c=g[r="onunhandledrejection"],g[r]=function(e){var t=c&&c.call(g,e);return!0!==t&&d._onerror({message:e.reason.toString(),error:e.reason instanceof Error?e.reason:Error(e.reason.toString()),url:p?p.href:"",lineNumber:0,columnNumber:0}),t},this.config.autoUnhandledPromiseInstrumented=!0),!0===this.config.enableAutoRouteTracking&&t&&J.isFunction(t.pushState)&&J.isFunction(t.replaceState)&&g&&"undefined"!=typeof Event&&(u=this,J.arrForEach(n,function(e){"AppInsightsPropertiesPlugin"===e.identifier&&(o._properties=e)}),t.pushState=(f=t.pushState,function(){var e=f.apply(this,arguments);return Mn(g,mt.createDomEvent(u.config.namePrefix+"pushState")),Mn(g,mt.createDomEvent(u.config.namePrefix+"locationchange")),e}),t.replaceState=(l=t.replaceState,function(){var e=l.apply(this,arguments);return Mn(g,mt.createDomEvent(u.config.namePrefix+"replaceState")),Mn(g,mt.createDomEvent(u.config.namePrefix+"locationchange")),e}),g.addEventListener&&(g.addEventListener(u.config.namePrefix+"popstate",function(){Mn(g,mt.createDomEvent(u.config.namePrefix+"locationchange"))}),g.addEventListener(u.config.namePrefix+"locationchange",function(){u._properties&&u._properties.context&&u._properties.context.telemetryTrace&&(u._properties.context.telemetryTrace.traceID=mt.generateW3CId(),u._properties.context.telemetryTrace.name=p&&p.pathname||"_unknown_"),o._currUri&&(o._prevUri=o._currUri),o._currUri=p&&p.href||"",setTimeout((function(e){u.trackPageView({refUri:e,properties:{duration:0}})}).bind(o,o._prevUri),u.autoRoutePVDelay)}))),this.setInitialized(!0)}},On.prototype.trackPageVisitTime=function(e,t,n){t={PageName:e,PageUrl:t},this.trackMetric({name:"PageVisitTime",average:n,max:n,min:n,sampleCount:1},t)},On.prototype._addDefaultTelemetryInitializers=function(e){var r;e.isBrowserLinkTrackingEnabled()||(r=["/browserLinkSignalR/","/__browserLink/"],this._addTelemetryInitializer(function(e){if(e.baseType===ln.dataType){var t=e.baseData;if(t)for(var n=0;n<r.length;n++)if(t.target&&~t.target.indexOf(r[n]))return!1}return!0}))},On.prototype._addTelemetryInitializer=function(e){this._telemetryInitializers.push(e)},On.prototype._sendCORSException=function(e){var t={message:"Script error: The browser's same-origin policy prevents us from getting the details of this exception. Consider using the 'crossorigin' attribute.",url:e,lineNumber:0,columnNumber:0,error:undefined},e=Nn.create(t,zt.dataType,zt.envelopeType,this.diagLog(),{url:e});this.core.track(e)},On.Version="2.5.11",On);function On(){var e=Rn.call(this)||this;e.identifier="ApplicationInsightsAnalytics",e.priority=180,e.autoRoutePVDelay=500,e._trackAjaxAttempts=0;var t=w();return e._prevUri=t&&t.href||"",e}var Un=(zn.prototype.start=function(e){"undefined"!=typeof this._events[e]&&this._logger.throwInternal(Q.WARNING,62,"start was called more than once for this event without calling stop.",{name:this._name,key:e},!0),this._events[e]=+new Date},zn.prototype.stop=function(e,t,n,r){var i,o=this._events[e];isNaN(o)?this._logger.throwInternal(Q.WARNING,63,"stop was called without a corresponding start.",{name:this._name,key:e},!0):(i=+new Date,i=St.GetDuration(o,i),this.action(e,t,i,n,r)),delete this._events[e],this._events[e]=undefined},zn);function zn(e,t){this._name=t,this._events={},this._logger=e}e.ApplicationInsights=Be,function(e,t,n){var r=Object.defineProperty;if(r)try{return r(e,t,n)}catch(i){}typeof n.value!==undefined&&(e[t]=n.value)}(e,"__esModule",{value:!0})};"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e.Microsoft=e.Microsoft||{},e.Microsoft.ApplicationInsights=e.Microsoft.ApplicationInsights||{}));
var e=this,t=function(e){"use strict";var r="function",a="object",t="undefined",o="prototype",s="hasOwnProperty";function n(){return typeof globalThis!==t&&globalThis?globalThis:typeof self!==t&&self?self:typeof window!==t&&window?window:typeof global!==t&&global?global:null}var i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t[s](n)&&(e[n]=t[n])})(e,t)};Fe=function(e,t){function n(){this.constructor=e}i(e,t),e[o]=null===t?function(e){var t=Object.create;if(t)return t(e);if(null==e)return{};if((t=typeof e)!=a&&t!==r)throw new TypeError("Object prototype may only be an Object:"+e);function n(){}return n[o]=e,new n}(t):(n[o]=t[o],new n)},(ht=Mt=n()||{}).__assign||(ht.__assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object[o][s].call(t,i)&&(e[i]=t[i]);return e}),ht.__extends||(ht.__extends=Fe),__assign=__assign||Mt.__assign,__extends=__extends||Mt.__extends;var x,l="constructor",p="prototype",m="function",h="_dynInstFuncs",v="_isDynProxy",y="_dynClass",T="_dynCls$",I="_dynInstChk",w=I,S="_dfOpts",c="_unknown_",u="__proto__",N="useBaseInst",C="setInstFuncs",g=Object,P=g.getPrototypeOf,E=0;function _(e,t){return e&&g[p].hasOwnProperty.call(e,t)}function k(e){return e&&(e===g[p]||e===Array[p])}function b(e){return k(e)||e===Function[p]}function A(e){if(e){if(P)return P(e);if(e=e[u]||e[p]||e[l])return e}return null}function D(e,t){var n=[],r=g.getOwnPropertyNames;if(r)n=r(e);else for(var i in e)"string"==typeof i&&_(e,i)&&n.push(i);if(n&&0<n.length)for(var a=0;a<n.length;a++)t(n[a])}function L(e,t,n){return t!==l&&typeof e[t]===m&&(n||_(e,t))}function M(e){throw new TypeError("DynamicProto: "+e)}function R(e,t){for(var n=e.length-1;0<=n;n--)if(e[n]===t)return 1}function V(e,t){return _(e,p)?e.name||t||c:((e||{})[l]||{}).name||t||c}function z(e,n,t,r){_(e,p)||M("theClass is an invalid class definition.");var i=e[p];!function(e){for(var t=A(n);t&&!b(t);){if(t===e)return 1;t=A(t)}}(i)&&M("["+V(e)+"] is not in class hierarchy of ["+V(n)+"]");var a=null;_(i,y)?a=i[y]:(a=T+V(e,"_")+"$"+E,E++,i[y]=a);var o,s,l,c,u,g,f=z[S],d=!!f[N];d&&r&&r[N]!==undefined&&(d=!!r[N]),t(n,function(e,t,n,a){function r(e,t,n){var r,i=t[n];return i[v]&&a&&!1!==(r=e[h]||{})[w]&&(i=(r[t[y]]||{})[n]||i),function(){return i.apply(e,arguments)}}var i={};D(n,function(e){i[e]=r(t,n,e)});for(var o=A(e),s=[];o&&!b(o)&&!R(s,o);)D(o,function(e){!i[e]&&L(o,e,!P)&&(i[e]=r(t,o,e))}),s.push(o),o=A(o);return i}(i,n,(s={},D(o=n,function(e){!s[e]&&L(o,e,!1)&&(s[e]=o[e])}),e=s),d)),l=i,a=a,c=n,u=e,r=!1!==(f=(f=!!P&&!!f[C])&&r?!!r[C]:f),k(l)||(f=c[h]=c[h]||{},g=f[a]=f[a]||{},!1!==f[w]&&(f[w]=!!r),D(c,function(e){var n,r,i;L(c,e,!1)&&c[e]!==u[e]&&(g[e]=c[e],delete c[e],_(l,e)&&(!l[e]||l[e][v])||(l[e]=(n=l,r=e,(i=function(){var e,t;return(function(e,t,n,r){var i=null;if(e&&_(n,y)){var a=e[h]||{};if((i=(a[n[y]]||{})[t])||M("Missing ["+t+"] "+m),!i[I]&&!1!==a[w]){for(var o=!_(e,t),s=A(e),l=[];o&&s&&!b(s)&&!R(l,s);){var c=s[t];if(c){o=c===r;break}l.push(s),s=A(s)}try{o&&(e[t]=i),i[I]=1}catch(u){a[w]=!1}}}return i}(this,r,n,i)||(typeof(t=(t=n[e=r])===i?A(n)[e]:t)!==m&&M("["+e+"] is not a "+m),t)).apply(this,arguments)})[v]=1,i)))}))}z[S]={setInstFuncs:!0,useBaseInst:!0},(mt=x=x||{})[mt.CRITICAL=1]="CRITICAL",mt[mt.WARNING=2]="WARNING";var F={BrowserDoesNotSupportLocalStorage:0,BrowserCannotReadLocalStorage:1,BrowserCannotReadSessionStorage:2,BrowserCannotWriteLocalStorage:3,BrowserCannotWriteSessionStorage:4,BrowserFailedRemovalFromLocalStorage:5,BrowserFailedRemovalFromSessionStorage:6,CannotSendEmptyTelemetry:7,ClientPerformanceMathError:8,ErrorParsingAISessionCookie:9,ErrorPVCalc:10,ExceptionWhileLoggingError:11,FailedAddingTelemetryToBuffer:12,FailedMonitorAjaxAbort:13,FailedMonitorAjaxDur:14,FailedMonitorAjaxOpen:15,FailedMonitorAjaxRSC:16,FailedMonitorAjaxSend:17,FailedMonitorAjaxGetCorrelationHeader:18,FailedToAddHandlerForOnBeforeUnload:19,FailedToSendQueuedTelemetry:20,FailedToReportDataLoss:21,FlushFailed:22,MessageLimitPerPVExceeded:23,MissingRequiredFieldSpecification:24,NavigationTimingNotSupported:25,OnError:26,SessionRenewalDateIsZero:27,SenderNotInitialized:28,StartTrackEventFailed:29,StopTrackEventFailed:30,StartTrackFailed:31,StopTrackFailed:32,TelemetrySampledAndNotSent:33,TrackEventFailed:34,TrackExceptionFailed:35,TrackMetricFailed:36,TrackPVFailed:37,TrackPVFailedCalc:38,TrackTraceFailed:39,TransmissionFailed:40,FailedToSetStorageBuffer:41,FailedToRestoreStorageBuffer:42,InvalidBackendResponse:43,FailedToFixDepricatedValues:44,InvalidDurationValue:45,TelemetryEnvelopeInvalid:46,CreateEnvelopeError:47,CannotSerializeObject:48,CannotSerializeObjectNonSerializable:49,CircularReferenceDetected:50,ClearAuthContextFailed:51,ExceptionTruncated:52,IllegalCharsInName:53,ItemNotInArray:54,MaxAjaxPerPVExceeded:55,MessageTruncated:56,NameTooLong:57,SampleRateOutOfRange:58,SetAuthContextFailed:59,SetAuthContextFailedAccountName:60,StringValueTooLong:61,StartCalledMoreThanOnce:62,StopCalledWithoutStart:63,TelemetryInitializerFailed:64,TrackArgumentsNotSpecified:65,UrlTooLong:66,SessionStorageBufferFull:67,CannotAccessCookie:68,IdTooLong:69,InvalidEvent:70,FailedMonitorAjaxSetRequestHeader:71,SendBrowserInfoOnUserInit:72,PluginException:73,NotificationException:74,SnippetScriptLoadFailure:99,InvalidInstrumentationKey:100,CannotParseAiBlobValue:101,InvalidContentBlob:102,TrackPageActionEventFailed:103},f=(ht=Object)[o],d=f.hasOwnProperty,G=ht.defineProperty;function O(e){return f.toString.call(e)}function B(e){return e===undefined||typeof e===t}function U(e){return null===e||B(e)}function q(e){return typeof e===r}function W(e,t){if(e)for(var n in e)d.call(e,n)&&t.call(e,n,e[n])}function j(e,t){return!(!e||!t||!~e.indexOf(t))}function H(e){return"[object Array]"===O(e)}function X(e){return"[object Error]"===O(e)}function K(e){return"string"==typeof e}function J(e,t,n){for(var r=e.length,i=0;i<r&&!(i in e&&-1===t.call(n||e,e[i],i,e));i++);}function $(e,t,n){for(var r=e.length,i=n||e,a=Array(r),o=0;o<r;o++)o in e&&(a[o]=t.call(i,e[o],e));return a}function Y(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")}function Z(){var e=Date;return e.now?e.now():(new e).getTime()}function Q(e){return X(e)?e.name:""}({toString:null}).propertyIsEnumerable("toString");var ee=t,te=a,ne="window",re="document",ie="navigator",ae="history",oe="location",se="JSON",le="crypto",ce="msCrypto",ue="msie",ge="trident/",fe=null,de=null,pe=!1,me=n;function he(e){var t=me();return t&&t[e]?t[e]:e===ne&&ve()?window:null}function ve(){return typeof window===te&&window}function ye(){return typeof document===te&&document?document:he(re)}function Te(){return typeof navigator===te&&navigator?navigator:he(ie)}function Ie(e){return e&&pe&&(e=he("__mockLocation"))?e:typeof location===te&&location?location:he(oe)}function we(){return he("performance")}function Se(){return typeof JSON===te&&JSON||null!==he(se)}function xe(){return Se()?JSON||he(se):null}function Ne(e){var t=Object[o].toString.call(e),n="";return"[object Error]"===t?n="{ stack: '"+e.stack+"', message: '"+e.message+"', name: '"+e.name+"'":Se()&&(n=xe().stringify(e)),t+n}function Ce(e){return e?'"'+e.replace(/\"/g,"")+'"':""}var Pe=(Ee.dataType="MessageData",Ee);function Ee(e,t,n,r){void 0===n&&(n=!1),this.messageId=e,this.message=(n?"AI: ":"AI (Internal): ")+e,e="",Se()&&(e=xe().stringify(r)),e=(t?" message:"+Ce(t):"")+(r?" props:"+Ce(e):""),this.message+=e}var _e=function dn(n){this.identifier="DiagnosticLogger",this.queue=[];var i=0,o={};z(dn,this,function(a){function e(e,t){return U(e=n[e])?t:e}U(n)&&(n={}),a.consoleLoggingLevel=function(){return e("loggingLevelConsole",0)},a.telemetryLoggingLevel=function(){return e("loggingLevelTelemetry",1)},a.maxInternalMessageLimit=function(){return e("maxMessageLimit",25)},a.enableDebugExceptions=function(){return e("enableDebugExceptions",!1)},a.throwInternal=function(e,t,n,r,i){if(n=new Pe(t,n,i=void 0!==i&&i,r),a.enableDebugExceptions())throw n;B(n)||!n||B(n.message)||(r=a.consoleLoggingLevel(),i?(i=+n.messageId,!o[i]&&r>=x.WARNING&&(a.warnToConsole(n.message),o[i]=!0)):r>=x.WARNING&&a.warnToConsole(n.message),a.logInternalMessage(e,n))},a.warnToConsole=function(e){var t,n=typeof console!==ee?console:he("console");n&&(t="log",q(n[t=n.warn?"warn":t])&&n[t](e))},a.resetInternalMessageCount=function(){i=0,o={}},a.logInternalMessage=function(e,t){var n,r;i>=a.maxInternalMessageLimit()||(n=!0,r="AITR_"+t.messageId,o[r]?n=!1:o[r]=!0,n&&(e<=a.telemetryLoggingLevel()&&(a.queue.push(t),i++),i===a.maxInternalMessageLimit()&&(t=new Pe(F.MessageLimitPerPVExceeded,e="Internal events throttle limit per PageView reached for this app.",!1),a.queue.push(t),a.warnToConsole(e))))}})},ke="ctx",be=(Ae.ParentContextKey="parent",Ae.ChildrenContextKey="childEvts",Ae);function Ae(e,i,t){var r,a=this,o=!1;a.start=Z(),a.name=e,a.isAsync=t,a.isChildEvt=function(){return!1},q(i)&&(o=function(e){if(G)try{var t={enumerable:!0,configurable:!0,get:function(){return!r&&q(i)&&(r=i(),i=null),r}};return G(e,"payload",t),!0}catch(n){}return!1}(a)),a.getCtx=function(e){return e?(e===Ae.ParentContextKey||e===Ae.ChildrenContextKey?a:a[ke]||{})[e]:null},a.setCtx=function(e,t){e&&(e===Ae.ParentContextKey?(a[e]||(a.isChildEvt=function(){return!0}),a[e]=t):e===Ae.ChildrenContextKey?a[e]=t:(a[ke]=a[ke]||{})[e]=t)},a.complete=function(){var e=0,t=a.getCtx(Ae.ChildrenContextKey);if(H(t))for(var n=0;n<t.length;n++){var r=t[n];r&&(e+=r.time)}a.time=Z()-a.start,a.exTime=a.time-e,a.complete=function(){},!o&&q(i)&&(a.payload=i())}}var De="CoreUtils.doPerf";function Le(e,t,n,r,i){if(e){var a=e;if(a=a&&q(a.getPerfMgr)?a.getPerfMgr():a){var o,s=void 0,e=a.getCtx(De);try{if(s=a.create(t(),r,i))return e&&s.setCtx&&(s.setCtx(be.ParentContextKey,e),e.getCtx&&e.setCtx&&((o=e.getCtx(be.ChildrenContextKey))||(o=[],e.setCtx(be.ChildrenContextKey,o)),o.push(s))),a.setCtx(De,s),n(s)}catch(l){s&&s.setCtx&&s.setCtx("exception",l)}finally{s&&a.fire(s),a.setCtx(De,e)}}}return n()}var Me=function(i,t){var a=this,o=null,s=q(i.processTelemetry),l=q(i.setNextPlugin);a._hasRun=!1,a.getPlugin=function(){return i},a.getNext=function(){return o},a.setNext=function(e){o=e},a.processTelemetry=function(n,r){var e=i?i.identifier:"TelemetryPluginChain";Le((r=r||t)?r.core():null,function(){return e+":processTelemetry"},function(){if(i&&s){a._hasRun=!0;try{r.setNext(o),l&&i.setNextPlugin(o),o&&(o._hasRun=!1),i.processTelemetry(n,r)}catch(t){var e=o&&o._hasRun;o&&e||r.diagLog().throwInternal(x.CRITICAL,F.PluginException,"Plugin ["+i.identifier+"] failed during processTelemetry - "+t),o&&!e&&o.processTelemetry(n,r)}}else o&&(a._hasRun=!0,o.processTelemetry(n,r))},function(){return{item:n}},!n.sync)}};function Re(e,t){var n=[];if(e&&0<e.length)for(var r=null,i=0;i<e.length;i++){var a=e[i];a&&q(a.processTelemetry)&&(a=new Me(a,t),n.push(a),r&&r.setNext(a),r=a)}return 0<n.length?n[0]:null}var Ve=function pn(e,i,n,t){var r,a,o,s,l=this,c=null;null!==t&&(e&&q(e.getPlugin)?c=function(e,t,n){var r=[],i=!n;if(e)for(;e;){var a=e.getPlugin();!i&&a!==n||(i=!0,r.push(a)),e=e.getNext()}return i||r.push(n),Re(r,t)}(e,l,t||e.getPlugin()):t?(r=l,o=e,s=!1,(a=t)&&e&&(o=[],J(e,function(e){!s&&e!==a||(s=!0,o.push(e))})),a&&!s&&(o=o||[]).push(a),c=Re(o,r)):B(t)&&(c=Re(e,l))),l.core=function(){return n},l.diagLog=function(){return(n||{}).logger||new _e(i)},l.getCfg=function(){return i},l.getExtCfg=function(e,t){var n,r;return void 0===t&&(t={}),!i||(r=i.extensionConfig)&&e&&(n=r[e]),n||t},l.getConfig=function(e,t,n){var r;return void 0===n&&(n=!1),(e=l.getExtCfg(e,null))&&!U(e[t])?r=e[t]:i&&!U(i[t])&&(r=i[t]),U(r)?n:r},l.hasNext=function(){return null!=c},l.getNext=function(){return c},l.setNext=function(e){c=e},l.processNext=function(e){var t=c;t&&(c=t.getNext(),t.processTelemetry(e,l))},l.createNew=function(e,t){return new pn((e=void 0===e?null:e)||c,i,n,t)}},ze="getPlugin",Fe=(Ge.prototype.initialize=function(e,t,n,r){this._baseTelInit(e,t,n,r)},Ge);function Ge(){var s=this,l=!1,c=null,u=null;s.core=null,s.diagLog=function(e){return s._getTelCtx(e).diagLog()},s.isInitialized=function(){return l},s.setInitialized=function(e){l=e},s.setNextPlugin=function(e){u=e},s.processNext=function(e,t){t?t.processNext(e):u&&q(u.processTelemetry)&&u.processTelemetry(e,null)},s._getTelCtx=function(e){var t=e=void 0===e?null:e;return t||(e=c||new Ve(null,{},s.core),t=u&&u[ze]?e.createNew(null,u[ze]):e.createNew(null,u)),t},s._baseTelInit=function(e,t,n,r){var i,a;e&&(i="extensionConfig",o=a=[],!e||(o=e[i])!==a&&U(o)&&(e[i]=o=a)),!r&&t&&(r=t.getProcessTelContext().getNext());var o=u;u&&u[ze]&&(o=u[ze]()),s.core=t,c=new Ve(r,e,t,o),l=!0}}var Oe=4294967296,Be=4294967295,Ue=!1,qe=123456789,We=987654321;function je(e){var t=he(le)||he(ce),n=t&&t.getRandomValues?t.getRandomValues(new Uint32Array(1))[0]&Be:(!(n=Te())||n.userAgent===de&&null!==fe||(n=((de=n.userAgent)||"").toLowerCase(),fe=j(n,ue)||j(n,ge)),fe?(Ue||function(){try{var e=2147483647&Z();(t=(Math.random()*Oe^e)+e)<0&&(t>>>=0),qe=123456789+t&Be,We=987654321-t&Be,Ue=!0}catch(n){}var t}(),t=((We=36969*(65535&We)+(We>>16)&Be)<<16)+(65535&(qe=18e3*(65535&qe)+(qe>>16)&Be))>>>0&Be|0,(t>>>=0)&Be):Math.floor(Oe*Math.random()|0));return e||(n>>>=0),n}var He=(Xe.sanitizeKeyAndAddUniqueness=function(e,t,n){var r=t.length,i=Xe.sanitizeKey(e,t);if(i.length!==r){for(var a=0,o=i;n[o]!==undefined;)a++,o=i.substring(0,Xe.MAX_NAME_LENGTH-3)+Xe.padNumber(a);i=o}return i},Xe.sanitizeKey=function(e,t){var n;return t&&(t=Xe.trim(t.toString())).length>Xe.MAX_NAME_LENGTH&&(n=t.substring(0,Xe.MAX_NAME_LENGTH),e.throwInternal(x.WARNING,F.NameTooLong,"name is too long. It has been truncated to "+Xe.MAX_NAME_LENGTH+" characters.",{name:t},!0)),n||t},Xe.sanitizeString=function(e,t,n){var r;return void 0===n&&(n=Xe.MAX_STRING_LENGTH),t&&(n=n||Xe.MAX_STRING_LENGTH,(t=Xe.trim(t)).toString().length>n&&(r=t.toString().substring(0,n),e.throwInternal(x.WARNING,F.StringValueTooLong,"string value is too long. It has been truncated to "+n+" characters.",{value:t},!0))),r||t},Xe.sanitizeUrl=function(e,t){return Xe.sanitizeInput(e,t,Xe.MAX_URL_LENGTH,F.UrlTooLong)},Xe.sanitizeMessage=function(e,t){var n;return t&&t.length>Xe.MAX_MESSAGE_LENGTH&&(n=t.substring(0,Xe.MAX_MESSAGE_LENGTH),e.throwInternal(x.WARNING,F.MessageTruncated,"message is too long, it has been truncated to "+Xe.MAX_MESSAGE_LENGTH+" characters.",{message:t},!0)),n||t},Xe.sanitizeException=function(e,t){var n;return t&&t.length>Xe.MAX_EXCEPTION_LENGTH&&(n=t.substring(0,Xe.MAX_EXCEPTION_LENGTH),e.throwInternal(x.WARNING,F.ExceptionTruncated,"exception is too long, it has been truncated to "+Xe.MAX_EXCEPTION_LENGTH+" characters.",{exception:t},!0)),n||t},Xe.sanitizeProperties=function(r,e){var i;return e&&(i={},W(e,function(e,t){if(typeof t==a&&Se())try{t=xe().stringify(t)}catch(n){r.throwInternal(x.WARNING,F.CannotSerializeObjectNonSerializable,"custom property is not valid",{exception:n},!0)}t=Xe.sanitizeString(r,t,Xe.MAX_PROPERTY_LENGTH),e=Xe.sanitizeKeyAndAddUniqueness(r,e,i),i[e]=t}),e=i),e},Xe.sanitizeMeasurements=function(n,e){var r;return e&&(r={},W(e,function(e,t){e=Xe.sanitizeKeyAndAddUniqueness(n,e,r),r[e]=t}),e=r),e},Xe.sanitizeId=function(e,t){return t&&Xe.sanitizeInput(e,t,Xe.MAX_ID_LENGTH,F.IdTooLong).toString()},Xe.sanitizeInput=function(e,t,n,r){var i;return t&&(t=Xe.trim(t)).length>n&&(i=t.substring(0,n),e.throwInternal(x.WARNING,r,"input is too long, it has been truncated to "+n+" characters.",{data:t},!0)),i||t},Xe.padNumber=function(e){return(e="00"+e).substr(e.length-3)},Xe.trim=function(e){return K(e)?e.replace(/^\s+|\s+$/g,""):e},Xe.MAX_NAME_LENGTH=150,Xe.MAX_ID_LENGTH=128,Xe.MAX_PROPERTY_LENGTH=8192,Xe.MAX_STRING_LENGTH=1024,Xe.MAX_URL_LENGTH=2048,Xe.MAX_MESSAGE_LENGTH=32768,Xe.MAX_EXCEPTION_LENGTH=32768,Xe);function Xe(){}function Ke(e){var t,n=null;return q(Event)?n=new Event(e):(t=ye())&&t.createEvent&&(n=t.createEvent("Event")).initEvent(e,!0,!0),n}function Je(e,t){return void 0===t&&(t=!1),e===undefined||null===e?t:"true"==e.toString().toLowerCase()}function $e(e){var t=""+(e=Math.round(e=isNaN(e)||e<0?0:e))%1e3,n=""+Math.floor(e/1e3)%60,r=""+Math.floor(e/6e4)%60,i=""+Math.floor(e/36e5)%24,t=1===t.length?"00"+t:2===t.length?"0"+t:t,n=n.length<2?"0"+n:n,r=r.length<2?"0"+r:r;return(0<(e=Math.floor(e/864e5))?e+".":"")+(i=i.length<2?"0"+i:i)+":"+r+":"+n+"."+t}var Ye,Ze,Qe="not_specified";(Mt=Ye=Ye||{})[Mt.LocalStorage=0]="LocalStorage",Mt[Mt.SessionStorage=1]="SessionStorage",(mt=Ze=Ze||{})[mt.Default=0]="Default",mt[mt.Required=1]="Required",mt[mt.Array=2]="Array",mt[mt.Hidden=4]="Hidden",(ht={})[ht.AI=0]="AI",ht[ht.AI_AND_W3C=1]="AI_AND_W3C",ht[ht.W3C=2]="W3C";var et=undefined;function tt(e){try{if(U(me()))return null;var t=new Date,n=he(e===Ye.LocalStorage?"localStorage":"sessionStorage");n.setItem(t.toString(),t.toString());var r=n.getItem(t.toString())!==t.toString();if(n.removeItem(t.toString()),!r)return n}catch(i){}return null}function nt(){return rt()?tt(Ye.SessionStorage):null}function rt(){return et=et===undefined?!!tt(Ye.SessionStorage):et}function it(e,t){var n=nt();if(null!==n)try{return n.getItem(t)}catch(r){et=!1,e.throwInternal(x.WARNING,F.BrowserCannotReadSessionStorage,"Browser failed read of session storage. "+Q(r),{exception:Ne(r)})}return null}function at(e,t,n){var r=nt();if(null!==r)try{return r.setItem(t,n),1}catch(i){et=!1,e.throwInternal(x.WARNING,F.BrowserCannotWriteSessionStorage,"Browser failed write to session storage. "+Q(i),{exception:Ne(i)})}}function ot(e,t){var n=nt();if(null!==n)try{return n.removeItem(t),1}catch(r){et=!1,e.throwInternal(x.WARNING,F.BrowserFailedRemovalFromSessionStorage,"Browser failed removal of session storage item. "+Q(r),{exception:Ne(r)})}}var st=ye()||{},lt=0,ct=[null,null,null,null,null];function ut(e,t){return 0===e||0===t||U(e)||U(t)?null:t-e}var gt,ft=(gt=Mt=function(){this.ver=2,this.properties={},this.measurements={}},__extends(dt,gt),dt.envelopeType="Microsoft.ApplicationInsights.{0}.Event",dt.dataType="EventData",dt);function dt(e,t,n,r){var i=gt.call(this)||this;return i.aiDataContract={ver:Ze.Required,name:Ze.Required,properties:Ze.Default,measurements:Ze.Default},i.name=He.sanitizeString(e,t)||Qe,i.properties=He.sanitizeProperties(e,n),i.measurements=He.sanitizeMeasurements(e,r),i}var pt,mt=function(){},ht=function(){this.hasFullStack=!0,this.parsedStack=[]},vt="error",yt=(pt=function(){this.ver=2,this.exceptions=[],this.properties={},this.measurements={}},__extends(Tt,pt),Tt.CreateFromInterface=function(t,e,n,r){var i=e.exceptions&&$(e.exceptions,function(e){return wt.CreateFromInterface(t,e)});return new Tt(t,__assign({},e,{exceptions:i}),n,r)},Tt.prototype.toInterface=function(){var e=this.exceptions,t=this.properties,n=this.measurements,r=this.severityLevel;this.ver;var i=this.problemGroup,a=this.id,o=this.isManual;return{ver:"4.0",exceptions:e instanceof Array&&$(e,function(e){return e.toInterface()})||undefined,severityLevel:r,properties:t,measurements:n,problemGroup:i,id:a,isManual:o}},Tt.CreateSimpleException=function(e,t,n,r,i,a){return{exceptions:[{hasFullStack:!0,message:e,stack:i,typeName:t}]}},Tt.envelopeType="Microsoft.ApplicationInsights.{0}.Exception",Tt.dataType="ExceptionData",Tt);function Tt(e,t,n,r,i,a){var o,s=pt.call(this)||this;return s.aiDataContract={ver:Ze.Required,exceptions:Ze.Required,severityLevel:Ze.Default,properties:Ze.Default,measurements:Ze.Default},"ver"in(o=t)&&"exceptions"in o&&"properties"in o?(s.exceptions=t.exceptions,s.properties=t.properties,s.measurements=t.measurements,t.severityLevel&&(s.severityLevel=t.severityLevel),t.id&&(s.id=t.id),t.problemGroup&&(s.problemGroup=t.problemGroup),s.ver=2,U(t.isManual)||(s.isManual=t.isManual)):(s.exceptions=[new wt(e,t)],s.properties=He.sanitizeProperties(e,n)||{},s.measurements=He.sanitizeMeasurements(e,r),i&&(s.severityLevel=i),a&&(s.id=a)),s}var It,wt=(It=ht,__extends(St,It),St.prototype.toInterface=function(){var e=this.parsedStack instanceof Array&&$(this.parsedStack,function(e){return e.toInterface()});return{id:this.id,outerId:this.outerId,typeName:this.typeName,message:this.message,hasFullStack:this.hasFullStack,stack:this.stack,parsedStack:e||undefined}},St.CreateFromInterface=function(e,t){var n=t.parsedStack instanceof Array&&$(t.parsedStack,function(e){return Nt.CreateFromInterface(e)})||t.parsedStack;return new St(e,__assign({},t,{parsedStack:n}))},St.parseStack=function(e){if(K(e)){for(var t=e.split("\n"),n=[],r=0,i=0,a=0;a<=t.length;a++){var o=t[a];Nt.regex.test(o)&&(i+=(o=new Nt(t[a],r++)).sizeInBytes,n.push(o))}if(32768<i)for(var s=0,l=n.length-1,c=0,u=s,g=l;s<l;){if(32768<(c+=n[s].sizeInBytes+n[l].sizeInBytes)){n.splice(u,g-u+1);break}u=s,g=l,s++,l--}}return n},St);function St(e,t){var n,r=It.call(this)||this;return r.aiDataContract={id:Ze.Default,outerId:Ze.Default,typeName:Ze.Required,message:Ze.Required,hasFullStack:Ze.Default,stack:Ze.Default,parsedStack:Ze.Array},"hasFullStack"in(n=t)&&"typeName"in n?(r.typeName=t.typeName,r.message=t.message,r.stack=t.stack,r.parsedStack=t.parsedStack,r.hasFullStack=t.hasFullStack):(X(n=t)||(n=n[vt]||n.evt||n),r.typeName=He.sanitizeString(e,function(e){var t="";if(e&&!(t=e.typeName||e.name||""))try{var n=/function (.{1,})\(/.exec(e.constructor.toString()),t=n&&1<n.length?n[1]:""}catch(r){}return t}(n))||Qe,r.message=He.sanitizeMessage(e,t.message)||Qe,t=t.stack,r.parsedStack=St.parseStack(t),r.stack=He.sanitizeException(e,t),r.hasFullStack=H(r.parsedStack)&&0<r.parsedStack.length),r}var xt,Nt=(xt=mt,__extends(Ct,xt),Ct.CreateFromInterface=function(e){return new Ct(e,null)},Ct.prototype.toInterface=function(){return{level:this.level,method:this.method,assembly:this.assembly,fileName:this.fileName,line:this.line}},Ct.regex=/^([\s]+at)?(.*?)(\@|\s\(|\s)([^\(\@\n]+):([0-9]+):([0-9]+)(\)?)$/,Ct.baseSize=58,Ct);function Ct(e,t){var n,r=xt.call(this)||this;return r.sizeInBytes=0,r.aiDataContract={level:Ze.Required,method:Ze.Required,assembly:Ze.Default,fileName:Ze.Default,line:Ze.Default},"string"==typeof e?(n=e,r.level=t,r.method="<no_method>",r.assembly=Y(n),r.fileName="",r.line=0,(n=n.match(Ct.regex))&&5<=n.length&&(r.method=Y(n[2])||r.method,r.fileName=Y(n[4]),r.line=parseInt(n[5])||0)):(r.level=e.level,r.method=e.method,r.assembly=e.assembly,r.fileName=e.fileName,r.line=e.line,r.sizeInBytes=0),r.sizeInBytes+=r.method.length,r.sizeInBytes+=r.fileName.length,r.sizeInBytes+=r.assembly.length,r.sizeInBytes+=Ct.baseSize,r.sizeInBytes+=r.level.toString().length,r.sizeInBytes+=r.line.toString().length,r}var Pt,ht=function(){this.ver=2,this.metrics=[],this.properties={},this.measurements={}};(mt=Pt={})[mt.Measurement=0]="Measurement",mt[mt.Aggregation=1]="Aggregation";var Et,_t=(Et=function(){this.kind=Pt.Measurement},__extends(kt,Et),kt);function kt(){var e=Et.apply(this,arguments)||this;return e.aiDataContract={name:Ze.Required,kind:Ze.Default,value:Ze.Required,count:Ze.Default,min:Ze.Default,max:Ze.Default,stdDev:Ze.Default},e}var bt,At=(bt=ht,__extends(Dt,bt),Dt.envelopeType="Microsoft.ApplicationInsights.{0}.Metric",Dt.dataType="MetricData",Dt);function Dt(e,t,n,r,i,a,o,s){var l=bt.call(this)||this;l.aiDataContract={ver:Ze.Required,metrics:Ze.Required,properties:Ze.Default};var c=new _t;return c.count=0<r?r:undefined,c.max=isNaN(a)||null===a?undefined:a,c.min=isNaN(i)||null===i?undefined:i,c.name=He.sanitizeString(e,t)||Qe,c.value=n,l.metrics=[c],l.properties=He.sanitizeProperties(e,o),l.measurements=He.sanitizeMeasurements(e,s),l}var Lt,Mt=(Lt=Mt,__extends(Rt,Lt),Rt);function Rt(){var e=Lt.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var Vt,zt=(Vt=Mt,__extends(Ft,Vt),Ft.envelopeType="Microsoft.ApplicationInsights.{0}.Pageview",Ft.dataType="PageviewData",Ft);function Ft(e,t,n,r,i,a,o){var s=Vt.call(this)||this;return s.aiDataContract={ver:Ze.Required,name:Ze.Default,url:Ze.Default,duration:Ze.Default,properties:Ze.Default,measurements:Ze.Default,id:Ze.Default},s.id=He.sanitizeId(e,o),s.url=He.sanitizeUrl(e,n),s.name=He.sanitizeString(e,t)||Qe,isNaN(r)||(s.duration=$e(r)),s.properties=He.sanitizeProperties(e,i),s.measurements=He.sanitizeMeasurements(e,a),s}var Gt,Ot=(Gt=function(){this.ver=2,this.success=!0,this.properties={},this.measurements={}},__extends(Bt,Gt),Bt.envelopeType="Microsoft.ApplicationInsights.{0}.RemoteDependency",Bt.dataType="RemoteDependencyData",Bt);function Bt(e,t,n,r,i,a,o,s,l,c,u,g){void 0===l&&(l="Ajax");var f=Gt.call(this)||this;f.aiDataContract={id:Ze.Required,ver:Ze.Required,name:Ze.Default,resultCode:Ze.Default,duration:Ze.Default,success:Ze.Default,data:Ze.Default,target:Ze.Default,type:Ze.Default,properties:Ze.Default,measurements:Ze.Default,kind:Ze.Default,value:Ze.Default,count:Ze.Default,min:Ze.Default,max:Ze.Default,stdDev:Ze.Default,dependencyKind:Ze.Default,dependencySource:Ze.Default,commandName:Ze.Default,dependencyTypeName:Ze.Default},f.id=t,f.duration=$e(i),f.success=a,f.resultCode=o+"",f.type=He.sanitizeString(e,l);var d,p,m,h,v,y,T,I,w,S,o=(d=e,t=s,o=a=i=r,a=(l=n)&&0<l.length?(p=l,S=(w=ct)[I=lt],st.createElement?w[I]||(S=w[I]=st.createElement("a")):S={host:(y=!0,T=null,!(v=m=p)||null!=(v=v.match(/(\w*):\/\/(.[^/:]+)(\:[\d]+)?/i))&&2<v.length&&K(v[2])&&0<v[2].length&&(T=v[2]||"",y&&2<v.length&&(y=(v[1]||"").toLowerCase(),v=v[3]||"",T+=v="http"==y&&":80"===v||"https"==y&&":443"===v?"":v)),(m=T)&&null!=(h=m.match(/(www[0-9]?\.)?(.[^/:]+)(\:[\d]+)?/i))&&3<h.length&&K(h[2])&&0<h[2].length?h[2]+(h[3]||""):m)},S.href=p,++I>=w.length&&(I=0),lt=I,S=(s=S).host,a||(null!=s.pathname?("/"!=((n=0===s.pathname.length?"/":s.pathname)[0]||"")&&(n="/"+n),o=s.pathname,He.sanitizeString(d,t?t+" "+n:n)):He.sanitizeString(d,l))):S=i,{target:S,name:a,data:o});return f.data=He.sanitizeUrl(e,r)||o.data,f.target=He.sanitizeString(e,o.target),c&&(f.target=f.target+" | "+c),f.name=He.sanitizeString(e,o.name),f.properties=He.sanitizeProperties(e,u),f.measurements=He.sanitizeMeasurements(e,g),f}var Ut,qt=(Ut=function(){this.ver=2,this.properties={},this.measurements={}},__extends(Wt,Ut),Wt.envelopeType="Microsoft.ApplicationInsights.{0}.Message",Wt.dataType="MessageData",Wt);function Wt(e,t,n,r,i){var a=Ut.call(this)||this;return a.aiDataContract={ver:Ze.Required,message:Ze.Required,severityLevel:Ze.Default,properties:Ze.Default},a.message=He.sanitizeMessage(e,t=t||Qe),a.properties=He.sanitizeProperties(e,r),a.measurements=He.sanitizeMeasurements(e,i),n&&(a.severityLevel=n),a}var jt,Mt=(jt=Mt,__extends(Ht,jt),Ht);function Ht(){var e=jt.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var Xt,Kt,Jt=(Xt=Mt,__extends($t,Xt),$t.envelopeType="Microsoft.ApplicationInsights.{0}.PageviewPerformance",$t.dataType="PageviewPerformanceData",$t);function $t(e,t,n,r,i,a,o){var s=Xt.call(this)||this;return s.aiDataContract={ver:Ze.Required,name:Ze.Default,url:Ze.Default,duration:Ze.Default,perfTotal:Ze.Default,networkConnect:Ze.Default,sentRequest:Ze.Default,receivedResponse:Ze.Default,domProcessing:Ze.Default,properties:Ze.Default,measurements:Ze.Default},s.url=He.sanitizeUrl(e,n),s.name=He.sanitizeString(e,t)||Qe,s.properties=He.sanitizeProperties(e,i),s.measurements=He.sanitizeMeasurements(e,a),o&&(s.domProcessing=o.domProcessing,s.duration=o.duration,s.networkConnect=o.networkConnect,s.perfTotal=o.perfTotal,s.receivedResponse=o.receivedResponse,s.sentRequest=o.sentRequest),s}(Mt=Kt=Kt||{})[Mt.Verbose=0]="Verbose",Mt[Mt.Information=1]="Information",Mt[Mt.Warning=2]="Warning",Mt[Mt.Error=3]="Error",Mt[Mt.Critical=4]="Critical";var Yt=(Zt.create=function(e,t,n,r,i,a){if(n=He.sanitizeString(r,n)||Qe,U(e)||U(t)||U(n))throw Error("Input doesn't contain all required fields");var o={name:n,time:function(e){if("[object Date]"===O(e)){var t=function(e){return 1===(e=""+e).length?"0"+e:e};return e.getUTCFullYear()+"-"+t(1+e.getUTCMonth())+"-"+t(e.getUTCDate())+"T"+t(e.getUTCHours())+":"+t(e.getUTCMinutes())+":"+t(e.getUTCSeconds())+"."+(""+(e.getUTCMilliseconds()/1e3).toFixed(3)).slice(2,5)+"Z"}}(new Date),iKey:"",ext:a||{},tags:[],data:{},baseType:t,baseData:e};return U(i)||W(i,function(e,t){o.data[e]=t}),o},Zt);function Zt(){}var Qt="AppInsightsPropertiesPlugin",en="ApplicationInsightsAnalytics",tn=function mn(p,m,t,h){z(mn,this,function(e){var u,n=null,g=[],f=!1;function d(){t&&J(t.getTransmissionControls(),function(e){J(e,function(e){return e.flush(!0)})})}t&&(u=t.logger),e.trackPageView=function(r,i){var a=r.name;!U(a)&&"string"==typeof a||(e=ye(),a=r.name=e&&e.title||"");var e,o=r.uri;if(!U(o)&&"string"==typeof o||(e=Ie(),o=r.uri=e&&e.href||""),!h.isPerformanceTimingSupported())return p.sendPageViewInternal(r,i),d(),void u.throwInternal(x.WARNING,F.NavigationTimingNotSupported,"trackPageView: navigation timing API used for calculation of page duration is not supported in this browser. This page view will be collected without duration and timing info.");var s,t,l=!1,c=h.getPerformanceTiming().navigationStart;0<c&&(s=ut(c,+new Date),h.shouldCollectDuration(s)||(s=undefined)),U(i)||U(i.duration)||(t=i.duration),!m&&isNaN(t)||(isNaN(t)&&((i=i||{}).duration=s),p.sendPageViewInternal(r,i),d(),l=!0),i=i||{},g.push(t=function(){var e,t=!1;try{h.isPerformanceTimingDataReady()?(t=!0,e={name:a,uri:o},h.populatePageViewPerformanceEvent(e),e.isValid||l?(l||(i.duration=e.durationMs,p.sendPageViewInternal(r,i)),f||(p.sendPageViewPerformanceInternal(e,i),f=!0)):(i.duration=s,p.sendPageViewInternal(r,i))):0<c&&6e4<ut(c,+new Date)&&(t=!0,l||(i.duration=6e4,p.sendPageViewInternal(r,i)))}catch(n){u.throwInternal(x.CRITICAL,F.TrackPVFailedCalc,"trackPageView failed on page load calculation: "+Q(n),{exception:Ne(n)})}return t}),n=n||setInterval(function(){var e=g.slice(0),t=!1;g=[],J(e,function(e){e()?t=!0:g.push(e)}),0===g.length&&(clearInterval(n),n=null),t&&d()},100)}})},nn=(rn.prototype.trackPreviousPageVisit=function(e,t){try{var n=this.restartPageVisitTimer(e,t);n&&this.pageVisitTimeTrackingHandler(n.pageName,n.pageUrl,n.pageVisitTime)}catch(r){this._logger.warnToConsole("Auto track page visit time failed, metric will not be collected: "+Ne(r))}},rn.prototype.restartPageVisitTimer=function(e,t){try{var n=this.stopPageVisitTimer();return this.startPageVisitTimer(e,t),n}catch(r){return this._logger.warnToConsole("Call to restart failed: "+Ne(r)),null}},rn.prototype.startPageVisitTimer=function(e,t){try{var n,r;rt()&&(null!=it(this._logger,this.prevPageVisitDataKeyName)&&function(){throw Error("Cannot call startPageVisit consecutively without first calling stopPageVisit")}(),n=new an(e,t),r=xe().stringify(n),at(this._logger,this.prevPageVisitDataKeyName,r))}catch(i){this._logger.warnToConsole("Call to start failed: "+Ne(i))}},rn.prototype.stopPageVisitTimer=function(){try{if(rt()){var e=Z(),t=it(this._logger,this.prevPageVisitDataKeyName);if(t&&Se()){var n=xe().parse(t);return n.pageVisitTime=e-n.pageVisitStartTime,ot(this._logger,this.prevPageVisitDataKeyName),n}return null}return null}catch(r){return this._logger.warnToConsole("Stop page visit timer failed: "+Ne(r)),null}},rn);function rn(e,t){this.prevPageVisitDataKeyName="prevPageVisitData",this.pageVisitTimeTrackingHandler=t,this._logger=e}var an=function(e,t){this.pageVisitStartTime=Z(),this.pageName=e,this.pageUrl=t},on=(sn.prototype.populatePageViewPerformanceEvent=function(e){e.isValid=!1;var t,n,r,i,a=this.getPerformanceNavigationTiming(),o=this.getPerformanceTiming();(a||o)&&(o=a?(t=a.duration,n=ut(a.startTime,a.connectEnd),r=ut(a.requestStart,a.responseStart),i=ut(a.responseStart,a.responseEnd),ut(a.responseEnd,a.loadEventEnd)):(t=ut(o.navigationStart,o.loadEventEnd),n=ut(o.navigationStart,o.connectEnd),r=ut(o.requestStart,o.responseStart),i=ut(o.responseStart,o.responseEnd),ut(o.responseEnd,o.loadEventEnd)),0===t?this._logger.throwInternal(x.WARNING,F.ErrorPVCalc,"error calculating page view performance.",{total:t,network:n,request:r,response:i,dom:o}):this.shouldCollectDuration(t,n,r,i,o)?t<Math.floor(n)+Math.floor(r)+Math.floor(i)+Math.floor(o)?this._logger.throwInternal(x.WARNING,F.ClientPerformanceMathError,"client performance math error.",{total:t,network:n,request:r,response:i,dom:o}):(e.durationMs=t,e.perfTotal=e.duration=$e(t),e.networkConnect=$e(n),e.sentRequest=$e(r),e.receivedResponse=$e(i),e.domProcessing=$e(o),e.isValid=!0):this._logger.throwInternal(x.WARNING,F.InvalidDurationValue,"Invalid page load duration value. Browser perf data won't be sent.",{total:t,network:n,request:r,response:i,dom:o}))},sn.prototype.getPerformanceTiming=function(){return this.isPerformanceTimingSupported()?we().timing:null},sn.prototype.getPerformanceNavigationTiming=function(){return this.isPerformanceNavigationTimingSupported()?we().getEntriesByType("navigation")[0]:null},sn.prototype.isPerformanceNavigationTimingSupported=function(){var e=we();return e&&e.getEntriesByType&&0<e.getEntriesByType("navigation").length},sn.prototype.isPerformanceTimingSupported=function(){var e=we();return e&&e.timing},sn.prototype.isPerformanceTimingDataReady=function(){var e=we();return(e=e?e.timing:0)&&0<e.domainLookupStart&&0<e.navigationStart&&0<e.responseStart&&0<e.requestStart&&0<e.loadEventEnd&&0<e.responseEnd&&0<e.connectEnd&&0<e.domLoading},sn.prototype.shouldCollectDuration=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=["googlebot","adsbot-google","apis-google","mediapartners-google"],r=(Te()||{}).userAgent,i=!1;if(r)for(var a=0;a<n.length;a++)i=i||!!~r.toLowerCase().indexOf(n[a]);if(i)return!1;for(a=0;a<e.length;a++)if(e[a]<0||e[a]>=this.MAX_DURATION_ALLOWED)return!1;return!0},sn);function sn(e){this.MAX_DURATION_ALLOWED=36e5,e&&(this._logger=e.logger)}var ln="duration";function cn(e,t){e&&e.dispatchEvent&&t&&e.dispatchEvent(t)}var un,Fe=(un=Fe,__extends(gn,un),gn.getDefaultConfig=function(e){return(e=e||{}).sessionRenewalMs=18e5,e.sessionExpirationMs=864e5,e.disableExceptionTracking=Je(e.disableExceptionTracking),e.autoTrackPageVisitTime=Je(e.autoTrackPageVisitTime),e.overridePageViewDuration=Je(e.overridePageViewDuration),e.enableUnhandledPromiseRejectionTracking=Je(e.enableUnhandledPromiseRejectionTracking),(isNaN(e.samplingPercentage)||e.samplingPercentage<=0||100<=e.samplingPercentage)&&(e.samplingPercentage=100),e.isCookieUseDisabled=Je(e.isCookieUseDisabled),e.isStorageUseDisabled=Je(e.isStorageUseDisabled),e.isBrowserLinkTrackingEnabled=Je(e.isBrowserLinkTrackingEnabled),e.enableAutoRouteTracking=Je(e.enableAutoRouteTracking),e.namePrefix=e.namePrefix||"",e},gn.Version="2.6.0",gn);function gn(){var v,y,T,I,w,S=un.call(this)||this;return S.identifier=en,S.priority=180,S.autoRoutePVDelay=500,z(gn,S,function(m,h){var e=Ie(!0);I=e&&e.href||"",m.processTelemetry=function(a,o){Le(m.core,function(){return m.identifier+":processTelemetry"},function(){var e=!1,t=m._telemetryInitializers.length;o=m._getTelCtx(o);for(var n=0;n<t;++n){var r=m._telemetryInitializers[n];if(r)try{if(!1===r.call(null,a)){e=!0;break}}catch(i){o.diagLog().throwInternal(x.CRITICAL,F.TelemetryInitializerFailed,"One of telemetry initializers failed, telemetry item will not be sent: "+Q(i),{exception:Ne(i)},!0)}}e||m.processNext(a,o)},function(){return{item:a}},!a.sync)},m.trackEvent=function(e,t){try{var n=Yt.create(e,ft.dataType,ft.envelopeType,m.diagLog(),t);m.core.track(n)}catch(r){m.diagLog().throwInternal(x.WARNING,F.TrackTraceFailed,"trackTrace failed, trace will not be collected: "+Q(r),{exception:Ne(r)})}},m.startTrackEvent=function(e){try{v.start(e)}catch(t){m.diagLog().throwInternal(x.CRITICAL,F.StartTrackEventFailed,"startTrackEvent failed, event will not be collected: "+Q(t),{exception:Ne(t)})}},m.stopTrackEvent=function(e,t,n){try{v.stop(e,undefined,t)}catch(r){m.diagLog().throwInternal(x.CRITICAL,F.StopTrackEventFailed,"stopTrackEvent failed, event will not be collected: "+Q(r),{exception:Ne(r)})}},m.trackTrace=function(e,t){try{var n=Yt.create(e,qt.dataType,qt.envelopeType,m.diagLog(),t);m.core.track(n)}catch(r){m.diagLog().throwInternal(x.WARNING,F.TrackTraceFailed,"trackTrace failed, trace will not be collected: "+Q(r),{exception:Ne(r)})}},m.trackMetric=function(e,t){try{var n=Yt.create(e,At.dataType,At.envelopeType,m.diagLog(),t);m.core.track(n)}catch(r){m.diagLog().throwInternal(x.CRITICAL,F.TrackMetricFailed,"trackMetric failed, metric will not be collected: "+Q(r),{exception:Ne(r)})}},m.trackPageView=function(e,t){try{var n=e||{};m._pageViewManager.trackPageView(n,__assign({},n.properties,n.measurements,t)),m.config.autoTrackPageVisitTime&&m._pageVisitTimeManager.trackPreviousPageVisit(n.name,n.uri)}catch(r){m.diagLog().throwInternal(x.CRITICAL,F.TrackPVFailed,"trackPageView failed, page view will not be collected: "+Q(r),{exception:Ne(r)})}},m.sendPageViewInternal=function(e,t,n){var r=ye();r&&(e.refUri=e.refUri===undefined?r.referrer:e.refUri),n=Yt.create(e,zt.dataType,zt.envelopeType,m.diagLog(),t,n),m.core.track(n)},m.sendPageViewPerformanceInternal=function(e,t,n){n=Yt.create(e,Jt.dataType,Jt.envelopeType,m.diagLog(),t,n),m.core.track(n)},m.trackPageViewPerformance=function(e,t){try{m._pageViewPerformanceManager.populatePageViewPerformanceEvent(e),m.sendPageViewPerformanceInternal(e,t)}catch(n){m.diagLog().throwInternal(x.CRITICAL,F.TrackPVFailed,"trackPageViewPerformance failed, page view will not be collected: "+Q(n),{exception:Ne(n)})}},m.startTrackPage=function(e){try{var t;"string"!=typeof e&&(e=(t=ye())&&t.title||""),y.start(e)}catch(n){m.diagLog().throwInternal(x.CRITICAL,F.StartTrackFailed,"startTrackPage failed, page view may not be collected: "+Q(n),{exception:Ne(n)})}},m.stopTrackPage=function(e,t,n,r){try{var i,a;"string"!=typeof e&&(e=(i=ye())&&i.title||""),"string"!=typeof t&&(t=(a=Ie())&&a.href||""),y.stop(e,t,n,r),m.config.autoTrackPageVisitTime&&m._pageVisitTimeManager.trackPreviousPageVisit(e,t)}catch(o){m.diagLog().throwInternal(x.CRITICAL,F.StopTrackFailed,"stopTrackPage failed, page view will not be collected: "+Q(o),{exception:Ne(o)})}},m.sendExceptionInternal=function(e,t,n){e=new yt(m.diagLog(),e.exception||Error(Qe),e.properties,e.measurements,e.severityLevel,e.id).toInterface(),n=Yt.create(e,yt.dataType,yt.envelopeType,m.diagLog(),t,n),m.core.track(n)},m.trackException=function(e,t){try{m.sendExceptionInternal(e,t)}catch(n){m.diagLog().throwInternal(x.CRITICAL,F.TrackExceptionFailed,"trackException failed, exception will not be collected: "+Q(n),{exception:Ne(n)})}},m._onerror=function(e){try{var t,n={url:e&&e.url||(ye()||{}).URL,lineNumber:e.lineNumber,columnNumber:e.columnNumber,message:e.message},r=e.message;e.url,e.lineNumber,e.columnNumber,e.error||!K(r)||"Script error."!==r&&"Script error"!==r?(X(e.error)||(t="window.onerror@"+n.url+":"+e.lineNumber+":"+(e.columnNumber||0),e.error=Error(e.message),e.error.stack=t),m.trackException({exception:e.error,severityLevel:Kt.Error},n)):(a={message:"Script error: The browser's same-origin policy prevents us from getting the details of this exception. Consider using the 'crossorigin' attribute.",url:i=n.url,lineNumber:0,columnNumber:0,error:undefined},i=Yt.create(a,yt.dataType,yt.envelopeType,m.diagLog(),{url:i}),m.core.track(i))}catch(o){e=e.error?e.error.name+", "+e.error.message:"null",m.diagLog().throwInternal(x.CRITICAL,F.ExceptionWhileLoggingError,"_onError threw exception while logging error, error will not be collected: "+Q(o),{exception:Ne(o),errorString:e})}var i,a},m.addTelemetryInitializer=function(e){m._telemetryInitializers.push(e)},m.initialize=function(e,t,n,r){if(!m.isInitialized()){if(U(t))throw Error("Error initializing");h.initialize(e,t,n,r),m.setInitialized(!1);var i=m._getTelCtx(),a=m.identifier;m.config=i.getExtCfg(a),(t=gn.getDefaultConfig())!==undefined&&W(t,function(e,t){m.config[e]=i.getConfig(a,e,t),m.config[e]===undefined&&(m.config[e]=t)}),m.config.isStorageUseDisabled&&(et=!1),r={instrumentationKey:function(){return e.instrumentationKey},accountId:function(){return m.config.accountId||e.accountId},sessionRenewalMs:function(){return m.config.sessionRenewalMs||e.sessionRenewalMs},sessionExpirationMs:function(){return m.config.sessionExpirationMs||e.sessionExpirationMs},sampleRate:function(){return m.config.samplingPercentage||e.samplingPercentage},sdkExtension:function(){return m.config.sdkExtension||e.sdkExtension},isBrowserLinkTrackingEnabled:function(){return m.config.isBrowserLinkTrackingEnabled||e.isBrowserLinkTrackingEnabled},appId:function(){return m.config.appId||e.appId}},m._pageViewPerformanceManager=new on(m.core),m._pageViewManager=new tn(S,m.config.overridePageViewDuration,m.core,m._pageViewPerformanceManager),m._pageVisitTimeManager=new nn(m.diagLog(),function(e,t,n){m.trackMetric({name:"PageVisitTime",average:n,max:n,min:n,sampleCount:1},t={PageName:e,PageUrl:t})}),m._telemetryInitializers=m._telemetryInitializers||[],r.isBrowserLinkTrackingEnabled()||(p=["/browserLinkSignalR/","/__browserLink/"],m._telemetryInitializers.push(function(e){if(e.baseType===Ot.dataType){var t=e.baseData;if(t)for(var n=0;n<p.length;n++)if(t.target&&~t.target.indexOf(p[n]))return!1}return!0})),(v=new fn(m.diagLog(),"trackEvent")).action=function(e,t,n,r){(r=r||{})[ln]=n.toString(),m.trackEvent({name:e,properties:r})},(y=new fn(m.diagLog(),"trackPageView")).action=function(e,t,n,r,i){(r=U(r)?{}:r)[ln]=n.toString(),m.sendPageViewInternal({name:e,uri:t,properties:r,measurements:i},r)};var o,s,l,c,u,g=ve()?window:he(ne),t=typeof history===te&&history?history:he(ae),f=Ie(!0),d=S;!1===m.config.disableExceptionTracking&&!m.config.autoExceptionInstrumented&&g&&(o=g.onerror,g.onerror=function(e,t,n,r,i){var a=o&&o(e,t,n,r,i);return!0!==a&&d._onerror({message:e=e&&!K(e)?q(e.toString)?e.toString():JSON.stringify(e):e,url:t,lineNumber:n,columnNumber:r,error:i}),a},m.config.autoExceptionInstrumented=!0),!1===m.config.disableExceptionTracking&&!0===m.config.enableUnhandledPromiseRejectionTracking&&!m.config.autoUnhandledPromiseInstrumented&&g&&(s=g[r="onunhandledrejection"],g[r]=function(e){var t=s&&s.call(g,e);return!0!==t&&d._onerror({message:e.reason.toString(),error:e.reason instanceof Error?e.reason:Error(e.reason.toString()),url:f?f.href:"",lineNumber:0,columnNumber:0}),t},m.config.autoUnhandledPromiseInstrumented=!0),!0===m.config.enableAutoRouteTracking&&t&&q(t.pushState)&&q(t.replaceState)&&g&&"undefined"!=typeof Event&&(l=S,J(n,function(e){e.identifier===Qt&&(T=e)}),t.pushState=(u=t.pushState,function(){var e=u.apply(this,arguments);return cn(g,Ke(l.config.namePrefix+"pushState")),cn(g,Ke(l.config.namePrefix+"locationchange")),e}),t.replaceState=(c=t.replaceState,function(){var e=c.apply(this,arguments);return cn(g,Ke(l.config.namePrefix+"replaceState")),cn(g,Ke(l.config.namePrefix+"locationchange")),e}),g.addEventListener&&(g.addEventListener(l.config.namePrefix+"popstate",function(){cn(g,Ke(l.config.namePrefix+"locationchange"))}),g.addEventListener(l.config.namePrefix+"locationchange",function(){T&&T.context&&T.context.telemetryTrace&&(T.context.telemetryTrace.traceID=function(){for(var e,t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],n="",r=0;r<4;r++)n+=t[15&(e=je())]+t[e>>4&15]+t[e>>8&15]+t[e>>12&15]+t[e>>16&15]+t[e>>20&15]+t[e>>24&15]+t[e>>28&15];var i=t[8+(3&je())|0];return n.substr(0,8)+n.substr(9,4)+"4"+n.substr(13,3)+i+n.substr(16,3)+n.substr(19,12)}(),T.context.telemetryTrace.name=f&&f.pathname||"_unknown_"),w&&(I=w),w=f&&f.href||"",setTimeout((function(e){l.trackPageView({refUri:e,properties:{duration:0}})}).bind(S,I),l.autoRoutePVDelay)}))),m.setInitialized(!0)}var p}}),S}var fn=function(a,e){var o=this,s={};o.start=function(e){"undefined"!=typeof s[e]&&a.throwInternal(x.WARNING,F.StartCalledMoreThanOnce,"start was called more than once for this event without calling stop.",{name:e,key:e},!0),s[e]=+new Date},o.stop=function(e,t,n,r){var i=s[e];isNaN(i)?a.throwInternal(x.WARNING,F.StopCalledWithoutStart,"stop was called without a corresponding start.",{name:e,key:e},!0):(i=ut(i,+new Date),o.action(e,t,i,n,r)),delete s[e],s[e]=undefined}};e.ApplicationInsights=Fe,function(e,t,n){var r=Object.defineProperty;if(r)try{return r(e,t,n)}catch(i){}typeof n.value!==undefined&&(e[t]=n.value)}(e,"__esModule",{value:!0})};"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).Microsoft=e.Microsoft||{},e.Microsoft.ApplicationInsights=e.Microsoft.ApplicationInsights||{}));
//# sourceMappingURL=applicationinsights-analytics-js.min.js.map
{
"name": "@microsoft/applicationinsights-analytics-js",
"version": "2.5.11",
"description": "Microsoft Application Insights Javascript SDK apis",
"version": "2.6.0",
"description": "Microsoft Application Insights JavaScript SDK - Web Analytics",
"homepage": "https://github.com/microsoft/ApplicationInsights-JS#readme",
"author": "Microsoft Application Insights Team",
"main": "dist/applicationinsights-analytics-js.js",

@@ -14,31 +16,38 @@ "module": "dist-esm/applicationinsights-analytics-js.js",

"scripts": {
"build": "npm run build:esm && npm run build:browser",
"build": "npm run build:esm && npm run build:browser && npm run dtsgen",
"build:esm": "grunt ai",
"build:browser": "rollup -c",
"test": "grunt aitests",
"lint": "tslint -p tsconfig.json"
"lint": "tslint -p tsconfig.json",
"dtsgen": "api-extractor run --local && node ../../scripts/dtsgen.js \"Microsoft Application Insights JavaScript SDK - Web Analytics\""
},
"devDependencies": {
"@microsoft/ai-test-framework": "0.0.1",
"@microsoft/applicationinsights-rollup-plugin-uglify3-js": "1.0.0",
"@microsoft/applicationinsights-rollup-es3" : "1.1.3",
"@microsoft/applicationinsights-properties-js": "2.5.11",
"@microsoft/applicationinsights-properties-js": "2.6.0",
"@microsoft/api-extractor" : "^7.9.11",
"typescript": "2.5.3",
"globby": "^11.0.0",
"rollup-plugin-node-resolve": "^3.4.0",
"rollup-plugin-replace": "^2.1.0",
"rollup-plugin-uglify": "^6.0.0",
"grunt": "1.0.1",
"@rollup/plugin-commonjs": "^15.1.0",
"@rollup/plugin-node-resolve": "^9.0.0",
"@rollup/plugin-replace": "^2.3.3",
"rollup-plugin-cleanup": "3.2.1",
"rollup": "^2.32.0",
"grunt": "^1.3.0",
"grunt-contrib-qunit": "^3.1.0",
"grunt-contrib-uglify": "3.1.0",
"grunt-ts": "^6.0.0-beta.15",
"rollup": "^0.66.0",
"grunt-run": "^0.8.1",
"grunt-ts": "^6.0.0-beta.22",
"tslint": "^5.19.0",
"tslint-config-prettier": "^1.18.0"
"tslint-config-prettier": "^1.18.0",
"qunit": "^2.9.1",
"sinon": "^7.3.1"
},
"dependencies": {
"@microsoft/dynamicproto-js": "^1.1.0",
"@microsoft/dynamicproto-js": "^1.1.1",
"@microsoft/applicationinsights-shims" : "1.0.3",
"@microsoft/applicationinsights-core-js": "2.5.11",
"@microsoft/applicationinsights-common": "2.5.11"
"@microsoft/applicationinsights-core-js": "2.6.0",
"@microsoft/applicationinsights-common": "2.6.0"
},
"license": "MIT"
}

@@ -6,1 +6,2 @@ // Copyright (c) Microsoft Corporation. All rights reserved.

export { ApplicationInsights } from "./JavaScriptSDK/ApplicationInsights";
export { IAppInsightsInternal } from "./JavaScriptSDK/Telemetry/PageViewManager";

@@ -10,3 +10,2 @@ // Copyright (c) Microsoft Corporation. All rights reserved.

sessionExpirationMs: () => number;
cookieDomain: () => string;
sdkExtension: () => string;

@@ -13,0 +12,0 @@ isBrowserLinkTrackingEnabled: () => boolean;

@@ -7,7 +7,8 @@ /**

import {
IConfig, Util, PageViewPerformance, IAppInsights, PageView, RemoteDependencyData, Event as EventTelemetry, IEventTelemetry,
IConfig, PageViewPerformance, IAppInsights, PageView, RemoteDependencyData, Event as EventTelemetry, IEventTelemetry,
TelemetryItemCreator, Metric, Exception, SeverityLevel, Trace, IDependencyTelemetry,
IExceptionTelemetry, ITraceTelemetry, IMetricTelemetry, IAutoExceptionTelemetry,
IPageViewTelemetryInternal, IPageViewTelemetry, IPageViewPerformanceTelemetry, IPageViewPerformanceTelemetryInternal,
DateTimeUtils, IExceptionInternal, PropertiesPluginIdentifier, AnalyticsPluginIdentifier
dateTimeUtilsDuration, IExceptionInternal, PropertiesPluginIdentifier, AnalyticsPluginIdentifier, stringToBoolOrDefault, createDomEvent,
strNotSpecified, isCrossOriginError, utlDisableStorage
} from "@microsoft/applicationinsights-common";

@@ -17,5 +18,6 @@

IPlugin, IConfiguration, IAppInsightsCore,
BaseTelemetryPlugin, CoreUtils, ITelemetryItem, IProcessTelemetryContext, ITelemetryPluginChain,
BaseTelemetryPlugin, ITelemetryItem, IProcessTelemetryContext, ITelemetryPluginChain,
IDiagnosticLogger, LoggingSeverity, _InternalMessageId, ICustomProperties,
getWindow, getDocument, getHistory, getLocation, doPerf, objForEachKey
getWindow, getDocument, getHistory, getLocation, doPerf, objForEachKey,
isString, isFunction, isNullOrUndefined, arrForEach, generateW3CId, dumpObj, getExceptionName, isError
} from "@microsoft/applicationinsights-core-js";

@@ -26,2 +28,3 @@ import { PageViewManager, IAppInsightsInternal } from "./Telemetry/PageViewManager";

import { ITelemetryConfig } from "../JavaScriptSDK.Interfaces/ITelemetryConfig";
import dynamicProto from "@microsoft/dynamicproto-js";

@@ -41,4 +44,17 @@ // For types only

function _formatMessage(message: any) {
if (message && !isString(message)) {
// tslint:disable-next-line: prefer-conditional-expression
if (isFunction(message.toString)) {
message = message.toString();
} else {
message = JSON.stringify(message);
}
}
return message;
}
export class ApplicationInsights extends BaseTelemetryPlugin implements IAppInsights, IAppInsightsInternal {
public static Version = "2.5.11"; // Not currently used anywhere
public static Version = "2.6.0"; // Not currently used anywhere

@@ -53,7 +69,7 @@ public static getDefaultConfig(config?: IConfig): IConfig {

config.sessionExpirationMs = 24 * 60 * 60 * 1000;
config.disableExceptionTracking = Util.stringToBoolOrDefault(config.disableExceptionTracking);
config.autoTrackPageVisitTime = Util.stringToBoolOrDefault(config.autoTrackPageVisitTime);
config.overridePageViewDuration = Util.stringToBoolOrDefault(config.overridePageViewDuration);
config.enableUnhandledPromiseRejectionTracking = Util.stringToBoolOrDefault(config.enableUnhandledPromiseRejectionTracking);
config.disableExceptionTracking = stringToBoolOrDefault(config.disableExceptionTracking);
config.autoTrackPageVisitTime = stringToBoolOrDefault(config.autoTrackPageVisitTime);
config.overridePageViewDuration = stringToBoolOrDefault(config.overridePageViewDuration);
config.enableUnhandledPromiseRejectionTracking = stringToBoolOrDefault(config.enableUnhandledPromiseRejectionTracking);
if (isNaN(config.samplingPercentage) || config.samplingPercentage <= 0 || config.samplingPercentage >= 100) {

@@ -63,6 +79,6 @@ config.samplingPercentage = 100;

config.isCookieUseDisabled = Util.stringToBoolOrDefault(config.isCookieUseDisabled);
config.isStorageUseDisabled = Util.stringToBoolOrDefault(config.isStorageUseDisabled);
config.isBrowserLinkTrackingEnabled = Util.stringToBoolOrDefault(config.isBrowserLinkTrackingEnabled);
config.enableAutoRouteTracking = Util.stringToBoolOrDefault(config.enableAutoRouteTracking);
config.isCookieUseDisabled = stringToBoolOrDefault(config.isCookieUseDisabled);
config.isStorageUseDisabled = stringToBoolOrDefault(config.isStorageUseDisabled);
config.isBrowserLinkTrackingEnabled = stringToBoolOrDefault(config.isBrowserLinkTrackingEnabled);
config.enableAutoRouteTracking = stringToBoolOrDefault(config.enableAutoRouteTracking);
config.namePrefix = config.namePrefix || "";

@@ -84,69 +100,646 @@

private _globalconfig: IConfiguration;
private _eventTracking: Timing;
private _pageTracking: Timing;
private _properties: properties.PropertiesPlugin;
constructor() {
super();
let _eventTracking: Timing;
let _pageTracking: Timing;
let _properties: properties.PropertiesPlugin;
// Counts number of trackAjax invocations.
// By default we only monitor X ajax call per view to avoid too much load.
// Default value is set in config.
// This counter keeps increasing even after the limit is reached.
let _trackAjaxAttempts: number = 0;
// array with max length of 2 that store current url and previous url for SPA page route change trackPageview use.
let _prevUri: string; // Assigned in the constructor
let _currUri: string;
// Counts number of trackAjax invokations.
// By default we only monitor X ajax call per view to avoid too much load.
// Default value is set in config.
// This counter keeps increasing even after the limit is reached.
private _trackAjaxAttempts: number = 0;
dynamicProto(ApplicationInsights, this, (_self, _base) => {
let location = getLocation(true);
_prevUri = location && location.href || "";
// array with max length of 2 that store current url and previous url for SPA page route change trackPageview use.
private _prevUri: string; // Assigned in the constructor
private _currUri: string;
_self.processTelemetry = (env: ITelemetryItem, itemCtx?: IProcessTelemetryContext) => {
doPerf(_self.core, () => _self.identifier + ":processTelemetry", () => {
let doNotSendItem = false;
const telemetryInitializersCount = _self._telemetryInitializers.length;
itemCtx = _self._getTelCtx(itemCtx);
for (let i = 0; i < telemetryInitializersCount; ++i) {
const telemetryInitializer = _self._telemetryInitializers[i];
if (telemetryInitializer) {
try {
if (telemetryInitializer.apply(null, [env]) === false) {
doNotSendItem = true;
break;
}
} catch (e) {
// log error but dont stop executing rest of the telemetry initializers
// doNotSendItem = true;
itemCtx.diagLog().throwInternal(
LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryInitializerFailed, "One of telemetry initializers failed, telemetry item will not be sent: " + getExceptionName(e),
{ exception: dumpObj(e) }, true);
}
}
}
if (!doNotSendItem) {
_self.processNext(env, itemCtx);
}
}, () => ({ item: env }), !((env as any).sync));
};
_self.trackEvent = (event: IEventTelemetry, customProperties?: ICustomProperties): void => {
try {
const telemetryItem = TelemetryItemCreator.create<IEventTelemetry>(
event,
EventTelemetry.dataType,
EventTelemetry.envelopeType,
_self.diagLog(),
customProperties
);
constructor() {
super();
let location = getLocation();
this._prevUri = location && location.href || "";
}
_self.core.track(telemetryItem);
} catch (e) {
_self.diagLog().throwInternal(LoggingSeverity.WARNING,
_InternalMessageId.TrackTraceFailed,
"trackTrace failed, trace will not be collected: " + getExceptionName(e),
{ exception: dumpObj(e) });
}
};
public processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext) {
doPerf(this.core, () => this.identifier + ":processTelemetry", () => {
let doNotSendItem = false;
const telemetryInitializersCount = this._telemetryInitializers.length;
itemCtx = this._getTelCtx(itemCtx);
for (let i = 0; i < telemetryInitializersCount; ++i) {
const telemetryInitializer = this._telemetryInitializers[i];
if (telemetryInitializer) {
try {
if (telemetryInitializer.apply(null, [env]) === false) {
doNotSendItem = true;
break;
/**
* Start timing an extended event. Call `stopTrackEvent` to log the event when it ends.
* @param name A string that identifies this event uniquely within the document.
*/
_self.startTrackEvent = (name: string) => {
try {
_eventTracking.start(name);
} catch (e) {
_self.diagLog().throwInternal(LoggingSeverity.CRITICAL,
_InternalMessageId.StartTrackEventFailed,
"startTrackEvent failed, event will not be collected: " + getExceptionName(e),
{ exception: dumpObj(e) });
}
};
/**
* Log an extended event that you started timing with `startTrackEvent`.
* @param name The string you used to identify this event in `startTrackEvent`.
* @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
* @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.
*/
_self.stopTrackEvent = (name: string, properties?: { [key: string]: string }, measurements?: { [key: string]: number }) => {
try {
_eventTracking.stop(name, undefined, properties); // Todo: Fix to pass measurements once type is updated
} catch (e) {
_self.diagLog().throwInternal(LoggingSeverity.CRITICAL,
_InternalMessageId.StopTrackEventFailed,
"stopTrackEvent failed, event will not be collected: " + getExceptionName(e),
{ exception: dumpObj(e) });
}
};
/**
* @description Log a diagnostic message
* @param {ITraceTelemetry} trace
* @param ICustomProperties.
* @memberof ApplicationInsights
*/
_self.trackTrace = (trace: ITraceTelemetry, customProperties?: ICustomProperties): void => {
try {
const telemetryItem = TelemetryItemCreator.create<ITraceTelemetry>(
trace,
Trace.dataType,
Trace.envelopeType,
_self.diagLog(),
customProperties);
_self.core.track(telemetryItem);
} catch (e) {
_self.diagLog().throwInternal(LoggingSeverity.WARNING,
_InternalMessageId.TrackTraceFailed,
"trackTrace failed, trace will not be collected: " + getExceptionName(e),
{ exception: dumpObj(e) });
}
};
/**
* @description Log a numeric value that is not associated with a specific event. Typically
* used to send regular reports of performance indicators. To send single measurement, just
* use the name and average fields of {@link IMetricTelemetry}. If you take measurements
* frequently, you can reduce the telemetry bandwidth by aggregating multiple measurements
* and sending the resulting average at intervals
* @param {IMetricTelemetry} metric input object argument. Only name and average are mandatory.
* @param {{[key: string]: any}} customProperties additional data used to filter metrics in the
* portal. Defaults to empty.
* @memberof ApplicationInsights
*/
_self.trackMetric = (metric: IMetricTelemetry, customProperties?: ICustomProperties): void => {
try {
const telemetryItem = TelemetryItemCreator.create<IMetricTelemetry>(
metric,
Metric.dataType,
Metric.envelopeType,
_self.diagLog(),
customProperties
);
_self.core.track(telemetryItem);
} catch (e) {
_self.diagLog().throwInternal(LoggingSeverity.CRITICAL,
_InternalMessageId.TrackMetricFailed,
"trackMetric failed, metric will not be collected: " + getExceptionName(e),
{ exception: dumpObj(e) });
}
};
/**
* Logs that a page or other item was viewed.
* @param IPageViewTelemetry The string you used as the name in startTrackPage. Defaults to the document title.
* @param customProperties Additional data used to filter events and metrics. Defaults to empty.
* If a user wants to provide duration for pageLoad, it'll have to be in pageView.properties.duration
*/
_self.trackPageView = (pageView?: IPageViewTelemetry, customProperties?: ICustomProperties) => {
try {
const inPv = pageView || {};
_self._pageViewManager.trackPageView(inPv, {...inPv.properties, ...inPv.measurements, ...customProperties});
if (_self.config.autoTrackPageVisitTime) {
_self._pageVisitTimeManager.trackPreviousPageVisit(inPv.name, inPv.uri);
}
} catch (e) {
_self.diagLog().throwInternal(
LoggingSeverity.CRITICAL,
_InternalMessageId.TrackPVFailed,
"trackPageView failed, page view will not be collected: " + getExceptionName(e),
{ exception: dumpObj(e) });
}
};
/**
* Create a page view telemetry item and send it to the SDK pipeline through the core.track API
* @param pageView Page view item to be sent
* @param properties Custom properties (Part C) that a user can add to the telemetry item
* @param systemProperties System level properties (Part A) that a user can add to the telemetry item
*/
_self.sendPageViewInternal = (pageView: IPageViewTelemetryInternal, properties?: { [key: string]: any }, systemProperties?: { [key: string]: any }) => {
let doc = getDocument();
if (doc) {
pageView.refUri = pageView.refUri === undefined ? doc.referrer : pageView.refUri;
}
const telemetryItem = TelemetryItemCreator.create<IPageViewTelemetryInternal>(
pageView,
PageView.dataType,
PageView.envelopeType,
_self.diagLog(),
properties,
systemProperties);
_self.core.track(telemetryItem);
// reset ajaxes counter
_trackAjaxAttempts = 0;
};
/**
* @ignore INTERNAL ONLY
* @param pageViewPerformance
* @param properties
*/
_self.sendPageViewPerformanceInternal = (pageViewPerformance: IPageViewPerformanceTelemetryInternal, properties?: { [key: string]: any }, systemProperties?: { [key: string]: any }) => {
const telemetryItem = TelemetryItemCreator.create<IPageViewPerformanceTelemetryInternal>(
pageViewPerformance,
PageViewPerformance.dataType,
PageViewPerformance.envelopeType,
_self.diagLog(),
properties,
systemProperties);
_self.core.track(telemetryItem);
};
/**
* Send browser performance metrics.
* @param pageViewPerformance
* @param customProperties
*/
_self.trackPageViewPerformance = (pageViewPerformance: IPageViewPerformanceTelemetry, customProperties?: ICustomProperties): void => {
try {
_self._pageViewPerformanceManager.populatePageViewPerformanceEvent(pageViewPerformance);
_self.sendPageViewPerformanceInternal(pageViewPerformance, customProperties);
} catch (e) {
_self.diagLog().throwInternal(
LoggingSeverity.CRITICAL,
_InternalMessageId.TrackPVFailed,
"trackPageViewPerformance failed, page view will not be collected: " + getExceptionName(e),
{ exception: dumpObj(e) });
}
};
/**
* Starts the timer for tracking a page load time. Use this instead of `trackPageView` if you want to control when the page view timer starts and stops,
* but don't want to calculate the duration yourself. This method doesn't send any telemetry. Call `stopTrackPage` to log the end of the page view
* and send the event.
* @param name A string that idenfities this item, unique within this HTML document. Defaults to the document title.
*/
_self.startTrackPage = (name?: string) => {
try {
if (typeof name !== "string") {
let doc = getDocument();
name = doc && doc.title || "";
}
_pageTracking.start(name);
} catch (e) {
_self.diagLog().throwInternal(
LoggingSeverity.CRITICAL,
_InternalMessageId.StartTrackFailed,
"startTrackPage failed, page view may not be collected: " + getExceptionName(e),
{ exception: dumpObj(e) });
}
};
/**
* Stops the timer that was started by calling `startTrackPage` and sends the pageview load time telemetry with the specified properties and measurements.
* The duration of the page view will be the time between calling `startTrackPage` and `stopTrackPage`.
* @param name The string you used as the name in startTrackPage. Defaults to the document title.
* @param url String - a relative or absolute URL that identifies the page or other item. Defaults to the window location.
* @param properties map[string, string] - additional data used to filter pages and metrics in the portal. Defaults to empty.
* @param measurements map[string, number] - metrics associated with this page, displayed in Metrics Explorer on the portal. Defaults to empty.
*/
_self.stopTrackPage = (name?: string, url?: string, properties?: { [key: string]: string }, measurement?: { [key: string]: number }) => {
try {
if (typeof name !== "string") {
let doc = getDocument();
name = doc && doc.title || "";
}
if (typeof url !== "string") {
let loc = getLocation();
url = loc && loc.href || "";
}
_pageTracking.stop(name, url, properties, measurement);
if (_self.config.autoTrackPageVisitTime) {
_self._pageVisitTimeManager.trackPreviousPageVisit(name, url);
}
} catch (e) {
_self.diagLog().throwInternal(
LoggingSeverity.CRITICAL,
_InternalMessageId.StopTrackFailed,
"stopTrackPage failed, page view will not be collected: " + getExceptionName(e),
{ exception: dumpObj(e) });
}
};
/**
* @ignore INTERNAL ONLY
* @param exception
* @param properties
* @param systemProperties
*/
_self.sendExceptionInternal = (exception: IExceptionTelemetry, customProperties?: { [key: string]: any }, systemProperties?: { [key: string]: any }) => {
const exceptionPartB = new Exception(
_self.diagLog(),
exception.exception || new Error(strNotSpecified),
exception.properties,
exception.measurements,
exception.severityLevel,
exception.id
).toInterface();
const telemetryItem: ITelemetryItem = TelemetryItemCreator.create<IExceptionInternal>(
exceptionPartB,
Exception.dataType,
Exception.envelopeType,
_self.diagLog(),
customProperties,
systemProperties
);
_self.core.track(telemetryItem);
};
/**
* Log an exception you have caught.
*
* @param {IExceptionTelemetry} exception Object which contains exception to be sent
* @param {{[key: string]: any}} customProperties Additional data used to filter pages and metrics in the portal. Defaults to empty.
*
* Any property of type double will be considered a measurement, and will be treated by Application Insights as a metric.
* @memberof ApplicationInsights
*/
_self.trackException = (exception: IExceptionTelemetry, customProperties?: ICustomProperties): void => {
try {
_self.sendExceptionInternal(exception, customProperties);
} catch (e) {
_self.diagLog().throwInternal(
LoggingSeverity.CRITICAL,
_InternalMessageId.TrackExceptionFailed,
"trackException failed, exception will not be collected: " + getExceptionName(e),
{ exception: dumpObj(e) });
}
};
/**
* @description Custom error handler for Application Insights Analytics
* @param {IAutoExceptionTelemetry} exception
* @memberof ApplicationInsights
*/
_self._onerror = (exception: IAutoExceptionTelemetry): void => {
try {
const properties = {
url: (exception && exception.url) || (getDocument()||{} as any).URL,
lineNumber: exception.lineNumber,
columnNumber: exception.columnNumber,
message: exception.message
};
if (isCrossOriginError(exception.message, exception.url, exception.lineNumber, exception.columnNumber, exception.error)) {
_sendCORSException(properties.url);
} else {
if (!isError(exception.error)) {
const stack = "window.onerror@" + properties.url + ":" + exception.lineNumber + ":" + (exception.columnNumber || 0);
exception.error = new Error(exception.message);
exception.error.stack = stack;
}
} catch (e) {
// log error but dont stop executing rest of the telemetry initializers
// doNotSendItem = true;
itemCtx.diagLog().throwInternal(
LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryInitializerFailed, "One of telemetry initializers failed, telemetry item will not be sent: " + Util.getExceptionName(e),
{ exception: Util.dump(e) }, true);
_self.trackException({ exception: exception.error, severityLevel: SeverityLevel.Error }, properties);
}
} catch (e) {
const errorString = exception.error ?
(exception.error.name + ", " + exception.error.message)
: "null";
_self.diagLog().throwInternal(
LoggingSeverity.CRITICAL,
_InternalMessageId.ExceptionWhileLoggingError,
"_onError threw exception while logging error, error will not be collected: "
+ getExceptionName(e),
{ exception: dumpObj(e), errorString }
);
}
};
_self.addTelemetryInitializer = (telemetryInitializer: (item: ITelemetryItem) => boolean | void) => {
_self._telemetryInitializers.push(telemetryInitializer);
};
_self.initialize = (config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?:ITelemetryPluginChain) => {
if (_self.isInitialized()) {
return;
}
if (isNullOrUndefined(core)) {
throw Error("Error initializing");
}
_base.initialize(config, core, extensions, pluginChain);
_self.setInitialized(false); // resetting the initialized state, just in case the following fails
let ctx = _self._getTelCtx();
let identifier = _self.identifier;
_self.config = ctx.getExtCfg<IConfig>(identifier);
// load default values if specified
const defaults: IConfig = ApplicationInsights.getDefaultConfig();
if (defaults !== undefined) {
objForEachKey(defaults, (field, value) => {
// for each unspecified field, set the default value
_self.config[field] = ctx.getConfig(identifier, field, value);
if (_self.config[field] === undefined) {
_self.config[field] = value;
}
});
}
// Todo: move this out of static state
if (_self.config.isStorageUseDisabled) {
utlDisableStorage();
}
const configGetters: ITelemetryConfig = {
instrumentationKey: () => config.instrumentationKey,
accountId: () => _self.config.accountId || config.accountId,
sessionRenewalMs: () => _self.config.sessionRenewalMs || config.sessionRenewalMs,
sessionExpirationMs: () => _self.config.sessionExpirationMs || config.sessionExpirationMs,
sampleRate: () => _self.config.samplingPercentage || config.samplingPercentage,
sdkExtension: () => _self.config.sdkExtension || config.sdkExtension,
isBrowserLinkTrackingEnabled: () => _self.config.isBrowserLinkTrackingEnabled || config.isBrowserLinkTrackingEnabled,
appId: () => _self.config.appId || config.appId
}
_self._pageViewPerformanceManager = new PageViewPerformanceManager(_self.core);
_self._pageViewManager = new PageViewManager(this, _self.config.overridePageViewDuration, _self.core, _self._pageViewPerformanceManager);
_self._pageVisitTimeManager = new PageVisitTimeManager(_self.diagLog(), (pageName, pageUrl, pageVisitTime) => trackPageVisitTime(pageName, pageUrl, pageVisitTime))
_self._telemetryInitializers = _self._telemetryInitializers || [];
_addDefaultTelemetryInitializers(configGetters);
_eventTracking = new Timing(_self.diagLog(), "trackEvent");
_eventTracking.action =
(name?: string, url?: string, duration?: number, properties?: { [key: string]: string }) => {
if (!properties) {
properties = {};
}
properties[durationProperty] = duration.toString();
_self.trackEvent({ name, properties } as IEventTelemetry);
}
// initialize page view timing
_pageTracking = new Timing(_self.diagLog(), "trackPageView");
_pageTracking.action = (name, url, duration, properties, measurements) => {
// duration must be a custom property in order for the collector to extract it
if (isNullOrUndefined(properties)) {
properties = {};
}
properties[durationProperty] = duration.toString();
const pageViewItem: IPageViewTelemetry = {
name,
uri: url,
properties,
measurements
};
_self.sendPageViewInternal(pageViewItem, properties);
}
let _window = getWindow();
let _history = getHistory();
let _location = getLocation(true);
const instance: IAppInsights = this;
if (_self.config.disableExceptionTracking === false &&
!_self.config.autoExceptionInstrumented && _window) {
// We want to enable exception auto collection and it has not been done so yet
const onerror = "onerror";
const originalOnError = _window[onerror];
_window.onerror = (message, url, lineNumber, columnNumber, error) => {
const handled = originalOnError && (originalOnError(message, url, lineNumber, columnNumber, error) as any);
if (handled !== true) { // handled could be typeof function
instance._onerror({
message: _formatMessage(message),
url,
lineNumber,
columnNumber,
error
});
}
return handled;
}
_self.config.autoExceptionInstrumented = true;
}
if (_self.config.disableExceptionTracking === false &&
_self.config.enableUnhandledPromiseRejectionTracking === true &&
!_self.config.autoUnhandledPromiseInstrumented && _window) {
// We want to enable exception auto collection and it has not been done so yet
const onunhandledrejection = "onunhandledrejection";
const originalOnUnhandledRejection = _window[onunhandledrejection];
_window[onunhandledrejection] = (error: PromiseRejectionEvent) => {
const handled = originalOnUnhandledRejection && (originalOnUnhandledRejection.call(_window, error) as any);
if (handled !== true) { // handled could be typeof function
instance._onerror({
message: error.reason.toString(),
error: error.reason instanceof Error ? error.reason : new Error(error.reason.toString()),
url: _location ? _location.href : "",
lineNumber: 0,
columnNumber: 0
});
}
return handled;
}
_self.config.autoUnhandledPromiseInstrumented = true;
}
/**
* Create a custom "locationchange" event which is triggered each time the history object is changed
*/
if (_self.config.enableAutoRouteTracking === true
&& _history && isFunction(_history.pushState) && isFunction(_history.replaceState)
&& _window
&& typeof Event !== "undefined") {
const _self = this;
// Find the properties plugin
arrForEach(extensions, extension => {
if (extension.identifier === PropertiesPluginIdentifier) {
_properties = extension as properties.PropertiesPlugin;
}
});
_history.pushState = ( f => function pushState() {
const ret = f.apply(this, arguments);
_dispatchEvent(_window, createDomEvent(_self.config.namePrefix + "pushState"));
_dispatchEvent(_window, createDomEvent(_self.config.namePrefix + "locationchange"));
return ret;
})(_history.pushState);
_history.replaceState = ( f => function replaceState(){
const ret = f.apply(this, arguments);
_dispatchEvent(_window, createDomEvent(_self.config.namePrefix + "replaceState"));
_dispatchEvent(_window, createDomEvent(_self.config.namePrefix + "locationchange"));
return ret;
})(_history.replaceState);
if (_window.addEventListener) {
_window.addEventListener(_self.config.namePrefix + "popstate",()=>{
_dispatchEvent(_window, createDomEvent(_self.config.namePrefix + "locationchange"));
});
_window.addEventListener(_self.config.namePrefix + "locationchange", () => {
if (_properties && _properties.context && _properties.context.telemetryTrace) {
_properties.context.telemetryTrace.traceID = generateW3CId();
_properties.context.telemetryTrace.name = _location && _location.pathname || "_unknown_";
}
if (_currUri) {
_prevUri = _currUri;
_currUri = _location && _location.href || "";
} else {
_currUri = _location && _location.href || "";
}
setTimeout(((uri: string) => {
// todo: override start time so that it is not affected by autoRoutePVDelay
_self.trackPageView({ refUri: uri, properties: { duration: 0 } }); // SPA route change loading durations are undefined, so send 0
}).bind(this, _prevUri), _self.autoRoutePVDelay);
});
}
}
_self.setInitialized(true);
};
/**
* Log a page visit time
* @param pageName Name of page
* @param pageVisitDuration Duration of visit to the page in milleseconds
*/
function trackPageVisitTime(pageName: string, pageUrl: string, pageVisitTime: number) {
const properties = { PageName: pageName, PageUrl: pageUrl };
_self.trackMetric({
name: "PageVisitTime",
average: pageVisitTime,
max: pageVisitTime,
min: pageVisitTime,
sampleCount: 1
}, properties);
}
if (!doNotSendItem) {
this.processNext(env, itemCtx);
function _addDefaultTelemetryInitializers(configGetters: ITelemetryConfig) {
if (!configGetters.isBrowserLinkTrackingEnabled()) {
const browserLinkPaths = ['/browserLinkSignalR/', '/__browserLink/'];
const dropBrowserLinkRequests = (envelope: ITelemetryItem) => {
if (envelope.baseType === RemoteDependencyData.dataType) {
const remoteData = envelope.baseData as IDependencyTelemetry;
if (remoteData) {
for (let i = 0; i < browserLinkPaths.length; i++) {
if (remoteData.target && remoteData.target.indexOf(browserLinkPaths[i]) >= 0) {
return false;
}
}
}
}
return true;
}
_addTelemetryInitializer(dropBrowserLinkRequests)
}
}
}, () => ({ item: env }), !((env as any).sync));
function _addTelemetryInitializer(telemetryInitializer: (envelope: ITelemetryItem) => boolean | void) {
_self._telemetryInitializers.push(telemetryInitializer);
}
function _sendCORSException(url: string) {
const exception: IAutoExceptionTelemetry = {
message: "Script error: The browser's same-origin policy prevents us from getting the details of this exception. Consider using the 'crossorigin' attribute.",
url,
lineNumber: 0,
columnNumber: 0,
error: undefined
};
const telemetryItem: ITelemetryItem = TelemetryItemCreator.create<IAutoExceptionTelemetry>(
exception,
Exception.dataType,
Exception.envelopeType,
_self.diagLog(),
{ url }
);
_self.core.track(telemetryItem);
}
});
}
public processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext) {
// @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
}
public trackEvent(event: IEventTelemetry, customProperties?: ICustomProperties): void {
try {
const telemetryItem = TelemetryItemCreator.create<IEventTelemetry>(
event,
EventTelemetry.dataType,
EventTelemetry.envelopeType,
this.diagLog(),
customProperties
);
this.core.track(telemetryItem);
} catch (e) {
this.diagLog().throwInternal(LoggingSeverity.WARNING,
_InternalMessageId.TrackTraceFailed,
"trackTrace failed, trace will not be collected: " + Util.getExceptionName(e),
{ exception: Util.dump(e) });
}
// @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
}

@@ -159,10 +752,3 @@

public startTrackEvent(name: string) {
try {
this._eventTracking.start(name);
} catch (e) {
this.diagLog().throwInternal(LoggingSeverity.CRITICAL,
_InternalMessageId.StartTrackEventFailed,
"startTrackEvent failed, event will not be collected: " + Util.getExceptionName(e),
{ exception: Util.dump(e) });
}
// @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
}

@@ -177,10 +763,3 @@

public stopTrackEvent(name: string, properties?: { [key: string]: string }, measurements?: { [key: string]: number }) {
try {
this._eventTracking.stop(name, undefined, properties); // Todo: Fix to pass measurements once type is updated
} catch (e) {
this.diagLog().throwInternal(LoggingSeverity.CRITICAL,
_InternalMessageId.StopTrackEventFailed,
"stopTrackEvent failed, event will not be collected: " + Util.getExceptionName(e),
{ exception: Util.dump(e) });
}
// @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
}

@@ -195,17 +774,3 @@

public trackTrace(trace: ITraceTelemetry, customProperties?: ICustomProperties): void {
try {
const telemetryItem = TelemetryItemCreator.create<ITraceTelemetry>(
trace,
Trace.dataType,
Trace.envelopeType,
this.diagLog(),
customProperties);
this.core.track(telemetryItem);
} catch (e) {
this.diagLog().throwInternal(LoggingSeverity.WARNING,
_InternalMessageId.TrackTraceFailed,
"trackTrace failed, trace will not be collected: " + Util.getExceptionName(e),
{ exception: Util.dump(e) });
}
// @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
}

@@ -225,18 +790,3 @@

public trackMetric(metric: IMetricTelemetry, customProperties?: ICustomProperties): void {
try {
const telemetryItem = TelemetryItemCreator.create<IMetricTelemetry>(
metric,
Metric.dataType,
Metric.envelopeType,
this.diagLog(),
customProperties
);
this.core.track(telemetryItem);
} catch (e) {
this.diagLog().throwInternal(LoggingSeverity.CRITICAL,
_InternalMessageId.TrackMetricFailed,
"trackMetric failed, metric will not be collected: " + Util.getExceptionName(e),
{ exception: Util.dump(e) });
}
// @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
}

@@ -251,16 +801,3 @@

public trackPageView(pageView?: IPageViewTelemetry, customProperties?: ICustomProperties) {
try {
const inPv = pageView || {};
this._pageViewManager.trackPageView(inPv, {...inPv.properties, ...inPv.measurements, ...customProperties});
if (this.config.autoTrackPageVisitTime) {
this._pageVisitTimeManager.trackPreviousPageVisit(inPv.name, inPv.uri);
}
} catch (e) {
this.diagLog().throwInternal(
LoggingSeverity.CRITICAL,
_InternalMessageId.TrackPVFailed,
"trackPageView failed, page view will not be collected: " + Util.getExceptionName(e),
{ exception: Util.dump(e) });
}
// @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
}

@@ -275,19 +812,3 @@

public sendPageViewInternal(pageView: IPageViewTelemetryInternal, properties?: { [key: string]: any }, systemProperties?: { [key: string]: any }) {
let doc = getDocument();
if (doc) {
pageView.refUri = pageView.refUri === undefined ? doc.referrer : pageView.refUri;
}
const telemetryItem = TelemetryItemCreator.create<IPageViewTelemetryInternal>(
pageView,
PageView.dataType,
PageView.envelopeType,
this.diagLog(),
properties,
systemProperties);
this.core.track(telemetryItem);
// reset ajaxes counter
this._trackAjaxAttempts = 0;
// @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
}

@@ -301,11 +822,3 @@

public sendPageViewPerformanceInternal(pageViewPerformance: IPageViewPerformanceTelemetryInternal, properties?: { [key: string]: any }, systemProperties?: { [key: string]: any }) {
const telemetryItem = TelemetryItemCreator.create<IPageViewPerformanceTelemetryInternal>(
pageViewPerformance,
PageViewPerformance.dataType,
PageViewPerformance.envelopeType,
this.diagLog(),
properties,
systemProperties);
this.core.track(telemetryItem);
// @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
}

@@ -319,12 +832,3 @@

public trackPageViewPerformance(pageViewPerformance: IPageViewPerformanceTelemetry, customProperties?: ICustomProperties): void {
try {
this._pageViewPerformanceManager.populatePageViewPerformanceEvent(pageViewPerformance);
this.sendPageViewPerformanceInternal(pageViewPerformance, customProperties);
} catch (e) {
this.diagLog().throwInternal(
LoggingSeverity.CRITICAL,
_InternalMessageId.TrackPVFailed,
"trackPageViewPerformance failed, page view will not be collected: " + Util.getExceptionName(e),
{ exception: Util.dump(e) });
}
// @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
}

@@ -339,16 +843,3 @@

public startTrackPage(name?: string) {
try {
if (typeof name !== "string") {
let doc = getDocument();
name = doc && doc.title || "";
}
this._pageTracking.start(name);
} catch (e) {
this.diagLog().throwInternal(
LoggingSeverity.CRITICAL,
_InternalMessageId.StartTrackFailed,
"startTrackPage failed, page view may not be collected: " + Util.getExceptionName(e),
{ exception: Util.dump(e) });
}
// @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
}

@@ -366,25 +857,3 @@

public stopTrackPage(name?: string, url?: string, properties?: { [key: string]: string }, measurement?: { [key: string]: number }) {
try {
if (typeof name !== "string") {
let doc = getDocument();
name = doc && doc.title || "";
}
if (typeof url !== "string") {
let loc = getLocation();
url = loc && loc.href || "";
}
this._pageTracking.stop(name, url, properties, measurement);
if (this.config.autoTrackPageVisitTime) {
this._pageVisitTimeManager.trackPreviousPageVisit(name, url);
}
} catch (e) {
this.diagLog().throwInternal(
LoggingSeverity.CRITICAL,
_InternalMessageId.StopTrackFailed,
"stopTrackPage failed, page view will not be collected: " + Util.getExceptionName(e),
{ exception: Util.dump(e) });
}
// @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
}

@@ -399,20 +868,3 @@

public sendExceptionInternal(exception: IExceptionTelemetry, customProperties?: { [key: string]: any }, systemProperties?: { [key: string]: any }) {
const exceptionPartB = new Exception(
this.diagLog(),
exception.exception || new Error(Util.NotSpecified),
exception.properties,
exception.measurements,
exception.severityLevel,
exception.id
).toInterface();
const telemetryItem: ITelemetryItem = TelemetryItemCreator.create<IExceptionInternal>(
exceptionPartB,
Exception.dataType,
Exception.envelopeType,
this.diagLog(),
customProperties,
systemProperties
);
this.core.track(telemetryItem);
// @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
}

@@ -430,11 +882,3 @@

public trackException(exception: IExceptionTelemetry, customProperties?: ICustomProperties): void {
try {
this.sendExceptionInternal(exception, customProperties);
} catch (e) {
this.diagLog().throwInternal(
LoggingSeverity.CRITICAL,
_InternalMessageId.TrackExceptionFailed,
"trackException failed, exception will not be collected: " + Util.getExceptionName(e),
{ exception: Util.dump(e) });
}
// @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
}

@@ -448,304 +892,12 @@

public _onerror(exception: IAutoExceptionTelemetry): void {
try {
const properties = {
url: (exception && exception.url) || (getDocument()||{} as any).URL,
lineNumber: exception.lineNumber,
columnNumber: exception.columnNumber,
message: exception.message
};
if (Util.isCrossOriginError(exception.message, exception.url, exception.lineNumber, exception.columnNumber, exception.error)) {
this._sendCORSException(properties.url);
} else {
if (!Util.isError(exception.error)) {
const stack = "window.onerror@" + properties.url + ":" + exception.lineNumber + ":" + (exception.columnNumber || 0);
exception.error = new Error(exception.message);
exception.error.stack = stack;
}
this.trackException({ exception: exception.error, severityLevel: SeverityLevel.Error }, properties);
}
} catch (e) {
const errorString = exception.error ?
(exception.error.name + ", " + exception.error.message)
: "null";
this.diagLog().throwInternal(
LoggingSeverity.CRITICAL,
_InternalMessageId.ExceptionWhileLoggingError,
"_onError threw exception while logging error, error will not be collected: "
+ Util.getExceptionName(e),
{ exception: Util.dump(e), errorString }
);
}
// @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
}
public addTelemetryInitializer(telemetryInitializer: (item: ITelemetryItem) => boolean | void) {
this._telemetryInitializers.push(telemetryInitializer);
// @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
}
public initialize(config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?:ITelemetryPluginChain) {
if (this.isInitialized()) {
return;
}
if (CoreUtils.isNullOrUndefined(core)) {
throw Error("Error initializing");
}
super.initialize(config, core, extensions, pluginChain);
this.setInitialized(false); // resetting the initialized state, just in case the following fails
let ctx = this._getTelCtx();
let identifier = this.identifier;
this._globalconfig = {
instrumentationKey: config.instrumentationKey,
endpointUrl: config.endpointUrl || "https://dc.services.visualstudio.com/v2/track"
};
this.config = ctx.getExtCfg<IConfig>(identifier);
// load default values if specified
const defaults: IConfig = ApplicationInsights.getDefaultConfig();
if (defaults !== undefined) {
objForEachKey(defaults, (field, value) => {
// for each unspecified field, set the default value
this.config[field] = ctx.getConfig(identifier, field, value);
});
if (this._globalconfig) {
objForEachKey(defaults, (field, value) => {
if (this._globalconfig[field] === undefined) {
this._globalconfig[field] = value;
}
});
}
}
// Todo: move this out of static state
if (this.config.isCookieUseDisabled) {
Util.disableCookies();
}
// Todo: move this out of static state
if (this.config.isStorageUseDisabled) {
Util.disableStorage();
}
const configGetters: ITelemetryConfig = {
instrumentationKey: () => config.instrumentationKey,
accountId: () => this.config.accountId || config.accountId,
sessionRenewalMs: () => this.config.sessionRenewalMs || config.sessionRenewalMs,
sessionExpirationMs: () => this.config.sessionExpirationMs || config.sessionExpirationMs,
sampleRate: () => this.config.samplingPercentage || config.samplingPercentage,
cookieDomain: () => this.config.cookieDomain || config.cookieDomain,
sdkExtension: () => this.config.sdkExtension || config.sdkExtension,
isBrowserLinkTrackingEnabled: () => this.config.isBrowserLinkTrackingEnabled || config.isBrowserLinkTrackingEnabled,
appId: () => this.config.appId || config.appId
}
this._pageViewPerformanceManager = new PageViewPerformanceManager(this.core);
this._pageViewManager = new PageViewManager(this, this.config.overridePageViewDuration, this.core, this._pageViewPerformanceManager);
this._pageVisitTimeManager = new PageVisitTimeManager(this.diagLog(), (pageName, pageUrl, pageVisitTime) => this.trackPageVisitTime(pageName, pageUrl, pageVisitTime))
this._telemetryInitializers = this._telemetryInitializers || [];
this._addDefaultTelemetryInitializers(configGetters);
this._eventTracking = new Timing(this.diagLog(), "trackEvent");
this._eventTracking.action =
(name?: string, url?: string, duration?: number, properties?: { [key: string]: string }) => {
if (!properties) {
properties = {};
}
properties[durationProperty] = duration.toString();
this.trackEvent({ name, properties } as IEventTelemetry);
}
// initialize page view timing
this._pageTracking = new Timing(this.diagLog(), "trackPageView");
this._pageTracking.action = (name, url, duration, properties, measurements) => {
// duration must be a custom property in order for the collector to extract it
if (CoreUtils.isNullOrUndefined(properties)) {
properties = {};
}
properties[durationProperty] = duration.toString();
const pageViewItem: IPageViewTelemetry = {
name,
uri: url,
properties,
measurements
};
this.sendPageViewInternal(pageViewItem, properties);
}
let _window = getWindow();
let _history = getHistory();
let _location = getLocation();
const instance: IAppInsights = this;
if (this.config.disableExceptionTracking === false &&
!this.config.autoExceptionInstrumented && _window) {
// We want to enable exception auto collection and it has not been done so yet
const onerror = "onerror";
const originalOnError = _window[onerror];
_window.onerror = (message, url, lineNumber, columnNumber, error) => {
const handled = originalOnError && (originalOnError(message, url, lineNumber, columnNumber, error) as any);
if (handled !== true) { // handled could be typeof function
instance._onerror({
message,
url,
lineNumber,
columnNumber,
error
});
}
return handled;
}
this.config.autoExceptionInstrumented = true;
}
if (this.config.disableExceptionTracking === false &&
this.config.enableUnhandledPromiseRejectionTracking === true &&
!this.config.autoUnhandledPromiseInstrumented && _window) {
// We want to enable exception auto collection and it has not been done so yet
const onunhandledrejection = "onunhandledrejection";
const originalOnUnhandledRejection = _window[onunhandledrejection];
_window[onunhandledrejection] = (error: PromiseRejectionEvent) => {
const handled = originalOnUnhandledRejection && (originalOnUnhandledRejection.call(_window, error) as any);
if (handled !== true) { // handled could be typeof function
instance._onerror({
message: error.reason.toString(),
error: error.reason instanceof Error ? error.reason : new Error(error.reason.toString()),
url: _location ? _location.href : "",
lineNumber: 0,
columnNumber: 0
});
}
return handled;
}
this.config.autoUnhandledPromiseInstrumented = true;
}
/**
* Create a custom "locationchange" event which is triggered each time the history object is changed
*/
if (this.config.enableAutoRouteTracking === true
&& _history && CoreUtils.isFunction(_history.pushState) && CoreUtils.isFunction(_history.replaceState)
&& _window
&& typeof Event !== "undefined") {
const _self = this;
// Find the properties plugin
CoreUtils.arrForEach(extensions, extension => {
if (extension.identifier === PropertiesPluginIdentifier) {
this._properties = extension as properties.PropertiesPlugin;
}
});
_history.pushState = ( f => function pushState() {
const ret = f.apply(this, arguments);
_dispatchEvent(_window, Util.createDomEvent(_self.config.namePrefix + "pushState"));
_dispatchEvent(_window, Util.createDomEvent(_self.config.namePrefix + "locationchange"));
return ret;
})(_history.pushState);
_history.replaceState = ( f => function replaceState(){
const ret = f.apply(this, arguments);
_dispatchEvent(_window, Util.createDomEvent(_self.config.namePrefix + "replaceState"));
_dispatchEvent(_window, Util.createDomEvent(_self.config.namePrefix + "locationchange"));
return ret;
})(_history.replaceState);
if (_window.addEventListener) {
_window.addEventListener(_self.config.namePrefix + "popstate",()=>{
_dispatchEvent(_window, Util.createDomEvent(_self.config.namePrefix + "locationchange"));
});
_window.addEventListener(_self.config.namePrefix + "locationchange", () => {
if (_self._properties && _self._properties.context && _self._properties.context.telemetryTrace) {
_self._properties.context.telemetryTrace.traceID = Util.generateW3CId();
_self._properties.context.telemetryTrace.name = _location && _location.pathname || "_unknown_";
}
if (this._currUri) {
this._prevUri = this._currUri;
this._currUri = _location && _location.href || "";
} else {
this._currUri = _location && _location.href || "";
}
setTimeout(((uri: string) => {
// todo: override start time so that it is not affected by autoRoutePVDelay
_self.trackPageView({ refUri: uri, properties: { duration: 0 } }); // SPA route change loading durations are undefined, so send 0
}).bind(this, this._prevUri), _self.autoRoutePVDelay);
});
}
}
this.setInitialized(true);
// @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
}
/**
* Log a page visit time
* @param pageName Name of page
* @param pageVisitDuration Duration of visit to the page in milleseconds
*/
private trackPageVisitTime(pageName: string, pageUrl: string, pageVisitTime: number) {
const properties = { PageName: pageName, PageUrl: pageUrl };
this.trackMetric({
name: "PageVisitTime",
average: pageVisitTime,
max: pageVisitTime,
min: pageVisitTime,
sampleCount: 1
}, properties);
}
private _addDefaultTelemetryInitializers(configGetters: ITelemetryConfig) {
if (!configGetters.isBrowserLinkTrackingEnabled()) {
const browserLinkPaths = ['/browserLinkSignalR/', '/__browserLink/'];
const dropBrowserLinkRequests = (envelope: ITelemetryItem) => {
if (envelope.baseType === RemoteDependencyData.dataType) {
const remoteData = envelope.baseData as IDependencyTelemetry;
if (remoteData) {
for (let i = 0; i < browserLinkPaths.length; i++) {
if (remoteData.target && remoteData.target.indexOf(browserLinkPaths[i]) >= 0) {
return false;
}
}
}
}
return true;
}
this._addTelemetryInitializer(dropBrowserLinkRequests)
}
}
private _addTelemetryInitializer(telemetryInitializer: (envelope: ITelemetryItem) => boolean | void) {
this._telemetryInitializers.push(telemetryInitializer);
}
private _sendCORSException(url: string) {
const exception: IAutoExceptionTelemetry = {
message: "Script error: The browser's same-origin policy prevents us from getting the details of this exception. Consider using the 'crossorigin' attribute.",
url,
lineNumber: 0,
columnNumber: 0,
error: undefined
};
const telemetryItem: ITelemetryItem = TelemetryItemCreator.create<IAutoExceptionTelemetry>(
exception,
Exception.dataType,
Exception.envelopeType,
this.diagLog(),
{ url }
);
this.core.track(telemetryItem);
}
}

@@ -759,39 +911,35 @@

public action: (name?: string, url?: string, duration?: number, properties?: { [key: string]: string }, measurements?: { [key: string]: number }) => void;
private _name: string;
private _events: {
[key: string]: number;
};
private _logger: IDiagnosticLogger;
public start: (name: string) => void;
public stop: (name: string, url: string, properties?: { [key: string]: string }, measurements?: { [key: string]: number }) => void;
constructor(logger: IDiagnosticLogger, name: string) {
this._name = name;
this._events = {};
this._logger = logger;
}
let _self = this;
let _events: { [key: string]: number; } = {}
public start(name: string) {
if (typeof this._events[name] !== "undefined") {
this._logger.throwInternal(
LoggingSeverity.WARNING, _InternalMessageId.StartCalledMoreThanOnce, "start was called more than once for this event without calling stop.",
{ name: this._name, key: name }, true);
_self.start = (name: string) => {
if (typeof _events[name] !== "undefined") {
logger.throwInternal(
LoggingSeverity.WARNING, _InternalMessageId.StartCalledMoreThanOnce, "start was called more than once for this event without calling stop.",
{ name: name, key: name }, true);
}
_events[name] = +new Date;
}
this._events[name] = +new Date;
}
public stop(name: string, url: string, properties?: { [key: string]: string }, measurements?: { [key: string]: number }) {
const start = this._events[name];
if (isNaN(start)) {
this._logger.throwInternal(
LoggingSeverity.WARNING, _InternalMessageId.StopCalledWithoutStart, "stop was called without a corresponding start.",
{ name: this._name, key: name }, true);
} else {
const end = +new Date;
const duration = DateTimeUtils.GetDuration(start, end);
this.action(name, url, duration, properties, measurements);
_self.stop = (name: string, url: string, properties?: { [key: string]: string }, measurements?: { [key: string]: number }) => {
const start = _events[name];
if (isNaN(start)) {
logger.throwInternal(
LoggingSeverity.WARNING, _InternalMessageId.StopCalledWithoutStart, "stop was called without a corresponding start.",
{ name: name, key: name }, true);
} else {
const end = +new Date;
const duration = dateTimeUtilsDuration(start, end);
_self.action(name, url, duration, properties, measurements);
}
delete _events[name];
_events[name] = undefined;
}
delete this._events[name];
this._events[name] = undefined;
}
}

@@ -5,7 +5,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved.

import {
DateTimeUtils, Util, IPageViewTelemetry, IPageViewTelemetryInternal, IPageViewPerformanceTelemetryInternal
dateTimeUtilsDuration, IPageViewTelemetry, IPageViewTelemetryInternal, IPageViewPerformanceTelemetryInternal
} from '@microsoft/applicationinsights-common';
import {
IAppInsightsCore, CoreUtils, IDiagnosticLogger, LoggingSeverity,
_InternalMessageId, IChannelControls, getDocument, getLocation
IAppInsightsCore, IDiagnosticLogger, LoggingSeverity,
_InternalMessageId, getDocument, getLocation, arrForEach, isNullOrUndefined, getExceptionName, dumpObj
} from '@microsoft/applicationinsights-core-js';

@@ -35,4 +35,2 @@ import { PageViewPerformanceManager } from './PageViewPerformanceManager';

dynamicProto(PageViewManager, this, (_self) => {
let arrForEach = CoreUtils.arrForEach;
let isNullOrUndefined = CoreUtils.isNullOrUndefined;
let intervalHandle: any = null;

@@ -123,3 +121,3 @@ let itemQueue: Array<() => boolean> = [];

if (start > 0) {
customDuration = DateTimeUtils.GetDuration(start, +new Date);
customDuration = dateTimeUtilsDuration(start, +new Date);
if (!pageViewPerformanceManager.shouldCollectDuration(customDuration)) {

@@ -193,3 +191,3 @@ customDuration = undefined;

}
} else if (start > 0 && DateTimeUtils.GetDuration(start, +new Date) > maxDurationLimit) {
} else if (start > 0 && dateTimeUtilsDuration(start, +new Date) > maxDurationLimit) {
// if performance timings are not ready but we exceeded the maximum duration limit, just log a page view telemetry

@@ -210,4 +208,4 @@ // with the maximum duration limit. Otherwise, keep waiting until performance timings are ready

_InternalMessageId.TrackPVFailedCalc,
"trackPageView failed on page load calculation: " + Util.getExceptionName(e),
{ exception: Util.dump(e) });
"trackPageView failed on page load calculation: " + getExceptionName(e),
{ exception: dumpObj(e) });
}

@@ -214,0 +212,0 @@

@@ -5,3 +5,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved.

import {
Util, IPageViewPerformanceTelemetryInternal, DateTimeUtils
IPageViewPerformanceTelemetryInternal, dateTimeUtilsDuration, msToTimeSpan
} from '@microsoft/applicationinsights-common';

@@ -47,12 +47,12 @@ import {

var total = navigationTiming.duration;
var network = DateTimeUtils.GetDuration(navigationTiming.startTime, navigationTiming.connectEnd);
var request = DateTimeUtils.GetDuration(navigationTiming.requestStart, navigationTiming.responseStart);
var response = DateTimeUtils.GetDuration(navigationTiming.responseStart, navigationTiming.responseEnd);
var dom = DateTimeUtils.GetDuration(navigationTiming.responseEnd, navigationTiming.loadEventEnd);
var network = dateTimeUtilsDuration(navigationTiming.startTime, navigationTiming.connectEnd);
var request = dateTimeUtilsDuration(navigationTiming.requestStart, navigationTiming.responseStart);
var response = dateTimeUtilsDuration(navigationTiming.responseStart, navigationTiming.responseEnd);
var dom = dateTimeUtilsDuration(navigationTiming.responseEnd, navigationTiming.loadEventEnd);
} else {
var total = DateTimeUtils.GetDuration(timing.navigationStart, timing.loadEventEnd);
var network = DateTimeUtils.GetDuration(timing.navigationStart, timing.connectEnd);
var request = DateTimeUtils.GetDuration(timing.requestStart, timing.responseStart);
var response = DateTimeUtils.GetDuration(timing.responseStart, timing.responseEnd);
var dom = DateTimeUtils.GetDuration(timing.responseEnd, timing.loadEventEnd);
var total = dateTimeUtilsDuration(timing.navigationStart, timing.loadEventEnd);
var network = dateTimeUtilsDuration(timing.navigationStart, timing.connectEnd);
var request = dateTimeUtilsDuration(timing.requestStart, timing.responseStart);
var response = dateTimeUtilsDuration(timing.responseStart, timing.responseEnd);
var dom = dateTimeUtilsDuration(timing.responseEnd, timing.loadEventEnd);
}

@@ -86,7 +86,7 @@

// // convert to timespans
pageViewPerformance.perfTotal = pageViewPerformance.duration = Util.msToTimeSpan(total);
pageViewPerformance.networkConnect = Util.msToTimeSpan(network);
pageViewPerformance.sentRequest = Util.msToTimeSpan(request);
pageViewPerformance.receivedResponse = Util.msToTimeSpan(response);
pageViewPerformance.domProcessing = Util.msToTimeSpan(dom);
pageViewPerformance.perfTotal = pageViewPerformance.duration = msToTimeSpan(total);
pageViewPerformance.networkConnect = msToTimeSpan(network);
pageViewPerformance.sentRequest = msToTimeSpan(request);
pageViewPerformance.receivedResponse = msToTimeSpan(response);
pageViewPerformance.domProcessing = msToTimeSpan(dom);
pageViewPerformance.isValid = true;

@@ -93,0 +93,0 @@ }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import { Util } from '@microsoft/applicationinsights-common';
import { IDiagnosticLogger, hasJSON, getJSON, CoreUtils } from '@microsoft/applicationinsights-core-js';
import { utlCanUseSessionStorage, utlGetSessionStorage, utlRemoveSessionStorage, utlSetSessionStorage } from '@microsoft/applicationinsights-common';
import { IDiagnosticLogger, hasJSON, getJSON, dateNow, dumpObj, throwError } from '@microsoft/applicationinsights-core-js';

@@ -42,3 +42,3 @@ /**

} catch (e) {
this._logger.warnToConsole("Auto track page visit time failed, metric will not be collected: " + Util.dump(e));
this._logger.warnToConsole("Auto track page visit time failed, metric will not be collected: " + dumpObj(e));
}

@@ -59,3 +59,3 @@ }

} catch (e) {
this._logger.warnToConsole("Call to restart failed: " + Util.dump(e));
this._logger.warnToConsole("Call to restart failed: " + dumpObj(e));
return null;

@@ -72,5 +72,5 @@ }

try {
if (Util.canUseSessionStorage()) {
if (Util.getSessionStorage(this._logger, this.prevPageVisitDataKeyName) != null) {
throw new Error("Cannot call startPageVisit consecutively without first calling stopPageVisit");
if (utlCanUseSessionStorage()) {
if (utlGetSessionStorage(this._logger, this.prevPageVisitDataKeyName) != null) {
throwError("Cannot call startPageVisit consecutively without first calling stopPageVisit");
}

@@ -80,7 +80,7 @@

const currPageVisitDataStr = getJSON().stringify(currPageVisitData);
Util.setSessionStorage(this._logger, this.prevPageVisitDataKeyName, currPageVisitDataStr);
utlSetSessionStorage(this._logger, this.prevPageVisitDataKeyName, currPageVisitDataStr);
}
} catch (e) {
// TODO: Remove this catch in next phase, since if start is called twice in a row the exception needs to be propagated out
this._logger.warnToConsole("Call to start failed: " + Util.dump(e));
this._logger.warnToConsole("Call to start failed: " + dumpObj(e));
}

@@ -95,9 +95,9 @@ }

try {
if (Util.canUseSessionStorage()) {
if (utlCanUseSessionStorage()) {
// Define end time of page's visit
const pageVisitEndTime = CoreUtils.dateNow();
const pageVisitEndTime = dateNow();
// Try to retrieve page name and start time from session storage
const pageVisitDataJsonStr = Util.getSessionStorage(this._logger, this.prevPageVisitDataKeyName);
const pageVisitDataJsonStr = utlGetSessionStorage(this._logger, this.prevPageVisitDataKeyName);
if (pageVisitDataJsonStr && hasJSON()) {

@@ -110,3 +110,3 @@

// Remove data from storage since we already used it
Util.removeSessionStorage(this._logger, this.prevPageVisitDataKeyName);
utlRemoveSessionStorage(this._logger, this.prevPageVisitDataKeyName);

@@ -122,3 +122,3 @@ // Return page visit data

} catch (e) {
this._logger.warnToConsole("Stop page visit timer failed: " + Util.dump(e));
this._logger.warnToConsole("Stop page visit timer failed: " + dumpObj(e));
return null

@@ -137,3 +137,3 @@ }

constructor(pageName: string, pageUrl: string) {
this.pageVisitStartTime = CoreUtils.dateNow();
this.pageVisitStartTime = dateNow();
this.pageName = pageName;

@@ -140,0 +140,0 @@ this.pageUrl = pageUrl;

import '@microsoft/applicationinsights-shims';
export { ApplicationInsights } from "./JavaScriptSDK/ApplicationInsights";
export { IAppInsightsInternal } from "./JavaScriptSDK/Telemetry/PageViewManager";

@@ -7,3 +7,2 @@ export interface ITelemetryConfig {

sessionExpirationMs: () => number;
cookieDomain: () => string;
sdkExtension: () => string;

@@ -10,0 +9,0 @@ isBrowserLinkTrackingEnabled: () => boolean;

@@ -22,9 +22,2 @@ /**

protected _pageVisitTimeManager: PageVisitTimeManager;
private _globalconfig;
private _eventTracking;
private _pageTracking;
private _properties;
private _trackAjaxAttempts;
private _prevUri;
private _currUri;
constructor();

@@ -151,11 +144,2 @@ processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;

initialize(config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
/**
* Log a page visit time
* @param pageName Name of page
* @param pageVisitDuration Duration of visit to the page in milleseconds
*/
private trackPageVisitTime(pageName, pageUrl, pageVisitTime);
private _addDefaultTelemetryInitializers(configGetters);
private _addTelemetryInitializer(telemetryInitializer);
private _sendCORSException(url);
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc