@microsoft/applicationinsights-properties-js
Advanced tools
Comparing version 2.2.2 to 2.2.3
/*! | ||
* Application Insights JavaScript SDK - Properties Plugin, 2.2.2 | ||
* Application Insights JavaScript SDK - Properties Plugin, 2.2.3 | ||
* Copyright (c) Microsoft and contributors. All rights reserved. | ||
*/ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e.Microsoft=e.Microsoft||{},e.Microsoft.ApplicationInsights={}))}(this,function(e){"use strict";var c=(t.isNullOrUndefined=function(e){return null==e},t.disableCookies=function(){t._canUseCookies=!1},t.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(n,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},t);function t(){}var s,i,n=/[xy]/g;(i=s=s||{})[i.CRITICAL=1]="CRITICAL",i[i.WARNING=2]="WARNING";var o=0,a=1,r=2,u=3,l=4,p=5,h=6,d=9,f=23,g=27,m=49,v=52,y=56,x=57,S=60,I=61,N=66,w=68,D=69,C=(E.sanitizeDiagnosticText=function(e){return'"'+e.replace(/\"/g,"")+'"'},E.dataType="MessageData",E.AiNonUserActionablePrefix="AI (Internal): ",E.AiUserActionablePrefix="AI: ",E);function E(e,t,i,n){void 0===i&&(i=!1),this.messageId=e,this.message=(i?E.AiUserActionablePrefix:E.AiNonUserActionablePrefix)+e;var o=(t?" message:"+E.sanitizeDiagnosticText(t):"")+(n?" props:"+E.sanitizeDiagnosticText(JSON.stringify(n)):"");this.message+=o}var _=(A.prototype.throwInternal=function(e,t,i,n,o){void 0===o&&(o=!1);var a=new C(t,i,o,n);if(this.enableDebugExceptions())throw a;if(void 0!==a&&a&&void 0!==a.message){if(o){var r=+a.messageId;(!this._messageLogged[r]||this.consoleLoggingLevel()>=s.WARNING)&&(this.warnToConsole(a.message),this._messageLogged[r]=!0)}else this.consoleLoggingLevel()>=s.WARNING&&this.warnToConsole(a.message);this.logInternalMessage(e,a)}},A.prototype.warnToConsole=function(e){"undefined"!=typeof console&&console&&("function"==typeof console.warn?console.warn(e):"function"==typeof console.log&&console.log(e))},A.prototype.resetInternalMessageCount=function(){this._messageCount=0,this._messageLogged={}},A.prototype.logInternalMessage=function(e,t){if(!this._areInternalMessagesThrottled()){var i=!0,n=this.AIInternalMessagePrefix+t.messageId;if(this._messageLogged[n]?i=!1:this._messageLogged[n]=!0,i&&(e<=this.telemetryLoggingLevel()&&(this.queue.push(t),this._messageCount++),this._messageCount==this.maxInternalMessageLimit())){var o="Internal events throttle limit per PageView reached for this app.",a=new C(f,o,!1);this.queue.push(a),this.warnToConsole(o)}}},A.prototype._areInternalMessagesThrottled=function(){return this._messageCount>=this.maxInternalMessageLimit()},A);function A(e){this.AIInternalMessagePrefix="AITR_",this.enableDebugExceptions=function(){return!1},this.consoleLoggingLevel=function(){return 0},this.telemetryLoggingLevel=function(){return 1},this.maxInternalMessageLimit=function(){return 25},this.queue=[],this._messageCount=0,this._messageLogged={},c.isNullOrUndefined(e)||(c.isNullOrUndefined(e.loggingLevelConsole)||(this.consoleLoggingLevel=function(){return e.loggingLevelConsole}),c.isNullOrUndefined(e.loggingLevelTelemetry)||(this.telemetryLoggingLevel=function(){return e.loggingLevelTelemetry}),c.isNullOrUndefined(e.maxMessageLimit)||(this.maxInternalMessageLimit=function(){return e.maxMessageLimit}),c.isNullOrUndefined(e.enableDebugExceptions)||(this.enableDebugExceptions=function(){return e.enableDebugExceptions}))}var b,k,T,U,M,L;R.prototype.processTelemetry=function(t){this.channelQueue.forEach(function(e){0<e.length&&e[0].processTelemetry(t)})},Object.defineProperty(R.prototype,"ChannelControls",{get:function(){return this.channelQueue},enumerable:!0,configurable:!0}),R.prototype.initialize=function(i,n,o){var a=this;if(i.isCookieUseDisabled&&c.disableCookies(),this.channelQueue=new Array,i.channels){var r=void 0;i.channels.forEach(function(e){if(e&&0<e.length){e=e.sort(function(e,t){return e.priority-t.priority});for(var t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);if(e.forEach(function(e){e.priority<500&&(r=e.identifier),e.initialize(i,n,o)}),r)throw Error("Channel has invalid priority"+r);a.channelQueue.push(e)}})}for(var e=new Array,t=0;t<o.length;t++){var s=o[t];500<s.priority&&e.push(s)}if(0<e.length){for(e=e.sort(function(e,t){return e.priority-t.priority}),t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);e.forEach(function(e){return e.initialize(i,n,o)}),this.channelQueue.push(e)}};function R(){this.identifier="ChannelControllerPlugin",this.priority=500}(k=b=b||{})[k.LocalStorage=0]="LocalStorage",k[k.SessionStorage=1]="SessionStorage",(U=T=T||{})[U.Default=0]="Default",U[U.Required=1]="Required",U[U.Array=2]="Array",U[U.Hidden=4]="Hidden",(L=M=M||{})[L.AI=0]="AI",L[L.AI_AND_W3C=1]="AI_AND_W3C",L[L.W3C=2]="W3C";var O=(z.sanitizeKeyAndAddUniqueness=function(e,t,i){var n=t.length,o=z.sanitizeKey(e,t);if(o.length!==n){for(var a=0,r=o;void 0!==i[r];)a++,r=o.substring(0,z.MAX_NAME_LENGTH-3)+z.padNumber(a);o=r}return o},z.sanitizeKey=function(e,t){var i;return t&&(t=z.trim(t.toString())).length>z.MAX_NAME_LENGTH&&(i=t.substring(0,z.MAX_NAME_LENGTH),e.throwInternal(s.WARNING,x,"name is too long. It has been truncated to "+z.MAX_NAME_LENGTH+" characters.",{name:t},!0)),i||t},z.sanitizeString=function(e,t,i){var n;return void 0===i&&(i=z.MAX_STRING_LENGTH),t&&(i=i||z.MAX_STRING_LENGTH,(t=z.trim(t)).toString().length>i&&(n=t.toString().substring(0,i),e.throwInternal(s.WARNING,I,"string value is too long. It has been truncated to "+i+" characters.",{value:t},!0))),n||t},z.sanitizeUrl=function(e,t){return z.sanitizeInput(e,t,z.MAX_URL_LENGTH,N)},z.sanitizeMessage=function(e,t){var i;return t&&t.length>z.MAX_MESSAGE_LENGTH&&(i=t.substring(0,z.MAX_MESSAGE_LENGTH),e.throwInternal(s.WARNING,y,"message is too long, it has been truncated to "+z.MAX_MESSAGE_LENGTH+" characters.",{message:t},!0)),i||t},z.sanitizeException=function(e,t){var i;return t&&t.length>z.MAX_EXCEPTION_LENGTH&&(i=t.substring(0,z.MAX_EXCEPTION_LENGTH),e.throwInternal(s.WARNING,v,"exception is too long, it has been truncated to "+z.MAX_EXCEPTION_LENGTH+" characters.",{exception:t},!0)),i||t},z.sanitizeProperties=function(t,e){if(e){var i={};for(var n in e){var o=e[n];if("object"==typeof o&&"undefined"!=typeof JSON)try{o=JSON.stringify(o)}catch(e){t.throwInternal(s.WARNING,m,"custom property is not valid",{exception:e},!0)}o=z.sanitizeString(t,o,z.MAX_PROPERTY_LENGTH),i[n=z.sanitizeKeyAndAddUniqueness(t,n,i)]=o}e=i}return e},z.sanitizeMeasurements=function(e,t){if(t){var i={};for(var n in t){var o=t[n];i[n=z.sanitizeKeyAndAddUniqueness(e,n,i)]=o}t=i}return t},z.sanitizeId=function(e,t){return t?z.sanitizeInput(e,t,z.MAX_ID_LENGTH,D).toString():t},z.sanitizeInput=function(e,t,i,n){var o;return t&&(t=z.trim(t)).length>i&&(o=t.substring(0,i),e.throwInternal(s.WARNING,n,"input is too long, it has been truncated to "+i+" characters.",{data:t},!0)),o||t},z.padNumber=function(e){var t="00"+e;return t.substr(t.length-3)},z.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},z.MAX_NAME_LENGTH=150,z.MAX_ID_LENGTH=128,z.MAX_PROPERTY_LENGTH=8192,z.MAX_STRING_LENGTH=1024,z.MAX_URL_LENGTH=2048,z.MAX_MESSAGE_LENGTH=32768,z.MAX_EXCEPTION_LENGTH=32768,z);function z(){}var P=(G.createDomEvent=function(e){var t=null;return"function"==typeof Event?t=new Event(e):(t=document.createEvent("Event")).initEvent(e,!0,!0),t},G.disableStorage=function(){G._canUseLocalStorage=!1,G._canUseSessionStorage=!1},G._getLocalStorageObject=function(){return G.canUseLocalStorage()?G._getVerifiedStorageObject(b.LocalStorage):null},G._getVerifiedStorageObject=function(e){var t,i,n=null;try{if("undefined"==typeof window)return null;i=new Date,(n=e===b.LocalStorage?window.localStorage:window.sessionStorage).setItem(i,i),t=n.getItem(i)!=i,n.removeItem(i),t&&(n=null)}catch(e){n=null}return n},G.isInternalApplicationInsightsEndpoint=function(e){return-1!==G._internalEndpoints.indexOf(e.toLowerCase())},G.canUseLocalStorage=function(){return void 0===G._canUseLocalStorage&&(G._canUseLocalStorage=!!G._getVerifiedStorageObject(b.LocalStorage)),G._canUseLocalStorage},G.getStorage=function(t,e){var i=G._getLocalStorageObject();if(null!==i)try{return i.getItem(e)}catch(e){G._canUseLocalStorage=!1,t.throwInternal(s.WARNING,a,"Browser failed read of local storage. "+G.getExceptionName(e),{exception:G.dump(e)})}return null},G.setStorage=function(t,e,i){var n=G._getLocalStorageObject();if(null!==n)try{return n.setItem(e,i),!0}catch(e){G._canUseLocalStorage=!1,t.throwInternal(s.WARNING,u,"Browser failed write to local storage. "+G.getExceptionName(e),{exception:G.dump(e)})}return!1},G.removeStorage=function(t,e){var i=G._getLocalStorageObject();if(null!==i)try{return i.removeItem(e),!0}catch(e){G._canUseLocalStorage=!1,t.throwInternal(s.WARNING,p,"Browser failed removal of local storage item. "+G.getExceptionName(e),{exception:G.dump(e)})}return!1},G._getSessionStorageObject=function(){return G.canUseSessionStorage()?G._getVerifiedStorageObject(b.SessionStorage):null},G.canUseSessionStorage=function(){return void 0===G._canUseSessionStorage&&(G._canUseSessionStorage=!!G._getVerifiedStorageObject(b.SessionStorage)),G._canUseSessionStorage},G.getSessionStorageKeys=function(){var e=[];if(G.canUseSessionStorage())for(var t in window.sessionStorage)e.push(t);return e},G.getSessionStorage=function(t,e){var i=G._getSessionStorageObject();if(null!==i)try{return i.getItem(e)}catch(e){G._canUseSessionStorage=!1,t.throwInternal(s.WARNING,r,"Browser failed read of session storage. "+G.getExceptionName(e),{exception:G.dump(e)})}return null},G.setSessionStorage=function(t,e,i){var n=G._getSessionStorageObject();if(null!==n)try{return n.setItem(e,i),!0}catch(e){G._canUseSessionStorage=!1,t.throwInternal(s.WARNING,l,"Browser failed write to session storage. "+G.getExceptionName(e),{exception:G.dump(e)})}return!1},G.removeSessionStorage=function(t,e){var i=G._getSessionStorageObject();if(null!==i)try{return i.removeItem(e),!0}catch(e){G._canUseSessionStorage=!1,t.throwInternal(s.WARNING,h,"Browser failed removal of session storage item. "+G.getExceptionName(e),{exception:G.dump(e)})}return!1},G.disableCookies=function(){c.disableCookies()},G.canUseCookies=function(t){if(void 0===c._canUseCookies){c._canUseCookies=!1;try{c._canUseCookies=void 0!==G.document.cookie}catch(e){t.throwInternal(s.WARNING,w,"Cannot access document.cookie - "+G.getExceptionName(e),{exception:G.dump(e)})}}return c._canUseCookies},G.setCookie=function(e,t,i,n){var o="",a="";n&&(o=";domain="+n),G.document.location&&"https:"===G.document.location.protocol&&(a=";secure"),G.canUseCookies(e)&&(G.document.cookie=t+"="+i+o+";path=/"+a)},G.stringToBoolOrDefault=function(e,t){return void 0===t&&(t=!1),null==e?t:"true"===e.toString().toLowerCase()},G.getCookie=function(e,t){if(G.canUseCookies(e)){var i="";if(t&&t.length)for(var n=t+"=",o=G.document.cookie.split(";"),a=0;a<o.length;a++){var r=o[a];if((r=G.trim(r))&&0===r.indexOf(n)){i=r.substring(n.length,o[a].length);break}}return i}},G.deleteCookie=function(e,t){G.canUseCookies(e)&&(G.document.cookie=t+"=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;")},G.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},G.newId=function(){for(var e="",t=1073741824*Math.random();0<t;)e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t%64),t=Math.floor(t/64);return e},G.random32=function(){return 4294967296*Math.random()|0},G.generateW3CId=function(){for(var e,t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],i="",n=0;n<4;n++)i+=t[15&(e=G.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 o=t[8+4*Math.random()|0];return i.substr(0,8)+i.substr(9,4)+"4"+i.substr(13,3)+o+i.substr(16,3)+i.substr(19,12)},G.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},G.isError=function(e){return"[object Error]"===Object.prototype.toString.call(e)},G.isDate=function(e){return"[object Date]"===Object.prototype.toString.call(e)},G.toISOStringForIE8=function(e){if(G.isDate(e)){if(Date.prototype.toISOString)return e.toISOString();var t=function(e){var t=String(e);return 1===t.length&&(t="0"+t),t};return e.getUTCFullYear()+"-"+t(e.getUTCMonth()+1)+"-"+t(e.getUTCDate())+"T"+t(e.getUTCHours())+":"+t(e.getUTCMinutes())+":"+t(e.getUTCSeconds())+"."+String((e.getUTCMilliseconds()/1e3).toFixed(3)).slice(2,5)+"Z"}},G.getIEVersion=function(e){void 0===e&&(e=null);var t=e?e.toLowerCase():navigator.userAgent.toLowerCase();return-1!=t.indexOf("msie")?parseInt(t.split("msie")[1]):null},G.msToTimeSpan=function(e){(isNaN(e)||e<0)&&(e=0);var t=""+(e=Math.round(e))%1e3,i=""+Math.floor(e/1e3)%60,n=""+Math.floor(e/6e4)%60,o=""+Math.floor(e/36e5)%24,a=Math.floor(e/864e5);return t=1===t.length?"00"+t:2===t.length?"0"+t:t,i=i.length<2?"0"+i:i,n=n.length<2?"0"+n:n,(0<a?a+".":"")+(o=o.length<2?"0"+o:o)+":"+n+":"+i+"."+t},G.isCrossOriginError=function(e,t,i,n,o){return("Script error."===e||"Script error"===e)&&!o},G.dump=function(e){var t=Object.prototype.toString.call(e),i=JSON.stringify(e);return"[object Error]"===t&&(i="{ stack: '"+e.stack+"', message: '"+e.message+"', name: '"+e.name+"'"),t+i},G.getExceptionName=function(e){return"[object Error]"===Object.prototype.toString.call(e)?e.name:""},G.addEventHandler=function(e,t){if("undefined"==typeof window||!window||"string"!=typeof e||"function"!=typeof t)return!1;var i="on"+e;if(window.addEventListener)window.addEventListener(e,t,!1);else{if(!window.attachEvent)return!1;window.attachEvent(i,t)}return!0},G.IsBeaconApiSupported=function(){return"sendBeacon"in navigator&&navigator.sendBeacon},G.getExtension=function(e,t){for(var i=null,n=0;!i&&n<e.length;)e[n]&&e[n].identifier===t&&(i=e[n]),n++;return i},G.document="undefined"!=typeof document?document:{},G._canUseLocalStorage=void 0,G._canUseSessionStorage=void 0,G._internalEndpoints=["https://dc.services.visualstudio.com/v2/track","https://breeze.aimon.applicationinsights.io/v2/track","https://dc-int.services.visualstudio.com/v2/track"],G.NotSpecified="not_specified",G);function G(){}var q=(j.parseUrl=function(e){return j.htmlAnchorElement||(j.htmlAnchorElement=j.document.createElement?j.document.createElement("a"):{host:j.parseHost(e)}),j.htmlAnchorElement.href=e,j.htmlAnchorElement},j.getAbsoluteUrl=function(e){var t,i=j.parseUrl(e);return i&&(t=i.href),t},j.getPathName=function(e){var t,i=j.parseUrl(e);return i&&(t=i.pathname),t},j.getCompleteUrl=function(e,t){return e?e.toUpperCase()+" "+t:t},j.parseHost=function(e){var t=e.match(/:\/\/(www[0-9]?\.)?(.[^/:]+)/i);return null!=t&&2<t.length&&"string"==typeof t[2]&&0<t[2].length?t[2]:null},j.document="undefined"!=typeof document?document:{},j);function j(){}var W=(V.ParseDependencyPath=function(e,t,i,n){var o,a=n,r=n;if(t&&0<t.length){var s=q.parseUrl(t);if(o=s.host,!a)if(null!=s.pathname){var c=0===s.pathname.length?"/":s.pathname;"/"!==c.charAt(0)&&(c="/"+c),r=s.pathname,a=O.sanitizeString(e,i?i+" "+c:c)}else a=O.sanitizeString(e,t)}else a=o=n;return{target:o,name:a,data:r}},V);function V(){}var H=(B.Now="undefined"==typeof window?function(){return(new Date).getTime()}:window.performance&&window.performance.now&&window.performance.timing?function(){return window.performance.now()+window.performance.timing.navigationStart}:function(){return(new Date).getTime()},B.GetDuration=function(e,t){var i=null;return 0===e||0===t||c.isNullOrUndefined(e)||c.isNullOrUndefined(t)||(i=t-e),i},B);function B(){}var X=function(e,t){return(X=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};function F(e,t){function i(){this.constructor=e}X(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var K,J=function(){return(J=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var o in t=arguments[i])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},Q=(F(Y,K=function(){}),Y);function Y(){return K.call(this)||this}var $;F(Z,$=function(){this.ver=1,this.sampleRate=100,this.tags={}});function Z(e,t,i){var n=$.call(this)||this;return n.name=O.sanitizeString(e,i)||P.NotSpecified,n.data=t,n.time=P.toISOStringForIE8(new Date),n.aiDataContract={time:T.Required,iKey:T.Required,name:T.Required,sampleRate:function(){return 100==n.sampleRate?T.Hidden:T.Required},tags:T.Required,data:T.Required},n}function ee(){}var te,ie=(F(ne,te=ee),ne);function ne(){var e=te.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var oe;F(ae,oe=ie),ae.envelopeType="Microsoft.ApplicationInsights.{0}.Event",ae.dataType="EventData";function ae(e,t,i,n){var o=oe.call(this)||this;return o.aiDataContract={ver:T.Required,name:T.Required,properties:T.Default,measurements:T.Default},o.name=O.sanitizeString(e,t)||P.NotSpecified,o.properties=O.sanitizeProperties(e,i),o.measurements=O.sanitizeMeasurements(e,n),o}function re(){}var se,ce=(F(ue,se=ee),ue);function ue(){var e=se.call(this)||this;return e.ver=2,e.exceptions=[],e.properties={},e.measurements={},e}function le(){this.hasFullStack=!0,this.parsedStack=[]}var pe;F(he,pe=ce),he.CreateFromInterface=function(t,e){var i=e.exceptions&&e.exceptions.map(function(e){return fe.CreateFromInterface(t,e)});return new he(t,J({},e,{exceptions:i}))},he.prototype.toInterface=function(){var e=this,t=e.exceptions,i=e.properties,n=e.measurements,o=e.severityLevel,a=e.ver,r=e.problemGroup,s=e.id,c=e.isManual;return{ver:a,exceptions:t instanceof Array&&t.map(function(e){return e.toInterface()})||void 0,severityLevel:o,properties:i,measurements:n,problemGroup:r,id:s,isManual:c}},he.CreateSimpleException=function(e,t,i,n,o,a){return{exceptions:[{hasFullStack:!0,message:e,stack:o,typeName:t}]}},he.envelopeType="Microsoft.ApplicationInsights.{0}.Exception",he.dataType="ExceptionData";function he(e,t,i,n,o,a){var r=pe.call(this)||this;return r.aiDataContract={ver:T.Required,exceptions:T.Required,severityLevel:T.Default,properties:T.Default,measurements:T.Default},t instanceof Error?(r.exceptions=[new fe(e,t)],r.properties=O.sanitizeProperties(e,i),r.measurements=O.sanitizeMeasurements(e,n),o&&(r.severityLevel=o),a&&(r.id=a)):(r.exceptions=t.exceptions,r.properties=t.properties,r.measurements=t.measurements,t.severityLevel&&(r.severityLevel=t.severityLevel),t.id&&(r.id=t.id),t.problemGroup&&(r.problemGroup=t.problemGroup),c.isNullOrUndefined(t.ver)||(r.ver=t.ver),c.isNullOrUndefined(t.isManual)||(r.isManual=t.isManual)),r}var de,fe=(F(ge,de=le),ge.prototype.toInterface=function(){var e=this.parsedStack instanceof Array&&this.parsedStack.map(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||void 0}},ge.CreateFromInterface=function(e,t){var i=t.parsedStack instanceof Array&&t.parsedStack.map(function(e){return ve.CreateFromInterface(e)})||t.parsedStack;return new ge(e,J({},t,{parsedStack:i}))},ge.parseStack=function(e){var t=void 0;if("string"==typeof e){var i=e.split("\n");t=[];for(var n=0,o=0,a=0;a<=i.length;a++){var r=i[a];if(ve.regex.test(r)){var s=new ve(i[a],n++);o+=s.sizeInBytes,t.push(s)}}if(32768<o)for(var c=0,u=t.length-1,l=0,p=c,h=u;c<u;){if(32768<(l+=t[c].sizeInBytes+t[u].sizeInBytes)){var d=h-p+1;t.splice(p,d);break}p=c,h=u,c++,u--}}return t},ge);function ge(e,t){var i=de.call(this)||this;if(i.aiDataContract={id:T.Default,outerId:T.Default,typeName:T.Required,message:T.Required,hasFullStack:T.Default,stack:T.Default,parsedStack:T.Array},t instanceof Error){i.typeName=O.sanitizeString(e,t.name)||P.NotSpecified,i.message=O.sanitizeMessage(e,t.message)||P.NotSpecified;var n=t.stack;i.parsedStack=ge.parseStack(n),i.stack=O.sanitizeException(e,n),i.hasFullStack=P.isArray(i.parsedStack)&&0<i.parsedStack.length}else i.typeName=t.typeName,i.message=t.message,i.stack=t.stack,i.parsedStack=t.parsedStack,i.hasFullStack=t.hasFullStack;return i}var me,ve=(F(ye,me=re),ye.CreateFromInterface=function(e){return new ye(e,null)},ye.prototype.toInterface=function(){return{level:this.level,method:this.method,assembly:this.assembly,fileName:this.fileName,line:this.line}},ye.regex=/^([\s]+at)?(.*?)(\@|\s\(|\s)([^\(\@\n]+):([0-9]+):([0-9]+)(\)?)$/,ye.baseSize=58,ye);function ye(e,t){var i=me.call(this)||this;if(i.sizeInBytes=0,i.aiDataContract={level:T.Required,method:T.Required,assembly:T.Default,fileName:T.Default,line:T.Default},"string"==typeof e){var n=e;i.level=t,i.method="<no_method>",i.assembly=P.trim(n),i.fileName="",i.line=0;var o=n.match(ye.regex);o&&5<=o.length&&(i.method=P.trim(o[2])||i.method,i.fileName=P.trim(o[4]),i.line=parseInt(o[5])||0)}else i.level=e.level,i.method=e.method,i.assembly=e.assembly,i.fileName=e.fileName,i.line=e.line,i.sizeInBytes=0;return i.sizeInBytes+=i.method.length,i.sizeInBytes+=i.fileName.length,i.sizeInBytes+=i.assembly.length,i.sizeInBytes+=ye.baseSize,i.sizeInBytes+=i.level.toString().length,i.sizeInBytes+=i.line.toString().length,i}var xe,Se,Ie,Ne=(F(we,xe=ee),we);function we(){var e=xe.call(this)||this;return e.ver=2,e.metrics=[],e.properties={},e}(Ie=Se=Se||{})[Ie.Measurement=0]="Measurement",Ie[Ie.Aggregation=1]="Aggregation";var De,Ce=(F(Ee,De=function(){this.kind=Se.Measurement}),Ee);function Ee(){var e=null!==De&&De.apply(this,arguments)||this;return e.aiDataContract={name:T.Required,kind:T.Default,value:T.Required,count:T.Default,min:T.Default,max:T.Default,stdDev:T.Default},e}var _e;F(Ae,_e=Ne),Ae.envelopeType="Microsoft.ApplicationInsights.{0}.Metric",Ae.dataType="MetricData";function Ae(e,t,i,n,o,a,r){var s=_e.call(this)||this;s.aiDataContract={ver:T.Required,metrics:T.Required,properties:T.Default};var c=new Ce;return c.count=0<n?n:void 0,c.max=isNaN(a)||null===a?void 0:a,c.min=isNaN(o)||null===o?void 0:o,c.name=O.sanitizeString(e,t)||P.NotSpecified,c.value=i,s.metrics=[c],s.properties=O.sanitizeProperties(e,r),s}var be,ke=(F(Te,be=ie),Te);function Te(){var e=be.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var Ue,Me=(F(Le,Ue=ke),Le.envelopeType="Microsoft.ApplicationInsights.{0}.Pageview",Le.dataType="PageviewData",Le);function Le(e,t,i,n,o,a,r){var s=Ue.call(this)||this;return s.aiDataContract={ver:T.Required,name:T.Default,url:T.Default,duration:T.Default,properties:T.Default,measurements:T.Default,id:T.Default},s.id=O.sanitizeId(e,r),s.url=O.sanitizeUrl(e,i),s.name=O.sanitizeString(e,t)||P.NotSpecified,isNaN(n)||(s.duration=P.msToTimeSpan(n)),s.properties=O.sanitizeProperties(e,o),s.measurements=O.sanitizeMeasurements(e,a),s}var Re,Oe=(F(ze,Re=ee),ze);function ze(){var e=Re.call(this)||this;return e.ver=2,e.success=!0,e.properties={},e.measurements={},e}var Pe;F(Ge,Pe=Oe),Ge.envelopeType="Microsoft.ApplicationInsights.{0}.RemoteDependency",Ge.dataType="RemoteDependencyData";function Ge(e,t,i,n,o,a,r,s,c,u,l,p){void 0===c&&(c="Ajax");var h=Pe.call(this)||this;h.aiDataContract={id:T.Required,ver:T.Required,name:T.Default,resultCode:T.Default,duration:T.Default,success:T.Default,data:T.Default,target:T.Default,type:T.Default,properties:T.Default,measurements:T.Default,kind:T.Default,value:T.Default,count:T.Default,min:T.Default,max:T.Default,stdDev:T.Default,dependencyKind:T.Default,dependencySource:T.Default,commandName:T.Default,dependencyTypeName:T.Default},h.id=t,h.duration=P.msToTimeSpan(o),h.success=a,h.resultCode=r+"",h.type=O.sanitizeString(e,c);var d=W.ParseDependencyPath(e,i,s,n);return h.data=O.sanitizeUrl(e,n)||d.data,h.target=O.sanitizeString(e,d.target),u&&(h.target=h.target+" | "+u),h.name=O.sanitizeString(e,d.name),h.properties=O.sanitizeProperties(e,l),h.measurements=O.sanitizeMeasurements(e,p),h}var qe,je=(F(We,qe=ee),We);function We(){var e=qe.call(this)||this;return e.ver=2,e.properties={},e}var Ve;F(He,Ve=je),He.envelopeType="Microsoft.ApplicationInsights.{0}.Message",He.dataType="MessageData";function He(e,t,i,n){var o=Ve.call(this)||this;return o.aiDataContract={ver:T.Required,message:T.Required,severityLevel:T.Default,properties:T.Default},t=t||P.NotSpecified,o.message=O.sanitizeMessage(e,t),o.properties=O.sanitizeProperties(e,n),i&&(o.severityLevel=i),o}var Be,Xe=(F(Fe,Be=ke),Fe);function Fe(){var e=Be.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var Ke;F(Je,Ke=Xe),Je.envelopeType="Microsoft.ApplicationInsights.{0}.PageviewPerformance",Je.dataType="PageviewPerformanceData";function Je(e,t,i,n,o,a,r){var s=Ke.call(this)||this;return s.aiDataContract={ver:T.Required,name:T.Default,url:T.Default,duration:T.Default,perfTotal:T.Default,networkConnect:T.Default,sentRequest:T.Default,receivedResponse:T.Default,domProcessing:T.Default,properties:T.Default,measurements:T.Default},s.url=O.sanitizeUrl(e,i),s.name=O.sanitizeString(e,t)||P.NotSpecified,s.properties=O.sanitizeProperties(e,o),s.measurements=O.sanitizeMeasurements(e,a),r&&(s.domProcessing=r.domProcessing,s.duration=r.duration,s.networkConnect=r.networkConnect,s.perfTotal=r.perfTotal,s.receivedResponse=r.receivedResponse,s.sentRequest=r.sentRequest),s}var Qe,Ye,$e;F(Ze,Qe=Q);function Ze(e,t){var i=Qe.call(this)||this;return i.aiDataContract={baseType:T.Required,baseData:T.Required},i.baseType=e,i.baseData=t,i}($e=Ye=Ye||{})[$e.Verbose=0]="Verbose",$e[$e.Information=1]="Information",$e[$e.Warning=2]="Warning",$e[$e.Error=3]="Error",$e[$e.Critical=4]="Critical";var et=(tt.getConfig=function(e,t,i,n){var o;return void 0===n&&(n=!1),o=i&&e.extensionConfig&&e.extensionConfig[i]&&!c.isNullOrUndefined(e.extensionConfig[i][t])?e.extensionConfig[i][t]:e[t],c.isNullOrUndefined(o)?n:o},tt);function tt(){}var it=function(){this.applicationVersion="ai.application.ver",this.applicationBuild="ai.application.build",this.applicationTypeId="ai.application.typeId",this.applicationId="ai.application.applicationId",this.applicationLayer="ai.application.layer",this.deviceId="ai.device.id",this.deviceIp="ai.device.ip",this.deviceLanguage="ai.device.language",this.deviceLocale="ai.device.locale",this.deviceModel="ai.device.model",this.deviceFriendlyName="ai.device.friendlyName",this.deviceNetwork="ai.device.network",this.deviceNetworkName="ai.device.networkName",this.deviceOEMName="ai.device.oemName",this.deviceOS="ai.device.os",this.deviceOSVersion="ai.device.osVersion",this.deviceRoleInstance="ai.device.roleInstance",this.deviceRoleName="ai.device.roleName",this.deviceScreenResolution="ai.device.screenResolution",this.deviceType="ai.device.type",this.deviceMachineName="ai.device.machineName",this.deviceVMName="ai.device.vmName",this.deviceBrowser="ai.device.browser",this.deviceBrowserVersion="ai.device.browserVersion",this.locationIp="ai.location.ip",this.locationCountry="ai.location.country",this.locationProvince="ai.location.province",this.locationCity="ai.location.city",this.operationId="ai.operation.id",this.operationName="ai.operation.name",this.operationParentId="ai.operation.parentId",this.operationRootId="ai.operation.rootId",this.operationSyntheticSource="ai.operation.syntheticSource",this.operationCorrelationVector="ai.operation.correlationVector",this.sessionId="ai.session.id",this.sessionIsFirst="ai.session.isFirst",this.sessionIsNew="ai.session.isNew",this.userAccountAcquisitionDate="ai.user.accountAcquisitionDate",this.userAccountId="ai.user.accountId",this.userAgent="ai.user.userAgent",this.userId="ai.user.id",this.userStoreRegion="ai.user.storeRegion",this.userAuthUserId="ai.user.authUserId",this.userAnonymousUserAcquisitionDate="ai.user.anonUserAcquisitionDate",this.userAuthenticatedUserAcquisitionDate="ai.user.authUserAcquisitionDate",this.cloudName="ai.cloud.name",this.cloudRole="ai.cloud.role",this.cloudRoleVer="ai.cloud.roleVer",this.cloudRoleInstance="ai.cloud.roleInstance",this.cloudEnvironment="ai.cloud.environment",this.cloudLocation="ai.cloud.location",this.cloudDeploymentUnit="ai.cloud.deploymentUnit",this.internalNodeName="ai.internal.nodeName",this.internalSdkVersion="ai.internal.sdkVersion",this.internalAgentVersion="ai.internal.agentVersion"},nt=(ot.UserExt="user",ot.DeviceExt="device",ot.TraceExt="trace",ot.WebExt="web",ot.AppExt="app",ot.OSExt="os",ot.SessionExt="ses",ot.SDKExt="sdk",ot);function ot(){}var at=new it,rt=function(){},st=(ct.prototype.update=function(){this.automaticSession.id||this.initializeAutomaticSession();var e=H.Now(),t=e-this.automaticSession.acquisitionDate>this.config.sessionExpirationMs(),i=e-this.automaticSession.renewalDate>this.config.sessionRenewalMs();t||i?this.renew():(!this.cookieUpdatedTimestamp||e-this.cookieUpdatedTimestamp>ct.cookieUpdateInterval)&&(this.automaticSession.renewalDate=e,this.setCookie(this.automaticSession.id,this.automaticSession.acquisitionDate,this.automaticSession.renewalDate))},ct.prototype.backup=function(){this.setStorage(this.automaticSession.id,this.automaticSession.acquisitionDate,this.automaticSession.renewalDate)},ct.prototype.initializeAutomaticSession=function(){var e=P.getCookie(this._logger,this._storageNamePrefix());if(e&&"function"==typeof e.split)this.initializeAutomaticSessionWithData(e);else{var t=P.getStorage(this._logger,this._storageNamePrefix());t&&this.initializeAutomaticSessionWithData(t)}this.automaticSession.id||this.renew()},ct.prototype.initializeAutomaticSessionWithData=function(e){var t=e.split("|");0<t.length&&(this.automaticSession.id=t[0]);try{if(1<t.length){var i=+t[1];this.automaticSession.acquisitionDate=+new Date(i),this.automaticSession.acquisitionDate=0<this.automaticSession.acquisitionDate?this.automaticSession.acquisitionDate:0}if(2<t.length){var n=+t[2];this.automaticSession.renewalDate=+new Date(n),this.automaticSession.renewalDate=0<this.automaticSession.renewalDate?this.automaticSession.renewalDate:0}}catch(e){this._logger.throwInternal(s.CRITICAL,d,"Error parsing ai_session cookie, session will be reset: "+P.getExceptionName(e),{exception:P.dump(e)})}0==this.automaticSession.renewalDate&&this._logger.throwInternal(s.WARNING,g,"AI session renewal date is 0, session will be reset.")},ct.prototype.renew=function(){var e=H.Now();this.automaticSession.id=P.newId(),this.automaticSession.acquisitionDate=e,this.automaticSession.renewalDate=e,this.setCookie(this.automaticSession.id,this.automaticSession.acquisitionDate,this.automaticSession.renewalDate),P.canUseLocalStorage()||this._logger.throwInternal(s.WARNING,o,"Browser does not support local storage. Session durations will be inaccurate.")},ct.prototype.setCookie=function(e,t,i){var n=t+this.config.sessionExpirationMs(),o=i+this.config.sessionRenewalMs(),a=new Date,r=[e,t,i];n<o?a.setTime(n):a.setTime(o);var s=this.config.cookieDomain?this.config.cookieDomain():null;P.setCookie(this._logger,this._storageNamePrefix(),r.join("|")+";expires="+a.toUTCString(),s),this.cookieUpdatedTimestamp=H.Now()},ct.prototype.setStorage=function(e,t,i){P.setStorage(this._logger,this._storageNamePrefix(),[e,t,i].join("|"))},ct.acquisitionSpan=864e5,ct.renewalSpan=18e5,ct.cookieUpdateInterval=6e4,ct.cookieNameConst="ai_session",ct);function ct(e,t){var i=this;c.isNullOrUndefined(t)?this._logger=new _:this._logger=t,"function"!=typeof(e=e||{}).sessionExpirationMs&&(e.sessionExpirationMs=function(){return ct.acquisitionSpan}),"function"!=typeof e.sessionRenewalMs&&(e.sessionRenewalMs=function(){return ct.renewalSpan}),this.config=e,this._storageNamePrefix=function(){return i.config.namePrefix&&i.config.namePrefix()?ct.cookieNameConst+i.config.namePrefix():ct.cookieNameConst},this.automaticSession=new rt}var ut=function(){},lt=function(){this.id="browser",this.deviceClass="Browser"},pt=function(e){this.sdkVersion=(e.sdkExtension&&e.sdkExtension()?e.sdkExtension()+"_":"")+"javascript:2.2.2"},ht=(dt.prototype.setAuthenticatedUserContext=function(e,t,i){if(void 0===i&&(i=!1),!this.validateUserInput(e)||t&&!this.validateUserInput(t))this._logger.throwInternal(s.WARNING,S,"Setting auth user context failed. User auth/account id should be of type string, and not contain commas, semi-colons, equal signs, spaces, or vertical-bars.",!0);else{this.authenticatedId=e;var n=this.authenticatedId;t&&(this.accountId=t,n=[this.authenticatedId,this.accountId].join(dt.cookieSeparator)),i&&P.setCookie(this._logger,dt.authUserCookieName,encodeURI(n),this.config.cookieDomain())}},dt.prototype.clearAuthenticatedUserContext=function(){this.authenticatedId=null,this.accountId=null,P.deleteCookie(this._logger,dt.authUserCookieName)},dt.prototype.validateUserInput=function(e){return!("string"!=typeof e||!e||e.match(/,|;|=| |\|/))},dt.cookieSeparator="|",dt.userCookieName="ai_user",dt.authUserCookieName="ai_authUser",dt);function dt(e,t){this._logger=t;var i=P.getCookie(this._logger,dt.userCookieName);if(i){var n=i.split(dt.cookieSeparator);0<n.length&&(this.id=n[0])}if(this.config=e,!this.id){this.id=P.newId();var o=new Date,a=P.toISOStringForIE8(o);this.accountAcquisitionDate=a,o.setTime(o.getTime()+31536e6);var r=[this.id,a],s=this.config.cookieDomain?this.config.cookieDomain():void 0;P.setCookie(this._logger,dt.userCookieName,r.join(dt.cookieSeparator)+";expires="+o.toUTCString(),s);var c=e.namePrefix&&e.namePrefix()?e.namePrefix()+"ai_session":"ai_session";P.removeStorage(this._logger,c)}this.accountId=e.accountId?e.accountId():void 0;var u=P.getCookie(this._logger,dt.authUserCookieName);if(u){var l=(u=decodeURI(u)).split(dt.cookieSeparator);l[0]&&(this.authenticatedId=l[0]),1<l.length&&l[1]&&(this.accountId=l[1])}}var ft=function(){},gt=function(e,t,i){this.traceID=e||P.generateW3CId(),this.parentID=t,this.name=i,window&&window.location&&window.location.pathname&&(this.name=window.location.pathname)},mt=(vt.prototype.applySessionContext=function(e){var t=this.session||this.sessionManager.automaticSession;t&&"string"==typeof t.id&&(e.ext.app.sesId=t.id),this.session&&("string"==typeof this.session.id?e.ext.app.sesId=this.session.id:e.ext.app.sesId=this.sessionManager.automaticSession.id)},vt.prototype.applyOperatingSystemContxt=function(e){this.os&&this.os.name&&(e.ext.os=this.os)},vt.prototype.applyApplicationContext=function(e){this.application&&("string"==typeof this.application.ver&&(e.tags[at.applicationVersion]=this.application.ver),"string"==typeof this.application.build&&(e.tags[at.applicationBuild]=this.application.build))},vt.prototype.applyDeviceContext=function(e){this.device&&("string"==typeof this.device.id&&(e.ext.device.localId=this.device.id),"string"==typeof this.device.ip&&(e.ext.device.ip=this.device.ip),"string"==typeof this.device.model&&(e.ext.device.model=this.device.model),"string"==typeof this.device.deviceClass&&(e.ext.device.deviceClass=this.device.deviceClass))},vt.prototype.applyInternalContext=function(e){this.internal&&("string"==typeof this.internal.agentVersion&&(e.tags[at.internalAgentVersion]=this.internal.agentVersion),"string"==typeof this.internal.sdkVersion&&(e.tags[at.internalSdkVersion]=this.internal.sdkVersion))},vt.prototype.applyLocationContext=function(e){this.location&&"string"==typeof this.location.ip&&(e.tags[at.locationIp]=this.location.ip)},vt.prototype.applyOperationContext=function(e){if(this.telemetryTrace){var t=e.ext.trace||{traceID:void 0,parentID:void 0};"string"==typeof this.telemetryTrace.traceID&&(t.traceID=this.telemetryTrace.traceID),"string"==typeof this.telemetryTrace.name&&(t.name=this.telemetryTrace.name),"string"==typeof this.telemetryTrace.parentID&&(t.parentID=this.telemetryTrace.parentID),e.ext.trace=t}},vt.prototype.applyWebContext=function(e){this.web&&(e.ext.web=e.ext.web||{},e.ext.web=this.web)},vt.prototype.applyUserContext=function(e){this.user&&(e.tags||(e.tags=[]),"string"==typeof this.user.accountId&&(e.tags[at.userAccountId]=this.user.accountId),"string"==typeof this.user.id&&(e.ext.user.id=this.user.id),"string"==typeof this.user.authenticatedId&&(e.ext.user.authId=this.user.authenticatedId))},vt.prototype.cleanUp=function(e){e.ext[nt.DeviceExt]&&0===Object.keys(e.ext[nt.DeviceExt]).length&&delete e.ext[nt.DeviceExt],e.ext[nt.UserExt]&&0===Object.keys(e.ext[nt.UserExt]).length&&delete e.ext[nt.UserExt],e.ext[nt.WebExt]&&0===Object.keys(e.ext[nt.WebExt]).length&&delete e.ext[nt.WebExt],e.ext[nt.OSExt]&&0===Object.keys(e.ext[nt.OSExt]).length&&delete e.ext[nt.OSExt],e.ext[nt.AppExt]&&0===Object.keys(e.ext[nt.AppExt]).length&&delete e.ext[nt.AppExt],e.ext[nt.TraceExt]&&0===Object.keys(e.ext[nt.TraceExt]).length&&delete e.ext[nt.TraceExt]},vt);function vt(e,t){"undefined"!=typeof window&&(this.sessionManager=new st(t,e),this.application=new ut,this.device=new lt,this.internal=new pt(t),this.location=new ft,this.user=new ht(t,e),this.telemetryTrace=new gt,this.session=new rt),this.appId=function(){return null}}var yt=(xt.getDefaultConfig=function(){return{instrumentationKey:function(){},accountId:function(){return null},sessionRenewalMs:function(){return 18e5},samplingPercentage:function(){return 100},sessionExpirationMs:function(){return 864e5},cookieDomain:function(){return null},sdkExtension:function(){return null},isBrowserLinkTrackingEnabled:function(){return!1},appId:function(){return null},namePrefix:function(){}}},xt.prototype.initialize=function(t,e,i){var n=this,o=xt.getDefaultConfig();function a(e){r._extensionConfig[e]=function(){return et.getConfig(t,e,n.identifier,o[e]())}}this._extensionConfig=this._extensionConfig||xt.getDefaultConfig();var r=this;for(var s in o)a(s);this._logger=e.logger,this.context=new mt(e.logger,this._extensionConfig),this._breezeChannel=P.getExtension(i,"AppInsightsChannelPlugin"),this.context.appId=function(){return n._breezeChannel?n._breezeChannel._appId:null}},xt.prototype.processTelemetry=function(e){c.isNullOrUndefined(e)||(e.name===Me.envelopeType&&this._logger.resetInternalMessageCount(),this.context.session&&"string"!=typeof this.context.session.id&&this.context.sessionManager.update(),this._processTelemetryInternal(e),c.isNullOrUndefined(this._nextPlugin)||this._nextPlugin.processTelemetry(e))},xt.prototype.setNextPlugin=function(e){this._nextPlugin=e},xt.prototype._processTelemetryInternal=function(e){e.tags||(e.tags=[]),e.ext||(e.ext={}),e.ext[nt.DeviceExt]=e.ext[nt.DeviceExt]||{},e.ext[nt.WebExt]=e.ext[nt.WebExt]||{},e.ext[nt.UserExt]=e.ext[nt.UserExt]||{},e.ext[nt.OSExt]=e.ext[nt.OSExt]||{},e.ext[nt.AppExt]=e.ext[nt.AppExt]||{},e.ext[nt.TraceExt]=e.ext[nt.TraceExt]||{},this.context.applySessionContext(e),this.context.applyApplicationContext(e),this.context.applyDeviceContext(e),this.context.applyOperationContext(e),this.context.applyUserContext(e),this.context.applyOperatingSystemContxt(e),this.context.applyWebContext(e),this.context.applyLocationContext(e),this.context.applyInternalContext(e),this.context.cleanUp(e)},xt);function xt(){this.priority=110,this.identifier="AppInsightsPropertiesPlugin"}e.PropertiesPlugin=yt,e.TelemetryTrace=gt,e.TelemetryContext=mt,e.Session=rt,e.SessionManager=st,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e.Microsoft=e.Microsoft||{},e.Microsoft.ApplicationInsights={}))}(this,function(e){"use strict";var c=(t.isNullOrUndefined=function(e){return null==e},t.disableCookies=function(){t._canUseCookies=!1},t.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(n,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},t);function t(){}var s,i,n=/[xy]/g;o.prototype.processTelemetry=function(t){this.channelQueue.forEach(function(e){0<e.length&&e[0].processTelemetry(t)})},Object.defineProperty(o.prototype,"ChannelControls",{get:function(){return this.channelQueue},enumerable:!0,configurable:!0}),o.prototype.initialize=function(i,n,o){var a,r=this;i.isCookieUseDisabled&&c.disableCookies(),this.channelQueue=new Array,i.channels&&i.channels.forEach(function(e){if(e&&0<e.length){e=e.sort(function(e,t){return e.priority-t.priority});for(var t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);if(e.forEach(function(e){e.priority<500&&(a=e.identifier),e.initialize(i,n,o)}),a)throw Error("Channel has invalid priority"+a);r.channelQueue.push(e)}});for(var e=new Array,t=0;t<o.length;t++){var s=o[t];500<s.priority&&e.push(s)}if(0<e.length){for(e=e.sort(function(e,t){return e.priority-t.priority}),t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);e.forEach(function(e){return e.initialize(i,n,o)}),this.channelQueue.push(e)}};function o(){this.identifier="ChannelControllerPlugin",this.priority=500}(i=s=s||{})[i.CRITICAL=1]="CRITICAL",i[i.WARNING=2]="WARNING";var a=0,r=1,u=2,l=3,p=4,h=5,d=6,f=9,g=23,m=27,v=49,x=52,y=56,S=57,I=60,N=61,w=66,D=68,C=69,E=72,_=(A.sanitizeDiagnosticText=function(e){return'"'+e.replace(/\"/g,"")+'"'},A.dataType="MessageData",A.AiNonUserActionablePrefix="AI (Internal): ",A.AiUserActionablePrefix="AI: ",A);function A(e,t,i,n){void 0===i&&(i=!1),this.messageId=e,this.message=(i?A.AiUserActionablePrefix:A.AiNonUserActionablePrefix)+e;var o=(t?" message:"+A.sanitizeDiagnosticText(t):"")+(n?" props:"+A.sanitizeDiagnosticText(JSON.stringify(n)):"");this.message+=o}var b,k,T,U,M,L,R=(O.prototype.throwInternal=function(e,t,i,n,o){void 0===o&&(o=!1);var a=new _(t,i,o,n);if(this.enableDebugExceptions())throw a;if(void 0!==a&&a&&void 0!==a.message){if(o){var r=+a.messageId;(!this._messageLogged[r]||this.consoleLoggingLevel()>=s.WARNING)&&(this.warnToConsole(a.message),this._messageLogged[r]=!0)}else this.consoleLoggingLevel()>=s.WARNING&&this.warnToConsole(a.message);this.logInternalMessage(e,a)}},O.prototype.warnToConsole=function(e){"undefined"!=typeof console&&console&&("function"==typeof console.warn?console.warn(e):"function"==typeof console.log&&console.log(e))},O.prototype.resetInternalMessageCount=function(){this._messageCount=0,this._messageLogged={}},O.prototype.logInternalMessage=function(e,t){if(!this._areInternalMessagesThrottled()){var i=!0,n=this.AIInternalMessagePrefix+t.messageId;if(this._messageLogged[n]?i=!1:this._messageLogged[n]=!0,i&&(e<=this.telemetryLoggingLevel()&&(this.queue.push(t),this._messageCount++),this._messageCount===this.maxInternalMessageLimit())){var o="Internal events throttle limit per PageView reached for this app.",a=new _(g,o,!1);this.queue.push(a),this.warnToConsole(o)}}},O.prototype._areInternalMessagesThrottled=function(){return this._messageCount>=this.maxInternalMessageLimit()},O);function O(e){this.queue=[],this.AIInternalMessagePrefix="AITR_",this._messageCount=0,this._messageLogged={},this.enableDebugExceptions=function(){return!1},this.consoleLoggingLevel=function(){return 0},this.telemetryLoggingLevel=function(){return 1},this.maxInternalMessageLimit=function(){return 25},c.isNullOrUndefined(e)||(c.isNullOrUndefined(e.loggingLevelConsole)||(this.consoleLoggingLevel=function(){return e.loggingLevelConsole}),c.isNullOrUndefined(e.loggingLevelTelemetry)||(this.telemetryLoggingLevel=function(){return e.loggingLevelTelemetry}),c.isNullOrUndefined(e.maxMessageLimit)||(this.maxInternalMessageLimit=function(){return e.maxMessageLimit}),c.isNullOrUndefined(e.enableDebugExceptions)||(this.enableDebugExceptions=function(){return e.enableDebugExceptions}))}(k=b=b||{})[k.LocalStorage=0]="LocalStorage",k[k.SessionStorage=1]="SessionStorage",(U=T=T||{})[U.Default=0]="Default",U[U.Required=1]="Required",U[U.Array=2]="Array",U[U.Hidden=4]="Hidden",(L=M=M||{})[L.AI=0]="AI",L[L.AI_AND_W3C=1]="AI_AND_W3C",L[L.W3C=2]="W3C";var z=(P.sanitizeKeyAndAddUniqueness=function(e,t,i){var n=t.length,o=P.sanitizeKey(e,t);if(o.length!==n){for(var a=0,r=o;void 0!==i[r];)a++,r=o.substring(0,P.MAX_NAME_LENGTH-3)+P.padNumber(a);o=r}return o},P.sanitizeKey=function(e,t){var i;return t&&(t=P.trim(t.toString())).length>P.MAX_NAME_LENGTH&&(i=t.substring(0,P.MAX_NAME_LENGTH),e.throwInternal(s.WARNING,S,"name is too long. It has been truncated to "+P.MAX_NAME_LENGTH+" characters.",{name:t},!0)),i||t},P.sanitizeString=function(e,t,i){var n;return void 0===i&&(i=P.MAX_STRING_LENGTH),t&&(i=i||P.MAX_STRING_LENGTH,(t=P.trim(t)).toString().length>i&&(n=t.toString().substring(0,i),e.throwInternal(s.WARNING,N,"string value is too long. It has been truncated to "+i+" characters.",{value:t},!0))),n||t},P.sanitizeUrl=function(e,t){return P.sanitizeInput(e,t,P.MAX_URL_LENGTH,w)},P.sanitizeMessage=function(e,t){var i;return t&&t.length>P.MAX_MESSAGE_LENGTH&&(i=t.substring(0,P.MAX_MESSAGE_LENGTH),e.throwInternal(s.WARNING,y,"message is too long, it has been truncated to "+P.MAX_MESSAGE_LENGTH+" characters.",{message:t},!0)),i||t},P.sanitizeException=function(e,t){var i;return t&&t.length>P.MAX_EXCEPTION_LENGTH&&(i=t.substring(0,P.MAX_EXCEPTION_LENGTH),e.throwInternal(s.WARNING,x,"exception is too long, it has been truncated to "+P.MAX_EXCEPTION_LENGTH+" characters.",{exception:t},!0)),i||t},P.sanitizeProperties=function(t,e){if(e){var i={};for(var n in e){var o=e[n];if("object"==typeof o&&"undefined"!=typeof JSON)try{o=JSON.stringify(o)}catch(e){t.throwInternal(s.WARNING,v,"custom property is not valid",{exception:e},!0)}o=P.sanitizeString(t,o,P.MAX_PROPERTY_LENGTH),i[n=P.sanitizeKeyAndAddUniqueness(t,n,i)]=o}e=i}return e},P.sanitizeMeasurements=function(e,t){if(t){var i={};for(var n in t){var o=t[n];i[n=P.sanitizeKeyAndAddUniqueness(e,n,i)]=o}t=i}return t},P.sanitizeId=function(e,t){return t?P.sanitizeInput(e,t,P.MAX_ID_LENGTH,C).toString():t},P.sanitizeInput=function(e,t,i,n){var o;return t&&(t=P.trim(t)).length>i&&(o=t.substring(0,i),e.throwInternal(s.WARNING,n,"input is too long, it has been truncated to "+i+" characters.",{data:t},!0)),o||t},P.padNumber=function(e){var t="00"+e;return t.substr(t.length-3)},P.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},P.MAX_NAME_LENGTH=150,P.MAX_ID_LENGTH=128,P.MAX_PROPERTY_LENGTH=8192,P.MAX_STRING_LENGTH=1024,P.MAX_URL_LENGTH=2048,P.MAX_MESSAGE_LENGTH=32768,P.MAX_EXCEPTION_LENGTH=32768,P);function P(){}var G=(q.createDomEvent=function(e){var t=null;return"function"==typeof Event?t=new Event(e):(t=document.createEvent("Event")).initEvent(e,!0,!0),t},q.disableStorage=function(){q._canUseLocalStorage=!1,q._canUseSessionStorage=!1},q._getLocalStorageObject=function(){return q.canUseLocalStorage()?q._getVerifiedStorageObject(b.LocalStorage):null},q._getVerifiedStorageObject=function(e){var t,i,n=null;try{if("undefined"==typeof window)return null;i=new Date,(n=e===b.LocalStorage?window.localStorage:window.sessionStorage).setItem(i.toString(),i.toString()),t=n.getItem(i.toString())!==i.toString(),n.removeItem(i.toString()),t&&(n=null)}catch(e){n=null}return n},q.isInternalApplicationInsightsEndpoint=function(e){return-1!==q._internalEndpoints.indexOf(e.toLowerCase())},q.canUseLocalStorage=function(){return void 0===q._canUseLocalStorage&&(q._canUseLocalStorage=!!q._getVerifiedStorageObject(b.LocalStorage)),q._canUseLocalStorage},q.getStorage=function(t,e){var i=q._getLocalStorageObject();if(null!==i)try{return i.getItem(e)}catch(e){q._canUseLocalStorage=!1,t.throwInternal(s.WARNING,r,"Browser failed read of local storage. "+q.getExceptionName(e),{exception:q.dump(e)})}return null},q.setStorage=function(t,e,i){var n=q._getLocalStorageObject();if(null!==n)try{return n.setItem(e,i),!0}catch(e){q._canUseLocalStorage=!1,t.throwInternal(s.WARNING,l,"Browser failed write to local storage. "+q.getExceptionName(e),{exception:q.dump(e)})}return!1},q.removeStorage=function(t,e){var i=q._getLocalStorageObject();if(null!==i)try{return i.removeItem(e),!0}catch(e){q._canUseLocalStorage=!1,t.throwInternal(s.WARNING,h,"Browser failed removal of local storage item. "+q.getExceptionName(e),{exception:q.dump(e)})}return!1},q._getSessionStorageObject=function(){return q.canUseSessionStorage()?q._getVerifiedStorageObject(b.SessionStorage):null},q.canUseSessionStorage=function(){return void 0===q._canUseSessionStorage&&(q._canUseSessionStorage=!!q._getVerifiedStorageObject(b.SessionStorage)),q._canUseSessionStorage},q.getSessionStorageKeys=function(){var e=[];if(q.canUseSessionStorage())for(var t in window.sessionStorage)e.push(t);return e},q.getSessionStorage=function(t,e){var i=q._getSessionStorageObject();if(null!==i)try{return i.getItem(e)}catch(e){q._canUseSessionStorage=!1,t.throwInternal(s.WARNING,u,"Browser failed read of session storage. "+q.getExceptionName(e),{exception:q.dump(e)})}return null},q.setSessionStorage=function(t,e,i){var n=q._getSessionStorageObject();if(null!==n)try{return n.setItem(e,i),!0}catch(e){q._canUseSessionStorage=!1,t.throwInternal(s.WARNING,p,"Browser failed write to session storage. "+q.getExceptionName(e),{exception:q.dump(e)})}return!1},q.removeSessionStorage=function(t,e){var i=q._getSessionStorageObject();if(null!==i)try{return i.removeItem(e),!0}catch(e){q._canUseSessionStorage=!1,t.throwInternal(s.WARNING,d,"Browser failed removal of session storage item. "+q.getExceptionName(e),{exception:q.dump(e)})}return!1},q.disableCookies=function(){c.disableCookies()},q.canUseCookies=function(t){if(void 0===c._canUseCookies){c._canUseCookies=!1;try{c._canUseCookies=void 0!==q.document.cookie}catch(e){t.throwInternal(s.WARNING,D,"Cannot access document.cookie - "+q.getExceptionName(e),{exception:q.dump(e)})}}return c._canUseCookies},q.setCookie=function(e,t,i,n){var o="",a="";n&&(o=";domain="+n),q.document.location&&"https:"===q.document.location.protocol&&(a=";secure"),q.canUseCookies(e)&&(q.document.cookie=t+"="+i+o+";path=/"+a)},q.stringToBoolOrDefault=function(e,t){return void 0===t&&(t=!1),null==e?t:"true"===e.toString().toLowerCase()},q.getCookie=function(e,t){if(q.canUseCookies(e)){var i="";if(t&&t.length)for(var n=t+"=",o=q.document.cookie.split(";"),a=0;a<o.length;a++){var r=o[a];if((r=q.trim(r))&&0===r.indexOf(n)){i=r.substring(n.length,o[a].length);break}}return i}},q.deleteCookie=function(e,t){q.canUseCookies(e)&&(q.document.cookie=t+"=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;")},q.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},q.newId=function(){for(var e="",t=1073741824*Math.random();0<t;)e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t%64),t=Math.floor(t/64);return e},q.random32=function(){return 4294967296*Math.random()|0},q.generateW3CId=function(){for(var e,t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],i="",n=0;n<4;n++)i+=t[15&(e=q.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 o=t[8+4*Math.random()|0];return i.substr(0,8)+i.substr(9,4)+"4"+i.substr(13,3)+o+i.substr(16,3)+i.substr(19,12)},q.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},q.isError=function(e){return"[object Error]"===Object.prototype.toString.call(e)},q.isDate=function(e){return"[object Date]"===Object.prototype.toString.call(e)},q.toISOStringForIE8=function(e){if(q.isDate(e)){if(Date.prototype.toISOString)return e.toISOString();var t=function(e){var t=String(e);return 1===t.length&&(t="0"+t),t};return e.getUTCFullYear()+"-"+t(e.getUTCMonth()+1)+"-"+t(e.getUTCDate())+"T"+t(e.getUTCHours())+":"+t(e.getUTCMinutes())+":"+t(e.getUTCSeconds())+"."+String((e.getUTCMilliseconds()/1e3).toFixed(3)).slice(2,5)+"Z"}},q.getIEVersion=function(e){void 0===e&&(e=null);var t=e?e.toLowerCase():navigator.userAgent.toLowerCase();return-1!==t.indexOf("msie")?parseInt(t.split("msie")[1]):null},q.msToTimeSpan=function(e){(isNaN(e)||e<0)&&(e=0);var t=""+(e=Math.round(e))%1e3,i=""+Math.floor(e/1e3)%60,n=""+Math.floor(e/6e4)%60,o=""+Math.floor(e/36e5)%24,a=Math.floor(e/864e5);return t=1===t.length?"00"+t:2===t.length?"0"+t:t,i=i.length<2?"0"+i:i,n=n.length<2?"0"+n:n,(0<a?a+".":"")+(o=o.length<2?"0"+o:o)+":"+n+":"+i+"."+t},q.isCrossOriginError=function(e,t,i,n,o){return("Script error."===e||"Script error"===e)&&!o},q.dump=function(e){var t=Object.prototype.toString.call(e),i=JSON.stringify(e);return"[object Error]"===t&&(i="{ stack: '"+e.stack+"', message: '"+e.message+"', name: '"+e.name+"'"),t+i},q.getExceptionName=function(e){return"[object Error]"===Object.prototype.toString.call(e)?e.name:""},q.addEventHandler=function(e,t){if("undefined"==typeof window||!window||"string"!=typeof e||"function"!=typeof t)return!1;var i="on"+e;if(window.addEventListener)window.addEventListener(e,t,!1);else{if(!window.attachEvent)return!1;window.attachEvent(i,t)}return!0},q.IsBeaconApiSupported=function(){return"sendBeacon"in navigator&&navigator.sendBeacon},q.getExtension=function(e,t){for(var i=null,n=0;!i&&n<e.length;)e[n]&&e[n].identifier===t&&(i=e[n]),n++;return i},q.document="undefined"!=typeof document?document:{},q._canUseLocalStorage=void 0,q._canUseSessionStorage=void 0,q._internalEndpoints=["https://dc.services.visualstudio.com/v2/track","https://breeze.aimon.applicationinsights.io/v2/track","https://dc-int.services.visualstudio.com/v2/track"],q.NotSpecified="not_specified",q);function q(){}var j=(W.parseUrl=function(e){return W.htmlAnchorElement||(W.htmlAnchorElement=W.document.createElement?W.document.createElement("a"):{host:W.parseHost(e)}),W.htmlAnchorElement.href=e,W.htmlAnchorElement},W.getAbsoluteUrl=function(e){var t,i=W.parseUrl(e);return i&&(t=i.href),t},W.getPathName=function(e){var t,i=W.parseUrl(e);return i&&(t=i.pathname),t},W.getCompleteUrl=function(e,t){return e?e.toUpperCase()+" "+t:t},W.parseHost=function(e){var t=e.match(/:\/\/(www[0-9]?\.)?(.[^/:]+)/i);return null!=t&&2<t.length&&"string"==typeof t[2]&&0<t[2].length?t[2]:null},W.document="undefined"!=typeof document?document:{},W);function W(){}var V=(H.ParseDependencyPath=function(e,t,i,n){var o,a=n,r=n;if(t&&0<t.length){var s=j.parseUrl(t);if(o=s.host,!a)if(null!=s.pathname){var c=0===s.pathname.length?"/":s.pathname;"/"!==c.charAt(0)&&(c="/"+c),r=s.pathname,a=z.sanitizeString(e,i?i+" "+c:c)}else a=z.sanitizeString(e,t)}else a=o=n;return{target:o,name:a,data:r}},H);function H(){}var B=(X.Now="undefined"==typeof window?function(){return(new Date).getTime()}:window.performance&&window.performance.now&&window.performance.timing?function(){return window.performance.now()+window.performance.timing.navigationStart}:function(){return(new Date).getTime()},X.GetDuration=function(e,t){var i=null;return 0===e||0===t||c.isNullOrUndefined(e)||c.isNullOrUndefined(t)||(i=t-e),i},X);function X(){}var F=function(e,t){return(F=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};function K(e,t){function i(){this.constructor=e}F(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var J,Q=function(){return(Q=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var o in t=arguments[i])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},Y=(K($,J=function(){}),$);function $(){return J.call(this)||this}var Z;K(ee,Z=function(){this.ver=1,this.sampleRate=100,this.tags={}});function ee(e,t,i){var n=Z.call(this)||this;return n.name=z.sanitizeString(e,i)||G.NotSpecified,n.data=t,n.time=G.toISOStringForIE8(new Date),n.aiDataContract={time:T.Required,iKey:T.Required,name:T.Required,sampleRate:function(){return 100===n.sampleRate?T.Hidden:T.Required},tags:T.Required,data:T.Required},n}function te(){}var ie,ne=(K(oe,ie=te),oe);function oe(){var e=ie.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var ae;K(re,ae=ne),re.envelopeType="Microsoft.ApplicationInsights.{0}.Event",re.dataType="EventData";function re(e,t,i,n){var o=ae.call(this)||this;return o.aiDataContract={ver:T.Required,name:T.Required,properties:T.Default,measurements:T.Default},o.name=z.sanitizeString(e,t)||G.NotSpecified,o.properties=z.sanitizeProperties(e,i),o.measurements=z.sanitizeMeasurements(e,n),o}function se(){}var ce,ue=(K(le,ce=te),le);function le(){var e=ce.call(this)||this;return e.ver=2,e.exceptions=[],e.properties={},e.measurements={},e}function pe(){this.hasFullStack=!0,this.parsedStack=[]}var he;K(de,he=ue),de.CreateFromInterface=function(t,e){var i=e.exceptions&&e.exceptions.map(function(e){return ge.CreateFromInterface(t,e)});return new de(t,Q({},e,{exceptions:i}))},de.prototype.toInterface=function(){var e=this,t=e.exceptions,i=e.properties,n=e.measurements,o=e.severityLevel,a=(e.ver,e.problemGroup),r=e.id,s=e.isManual;return{ver:"4.0",exceptions:t instanceof Array&&t.map(function(e){return e.toInterface()})||void 0,severityLevel:o,properties:i,measurements:n,problemGroup:a,id:r,isManual:s}},de.CreateSimpleException=function(e,t,i,n,o,a){return{exceptions:[{hasFullStack:!0,message:e,stack:o,typeName:t}]}},de.envelopeType="Microsoft.ApplicationInsights.{0}.Exception",de.dataType="ExceptionData";function de(e,t,i,n,o,a){var r=he.call(this)||this;return r.aiDataContract={ver:T.Required,exceptions:T.Required,severityLevel:T.Default,properties:T.Default,measurements:T.Default},t instanceof Error?(r.exceptions=[new ge(e,t)],r.properties=z.sanitizeProperties(e,i),r.measurements=z.sanitizeMeasurements(e,n),o&&(r.severityLevel=o),a&&(r.id=a)):(r.exceptions=t.exceptions,r.properties=t.properties,r.measurements=t.measurements,t.severityLevel&&(r.severityLevel=t.severityLevel),t.id&&(r.id=t.id),t.problemGroup&&(r.problemGroup=t.problemGroup),r.ver=2,c.isNullOrUndefined(t.isManual)||(r.isManual=t.isManual)),r}var fe,ge=(K(me,fe=pe),me.prototype.toInterface=function(){var e=this.parsedStack instanceof Array&&this.parsedStack.map(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||void 0}},me.CreateFromInterface=function(e,t){var i=t.parsedStack instanceof Array&&t.parsedStack.map(function(e){return xe.CreateFromInterface(e)})||t.parsedStack;return new me(e,Q({},t,{parsedStack:i}))},me.parseStack=function(e){var t;if("string"==typeof e){var i=e.split("\n");t=[];for(var n=0,o=0,a=0;a<=i.length;a++){var r=i[a];if(xe.regex.test(r)){var s=new xe(i[a],n++);o+=s.sizeInBytes,t.push(s)}}if(32768<o)for(var c=0,u=t.length-1,l=0,p=c,h=u;c<u;){if(32768<(l+=t[c].sizeInBytes+t[u].sizeInBytes)){var d=h-p+1;t.splice(p,d);break}p=c,h=u,c++,u--}}return t},me);function me(e,t){var i=fe.call(this)||this;if(i.aiDataContract={id:T.Default,outerId:T.Default,typeName:T.Required,message:T.Required,hasFullStack:T.Default,stack:T.Default,parsedStack:T.Array},t instanceof Error){i.typeName=z.sanitizeString(e,t.name)||G.NotSpecified,i.message=z.sanitizeMessage(e,t.message)||G.NotSpecified;var n=t.stack;i.parsedStack=me.parseStack(n),i.stack=z.sanitizeException(e,n),i.hasFullStack=G.isArray(i.parsedStack)&&0<i.parsedStack.length}else i.typeName=t.typeName,i.message=t.message,i.stack=t.stack,i.parsedStack=t.parsedStack,i.hasFullStack=t.hasFullStack;return i}var ve,xe=(K(ye,ve=se),ye.CreateFromInterface=function(e){return new ye(e,null)},ye.prototype.toInterface=function(){return{level:this.level,method:this.method,assembly:this.assembly,fileName:this.fileName,line:this.line}},ye.regex=/^([\s]+at)?(.*?)(\@|\s\(|\s)([^\(\@\n]+):([0-9]+):([0-9]+)(\)?)$/,ye.baseSize=58,ye);function ye(e,t){var i=ve.call(this)||this;if(i.sizeInBytes=0,i.aiDataContract={level:T.Required,method:T.Required,assembly:T.Default,fileName:T.Default,line:T.Default},"string"==typeof e){var n=e;i.level=t,i.method="<no_method>",i.assembly=G.trim(n),i.fileName="",i.line=0;var o=n.match(ye.regex);o&&5<=o.length&&(i.method=G.trim(o[2])||i.method,i.fileName=G.trim(o[4]),i.line=parseInt(o[5])||0)}else i.level=e.level,i.method=e.method,i.assembly=e.assembly,i.fileName=e.fileName,i.line=e.line,i.sizeInBytes=0;return i.sizeInBytes+=i.method.length,i.sizeInBytes+=i.fileName.length,i.sizeInBytes+=i.assembly.length,i.sizeInBytes+=ye.baseSize,i.sizeInBytes+=i.level.toString().length,i.sizeInBytes+=i.line.toString().length,i}var Se,Ie,Ne,we=(K(De,Se=te),De);function De(){var e=Se.call(this)||this;return e.ver=2,e.metrics=[],e.properties={},e}(Ne=Ie=Ie||{})[Ne.Measurement=0]="Measurement",Ne[Ne.Aggregation=1]="Aggregation";var Ce,Ee=(K(_e,Ce=function(){this.kind=Ie.Measurement}),_e);function _e(){var e=null!==Ce&&Ce.apply(this,arguments)||this;return e.aiDataContract={name:T.Required,kind:T.Default,value:T.Required,count:T.Default,min:T.Default,max:T.Default,stdDev:T.Default},e}var Ae;K(be,Ae=we),be.envelopeType="Microsoft.ApplicationInsights.{0}.Metric",be.dataType="MetricData";function be(e,t,i,n,o,a,r){var s=Ae.call(this)||this;s.aiDataContract={ver:T.Required,metrics:T.Required,properties:T.Default};var c=new Ee;return c.count=0<n?n:void 0,c.max=isNaN(a)||null===a?void 0:a,c.min=isNaN(o)||null===o?void 0:o,c.name=z.sanitizeString(e,t)||G.NotSpecified,c.value=i,s.metrics=[c],s.properties=z.sanitizeProperties(e,r),s}var ke,Te=(K(Ue,ke=ne),Ue);function Ue(){var e=ke.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var Me,Le=(K(Re,Me=Te),Re.envelopeType="Microsoft.ApplicationInsights.{0}.Pageview",Re.dataType="PageviewData",Re);function Re(e,t,i,n,o,a,r){var s=Me.call(this)||this;return s.aiDataContract={ver:T.Required,name:T.Default,url:T.Default,duration:T.Default,properties:T.Default,measurements:T.Default,id:T.Default},s.id=z.sanitizeId(e,r),s.url=z.sanitizeUrl(e,i),s.name=z.sanitizeString(e,t)||G.NotSpecified,isNaN(n)||(s.duration=G.msToTimeSpan(n)),s.properties=z.sanitizeProperties(e,o),s.measurements=z.sanitizeMeasurements(e,a),s}var Oe,ze=(K(Pe,Oe=te),Pe);function Pe(){var e=Oe.call(this)||this;return e.ver=2,e.success=!0,e.properties={},e.measurements={},e}var Ge;K(qe,Ge=ze),qe.envelopeType="Microsoft.ApplicationInsights.{0}.RemoteDependency",qe.dataType="RemoteDependencyData";function qe(e,t,i,n,o,a,r,s,c,u,l,p){void 0===c&&(c="Ajax");var h=Ge.call(this)||this;h.aiDataContract={id:T.Required,ver:T.Required,name:T.Default,resultCode:T.Default,duration:T.Default,success:T.Default,data:T.Default,target:T.Default,type:T.Default,properties:T.Default,measurements:T.Default,kind:T.Default,value:T.Default,count:T.Default,min:T.Default,max:T.Default,stdDev:T.Default,dependencyKind:T.Default,dependencySource:T.Default,commandName:T.Default,dependencyTypeName:T.Default},h.id=t,h.duration=G.msToTimeSpan(o),h.success=a,h.resultCode=r+"",h.type=z.sanitizeString(e,c);var d=V.ParseDependencyPath(e,i,s,n);return h.data=z.sanitizeUrl(e,n)||d.data,h.target=z.sanitizeString(e,d.target),u&&(h.target=h.target+" | "+u),h.name=z.sanitizeString(e,d.name),h.properties=z.sanitizeProperties(e,l),h.measurements=z.sanitizeMeasurements(e,p),h}var je,We=(K(Ve,je=te),Ve);function Ve(){var e=je.call(this)||this;return e.ver=2,e.properties={},e}var He;K(Be,He=We),Be.envelopeType="Microsoft.ApplicationInsights.{0}.Message",Be.dataType="MessageData";function Be(e,t,i,n){var o=He.call(this)||this;return o.aiDataContract={ver:T.Required,message:T.Required,severityLevel:T.Default,properties:T.Default},t=t||G.NotSpecified,o.message=z.sanitizeMessage(e,t),o.properties=z.sanitizeProperties(e,n),i&&(o.severityLevel=i),o}var Xe,Fe=(K(Ke,Xe=Te),Ke);function Ke(){var e=Xe.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var Je;K(Qe,Je=Fe),Qe.envelopeType="Microsoft.ApplicationInsights.{0}.PageviewPerformance",Qe.dataType="PageviewPerformanceData";function Qe(e,t,i,n,o,a,r){var s=Je.call(this)||this;return s.aiDataContract={ver:T.Required,name:T.Default,url:T.Default,duration:T.Default,perfTotal:T.Default,networkConnect:T.Default,sentRequest:T.Default,receivedResponse:T.Default,domProcessing:T.Default,properties:T.Default,measurements:T.Default},s.url=z.sanitizeUrl(e,i),s.name=z.sanitizeString(e,t)||G.NotSpecified,s.properties=z.sanitizeProperties(e,o),s.measurements=z.sanitizeMeasurements(e,a),r&&(s.domProcessing=r.domProcessing,s.duration=r.duration,s.networkConnect=r.networkConnect,s.perfTotal=r.perfTotal,s.receivedResponse=r.receivedResponse,s.sentRequest=r.sentRequest),s}var Ye,$e,Ze;K(et,Ye=Y);function et(e,t){var i=Ye.call(this)||this;return i.aiDataContract={baseType:T.Required,baseData:T.Required},i.baseType=e,i.baseData=t,i}(Ze=$e=$e||{})[Ze.Verbose=0]="Verbose",Ze[Ze.Information=1]="Information",Ze[Ze.Warning=2]="Warning",Ze[Ze.Error=3]="Error",Ze[Ze.Critical=4]="Critical";var tt=(it.getConfig=function(e,t,i,n){var o;return void 0===n&&(n=!1),o=i&&e.extensionConfig&&e.extensionConfig[i]&&!c.isNullOrUndefined(e.extensionConfig[i][t])?e.extensionConfig[i][t]:e[t],c.isNullOrUndefined(o)?n:o},it);function it(){}var nt=function(){this.applicationVersion="ai.application.ver",this.applicationBuild="ai.application.build",this.applicationTypeId="ai.application.typeId",this.applicationId="ai.application.applicationId",this.applicationLayer="ai.application.layer",this.deviceId="ai.device.id",this.deviceIp="ai.device.ip",this.deviceLanguage="ai.device.language",this.deviceLocale="ai.device.locale",this.deviceModel="ai.device.model",this.deviceFriendlyName="ai.device.friendlyName",this.deviceNetwork="ai.device.network",this.deviceNetworkName="ai.device.networkName",this.deviceOEMName="ai.device.oemName",this.deviceOS="ai.device.os",this.deviceOSVersion="ai.device.osVersion",this.deviceRoleInstance="ai.device.roleInstance",this.deviceRoleName="ai.device.roleName",this.deviceScreenResolution="ai.device.screenResolution",this.deviceType="ai.device.type",this.deviceMachineName="ai.device.machineName",this.deviceVMName="ai.device.vmName",this.deviceBrowser="ai.device.browser",this.deviceBrowserVersion="ai.device.browserVersion",this.locationIp="ai.location.ip",this.locationCountry="ai.location.country",this.locationProvince="ai.location.province",this.locationCity="ai.location.city",this.operationId="ai.operation.id",this.operationName="ai.operation.name",this.operationParentId="ai.operation.parentId",this.operationRootId="ai.operation.rootId",this.operationSyntheticSource="ai.operation.syntheticSource",this.operationCorrelationVector="ai.operation.correlationVector",this.sessionId="ai.session.id",this.sessionIsFirst="ai.session.isFirst",this.sessionIsNew="ai.session.isNew",this.userAccountAcquisitionDate="ai.user.accountAcquisitionDate",this.userAccountId="ai.user.accountId",this.userAgent="ai.user.userAgent",this.userId="ai.user.id",this.userStoreRegion="ai.user.storeRegion",this.userAuthUserId="ai.user.authUserId",this.userAnonymousUserAcquisitionDate="ai.user.anonUserAcquisitionDate",this.userAuthenticatedUserAcquisitionDate="ai.user.authUserAcquisitionDate",this.cloudName="ai.cloud.name",this.cloudRole="ai.cloud.role",this.cloudRoleVer="ai.cloud.roleVer",this.cloudRoleInstance="ai.cloud.roleInstance",this.cloudEnvironment="ai.cloud.environment",this.cloudLocation="ai.cloud.location",this.cloudDeploymentUnit="ai.cloud.deploymentUnit",this.internalNodeName="ai.internal.nodeName",this.internalSdkVersion="ai.internal.sdkVersion",this.internalAgentVersion="ai.internal.agentVersion"},ot=(at.UserExt="user",at.DeviceExt="device",at.TraceExt="trace",at.WebExt="web",at.AppExt="app",at.OSExt="os",at.SessionExt="ses",at.SDKExt="sdk",at);function at(){}var rt=new nt,st=function(){},ct=(ut.prototype.update=function(){this.automaticSession.id||this.initializeAutomaticSession();var e=B.Now(),t=e-this.automaticSession.acquisitionDate>this.config.sessionExpirationMs(),i=e-this.automaticSession.renewalDate>this.config.sessionRenewalMs();t||i?this.renew():(!this.cookieUpdatedTimestamp||e-this.cookieUpdatedTimestamp>ut.cookieUpdateInterval)&&(this.automaticSession.renewalDate=e,this.setCookie(this.automaticSession.id,this.automaticSession.acquisitionDate,this.automaticSession.renewalDate))},ut.prototype.backup=function(){this.setStorage(this.automaticSession.id,this.automaticSession.acquisitionDate,this.automaticSession.renewalDate)},ut.prototype.initializeAutomaticSession=function(){var e=G.getCookie(this._logger,this._storageNamePrefix());if(e&&"function"==typeof e.split)this.initializeAutomaticSessionWithData(e);else{var t=G.getStorage(this._logger,this._storageNamePrefix());t&&this.initializeAutomaticSessionWithData(t)}this.automaticSession.id||this.renew()},ut.prototype.initializeAutomaticSessionWithData=function(e){var t=e.split("|");0<t.length&&(this.automaticSession.id=t[0]);try{if(1<t.length){var i=+t[1];this.automaticSession.acquisitionDate=+new Date(i),this.automaticSession.acquisitionDate=0<this.automaticSession.acquisitionDate?this.automaticSession.acquisitionDate:0}if(2<t.length){var n=+t[2];this.automaticSession.renewalDate=+new Date(n),this.automaticSession.renewalDate=0<this.automaticSession.renewalDate?this.automaticSession.renewalDate:0}}catch(e){this._logger.throwInternal(s.CRITICAL,f,"Error parsing ai_session cookie, session will be reset: "+G.getExceptionName(e),{exception:G.dump(e)})}0===this.automaticSession.renewalDate&&this._logger.throwInternal(s.WARNING,m,"AI session renewal date is 0, session will be reset.")},ut.prototype.renew=function(){var e=B.Now();this.automaticSession.id=G.newId(),this.automaticSession.acquisitionDate=e,this.automaticSession.renewalDate=e,this.setCookie(this.automaticSession.id,this.automaticSession.acquisitionDate,this.automaticSession.renewalDate),G.canUseLocalStorage()||this._logger.throwInternal(s.WARNING,a,"Browser does not support local storage. Session durations will be inaccurate.")},ut.prototype.setCookie=function(e,t,i){var n=t+this.config.sessionExpirationMs(),o=i+this.config.sessionRenewalMs(),a=new Date,r=[e,t,i];n<o?a.setTime(n):a.setTime(o);var s=this.config.cookieDomain?this.config.cookieDomain():null;G.setCookie(this._logger,this._storageNamePrefix(),r.join("|")+";expires="+a.toUTCString(),s),this.cookieUpdatedTimestamp=B.Now()},ut.prototype.setStorage=function(e,t,i){G.setStorage(this._logger,this._storageNamePrefix(),[e,t,i].join("|"))},ut.acquisitionSpan=864e5,ut.renewalSpan=18e5,ut.cookieUpdateInterval=6e4,ut.cookieNameConst="ai_session",ut);function ut(e,t){var i=this;c.isNullOrUndefined(t)?this._logger=new R:this._logger=t,"function"!=typeof(e=e||{}).sessionExpirationMs&&(e.sessionExpirationMs=function(){return ut.acquisitionSpan}),"function"!=typeof e.sessionRenewalMs&&(e.sessionRenewalMs=function(){return ut.renewalSpan}),this.config=e,this._storageNamePrefix=function(){return i.config.namePrefix&&i.config.namePrefix()?ut.cookieNameConst+i.config.namePrefix():ut.cookieNameConst},this.automaticSession=new st}var lt=function(){},pt=function(){this.id="browser",this.deviceClass="Browser"},ht=function(e){this.sdkVersion=(e.sdkExtension&&e.sdkExtension()?e.sdkExtension()+"_":"")+"javascript:2.2.3"},dt=(ft.prototype.setAuthenticatedUserContext=function(e,t,i){if(void 0===i&&(i=!1),!this.validateUserInput(e)||t&&!this.validateUserInput(t))this._logger.throwInternal(s.WARNING,I,"Setting auth user context failed. User auth/account id should be of type string, and not contain commas, semi-colons, equal signs, spaces, or vertical-bars.",!0);else{this.authenticatedId=e;var n=this.authenticatedId;t&&(this.accountId=t,n=[this.authenticatedId,this.accountId].join(ft.cookieSeparator)),i&&G.setCookie(this._logger,ft.authUserCookieName,encodeURI(n),this.config.cookieDomain())}},ft.prototype.clearAuthenticatedUserContext=function(){this.authenticatedId=null,this.accountId=null,G.deleteCookie(this._logger,ft.authUserCookieName)},ft.prototype.validateUserInput=function(e){return!("string"!=typeof e||!e||e.match(/,|;|=| |\|/))},ft.cookieSeparator="|",ft.userCookieName="ai_user",ft.authUserCookieName="ai_authUser",ft);function ft(e,t){this.isNewUser=!1,this._logger=t;var i=G.getCookie(this._logger,ft.userCookieName);if(i){this.isNewUser=!1;var n=i.split(ft.cookieSeparator);0<n.length&&(this.id=n[0])}if(this.config=e,!this.id){this.id=G.newId();var o=new Date,a=G.toISOStringForIE8(o);this.accountAcquisitionDate=a,this.isNewUser=!0,o.setTime(o.getTime()+31536e6);var r=[this.id,a],s=this.config.cookieDomain?this.config.cookieDomain():void 0;G.setCookie(this._logger,ft.userCookieName,r.join(ft.cookieSeparator)+";expires="+o.toUTCString(),s);var c=e.namePrefix&&e.namePrefix()?e.namePrefix()+"ai_session":"ai_session";G.removeStorage(this._logger,c)}this.accountId=e.accountId?e.accountId():void 0;var u=G.getCookie(this._logger,ft.authUserCookieName);if(u){var l=(u=decodeURI(u)).split(ft.cookieSeparator);l[0]&&(this.authenticatedId=l[0]),1<l.length&&l[1]&&(this.accountId=l[1])}}var gt=function(){},mt=function(e,t,i){this.traceID=e||G.generateW3CId(),this.parentID=t,this.name=i,window&&window.location&&window.location.pathname&&(this.name=window.location.pathname)},vt=(xt.prototype.applySessionContext=function(e){var t=this.session||this.sessionManager.automaticSession;t&&"string"==typeof t.id&&(e.ext.app.sesId=t.id),this.session&&("string"==typeof this.session.id?e.ext.app.sesId=this.session.id:e.ext.app.sesId=this.sessionManager.automaticSession.id)},xt.prototype.applyOperatingSystemContxt=function(e){this.os&&this.os.name&&(e.ext.os=this.os)},xt.prototype.applyApplicationContext=function(e){this.application&&("string"==typeof this.application.ver&&(e.tags[rt.applicationVersion]=this.application.ver),"string"==typeof this.application.build&&(e.tags[rt.applicationBuild]=this.application.build))},xt.prototype.applyDeviceContext=function(e){this.device&&("string"==typeof this.device.id&&(e.ext.device.localId=this.device.id),"string"==typeof this.device.ip&&(e.ext.device.ip=this.device.ip),"string"==typeof this.device.model&&(e.ext.device.model=this.device.model),"string"==typeof this.device.deviceClass&&(e.ext.device.deviceClass=this.device.deviceClass))},xt.prototype.applyInternalContext=function(e){this.internal&&("string"==typeof this.internal.agentVersion&&(e.tags[rt.internalAgentVersion]=this.internal.agentVersion),"string"==typeof this.internal.sdkVersion&&(e.tags[rt.internalSdkVersion]=this.internal.sdkVersion))},xt.prototype.applyLocationContext=function(e){this.location&&"string"==typeof this.location.ip&&(e.tags[rt.locationIp]=this.location.ip)},xt.prototype.applyOperationContext=function(e){if(this.telemetryTrace){var t=e.ext.trace||{traceID:void 0,parentID:void 0};"string"==typeof this.telemetryTrace.traceID&&(t.traceID=this.telemetryTrace.traceID),"string"==typeof this.telemetryTrace.name&&(t.name=this.telemetryTrace.name),"string"==typeof this.telemetryTrace.parentID&&(t.parentID=this.telemetryTrace.parentID),e.ext.trace=t}},xt.prototype.applyWebContext=function(e){this.web&&(e.ext.web=e.ext.web||{},e.ext.web=this.web)},xt.prototype.applyUserContext=function(e){this.user&&(e.tags||(e.tags=[]),"string"==typeof this.user.accountId&&(e.tags[rt.userAccountId]=this.user.accountId),"string"==typeof this.user.id&&(e.ext.user.id=this.user.id),"string"==typeof this.user.authenticatedId&&(e.ext.user.authId=this.user.authenticatedId))},xt.prototype.cleanUp=function(e){e.ext[ot.DeviceExt]&&0===Object.keys(e.ext[ot.DeviceExt]).length&&delete e.ext[ot.DeviceExt],e.ext[ot.UserExt]&&0===Object.keys(e.ext[ot.UserExt]).length&&delete e.ext[ot.UserExt],e.ext[ot.WebExt]&&0===Object.keys(e.ext[ot.WebExt]).length&&delete e.ext[ot.WebExt],e.ext[ot.OSExt]&&0===Object.keys(e.ext[ot.OSExt]).length&&delete e.ext[ot.OSExt],e.ext[ot.AppExt]&&0===Object.keys(e.ext[ot.AppExt]).length&&delete e.ext[ot.AppExt],e.ext[ot.TraceExt]&&0===Object.keys(e.ext[ot.TraceExt]).length&&delete e.ext[ot.TraceExt]},xt);function xt(e,t){"undefined"!=typeof window&&(this.sessionManager=new ct(t,e),this.application=new lt,this.device=new pt,this.internal=new ht(t),this.location=new gt,this.user=new dt(t,e),this.telemetryTrace=new mt,this.session=new st),this.appId=function(){return null}}var yt=(St.getDefaultConfig=function(){return{instrumentationKey:function(){},accountId:function(){return null},sessionRenewalMs:function(){return 18e5},samplingPercentage:function(){return 100},sessionExpirationMs:function(){return 864e5},cookieDomain:function(){return null},sdkExtension:function(){return null},isBrowserLinkTrackingEnabled:function(){return!1},appId:function(){return null},namePrefix:function(){}}},St.prototype.initialize=function(t,e,i){var n=this,o=St.getDefaultConfig();function a(e){r._extensionConfig[e]=function(){return tt.getConfig(t,e,n.identifier,o[e]())}}this._extensionConfig=this._extensionConfig||St.getDefaultConfig();var r=this;for(var s in o)a(s);this._logger=e.logger,this.context=new vt(e.logger,this._extensionConfig),this._breezeChannel=G.getExtension(i,"AppInsightsChannelPlugin"),this.context.appId=function(){return n._breezeChannel?n._breezeChannel._appId:null}},St.prototype.processTelemetry=function(e){if(c.isNullOrUndefined(e));else{if(e.name===Le.envelopeType&&this._logger.resetInternalMessageCount(),this.context.session&&"string"!=typeof this.context.session.id&&this.context.sessionManager.update(),this._processTelemetryInternal(e),this.context&&this.context.user&&this.context.user.isNewUser){this.context.user.isNewUser=!1;var t=new _(E,navigator.userAgent);this._logger.logInternalMessage(s.CRITICAL,t)}c.isNullOrUndefined(this._nextPlugin)||this._nextPlugin.processTelemetry(e)}},St.prototype.setNextPlugin=function(e){this._nextPlugin=e},St.prototype._processTelemetryInternal=function(e){e.tags||(e.tags=[]),e.ext||(e.ext={}),e.ext[ot.DeviceExt]=e.ext[ot.DeviceExt]||{},e.ext[ot.WebExt]=e.ext[ot.WebExt]||{},e.ext[ot.UserExt]=e.ext[ot.UserExt]||{},e.ext[ot.OSExt]=e.ext[ot.OSExt]||{},e.ext[ot.AppExt]=e.ext[ot.AppExt]||{},e.ext[ot.TraceExt]=e.ext[ot.TraceExt]||{},this.context.applySessionContext(e),this.context.applyApplicationContext(e),this.context.applyDeviceContext(e),this.context.applyOperationContext(e),this.context.applyUserContext(e),this.context.applyOperatingSystemContxt(e),this.context.applyWebContext(e),this.context.applyLocationContext(e),this.context.applyInternalContext(e),this.context.cleanUp(e)},St);function St(){this.priority=110,this.identifier="AppInsightsPropertiesPlugin"}e.PropertiesPlugin=yt,e.TelemetryTrace=mt,e.TelemetryContext=vt,e.Session=st,e.SessionManager=ct,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=applicationinsights-properties-js.min.js.map |
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
var Version = "2.2.2"; | ||
var Version = "2.2.3"; | ||
var Internal = /** @class */ (function () { | ||
/** | ||
* Constructs a new instance of the internal telemetry data class. | ||
*/ | ||
* Constructs a new instance of the internal telemetry data class. | ||
*/ | ||
function Internal(config) { | ||
@@ -9,0 +9,0 @@ this.sdkVersion = (config.sdkExtension && config.sdkExtension() ? config.sdkExtension() + "_" : "") + "javascript:" + Version; |
@@ -110,3 +110,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
} | ||
if (this.automaticSession.renewalDate == 0) { | ||
if (this.automaticSession.renewalDate === 0) { | ||
this._logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.SessionRenewalDateIsZero, "AI session renewal date is 0, session will be reset."); | ||
@@ -113,0 +113,0 @@ } |
@@ -7,6 +7,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
function User(config, logger) { | ||
this.isNewUser = false; | ||
this._logger = logger; | ||
//get userId or create new one if none exists | ||
// get userId or create new one if none exists | ||
var cookie = Util.getCookie(this._logger, User.userCookieName); | ||
if (cookie) { | ||
this.isNewUser = false; | ||
var params = cookie.split(User.cookieSeparator); | ||
@@ -23,2 +25,3 @@ if (params.length > 0) { | ||
this.accountAcquisitionDate = acqStr; | ||
this.isNewUser = true; | ||
// without expiration, cookies expire at the end of the session | ||
@@ -54,7 +57,7 @@ // set it to 365 days from now | ||
/** | ||
* Sets the authenticated user id and the account id in this session. | ||
* | ||
* @param authenticatedUserId {string} - The authenticated user id. A unique and persistent string that represents each authenticated user in the service. | ||
* @param accountId {string} - An optional string to represent the account associated with the authenticated user. | ||
*/ | ||
* Sets the authenticated user id and the account id in this session. | ||
* | ||
* @param authenticatedUserId {string} - The authenticated user id. A unique and persistent string that represents each authenticated user in the service. | ||
* @param accountId {string} - An optional string to represent the account associated with the authenticated user. | ||
*/ | ||
User.prototype.setAuthenticatedUserContext = function (authenticatedUserId, accountId, storeInCookie) { | ||
@@ -61,0 +64,0 @@ if (storeInCookie === void 0) { storeInCookie = false; } |
@@ -5,3 +5,3 @@ /** | ||
*/ | ||
import { CoreUtils } from '@microsoft/applicationinsights-core-js'; | ||
import { CoreUtils, _InternalLogMessage, LoggingSeverity, _InternalMessageId } from '@microsoft/applicationinsights-core-js'; | ||
import { TelemetryContext } from './TelemetryContext'; | ||
@@ -65,2 +65,7 @@ import { PageView, ConfigurationManager, BreezeChannelIdentifier, PropertiesPluginIdentifier, Extensions, Util } from '@microsoft/applicationinsights-common'; | ||
this._processTelemetryInternal(event); | ||
if (this.context && this.context.user && this.context.user.isNewUser) { | ||
this.context.user.isNewUser = false; | ||
var message = new _InternalLogMessage(_InternalMessageId.SendBrowserInfoOnUserInit, navigator.userAgent); | ||
this._logger.logInternalMessage(LoggingSeverity.CRITICAL, message); | ||
} | ||
if (!CoreUtils.isNullOrUndefined(this._nextPlugin)) { | ||
@@ -67,0 +72,0 @@ this._nextPlugin.processTelemetry(event); |
/*! | ||
* Application Insights JavaScript SDK - Properties Plugin, 2.2.2 | ||
* Application Insights JavaScript SDK - Properties Plugin, 2.2.3 | ||
* Copyright (c) Microsoft and contributors. All rights reserved. | ||
*/ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e.Microsoft=e.Microsoft||{},e.Microsoft.ApplicationInsights={}))}(this,function(e){"use strict";var c=(t.isNullOrUndefined=function(e){return null==e},t.disableCookies=function(){t._canUseCookies=!1},t.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(n,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},t);function t(){}var s,i,n=/[xy]/g;(i=s=s||{})[i.CRITICAL=1]="CRITICAL",i[i.WARNING=2]="WARNING";var o=0,a=1,r=2,u=3,l=4,p=5,h=6,d=9,f=23,g=27,m=49,v=52,y=56,x=57,S=60,I=61,N=66,w=68,D=69,C=(E.sanitizeDiagnosticText=function(e){return'"'+e.replace(/\"/g,"")+'"'},E.dataType="MessageData",E.AiNonUserActionablePrefix="AI (Internal): ",E.AiUserActionablePrefix="AI: ",E);function E(e,t,i,n){void 0===i&&(i=!1),this.messageId=e,this.message=(i?E.AiUserActionablePrefix:E.AiNonUserActionablePrefix)+e;var o=(t?" message:"+E.sanitizeDiagnosticText(t):"")+(n?" props:"+E.sanitizeDiagnosticText(JSON.stringify(n)):"");this.message+=o}var _=(A.prototype.throwInternal=function(e,t,i,n,o){void 0===o&&(o=!1);var a=new C(t,i,o,n);if(this.enableDebugExceptions())throw a;if(void 0!==a&&a&&void 0!==a.message){if(o){var r=+a.messageId;(!this._messageLogged[r]||this.consoleLoggingLevel()>=s.WARNING)&&(this.warnToConsole(a.message),this._messageLogged[r]=!0)}else this.consoleLoggingLevel()>=s.WARNING&&this.warnToConsole(a.message);this.logInternalMessage(e,a)}},A.prototype.warnToConsole=function(e){"undefined"!=typeof console&&console&&("function"==typeof console.warn?console.warn(e):"function"==typeof console.log&&console.log(e))},A.prototype.resetInternalMessageCount=function(){this._messageCount=0,this._messageLogged={}},A.prototype.logInternalMessage=function(e,t){if(!this._areInternalMessagesThrottled()){var i=!0,n=this.AIInternalMessagePrefix+t.messageId;if(this._messageLogged[n]?i=!1:this._messageLogged[n]=!0,i&&(e<=this.telemetryLoggingLevel()&&(this.queue.push(t),this._messageCount++),this._messageCount==this.maxInternalMessageLimit())){var o="Internal events throttle limit per PageView reached for this app.",a=new C(f,o,!1);this.queue.push(a),this.warnToConsole(o)}}},A.prototype._areInternalMessagesThrottled=function(){return this._messageCount>=this.maxInternalMessageLimit()},A);function A(e){this.AIInternalMessagePrefix="AITR_",this.enableDebugExceptions=function(){return!1},this.consoleLoggingLevel=function(){return 0},this.telemetryLoggingLevel=function(){return 1},this.maxInternalMessageLimit=function(){return 25},this.queue=[],this._messageCount=0,this._messageLogged={},c.isNullOrUndefined(e)||(c.isNullOrUndefined(e.loggingLevelConsole)||(this.consoleLoggingLevel=function(){return e.loggingLevelConsole}),c.isNullOrUndefined(e.loggingLevelTelemetry)||(this.telemetryLoggingLevel=function(){return e.loggingLevelTelemetry}),c.isNullOrUndefined(e.maxMessageLimit)||(this.maxInternalMessageLimit=function(){return e.maxMessageLimit}),c.isNullOrUndefined(e.enableDebugExceptions)||(this.enableDebugExceptions=function(){return e.enableDebugExceptions}))}var b,k,T,U,M,L;R.prototype.processTelemetry=function(t){this.channelQueue.forEach(function(e){0<e.length&&e[0].processTelemetry(t)})},Object.defineProperty(R.prototype,"ChannelControls",{get:function(){return this.channelQueue},enumerable:!0,configurable:!0}),R.prototype.initialize=function(i,n,o){var a=this;if(i.isCookieUseDisabled&&c.disableCookies(),this.channelQueue=new Array,i.channels){var r=void 0;i.channels.forEach(function(e){if(e&&0<e.length){e=e.sort(function(e,t){return e.priority-t.priority});for(var t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);if(e.forEach(function(e){e.priority<500&&(r=e.identifier),e.initialize(i,n,o)}),r)throw Error("Channel has invalid priority"+r);a.channelQueue.push(e)}})}for(var e=new Array,t=0;t<o.length;t++){var s=o[t];500<s.priority&&e.push(s)}if(0<e.length){for(e=e.sort(function(e,t){return e.priority-t.priority}),t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);e.forEach(function(e){return e.initialize(i,n,o)}),this.channelQueue.push(e)}};function R(){this.identifier="ChannelControllerPlugin",this.priority=500}(k=b=b||{})[k.LocalStorage=0]="LocalStorage",k[k.SessionStorage=1]="SessionStorage",(U=T=T||{})[U.Default=0]="Default",U[U.Required=1]="Required",U[U.Array=2]="Array",U[U.Hidden=4]="Hidden",(L=M=M||{})[L.AI=0]="AI",L[L.AI_AND_W3C=1]="AI_AND_W3C",L[L.W3C=2]="W3C";var O=(z.sanitizeKeyAndAddUniqueness=function(e,t,i){var n=t.length,o=z.sanitizeKey(e,t);if(o.length!==n){for(var a=0,r=o;void 0!==i[r];)a++,r=o.substring(0,z.MAX_NAME_LENGTH-3)+z.padNumber(a);o=r}return o},z.sanitizeKey=function(e,t){var i;return t&&(t=z.trim(t.toString())).length>z.MAX_NAME_LENGTH&&(i=t.substring(0,z.MAX_NAME_LENGTH),e.throwInternal(s.WARNING,x,"name is too long. It has been truncated to "+z.MAX_NAME_LENGTH+" characters.",{name:t},!0)),i||t},z.sanitizeString=function(e,t,i){var n;return void 0===i&&(i=z.MAX_STRING_LENGTH),t&&(i=i||z.MAX_STRING_LENGTH,(t=z.trim(t)).toString().length>i&&(n=t.toString().substring(0,i),e.throwInternal(s.WARNING,I,"string value is too long. It has been truncated to "+i+" characters.",{value:t},!0))),n||t},z.sanitizeUrl=function(e,t){return z.sanitizeInput(e,t,z.MAX_URL_LENGTH,N)},z.sanitizeMessage=function(e,t){var i;return t&&t.length>z.MAX_MESSAGE_LENGTH&&(i=t.substring(0,z.MAX_MESSAGE_LENGTH),e.throwInternal(s.WARNING,y,"message is too long, it has been truncated to "+z.MAX_MESSAGE_LENGTH+" characters.",{message:t},!0)),i||t},z.sanitizeException=function(e,t){var i;return t&&t.length>z.MAX_EXCEPTION_LENGTH&&(i=t.substring(0,z.MAX_EXCEPTION_LENGTH),e.throwInternal(s.WARNING,v,"exception is too long, it has been truncated to "+z.MAX_EXCEPTION_LENGTH+" characters.",{exception:t},!0)),i||t},z.sanitizeProperties=function(t,e){if(e){var i={};for(var n in e){var o=e[n];if("object"==typeof o&&"undefined"!=typeof JSON)try{o=JSON.stringify(o)}catch(e){t.throwInternal(s.WARNING,m,"custom property is not valid",{exception:e},!0)}o=z.sanitizeString(t,o,z.MAX_PROPERTY_LENGTH),i[n=z.sanitizeKeyAndAddUniqueness(t,n,i)]=o}e=i}return e},z.sanitizeMeasurements=function(e,t){if(t){var i={};for(var n in t){var o=t[n];i[n=z.sanitizeKeyAndAddUniqueness(e,n,i)]=o}t=i}return t},z.sanitizeId=function(e,t){return t?z.sanitizeInput(e,t,z.MAX_ID_LENGTH,D).toString():t},z.sanitizeInput=function(e,t,i,n){var o;return t&&(t=z.trim(t)).length>i&&(o=t.substring(0,i),e.throwInternal(s.WARNING,n,"input is too long, it has been truncated to "+i+" characters.",{data:t},!0)),o||t},z.padNumber=function(e){var t="00"+e;return t.substr(t.length-3)},z.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},z.MAX_NAME_LENGTH=150,z.MAX_ID_LENGTH=128,z.MAX_PROPERTY_LENGTH=8192,z.MAX_STRING_LENGTH=1024,z.MAX_URL_LENGTH=2048,z.MAX_MESSAGE_LENGTH=32768,z.MAX_EXCEPTION_LENGTH=32768,z);function z(){}var P=(G.createDomEvent=function(e){var t=null;return"function"==typeof Event?t=new Event(e):(t=document.createEvent("Event")).initEvent(e,!0,!0),t},G.disableStorage=function(){G._canUseLocalStorage=!1,G._canUseSessionStorage=!1},G._getLocalStorageObject=function(){return G.canUseLocalStorage()?G._getVerifiedStorageObject(b.LocalStorage):null},G._getVerifiedStorageObject=function(e){var t,i,n=null;try{if("undefined"==typeof window)return null;i=new Date,(n=e===b.LocalStorage?window.localStorage:window.sessionStorage).setItem(i,i),t=n.getItem(i)!=i,n.removeItem(i),t&&(n=null)}catch(e){n=null}return n},G.isInternalApplicationInsightsEndpoint=function(e){return-1!==G._internalEndpoints.indexOf(e.toLowerCase())},G.canUseLocalStorage=function(){return void 0===G._canUseLocalStorage&&(G._canUseLocalStorage=!!G._getVerifiedStorageObject(b.LocalStorage)),G._canUseLocalStorage},G.getStorage=function(t,e){var i=G._getLocalStorageObject();if(null!==i)try{return i.getItem(e)}catch(e){G._canUseLocalStorage=!1,t.throwInternal(s.WARNING,a,"Browser failed read of local storage. "+G.getExceptionName(e),{exception:G.dump(e)})}return null},G.setStorage=function(t,e,i){var n=G._getLocalStorageObject();if(null!==n)try{return n.setItem(e,i),!0}catch(e){G._canUseLocalStorage=!1,t.throwInternal(s.WARNING,u,"Browser failed write to local storage. "+G.getExceptionName(e),{exception:G.dump(e)})}return!1},G.removeStorage=function(t,e){var i=G._getLocalStorageObject();if(null!==i)try{return i.removeItem(e),!0}catch(e){G._canUseLocalStorage=!1,t.throwInternal(s.WARNING,p,"Browser failed removal of local storage item. "+G.getExceptionName(e),{exception:G.dump(e)})}return!1},G._getSessionStorageObject=function(){return G.canUseSessionStorage()?G._getVerifiedStorageObject(b.SessionStorage):null},G.canUseSessionStorage=function(){return void 0===G._canUseSessionStorage&&(G._canUseSessionStorage=!!G._getVerifiedStorageObject(b.SessionStorage)),G._canUseSessionStorage},G.getSessionStorageKeys=function(){var e=[];if(G.canUseSessionStorage())for(var t in window.sessionStorage)e.push(t);return e},G.getSessionStorage=function(t,e){var i=G._getSessionStorageObject();if(null!==i)try{return i.getItem(e)}catch(e){G._canUseSessionStorage=!1,t.throwInternal(s.WARNING,r,"Browser failed read of session storage. "+G.getExceptionName(e),{exception:G.dump(e)})}return null},G.setSessionStorage=function(t,e,i){var n=G._getSessionStorageObject();if(null!==n)try{return n.setItem(e,i),!0}catch(e){G._canUseSessionStorage=!1,t.throwInternal(s.WARNING,l,"Browser failed write to session storage. "+G.getExceptionName(e),{exception:G.dump(e)})}return!1},G.removeSessionStorage=function(t,e){var i=G._getSessionStorageObject();if(null!==i)try{return i.removeItem(e),!0}catch(e){G._canUseSessionStorage=!1,t.throwInternal(s.WARNING,h,"Browser failed removal of session storage item. "+G.getExceptionName(e),{exception:G.dump(e)})}return!1},G.disableCookies=function(){c.disableCookies()},G.canUseCookies=function(t){if(void 0===c._canUseCookies){c._canUseCookies=!1;try{c._canUseCookies=void 0!==G.document.cookie}catch(e){t.throwInternal(s.WARNING,w,"Cannot access document.cookie - "+G.getExceptionName(e),{exception:G.dump(e)})}}return c._canUseCookies},G.setCookie=function(e,t,i,n){var o="",a="";n&&(o=";domain="+n),G.document.location&&"https:"===G.document.location.protocol&&(a=";secure"),G.canUseCookies(e)&&(G.document.cookie=t+"="+i+o+";path=/"+a)},G.stringToBoolOrDefault=function(e,t){return void 0===t&&(t=!1),null==e?t:"true"===e.toString().toLowerCase()},G.getCookie=function(e,t){if(G.canUseCookies(e)){var i="";if(t&&t.length)for(var n=t+"=",o=G.document.cookie.split(";"),a=0;a<o.length;a++){var r=o[a];if((r=G.trim(r))&&0===r.indexOf(n)){i=r.substring(n.length,o[a].length);break}}return i}},G.deleteCookie=function(e,t){G.canUseCookies(e)&&(G.document.cookie=t+"=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;")},G.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},G.newId=function(){for(var e="",t=1073741824*Math.random();0<t;)e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t%64),t=Math.floor(t/64);return e},G.random32=function(){return 4294967296*Math.random()|0},G.generateW3CId=function(){for(var e,t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],i="",n=0;n<4;n++)i+=t[15&(e=G.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 o=t[8+4*Math.random()|0];return i.substr(0,8)+i.substr(9,4)+"4"+i.substr(13,3)+o+i.substr(16,3)+i.substr(19,12)},G.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},G.isError=function(e){return"[object Error]"===Object.prototype.toString.call(e)},G.isDate=function(e){return"[object Date]"===Object.prototype.toString.call(e)},G.toISOStringForIE8=function(e){if(G.isDate(e)){if(Date.prototype.toISOString)return e.toISOString();var t=function(e){var t=String(e);return 1===t.length&&(t="0"+t),t};return e.getUTCFullYear()+"-"+t(e.getUTCMonth()+1)+"-"+t(e.getUTCDate())+"T"+t(e.getUTCHours())+":"+t(e.getUTCMinutes())+":"+t(e.getUTCSeconds())+"."+String((e.getUTCMilliseconds()/1e3).toFixed(3)).slice(2,5)+"Z"}},G.getIEVersion=function(e){void 0===e&&(e=null);var t=e?e.toLowerCase():navigator.userAgent.toLowerCase();return-1!=t.indexOf("msie")?parseInt(t.split("msie")[1]):null},G.msToTimeSpan=function(e){(isNaN(e)||e<0)&&(e=0);var t=""+(e=Math.round(e))%1e3,i=""+Math.floor(e/1e3)%60,n=""+Math.floor(e/6e4)%60,o=""+Math.floor(e/36e5)%24,a=Math.floor(e/864e5);return t=1===t.length?"00"+t:2===t.length?"0"+t:t,i=i.length<2?"0"+i:i,n=n.length<2?"0"+n:n,(0<a?a+".":"")+(o=o.length<2?"0"+o:o)+":"+n+":"+i+"."+t},G.isCrossOriginError=function(e,t,i,n,o){return("Script error."===e||"Script error"===e)&&!o},G.dump=function(e){var t=Object.prototype.toString.call(e),i=JSON.stringify(e);return"[object Error]"===t&&(i="{ stack: '"+e.stack+"', message: '"+e.message+"', name: '"+e.name+"'"),t+i},G.getExceptionName=function(e){return"[object Error]"===Object.prototype.toString.call(e)?e.name:""},G.addEventHandler=function(e,t){if("undefined"==typeof window||!window||"string"!=typeof e||"function"!=typeof t)return!1;var i="on"+e;if(window.addEventListener)window.addEventListener(e,t,!1);else{if(!window.attachEvent)return!1;window.attachEvent(i,t)}return!0},G.IsBeaconApiSupported=function(){return"sendBeacon"in navigator&&navigator.sendBeacon},G.getExtension=function(e,t){for(var i=null,n=0;!i&&n<e.length;)e[n]&&e[n].identifier===t&&(i=e[n]),n++;return i},G.document="undefined"!=typeof document?document:{},G._canUseLocalStorage=void 0,G._canUseSessionStorage=void 0,G._internalEndpoints=["https://dc.services.visualstudio.com/v2/track","https://breeze.aimon.applicationinsights.io/v2/track","https://dc-int.services.visualstudio.com/v2/track"],G.NotSpecified="not_specified",G);function G(){}var q=(j.parseUrl=function(e){return j.htmlAnchorElement||(j.htmlAnchorElement=j.document.createElement?j.document.createElement("a"):{host:j.parseHost(e)}),j.htmlAnchorElement.href=e,j.htmlAnchorElement},j.getAbsoluteUrl=function(e){var t,i=j.parseUrl(e);return i&&(t=i.href),t},j.getPathName=function(e){var t,i=j.parseUrl(e);return i&&(t=i.pathname),t},j.getCompleteUrl=function(e,t){return e?e.toUpperCase()+" "+t:t},j.parseHost=function(e){var t=e.match(/:\/\/(www[0-9]?\.)?(.[^/:]+)/i);return null!=t&&2<t.length&&"string"==typeof t[2]&&0<t[2].length?t[2]:null},j.document="undefined"!=typeof document?document:{},j);function j(){}var W=(V.ParseDependencyPath=function(e,t,i,n){var o,a=n,r=n;if(t&&0<t.length){var s=q.parseUrl(t);if(o=s.host,!a)if(null!=s.pathname){var c=0===s.pathname.length?"/":s.pathname;"/"!==c.charAt(0)&&(c="/"+c),r=s.pathname,a=O.sanitizeString(e,i?i+" "+c:c)}else a=O.sanitizeString(e,t)}else a=o=n;return{target:o,name:a,data:r}},V);function V(){}var H=(B.Now="undefined"==typeof window?function(){return(new Date).getTime()}:window.performance&&window.performance.now&&window.performance.timing?function(){return window.performance.now()+window.performance.timing.navigationStart}:function(){return(new Date).getTime()},B.GetDuration=function(e,t){var i=null;return 0===e||0===t||c.isNullOrUndefined(e)||c.isNullOrUndefined(t)||(i=t-e),i},B);function B(){}var X=function(e,t){return(X=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};function F(e,t){function i(){this.constructor=e}X(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var K,J=function(){return(J=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var o in t=arguments[i])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},Q=(F(Y,K=function(){}),Y);function Y(){return K.call(this)||this}var $;F(Z,$=function(){this.ver=1,this.sampleRate=100,this.tags={}});function Z(e,t,i){var n=$.call(this)||this;return n.name=O.sanitizeString(e,i)||P.NotSpecified,n.data=t,n.time=P.toISOStringForIE8(new Date),n.aiDataContract={time:T.Required,iKey:T.Required,name:T.Required,sampleRate:function(){return 100==n.sampleRate?T.Hidden:T.Required},tags:T.Required,data:T.Required},n}function ee(){}var te,ie=(F(ne,te=ee),ne);function ne(){var e=te.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var oe;F(ae,oe=ie),ae.envelopeType="Microsoft.ApplicationInsights.{0}.Event",ae.dataType="EventData";function ae(e,t,i,n){var o=oe.call(this)||this;return o.aiDataContract={ver:T.Required,name:T.Required,properties:T.Default,measurements:T.Default},o.name=O.sanitizeString(e,t)||P.NotSpecified,o.properties=O.sanitizeProperties(e,i),o.measurements=O.sanitizeMeasurements(e,n),o}function re(){}var se,ce=(F(ue,se=ee),ue);function ue(){var e=se.call(this)||this;return e.ver=2,e.exceptions=[],e.properties={},e.measurements={},e}function le(){this.hasFullStack=!0,this.parsedStack=[]}var pe;F(he,pe=ce),he.CreateFromInterface=function(t,e){var i=e.exceptions&&e.exceptions.map(function(e){return fe.CreateFromInterface(t,e)});return new he(t,J({},e,{exceptions:i}))},he.prototype.toInterface=function(){var e=this,t=e.exceptions,i=e.properties,n=e.measurements,o=e.severityLevel,a=e.ver,r=e.problemGroup,s=e.id,c=e.isManual;return{ver:a,exceptions:t instanceof Array&&t.map(function(e){return e.toInterface()})||void 0,severityLevel:o,properties:i,measurements:n,problemGroup:r,id:s,isManual:c}},he.CreateSimpleException=function(e,t,i,n,o,a){return{exceptions:[{hasFullStack:!0,message:e,stack:o,typeName:t}]}},he.envelopeType="Microsoft.ApplicationInsights.{0}.Exception",he.dataType="ExceptionData";function he(e,t,i,n,o,a){var r=pe.call(this)||this;return r.aiDataContract={ver:T.Required,exceptions:T.Required,severityLevel:T.Default,properties:T.Default,measurements:T.Default},t instanceof Error?(r.exceptions=[new fe(e,t)],r.properties=O.sanitizeProperties(e,i),r.measurements=O.sanitizeMeasurements(e,n),o&&(r.severityLevel=o),a&&(r.id=a)):(r.exceptions=t.exceptions,r.properties=t.properties,r.measurements=t.measurements,t.severityLevel&&(r.severityLevel=t.severityLevel),t.id&&(r.id=t.id),t.problemGroup&&(r.problemGroup=t.problemGroup),c.isNullOrUndefined(t.ver)||(r.ver=t.ver),c.isNullOrUndefined(t.isManual)||(r.isManual=t.isManual)),r}var de,fe=(F(ge,de=le),ge.prototype.toInterface=function(){var e=this.parsedStack instanceof Array&&this.parsedStack.map(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||void 0}},ge.CreateFromInterface=function(e,t){var i=t.parsedStack instanceof Array&&t.parsedStack.map(function(e){return ve.CreateFromInterface(e)})||t.parsedStack;return new ge(e,J({},t,{parsedStack:i}))},ge.parseStack=function(e){var t=void 0;if("string"==typeof e){var i=e.split("\n");t=[];for(var n=0,o=0,a=0;a<=i.length;a++){var r=i[a];if(ve.regex.test(r)){var s=new ve(i[a],n++);o+=s.sizeInBytes,t.push(s)}}if(32768<o)for(var c=0,u=t.length-1,l=0,p=c,h=u;c<u;){if(32768<(l+=t[c].sizeInBytes+t[u].sizeInBytes)){var d=h-p+1;t.splice(p,d);break}p=c,h=u,c++,u--}}return t},ge);function ge(e,t){var i=de.call(this)||this;if(i.aiDataContract={id:T.Default,outerId:T.Default,typeName:T.Required,message:T.Required,hasFullStack:T.Default,stack:T.Default,parsedStack:T.Array},t instanceof Error){i.typeName=O.sanitizeString(e,t.name)||P.NotSpecified,i.message=O.sanitizeMessage(e,t.message)||P.NotSpecified;var n=t.stack;i.parsedStack=ge.parseStack(n),i.stack=O.sanitizeException(e,n),i.hasFullStack=P.isArray(i.parsedStack)&&0<i.parsedStack.length}else i.typeName=t.typeName,i.message=t.message,i.stack=t.stack,i.parsedStack=t.parsedStack,i.hasFullStack=t.hasFullStack;return i}var me,ve=(F(ye,me=re),ye.CreateFromInterface=function(e){return new ye(e,null)},ye.prototype.toInterface=function(){return{level:this.level,method:this.method,assembly:this.assembly,fileName:this.fileName,line:this.line}},ye.regex=/^([\s]+at)?(.*?)(\@|\s\(|\s)([^\(\@\n]+):([0-9]+):([0-9]+)(\)?)$/,ye.baseSize=58,ye);function ye(e,t){var i=me.call(this)||this;if(i.sizeInBytes=0,i.aiDataContract={level:T.Required,method:T.Required,assembly:T.Default,fileName:T.Default,line:T.Default},"string"==typeof e){var n=e;i.level=t,i.method="<no_method>",i.assembly=P.trim(n),i.fileName="",i.line=0;var o=n.match(ye.regex);o&&5<=o.length&&(i.method=P.trim(o[2])||i.method,i.fileName=P.trim(o[4]),i.line=parseInt(o[5])||0)}else i.level=e.level,i.method=e.method,i.assembly=e.assembly,i.fileName=e.fileName,i.line=e.line,i.sizeInBytes=0;return i.sizeInBytes+=i.method.length,i.sizeInBytes+=i.fileName.length,i.sizeInBytes+=i.assembly.length,i.sizeInBytes+=ye.baseSize,i.sizeInBytes+=i.level.toString().length,i.sizeInBytes+=i.line.toString().length,i}var xe,Se,Ie,Ne=(F(we,xe=ee),we);function we(){var e=xe.call(this)||this;return e.ver=2,e.metrics=[],e.properties={},e}(Ie=Se=Se||{})[Ie.Measurement=0]="Measurement",Ie[Ie.Aggregation=1]="Aggregation";var De,Ce=(F(Ee,De=function(){this.kind=Se.Measurement}),Ee);function Ee(){var e=null!==De&&De.apply(this,arguments)||this;return e.aiDataContract={name:T.Required,kind:T.Default,value:T.Required,count:T.Default,min:T.Default,max:T.Default,stdDev:T.Default},e}var _e;F(Ae,_e=Ne),Ae.envelopeType="Microsoft.ApplicationInsights.{0}.Metric",Ae.dataType="MetricData";function Ae(e,t,i,n,o,a,r){var s=_e.call(this)||this;s.aiDataContract={ver:T.Required,metrics:T.Required,properties:T.Default};var c=new Ce;return c.count=0<n?n:void 0,c.max=isNaN(a)||null===a?void 0:a,c.min=isNaN(o)||null===o?void 0:o,c.name=O.sanitizeString(e,t)||P.NotSpecified,c.value=i,s.metrics=[c],s.properties=O.sanitizeProperties(e,r),s}var be,ke=(F(Te,be=ie),Te);function Te(){var e=be.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var Ue,Me=(F(Le,Ue=ke),Le.envelopeType="Microsoft.ApplicationInsights.{0}.Pageview",Le.dataType="PageviewData",Le);function Le(e,t,i,n,o,a,r){var s=Ue.call(this)||this;return s.aiDataContract={ver:T.Required,name:T.Default,url:T.Default,duration:T.Default,properties:T.Default,measurements:T.Default,id:T.Default},s.id=O.sanitizeId(e,r),s.url=O.sanitizeUrl(e,i),s.name=O.sanitizeString(e,t)||P.NotSpecified,isNaN(n)||(s.duration=P.msToTimeSpan(n)),s.properties=O.sanitizeProperties(e,o),s.measurements=O.sanitizeMeasurements(e,a),s}var Re,Oe=(F(ze,Re=ee),ze);function ze(){var e=Re.call(this)||this;return e.ver=2,e.success=!0,e.properties={},e.measurements={},e}var Pe;F(Ge,Pe=Oe),Ge.envelopeType="Microsoft.ApplicationInsights.{0}.RemoteDependency",Ge.dataType="RemoteDependencyData";function Ge(e,t,i,n,o,a,r,s,c,u,l,p){void 0===c&&(c="Ajax");var h=Pe.call(this)||this;h.aiDataContract={id:T.Required,ver:T.Required,name:T.Default,resultCode:T.Default,duration:T.Default,success:T.Default,data:T.Default,target:T.Default,type:T.Default,properties:T.Default,measurements:T.Default,kind:T.Default,value:T.Default,count:T.Default,min:T.Default,max:T.Default,stdDev:T.Default,dependencyKind:T.Default,dependencySource:T.Default,commandName:T.Default,dependencyTypeName:T.Default},h.id=t,h.duration=P.msToTimeSpan(o),h.success=a,h.resultCode=r+"",h.type=O.sanitizeString(e,c);var d=W.ParseDependencyPath(e,i,s,n);return h.data=O.sanitizeUrl(e,n)||d.data,h.target=O.sanitizeString(e,d.target),u&&(h.target=h.target+" | "+u),h.name=O.sanitizeString(e,d.name),h.properties=O.sanitizeProperties(e,l),h.measurements=O.sanitizeMeasurements(e,p),h}var qe,je=(F(We,qe=ee),We);function We(){var e=qe.call(this)||this;return e.ver=2,e.properties={},e}var Ve;F(He,Ve=je),He.envelopeType="Microsoft.ApplicationInsights.{0}.Message",He.dataType="MessageData";function He(e,t,i,n){var o=Ve.call(this)||this;return o.aiDataContract={ver:T.Required,message:T.Required,severityLevel:T.Default,properties:T.Default},t=t||P.NotSpecified,o.message=O.sanitizeMessage(e,t),o.properties=O.sanitizeProperties(e,n),i&&(o.severityLevel=i),o}var Be,Xe=(F(Fe,Be=ke),Fe);function Fe(){var e=Be.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var Ke;F(Je,Ke=Xe),Je.envelopeType="Microsoft.ApplicationInsights.{0}.PageviewPerformance",Je.dataType="PageviewPerformanceData";function Je(e,t,i,n,o,a,r){var s=Ke.call(this)||this;return s.aiDataContract={ver:T.Required,name:T.Default,url:T.Default,duration:T.Default,perfTotal:T.Default,networkConnect:T.Default,sentRequest:T.Default,receivedResponse:T.Default,domProcessing:T.Default,properties:T.Default,measurements:T.Default},s.url=O.sanitizeUrl(e,i),s.name=O.sanitizeString(e,t)||P.NotSpecified,s.properties=O.sanitizeProperties(e,o),s.measurements=O.sanitizeMeasurements(e,a),r&&(s.domProcessing=r.domProcessing,s.duration=r.duration,s.networkConnect=r.networkConnect,s.perfTotal=r.perfTotal,s.receivedResponse=r.receivedResponse,s.sentRequest=r.sentRequest),s}var Qe,Ye,$e;F(Ze,Qe=Q);function Ze(e,t){var i=Qe.call(this)||this;return i.aiDataContract={baseType:T.Required,baseData:T.Required},i.baseType=e,i.baseData=t,i}($e=Ye=Ye||{})[$e.Verbose=0]="Verbose",$e[$e.Information=1]="Information",$e[$e.Warning=2]="Warning",$e[$e.Error=3]="Error",$e[$e.Critical=4]="Critical";var et=(tt.getConfig=function(e,t,i,n){var o;return void 0===n&&(n=!1),o=i&&e.extensionConfig&&e.extensionConfig[i]&&!c.isNullOrUndefined(e.extensionConfig[i][t])?e.extensionConfig[i][t]:e[t],c.isNullOrUndefined(o)?n:o},tt);function tt(){}var it=function(){this.applicationVersion="ai.application.ver",this.applicationBuild="ai.application.build",this.applicationTypeId="ai.application.typeId",this.applicationId="ai.application.applicationId",this.applicationLayer="ai.application.layer",this.deviceId="ai.device.id",this.deviceIp="ai.device.ip",this.deviceLanguage="ai.device.language",this.deviceLocale="ai.device.locale",this.deviceModel="ai.device.model",this.deviceFriendlyName="ai.device.friendlyName",this.deviceNetwork="ai.device.network",this.deviceNetworkName="ai.device.networkName",this.deviceOEMName="ai.device.oemName",this.deviceOS="ai.device.os",this.deviceOSVersion="ai.device.osVersion",this.deviceRoleInstance="ai.device.roleInstance",this.deviceRoleName="ai.device.roleName",this.deviceScreenResolution="ai.device.screenResolution",this.deviceType="ai.device.type",this.deviceMachineName="ai.device.machineName",this.deviceVMName="ai.device.vmName",this.deviceBrowser="ai.device.browser",this.deviceBrowserVersion="ai.device.browserVersion",this.locationIp="ai.location.ip",this.locationCountry="ai.location.country",this.locationProvince="ai.location.province",this.locationCity="ai.location.city",this.operationId="ai.operation.id",this.operationName="ai.operation.name",this.operationParentId="ai.operation.parentId",this.operationRootId="ai.operation.rootId",this.operationSyntheticSource="ai.operation.syntheticSource",this.operationCorrelationVector="ai.operation.correlationVector",this.sessionId="ai.session.id",this.sessionIsFirst="ai.session.isFirst",this.sessionIsNew="ai.session.isNew",this.userAccountAcquisitionDate="ai.user.accountAcquisitionDate",this.userAccountId="ai.user.accountId",this.userAgent="ai.user.userAgent",this.userId="ai.user.id",this.userStoreRegion="ai.user.storeRegion",this.userAuthUserId="ai.user.authUserId",this.userAnonymousUserAcquisitionDate="ai.user.anonUserAcquisitionDate",this.userAuthenticatedUserAcquisitionDate="ai.user.authUserAcquisitionDate",this.cloudName="ai.cloud.name",this.cloudRole="ai.cloud.role",this.cloudRoleVer="ai.cloud.roleVer",this.cloudRoleInstance="ai.cloud.roleInstance",this.cloudEnvironment="ai.cloud.environment",this.cloudLocation="ai.cloud.location",this.cloudDeploymentUnit="ai.cloud.deploymentUnit",this.internalNodeName="ai.internal.nodeName",this.internalSdkVersion="ai.internal.sdkVersion",this.internalAgentVersion="ai.internal.agentVersion"},nt=(ot.UserExt="user",ot.DeviceExt="device",ot.TraceExt="trace",ot.WebExt="web",ot.AppExt="app",ot.OSExt="os",ot.SessionExt="ses",ot.SDKExt="sdk",ot);function ot(){}var at=new it,rt=function(){},st=(ct.prototype.update=function(){this.automaticSession.id||this.initializeAutomaticSession();var e=H.Now(),t=e-this.automaticSession.acquisitionDate>this.config.sessionExpirationMs(),i=e-this.automaticSession.renewalDate>this.config.sessionRenewalMs();t||i?this.renew():(!this.cookieUpdatedTimestamp||e-this.cookieUpdatedTimestamp>ct.cookieUpdateInterval)&&(this.automaticSession.renewalDate=e,this.setCookie(this.automaticSession.id,this.automaticSession.acquisitionDate,this.automaticSession.renewalDate))},ct.prototype.backup=function(){this.setStorage(this.automaticSession.id,this.automaticSession.acquisitionDate,this.automaticSession.renewalDate)},ct.prototype.initializeAutomaticSession=function(){var e=P.getCookie(this._logger,this._storageNamePrefix());if(e&&"function"==typeof e.split)this.initializeAutomaticSessionWithData(e);else{var t=P.getStorage(this._logger,this._storageNamePrefix());t&&this.initializeAutomaticSessionWithData(t)}this.automaticSession.id||this.renew()},ct.prototype.initializeAutomaticSessionWithData=function(e){var t=e.split("|");0<t.length&&(this.automaticSession.id=t[0]);try{if(1<t.length){var i=+t[1];this.automaticSession.acquisitionDate=+new Date(i),this.automaticSession.acquisitionDate=0<this.automaticSession.acquisitionDate?this.automaticSession.acquisitionDate:0}if(2<t.length){var n=+t[2];this.automaticSession.renewalDate=+new Date(n),this.automaticSession.renewalDate=0<this.automaticSession.renewalDate?this.automaticSession.renewalDate:0}}catch(e){this._logger.throwInternal(s.CRITICAL,d,"Error parsing ai_session cookie, session will be reset: "+P.getExceptionName(e),{exception:P.dump(e)})}0==this.automaticSession.renewalDate&&this._logger.throwInternal(s.WARNING,g,"AI session renewal date is 0, session will be reset.")},ct.prototype.renew=function(){var e=H.Now();this.automaticSession.id=P.newId(),this.automaticSession.acquisitionDate=e,this.automaticSession.renewalDate=e,this.setCookie(this.automaticSession.id,this.automaticSession.acquisitionDate,this.automaticSession.renewalDate),P.canUseLocalStorage()||this._logger.throwInternal(s.WARNING,o,"Browser does not support local storage. Session durations will be inaccurate.")},ct.prototype.setCookie=function(e,t,i){var n=t+this.config.sessionExpirationMs(),o=i+this.config.sessionRenewalMs(),a=new Date,r=[e,t,i];n<o?a.setTime(n):a.setTime(o);var s=this.config.cookieDomain?this.config.cookieDomain():null;P.setCookie(this._logger,this._storageNamePrefix(),r.join("|")+";expires="+a.toUTCString(),s),this.cookieUpdatedTimestamp=H.Now()},ct.prototype.setStorage=function(e,t,i){P.setStorage(this._logger,this._storageNamePrefix(),[e,t,i].join("|"))},ct.acquisitionSpan=864e5,ct.renewalSpan=18e5,ct.cookieUpdateInterval=6e4,ct.cookieNameConst="ai_session",ct);function ct(e,t){var i=this;c.isNullOrUndefined(t)?this._logger=new _:this._logger=t,"function"!=typeof(e=e||{}).sessionExpirationMs&&(e.sessionExpirationMs=function(){return ct.acquisitionSpan}),"function"!=typeof e.sessionRenewalMs&&(e.sessionRenewalMs=function(){return ct.renewalSpan}),this.config=e,this._storageNamePrefix=function(){return i.config.namePrefix&&i.config.namePrefix()?ct.cookieNameConst+i.config.namePrefix():ct.cookieNameConst},this.automaticSession=new rt}var ut=function(){},lt=function(){this.id="browser",this.deviceClass="Browser"},pt=function(e){this.sdkVersion=(e.sdkExtension&&e.sdkExtension()?e.sdkExtension()+"_":"")+"javascript:2.2.2"},ht=(dt.prototype.setAuthenticatedUserContext=function(e,t,i){if(void 0===i&&(i=!1),!this.validateUserInput(e)||t&&!this.validateUserInput(t))this._logger.throwInternal(s.WARNING,S,"Setting auth user context failed. User auth/account id should be of type string, and not contain commas, semi-colons, equal signs, spaces, or vertical-bars.",!0);else{this.authenticatedId=e;var n=this.authenticatedId;t&&(this.accountId=t,n=[this.authenticatedId,this.accountId].join(dt.cookieSeparator)),i&&P.setCookie(this._logger,dt.authUserCookieName,encodeURI(n),this.config.cookieDomain())}},dt.prototype.clearAuthenticatedUserContext=function(){this.authenticatedId=null,this.accountId=null,P.deleteCookie(this._logger,dt.authUserCookieName)},dt.prototype.validateUserInput=function(e){return!("string"!=typeof e||!e||e.match(/,|;|=| |\|/))},dt.cookieSeparator="|",dt.userCookieName="ai_user",dt.authUserCookieName="ai_authUser",dt);function dt(e,t){this._logger=t;var i=P.getCookie(this._logger,dt.userCookieName);if(i){var n=i.split(dt.cookieSeparator);0<n.length&&(this.id=n[0])}if(this.config=e,!this.id){this.id=P.newId();var o=new Date,a=P.toISOStringForIE8(o);this.accountAcquisitionDate=a,o.setTime(o.getTime()+31536e6);var r=[this.id,a],s=this.config.cookieDomain?this.config.cookieDomain():void 0;P.setCookie(this._logger,dt.userCookieName,r.join(dt.cookieSeparator)+";expires="+o.toUTCString(),s);var c=e.namePrefix&&e.namePrefix()?e.namePrefix()+"ai_session":"ai_session";P.removeStorage(this._logger,c)}this.accountId=e.accountId?e.accountId():void 0;var u=P.getCookie(this._logger,dt.authUserCookieName);if(u){var l=(u=decodeURI(u)).split(dt.cookieSeparator);l[0]&&(this.authenticatedId=l[0]),1<l.length&&l[1]&&(this.accountId=l[1])}}var ft=function(){},gt=function(e,t,i){this.traceID=e||P.generateW3CId(),this.parentID=t,this.name=i,window&&window.location&&window.location.pathname&&(this.name=window.location.pathname)},mt=(vt.prototype.applySessionContext=function(e){var t=this.session||this.sessionManager.automaticSession;t&&"string"==typeof t.id&&(e.ext.app.sesId=t.id),this.session&&("string"==typeof this.session.id?e.ext.app.sesId=this.session.id:e.ext.app.sesId=this.sessionManager.automaticSession.id)},vt.prototype.applyOperatingSystemContxt=function(e){this.os&&this.os.name&&(e.ext.os=this.os)},vt.prototype.applyApplicationContext=function(e){this.application&&("string"==typeof this.application.ver&&(e.tags[at.applicationVersion]=this.application.ver),"string"==typeof this.application.build&&(e.tags[at.applicationBuild]=this.application.build))},vt.prototype.applyDeviceContext=function(e){this.device&&("string"==typeof this.device.id&&(e.ext.device.localId=this.device.id),"string"==typeof this.device.ip&&(e.ext.device.ip=this.device.ip),"string"==typeof this.device.model&&(e.ext.device.model=this.device.model),"string"==typeof this.device.deviceClass&&(e.ext.device.deviceClass=this.device.deviceClass))},vt.prototype.applyInternalContext=function(e){this.internal&&("string"==typeof this.internal.agentVersion&&(e.tags[at.internalAgentVersion]=this.internal.agentVersion),"string"==typeof this.internal.sdkVersion&&(e.tags[at.internalSdkVersion]=this.internal.sdkVersion))},vt.prototype.applyLocationContext=function(e){this.location&&"string"==typeof this.location.ip&&(e.tags[at.locationIp]=this.location.ip)},vt.prototype.applyOperationContext=function(e){if(this.telemetryTrace){var t=e.ext.trace||{traceID:void 0,parentID:void 0};"string"==typeof this.telemetryTrace.traceID&&(t.traceID=this.telemetryTrace.traceID),"string"==typeof this.telemetryTrace.name&&(t.name=this.telemetryTrace.name),"string"==typeof this.telemetryTrace.parentID&&(t.parentID=this.telemetryTrace.parentID),e.ext.trace=t}},vt.prototype.applyWebContext=function(e){this.web&&(e.ext.web=e.ext.web||{},e.ext.web=this.web)},vt.prototype.applyUserContext=function(e){this.user&&(e.tags||(e.tags=[]),"string"==typeof this.user.accountId&&(e.tags[at.userAccountId]=this.user.accountId),"string"==typeof this.user.id&&(e.ext.user.id=this.user.id),"string"==typeof this.user.authenticatedId&&(e.ext.user.authId=this.user.authenticatedId))},vt.prototype.cleanUp=function(e){e.ext[nt.DeviceExt]&&0===Object.keys(e.ext[nt.DeviceExt]).length&&delete e.ext[nt.DeviceExt],e.ext[nt.UserExt]&&0===Object.keys(e.ext[nt.UserExt]).length&&delete e.ext[nt.UserExt],e.ext[nt.WebExt]&&0===Object.keys(e.ext[nt.WebExt]).length&&delete e.ext[nt.WebExt],e.ext[nt.OSExt]&&0===Object.keys(e.ext[nt.OSExt]).length&&delete e.ext[nt.OSExt],e.ext[nt.AppExt]&&0===Object.keys(e.ext[nt.AppExt]).length&&delete e.ext[nt.AppExt],e.ext[nt.TraceExt]&&0===Object.keys(e.ext[nt.TraceExt]).length&&delete e.ext[nt.TraceExt]},vt);function vt(e,t){"undefined"!=typeof window&&(this.sessionManager=new st(t,e),this.application=new ut,this.device=new lt,this.internal=new pt(t),this.location=new ft,this.user=new ht(t,e),this.telemetryTrace=new gt,this.session=new rt),this.appId=function(){return null}}var yt=(xt.getDefaultConfig=function(){return{instrumentationKey:function(){},accountId:function(){return null},sessionRenewalMs:function(){return 18e5},samplingPercentage:function(){return 100},sessionExpirationMs:function(){return 864e5},cookieDomain:function(){return null},sdkExtension:function(){return null},isBrowserLinkTrackingEnabled:function(){return!1},appId:function(){return null},namePrefix:function(){}}},xt.prototype.initialize=function(t,e,i){var n=this,o=xt.getDefaultConfig();function a(e){r._extensionConfig[e]=function(){return et.getConfig(t,e,n.identifier,o[e]())}}this._extensionConfig=this._extensionConfig||xt.getDefaultConfig();var r=this;for(var s in o)a(s);this._logger=e.logger,this.context=new mt(e.logger,this._extensionConfig),this._breezeChannel=P.getExtension(i,"AppInsightsChannelPlugin"),this.context.appId=function(){return n._breezeChannel?n._breezeChannel._appId:null}},xt.prototype.processTelemetry=function(e){c.isNullOrUndefined(e)||(e.name===Me.envelopeType&&this._logger.resetInternalMessageCount(),this.context.session&&"string"!=typeof this.context.session.id&&this.context.sessionManager.update(),this._processTelemetryInternal(e),c.isNullOrUndefined(this._nextPlugin)||this._nextPlugin.processTelemetry(e))},xt.prototype.setNextPlugin=function(e){this._nextPlugin=e},xt.prototype._processTelemetryInternal=function(e){e.tags||(e.tags=[]),e.ext||(e.ext={}),e.ext[nt.DeviceExt]=e.ext[nt.DeviceExt]||{},e.ext[nt.WebExt]=e.ext[nt.WebExt]||{},e.ext[nt.UserExt]=e.ext[nt.UserExt]||{},e.ext[nt.OSExt]=e.ext[nt.OSExt]||{},e.ext[nt.AppExt]=e.ext[nt.AppExt]||{},e.ext[nt.TraceExt]=e.ext[nt.TraceExt]||{},this.context.applySessionContext(e),this.context.applyApplicationContext(e),this.context.applyDeviceContext(e),this.context.applyOperationContext(e),this.context.applyUserContext(e),this.context.applyOperatingSystemContxt(e),this.context.applyWebContext(e),this.context.applyLocationContext(e),this.context.applyInternalContext(e),this.context.cleanUp(e)},xt);function xt(){this.priority=110,this.identifier="AppInsightsPropertiesPlugin"}e.PropertiesPlugin=yt,e.TelemetryTrace=gt,e.TelemetryContext=mt,e.Session=rt,e.SessionManager=st,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e.Microsoft=e.Microsoft||{},e.Microsoft.ApplicationInsights={}))}(this,function(e){"use strict";var c=(t.isNullOrUndefined=function(e){return null==e},t.disableCookies=function(){t._canUseCookies=!1},t.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(n,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},t);function t(){}var s,i,n=/[xy]/g;o.prototype.processTelemetry=function(t){this.channelQueue.forEach(function(e){0<e.length&&e[0].processTelemetry(t)})},Object.defineProperty(o.prototype,"ChannelControls",{get:function(){return this.channelQueue},enumerable:!0,configurable:!0}),o.prototype.initialize=function(i,n,o){var a,r=this;i.isCookieUseDisabled&&c.disableCookies(),this.channelQueue=new Array,i.channels&&i.channels.forEach(function(e){if(e&&0<e.length){e=e.sort(function(e,t){return e.priority-t.priority});for(var t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);if(e.forEach(function(e){e.priority<500&&(a=e.identifier),e.initialize(i,n,o)}),a)throw Error("Channel has invalid priority"+a);r.channelQueue.push(e)}});for(var e=new Array,t=0;t<o.length;t++){var s=o[t];500<s.priority&&e.push(s)}if(0<e.length){for(e=e.sort(function(e,t){return e.priority-t.priority}),t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);e.forEach(function(e){return e.initialize(i,n,o)}),this.channelQueue.push(e)}};function o(){this.identifier="ChannelControllerPlugin",this.priority=500}(i=s=s||{})[i.CRITICAL=1]="CRITICAL",i[i.WARNING=2]="WARNING";var a=0,r=1,u=2,l=3,p=4,h=5,d=6,f=9,g=23,m=27,v=49,x=52,y=56,S=57,I=60,N=61,w=66,D=68,C=69,E=72,_=(A.sanitizeDiagnosticText=function(e){return'"'+e.replace(/\"/g,"")+'"'},A.dataType="MessageData",A.AiNonUserActionablePrefix="AI (Internal): ",A.AiUserActionablePrefix="AI: ",A);function A(e,t,i,n){void 0===i&&(i=!1),this.messageId=e,this.message=(i?A.AiUserActionablePrefix:A.AiNonUserActionablePrefix)+e;var o=(t?" message:"+A.sanitizeDiagnosticText(t):"")+(n?" props:"+A.sanitizeDiagnosticText(JSON.stringify(n)):"");this.message+=o}var b,k,T,U,M,L,R=(O.prototype.throwInternal=function(e,t,i,n,o){void 0===o&&(o=!1);var a=new _(t,i,o,n);if(this.enableDebugExceptions())throw a;if(void 0!==a&&a&&void 0!==a.message){if(o){var r=+a.messageId;(!this._messageLogged[r]||this.consoleLoggingLevel()>=s.WARNING)&&(this.warnToConsole(a.message),this._messageLogged[r]=!0)}else this.consoleLoggingLevel()>=s.WARNING&&this.warnToConsole(a.message);this.logInternalMessage(e,a)}},O.prototype.warnToConsole=function(e){"undefined"!=typeof console&&console&&("function"==typeof console.warn?console.warn(e):"function"==typeof console.log&&console.log(e))},O.prototype.resetInternalMessageCount=function(){this._messageCount=0,this._messageLogged={}},O.prototype.logInternalMessage=function(e,t){if(!this._areInternalMessagesThrottled()){var i=!0,n=this.AIInternalMessagePrefix+t.messageId;if(this._messageLogged[n]?i=!1:this._messageLogged[n]=!0,i&&(e<=this.telemetryLoggingLevel()&&(this.queue.push(t),this._messageCount++),this._messageCount===this.maxInternalMessageLimit())){var o="Internal events throttle limit per PageView reached for this app.",a=new _(g,o,!1);this.queue.push(a),this.warnToConsole(o)}}},O.prototype._areInternalMessagesThrottled=function(){return this._messageCount>=this.maxInternalMessageLimit()},O);function O(e){this.queue=[],this.AIInternalMessagePrefix="AITR_",this._messageCount=0,this._messageLogged={},this.enableDebugExceptions=function(){return!1},this.consoleLoggingLevel=function(){return 0},this.telemetryLoggingLevel=function(){return 1},this.maxInternalMessageLimit=function(){return 25},c.isNullOrUndefined(e)||(c.isNullOrUndefined(e.loggingLevelConsole)||(this.consoleLoggingLevel=function(){return e.loggingLevelConsole}),c.isNullOrUndefined(e.loggingLevelTelemetry)||(this.telemetryLoggingLevel=function(){return e.loggingLevelTelemetry}),c.isNullOrUndefined(e.maxMessageLimit)||(this.maxInternalMessageLimit=function(){return e.maxMessageLimit}),c.isNullOrUndefined(e.enableDebugExceptions)||(this.enableDebugExceptions=function(){return e.enableDebugExceptions}))}(k=b=b||{})[k.LocalStorage=0]="LocalStorage",k[k.SessionStorage=1]="SessionStorage",(U=T=T||{})[U.Default=0]="Default",U[U.Required=1]="Required",U[U.Array=2]="Array",U[U.Hidden=4]="Hidden",(L=M=M||{})[L.AI=0]="AI",L[L.AI_AND_W3C=1]="AI_AND_W3C",L[L.W3C=2]="W3C";var z=(P.sanitizeKeyAndAddUniqueness=function(e,t,i){var n=t.length,o=P.sanitizeKey(e,t);if(o.length!==n){for(var a=0,r=o;void 0!==i[r];)a++,r=o.substring(0,P.MAX_NAME_LENGTH-3)+P.padNumber(a);o=r}return o},P.sanitizeKey=function(e,t){var i;return t&&(t=P.trim(t.toString())).length>P.MAX_NAME_LENGTH&&(i=t.substring(0,P.MAX_NAME_LENGTH),e.throwInternal(s.WARNING,S,"name is too long. It has been truncated to "+P.MAX_NAME_LENGTH+" characters.",{name:t},!0)),i||t},P.sanitizeString=function(e,t,i){var n;return void 0===i&&(i=P.MAX_STRING_LENGTH),t&&(i=i||P.MAX_STRING_LENGTH,(t=P.trim(t)).toString().length>i&&(n=t.toString().substring(0,i),e.throwInternal(s.WARNING,N,"string value is too long. It has been truncated to "+i+" characters.",{value:t},!0))),n||t},P.sanitizeUrl=function(e,t){return P.sanitizeInput(e,t,P.MAX_URL_LENGTH,w)},P.sanitizeMessage=function(e,t){var i;return t&&t.length>P.MAX_MESSAGE_LENGTH&&(i=t.substring(0,P.MAX_MESSAGE_LENGTH),e.throwInternal(s.WARNING,y,"message is too long, it has been truncated to "+P.MAX_MESSAGE_LENGTH+" characters.",{message:t},!0)),i||t},P.sanitizeException=function(e,t){var i;return t&&t.length>P.MAX_EXCEPTION_LENGTH&&(i=t.substring(0,P.MAX_EXCEPTION_LENGTH),e.throwInternal(s.WARNING,x,"exception is too long, it has been truncated to "+P.MAX_EXCEPTION_LENGTH+" characters.",{exception:t},!0)),i||t},P.sanitizeProperties=function(t,e){if(e){var i={};for(var n in e){var o=e[n];if("object"==typeof o&&"undefined"!=typeof JSON)try{o=JSON.stringify(o)}catch(e){t.throwInternal(s.WARNING,v,"custom property is not valid",{exception:e},!0)}o=P.sanitizeString(t,o,P.MAX_PROPERTY_LENGTH),i[n=P.sanitizeKeyAndAddUniqueness(t,n,i)]=o}e=i}return e},P.sanitizeMeasurements=function(e,t){if(t){var i={};for(var n in t){var o=t[n];i[n=P.sanitizeKeyAndAddUniqueness(e,n,i)]=o}t=i}return t},P.sanitizeId=function(e,t){return t?P.sanitizeInput(e,t,P.MAX_ID_LENGTH,C).toString():t},P.sanitizeInput=function(e,t,i,n){var o;return t&&(t=P.trim(t)).length>i&&(o=t.substring(0,i),e.throwInternal(s.WARNING,n,"input is too long, it has been truncated to "+i+" characters.",{data:t},!0)),o||t},P.padNumber=function(e){var t="00"+e;return t.substr(t.length-3)},P.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},P.MAX_NAME_LENGTH=150,P.MAX_ID_LENGTH=128,P.MAX_PROPERTY_LENGTH=8192,P.MAX_STRING_LENGTH=1024,P.MAX_URL_LENGTH=2048,P.MAX_MESSAGE_LENGTH=32768,P.MAX_EXCEPTION_LENGTH=32768,P);function P(){}var G=(q.createDomEvent=function(e){var t=null;return"function"==typeof Event?t=new Event(e):(t=document.createEvent("Event")).initEvent(e,!0,!0),t},q.disableStorage=function(){q._canUseLocalStorage=!1,q._canUseSessionStorage=!1},q._getLocalStorageObject=function(){return q.canUseLocalStorage()?q._getVerifiedStorageObject(b.LocalStorage):null},q._getVerifiedStorageObject=function(e){var t,i,n=null;try{if("undefined"==typeof window)return null;i=new Date,(n=e===b.LocalStorage?window.localStorage:window.sessionStorage).setItem(i.toString(),i.toString()),t=n.getItem(i.toString())!==i.toString(),n.removeItem(i.toString()),t&&(n=null)}catch(e){n=null}return n},q.isInternalApplicationInsightsEndpoint=function(e){return-1!==q._internalEndpoints.indexOf(e.toLowerCase())},q.canUseLocalStorage=function(){return void 0===q._canUseLocalStorage&&(q._canUseLocalStorage=!!q._getVerifiedStorageObject(b.LocalStorage)),q._canUseLocalStorage},q.getStorage=function(t,e){var i=q._getLocalStorageObject();if(null!==i)try{return i.getItem(e)}catch(e){q._canUseLocalStorage=!1,t.throwInternal(s.WARNING,r,"Browser failed read of local storage. "+q.getExceptionName(e),{exception:q.dump(e)})}return null},q.setStorage=function(t,e,i){var n=q._getLocalStorageObject();if(null!==n)try{return n.setItem(e,i),!0}catch(e){q._canUseLocalStorage=!1,t.throwInternal(s.WARNING,l,"Browser failed write to local storage. "+q.getExceptionName(e),{exception:q.dump(e)})}return!1},q.removeStorage=function(t,e){var i=q._getLocalStorageObject();if(null!==i)try{return i.removeItem(e),!0}catch(e){q._canUseLocalStorage=!1,t.throwInternal(s.WARNING,h,"Browser failed removal of local storage item. "+q.getExceptionName(e),{exception:q.dump(e)})}return!1},q._getSessionStorageObject=function(){return q.canUseSessionStorage()?q._getVerifiedStorageObject(b.SessionStorage):null},q.canUseSessionStorage=function(){return void 0===q._canUseSessionStorage&&(q._canUseSessionStorage=!!q._getVerifiedStorageObject(b.SessionStorage)),q._canUseSessionStorage},q.getSessionStorageKeys=function(){var e=[];if(q.canUseSessionStorage())for(var t in window.sessionStorage)e.push(t);return e},q.getSessionStorage=function(t,e){var i=q._getSessionStorageObject();if(null!==i)try{return i.getItem(e)}catch(e){q._canUseSessionStorage=!1,t.throwInternal(s.WARNING,u,"Browser failed read of session storage. "+q.getExceptionName(e),{exception:q.dump(e)})}return null},q.setSessionStorage=function(t,e,i){var n=q._getSessionStorageObject();if(null!==n)try{return n.setItem(e,i),!0}catch(e){q._canUseSessionStorage=!1,t.throwInternal(s.WARNING,p,"Browser failed write to session storage. "+q.getExceptionName(e),{exception:q.dump(e)})}return!1},q.removeSessionStorage=function(t,e){var i=q._getSessionStorageObject();if(null!==i)try{return i.removeItem(e),!0}catch(e){q._canUseSessionStorage=!1,t.throwInternal(s.WARNING,d,"Browser failed removal of session storage item. "+q.getExceptionName(e),{exception:q.dump(e)})}return!1},q.disableCookies=function(){c.disableCookies()},q.canUseCookies=function(t){if(void 0===c._canUseCookies){c._canUseCookies=!1;try{c._canUseCookies=void 0!==q.document.cookie}catch(e){t.throwInternal(s.WARNING,D,"Cannot access document.cookie - "+q.getExceptionName(e),{exception:q.dump(e)})}}return c._canUseCookies},q.setCookie=function(e,t,i,n){var o="",a="";n&&(o=";domain="+n),q.document.location&&"https:"===q.document.location.protocol&&(a=";secure"),q.canUseCookies(e)&&(q.document.cookie=t+"="+i+o+";path=/"+a)},q.stringToBoolOrDefault=function(e,t){return void 0===t&&(t=!1),null==e?t:"true"===e.toString().toLowerCase()},q.getCookie=function(e,t){if(q.canUseCookies(e)){var i="";if(t&&t.length)for(var n=t+"=",o=q.document.cookie.split(";"),a=0;a<o.length;a++){var r=o[a];if((r=q.trim(r))&&0===r.indexOf(n)){i=r.substring(n.length,o[a].length);break}}return i}},q.deleteCookie=function(e,t){q.canUseCookies(e)&&(q.document.cookie=t+"=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;")},q.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},q.newId=function(){for(var e="",t=1073741824*Math.random();0<t;)e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t%64),t=Math.floor(t/64);return e},q.random32=function(){return 4294967296*Math.random()|0},q.generateW3CId=function(){for(var e,t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],i="",n=0;n<4;n++)i+=t[15&(e=q.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 o=t[8+4*Math.random()|0];return i.substr(0,8)+i.substr(9,4)+"4"+i.substr(13,3)+o+i.substr(16,3)+i.substr(19,12)},q.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},q.isError=function(e){return"[object Error]"===Object.prototype.toString.call(e)},q.isDate=function(e){return"[object Date]"===Object.prototype.toString.call(e)},q.toISOStringForIE8=function(e){if(q.isDate(e)){if(Date.prototype.toISOString)return e.toISOString();var t=function(e){var t=String(e);return 1===t.length&&(t="0"+t),t};return e.getUTCFullYear()+"-"+t(e.getUTCMonth()+1)+"-"+t(e.getUTCDate())+"T"+t(e.getUTCHours())+":"+t(e.getUTCMinutes())+":"+t(e.getUTCSeconds())+"."+String((e.getUTCMilliseconds()/1e3).toFixed(3)).slice(2,5)+"Z"}},q.getIEVersion=function(e){void 0===e&&(e=null);var t=e?e.toLowerCase():navigator.userAgent.toLowerCase();return-1!==t.indexOf("msie")?parseInt(t.split("msie")[1]):null},q.msToTimeSpan=function(e){(isNaN(e)||e<0)&&(e=0);var t=""+(e=Math.round(e))%1e3,i=""+Math.floor(e/1e3)%60,n=""+Math.floor(e/6e4)%60,o=""+Math.floor(e/36e5)%24,a=Math.floor(e/864e5);return t=1===t.length?"00"+t:2===t.length?"0"+t:t,i=i.length<2?"0"+i:i,n=n.length<2?"0"+n:n,(0<a?a+".":"")+(o=o.length<2?"0"+o:o)+":"+n+":"+i+"."+t},q.isCrossOriginError=function(e,t,i,n,o){return("Script error."===e||"Script error"===e)&&!o},q.dump=function(e){var t=Object.prototype.toString.call(e),i=JSON.stringify(e);return"[object Error]"===t&&(i="{ stack: '"+e.stack+"', message: '"+e.message+"', name: '"+e.name+"'"),t+i},q.getExceptionName=function(e){return"[object Error]"===Object.prototype.toString.call(e)?e.name:""},q.addEventHandler=function(e,t){if("undefined"==typeof window||!window||"string"!=typeof e||"function"!=typeof t)return!1;var i="on"+e;if(window.addEventListener)window.addEventListener(e,t,!1);else{if(!window.attachEvent)return!1;window.attachEvent(i,t)}return!0},q.IsBeaconApiSupported=function(){return"sendBeacon"in navigator&&navigator.sendBeacon},q.getExtension=function(e,t){for(var i=null,n=0;!i&&n<e.length;)e[n]&&e[n].identifier===t&&(i=e[n]),n++;return i},q.document="undefined"!=typeof document?document:{},q._canUseLocalStorage=void 0,q._canUseSessionStorage=void 0,q._internalEndpoints=["https://dc.services.visualstudio.com/v2/track","https://breeze.aimon.applicationinsights.io/v2/track","https://dc-int.services.visualstudio.com/v2/track"],q.NotSpecified="not_specified",q);function q(){}var j=(W.parseUrl=function(e){return W.htmlAnchorElement||(W.htmlAnchorElement=W.document.createElement?W.document.createElement("a"):{host:W.parseHost(e)}),W.htmlAnchorElement.href=e,W.htmlAnchorElement},W.getAbsoluteUrl=function(e){var t,i=W.parseUrl(e);return i&&(t=i.href),t},W.getPathName=function(e){var t,i=W.parseUrl(e);return i&&(t=i.pathname),t},W.getCompleteUrl=function(e,t){return e?e.toUpperCase()+" "+t:t},W.parseHost=function(e){var t=e.match(/:\/\/(www[0-9]?\.)?(.[^/:]+)/i);return null!=t&&2<t.length&&"string"==typeof t[2]&&0<t[2].length?t[2]:null},W.document="undefined"!=typeof document?document:{},W);function W(){}var V=(H.ParseDependencyPath=function(e,t,i,n){var o,a=n,r=n;if(t&&0<t.length){var s=j.parseUrl(t);if(o=s.host,!a)if(null!=s.pathname){var c=0===s.pathname.length?"/":s.pathname;"/"!==c.charAt(0)&&(c="/"+c),r=s.pathname,a=z.sanitizeString(e,i?i+" "+c:c)}else a=z.sanitizeString(e,t)}else a=o=n;return{target:o,name:a,data:r}},H);function H(){}var B=(X.Now="undefined"==typeof window?function(){return(new Date).getTime()}:window.performance&&window.performance.now&&window.performance.timing?function(){return window.performance.now()+window.performance.timing.navigationStart}:function(){return(new Date).getTime()},X.GetDuration=function(e,t){var i=null;return 0===e||0===t||c.isNullOrUndefined(e)||c.isNullOrUndefined(t)||(i=t-e),i},X);function X(){}var F=function(e,t){return(F=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};function K(e,t){function i(){this.constructor=e}F(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var J,Q=function(){return(Q=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var o in t=arguments[i])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},Y=(K($,J=function(){}),$);function $(){return J.call(this)||this}var Z;K(ee,Z=function(){this.ver=1,this.sampleRate=100,this.tags={}});function ee(e,t,i){var n=Z.call(this)||this;return n.name=z.sanitizeString(e,i)||G.NotSpecified,n.data=t,n.time=G.toISOStringForIE8(new Date),n.aiDataContract={time:T.Required,iKey:T.Required,name:T.Required,sampleRate:function(){return 100===n.sampleRate?T.Hidden:T.Required},tags:T.Required,data:T.Required},n}function te(){}var ie,ne=(K(oe,ie=te),oe);function oe(){var e=ie.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var ae;K(re,ae=ne),re.envelopeType="Microsoft.ApplicationInsights.{0}.Event",re.dataType="EventData";function re(e,t,i,n){var o=ae.call(this)||this;return o.aiDataContract={ver:T.Required,name:T.Required,properties:T.Default,measurements:T.Default},o.name=z.sanitizeString(e,t)||G.NotSpecified,o.properties=z.sanitizeProperties(e,i),o.measurements=z.sanitizeMeasurements(e,n),o}function se(){}var ce,ue=(K(le,ce=te),le);function le(){var e=ce.call(this)||this;return e.ver=2,e.exceptions=[],e.properties={},e.measurements={},e}function pe(){this.hasFullStack=!0,this.parsedStack=[]}var he;K(de,he=ue),de.CreateFromInterface=function(t,e){var i=e.exceptions&&e.exceptions.map(function(e){return ge.CreateFromInterface(t,e)});return new de(t,Q({},e,{exceptions:i}))},de.prototype.toInterface=function(){var e=this,t=e.exceptions,i=e.properties,n=e.measurements,o=e.severityLevel,a=(e.ver,e.problemGroup),r=e.id,s=e.isManual;return{ver:"4.0",exceptions:t instanceof Array&&t.map(function(e){return e.toInterface()})||void 0,severityLevel:o,properties:i,measurements:n,problemGroup:a,id:r,isManual:s}},de.CreateSimpleException=function(e,t,i,n,o,a){return{exceptions:[{hasFullStack:!0,message:e,stack:o,typeName:t}]}},de.envelopeType="Microsoft.ApplicationInsights.{0}.Exception",de.dataType="ExceptionData";function de(e,t,i,n,o,a){var r=he.call(this)||this;return r.aiDataContract={ver:T.Required,exceptions:T.Required,severityLevel:T.Default,properties:T.Default,measurements:T.Default},t instanceof Error?(r.exceptions=[new ge(e,t)],r.properties=z.sanitizeProperties(e,i),r.measurements=z.sanitizeMeasurements(e,n),o&&(r.severityLevel=o),a&&(r.id=a)):(r.exceptions=t.exceptions,r.properties=t.properties,r.measurements=t.measurements,t.severityLevel&&(r.severityLevel=t.severityLevel),t.id&&(r.id=t.id),t.problemGroup&&(r.problemGroup=t.problemGroup),r.ver=2,c.isNullOrUndefined(t.isManual)||(r.isManual=t.isManual)),r}var fe,ge=(K(me,fe=pe),me.prototype.toInterface=function(){var e=this.parsedStack instanceof Array&&this.parsedStack.map(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||void 0}},me.CreateFromInterface=function(e,t){var i=t.parsedStack instanceof Array&&t.parsedStack.map(function(e){return xe.CreateFromInterface(e)})||t.parsedStack;return new me(e,Q({},t,{parsedStack:i}))},me.parseStack=function(e){var t;if("string"==typeof e){var i=e.split("\n");t=[];for(var n=0,o=0,a=0;a<=i.length;a++){var r=i[a];if(xe.regex.test(r)){var s=new xe(i[a],n++);o+=s.sizeInBytes,t.push(s)}}if(32768<o)for(var c=0,u=t.length-1,l=0,p=c,h=u;c<u;){if(32768<(l+=t[c].sizeInBytes+t[u].sizeInBytes)){var d=h-p+1;t.splice(p,d);break}p=c,h=u,c++,u--}}return t},me);function me(e,t){var i=fe.call(this)||this;if(i.aiDataContract={id:T.Default,outerId:T.Default,typeName:T.Required,message:T.Required,hasFullStack:T.Default,stack:T.Default,parsedStack:T.Array},t instanceof Error){i.typeName=z.sanitizeString(e,t.name)||G.NotSpecified,i.message=z.sanitizeMessage(e,t.message)||G.NotSpecified;var n=t.stack;i.parsedStack=me.parseStack(n),i.stack=z.sanitizeException(e,n),i.hasFullStack=G.isArray(i.parsedStack)&&0<i.parsedStack.length}else i.typeName=t.typeName,i.message=t.message,i.stack=t.stack,i.parsedStack=t.parsedStack,i.hasFullStack=t.hasFullStack;return i}var ve,xe=(K(ye,ve=se),ye.CreateFromInterface=function(e){return new ye(e,null)},ye.prototype.toInterface=function(){return{level:this.level,method:this.method,assembly:this.assembly,fileName:this.fileName,line:this.line}},ye.regex=/^([\s]+at)?(.*?)(\@|\s\(|\s)([^\(\@\n]+):([0-9]+):([0-9]+)(\)?)$/,ye.baseSize=58,ye);function ye(e,t){var i=ve.call(this)||this;if(i.sizeInBytes=0,i.aiDataContract={level:T.Required,method:T.Required,assembly:T.Default,fileName:T.Default,line:T.Default},"string"==typeof e){var n=e;i.level=t,i.method="<no_method>",i.assembly=G.trim(n),i.fileName="",i.line=0;var o=n.match(ye.regex);o&&5<=o.length&&(i.method=G.trim(o[2])||i.method,i.fileName=G.trim(o[4]),i.line=parseInt(o[5])||0)}else i.level=e.level,i.method=e.method,i.assembly=e.assembly,i.fileName=e.fileName,i.line=e.line,i.sizeInBytes=0;return i.sizeInBytes+=i.method.length,i.sizeInBytes+=i.fileName.length,i.sizeInBytes+=i.assembly.length,i.sizeInBytes+=ye.baseSize,i.sizeInBytes+=i.level.toString().length,i.sizeInBytes+=i.line.toString().length,i}var Se,Ie,Ne,we=(K(De,Se=te),De);function De(){var e=Se.call(this)||this;return e.ver=2,e.metrics=[],e.properties={},e}(Ne=Ie=Ie||{})[Ne.Measurement=0]="Measurement",Ne[Ne.Aggregation=1]="Aggregation";var Ce,Ee=(K(_e,Ce=function(){this.kind=Ie.Measurement}),_e);function _e(){var e=null!==Ce&&Ce.apply(this,arguments)||this;return e.aiDataContract={name:T.Required,kind:T.Default,value:T.Required,count:T.Default,min:T.Default,max:T.Default,stdDev:T.Default},e}var Ae;K(be,Ae=we),be.envelopeType="Microsoft.ApplicationInsights.{0}.Metric",be.dataType="MetricData";function be(e,t,i,n,o,a,r){var s=Ae.call(this)||this;s.aiDataContract={ver:T.Required,metrics:T.Required,properties:T.Default};var c=new Ee;return c.count=0<n?n:void 0,c.max=isNaN(a)||null===a?void 0:a,c.min=isNaN(o)||null===o?void 0:o,c.name=z.sanitizeString(e,t)||G.NotSpecified,c.value=i,s.metrics=[c],s.properties=z.sanitizeProperties(e,r),s}var ke,Te=(K(Ue,ke=ne),Ue);function Ue(){var e=ke.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var Me,Le=(K(Re,Me=Te),Re.envelopeType="Microsoft.ApplicationInsights.{0}.Pageview",Re.dataType="PageviewData",Re);function Re(e,t,i,n,o,a,r){var s=Me.call(this)||this;return s.aiDataContract={ver:T.Required,name:T.Default,url:T.Default,duration:T.Default,properties:T.Default,measurements:T.Default,id:T.Default},s.id=z.sanitizeId(e,r),s.url=z.sanitizeUrl(e,i),s.name=z.sanitizeString(e,t)||G.NotSpecified,isNaN(n)||(s.duration=G.msToTimeSpan(n)),s.properties=z.sanitizeProperties(e,o),s.measurements=z.sanitizeMeasurements(e,a),s}var Oe,ze=(K(Pe,Oe=te),Pe);function Pe(){var e=Oe.call(this)||this;return e.ver=2,e.success=!0,e.properties={},e.measurements={},e}var Ge;K(qe,Ge=ze),qe.envelopeType="Microsoft.ApplicationInsights.{0}.RemoteDependency",qe.dataType="RemoteDependencyData";function qe(e,t,i,n,o,a,r,s,c,u,l,p){void 0===c&&(c="Ajax");var h=Ge.call(this)||this;h.aiDataContract={id:T.Required,ver:T.Required,name:T.Default,resultCode:T.Default,duration:T.Default,success:T.Default,data:T.Default,target:T.Default,type:T.Default,properties:T.Default,measurements:T.Default,kind:T.Default,value:T.Default,count:T.Default,min:T.Default,max:T.Default,stdDev:T.Default,dependencyKind:T.Default,dependencySource:T.Default,commandName:T.Default,dependencyTypeName:T.Default},h.id=t,h.duration=G.msToTimeSpan(o),h.success=a,h.resultCode=r+"",h.type=z.sanitizeString(e,c);var d=V.ParseDependencyPath(e,i,s,n);return h.data=z.sanitizeUrl(e,n)||d.data,h.target=z.sanitizeString(e,d.target),u&&(h.target=h.target+" | "+u),h.name=z.sanitizeString(e,d.name),h.properties=z.sanitizeProperties(e,l),h.measurements=z.sanitizeMeasurements(e,p),h}var je,We=(K(Ve,je=te),Ve);function Ve(){var e=je.call(this)||this;return e.ver=2,e.properties={},e}var He;K(Be,He=We),Be.envelopeType="Microsoft.ApplicationInsights.{0}.Message",Be.dataType="MessageData";function Be(e,t,i,n){var o=He.call(this)||this;return o.aiDataContract={ver:T.Required,message:T.Required,severityLevel:T.Default,properties:T.Default},t=t||G.NotSpecified,o.message=z.sanitizeMessage(e,t),o.properties=z.sanitizeProperties(e,n),i&&(o.severityLevel=i),o}var Xe,Fe=(K(Ke,Xe=Te),Ke);function Ke(){var e=Xe.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var Je;K(Qe,Je=Fe),Qe.envelopeType="Microsoft.ApplicationInsights.{0}.PageviewPerformance",Qe.dataType="PageviewPerformanceData";function Qe(e,t,i,n,o,a,r){var s=Je.call(this)||this;return s.aiDataContract={ver:T.Required,name:T.Default,url:T.Default,duration:T.Default,perfTotal:T.Default,networkConnect:T.Default,sentRequest:T.Default,receivedResponse:T.Default,domProcessing:T.Default,properties:T.Default,measurements:T.Default},s.url=z.sanitizeUrl(e,i),s.name=z.sanitizeString(e,t)||G.NotSpecified,s.properties=z.sanitizeProperties(e,o),s.measurements=z.sanitizeMeasurements(e,a),r&&(s.domProcessing=r.domProcessing,s.duration=r.duration,s.networkConnect=r.networkConnect,s.perfTotal=r.perfTotal,s.receivedResponse=r.receivedResponse,s.sentRequest=r.sentRequest),s}var Ye,$e,Ze;K(et,Ye=Y);function et(e,t){var i=Ye.call(this)||this;return i.aiDataContract={baseType:T.Required,baseData:T.Required},i.baseType=e,i.baseData=t,i}(Ze=$e=$e||{})[Ze.Verbose=0]="Verbose",Ze[Ze.Information=1]="Information",Ze[Ze.Warning=2]="Warning",Ze[Ze.Error=3]="Error",Ze[Ze.Critical=4]="Critical";var tt=(it.getConfig=function(e,t,i,n){var o;return void 0===n&&(n=!1),o=i&&e.extensionConfig&&e.extensionConfig[i]&&!c.isNullOrUndefined(e.extensionConfig[i][t])?e.extensionConfig[i][t]:e[t],c.isNullOrUndefined(o)?n:o},it);function it(){}var nt=function(){this.applicationVersion="ai.application.ver",this.applicationBuild="ai.application.build",this.applicationTypeId="ai.application.typeId",this.applicationId="ai.application.applicationId",this.applicationLayer="ai.application.layer",this.deviceId="ai.device.id",this.deviceIp="ai.device.ip",this.deviceLanguage="ai.device.language",this.deviceLocale="ai.device.locale",this.deviceModel="ai.device.model",this.deviceFriendlyName="ai.device.friendlyName",this.deviceNetwork="ai.device.network",this.deviceNetworkName="ai.device.networkName",this.deviceOEMName="ai.device.oemName",this.deviceOS="ai.device.os",this.deviceOSVersion="ai.device.osVersion",this.deviceRoleInstance="ai.device.roleInstance",this.deviceRoleName="ai.device.roleName",this.deviceScreenResolution="ai.device.screenResolution",this.deviceType="ai.device.type",this.deviceMachineName="ai.device.machineName",this.deviceVMName="ai.device.vmName",this.deviceBrowser="ai.device.browser",this.deviceBrowserVersion="ai.device.browserVersion",this.locationIp="ai.location.ip",this.locationCountry="ai.location.country",this.locationProvince="ai.location.province",this.locationCity="ai.location.city",this.operationId="ai.operation.id",this.operationName="ai.operation.name",this.operationParentId="ai.operation.parentId",this.operationRootId="ai.operation.rootId",this.operationSyntheticSource="ai.operation.syntheticSource",this.operationCorrelationVector="ai.operation.correlationVector",this.sessionId="ai.session.id",this.sessionIsFirst="ai.session.isFirst",this.sessionIsNew="ai.session.isNew",this.userAccountAcquisitionDate="ai.user.accountAcquisitionDate",this.userAccountId="ai.user.accountId",this.userAgent="ai.user.userAgent",this.userId="ai.user.id",this.userStoreRegion="ai.user.storeRegion",this.userAuthUserId="ai.user.authUserId",this.userAnonymousUserAcquisitionDate="ai.user.anonUserAcquisitionDate",this.userAuthenticatedUserAcquisitionDate="ai.user.authUserAcquisitionDate",this.cloudName="ai.cloud.name",this.cloudRole="ai.cloud.role",this.cloudRoleVer="ai.cloud.roleVer",this.cloudRoleInstance="ai.cloud.roleInstance",this.cloudEnvironment="ai.cloud.environment",this.cloudLocation="ai.cloud.location",this.cloudDeploymentUnit="ai.cloud.deploymentUnit",this.internalNodeName="ai.internal.nodeName",this.internalSdkVersion="ai.internal.sdkVersion",this.internalAgentVersion="ai.internal.agentVersion"},ot=(at.UserExt="user",at.DeviceExt="device",at.TraceExt="trace",at.WebExt="web",at.AppExt="app",at.OSExt="os",at.SessionExt="ses",at.SDKExt="sdk",at);function at(){}var rt=new nt,st=function(){},ct=(ut.prototype.update=function(){this.automaticSession.id||this.initializeAutomaticSession();var e=B.Now(),t=e-this.automaticSession.acquisitionDate>this.config.sessionExpirationMs(),i=e-this.automaticSession.renewalDate>this.config.sessionRenewalMs();t||i?this.renew():(!this.cookieUpdatedTimestamp||e-this.cookieUpdatedTimestamp>ut.cookieUpdateInterval)&&(this.automaticSession.renewalDate=e,this.setCookie(this.automaticSession.id,this.automaticSession.acquisitionDate,this.automaticSession.renewalDate))},ut.prototype.backup=function(){this.setStorage(this.automaticSession.id,this.automaticSession.acquisitionDate,this.automaticSession.renewalDate)},ut.prototype.initializeAutomaticSession=function(){var e=G.getCookie(this._logger,this._storageNamePrefix());if(e&&"function"==typeof e.split)this.initializeAutomaticSessionWithData(e);else{var t=G.getStorage(this._logger,this._storageNamePrefix());t&&this.initializeAutomaticSessionWithData(t)}this.automaticSession.id||this.renew()},ut.prototype.initializeAutomaticSessionWithData=function(e){var t=e.split("|");0<t.length&&(this.automaticSession.id=t[0]);try{if(1<t.length){var i=+t[1];this.automaticSession.acquisitionDate=+new Date(i),this.automaticSession.acquisitionDate=0<this.automaticSession.acquisitionDate?this.automaticSession.acquisitionDate:0}if(2<t.length){var n=+t[2];this.automaticSession.renewalDate=+new Date(n),this.automaticSession.renewalDate=0<this.automaticSession.renewalDate?this.automaticSession.renewalDate:0}}catch(e){this._logger.throwInternal(s.CRITICAL,f,"Error parsing ai_session cookie, session will be reset: "+G.getExceptionName(e),{exception:G.dump(e)})}0===this.automaticSession.renewalDate&&this._logger.throwInternal(s.WARNING,m,"AI session renewal date is 0, session will be reset.")},ut.prototype.renew=function(){var e=B.Now();this.automaticSession.id=G.newId(),this.automaticSession.acquisitionDate=e,this.automaticSession.renewalDate=e,this.setCookie(this.automaticSession.id,this.automaticSession.acquisitionDate,this.automaticSession.renewalDate),G.canUseLocalStorage()||this._logger.throwInternal(s.WARNING,a,"Browser does not support local storage. Session durations will be inaccurate.")},ut.prototype.setCookie=function(e,t,i){var n=t+this.config.sessionExpirationMs(),o=i+this.config.sessionRenewalMs(),a=new Date,r=[e,t,i];n<o?a.setTime(n):a.setTime(o);var s=this.config.cookieDomain?this.config.cookieDomain():null;G.setCookie(this._logger,this._storageNamePrefix(),r.join("|")+";expires="+a.toUTCString(),s),this.cookieUpdatedTimestamp=B.Now()},ut.prototype.setStorage=function(e,t,i){G.setStorage(this._logger,this._storageNamePrefix(),[e,t,i].join("|"))},ut.acquisitionSpan=864e5,ut.renewalSpan=18e5,ut.cookieUpdateInterval=6e4,ut.cookieNameConst="ai_session",ut);function ut(e,t){var i=this;c.isNullOrUndefined(t)?this._logger=new R:this._logger=t,"function"!=typeof(e=e||{}).sessionExpirationMs&&(e.sessionExpirationMs=function(){return ut.acquisitionSpan}),"function"!=typeof e.sessionRenewalMs&&(e.sessionRenewalMs=function(){return ut.renewalSpan}),this.config=e,this._storageNamePrefix=function(){return i.config.namePrefix&&i.config.namePrefix()?ut.cookieNameConst+i.config.namePrefix():ut.cookieNameConst},this.automaticSession=new st}var lt=function(){},pt=function(){this.id="browser",this.deviceClass="Browser"},ht=function(e){this.sdkVersion=(e.sdkExtension&&e.sdkExtension()?e.sdkExtension()+"_":"")+"javascript:2.2.3"},dt=(ft.prototype.setAuthenticatedUserContext=function(e,t,i){if(void 0===i&&(i=!1),!this.validateUserInput(e)||t&&!this.validateUserInput(t))this._logger.throwInternal(s.WARNING,I,"Setting auth user context failed. User auth/account id should be of type string, and not contain commas, semi-colons, equal signs, spaces, or vertical-bars.",!0);else{this.authenticatedId=e;var n=this.authenticatedId;t&&(this.accountId=t,n=[this.authenticatedId,this.accountId].join(ft.cookieSeparator)),i&&G.setCookie(this._logger,ft.authUserCookieName,encodeURI(n),this.config.cookieDomain())}},ft.prototype.clearAuthenticatedUserContext=function(){this.authenticatedId=null,this.accountId=null,G.deleteCookie(this._logger,ft.authUserCookieName)},ft.prototype.validateUserInput=function(e){return!("string"!=typeof e||!e||e.match(/,|;|=| |\|/))},ft.cookieSeparator="|",ft.userCookieName="ai_user",ft.authUserCookieName="ai_authUser",ft);function ft(e,t){this.isNewUser=!1,this._logger=t;var i=G.getCookie(this._logger,ft.userCookieName);if(i){this.isNewUser=!1;var n=i.split(ft.cookieSeparator);0<n.length&&(this.id=n[0])}if(this.config=e,!this.id){this.id=G.newId();var o=new Date,a=G.toISOStringForIE8(o);this.accountAcquisitionDate=a,this.isNewUser=!0,o.setTime(o.getTime()+31536e6);var r=[this.id,a],s=this.config.cookieDomain?this.config.cookieDomain():void 0;G.setCookie(this._logger,ft.userCookieName,r.join(ft.cookieSeparator)+";expires="+o.toUTCString(),s);var c=e.namePrefix&&e.namePrefix()?e.namePrefix()+"ai_session":"ai_session";G.removeStorage(this._logger,c)}this.accountId=e.accountId?e.accountId():void 0;var u=G.getCookie(this._logger,ft.authUserCookieName);if(u){var l=(u=decodeURI(u)).split(ft.cookieSeparator);l[0]&&(this.authenticatedId=l[0]),1<l.length&&l[1]&&(this.accountId=l[1])}}var gt=function(){},mt=function(e,t,i){this.traceID=e||G.generateW3CId(),this.parentID=t,this.name=i,window&&window.location&&window.location.pathname&&(this.name=window.location.pathname)},vt=(xt.prototype.applySessionContext=function(e){var t=this.session||this.sessionManager.automaticSession;t&&"string"==typeof t.id&&(e.ext.app.sesId=t.id),this.session&&("string"==typeof this.session.id?e.ext.app.sesId=this.session.id:e.ext.app.sesId=this.sessionManager.automaticSession.id)},xt.prototype.applyOperatingSystemContxt=function(e){this.os&&this.os.name&&(e.ext.os=this.os)},xt.prototype.applyApplicationContext=function(e){this.application&&("string"==typeof this.application.ver&&(e.tags[rt.applicationVersion]=this.application.ver),"string"==typeof this.application.build&&(e.tags[rt.applicationBuild]=this.application.build))},xt.prototype.applyDeviceContext=function(e){this.device&&("string"==typeof this.device.id&&(e.ext.device.localId=this.device.id),"string"==typeof this.device.ip&&(e.ext.device.ip=this.device.ip),"string"==typeof this.device.model&&(e.ext.device.model=this.device.model),"string"==typeof this.device.deviceClass&&(e.ext.device.deviceClass=this.device.deviceClass))},xt.prototype.applyInternalContext=function(e){this.internal&&("string"==typeof this.internal.agentVersion&&(e.tags[rt.internalAgentVersion]=this.internal.agentVersion),"string"==typeof this.internal.sdkVersion&&(e.tags[rt.internalSdkVersion]=this.internal.sdkVersion))},xt.prototype.applyLocationContext=function(e){this.location&&"string"==typeof this.location.ip&&(e.tags[rt.locationIp]=this.location.ip)},xt.prototype.applyOperationContext=function(e){if(this.telemetryTrace){var t=e.ext.trace||{traceID:void 0,parentID:void 0};"string"==typeof this.telemetryTrace.traceID&&(t.traceID=this.telemetryTrace.traceID),"string"==typeof this.telemetryTrace.name&&(t.name=this.telemetryTrace.name),"string"==typeof this.telemetryTrace.parentID&&(t.parentID=this.telemetryTrace.parentID),e.ext.trace=t}},xt.prototype.applyWebContext=function(e){this.web&&(e.ext.web=e.ext.web||{},e.ext.web=this.web)},xt.prototype.applyUserContext=function(e){this.user&&(e.tags||(e.tags=[]),"string"==typeof this.user.accountId&&(e.tags[rt.userAccountId]=this.user.accountId),"string"==typeof this.user.id&&(e.ext.user.id=this.user.id),"string"==typeof this.user.authenticatedId&&(e.ext.user.authId=this.user.authenticatedId))},xt.prototype.cleanUp=function(e){e.ext[ot.DeviceExt]&&0===Object.keys(e.ext[ot.DeviceExt]).length&&delete e.ext[ot.DeviceExt],e.ext[ot.UserExt]&&0===Object.keys(e.ext[ot.UserExt]).length&&delete e.ext[ot.UserExt],e.ext[ot.WebExt]&&0===Object.keys(e.ext[ot.WebExt]).length&&delete e.ext[ot.WebExt],e.ext[ot.OSExt]&&0===Object.keys(e.ext[ot.OSExt]).length&&delete e.ext[ot.OSExt],e.ext[ot.AppExt]&&0===Object.keys(e.ext[ot.AppExt]).length&&delete e.ext[ot.AppExt],e.ext[ot.TraceExt]&&0===Object.keys(e.ext[ot.TraceExt]).length&&delete e.ext[ot.TraceExt]},xt);function xt(e,t){"undefined"!=typeof window&&(this.sessionManager=new ct(t,e),this.application=new lt,this.device=new pt,this.internal=new ht(t),this.location=new gt,this.user=new dt(t,e),this.telemetryTrace=new mt,this.session=new st),this.appId=function(){return null}}var yt=(St.getDefaultConfig=function(){return{instrumentationKey:function(){},accountId:function(){return null},sessionRenewalMs:function(){return 18e5},samplingPercentage:function(){return 100},sessionExpirationMs:function(){return 864e5},cookieDomain:function(){return null},sdkExtension:function(){return null},isBrowserLinkTrackingEnabled:function(){return!1},appId:function(){return null},namePrefix:function(){}}},St.prototype.initialize=function(t,e,i){var n=this,o=St.getDefaultConfig();function a(e){r._extensionConfig[e]=function(){return tt.getConfig(t,e,n.identifier,o[e]())}}this._extensionConfig=this._extensionConfig||St.getDefaultConfig();var r=this;for(var s in o)a(s);this._logger=e.logger,this.context=new vt(e.logger,this._extensionConfig),this._breezeChannel=G.getExtension(i,"AppInsightsChannelPlugin"),this.context.appId=function(){return n._breezeChannel?n._breezeChannel._appId:null}},St.prototype.processTelemetry=function(e){if(c.isNullOrUndefined(e));else{if(e.name===Le.envelopeType&&this._logger.resetInternalMessageCount(),this.context.session&&"string"!=typeof this.context.session.id&&this.context.sessionManager.update(),this._processTelemetryInternal(e),this.context&&this.context.user&&this.context.user.isNewUser){this.context.user.isNewUser=!1;var t=new _(E,navigator.userAgent);this._logger.logInternalMessage(s.CRITICAL,t)}c.isNullOrUndefined(this._nextPlugin)||this._nextPlugin.processTelemetry(e)}},St.prototype.setNextPlugin=function(e){this._nextPlugin=e},St.prototype._processTelemetryInternal=function(e){e.tags||(e.tags=[]),e.ext||(e.ext={}),e.ext[ot.DeviceExt]=e.ext[ot.DeviceExt]||{},e.ext[ot.WebExt]=e.ext[ot.WebExt]||{},e.ext[ot.UserExt]=e.ext[ot.UserExt]||{},e.ext[ot.OSExt]=e.ext[ot.OSExt]||{},e.ext[ot.AppExt]=e.ext[ot.AppExt]||{},e.ext[ot.TraceExt]=e.ext[ot.TraceExt]||{},this.context.applySessionContext(e),this.context.applyApplicationContext(e),this.context.applyDeviceContext(e),this.context.applyOperationContext(e),this.context.applyUserContext(e),this.context.applyOperatingSystemContxt(e),this.context.applyWebContext(e),this.context.applyLocationContext(e),this.context.applyInternalContext(e),this.context.cleanUp(e)},St);function St(){this.priority=110,this.identifier="AppInsightsPropertiesPlugin"}e.PropertiesPlugin=yt,e.TelemetryTrace=mt,e.TelemetryContext=vt,e.Session=st,e.SessionManager=ct,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=applicationinsights-properties-js.min.js.map |
{ | ||
"name": "@microsoft/applicationinsights-properties-js", | ||
"version": "2.2.2", | ||
"version": "2.2.3", | ||
"description": "Microsoft Application Insights properties (Part A) plugin", | ||
@@ -11,3 +11,3 @@ "main": "dist/applicationinsights-properties-js.js", | ||
"type": "git", | ||
"url": "https://github.com/microsoft/ApplicationInsights-JS/tree/master/vNext/extensions/applicationinsights-properties-js" | ||
"url": "https://github.com/microsoft/ApplicationInsights-JS/tree/master/extensions/applicationinsights-properties-js" | ||
}, | ||
@@ -18,3 +18,4 @@ "scripts": { | ||
"build:browser": "rollup -c", | ||
"test": "grunt propertiestests" | ||
"test": "grunt propertiestests", | ||
"lint": "tslint -p tsconfig.json" | ||
}, | ||
@@ -30,7 +31,9 @@ "devDependencies": { | ||
"rollup-plugin-uglify": "^6.0.0", | ||
"rollup": "^0.66.0" | ||
"rollup": "^0.66.0", | ||
"tslint": "^5.19.0", | ||
"tslint-config-prettier": "^1.18.0" | ||
}, | ||
"dependencies": { | ||
"@microsoft/applicationinsights-core-js": "2.2.2", | ||
"@microsoft/applicationinsights-common": "2.2.2", | ||
"@microsoft/applicationinsights-core-js": "2.2.3", | ||
"@microsoft/applicationinsights-common": "2.2.3", | ||
"tslib": "^1.9.3" | ||
@@ -37,0 +40,0 @@ }, |
@@ -7,3 +7,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
const Version = "2.2.2"; | ||
const Version = "2.2.3"; | ||
@@ -23,4 +23,4 @@ export class Internal implements IInternal { | ||
/** | ||
* Constructs a new instance of the internal telemetry data class. | ||
*/ | ||
* Constructs a new instance of the internal telemetry data class. | ||
*/ | ||
constructor(config: ITelemetryConfig) { | ||
@@ -27,0 +27,0 @@ this.sdkVersion = (config.sdkExtension && config.sdkExtension() ? config.sdkExtension() + "_" : "") + "javascript:" + Version; |
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
import { ISession } from '@microsoft/applicationinsights-common'; | ||
import { | ||
Util, DateTimeUtils | ||
} from '@microsoft/applicationinsights-common'; | ||
import { ISession, Util, DateTimeUtils } from '@microsoft/applicationinsights-common'; | ||
import { IDiagnosticLogger, _InternalMessageId, LoggingSeverity, CoreUtils, DiagnosticLogger } from '@microsoft/applicationinsights-core-js'; | ||
@@ -42,5 +39,5 @@ | ||
public static cookieUpdateInterval = 60000 // 1 minute in ms | ||
private static cookieNameConst = 'ai_session'; | ||
public automaticSession: Session; | ||
public config: ISessionConfig; | ||
private static cookieNameConst = 'ai_session'; | ||
@@ -59,3 +56,3 @@ private cookieUpdatedTimestamp: number; | ||
if (!config) { | ||
config = <any>{}; | ||
config = ({} as any); | ||
} | ||
@@ -82,6 +79,6 @@ | ||
var now = DateTimeUtils.Now(); | ||
const now = DateTimeUtils.Now(); | ||
var acquisitionExpired = now - this.automaticSession.acquisitionDate > this.config.sessionExpirationMs(); | ||
var renewalExpired = now - this.automaticSession.renewalDate > this.config.sessionRenewalMs(); | ||
const acquisitionExpired = now - this.automaticSession.acquisitionDate > this.config.sessionExpirationMs(); | ||
const renewalExpired = now - this.automaticSession.renewalDate > this.config.sessionRenewalMs(); | ||
@@ -115,3 +112,3 @@ // renew if acquisitionSpan or renewalSpan has ellapsed | ||
private initializeAutomaticSession() { | ||
var cookie = Util.getCookie(this._logger, this._storageNamePrefix()); | ||
const cookie = Util.getCookie(this._logger, this._storageNamePrefix()); | ||
if (cookie && typeof cookie.split === "function") { | ||
@@ -124,3 +121,3 @@ this.initializeAutomaticSessionWithData(cookie); | ||
// The User class handles this for us and deletes our local storage object if the persistent user cookie was removed. | ||
var storage = Util.getStorage(this._logger, this._storageNamePrefix()); | ||
const storage = Util.getStorage(this._logger, this._storageNamePrefix()); | ||
if (storage) { | ||
@@ -143,3 +140,3 @@ this.initializeAutomaticSessionWithData(storage); | ||
private initializeAutomaticSessionWithData(sessionData: string) { | ||
var params = sessionData.split("|"); | ||
const params = sessionData.split("|"); | ||
@@ -152,3 +149,3 @@ if (params.length > 0) { | ||
if (params.length > 1) { | ||
var acq = +params[1]; | ||
const acq = +params[1]; | ||
this.automaticSession.acquisitionDate = +new Date(acq); | ||
@@ -159,3 +156,3 @@ this.automaticSession.acquisitionDate = this.automaticSession.acquisitionDate > 0 ? this.automaticSession.acquisitionDate : 0; | ||
if (params.length > 2) { | ||
var renewal = +params[2]; | ||
const renewal = +params[2]; | ||
this.automaticSession.renewalDate = +new Date(renewal); | ||
@@ -172,3 +169,3 @@ this.automaticSession.renewalDate = this.automaticSession.renewalDate > 0 ? this.automaticSession.renewalDate : 0; | ||
if (this.automaticSession.renewalDate == 0) { | ||
if (this.automaticSession.renewalDate === 0) { | ||
this._logger.throwInternal(LoggingSeverity.WARNING, | ||
@@ -181,3 +178,3 @@ _InternalMessageId.SessionRenewalDateIsZero, | ||
private renew() { | ||
var now = DateTimeUtils.Now(); | ||
const now = DateTimeUtils.Now(); | ||
@@ -201,6 +198,6 @@ this.automaticSession.id = Util.newId(); | ||
// Expiring the cookie will cause the session to expire even if the user isn't on the page | ||
var acquisitionExpiry = acq + this.config.sessionExpirationMs(); | ||
var renewalExpiry = renewal + this.config.sessionRenewalMs(); | ||
var cookieExpiry = new Date(); | ||
var cookie = [guid, acq, renewal]; | ||
const acquisitionExpiry = acq + this.config.sessionExpirationMs(); | ||
const renewalExpiry = renewal + this.config.sessionRenewalMs(); | ||
const cookieExpiry = new Date(); | ||
const cookie = [guid, acq, renewal]; | ||
@@ -213,3 +210,3 @@ if (acquisitionExpiry < renewalExpiry) { | ||
var cookieDomnain = this.config.cookieDomain ? this.config.cookieDomain() : null; | ||
const cookieDomnain = this.config.cookieDomain ? this.config.cookieDomain() : null; | ||
@@ -216,0 +213,0 @@ Util.setCookie(this._logger, this._storageNamePrefix(), cookie.join('|') + ';expires=' + cookieExpiry.toUTCString(), cookieDomnain); |
@@ -44,56 +44,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
public isNewUser = false; | ||
private _logger: IDiagnosticLogger; | ||
/** | ||
* Sets the authenticated user id and the account id in this session. | ||
* | ||
* @param authenticatedUserId {string} - The authenticated user id. A unique and persistent string that represents each authenticated user in the service. | ||
* @param accountId {string} - An optional string to represent the account associated with the authenticated user. | ||
*/ | ||
public setAuthenticatedUserContext(authenticatedUserId: string, accountId?: string, storeInCookie = false) { | ||
// Validate inputs to ensure no cookie control characters. | ||
var isInvalidInput = !this.validateUserInput(authenticatedUserId) || (accountId && !this.validateUserInput(accountId)); | ||
if (isInvalidInput) { | ||
this._logger.throwInternal( | ||
LoggingSeverity.WARNING, | ||
_InternalMessageId.SetAuthContextFailedAccountName, | ||
"Setting auth user context failed. " + | ||
"User auth/account id should be of type string, and not contain commas, semi-colons, equal signs, spaces, or vertical-bars.", | ||
true); | ||
return; | ||
} | ||
// Create cookie string. | ||
this.authenticatedId = authenticatedUserId; | ||
var authCookie = this.authenticatedId; | ||
if (accountId) { | ||
this.accountId = accountId; | ||
authCookie = [this.authenticatedId, this.accountId].join(User.cookieSeparator); | ||
} | ||
if (storeInCookie) { | ||
// Set the cookie. No expiration date because this is a session cookie (expires when browser closed). | ||
// Encoding the cookie to handle unexpected unicode characters. | ||
Util.setCookie(this._logger, User.authUserCookieName, encodeURI(authCookie), this.config.cookieDomain()); | ||
} | ||
} | ||
/** | ||
* Clears the authenticated user id and the account id from the user context. | ||
* @returns {} | ||
*/ | ||
public clearAuthenticatedUserContext() { | ||
this.authenticatedId = null; | ||
this.accountId = null; | ||
Util.deleteCookie(this._logger, User.authUserCookieName); | ||
} | ||
constructor(config: ITelemetryConfig, logger: IDiagnosticLogger) { | ||
this._logger = logger; | ||
//get userId or create new one if none exists | ||
var cookie = Util.getCookie(this._logger, User.userCookieName); | ||
// get userId or create new one if none exists | ||
const cookie = Util.getCookie(this._logger, User.userCookieName); | ||
if (cookie) { | ||
var params = cookie.split(User.cookieSeparator); | ||
this.isNewUser = false; | ||
const params = cookie.split(User.cookieSeparator); | ||
if (params.length > 0) { | ||
@@ -108,5 +66,6 @@ this.id = params[0]; | ||
this.id = Util.newId(); | ||
var date = new Date(); | ||
var acqStr = Util.toISOStringForIE8(date); | ||
const date = new Date(); | ||
const acqStr = Util.toISOStringForIE8(date); | ||
this.accountAcquisitionDate = acqStr; | ||
this.isNewUser = true; | ||
// without expiration, cookies expire at the end of the session | ||
@@ -116,4 +75,4 @@ // set it to 365 days from now | ||
date.setTime(date.getTime() + 31536000000); | ||
var newCookie = [this.id, acqStr]; | ||
var cookieDomain = this.config.cookieDomain ? this.config.cookieDomain() : undefined; | ||
const newCookie = [this.id, acqStr]; | ||
const cookieDomain = this.config.cookieDomain ? this.config.cookieDomain() : undefined; | ||
@@ -134,6 +93,6 @@ Util.setCookie(this._logger, User.userCookieName, newCookie.join(User.cookieSeparator) + ';expires=' + date.toUTCString(), cookieDomain); | ||
// Cookie is in the pattern: <authenticatedId>|<accountId> | ||
var authCookie = Util.getCookie(this._logger, User.authUserCookieName); | ||
let authCookie = Util.getCookie(this._logger, User.authUserCookieName); | ||
if (authCookie) { | ||
authCookie = decodeURI(authCookie); | ||
var authCookieString = authCookie.split(User.cookieSeparator); | ||
const authCookieString = authCookie.split(User.cookieSeparator); | ||
if (authCookieString[0]) { | ||
@@ -148,2 +107,47 @@ this.authenticatedId = authCookieString[0]; | ||
/** | ||
* Sets the authenticated user id and the account id in this session. | ||
* | ||
* @param authenticatedUserId {string} - The authenticated user id. A unique and persistent string that represents each authenticated user in the service. | ||
* @param accountId {string} - An optional string to represent the account associated with the authenticated user. | ||
*/ | ||
public setAuthenticatedUserContext(authenticatedUserId: string, accountId?: string, storeInCookie = false) { | ||
// Validate inputs to ensure no cookie control characters. | ||
const isInvalidInput = !this.validateUserInput(authenticatedUserId) || (accountId && !this.validateUserInput(accountId)); | ||
if (isInvalidInput) { | ||
this._logger.throwInternal( | ||
LoggingSeverity.WARNING, | ||
_InternalMessageId.SetAuthContextFailedAccountName, | ||
"Setting auth user context failed. " + | ||
"User auth/account id should be of type string, and not contain commas, semi-colons, equal signs, spaces, or vertical-bars.", | ||
true); | ||
return; | ||
} | ||
// Create cookie string. | ||
this.authenticatedId = authenticatedUserId; | ||
let authCookie = this.authenticatedId; | ||
if (accountId) { | ||
this.accountId = accountId; | ||
authCookie = [this.authenticatedId, this.accountId].join(User.cookieSeparator); | ||
} | ||
if (storeInCookie) { | ||
// Set the cookie. No expiration date because this is a session cookie (expires when browser closed). | ||
// Encoding the cookie to handle unexpected unicode characters. | ||
Util.setCookie(this._logger, User.authUserCookieName, encodeURI(authCookie), this.config.cookieDomain()); | ||
} | ||
} | ||
/** | ||
* Clears the authenticated user id and the account id from the user context. | ||
* @returns {} | ||
*/ | ||
public clearAuthenticatedUserContext() { | ||
this.authenticatedId = null; | ||
this.accountId = null; | ||
Util.deleteCookie(this._logger, User.authUserCookieName); | ||
} | ||
private validateUserInput(id: string): boolean { | ||
@@ -150,0 +154,0 @@ // Validate: |
@@ -8,3 +8,3 @@ /** | ||
ITelemetryPlugin, IConfiguration, CoreUtils, | ||
IAppInsightsCore, IPlugin, ITelemetryItem, IDiagnosticLogger | ||
IAppInsightsCore, IPlugin, ITelemetryItem, IDiagnosticLogger, _InternalLogMessage, LoggingSeverity, _InternalMessageId | ||
} from '@microsoft/applicationinsights-core-js'; | ||
@@ -17,12 +17,3 @@ import { TelemetryContext } from './TelemetryContext'; | ||
export default class PropertiesPlugin implements ITelemetryPlugin, IPropertiesPlugin { | ||
public context: TelemetryContext; | ||
private _logger: IDiagnosticLogger; | ||
private _breezeChannel: IPlugin; // optional. If exists, grab appId from it | ||
public priority = 110; | ||
public identifier = PropertiesPluginIdentifier; | ||
private _nextPlugin: ITelemetryPlugin; | ||
private _extensionConfig: ITelemetryConfig; | ||
public static getDefaultConfig(): ITelemetryConfig { | ||
@@ -43,7 +34,16 @@ const defaultConfig: ITelemetryConfig = { | ||
} | ||
public context: TelemetryContext; | ||
public priority = 110; | ||
public identifier = PropertiesPluginIdentifier; | ||
private _logger: IDiagnosticLogger; | ||
private _breezeChannel: IPlugin; // optional. If exists, grab appId from it | ||
private _nextPlugin: ITelemetryPlugin; | ||
private _extensionConfig: ITelemetryConfig; | ||
initialize(config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[]) { | ||
const defaultConfig: ITelemetryConfig = PropertiesPlugin.getDefaultConfig(); | ||
this._extensionConfig = this._extensionConfig || PropertiesPlugin.getDefaultConfig(); | ||
for (let field in defaultConfig) { | ||
for (const field in defaultConfig) { | ||
this._extensionConfig[field] = () => ConfigurationManager.getConfig(config, field, this.identifier, defaultConfig[field]()); | ||
@@ -80,2 +80,8 @@ } | ||
if (this.context && this.context.user && this.context.user.isNewUser) { | ||
this.context.user.isNewUser = false; | ||
const message = new _InternalLogMessage(_InternalMessageId.SendBrowserInfoOnUserInit, navigator.userAgent); | ||
this._logger.logInternalMessage(LoggingSeverity.CRITICAL, message); | ||
} | ||
if (!CoreUtils.isNullOrUndefined(this._nextPlugin)) { | ||
@@ -82,0 +88,0 @@ this._nextPlugin.processTelemetry(event); |
@@ -46,3 +46,3 @@ /** | ||
public applySessionContext(event: ITelemetryItem) { | ||
let sessionContext = this.session || this.sessionManager.automaticSession; | ||
const sessionContext = this.session || this.sessionManager.automaticSession; | ||
if (sessionContext) { | ||
@@ -124,3 +124,3 @@ if (typeof sessionContext.id === "string") { | ||
if (this.telemetryTrace) { | ||
let trace = event.ext.trace || <ITelemetryTrace>{traceID: undefined, parentID: undefined}; | ||
const trace = event.ext.trace || ({traceID: undefined, parentID: undefined} as ITelemetryTrace); | ||
if (typeof this.telemetryTrace.traceID === "string") { | ||
@@ -157,3 +157,3 @@ trace.traceID = this.telemetryTrace.traceID; | ||
if (typeof this.user.accountId === "string") { | ||
let item = {}; | ||
const item = {}; | ||
event.tags[CtxTagKeys.userAccountId] = this.user.accountId; | ||
@@ -160,0 +160,0 @@ } |
@@ -16,9 +16,8 @@ { | ||
"declaration": true, | ||
"declarationMap": true, | ||
"declarationDir": "vNext/extensions/applicationinsights-properties-js/types", | ||
"declarationDir": "extensions/applicationinsights-properties-js/types", | ||
"outDir": "dist-esm", | ||
"rootDir": "vNext/extensions/applicationinsights-properties-js/src" | ||
"rootDir": "extensions/applicationinsights-properties-js/src" | ||
}, | ||
"include": [ | ||
"./src/*.ts" | ||
"./src/**/*.ts" | ||
], | ||
@@ -25,0 +24,0 @@ "exclude": [ |
@@ -13,5 +13,5 @@ import { IInternal } from '@microsoft/applicationinsights-common'; | ||
/** | ||
* Constructs a new instance of the internal telemetry data class. | ||
*/ | ||
* Constructs a new instance of the internal telemetry data class. | ||
*/ | ||
constructor(config: ITelemetryConfig); | ||
} |
@@ -30,5 +30,5 @@ import { ISession } from '@microsoft/applicationinsights-common'; | ||
static cookieUpdateInterval: number; | ||
private static cookieNameConst; | ||
automaticSession: Session; | ||
config: ISessionConfig; | ||
private static cookieNameConst; | ||
private cookieUpdatedTimestamp; | ||
@@ -35,0 +35,0 @@ private _logger; |
@@ -32,9 +32,11 @@ import { ITelemetryConfig } from '../Interfaces/ITelemetryConfig'; | ||
accountAcquisitionDate: string; | ||
isNewUser: boolean; | ||
private _logger; | ||
constructor(config: ITelemetryConfig, logger: IDiagnosticLogger); | ||
/** | ||
* Sets the authenticated user id and the account id in this session. | ||
* | ||
* @param authenticatedUserId {string} - The authenticated user id. A unique and persistent string that represents each authenticated user in the service. | ||
* @param accountId {string} - An optional string to represent the account associated with the authenticated user. | ||
*/ | ||
* Sets the authenticated user id and the account id in this session. | ||
* | ||
* @param authenticatedUserId {string} - The authenticated user id. A unique and persistent string that represents each authenticated user in the service. | ||
* @param accountId {string} - An optional string to represent the account associated with the authenticated user. | ||
*/ | ||
setAuthenticatedUserContext(authenticatedUserId: string, accountId?: string, storeInCookie?: boolean): void; | ||
@@ -46,4 +48,3 @@ /** | ||
clearAuthenticatedUserContext(): void; | ||
constructor(config: ITelemetryConfig, logger: IDiagnosticLogger); | ||
private validateUserInput(id); | ||
} |
@@ -10,10 +10,10 @@ /** | ||
export default class PropertiesPlugin implements ITelemetryPlugin, IPropertiesPlugin { | ||
static getDefaultConfig(): ITelemetryConfig; | ||
context: TelemetryContext; | ||
priority: number; | ||
identifier: string; | ||
private _logger; | ||
private _breezeChannel; | ||
priority: number; | ||
identifier: string; | ||
private _nextPlugin; | ||
private _extensionConfig; | ||
static getDefaultConfig(): ITelemetryConfig; | ||
initialize(config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[]): void; | ||
@@ -20,0 +20,0 @@ /** |
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 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
1302193
7006
11
+ Added@microsoft/applicationinsights-common@2.2.3(transitive)
+ Added@microsoft/applicationinsights-core-js@2.2.3(transitive)
- Removed@microsoft/applicationinsights-common@2.2.2(transitive)
- Removed@microsoft/applicationinsights-core-js@2.2.2(transitive)