@microsoft/applicationinsights-dependencies-js
Advanced tools
Comparing version 2.1.1 to 2.2.0
/*! | ||
* Application Insights JavaScript SDK - Dependencies Plugin, 2.1.1 | ||
* Application Insights JavaScript SDK - Dependencies Plugin, 2.2.0 | ||
* 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 a,t,h,n;(t=a||(a={}))[t.LocalStorage=0]="LocalStorage",t[t.SessionStorage=1]="SessionStorage",(n=h||(h={}))[n.Default=0]="Default",n[n.Required=1]="Required",n[n.Array=2]="Array",n[n.Hidden=4]="Hidden";var c=(r.isNullOrUndefined=function(e){return null==e},r.disableCookies=function(){r._canUseCookies=!1},r.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(s,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},r);function r(){}var i,o,s=/[xy]/g;(o=i||(i={}))[o.CRITICAL=1]="CRITICAL",o[o.WARNING=2]="WARNING";var l=1,u=2,d=3,p=4,f=5,g=6,m=13,v=14,x=15,y=16,D=17,S=18,I=49,C=52,N=55,w=56,A=57,_=61,M=66,b=68,T=69;j.prototype.processTelemetry=function(t){this.channelQueue.forEach(function(e){0<e.length&&e[0].processTelemetry(t)})},Object.defineProperty(j.prototype,"ChannelControls",{get:function(){return this.channelQueue},enumerable:!0,configurable:!0}),j.prototype.initialize=function(n,r,a){var i=this;if(n.isCookieUseDisabled&&c.disableCookies(),this.channelQueue=new Array,n.channels){var o=void 0;n.channels.forEach(function(e){if(e&&0<e.length){if((e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){e.priority<500&&(o=e.identifier),e.initialize(n,r,a)}),o)throw Error("Channel has invalid priority"+o);for(var t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);i.channelQueue.push(e)}})}for(var e=new Array,t=0;t<a.length;t++){var s=a[t];500<s.priority&&e.push(s)}if(0<e.length){for((e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){return e.initialize(n,r,a)}),t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);this.channelQueue.push(e)}};function j(){this.identifier="ChannelControllerPlugin",this.priority=500}var R=(E.requestContextHeader="Request-Context",E.requestContextTargetKey="appId",E.requestContextAppIdFormat="appId=cid-v1:",E.requestIdHeader="Request-Id",E.sdkContextHeader="Sdk-Context",E.sdkContextHeaderAppIdRequest="appId",E.requestContextHeaderLowerCase="request-context",E);function E(){}var U=(q.sanitizeKeyAndAddUniqueness=function(e,t,n){var r=t.length,a=q.sanitizeKey(e,t);if(a.length!==r){for(var i=0,o=a;void 0!==n[o];)i++,o=a.substring(0,q.MAX_NAME_LENGTH-3)+q.padNumber(i);a=o}return a},q.sanitizeKey=function(e,t){var n;return t&&(t=q.trim(t.toString())).length>q.MAX_NAME_LENGTH&&(n=t.substring(0,q.MAX_NAME_LENGTH),e.throwInternal(i.WARNING,A,"name is too long. It has been truncated to "+q.MAX_NAME_LENGTH+" characters.",{name:t},!0)),n||t},q.sanitizeString=function(e,t,n){var r;return void 0===n&&(n=q.MAX_STRING_LENGTH),t&&(n=n||q.MAX_STRING_LENGTH,(t=q.trim(t)).toString().length>n&&(r=t.toString().substring(0,n),e.throwInternal(i.WARNING,_,"string value is too long. It has been truncated to "+n+" characters.",{value:t},!0))),r||t},q.sanitizeUrl=function(e,t){return q.sanitizeInput(e,t,q.MAX_URL_LENGTH,M)},q.sanitizeMessage=function(e,t){var n;return t&&t.length>q.MAX_MESSAGE_LENGTH&&(n=t.substring(0,q.MAX_MESSAGE_LENGTH),e.throwInternal(i.WARNING,w,"message is too long, it has been truncated to "+q.MAX_MESSAGE_LENGTH+" characters.",{message:t},!0)),n||t},q.sanitizeException=function(e,t){var n;return t&&t.length>q.MAX_EXCEPTION_LENGTH&&(n=t.substring(0,q.MAX_EXCEPTION_LENGTH),e.throwInternal(i.WARNING,C,"exception is too long, it has been truncated to "+q.MAX_EXCEPTION_LENGTH+" characters.",{exception:t},!0)),n||t},q.sanitizeProperties=function(t,e){if(e){var n={};for(var r in e){var a=e[r];if("object"==typeof a&&"undefined"!=typeof JSON)try{a=JSON.stringify(a)}catch(e){t.throwInternal(i.WARNING,I,"custom property is not valid",{exception:e},!0)}a=q.sanitizeString(t,a,q.MAX_PROPERTY_LENGTH),n[r=q.sanitizeKeyAndAddUniqueness(t,r,n)]=a}e=n}return e},q.sanitizeMeasurements=function(e,t){if(t){var n={};for(var r in t){var a=t[r];n[r=q.sanitizeKeyAndAddUniqueness(e,r,n)]=a}t=n}return t},q.sanitizeId=function(e,t){return t?q.sanitizeInput(e,t,q.MAX_ID_LENGTH,T).toString():t},q.sanitizeInput=function(e,t,n,r){var a;return t&&(t=q.trim(t)).length>n&&(a=t.substring(0,n),e.throwInternal(i.WARNING,r,"input is too long, it has been truncated to "+n+" characters.",{data:t},!0)),a||t},q.padNumber=function(e){var t="00"+e;return t.substr(t.length-3)},q.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},q.MAX_NAME_LENGTH=150,q.MAX_ID_LENGTH=128,q.MAX_PROPERTY_LENGTH=8192,q.MAX_STRING_LENGTH=1024,q.MAX_URL_LENGTH=2048,q.MAX_MESSAGE_LENGTH=32768,q.MAX_EXCEPTION_LENGTH=32768,q);function q(){}var L=(k.disableStorage=function(){k._canUseLocalStorage=!1,k._canUseSessionStorage=!1},k._getLocalStorageObject=function(){return k.canUseLocalStorage()?k._getVerifiedStorageObject(a.LocalStorage):null},k._getVerifiedStorageObject=function(e){var t,n,r=null;try{if("undefined"==typeof window)return null;n=new Date,(r=e===a.LocalStorage?window.localStorage:window.sessionStorage).setItem(n,n),t=r.getItem(n)!=n,r.removeItem(n),t&&(r=null)}catch(e){r=null}return r},k.isInternalApplicationInsightsEndpoint=function(e){return-1!==k._internalEndpoints.indexOf(e.toLowerCase())},k.canUseLocalStorage=function(){return void 0===k._canUseLocalStorage&&(k._canUseLocalStorage=!!k._getVerifiedStorageObject(a.LocalStorage)),k._canUseLocalStorage},k.getStorage=function(t,e){var n=k._getLocalStorageObject();if(null!==n)try{return n.getItem(e)}catch(e){k._canUseLocalStorage=!1,t.throwInternal(i.WARNING,l,"Browser failed read of local storage. "+k.getExceptionName(e),{exception:k.dump(e)})}return null},k.setStorage=function(t,e,n){var r=k._getLocalStorageObject();if(null!==r)try{return r.setItem(e,n),!0}catch(e){k._canUseLocalStorage=!1,t.throwInternal(i.WARNING,d,"Browser failed write to local storage. "+k.getExceptionName(e),{exception:k.dump(e)})}return!1},k.removeStorage=function(t,e){var n=k._getLocalStorageObject();if(null!==n)try{return n.removeItem(e),!0}catch(e){k._canUseLocalStorage=!1,t.throwInternal(i.WARNING,f,"Browser failed removal of local storage item. "+k.getExceptionName(e),{exception:k.dump(e)})}return!1},k._getSessionStorageObject=function(){return k.canUseSessionStorage()?k._getVerifiedStorageObject(a.SessionStorage):null},k.canUseSessionStorage=function(){return void 0===k._canUseSessionStorage&&(k._canUseSessionStorage=!!k._getVerifiedStorageObject(a.SessionStorage)),k._canUseSessionStorage},k.getSessionStorageKeys=function(){var e=[];if(k.canUseSessionStorage())for(var t in window.sessionStorage)e.push(t);return e},k.getSessionStorage=function(t,e){var n=k._getSessionStorageObject();if(null!==n)try{return n.getItem(e)}catch(e){k._canUseSessionStorage=!1,t.throwInternal(i.WARNING,u,"Browser failed read of session storage. "+k.getExceptionName(e),{exception:k.dump(e)})}return null},k.setSessionStorage=function(t,e,n){var r=k._getSessionStorageObject();if(null!==r)try{return r.setItem(e,n),!0}catch(e){k._canUseSessionStorage=!1,t.throwInternal(i.WARNING,p,"Browser failed write to session storage. "+k.getExceptionName(e),{exception:k.dump(e)})}return!1},k.removeSessionStorage=function(t,e){var n=k._getSessionStorageObject();if(null!==n)try{return n.removeItem(e),!0}catch(e){k._canUseSessionStorage=!1,t.throwInternal(i.WARNING,g,"Browser failed removal of session storage item. "+k.getExceptionName(e),{exception:k.dump(e)})}return!1},k.disableCookies=function(){c.disableCookies()},k.canUseCookies=function(t){if(void 0===c._canUseCookies){c._canUseCookies=!1;try{c._canUseCookies=void 0!==k.document.cookie}catch(e){t.throwInternal(i.WARNING,b,"Cannot access document.cookie - "+k.getExceptionName(e),{exception:k.dump(e)})}}return c._canUseCookies},k.setCookie=function(e,t,n,r){var a="",i="";r&&(a=";domain="+r),k.document.location&&"https:"===k.document.location.protocol&&(i=";secure"),k.canUseCookies(e)&&(k.document.cookie=t+"="+n+a+";path=/"+i)},k.stringToBoolOrDefault=function(e,t){return void 0===t&&(t=!1),null==e?t:"true"===e.toString().toLowerCase()},k.getCookie=function(e,t){if(k.canUseCookies(e)){var n="";if(t&&t.length)for(var r=t+"=",a=k.document.cookie.split(";"),i=0;i<a.length;i++){var o=a[i];if((o=k.trim(o))&&0===o.indexOf(r)){n=o.substring(r.length,a[i].length);break}}return n}},k.deleteCookie=function(e,t){k.canUseCookies(e)&&(k.document.cookie=t+"=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;")},k.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},k.newId=function(){for(var e="",t=1073741824*Math.random();0<t;)e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t%64),t=Math.floor(t/64);return e},k.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},k.isError=function(e){return"[object Error]"===Object.prototype.toString.call(e)},k.isDate=function(e){return"[object Date]"===Object.prototype.toString.call(e)},k.toISOStringForIE8=function(e){if(k.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"}},k.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},k.msToTimeSpan=function(e){(isNaN(e)||e<0)&&(e=0);var t=""+(e=Math.round(e))%1e3,n=""+Math.floor(e/1e3)%60,r=""+Math.floor(e/6e4)%60,a=""+Math.floor(e/36e5)%24,i=Math.floor(e/864e5);return t=1===t.length?"00"+t:2===t.length?"0"+t:t,n=n.length<2?"0"+n:n,r=r.length<2?"0"+r:r,(0<i?i+".":"")+(a=a.length<2?"0"+a:a)+":"+r+":"+n+"."+t},k.isCrossOriginError=function(e,t,n,r,a){return("Script error."===e||"Script error"===e)&&!a},k.dump=function(e){var t=Object.prototype.toString.call(e),n=JSON.stringify(e);return"[object Error]"===t&&(n="{ stack: '"+e.stack+"', message: '"+e.message+"', name: '"+e.name+"'"),t+n},k.getExceptionName=function(e){return"[object Error]"===Object.prototype.toString.call(e)?e.name:""},k.addEventHandler=function(e,t){if("undefined"==typeof window||!window||"string"!=typeof e||"function"!=typeof t)return!1;var n="on"+e;if(window.addEventListener)window.addEventListener(e,t,!1);else{if(!window.attachEvent)return!1;window.attachEvent(n,t)}return!0},k.IsBeaconApiSupported=function(){return"sendBeacon"in navigator&&navigator.sendBeacon},k.getExtension=function(e,t){for(var n=null,r=0;!n&&r<e.length;)e[r]&&e[r].identifier===t&&(n=e[r]),r++;return n},k.document="undefined"!=typeof document?document:{},k._canUseLocalStorage=void 0,k._canUseSessionStorage=void 0,k._internalEndpoints=["https://dc.services.visualstudio.com/v2/track","https://breeze.aimon.applicationinsights.io/v2/track","https://dc-int.services.visualstudio.com/v2/track"],k.NotSpecified="not_specified",k);function k(){}var F=(H.parseUrl=function(e){return H.htmlAnchorElement||(H.htmlAnchorElement=H.document.createElement?H.document.createElement("a"):{host:H.parseHost(e)}),H.htmlAnchorElement.href=e,H.htmlAnchorElement},H.getAbsoluteUrl=function(e){var t,n=H.parseUrl(e);return n&&(t=n.href),t},H.getPathName=function(e){var t,n=H.parseUrl(e);return n&&(t=n.pathname),t},H.getCompleteUrl=function(e,t){return e?e.toUpperCase()+" "+t:t},H.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},H.document="undefined"!=typeof document?document:{},H);function H(){}var O=(z.canIncludeCorrelationHeader=function(e,t,n){if(e&&e.disableCorrelationHeaders)return!1;if(!t)return!1;var r=F.parseUrl(t).host.toLowerCase();if(!(e&&e.enableCorsCorrelation||r===n))return!1;var a,i=e&&e.correlationHeaderDomains;if(i&&(i.forEach(function(e){var t=new RegExp(e.toLowerCase().replace(/\./g,".").replace(/\*/g,".*"));a=a||t.test(r)}),!a))return!1;var o=e&&e.correlationHeaderExcludedDomains;if(!o||0==o.length)return!0;for(var s=0;s<o.length;s++)if(new RegExp(o[s].toLowerCase().replace(/\./g,".").replace(/\*/g,".*")).test(r))return!1;return!0},z.getCorrelationContext=function(e){if(e){var t=z.getCorrelationContextValue(e,R.requestContextTargetKey);if(t&&t!==z.correlationIdPrefix)return t}},z.getCorrelationContextValue=function(e,t){if(e)for(var n=e.split(","),r=0;r<n.length;++r){var a=n[r].split("=");if(2==a.length&&a[0]==t)return a[1]}},z.correlationIdPrefix="cid-v1:",z);function z(){}var G=(P.ParseDependencyPath=function(e,t,n,r){var a,i=r,o=r;if(t&&0<t.length){var s=F.parseUrl(t);if(a=s.host,!i)if(null!=s.pathname){var c=0===s.pathname.length?"/":s.pathname;"/"!==c.charAt(0)&&(c="/"+c),o=s.pathname,i=U.sanitizeString(e,n?n+" "+c:c)}else i=U.sanitizeString(e,t)}else i=a=r;return{target:a,name:i,data:o}},P);function P(){}var X=(W.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()},W.GetDuration=function(e,t){var n=null;return 0===e||0===t||c.isNullOrUndefined(e)||c.isNullOrUndefined(t)||(n=t-e),n},W);function W(){}var B="Microsoft_ApplicationInsights_BypassAjaxInstrumentation",V=function(e,t){return(V=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function K(e,t){function n(){this.constructor=e}V(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var Q,J=function(){return(J=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)},Y=(K($,Q=function(){}),$);function $(){return Q.call(this)||this}var Z;K(ee,Z=function(){this.ver=1,this.sampleRate=100,this.tags={}});function ee(e,t,n){var r=Z.call(this)||this;return r.name=U.sanitizeString(e,n)||L.NotSpecified,r.data=t,r.time=L.toISOStringForIE8(new Date),r.aiDataContract={time:h.Required,iKey:h.Required,name:h.Required,sampleRate:function(){return 100==r.sampleRate?h.Hidden:h.Required},tags:h.Required,data:h.Required},r}function te(){}var ne,re=(K(ae,ne=te),ae);function ae(){var e=ne.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var ie;K(oe,ie=re),oe.envelopeType="Microsoft.ApplicationInsights.{0}.Event",oe.dataType="EventData";function oe(e,t,n,r){var a=ie.call(this)||this;return a.aiDataContract={ver:h.Required,name:h.Required,properties:h.Default,measurements:h.Default},a.name=U.sanitizeString(e,t)||L.NotSpecified,a.properties=U.sanitizeProperties(e,n),a.measurements=U.sanitizeMeasurements(e,r),a}function se(){}var ce,le=(K(ue,ce=te),ue);function ue(){var e=ce.call(this)||this;return e.ver=2,e.exceptions=[],e.properties={},e.measurements={},e}function de(){this.hasFullStack=!0,this.parsedStack=[]}var pe;K(he,pe=le),he.CreateFromInterface=function(t,e){var n=e.exceptions&&e.exceptions.map(function(e){return ge.CreateFromInterface(t,e)});return new he(t,J({},e,{exceptions:n}))},he.prototype.toInterface=function(){var e=this,t=e.exceptions,n=e.properties,r=e.measurements,a=e.severityLevel,i=e.ver,o=e.problemGroup,s=e.id,c=e.isManual;return{ver:i,exceptions:t instanceof Array&&t.map(function(e){return e.toInterface()})||void 0,severityLevel:a,properties:n,measurements:r,problemGroup:o,id:s,isManual:c}},he.CreateSimpleException=function(e,t,n,r,a,i){return{exceptions:[{hasFullStack:!0,message:e,stack:a,typeName:t}]}},he.envelopeType="Microsoft.ApplicationInsights.{0}.Exception",he.dataType="ExceptionData";function he(e,t,n,r,a,i){var o=pe.call(this)||this;return o.aiDataContract={ver:h.Required,exceptions:h.Required,severityLevel:h.Default,properties:h.Default,measurements:h.Default},t instanceof Error?(o.exceptions=[new ge(e,t)],o.properties=U.sanitizeProperties(e,n),o.measurements=U.sanitizeMeasurements(e,r),a&&(o.severityLevel=a),i&&(o.id=i)):(o.exceptions=t.exceptions,o.properties=t.properties,o.measurements=t.measurements,t.severityLevel&&(o.severityLevel=t.severityLevel),t.id&&(o.id=t.id),t.problemGroup&&(o.problemGroup=t.problemGroup),c.isNullOrUndefined(t.ver)||(o.ver=t.ver),c.isNullOrUndefined(t.isManual)||(o.isManual=t.isManual)),o}var fe,ge=(K(me,fe=de),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 n=t.parsedStack instanceof Array&&t.parsedStack.map(function(e){return xe.CreateFromInterface(e)})||t.parsedStack;return new me(e,J({},t,{parsedStack:n}))},me.parseStack=function(e){var t=void 0;if("string"==typeof e){var n=e.split("\n");t=[];for(var r=0,a=0,i=0;i<=n.length;i++){var o=n[i];if(xe.regex.test(o)){var s=new xe(n[i],r++);a+=s.sizeInBytes,t.push(s)}}if(32768<a)for(var c=0,l=t.length-1,u=0,d=c,p=l;c<l;){if(32768<(u+=t[c].sizeInBytes+t[l].sizeInBytes)){var h=p-d+1;t.splice(d,h);break}d=c,p=l,c++,l--}}return t},me);function me(e,t){var n=fe.call(this)||this;if(n.aiDataContract={id:h.Default,outerId:h.Default,typeName:h.Required,message:h.Required,hasFullStack:h.Default,stack:h.Default,parsedStack:h.Array},t instanceof Error){n.typeName=U.sanitizeString(e,t.name)||L.NotSpecified,n.message=U.sanitizeMessage(e,t.message)||L.NotSpecified;var r=t.stack;n.parsedStack=me.parseStack(r),n.stack=U.sanitizeException(e,r),n.hasFullStack=L.isArray(n.parsedStack)&&0<n.parsedStack.length}else n.typeName=t.typeName,n.message=t.message,n.stack=t.stack,n.parsedStack=t.parsedStack,n.hasFullStack=t.hasFullStack;return n}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 n=ve.call(this)||this;if(n.sizeInBytes=0,n.aiDataContract={level:h.Required,method:h.Required,assembly:h.Default,fileName:h.Default,line:h.Default},"string"==typeof e){var r=e;n.level=t,n.method="<no_method>",n.assembly=L.trim(r),n.fileName="",n.line=0;var a=r.match(ye.regex);a&&5<=a.length&&(n.method=L.trim(a[2])||n.method,n.fileName=L.trim(a[4]),n.line=parseInt(a[5])||0)}else n.level=e.level,n.method=e.method,n.assembly=e.assembly,n.fileName=e.fileName,n.line=e.line,n.sizeInBytes=0;return n.sizeInBytes+=n.method.length,n.sizeInBytes+=n.fileName.length,n.sizeInBytes+=n.assembly.length,n.sizeInBytes+=ye.baseSize,n.sizeInBytes+=n.level.toString().length,n.sizeInBytes+=n.line.toString().length,n}var De,Se,Ie,Ce=(K(Ne,De=te),Ne);function Ne(){var e=De.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 we,Ae=(K(_e,we=function(){this.kind=Se.Measurement}),_e);function _e(){var e=null!==we&&we.apply(this,arguments)||this;return e.aiDataContract={name:h.Required,kind:h.Default,value:h.Required,count:h.Default,min:h.Default,max:h.Default,stdDev:h.Default},e}var Me;K(be,Me=Ce),be.envelopeType="Microsoft.ApplicationInsights.{0}.Metric",be.dataType="MetricData";function be(e,t,n,r,a,i,o){var s=Me.call(this)||this;s.aiDataContract={ver:h.Required,metrics:h.Required,properties:h.Default};var c=new Ae;return c.count=0<r?r:void 0,c.max=isNaN(i)||null===i?void 0:i,c.min=isNaN(a)||null===a?void 0:a,c.name=U.sanitizeString(e,t)||L.NotSpecified,c.value=n,s.metrics=[c],s.properties=U.sanitizeProperties(e,o),s}var Te,je=(K(Re,Te=re),Re);function Re(){var e=Te.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var Ee;K(Ue,Ee=je),Ue.envelopeType="Microsoft.ApplicationInsights.{0}.Pageview",Ue.dataType="PageviewData";function Ue(e,t,n,r,a,i,o){var s=Ee.call(this)||this;return s.aiDataContract={ver:h.Required,name:h.Default,url:h.Default,duration:h.Default,properties:h.Default,measurements:h.Default,id:h.Default},s.id=U.sanitizeId(e,o),s.url=U.sanitizeUrl(e,n),s.name=U.sanitizeString(e,t)||L.NotSpecified,isNaN(r)||(s.duration=L.msToTimeSpan(r)),s.properties=U.sanitizeProperties(e,a),s.measurements=U.sanitizeMeasurements(e,i),s}var qe,Le=(K(ke,qe=te),ke);function ke(){var e=qe.call(this)||this;return e.ver=2,e.success=!0,e.properties={},e.measurements={},e}var Fe,He=(K(Oe,Fe=Le),Oe.envelopeType="Microsoft.ApplicationInsights.{0}.RemoteDependency",Oe.dataType="RemoteDependencyData",Oe);function Oe(e,t,n,r,a,i,o,s,c,l,u){void 0===c&&(c="Ajax");var d=Fe.call(this)||this;d.aiDataContract={id:h.Required,ver:h.Required,name:h.Default,resultCode:h.Default,duration:h.Default,success:h.Default,data:h.Default,target:h.Default,type:h.Default,properties:h.Default,measurements:h.Default,kind:h.Default,value:h.Default,count:h.Default,min:h.Default,max:h.Default,stdDev:h.Default,dependencyKind:h.Default,dependencySource:h.Default,commandName:h.Default,dependencyTypeName:h.Default},d.id=t,d.duration=L.msToTimeSpan(a),d.success=i,d.resultCode=o+"",d.type=U.sanitizeString(e,c);var p=G.ParseDependencyPath(e,n,s,r);return d.data=U.sanitizeUrl(e,r)||p.data,d.target=U.sanitizeString(e,p.target),d.name=U.sanitizeString(e,p.name),d.properties=U.sanitizeProperties(e,l),d.measurements=U.sanitizeMeasurements(e,u),d}var ze,Ge=(K(Pe,ze=te),Pe);function Pe(){var e=ze.call(this)||this;return e.ver=2,e.properties={},e}var Xe;K(We,Xe=Ge),We.envelopeType="Microsoft.ApplicationInsights.{0}.Message",We.dataType="MessageData";function We(e,t,n,r){var a=Xe.call(this)||this;return a.aiDataContract={ver:h.Required,message:h.Required,severityLevel:h.Default,properties:h.Default},t=t||L.NotSpecified,a.message=U.sanitizeMessage(e,t),a.properties=U.sanitizeProperties(e,r),n&&(a.severityLevel=n),a}var Be,Ve=(K(Ke,Be=je),Ke);function Ke(){var e=Be.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var Qe;K(Je,Qe=Ve),Je.envelopeType="Microsoft.ApplicationInsights.{0}.PageviewPerformance",Je.dataType="PageviewPerformanceData";function Je(e,t,n,r,a,i,o){var s=Qe.call(this)||this;return s.aiDataContract={ver:h.Required,name:h.Default,url:h.Default,duration:h.Default,perfTotal:h.Default,networkConnect:h.Default,sentRequest:h.Default,receivedResponse:h.Default,domProcessing:h.Default,properties:h.Default,measurements:h.Default},s.url=U.sanitizeUrl(e,n),s.name=U.sanitizeString(e,t)||L.NotSpecified,s.properties=U.sanitizeProperties(e,a),s.measurements=U.sanitizeMeasurements(e,i),o&&(s.domProcessing=o.domProcessing,s.duration=o.duration,s.networkConnect=o.networkConnect,s.perfTotal=o.perfTotal,s.receivedResponse=o.receivedResponse,s.sentRequest=o.sentRequest),s}var Ye,$e,Ze;K(et,Ye=Y);function et(e,t){var n=Ye.call(this)||this;return n.aiDataContract={baseType:h.Required,baseData:h.Required},n.baseType=e,n.baseData=t,n}(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=(nt.getConfig=function(e,t,n,r){var a;return void 0===r&&(r=!1),a=n&&e.extensionConfig&&e.extensionConfig[n]&&!c.isNullOrUndefined(e.extensionConfig[n][t])?e.extensionConfig[n][t]:e[t],c.isNullOrUndefined(a)?r:a},nt);function nt(){}var rt=(at.create=function(e,t,n,r,a,i){if(n=U.sanitizeString(r,n)||L.NotSpecified,c.isNullOrUndefined(e)||c.isNullOrUndefined(t)||c.isNullOrUndefined(n))throw Error("Input doesn't contain all required fields");var o={name:n,time:(new Date).toISOString(),iKey:"",ext:i||{},tags:[],data:{},baseType:t,baseData:e};if(!c.isNullOrUndefined(a))for(var s in a)a.hasOwnProperty(s)&&(o.data[s]=a[s]);return o},at);function at(){}var it=function(){this.openDone=!1,this.setRequestHeaderDone=!1,this.sendDone=!1,this.abortDone=!1,this.onreadystatechangeCallbackAttached=!1},ot=(st.prototype.getAbsoluteUrl=function(){return this.requestUrl?F.getAbsoluteUrl(this.requestUrl):null},st.prototype.getPathName=function(){return this.requestUrl?U.sanitizeUrl(this._logger,F.getCompleteUrl(this.method,this.requestUrl)):null},st);function st(e,t){this.completed=!1,this.requestHeadersSize=null,this.ttfb=null,this.responseReceivingDuration=null,this.callbackDuration=null,this.ajaxTotalDuration=null,this.aborted=null,this.pageUrl=null,this.requestUrl=null,this.requestSize=0,this.method=null,this.status=null,this.requestSentTime=null,this.responseStartedTime=null,this.responseFinishedTime=null,this.callbackFinishedTime=null,this.endTime=null,this.originalOnreadystatechage=null,this.xhrMonitoringState=new it,this.clientFailure=0,this.CalculateMetrics=function(){this.ajaxTotalDuration=Math.round(1e3*X.GetDuration(this.requestSentTime,this.responseFinishedTime))/1e3},this.id=e,this._logger=t}var ct=(lt.AttachEvent=function(e,t,n){var r=!1;return c.isNullOrUndefined(e)||(c.isNullOrUndefined(e.attachEvent)?c.isNullOrUndefined(e.addEventListener)||(e.addEventListener(t,n,!1),r=!0):(e.attachEvent("on"+t,n),r=!0)),r},lt.DetachEvent=function(e,t,n){c.isNullOrUndefined(e)||(c.isNullOrUndefined(e.detachEvent)?c.isNullOrUndefined(e.removeEventListener)||e.removeEventListener(t,n,!1):e.detachEvent("on"+t,n))},lt);function lt(){}var ut=(dt.prototype.isMonitoredInstance=function(e,t,n,r){var a=!1,i=!0,o=!1;return void 0!==n?(o=this._fetchInitialized,a="object"==typeof n&&!0===n[B]||!!r&&!0===r[B]):void 0!==e&&(o=this.initialized,a=!0===e[B],i=!0===t||!c.isNullOrUndefined(e.ajaxData)),o&&i&&!a},dt.prototype.supportsAjaxMonitoring=function(){var e=!0;return(c.isNullOrUndefined(XMLHttpRequest)||c.isNullOrUndefined(XMLHttpRequest.prototype)||c.isNullOrUndefined(XMLHttpRequest.prototype.open)||c.isNullOrUndefined(XMLHttpRequest.prototype.send)||c.isNullOrUndefined(XMLHttpRequest.prototype.abort))&&(e=!1),e},dt.prototype.instrumentOpen=function(){var r=XMLHttpRequest.prototype.open,a=this;XMLHttpRequest.prototype.open=function(e,t,n){try{!a.isMonitoredInstance(this,!0)||this.ajaxData&&this.ajaxData.xhrMonitoringState.openDone||a.openHandler(this,e,t,n)}catch(e){a._core.logger.throwInternal(i.CRITICAL,x,"Failed to monitor XMLHttpRequest.open, monitoring data for this ajax call may be incorrect.",{ajaxDiagnosticsMessage:dt.getFailedAjaxDiagnosticsMessage(this),exception:L.dump(e)})}return r.apply(this,arguments)}},dt.prototype.openHandler=function(e,t,n,r){var a;a=this._context&&this._context.telemetryTrace&&this._context.telemetryTrace.traceID?"|"+this._context.telemetryTrace.traceID+"."+L.newId():L.newId();var i=new ot(a,this._core.logger);i.method=t,i.requestUrl=n,i.xhrMonitoringState.openDone=!0,e.ajaxData=i,this.attachToOnReadyStateChange(e)},dt.getFailedAjaxDiagnosticsMessage=function(e){var t="";try{c.isNullOrUndefined(e)||c.isNullOrUndefined(e.ajaxData)||c.isNullOrUndefined(e.ajaxData.requestUrl)||(t+="(url: '"+e.ajaxData.requestUrl+"')")}catch(e){}return t},dt.prototype.instrumentSend=function(){var t=XMLHttpRequest.prototype.send,n=this;XMLHttpRequest.prototype.send=function(e){try{n.isMonitoredInstance(this)&&!this.ajaxData.xhrMonitoringState.sendDone&&n.sendHandler(this,e)}catch(e){n._core.logger.throwInternal(i.CRITICAL,D,"Failed to monitor XMLHttpRequest, monitoring data for this ajax call may be incorrect.",{ajaxDiagnosticsMessage:dt.getFailedAjaxDiagnosticsMessage(this),exception:L.dump(e)})}return t.apply(this,arguments)}},dt.prototype.sendHandler=function(e,t){e.ajaxData.requestSentTime=X.Now(),(e=this.includeCorrelationHeaders(e.ajaxData,void 0,void 0,e)).ajaxData.xhrMonitoringState.sendDone=!0},dt.prototype.instrumentAbort=function(){var e=XMLHttpRequest.prototype.abort,t=this;XMLHttpRequest.prototype.abort=function(){try{t.isMonitoredInstance(this)&&!this.ajaxData.xhrMonitoringState.abortDone&&(this.ajaxData.aborted=1,this.ajaxData.xhrMonitoringState.abortDone=!0)}catch(e){t._core.logger.throwInternal(i.CRITICAL,m,"Failed to monitor XMLHttpRequest.abort, monitoring data for this ajax call may be incorrect.",{ajaxDiagnosticsMessage:dt.getFailedAjaxDiagnosticsMessage(this),exception:L.dump(e)})}return e.apply(this,arguments)}},dt.prototype.attachToOnReadyStateChange=function(n){var r=this;n.ajaxData.xhrMonitoringState.onreadystatechangeCallbackAttached=ct.AttachEvent(n,"readystatechange",function(){try{r.isMonitoredInstance(n)&&4===n.readyState&&r.onAjaxComplete(n)}catch(e){var t=L.dump(e);t&&-1!=t.toLowerCase().indexOf("c00c023f")||r._core.logger.throwInternal(i.CRITICAL,y,"Failed to monitor XMLHttpRequest 'readystatechange' event handler, monitoring data for this ajax call may be incorrect.",{ajaxDiagnosticsMessage:dt.getFailedAjaxDiagnosticsMessage(n),exception:L.dump(e)})}})},dt.prototype.onAjaxComplete=function(e){if(e.ajaxData.responseFinishedTime=X.Now(),e.ajaxData.status=e.status,e.ajaxData.CalculateMetrics(),e.ajaxData.ajaxTotalDuration<0)this._core.logger.throwInternal(i.WARNING,v,"Failed to calculate the duration of the ajax call, monitoring data for this ajax call won't be sent.",{ajaxDiagnosticsMessage:dt.getFailedAjaxDiagnosticsMessage(e),requestSentTime:e.ajaxData.requestSentTime,responseFinishedTime:e.ajaxData.responseFinishedTime});else{var t={id:e.ajaxData.id,target:e.ajaxData.getAbsoluteUrl(),name:e.ajaxData.getPathName(),type:"Ajax",duration:e.ajaxData.ajaxTotalDuration,success:200<=+e.ajaxData.status&&+e.ajaxData.status<400,responseCode:+e.ajaxData.status,method:e.ajaxData.method},n=this.getAjaxCorrelationContext(e);n&&(t.correlationContext=n),this.trackDependencyDataInternal(t),e.ajaxData=null}},dt.prototype.getAjaxCorrelationContext=function(t){try{var e=t.getAllResponseHeaders();if(null!==e&&-1!==e.toLowerCase().indexOf(R.requestContextHeaderLowerCase)){var n=t.getResponseHeader(R.requestContextHeader);return O.getCorrelationContext(n)}}catch(e){this._core.logger.throwInternal(i.WARNING,S,"Failed to get Request-Context correlation header as it may be not included in the response or not accessible.",{ajaxDiagnosticsMessage:dt.getFailedAjaxDiagnosticsMessage(t),exception:L.dump(e)})}},dt.prototype.trackDependencyDataInternal=function(e,t,n){if(-1===this._config.maxAjaxCallsPerView||this._trackAjaxAttempts<this._config.maxAjaxCallsPerView){var r=rt.create(e,He.dataType,He.envelopeType,this._core.logger,t,n);this._core.track(r)}else this._trackAjaxAttempts===this._config.maxAjaxCallsPerView&&this._core.logger.throwInternal(i.CRITICAL,N,"Maximum ajax per page view limit reached, ajax monitoring is paused until the next trackPageView(). In order to increase the limit set the maxAjaxCallsPerView configuration parameter.",!0);++this._trackAjaxAttempts},dt.prototype.trackDependencyData=function(e,t){this.trackDependencyDataInternal(e,t)},dt.prototype.processTelemetry=function(e){this._nextPlugin&&this._nextPlugin.processTelemetry&&this._nextPlugin.processTelemetry(e)},dt.prototype.setNextPlugin=function(e){e&&(this._nextPlugin=e)},dt.prototype.instrumentFetch=function(){if(this.supportsFetch()&&!this._fetchInitialized){var r=window.fetch,a=this;window.fetch=function(t,e){var n;if(a.isFetchInstrumented(t)&&a.isMonitoredInstance(void 0,void 0,t,e))try{n=a.createFetchRecord(t,e),e=a.includeCorrelationHeaders(n,t,e)}catch(e){a._core.logger.throwInternal(i.CRITICAL,x,"Failed to monitor Window.fetch, monitoring data for this fetch call may be incorrect.",{ajaxDiagnosticsMessage:this.getFailedFetchDiagnosticsMessage(t),exception:L.dump(e)})}return r(t,e).then(function(e){return a.onFetchComplete(e,n),e}).catch(function(e){throw a.onFetchFailed(t,n,e),e})},this._fetchInitialized=!0}},dt.prototype.isFetchInstrumented=function(e){return this._fetchInitialized&&!0!==e[B]},dt.prototype.supportsFetch=function(){var e=!0;return(!window||c.isNullOrUndefined(window.Request)||c.isNullOrUndefined(window.Request.prototype)||c.isNullOrUndefined(window.fetch))&&(e=!1),e},dt.prototype.createFetchRecord=function(e,t){var n;n=this._context&&this._context.telemetryTrace&&this._context.telemetryTrace.traceID?"|"+this._context.telemetryTrace.traceID+"."+L.newId():L.newId();var r=new ot(n,this._core.logger);return r.requestSentTime=X.Now(),e instanceof Request?r.requestUrl=e?e.url:"":r.requestUrl=e,t&&t.method?r.method=t.method:e&&e instanceof Request?r.method=e.method:r.method="GET",r},dt.prototype.includeCorrelationHeaders=function(e,t,n,r){if(t){if(O.canIncludeCorrelationHeader(this._config,e.getAbsoluteUrl(),this.currentWindowHost)){n||(n={}),n.headers=new Headers(n.headers||t instanceof Request&&t.headers||{}),n.headers.set(R.requestIdHeader,e.id);var a=this._config.appId||this._context.appId();return a&&n.headers.set(R.requestContextHeader,R.requestContextAppIdFormat+a),n}return n}if(r){if(this.currentWindowHost&&O.canIncludeCorrelationHeader(this._config,r.ajaxData.getAbsoluteUrl(),this.currentWindowHost)){r.setRequestHeader(R.requestIdHeader,r.ajaxData.id);var i=this._config.appId||this._context.appId();i&&r.setRequestHeader(R.requestContextHeader,R.requestContextAppIdFormat+i)}return r}},dt.prototype.getFailedFetchDiagnosticsMessage=function(e){var t="";try{c.isNullOrUndefined(e)||(t+="string"==typeof e?"(url: '"+e+"')":"(url: '"+e.url+"')")}catch(e){this._core.logger.throwInternal(i.CRITICAL,x,"Failed to grab failed fetch diagnostics message",{exception:L.dump(e)})}return t},dt.prototype.onFetchComplete=function(t,e){if(e)try{if(e.responseFinishedTime=X.Now(),e.CalculateMetrics(),e.ajaxTotalDuration<0)this._core.logger.throwInternal(i.WARNING,v,"Failed to calculate the duration of the fetch call, monitoring data for this fetch call won't be sent.",{fetchDiagnosticsMessage:this.getFailedFetchDiagnosticsMessage(t),requestSentTime:e.requestSentTime,responseFinishedTime:e.responseFinishedTime});else{var n={id:e.id,target:e.getAbsoluteUrl(),name:e.getPathName(),type:"Fetch",duration:e.ajaxTotalDuration,success:200<=t.status&&t.status<400,responseCode:t.status,properties:{HttpMethod:e.method}},r=this.getFetchCorrelationContext(t);r&&(n.correlationContext=r),this.trackDependencyDataInternal(n)}}catch(e){this._core.logger.throwInternal(i.WARNING,S,"Failed to calculate the duration of the fetch call, monitoring data for this fetch call won't be sent.",{fetchDiagnosticsMessage:this.getFailedFetchDiagnosticsMessage(t),exception:L.dump(e)})}},dt.prototype.onFetchFailed=function(t,e,n){if(e)try{if(e.responseFinishedTime=X.Now(),e.CalculateMetrics(),e.ajaxTotalDuration<0)this._core.logger.throwInternal(i.WARNING,v,"Failed to calculate the duration of the failed fetch call, monitoring data for this fetch call won't be sent.",{fetchDiagnosticsMessage:this.getFailedFetchDiagnosticsMessage(t),requestSentTime:e.requestSentTime,responseFinishedTime:e.responseFinishedTime});else{var r={id:e.id,target:e.getAbsoluteUrl(),name:e.getPathName(),type:"Fetch",duration:e.ajaxTotalDuration,success:!1,responseCode:0,properties:{HttpMethod:e.method}};this.trackDependencyDataInternal(r,{error:n.message})}}catch(e){this._core.logger.throwInternal(i.WARNING,S,"Failed to calculate the duration of the failed fetch call, monitoring data for this fetch call won't be sent.",{fetchDiagnosticsMessage:this.getFailedFetchDiagnosticsMessage(t),exception:L.dump(e)})}},dt.prototype.getFetchCorrelationContext=function(t){try{var e=t.headers.get(R.requestContextHeader);return O.getCorrelationContext(e)}catch(e){this._core.logger.throwInternal(i.WARNING,S,"Failed to get Request-Context correlation header as it may be not included in the response or not accessible.",{fetchDiagnosticsMessage:this.getFailedFetchDiagnosticsMessage(t),exception:L.dump(e)})}},dt.prototype.instrumentXhr=function(){this.supportsAjaxMonitoring()&&!this.initialized&&(this.instrumentOpen(),this.instrumentSend(),this.instrumentAbort(),this.initialized=!0)},dt.getDefaultConfig=function(){return{maxAjaxCallsPerView:500,disableAjaxTracking:!1,disableFetchTracking:!0,disableCorrelationHeaders:!1,correlationHeaderExcludedDomains:["*.blob.core.windows.net","*.blob.core.chinacloudapi.cn","*.blob.core.cloudapi.de","*.blob.core.usgovcloudapi.net"],correlationHeaderDomains:void 0,appId:void 0,enableCorsCorrelation:!1}},dt.getEmptyConfig=function(){return{maxAjaxCallsPerView:void 0,disableAjaxTracking:void 0,disableFetchTracking:void 0,disableCorrelationHeaders:void 0,correlationHeaderExcludedDomains:void 0,appId:void 0,enableCorsCorrelation:void 0,correlationHeaderDomains:void 0}},dt.prototype.initialize=function(e,t,n){if(!this.initialized&&!this._fetchInitialized){this._core=t;var r=dt.getDefaultConfig();for(var a in this._config=dt.getEmptyConfig(),r)this._config[a]=tt.getConfig(e,a,dt.identifier,r[a]);if(!1===this._config.disableAjaxTracking&&this.instrumentXhr(),!1===this._config.disableFetchTracking&&this.instrumentFetch(),0<n.length&&n){for(var i=void 0,o=0;!i&&o<n.length;)n[o]&&"AppInsightsPropertiesPlugin"===n[o].identifier&&(i=n[o]),o++;i&&(this._context=i.context)}}},dt.identifier="AjaxDependencyPlugin",dt);function dt(){this._trackAjaxAttempts=0,this.identifier=dt.identifier,this.priority=120,this.currentWindowHost=window&&window.location&&window.location.host&&window.location.host.toLowerCase(),this.initialized=!1,this._fetchInitialized=!1}e.AjaxPlugin=ut,e.ajaxRecord=ot,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 a,t,h,n,s,r;(t=a=a||{})[t.LocalStorage=0]="LocalStorage",t[t.SessionStorage=1]="SessionStorage",(n=h=h||{})[n.Default=0]="Default",n[n.Required=1]="Required",n[n.Array=2]="Array",n[n.Hidden=4]="Hidden",(r=s=s||{})[r.AI=0]="AI",r[r.AI_AND_W3C=1]="AI_AND_W3C",r[r.W3C=2]="W3C";var c=(i.isNullOrUndefined=function(e){return null==e},i.disableCookies=function(){i._canUseCookies=!1},i.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(l,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},i);function i(){}var o,u,l=/[xy]/g;(u=o=o||{})[u.CRITICAL=1]="CRITICAL",u[u.WARNING=2]="WARNING";var d=1,p=2,f=3,g=4,m=5,v=6,x=13,y=14,I=15,D=16,S=17,C=18,_=49,A=52,N=55,b=56,w=57,T=61,M=66,H=68,R=69,q=71;j.prototype.processTelemetry=function(t){this.channelQueue.forEach(function(e){0<e.length&&e[0].processTelemetry(t)})},Object.defineProperty(j.prototype,"ChannelControls",{get:function(){return this.channelQueue},enumerable:!0,configurable:!0}),j.prototype.initialize=function(n,r,a){var i=this;if(n.isCookieUseDisabled&&c.disableCookies(),this.channelQueue=new Array,n.channels){var o=void 0;n.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&&(o=e.identifier),e.initialize(n,r,a)}),o)throw Error("Channel has invalid priority"+o);i.channelQueue.push(e)}})}for(var e=new Array,t=0;t<a.length;t++){var s=a[t];500<s.priority&&e.push(s)}if(0<e.length){for((e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){return e.initialize(n,r,a)}),t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);this.channelQueue.push(e)}};function j(){this.identifier="ChannelControllerPlugin",this.priority=500}var E=(U.requestContextHeader="Request-Context",U.requestContextTargetKey="appId",U.requestContextAppIdFormat="appId=cid-v1:",U.requestIdHeader="Request-Id",U.traceParentHeader="traceparent",U.sdkContextHeader="Sdk-Context",U.sdkContextHeaderAppIdRequest="appId",U.requestContextHeaderLowerCase="request-context",U);function U(){}var k=(L.sanitizeKeyAndAddUniqueness=function(e,t,n){var r=t.length,a=L.sanitizeKey(e,t);if(a.length!==r){for(var i=0,o=a;void 0!==n[o];)i++,o=a.substring(0,L.MAX_NAME_LENGTH-3)+L.padNumber(i);a=o}return a},L.sanitizeKey=function(e,t){var n;return t&&(t=L.trim(t.toString())).length>L.MAX_NAME_LENGTH&&(n=t.substring(0,L.MAX_NAME_LENGTH),e.throwInternal(o.WARNING,w,"name is too long. It has been truncated to "+L.MAX_NAME_LENGTH+" characters.",{name:t},!0)),n||t},L.sanitizeString=function(e,t,n){var r;return void 0===n&&(n=L.MAX_STRING_LENGTH),t&&(n=n||L.MAX_STRING_LENGTH,(t=L.trim(t)).toString().length>n&&(r=t.toString().substring(0,n),e.throwInternal(o.WARNING,T,"string value is too long. It has been truncated to "+n+" characters.",{value:t},!0))),r||t},L.sanitizeUrl=function(e,t){return L.sanitizeInput(e,t,L.MAX_URL_LENGTH,M)},L.sanitizeMessage=function(e,t){var n;return t&&t.length>L.MAX_MESSAGE_LENGTH&&(n=t.substring(0,L.MAX_MESSAGE_LENGTH),e.throwInternal(o.WARNING,b,"message is too long, it has been truncated to "+L.MAX_MESSAGE_LENGTH+" characters.",{message:t},!0)),n||t},L.sanitizeException=function(e,t){var n;return t&&t.length>L.MAX_EXCEPTION_LENGTH&&(n=t.substring(0,L.MAX_EXCEPTION_LENGTH),e.throwInternal(o.WARNING,A,"exception is too long, it has been truncated to "+L.MAX_EXCEPTION_LENGTH+" characters.",{exception:t},!0)),n||t},L.sanitizeProperties=function(t,e){if(e){var n={};for(var r in e){var a=e[r];if("object"==typeof a&&"undefined"!=typeof JSON)try{a=JSON.stringify(a)}catch(e){t.throwInternal(o.WARNING,_,"custom property is not valid",{exception:e},!0)}a=L.sanitizeString(t,a,L.MAX_PROPERTY_LENGTH),n[r=L.sanitizeKeyAndAddUniqueness(t,r,n)]=a}e=n}return e},L.sanitizeMeasurements=function(e,t){if(t){var n={};for(var r in t){var a=t[r];n[r=L.sanitizeKeyAndAddUniqueness(e,r,n)]=a}t=n}return t},L.sanitizeId=function(e,t){return t?L.sanitizeInput(e,t,L.MAX_ID_LENGTH,R).toString():t},L.sanitizeInput=function(e,t,n,r){var a;return t&&(t=L.trim(t)).length>n&&(a=t.substring(0,n),e.throwInternal(o.WARNING,r,"input is too long, it has been truncated to "+n+" characters.",{data:t},!0)),a||t},L.padNumber=function(e){var t="00"+e;return t.substr(t.length-3)},L.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},L.MAX_NAME_LENGTH=150,L.MAX_ID_LENGTH=128,L.MAX_PROPERTY_LENGTH=8192,L.MAX_STRING_LENGTH=1024,L.MAX_URL_LENGTH=2048,L.MAX_MESSAGE_LENGTH=32768,L.MAX_EXCEPTION_LENGTH=32768,L);function L(){}var F=(O.createDomEvent=function(e){var t=null;return"function"==typeof Event?t=new Event(e):(t=document.createEvent("Event")).initEvent(e,!0,!0),t},O.disableStorage=function(){O._canUseLocalStorage=!1,O._canUseSessionStorage=!1},O._getLocalStorageObject=function(){return O.canUseLocalStorage()?O._getVerifiedStorageObject(a.LocalStorage):null},O._getVerifiedStorageObject=function(e){var t,n,r=null;try{if("undefined"==typeof window)return null;n=new Date,(r=e===a.LocalStorage?window.localStorage:window.sessionStorage).setItem(n,n),t=r.getItem(n)!=n,r.removeItem(n),t&&(r=null)}catch(e){r=null}return r},O.isInternalApplicationInsightsEndpoint=function(e){return-1!==O._internalEndpoints.indexOf(e.toLowerCase())},O.canUseLocalStorage=function(){return void 0===O._canUseLocalStorage&&(O._canUseLocalStorage=!!O._getVerifiedStorageObject(a.LocalStorage)),O._canUseLocalStorage},O.getStorage=function(t,e){var n=O._getLocalStorageObject();if(null!==n)try{return n.getItem(e)}catch(e){O._canUseLocalStorage=!1,t.throwInternal(o.WARNING,d,"Browser failed read of local storage. "+O.getExceptionName(e),{exception:O.dump(e)})}return null},O.setStorage=function(t,e,n){var r=O._getLocalStorageObject();if(null!==r)try{return r.setItem(e,n),!0}catch(e){O._canUseLocalStorage=!1,t.throwInternal(o.WARNING,f,"Browser failed write to local storage. "+O.getExceptionName(e),{exception:O.dump(e)})}return!1},O.removeStorage=function(t,e){var n=O._getLocalStorageObject();if(null!==n)try{return n.removeItem(e),!0}catch(e){O._canUseLocalStorage=!1,t.throwInternal(o.WARNING,m,"Browser failed removal of local storage item. "+O.getExceptionName(e),{exception:O.dump(e)})}return!1},O._getSessionStorageObject=function(){return O.canUseSessionStorage()?O._getVerifiedStorageObject(a.SessionStorage):null},O.canUseSessionStorage=function(){return void 0===O._canUseSessionStorage&&(O._canUseSessionStorage=!!O._getVerifiedStorageObject(a.SessionStorage)),O._canUseSessionStorage},O.getSessionStorageKeys=function(){var e=[];if(O.canUseSessionStorage())for(var t in window.sessionStorage)e.push(t);return e},O.getSessionStorage=function(t,e){var n=O._getSessionStorageObject();if(null!==n)try{return n.getItem(e)}catch(e){O._canUseSessionStorage=!1,t.throwInternal(o.WARNING,p,"Browser failed read of session storage. "+O.getExceptionName(e),{exception:O.dump(e)})}return null},O.setSessionStorage=function(t,e,n){var r=O._getSessionStorageObject();if(null!==r)try{return r.setItem(e,n),!0}catch(e){O._canUseSessionStorage=!1,t.throwInternal(o.WARNING,g,"Browser failed write to session storage. "+O.getExceptionName(e),{exception:O.dump(e)})}return!1},O.removeSessionStorage=function(t,e){var n=O._getSessionStorageObject();if(null!==n)try{return n.removeItem(e),!0}catch(e){O._canUseSessionStorage=!1,t.throwInternal(o.WARNING,v,"Browser failed removal of session storage item. "+O.getExceptionName(e),{exception:O.dump(e)})}return!1},O.disableCookies=function(){c.disableCookies()},O.canUseCookies=function(t){if(void 0===c._canUseCookies){c._canUseCookies=!1;try{c._canUseCookies=void 0!==O.document.cookie}catch(e){t.throwInternal(o.WARNING,H,"Cannot access document.cookie - "+O.getExceptionName(e),{exception:O.dump(e)})}}return c._canUseCookies},O.setCookie=function(e,t,n,r){var a="",i="";r&&(a=";domain="+r),O.document.location&&"https:"===O.document.location.protocol&&(i=";secure"),O.canUseCookies(e)&&(O.document.cookie=t+"="+n+a+";path=/"+i)},O.stringToBoolOrDefault=function(e,t){return void 0===t&&(t=!1),null==e?t:"true"===e.toString().toLowerCase()},O.getCookie=function(e,t){if(O.canUseCookies(e)){var n="";if(t&&t.length)for(var r=t+"=",a=O.document.cookie.split(";"),i=0;i<a.length;i++){var o=a[i];if((o=O.trim(o))&&0===o.indexOf(r)){n=o.substring(r.length,a[i].length);break}}return n}},O.deleteCookie=function(e,t){O.canUseCookies(e)&&(O.document.cookie=t+"=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;")},O.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},O.newId=function(){for(var e="",t=1073741824*Math.random();0<t;)e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t%64),t=Math.floor(t/64);return e},O.random32=function(){return 4294967296*Math.random()|0},O.generateW3CId=function(){for(var e,t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],n="",r=0;r<4;r++)n+=t[15&(e=O.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 a=t[8+4*Math.random()|0];return n.substr(0,8)+n.substr(9,4)+"4"+n.substr(13,3)+a+n.substr(16,3)+n.substr(19,12)},O.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},O.isError=function(e){return"[object Error]"===Object.prototype.toString.call(e)},O.isDate=function(e){return"[object Date]"===Object.prototype.toString.call(e)},O.toISOStringForIE8=function(e){if(O.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"}},O.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},O.msToTimeSpan=function(e){(isNaN(e)||e<0)&&(e=0);var t=""+(e=Math.round(e))%1e3,n=""+Math.floor(e/1e3)%60,r=""+Math.floor(e/6e4)%60,a=""+Math.floor(e/36e5)%24,i=Math.floor(e/864e5);return t=1===t.length?"00"+t:2===t.length?"0"+t:t,n=n.length<2?"0"+n:n,r=r.length<2?"0"+r:r,(0<i?i+".":"")+(a=a.length<2?"0"+a:a)+":"+r+":"+n+"."+t},O.isCrossOriginError=function(e,t,n,r,a){return("Script error."===e||"Script error"===e)&&!a},O.dump=function(e){var t=Object.prototype.toString.call(e),n=JSON.stringify(e);return"[object Error]"===t&&(n="{ stack: '"+e.stack+"', message: '"+e.message+"', name: '"+e.name+"'"),t+n},O.getExceptionName=function(e){return"[object Error]"===Object.prototype.toString.call(e)?e.name:""},O.addEventHandler=function(e,t){if("undefined"==typeof window||!window||"string"!=typeof e||"function"!=typeof t)return!1;var n="on"+e;if(window.addEventListener)window.addEventListener(e,t,!1);else{if(!window.attachEvent)return!1;window.attachEvent(n,t)}return!0},O.IsBeaconApiSupported=function(){return"sendBeacon"in navigator&&navigator.sendBeacon},O.getExtension=function(e,t){for(var n=null,r=0;!n&&r<e.length;)e[r]&&e[r].identifier===t&&(n=e[r]),r++;return n},O.document="undefined"!=typeof document?document:{},O._canUseLocalStorage=void 0,O._canUseSessionStorage=void 0,O._internalEndpoints=["https://dc.services.visualstudio.com/v2/track","https://breeze.aimon.applicationinsights.io/v2/track","https://dc-int.services.visualstudio.com/v2/track"],O.NotSpecified="not_specified",O);function O(){}var z=(P.parseUrl=function(e){return P.htmlAnchorElement||(P.htmlAnchorElement=P.document.createElement?P.document.createElement("a"):{host:P.parseHost(e)}),P.htmlAnchorElement.href=e,P.htmlAnchorElement},P.getAbsoluteUrl=function(e){var t,n=P.parseUrl(e);return n&&(t=n.href),t},P.getPathName=function(e){var t,n=P.parseUrl(e);return n&&(t=n.pathname),t},P.getCompleteUrl=function(e,t){return e?e.toUpperCase()+" "+t:t},P.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},P.document="undefined"!=typeof document?document:{},P);function P(){}var G=(W.canIncludeCorrelationHeader=function(e,t,n){if(e&&e.disableCorrelationHeaders)return!1;if(!t)return!1;var r=z.parseUrl(t).host.toLowerCase();if(!(e&&e.enableCorsCorrelation||r===n))return!1;var a,i=e&&e.correlationHeaderDomains;if(i&&(i.forEach(function(e){var t=new RegExp(e.toLowerCase().replace(/\./g,".").replace(/\*/g,".*"));a=a||t.test(r)}),!a))return!1;var o=e&&e.correlationHeaderExcludedDomains;if(!o||0==o.length)return!0;for(var s=0;s<o.length;s++)if(new RegExp(o[s].toLowerCase().replace(/\./g,".").replace(/\*/g,".*")).test(r))return!1;return!0},W.getCorrelationContext=function(e){if(e){var t=W.getCorrelationContextValue(e,E.requestContextTargetKey);if(t&&t!==W.correlationIdPrefix)return t}},W.getCorrelationContextValue=function(e,t){if(e)for(var n=e.split(","),r=0;r<n.length;++r){var a=n[r].split("=");if(2==a.length&&a[0]==t)return a[1]}},W.correlationIdPrefix="cid-v1:",W);function W(){}var X=(V.ParseDependencyPath=function(e,t,n,r){var a,i=r,o=r;if(t&&0<t.length){var s=z.parseUrl(t);if(a=s.host,!i)if(null!=s.pathname){var c=0===s.pathname.length?"/":s.pathname;"/"!==c.charAt(0)&&(c="/"+c),o=s.pathname,i=k.sanitizeString(e,n?n+" "+c:c)}else i=k.sanitizeString(e,t)}else i=a=r;return{target:a,name:i,data:o}},V);function V(){}var B=(K.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()},K.GetDuration=function(e,t){var n=null;return 0===e||0===t||c.isNullOrUndefined(e)||c.isNullOrUndefined(t)||(n=t-e),n},K);function K(){}var Q="Microsoft_ApplicationInsights_BypassAjaxInstrumentation",J=function(e,t){return(J=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function $(e,t){function n(){this.constructor=e}J(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var Y,Z=function(){return(Z=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)},ee=($(te,Y=function(){}),te);function te(){return Y.call(this)||this}var ne;$(re,ne=function(){this.ver=1,this.sampleRate=100,this.tags={}});function re(e,t,n){var r=ne.call(this)||this;return r.name=k.sanitizeString(e,n)||F.NotSpecified,r.data=t,r.time=F.toISOStringForIE8(new Date),r.aiDataContract={time:h.Required,iKey:h.Required,name:h.Required,sampleRate:function(){return 100==r.sampleRate?h.Hidden:h.Required},tags:h.Required,data:h.Required},r}function ae(){}var ie,oe=($(se,ie=ae),se);function se(){var e=ie.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var ce;$(ue,ce=oe),ue.envelopeType="Microsoft.ApplicationInsights.{0}.Event",ue.dataType="EventData";function ue(e,t,n,r){var a=ce.call(this)||this;return a.aiDataContract={ver:h.Required,name:h.Required,properties:h.Default,measurements:h.Default},a.name=k.sanitizeString(e,t)||F.NotSpecified,a.properties=k.sanitizeProperties(e,n),a.measurements=k.sanitizeMeasurements(e,r),a}function le(){}var de,pe=($(he,de=ae),he);function he(){var e=de.call(this)||this;return e.ver=2,e.exceptions=[],e.properties={},e.measurements={},e}function fe(){this.hasFullStack=!0,this.parsedStack=[]}var ge;$(me,ge=pe),me.CreateFromInterface=function(t,e){var n=e.exceptions&&e.exceptions.map(function(e){return xe.CreateFromInterface(t,e)});return new me(t,Z({},e,{exceptions:n}))},me.prototype.toInterface=function(){var e=this,t=e.exceptions,n=e.properties,r=e.measurements,a=e.severityLevel,i=e.ver,o=e.problemGroup,s=e.id,c=e.isManual;return{ver:i,exceptions:t instanceof Array&&t.map(function(e){return e.toInterface()})||void 0,severityLevel:a,properties:n,measurements:r,problemGroup:o,id:s,isManual:c}},me.CreateSimpleException=function(e,t,n,r,a,i){return{exceptions:[{hasFullStack:!0,message:e,stack:a,typeName:t}]}},me.envelopeType="Microsoft.ApplicationInsights.{0}.Exception",me.dataType="ExceptionData";function me(e,t,n,r,a,i){var o=ge.call(this)||this;return o.aiDataContract={ver:h.Required,exceptions:h.Required,severityLevel:h.Default,properties:h.Default,measurements:h.Default},t instanceof Error?(o.exceptions=[new xe(e,t)],o.properties=k.sanitizeProperties(e,n),o.measurements=k.sanitizeMeasurements(e,r),a&&(o.severityLevel=a),i&&(o.id=i)):(o.exceptions=t.exceptions,o.properties=t.properties,o.measurements=t.measurements,t.severityLevel&&(o.severityLevel=t.severityLevel),t.id&&(o.id=t.id),t.problemGroup&&(o.problemGroup=t.problemGroup),c.isNullOrUndefined(t.ver)||(o.ver=t.ver),c.isNullOrUndefined(t.isManual)||(o.isManual=t.isManual)),o}var ve,xe=($(ye,ve=fe),ye.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}},ye.CreateFromInterface=function(e,t){var n=t.parsedStack instanceof Array&&t.parsedStack.map(function(e){return De.CreateFromInterface(e)})||t.parsedStack;return new ye(e,Z({},t,{parsedStack:n}))},ye.parseStack=function(e){var t=void 0;if("string"==typeof e){var n=e.split("\n");t=[];for(var r=0,a=0,i=0;i<=n.length;i++){var o=n[i];if(De.regex.test(o)){var s=new De(n[i],r++);a+=s.sizeInBytes,t.push(s)}}if(32768<a)for(var c=0,u=t.length-1,l=0,d=c,p=u;c<u;){if(32768<(l+=t[c].sizeInBytes+t[u].sizeInBytes)){var h=p-d+1;t.splice(d,h);break}d=c,p=u,c++,u--}}return t},ye);function ye(e,t){var n=ve.call(this)||this;if(n.aiDataContract={id:h.Default,outerId:h.Default,typeName:h.Required,message:h.Required,hasFullStack:h.Default,stack:h.Default,parsedStack:h.Array},t instanceof Error){n.typeName=k.sanitizeString(e,t.name)||F.NotSpecified,n.message=k.sanitizeMessage(e,t.message)||F.NotSpecified;var r=t.stack;n.parsedStack=ye.parseStack(r),n.stack=k.sanitizeException(e,r),n.hasFullStack=F.isArray(n.parsedStack)&&0<n.parsedStack.length}else n.typeName=t.typeName,n.message=t.message,n.stack=t.stack,n.parsedStack=t.parsedStack,n.hasFullStack=t.hasFullStack;return n}var Ie,De=($(Se,Ie=le),Se.CreateFromInterface=function(e){return new Se(e,null)},Se.prototype.toInterface=function(){return{level:this.level,method:this.method,assembly:this.assembly,fileName:this.fileName,line:this.line}},Se.regex=/^([\s]+at)?(.*?)(\@|\s\(|\s)([^\(\@\n]+):([0-9]+):([0-9]+)(\)?)$/,Se.baseSize=58,Se);function Se(e,t){var n=Ie.call(this)||this;if(n.sizeInBytes=0,n.aiDataContract={level:h.Required,method:h.Required,assembly:h.Default,fileName:h.Default,line:h.Default},"string"==typeof e){var r=e;n.level=t,n.method="<no_method>",n.assembly=F.trim(r),n.fileName="",n.line=0;var a=r.match(Se.regex);a&&5<=a.length&&(n.method=F.trim(a[2])||n.method,n.fileName=F.trim(a[4]),n.line=parseInt(a[5])||0)}else n.level=e.level,n.method=e.method,n.assembly=e.assembly,n.fileName=e.fileName,n.line=e.line,n.sizeInBytes=0;return n.sizeInBytes+=n.method.length,n.sizeInBytes+=n.fileName.length,n.sizeInBytes+=n.assembly.length,n.sizeInBytes+=Se.baseSize,n.sizeInBytes+=n.level.toString().length,n.sizeInBytes+=n.line.toString().length,n}var Ce,_e,Ae,Ne=($(be,Ce=ae),be);function be(){var e=Ce.call(this)||this;return e.ver=2,e.metrics=[],e.properties={},e}(Ae=_e=_e||{})[Ae.Measurement=0]="Measurement",Ae[Ae.Aggregation=1]="Aggregation";var we,Te=($(Me,we=function(){this.kind=_e.Measurement}),Me);function Me(){var e=null!==we&&we.apply(this,arguments)||this;return e.aiDataContract={name:h.Required,kind:h.Default,value:h.Required,count:h.Default,min:h.Default,max:h.Default,stdDev:h.Default},e}var He;$(Re,He=Ne),Re.envelopeType="Microsoft.ApplicationInsights.{0}.Metric",Re.dataType="MetricData";function Re(e,t,n,r,a,i,o){var s=He.call(this)||this;s.aiDataContract={ver:h.Required,metrics:h.Required,properties:h.Default};var c=new Te;return c.count=0<r?r:void 0,c.max=isNaN(i)||null===i?void 0:i,c.min=isNaN(a)||null===a?void 0:a,c.name=k.sanitizeString(e,t)||F.NotSpecified,c.value=n,s.metrics=[c],s.properties=k.sanitizeProperties(e,o),s}var qe,je=($(Ee,qe=oe),Ee);function Ee(){var e=qe.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var Ue;$(ke,Ue=je),ke.envelopeType="Microsoft.ApplicationInsights.{0}.Pageview",ke.dataType="PageviewData";function ke(e,t,n,r,a,i,o){var s=Ue.call(this)||this;return s.aiDataContract={ver:h.Required,name:h.Default,url:h.Default,duration:h.Default,properties:h.Default,measurements:h.Default,id:h.Default},s.id=k.sanitizeId(e,o),s.url=k.sanitizeUrl(e,n),s.name=k.sanitizeString(e,t)||F.NotSpecified,isNaN(r)||(s.duration=F.msToTimeSpan(r)),s.properties=k.sanitizeProperties(e,a),s.measurements=k.sanitizeMeasurements(e,i),s}var Le,Fe=($(Oe,Le=ae),Oe);function Oe(){var e=Le.call(this)||this;return e.ver=2,e.success=!0,e.properties={},e.measurements={},e}var ze,Pe=($(Ge,ze=Fe),Ge.envelopeType="Microsoft.ApplicationInsights.{0}.RemoteDependency",Ge.dataType="RemoteDependencyData",Ge);function Ge(e,t,n,r,a,i,o,s,c,u,l){void 0===c&&(c="Ajax");var d=ze.call(this)||this;d.aiDataContract={id:h.Required,ver:h.Required,name:h.Default,resultCode:h.Default,duration:h.Default,success:h.Default,data:h.Default,target:h.Default,type:h.Default,properties:h.Default,measurements:h.Default,kind:h.Default,value:h.Default,count:h.Default,min:h.Default,max:h.Default,stdDev:h.Default,dependencyKind:h.Default,dependencySource:h.Default,commandName:h.Default,dependencyTypeName:h.Default},d.id=t,d.duration=F.msToTimeSpan(a),d.success=i,d.resultCode=o+"",d.type=k.sanitizeString(e,c);var p=X.ParseDependencyPath(e,n,s,r);return d.data=k.sanitizeUrl(e,r)||p.data,d.target=k.sanitizeString(e,p.target),d.name=k.sanitizeString(e,p.name),d.properties=k.sanitizeProperties(e,u),d.measurements=k.sanitizeMeasurements(e,l),d}var We,Xe=($(Ve,We=ae),Ve);function Ve(){var e=We.call(this)||this;return e.ver=2,e.properties={},e}var Be;$(Ke,Be=Xe),Ke.envelopeType="Microsoft.ApplicationInsights.{0}.Message",Ke.dataType="MessageData";function Ke(e,t,n,r){var a=Be.call(this)||this;return a.aiDataContract={ver:h.Required,message:h.Required,severityLevel:h.Default,properties:h.Default},t=t||F.NotSpecified,a.message=k.sanitizeMessage(e,t),a.properties=k.sanitizeProperties(e,r),n&&(a.severityLevel=n),a}var Qe,Je=($($e,Qe=je),$e);function $e(){var e=Qe.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var Ye;$(Ze,Ye=Je),Ze.envelopeType="Microsoft.ApplicationInsights.{0}.PageviewPerformance",Ze.dataType="PageviewPerformanceData";function Ze(e,t,n,r,a,i,o){var s=Ye.call(this)||this;return s.aiDataContract={ver:h.Required,name:h.Default,url:h.Default,duration:h.Default,perfTotal:h.Default,networkConnect:h.Default,sentRequest:h.Default,receivedResponse:h.Default,domProcessing:h.Default,properties:h.Default,measurements:h.Default},s.url=k.sanitizeUrl(e,n),s.name=k.sanitizeString(e,t)||F.NotSpecified,s.properties=k.sanitizeProperties(e,a),s.measurements=k.sanitizeMeasurements(e,i),o&&(s.domProcessing=o.domProcessing,s.duration=o.duration,s.networkConnect=o.networkConnect,s.perfTotal=o.perfTotal,s.receivedResponse=o.receivedResponse,s.sentRequest=o.sentRequest),s}var et,tt,nt;$(rt,et=ee);function rt(e,t){var n=et.call(this)||this;return n.aiDataContract={baseType:h.Required,baseData:h.Required},n.baseType=e,n.baseData=t,n}(nt=tt=tt||{})[nt.Verbose=0]="Verbose",nt[nt.Information=1]="Information",nt[nt.Warning=2]="Warning",nt[nt.Error=3]="Error",nt[nt.Critical=4]="Critical";var at=(it.getConfig=function(e,t,n,r){var a;return void 0===r&&(r=!1),a=n&&e.extensionConfig&&e.extensionConfig[n]&&!c.isNullOrUndefined(e.extensionConfig[n][t])?e.extensionConfig[n][t]:e[t],c.isNullOrUndefined(a)?r:a},it);function it(){}var ot=(st.create=function(e,t,n,r,a,i){if(n=k.sanitizeString(r,n)||F.NotSpecified,c.isNullOrUndefined(e)||c.isNullOrUndefined(t)||c.isNullOrUndefined(n))throw Error("Input doesn't contain all required fields");var o={name:n,time:(new Date).toISOString(),iKey:"",ext:i||{},tags:[],data:{},baseType:t,baseData:e};if(!c.isNullOrUndefined(a))for(var s in a)a.hasOwnProperty(s)&&(o.data[s]=a[s]);return o},st);function st(){}var ct=function(){this.openDone=!1,this.setRequestHeaderDone=!1,this.sendDone=!1,this.abortDone=!1,this.onreadystatechangeCallbackAttached=!1},ut=(lt.prototype.getAbsoluteUrl=function(){return this.requestUrl?z.getAbsoluteUrl(this.requestUrl):null},lt.prototype.getPathName=function(){return this.requestUrl?k.sanitizeUrl(this._logger,z.getCompleteUrl(this.method,this.requestUrl)):null},lt);function lt(e,t,n){this.completed=!1,this.requestHeadersSize=null,this.requestHeaders=null,this.ttfb=null,this.responseReceivingDuration=null,this.callbackDuration=null,this.ajaxTotalDuration=null,this.aborted=null,this.pageUrl=null,this.requestUrl=null,this.requestSize=0,this.method=null,this.status=null,this.requestSentTime=null,this.responseStartedTime=null,this.responseFinishedTime=null,this.callbackFinishedTime=null,this.endTime=null,this.originalOnreadystatechage=null,this.xhrMonitoringState=new ct,this.clientFailure=0,this.CalculateMetrics=function(){this.ajaxTotalDuration=Math.round(1e3*B.GetDuration(this.requestSentTime,this.responseFinishedTime))/1e3},this.traceID=e,this.spanID=t,this._logger=n}var dt=(pt.AttachEvent=function(e,t,n){var r=!1;return c.isNullOrUndefined(e)||(c.isNullOrUndefined(e.attachEvent)?c.isNullOrUndefined(e.addEventListener)||(e.addEventListener(t,n,!1),r=!0):(e.attachEvent("on"+t,n),r=!0)),r},pt.DetachEvent=function(e,t,n){c.isNullOrUndefined(e)||(c.isNullOrUndefined(e.detachEvent)?c.isNullOrUndefined(e.removeEventListener)||e.removeEventListener(t,n,!1):e.detachEvent("on"+t,n))},pt);function pt(){}var ht=(ft.isValidTraceId=function(e){return e.match(/^[0-9a-f]{32}$/)&&"00000000000000000000000000000000"!==e},ft.isValidSpanId=function(e){return e.match(/^[0-9a-f]{16}$/)&&"0000000000000000"!==e},ft.prototype.toString=function(){return this.version+"-"+this.traceId+"-"+this.spanId+"-"+this.traceFlag},ft.DEFAULT_TRACE_FLAG="00",ft.DEFAULT_VERSION="00",ft);function ft(e,t){this.traceFlag=ft.DEFAULT_TRACE_FLAG,this.version=ft.DEFAULT_VERSION,e&&ft.isValidTraceId(e)?this.traceId=e:this.traceId=F.generateW3CId(),t&&ft.isValidSpanId(t)?this.spanId=t:this.spanId=F.generateW3CId().substr(0,16)}var gt=(mt.prototype.isMonitoredInstance=function(e,t,n,r){var a=!1,i=!0,o=!1;return void 0!==n?(o=this._fetchInitialized,a="object"==typeof n&&!0===n[Q]||!!r&&!0===r[Q]):void 0!==e&&(o=this.initialized,a=!0===e[Q],i=!0===t||!c.isNullOrUndefined(e.ajaxData)),o&&i&&!a},mt.prototype.supportsAjaxMonitoring=function(){var e=!0;return(c.isNullOrUndefined(XMLHttpRequest)||c.isNullOrUndefined(XMLHttpRequest.prototype)||c.isNullOrUndefined(XMLHttpRequest.prototype.open)||c.isNullOrUndefined(XMLHttpRequest.prototype.send)||c.isNullOrUndefined(XMLHttpRequest.prototype.abort))&&(e=!1),e},mt.prototype.instrumentOpen=function(){var r=XMLHttpRequest.prototype.open,a=this;XMLHttpRequest.prototype.open=function(e,t,n){try{!a.isMonitoredInstance(this,!0)||this.ajaxData&&this.ajaxData.xhrMonitoringState.openDone||a.openHandler(this,e,t,n)}catch(e){a._core.logger.throwInternal(o.CRITICAL,I,"Failed to monitor XMLHttpRequest.open, monitoring data for this ajax call may be incorrect.",{ajaxDiagnosticsMessage:mt.getFailedAjaxDiagnosticsMessage(this),exception:F.dump(e)})}return r.apply(this,arguments)}},mt.prototype.openHandler=function(e,t,n,r){var a=this._context&&this._context.telemetryTrace&&this._context.telemetryTrace.traceID||F.generateW3CId(),i=F.generateW3CId().substr(0,16),o=new ut(a,i,this._core.logger);o.method=t,o.requestUrl=n,o.xhrMonitoringState.openDone=!0,o.requestHeaders={},e.ajaxData=o,this.attachToOnReadyStateChange(e)},mt.getFailedAjaxDiagnosticsMessage=function(e){var t="";try{c.isNullOrUndefined(e)||c.isNullOrUndefined(e.ajaxData)||c.isNullOrUndefined(e.ajaxData.requestUrl)||(t+="(url: '"+e.ajaxData.requestUrl+"')")}catch(e){}return t},mt.prototype.instrumentSend=function(){var t=XMLHttpRequest.prototype.send,n=this;XMLHttpRequest.prototype.send=function(e){try{n.isMonitoredInstance(this)&&!this.ajaxData.xhrMonitoringState.sendDone&&n.sendHandler(this,e)}catch(e){n._core.logger.throwInternal(o.CRITICAL,S,"Failed to monitor XMLHttpRequest, monitoring data for this ajax call may be incorrect.",{ajaxDiagnosticsMessage:mt.getFailedAjaxDiagnosticsMessage(this),exception:F.dump(e)})}return t.apply(this,arguments)}},mt.prototype.sendHandler=function(e,t){e.ajaxData.requestSentTime=B.Now(),(e=this.includeCorrelationHeaders(e.ajaxData,void 0,void 0,e)).ajaxData.xhrMonitoringState.sendDone=!0},mt.prototype.instrumentAbort=function(){var e=XMLHttpRequest.prototype.abort,t=this;XMLHttpRequest.prototype.abort=function(){try{t.isMonitoredInstance(this)&&!this.ajaxData.xhrMonitoringState.abortDone&&(this.ajaxData.aborted=1,this.ajaxData.xhrMonitoringState.abortDone=!0)}catch(e){t._core.logger.throwInternal(o.CRITICAL,x,"Failed to monitor XMLHttpRequest.abort, monitoring data for this ajax call may be incorrect.",{ajaxDiagnosticsMessage:mt.getFailedAjaxDiagnosticsMessage(this),exception:F.dump(e)})}return e.apply(this,arguments)}},mt.prototype.instrumentSetRequestHeader=function(){if(this._config.enableRequestHeaderTracking){var n=XMLHttpRequest.prototype.setRequestHeader,r=this;XMLHttpRequest.prototype.setRequestHeader=function(e,t){try{r.isMonitoredInstance(this)&&(this.ajaxData.requestHeaders[e]=t)}catch(e){r._core.logger.throwInternal(o.CRITICAL,q,"Failed to monitor XMLHttpRequest.setRequestHeader, monitoring data for this ajax call may be incorrect.",{ajaxDiagnosticsMessage:mt.getFailedAjaxDiagnosticsMessage(this),exception:F.dump(e)})}return n.apply(this,arguments)}}},mt.prototype.attachToOnReadyStateChange=function(n){var r=this;n.ajaxData.xhrMonitoringState.onreadystatechangeCallbackAttached=dt.AttachEvent(n,"readystatechange",function(){try{r.isMonitoredInstance(n)&&4===n.readyState&&r.onAjaxComplete(n)}catch(e){var t=F.dump(e);t&&-1!=t.toLowerCase().indexOf("c00c023f")||r._core.logger.throwInternal(o.CRITICAL,D,"Failed to monitor XMLHttpRequest 'readystatechange' event handler, monitoring data for this ajax call may be incorrect.",{ajaxDiagnosticsMessage:mt.getFailedAjaxDiagnosticsMessage(n),exception:F.dump(e)})}})},mt.prototype.onAjaxComplete=function(e){if(e.ajaxData.responseFinishedTime=B.Now(),e.ajaxData.status=e.status,e.ajaxData.CalculateMetrics(),e.ajaxData.ajaxTotalDuration<0)this._core.logger.throwInternal(o.WARNING,y,"Failed to calculate the duration of the ajax call, monitoring data for this ajax call won't be sent.",{ajaxDiagnosticsMessage:mt.getFailedAjaxDiagnosticsMessage(e),requestSentTime:e.ajaxData.requestSentTime,responseFinishedTime:e.ajaxData.responseFinishedTime});else{var t={id:"|"+e.ajaxData.traceID+"."+e.ajaxData.spanID,target:e.ajaxData.getAbsoluteUrl(),name:e.ajaxData.getPathName(),type:"Ajax",duration:e.ajaxData.ajaxTotalDuration,success:200<=+e.ajaxData.status&&+e.ajaxData.status<400,responseCode:+e.ajaxData.status,method:e.ajaxData.method},n=this.getAjaxCorrelationContext(e);if(n&&(t.correlationContext=n),this._config.enableRequestHeaderTracking&&0<Object.keys(e.ajaxData.requestHeaders).length&&(t.properties=t.properties||{},t.properties.requestHeaders={},t.properties.requestHeaders=e.ajaxData.requestHeaders),this._config.enableResponseHeaderTracking){var r=e.getAllResponseHeaders();if(r){var a=r.trim().split(/[\r\n]+/),i={};a.forEach(function(e){var t=e.split(": "),n=t.shift(),r=t.join(": ");i[n]=r}),0<Object.keys(i).length&&(t.properties=t.properties||{},t.properties.responseHeaders={},t.properties.responseHeaders=i)}}this.trackDependencyDataInternal(t),e.ajaxData=null}},mt.prototype.getAjaxCorrelationContext=function(t){try{var e=t.getAllResponseHeaders();if(null!==e&&-1!==e.toLowerCase().indexOf(E.requestContextHeaderLowerCase)){var n=t.getResponseHeader(E.requestContextHeader);return G.getCorrelationContext(n)}}catch(e){this._core.logger.throwInternal(o.WARNING,C,"Failed to get Request-Context correlation header as it may be not included in the response or not accessible.",{ajaxDiagnosticsMessage:mt.getFailedAjaxDiagnosticsMessage(t),exception:F.dump(e)})}},mt.prototype.trackDependencyDataInternal=function(e,t,n){if(-1===this._config.maxAjaxCallsPerView||this._trackAjaxAttempts<this._config.maxAjaxCallsPerView){var r=ot.create(e,Pe.dataType,Pe.envelopeType,this._core.logger,t,n);this._core.track(r)}else this._trackAjaxAttempts===this._config.maxAjaxCallsPerView&&this._core.logger.throwInternal(o.CRITICAL,N,"Maximum ajax per page view limit reached, ajax monitoring is paused until the next trackPageView(). In order to increase the limit set the maxAjaxCallsPerView configuration parameter.",!0);++this._trackAjaxAttempts},mt.prototype.trackDependencyData=function(e,t){this.trackDependencyDataInternal(e,t)},mt.prototype.processTelemetry=function(e){this._nextPlugin&&this._nextPlugin.processTelemetry&&this._nextPlugin.processTelemetry(e)},mt.prototype.setNextPlugin=function(e){e&&(this._nextPlugin=e)},mt.prototype.instrumentFetch=function(){if(this.supportsFetch()&&!this._fetchInitialized){var r=window.fetch,a=this;window.fetch=function(t,e){var n;if(a.isFetchInstrumented(t)&&a.isMonitoredInstance(void 0,void 0,t,e))try{n=a.createFetchRecord(t,e),e=a.includeCorrelationHeaders(n,t,e)}catch(e){a._core.logger.throwInternal(o.CRITICAL,I,"Failed to monitor Window.fetch, monitoring data for this fetch call may be incorrect.",{ajaxDiagnosticsMessage:this.getFailedFetchDiagnosticsMessage(t),exception:F.dump(e)})}return r(t,e).then(function(e){return a.onFetchComplete(e,n),e}).catch(function(e){throw a.onFetchFailed(t,n,e),e})},this._fetchInitialized=!0}},mt.prototype.isFetchInstrumented=function(e){return this._fetchInitialized&&!0!==e[Q]},mt.prototype.supportsFetch=function(){var e=!0;return(!window||c.isNullOrUndefined(window.Request)||c.isNullOrUndefined(window.Request.prototype)||c.isNullOrUndefined(window.fetch))&&(e=!1),e},mt.prototype.createFetchRecord=function(e,t){var n=this._context&&this._context.telemetryTrace&&this._context.telemetryTrace.traceID||F.generateW3CId(),r=F.generateW3CId().substr(0,16),a=new ut(n,r,this._core.logger);return a.requestSentTime=B.Now(),e instanceof Request?a.requestUrl=e?e.url:"":a.requestUrl=e,t&&t.method?a.method=t.method:e&&e instanceof Request?a.method=e.method:a.method="GET",t&&t.headers&&this._config.enableRequestHeaderTracking?a.requestHeaders=t.headers:a.requestHeaders={},a},mt.prototype.includeCorrelationHeaders=function(e,t,n,r){if(t){if(G.canIncludeCorrelationHeader(this._config,e.getAbsoluteUrl(),this.currentWindowHost)){if((n=n||{}).headers=new Headers(n.headers||t instanceof Request&&t.headers||{}),this._isUsingAIHeaders){var a="|"+e.traceID+"."+e.spanID;n.headers.set(E.requestIdHeader,a),this._config.enableRequestHeaderTracking&&(e.requestHeaders[E.requestIdHeader]=a)}var i=this._config.appId||this._context.appId();if(i&&(n.headers.set(E.requestContextHeader,E.requestContextAppIdFormat+i),this._config.enableRequestHeaderTracking&&(e.requestHeaders[E.requestContextHeader]=E.requestContextAppIdFormat+i)),this._isUsingW3CHeaders){var o=new ht(e.traceID,e.spanID);n.headers.set(E.traceParentHeader,o.toString()),this._config.enableRequestHeaderTracking&&(e.requestHeaders[E.traceParentHeader]=o.toString())}return n}return n}if(r){if(this.currentWindowHost&&G.canIncludeCorrelationHeader(this._config,r.ajaxData.getAbsoluteUrl(),this.currentWindowHost)){this._isUsingAIHeaders&&(a="|"+r.ajaxData.traceID+"."+r.ajaxData.spanID,r.setRequestHeader(E.requestIdHeader,a),this._config.enableRequestHeaderTracking&&(r.ajaxData.requestHeaders[E.requestIdHeader]=a));var s=this._config.appId||this._context.appId();s&&(r.setRequestHeader(E.requestContextHeader,E.requestContextAppIdFormat+s),this._config.enableRequestHeaderTracking&&(r.ajaxData.requestHeaders[E.requestContextHeader]=E.requestContextAppIdFormat+s)),this._isUsingW3CHeaders&&(o=new ht(r.ajaxData.traceID,r.ajaxData.spanID),r.setRequestHeader(E.traceParentHeader,o.toString()),this._config.enableRequestHeaderTracking&&(r.ajaxData.requestHeaders[E.traceParentHeader]=o.toString()))}return r}},mt.prototype.getFailedFetchDiagnosticsMessage=function(e){var t="";try{c.isNullOrUndefined(e)||(t+="string"==typeof e?"(url: '"+e+"')":"(url: '"+e.url+"')")}catch(e){this._core.logger.throwInternal(o.CRITICAL,I,"Failed to grab failed fetch diagnostics message",{exception:F.dump(e)})}return t},mt.prototype.onFetchComplete=function(t,e){if(e)try{if(e.responseFinishedTime=B.Now(),e.CalculateMetrics(),e.ajaxTotalDuration<0)this._core.logger.throwInternal(o.WARNING,y,"Failed to calculate the duration of the fetch call, monitoring data for this fetch call won't be sent.",{fetchDiagnosticsMessage:this.getFailedFetchDiagnosticsMessage(t),requestSentTime:e.requestSentTime,responseFinishedTime:e.responseFinishedTime});else{var n={id:"|"+e.traceID+"."+e.spanID,target:e.getAbsoluteUrl(),name:e.getPathName(),type:"Fetch",duration:e.ajaxTotalDuration,success:200<=t.status&&t.status<400,responseCode:t.status,properties:{HttpMethod:e.method}},r=this.getFetchCorrelationContext(t);if(r&&(n.correlationContext=r),this._config.enableRequestHeaderTracking&&0<Object.keys(e.requestHeaders).length&&(n.properties=n.properties||{},n.properties.requestHeaders=e.requestHeaders),this._config.enableResponseHeaderTracking){var a={};t.headers.forEach(function(e,t){a[t]=e}),0<Object.keys(a).length&&(n.properties=n.properties||{},n.properties.responseHeaders=a)}this.trackDependencyDataInternal(n)}}catch(e){this._core.logger.throwInternal(o.WARNING,C,"Failed to calculate the duration of the fetch call, monitoring data for this fetch call won't be sent.",{fetchDiagnosticsMessage:this.getFailedFetchDiagnosticsMessage(t),exception:F.dump(e)})}},mt.prototype.onFetchFailed=function(t,e,n){if(e)try{if(e.responseFinishedTime=B.Now(),e.CalculateMetrics(),e.ajaxTotalDuration<0)this._core.logger.throwInternal(o.WARNING,y,"Failed to calculate the duration of the failed fetch call, monitoring data for this fetch call won't be sent.",{fetchDiagnosticsMessage:this.getFailedFetchDiagnosticsMessage(t),requestSentTime:e.requestSentTime,responseFinishedTime:e.responseFinishedTime});else{var r={id:"|"+e.traceID+"."+e.spanID,target:e.getAbsoluteUrl(),name:e.getPathName(),type:"Fetch",duration:e.ajaxTotalDuration,success:!1,responseCode:0,properties:{HttpMethod:e.method}};this.trackDependencyDataInternal(r,{error:n.message})}}catch(e){this._core.logger.throwInternal(o.WARNING,C,"Failed to calculate the duration of the failed fetch call, monitoring data for this fetch call won't be sent.",{fetchDiagnosticsMessage:this.getFailedFetchDiagnosticsMessage(t),exception:F.dump(e)})}},mt.prototype.getFetchCorrelationContext=function(t){try{var e=t.headers.get(E.requestContextHeader);return G.getCorrelationContext(e)}catch(e){this._core.logger.throwInternal(o.WARNING,C,"Failed to get Request-Context correlation header as it may be not included in the response or not accessible.",{fetchDiagnosticsMessage:this.getFailedFetchDiagnosticsMessage(t),exception:F.dump(e)})}},mt.prototype.instrumentXhr=function(){this.supportsAjaxMonitoring()&&!this.initialized&&(this.instrumentOpen(),this.instrumentSend(),this.instrumentAbort(),this.instrumentSetRequestHeader(),this.initialized=!0)},mt.getDefaultConfig=function(){return{maxAjaxCallsPerView:500,disableAjaxTracking:!1,disableFetchTracking:!0,disableCorrelationHeaders:!1,distributedTracingMode:s.AI,correlationHeaderExcludedDomains:["*.blob.core.windows.net","*.blob.core.chinacloudapi.cn","*.blob.core.cloudapi.de","*.blob.core.usgovcloudapi.net"],correlationHeaderDomains:void 0,appId:void 0,enableCorsCorrelation:!1,enableRequestHeaderTracking:!1,enableResponseHeaderTracking:!1}},mt.getEmptyConfig=function(){return{maxAjaxCallsPerView:void 0,disableAjaxTracking:void 0,disableFetchTracking:void 0,disableCorrelationHeaders:void 0,distributedTracingMode:void 0,correlationHeaderExcludedDomains:void 0,appId:void 0,enableCorsCorrelation:void 0,correlationHeaderDomains:void 0,enableRequestHeaderTracking:void 0,enableResponseHeaderTracking:void 0}},mt.prototype.initialize=function(e,t,n){if(!this.initialized&&!this._fetchInitialized){this._core=t;var r=mt.getDefaultConfig();for(var a in this._config=mt.getEmptyConfig(),r)this._config[a]=at.getConfig(e,a,mt.identifier,r[a]);if(this._isUsingAIHeaders=this._config.distributedTracingMode===s.AI||this._config.distributedTracingMode===s.AI_AND_W3C,this._isUsingW3CHeaders=this._config.distributedTracingMode===s.AI_AND_W3C||this._config.distributedTracingMode===s.W3C,!1===this._config.disableAjaxTracking&&this.instrumentXhr(),!1===this._config.disableFetchTracking&&this.instrumentFetch(),0<n.length&&n){for(var i=void 0,o=0;!i&&o<n.length;)n[o]&&"AppInsightsPropertiesPlugin"===n[o].identifier&&(i=n[o]),o++;i&&(this._context=i.context)}}},mt.identifier="AjaxDependencyPlugin",mt);function mt(){this._trackAjaxAttempts=0,this.identifier=mt.identifier,this.priority=120,this.currentWindowHost=window&&window.location&&window.location.host&&window.location.host.toLowerCase(),this.initialized=!1,this._fetchInitialized=!1}e.AjaxPlugin=gt,e.ajaxRecord=ut,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=applicationinsights-dependencies-js.min.js.map |
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
import { RequestHeaders, Util, CorrelationIdHelper, TelemetryItemCreator, RemoteDependencyData, DateTimeUtils, DisabledPropertyName, ConfigurationManager, PropertiesPluginIdentifier } from '@microsoft/applicationinsights-common'; | ||
import { RequestHeaders, Util, CorrelationIdHelper, TelemetryItemCreator, RemoteDependencyData, DateTimeUtils, DisabledPropertyName, ConfigurationManager, PropertiesPluginIdentifier, DistributedTracingModes } from '@microsoft/applicationinsights-common'; | ||
import { CoreUtils, LoggingSeverity, _InternalMessageId } from '@microsoft/applicationinsights-core-js'; | ||
import { ajaxRecord } from './ajaxRecord'; | ||
import { EventHelper } from './ajaxUtils'; | ||
import { Traceparent } from './TraceParent'; | ||
var AjaxMonitor = /** @class */ (function () { | ||
@@ -82,14 +83,9 @@ function AjaxMonitor() { | ||
AjaxMonitor.prototype.openHandler = function (xhr, method, url, async) { | ||
var id; | ||
if (this._context && this._context.telemetryTrace && this._context.telemetryTrace.traceID) { | ||
// this format corresponds with activity logic on server-side and is required for the correct correlation | ||
id = "|" + this._context.telemetryTrace.traceID + "." + Util.newId(); | ||
} | ||
else { | ||
id = Util.newId(); | ||
} | ||
var ajaxData = new ajaxRecord(id, this._core.logger); | ||
var traceID = (this._context && this._context.telemetryTrace && this._context.telemetryTrace.traceID) || Util.generateW3CId(); | ||
var spanID = Util.generateW3CId().substr(0, 16); | ||
var ajaxData = new ajaxRecord(traceID, spanID, this._core.logger); | ||
ajaxData.method = method; | ||
ajaxData.requestUrl = url; | ||
ajaxData.xhrMonitoringState.openDone = true; | ||
ajaxData.requestHeaders = {}; | ||
xhr.ajaxData = ajaxData; | ||
@@ -152,2 +148,23 @@ this.attachToOnReadyStateChange(xhr); | ||
}; | ||
AjaxMonitor.prototype.instrumentSetRequestHeader = function () { | ||
if (!this._config.enableRequestHeaderTracking) { | ||
return; | ||
} | ||
var originalSetRequestHeader = XMLHttpRequest.prototype.setRequestHeader; | ||
var ajaxMonitorInstance = this; | ||
XMLHttpRequest.prototype.setRequestHeader = function (header, value) { | ||
try { | ||
if (ajaxMonitorInstance.isMonitoredInstance(this)) { | ||
this.ajaxData.requestHeaders[header] = value; | ||
} | ||
} | ||
catch (e) { | ||
ajaxMonitorInstance._core.logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.FailedMonitorAjaxSetRequestHeader, "Failed to monitor XMLHttpRequest.setRequestHeader, monitoring data for this ajax call may be incorrect.", { | ||
ajaxDiagnosticsMessage: AjaxMonitor.getFailedAjaxDiagnosticsMessage(this), | ||
exception: Util.dump(e) | ||
}); | ||
} | ||
return originalSetRequestHeader.apply(this, arguments); | ||
}; | ||
}; | ||
AjaxMonitor.prototype.attachToOnReadyStateChange = function (xhr) { | ||
@@ -188,3 +205,3 @@ var ajaxMonitorInstance = this; | ||
var dependency = { | ||
id: xhr.ajaxData.id, | ||
id: "|" + xhr.ajaxData.traceID + "." + xhr.ajaxData.spanID, | ||
target: xhr.ajaxData.getAbsoluteUrl(), | ||
@@ -203,2 +220,29 @@ name: xhr.ajaxData.getPathName(), | ||
} | ||
if (this._config.enableRequestHeaderTracking) { | ||
if (Object.keys(xhr.ajaxData.requestHeaders).length > 0) { | ||
dependency.properties = dependency.properties || {}; | ||
dependency.properties.requestHeaders = {}; | ||
dependency.properties.requestHeaders = xhr.ajaxData.requestHeaders; | ||
} | ||
} | ||
if (this._config.enableResponseHeaderTracking) { | ||
var headers = xhr.getAllResponseHeaders(); | ||
if (headers) { | ||
// xhr.getAllResponseHeaders() method returns all the response headers, separated by CRLF, as a string or null | ||
// the regex converts the header string into an array of individual headers | ||
var arr = headers.trim().split(/[\r\n]+/); | ||
var responseHeaderMap_1 = {}; | ||
arr.forEach(function (line) { | ||
var parts = line.split(': '); | ||
var header = parts.shift(); | ||
var value = parts.join(': '); | ||
responseHeaderMap_1[header] = value; | ||
}); | ||
if (Object.keys(responseHeaderMap_1).length > 0) { | ||
dependency.properties = dependency.properties || {}; | ||
dependency.properties.responseHeaders = {}; | ||
dependency.properties.responseHeaders = responseHeaderMap_1; | ||
} | ||
} | ||
} | ||
this.trackDependencyDataInternal(dependency); | ||
@@ -299,11 +343,5 @@ xhr.ajaxData = null; | ||
AjaxMonitor.prototype.createFetchRecord = function (input, init) { | ||
var id; | ||
if (this._context && this._context.telemetryTrace && this._context.telemetryTrace.traceID) { | ||
// this format corresponds with activity logic on server-side and is required for the correct correlation | ||
id = "|" + this._context.telemetryTrace.traceID + "." + Util.newId(); | ||
} | ||
else { | ||
id = Util.newId(); | ||
} | ||
var ajaxData = new ajaxRecord(id, this._core.logger); | ||
var traceID = (this._context && this._context.telemetryTrace && this._context.telemetryTrace.traceID) || Util.generateW3CId(); | ||
var spanID = Util.generateW3CId().substr(0, 16); | ||
var ajaxData = new ajaxRecord(traceID, spanID, this._core.logger); | ||
ajaxData.requestSentTime = DateTimeUtils.Now(); | ||
@@ -325,2 +363,8 @@ if (input instanceof Request) { | ||
} | ||
if (init && init.headers && this._config.enableRequestHeaderTracking) { | ||
ajaxData.requestHeaders = init.headers; | ||
} | ||
else { | ||
ajaxData.requestHeaders = {}; | ||
} | ||
return ajaxData; | ||
@@ -338,7 +382,23 @@ }; | ||
init.headers = new Headers(init.headers || (input instanceof Request ? (input.headers || {}) : {})); | ||
init.headers.set(RequestHeaders.requestIdHeader, ajaxData.id); | ||
if (this._isUsingAIHeaders) { | ||
var id = "|" + ajaxData.traceID + "." + ajaxData.spanID; | ||
init.headers.set(RequestHeaders.requestIdHeader, id); | ||
if (this._config.enableRequestHeaderTracking) { | ||
ajaxData.requestHeaders[RequestHeaders.requestIdHeader] = id; | ||
} | ||
} | ||
var appId_1 = this._config.appId || this._context.appId(); | ||
if (appId_1) { | ||
init.headers.set(RequestHeaders.requestContextHeader, RequestHeaders.requestContextAppIdFormat + appId_1); | ||
if (this._config.enableRequestHeaderTracking) { | ||
ajaxData.requestHeaders[RequestHeaders.requestContextHeader] = RequestHeaders.requestContextAppIdFormat + appId_1; | ||
} | ||
} | ||
if (this._isUsingW3CHeaders) { | ||
var traceparent = new Traceparent(ajaxData.traceID, ajaxData.spanID); | ||
init.headers.set(RequestHeaders.traceParentHeader, traceparent.toString()); | ||
if (this._config.enableRequestHeaderTracking) { | ||
ajaxData.requestHeaders[RequestHeaders.traceParentHeader] = traceparent.toString(); | ||
} | ||
} | ||
return init; | ||
@@ -350,7 +410,23 @@ } | ||
if (this.currentWindowHost && CorrelationIdHelper.canIncludeCorrelationHeader(this._config, xhr.ajaxData.getAbsoluteUrl(), this.currentWindowHost)) { | ||
xhr.setRequestHeader(RequestHeaders.requestIdHeader, xhr.ajaxData.id); | ||
if (this._isUsingAIHeaders) { | ||
var id = "|" + xhr.ajaxData.traceID + "." + xhr.ajaxData.spanID; | ||
xhr.setRequestHeader(RequestHeaders.requestIdHeader, id); | ||
if (this._config.enableRequestHeaderTracking) { | ||
xhr.ajaxData.requestHeaders[RequestHeaders.requestIdHeader] = id; | ||
} | ||
} | ||
var appId = this._config.appId || this._context.appId(); | ||
if (appId) { | ||
xhr.setRequestHeader(RequestHeaders.requestContextHeader, RequestHeaders.requestContextAppIdFormat + appId); | ||
if (this._config.enableRequestHeaderTracking) { | ||
xhr.ajaxData.requestHeaders[RequestHeaders.requestContextHeader] = RequestHeaders.requestContextAppIdFormat + appId; | ||
} | ||
} | ||
if (this._isUsingW3CHeaders) { | ||
var traceparent = new Traceparent(xhr.ajaxData.traceID, xhr.ajaxData.spanID); | ||
xhr.setRequestHeader(RequestHeaders.traceParentHeader, traceparent.toString()); | ||
if (this._config.enableRequestHeaderTracking) { | ||
xhr.ajaxData.requestHeaders[RequestHeaders.traceParentHeader] = traceparent.toString(); | ||
} | ||
} | ||
} | ||
@@ -394,3 +470,3 @@ return xhr; | ||
var dependency = { | ||
id: ajaxData.id, | ||
id: "|" + ajaxData.traceID + "." + ajaxData.spanID, | ||
target: ajaxData.getAbsoluteUrl(), | ||
@@ -409,2 +485,18 @@ name: ajaxData.getPathName(), | ||
} | ||
if (this._config.enableRequestHeaderTracking) { | ||
if (Object.keys(ajaxData.requestHeaders).length > 0) { | ||
dependency.properties = dependency.properties || {}; | ||
dependency.properties.requestHeaders = ajaxData.requestHeaders; | ||
} | ||
} | ||
if (this._config.enableResponseHeaderTracking) { | ||
var responseHeaderMap_2 = {}; | ||
response.headers.forEach(function (value, name) { | ||
responseHeaderMap_2[name] = value; | ||
}); | ||
if (Object.keys(responseHeaderMap_2).length > 0) { | ||
dependency.properties = dependency.properties || {}; | ||
dependency.properties.responseHeaders = responseHeaderMap_2; | ||
} | ||
} | ||
this.trackDependencyDataInternal(dependency); | ||
@@ -436,3 +528,3 @@ } | ||
var dependency = { | ||
id: ajaxData.id, | ||
id: "|" + ajaxData.traceID + "." + ajaxData.spanID, | ||
target: ajaxData.getAbsoluteUrl(), | ||
@@ -473,2 +565,3 @@ name: ajaxData.getPathName(), | ||
this.instrumentAbort(); | ||
this.instrumentSetRequestHeader(); | ||
this.initialized = true; | ||
@@ -483,2 +576,3 @@ } | ||
disableCorrelationHeaders: false, | ||
distributedTracingMode: DistributedTracingModes.AI, | ||
correlationHeaderExcludedDomains: [ | ||
@@ -492,3 +586,5 @@ "*.blob.core.windows.net", | ||
appId: undefined, | ||
enableCorsCorrelation: false | ||
enableCorsCorrelation: false, | ||
enableRequestHeaderTracking: false, | ||
enableResponseHeaderTracking: false | ||
}; | ||
@@ -503,2 +599,3 @@ return config; | ||
disableCorrelationHeaders: undefined, | ||
distributedTracingMode: undefined, | ||
correlationHeaderExcludedDomains: undefined, | ||
@@ -508,2 +605,4 @@ appId: undefined, | ||
correlationHeaderDomains: undefined, | ||
enableRequestHeaderTracking: undefined, | ||
enableResponseHeaderTracking: undefined | ||
}; | ||
@@ -519,2 +618,4 @@ }; | ||
} | ||
this._isUsingAIHeaders = this._config.distributedTracingMode === DistributedTracingModes.AI || this._config.distributedTracingMode === DistributedTracingModes.AI_AND_W3C; | ||
this._isUsingW3CHeaders = this._config.distributedTracingMode === DistributedTracingModes.AI_AND_W3C || this._config.distributedTracingMode === DistributedTracingModes.W3C; | ||
if (this._config.disableAjaxTracking === false) { | ||
@@ -521,0 +622,0 @@ this.instrumentXhr(); |
@@ -17,5 +17,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
var ajaxRecord = /** @class */ (function () { | ||
function ajaxRecord(id, logger) { | ||
function ajaxRecord(traceID, spanID, logger) { | ||
this.completed = false; | ||
this.requestHeadersSize = null; | ||
this.requestHeaders = null; | ||
this.ttfb = null; | ||
@@ -52,3 +53,4 @@ this.responseReceivingDuration = null; | ||
}; | ||
this.id = id; | ||
this.traceID = traceID; | ||
this.spanID = spanID; | ||
this._logger = logger; | ||
@@ -55,0 +57,0 @@ } |
/*! | ||
* Application Insights JavaScript SDK - Dependencies Plugin, 2.1.1 | ||
* Application Insights JavaScript SDK - Dependencies Plugin, 2.2.0 | ||
* 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 a,t,h,n;(t=a||(a={}))[t.LocalStorage=0]="LocalStorage",t[t.SessionStorage=1]="SessionStorage",(n=h||(h={}))[n.Default=0]="Default",n[n.Required=1]="Required",n[n.Array=2]="Array",n[n.Hidden=4]="Hidden";var c=(r.isNullOrUndefined=function(e){return null==e},r.disableCookies=function(){r._canUseCookies=!1},r.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(s,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},r);function r(){}var i,o,s=/[xy]/g;(o=i||(i={}))[o.CRITICAL=1]="CRITICAL",o[o.WARNING=2]="WARNING";var l=1,u=2,d=3,p=4,f=5,g=6,m=13,v=14,x=15,y=16,D=17,S=18,I=49,C=52,N=55,w=56,A=57,_=61,M=66,b=68,T=69;j.prototype.processTelemetry=function(t){this.channelQueue.forEach(function(e){0<e.length&&e[0].processTelemetry(t)})},Object.defineProperty(j.prototype,"ChannelControls",{get:function(){return this.channelQueue},enumerable:!0,configurable:!0}),j.prototype.initialize=function(n,r,a){var i=this;if(n.isCookieUseDisabled&&c.disableCookies(),this.channelQueue=new Array,n.channels){var o=void 0;n.channels.forEach(function(e){if(e&&0<e.length){if((e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){e.priority<500&&(o=e.identifier),e.initialize(n,r,a)}),o)throw Error("Channel has invalid priority"+o);for(var t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);i.channelQueue.push(e)}})}for(var e=new Array,t=0;t<a.length;t++){var s=a[t];500<s.priority&&e.push(s)}if(0<e.length){for((e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){return e.initialize(n,r,a)}),t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);this.channelQueue.push(e)}};function j(){this.identifier="ChannelControllerPlugin",this.priority=500}var R=(E.requestContextHeader="Request-Context",E.requestContextTargetKey="appId",E.requestContextAppIdFormat="appId=cid-v1:",E.requestIdHeader="Request-Id",E.sdkContextHeader="Sdk-Context",E.sdkContextHeaderAppIdRequest="appId",E.requestContextHeaderLowerCase="request-context",E);function E(){}var U=(q.sanitizeKeyAndAddUniqueness=function(e,t,n){var r=t.length,a=q.sanitizeKey(e,t);if(a.length!==r){for(var i=0,o=a;void 0!==n[o];)i++,o=a.substring(0,q.MAX_NAME_LENGTH-3)+q.padNumber(i);a=o}return a},q.sanitizeKey=function(e,t){var n;return t&&(t=q.trim(t.toString())).length>q.MAX_NAME_LENGTH&&(n=t.substring(0,q.MAX_NAME_LENGTH),e.throwInternal(i.WARNING,A,"name is too long. It has been truncated to "+q.MAX_NAME_LENGTH+" characters.",{name:t},!0)),n||t},q.sanitizeString=function(e,t,n){var r;return void 0===n&&(n=q.MAX_STRING_LENGTH),t&&(n=n||q.MAX_STRING_LENGTH,(t=q.trim(t)).toString().length>n&&(r=t.toString().substring(0,n),e.throwInternal(i.WARNING,_,"string value is too long. It has been truncated to "+n+" characters.",{value:t},!0))),r||t},q.sanitizeUrl=function(e,t){return q.sanitizeInput(e,t,q.MAX_URL_LENGTH,M)},q.sanitizeMessage=function(e,t){var n;return t&&t.length>q.MAX_MESSAGE_LENGTH&&(n=t.substring(0,q.MAX_MESSAGE_LENGTH),e.throwInternal(i.WARNING,w,"message is too long, it has been truncated to "+q.MAX_MESSAGE_LENGTH+" characters.",{message:t},!0)),n||t},q.sanitizeException=function(e,t){var n;return t&&t.length>q.MAX_EXCEPTION_LENGTH&&(n=t.substring(0,q.MAX_EXCEPTION_LENGTH),e.throwInternal(i.WARNING,C,"exception is too long, it has been truncated to "+q.MAX_EXCEPTION_LENGTH+" characters.",{exception:t},!0)),n||t},q.sanitizeProperties=function(t,e){if(e){var n={};for(var r in e){var a=e[r];if("object"==typeof a&&"undefined"!=typeof JSON)try{a=JSON.stringify(a)}catch(e){t.throwInternal(i.WARNING,I,"custom property is not valid",{exception:e},!0)}a=q.sanitizeString(t,a,q.MAX_PROPERTY_LENGTH),n[r=q.sanitizeKeyAndAddUniqueness(t,r,n)]=a}e=n}return e},q.sanitizeMeasurements=function(e,t){if(t){var n={};for(var r in t){var a=t[r];n[r=q.sanitizeKeyAndAddUniqueness(e,r,n)]=a}t=n}return t},q.sanitizeId=function(e,t){return t?q.sanitizeInput(e,t,q.MAX_ID_LENGTH,T).toString():t},q.sanitizeInput=function(e,t,n,r){var a;return t&&(t=q.trim(t)).length>n&&(a=t.substring(0,n),e.throwInternal(i.WARNING,r,"input is too long, it has been truncated to "+n+" characters.",{data:t},!0)),a||t},q.padNumber=function(e){var t="00"+e;return t.substr(t.length-3)},q.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},q.MAX_NAME_LENGTH=150,q.MAX_ID_LENGTH=128,q.MAX_PROPERTY_LENGTH=8192,q.MAX_STRING_LENGTH=1024,q.MAX_URL_LENGTH=2048,q.MAX_MESSAGE_LENGTH=32768,q.MAX_EXCEPTION_LENGTH=32768,q);function q(){}var L=(k.disableStorage=function(){k._canUseLocalStorage=!1,k._canUseSessionStorage=!1},k._getLocalStorageObject=function(){return k.canUseLocalStorage()?k._getVerifiedStorageObject(a.LocalStorage):null},k._getVerifiedStorageObject=function(e){var t,n,r=null;try{if("undefined"==typeof window)return null;n=new Date,(r=e===a.LocalStorage?window.localStorage:window.sessionStorage).setItem(n,n),t=r.getItem(n)!=n,r.removeItem(n),t&&(r=null)}catch(e){r=null}return r},k.isInternalApplicationInsightsEndpoint=function(e){return-1!==k._internalEndpoints.indexOf(e.toLowerCase())},k.canUseLocalStorage=function(){return void 0===k._canUseLocalStorage&&(k._canUseLocalStorage=!!k._getVerifiedStorageObject(a.LocalStorage)),k._canUseLocalStorage},k.getStorage=function(t,e){var n=k._getLocalStorageObject();if(null!==n)try{return n.getItem(e)}catch(e){k._canUseLocalStorage=!1,t.throwInternal(i.WARNING,l,"Browser failed read of local storage. "+k.getExceptionName(e),{exception:k.dump(e)})}return null},k.setStorage=function(t,e,n){var r=k._getLocalStorageObject();if(null!==r)try{return r.setItem(e,n),!0}catch(e){k._canUseLocalStorage=!1,t.throwInternal(i.WARNING,d,"Browser failed write to local storage. "+k.getExceptionName(e),{exception:k.dump(e)})}return!1},k.removeStorage=function(t,e){var n=k._getLocalStorageObject();if(null!==n)try{return n.removeItem(e),!0}catch(e){k._canUseLocalStorage=!1,t.throwInternal(i.WARNING,f,"Browser failed removal of local storage item. "+k.getExceptionName(e),{exception:k.dump(e)})}return!1},k._getSessionStorageObject=function(){return k.canUseSessionStorage()?k._getVerifiedStorageObject(a.SessionStorage):null},k.canUseSessionStorage=function(){return void 0===k._canUseSessionStorage&&(k._canUseSessionStorage=!!k._getVerifiedStorageObject(a.SessionStorage)),k._canUseSessionStorage},k.getSessionStorageKeys=function(){var e=[];if(k.canUseSessionStorage())for(var t in window.sessionStorage)e.push(t);return e},k.getSessionStorage=function(t,e){var n=k._getSessionStorageObject();if(null!==n)try{return n.getItem(e)}catch(e){k._canUseSessionStorage=!1,t.throwInternal(i.WARNING,u,"Browser failed read of session storage. "+k.getExceptionName(e),{exception:k.dump(e)})}return null},k.setSessionStorage=function(t,e,n){var r=k._getSessionStorageObject();if(null!==r)try{return r.setItem(e,n),!0}catch(e){k._canUseSessionStorage=!1,t.throwInternal(i.WARNING,p,"Browser failed write to session storage. "+k.getExceptionName(e),{exception:k.dump(e)})}return!1},k.removeSessionStorage=function(t,e){var n=k._getSessionStorageObject();if(null!==n)try{return n.removeItem(e),!0}catch(e){k._canUseSessionStorage=!1,t.throwInternal(i.WARNING,g,"Browser failed removal of session storage item. "+k.getExceptionName(e),{exception:k.dump(e)})}return!1},k.disableCookies=function(){c.disableCookies()},k.canUseCookies=function(t){if(void 0===c._canUseCookies){c._canUseCookies=!1;try{c._canUseCookies=void 0!==k.document.cookie}catch(e){t.throwInternal(i.WARNING,b,"Cannot access document.cookie - "+k.getExceptionName(e),{exception:k.dump(e)})}}return c._canUseCookies},k.setCookie=function(e,t,n,r){var a="",i="";r&&(a=";domain="+r),k.document.location&&"https:"===k.document.location.protocol&&(i=";secure"),k.canUseCookies(e)&&(k.document.cookie=t+"="+n+a+";path=/"+i)},k.stringToBoolOrDefault=function(e,t){return void 0===t&&(t=!1),null==e?t:"true"===e.toString().toLowerCase()},k.getCookie=function(e,t){if(k.canUseCookies(e)){var n="";if(t&&t.length)for(var r=t+"=",a=k.document.cookie.split(";"),i=0;i<a.length;i++){var o=a[i];if((o=k.trim(o))&&0===o.indexOf(r)){n=o.substring(r.length,a[i].length);break}}return n}},k.deleteCookie=function(e,t){k.canUseCookies(e)&&(k.document.cookie=t+"=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;")},k.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},k.newId=function(){for(var e="",t=1073741824*Math.random();0<t;)e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t%64),t=Math.floor(t/64);return e},k.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},k.isError=function(e){return"[object Error]"===Object.prototype.toString.call(e)},k.isDate=function(e){return"[object Date]"===Object.prototype.toString.call(e)},k.toISOStringForIE8=function(e){if(k.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"}},k.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},k.msToTimeSpan=function(e){(isNaN(e)||e<0)&&(e=0);var t=""+(e=Math.round(e))%1e3,n=""+Math.floor(e/1e3)%60,r=""+Math.floor(e/6e4)%60,a=""+Math.floor(e/36e5)%24,i=Math.floor(e/864e5);return t=1===t.length?"00"+t:2===t.length?"0"+t:t,n=n.length<2?"0"+n:n,r=r.length<2?"0"+r:r,(0<i?i+".":"")+(a=a.length<2?"0"+a:a)+":"+r+":"+n+"."+t},k.isCrossOriginError=function(e,t,n,r,a){return("Script error."===e||"Script error"===e)&&!a},k.dump=function(e){var t=Object.prototype.toString.call(e),n=JSON.stringify(e);return"[object Error]"===t&&(n="{ stack: '"+e.stack+"', message: '"+e.message+"', name: '"+e.name+"'"),t+n},k.getExceptionName=function(e){return"[object Error]"===Object.prototype.toString.call(e)?e.name:""},k.addEventHandler=function(e,t){if("undefined"==typeof window||!window||"string"!=typeof e||"function"!=typeof t)return!1;var n="on"+e;if(window.addEventListener)window.addEventListener(e,t,!1);else{if(!window.attachEvent)return!1;window.attachEvent(n,t)}return!0},k.IsBeaconApiSupported=function(){return"sendBeacon"in navigator&&navigator.sendBeacon},k.getExtension=function(e,t){for(var n=null,r=0;!n&&r<e.length;)e[r]&&e[r].identifier===t&&(n=e[r]),r++;return n},k.document="undefined"!=typeof document?document:{},k._canUseLocalStorage=void 0,k._canUseSessionStorage=void 0,k._internalEndpoints=["https://dc.services.visualstudio.com/v2/track","https://breeze.aimon.applicationinsights.io/v2/track","https://dc-int.services.visualstudio.com/v2/track"],k.NotSpecified="not_specified",k);function k(){}var F=(H.parseUrl=function(e){return H.htmlAnchorElement||(H.htmlAnchorElement=H.document.createElement?H.document.createElement("a"):{host:H.parseHost(e)}),H.htmlAnchorElement.href=e,H.htmlAnchorElement},H.getAbsoluteUrl=function(e){var t,n=H.parseUrl(e);return n&&(t=n.href),t},H.getPathName=function(e){var t,n=H.parseUrl(e);return n&&(t=n.pathname),t},H.getCompleteUrl=function(e,t){return e?e.toUpperCase()+" "+t:t},H.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},H.document="undefined"!=typeof document?document:{},H);function H(){}var O=(z.canIncludeCorrelationHeader=function(e,t,n){if(e&&e.disableCorrelationHeaders)return!1;if(!t)return!1;var r=F.parseUrl(t).host.toLowerCase();if(!(e&&e.enableCorsCorrelation||r===n))return!1;var a,i=e&&e.correlationHeaderDomains;if(i&&(i.forEach(function(e){var t=new RegExp(e.toLowerCase().replace(/\./g,".").replace(/\*/g,".*"));a=a||t.test(r)}),!a))return!1;var o=e&&e.correlationHeaderExcludedDomains;if(!o||0==o.length)return!0;for(var s=0;s<o.length;s++)if(new RegExp(o[s].toLowerCase().replace(/\./g,".").replace(/\*/g,".*")).test(r))return!1;return!0},z.getCorrelationContext=function(e){if(e){var t=z.getCorrelationContextValue(e,R.requestContextTargetKey);if(t&&t!==z.correlationIdPrefix)return t}},z.getCorrelationContextValue=function(e,t){if(e)for(var n=e.split(","),r=0;r<n.length;++r){var a=n[r].split("=");if(2==a.length&&a[0]==t)return a[1]}},z.correlationIdPrefix="cid-v1:",z);function z(){}var G=(P.ParseDependencyPath=function(e,t,n,r){var a,i=r,o=r;if(t&&0<t.length){var s=F.parseUrl(t);if(a=s.host,!i)if(null!=s.pathname){var c=0===s.pathname.length?"/":s.pathname;"/"!==c.charAt(0)&&(c="/"+c),o=s.pathname,i=U.sanitizeString(e,n?n+" "+c:c)}else i=U.sanitizeString(e,t)}else i=a=r;return{target:a,name:i,data:o}},P);function P(){}var X=(W.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()},W.GetDuration=function(e,t){var n=null;return 0===e||0===t||c.isNullOrUndefined(e)||c.isNullOrUndefined(t)||(n=t-e),n},W);function W(){}var B="Microsoft_ApplicationInsights_BypassAjaxInstrumentation",V=function(e,t){return(V=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function K(e,t){function n(){this.constructor=e}V(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var Q,J=function(){return(J=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)},Y=(K($,Q=function(){}),$);function $(){return Q.call(this)||this}var Z;K(ee,Z=function(){this.ver=1,this.sampleRate=100,this.tags={}});function ee(e,t,n){var r=Z.call(this)||this;return r.name=U.sanitizeString(e,n)||L.NotSpecified,r.data=t,r.time=L.toISOStringForIE8(new Date),r.aiDataContract={time:h.Required,iKey:h.Required,name:h.Required,sampleRate:function(){return 100==r.sampleRate?h.Hidden:h.Required},tags:h.Required,data:h.Required},r}function te(){}var ne,re=(K(ae,ne=te),ae);function ae(){var e=ne.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var ie;K(oe,ie=re),oe.envelopeType="Microsoft.ApplicationInsights.{0}.Event",oe.dataType="EventData";function oe(e,t,n,r){var a=ie.call(this)||this;return a.aiDataContract={ver:h.Required,name:h.Required,properties:h.Default,measurements:h.Default},a.name=U.sanitizeString(e,t)||L.NotSpecified,a.properties=U.sanitizeProperties(e,n),a.measurements=U.sanitizeMeasurements(e,r),a}function se(){}var ce,le=(K(ue,ce=te),ue);function ue(){var e=ce.call(this)||this;return e.ver=2,e.exceptions=[],e.properties={},e.measurements={},e}function de(){this.hasFullStack=!0,this.parsedStack=[]}var pe;K(he,pe=le),he.CreateFromInterface=function(t,e){var n=e.exceptions&&e.exceptions.map(function(e){return ge.CreateFromInterface(t,e)});return new he(t,J({},e,{exceptions:n}))},he.prototype.toInterface=function(){var e=this,t=e.exceptions,n=e.properties,r=e.measurements,a=e.severityLevel,i=e.ver,o=e.problemGroup,s=e.id,c=e.isManual;return{ver:i,exceptions:t instanceof Array&&t.map(function(e){return e.toInterface()})||void 0,severityLevel:a,properties:n,measurements:r,problemGroup:o,id:s,isManual:c}},he.CreateSimpleException=function(e,t,n,r,a,i){return{exceptions:[{hasFullStack:!0,message:e,stack:a,typeName:t}]}},he.envelopeType="Microsoft.ApplicationInsights.{0}.Exception",he.dataType="ExceptionData";function he(e,t,n,r,a,i){var o=pe.call(this)||this;return o.aiDataContract={ver:h.Required,exceptions:h.Required,severityLevel:h.Default,properties:h.Default,measurements:h.Default},t instanceof Error?(o.exceptions=[new ge(e,t)],o.properties=U.sanitizeProperties(e,n),o.measurements=U.sanitizeMeasurements(e,r),a&&(o.severityLevel=a),i&&(o.id=i)):(o.exceptions=t.exceptions,o.properties=t.properties,o.measurements=t.measurements,t.severityLevel&&(o.severityLevel=t.severityLevel),t.id&&(o.id=t.id),t.problemGroup&&(o.problemGroup=t.problemGroup),c.isNullOrUndefined(t.ver)||(o.ver=t.ver),c.isNullOrUndefined(t.isManual)||(o.isManual=t.isManual)),o}var fe,ge=(K(me,fe=de),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 n=t.parsedStack instanceof Array&&t.parsedStack.map(function(e){return xe.CreateFromInterface(e)})||t.parsedStack;return new me(e,J({},t,{parsedStack:n}))},me.parseStack=function(e){var t=void 0;if("string"==typeof e){var n=e.split("\n");t=[];for(var r=0,a=0,i=0;i<=n.length;i++){var o=n[i];if(xe.regex.test(o)){var s=new xe(n[i],r++);a+=s.sizeInBytes,t.push(s)}}if(32768<a)for(var c=0,l=t.length-1,u=0,d=c,p=l;c<l;){if(32768<(u+=t[c].sizeInBytes+t[l].sizeInBytes)){var h=p-d+1;t.splice(d,h);break}d=c,p=l,c++,l--}}return t},me);function me(e,t){var n=fe.call(this)||this;if(n.aiDataContract={id:h.Default,outerId:h.Default,typeName:h.Required,message:h.Required,hasFullStack:h.Default,stack:h.Default,parsedStack:h.Array},t instanceof Error){n.typeName=U.sanitizeString(e,t.name)||L.NotSpecified,n.message=U.sanitizeMessage(e,t.message)||L.NotSpecified;var r=t.stack;n.parsedStack=me.parseStack(r),n.stack=U.sanitizeException(e,r),n.hasFullStack=L.isArray(n.parsedStack)&&0<n.parsedStack.length}else n.typeName=t.typeName,n.message=t.message,n.stack=t.stack,n.parsedStack=t.parsedStack,n.hasFullStack=t.hasFullStack;return n}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 n=ve.call(this)||this;if(n.sizeInBytes=0,n.aiDataContract={level:h.Required,method:h.Required,assembly:h.Default,fileName:h.Default,line:h.Default},"string"==typeof e){var r=e;n.level=t,n.method="<no_method>",n.assembly=L.trim(r),n.fileName="",n.line=0;var a=r.match(ye.regex);a&&5<=a.length&&(n.method=L.trim(a[2])||n.method,n.fileName=L.trim(a[4]),n.line=parseInt(a[5])||0)}else n.level=e.level,n.method=e.method,n.assembly=e.assembly,n.fileName=e.fileName,n.line=e.line,n.sizeInBytes=0;return n.sizeInBytes+=n.method.length,n.sizeInBytes+=n.fileName.length,n.sizeInBytes+=n.assembly.length,n.sizeInBytes+=ye.baseSize,n.sizeInBytes+=n.level.toString().length,n.sizeInBytes+=n.line.toString().length,n}var De,Se,Ie,Ce=(K(Ne,De=te),Ne);function Ne(){var e=De.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 we,Ae=(K(_e,we=function(){this.kind=Se.Measurement}),_e);function _e(){var e=null!==we&&we.apply(this,arguments)||this;return e.aiDataContract={name:h.Required,kind:h.Default,value:h.Required,count:h.Default,min:h.Default,max:h.Default,stdDev:h.Default},e}var Me;K(be,Me=Ce),be.envelopeType="Microsoft.ApplicationInsights.{0}.Metric",be.dataType="MetricData";function be(e,t,n,r,a,i,o){var s=Me.call(this)||this;s.aiDataContract={ver:h.Required,metrics:h.Required,properties:h.Default};var c=new Ae;return c.count=0<r?r:void 0,c.max=isNaN(i)||null===i?void 0:i,c.min=isNaN(a)||null===a?void 0:a,c.name=U.sanitizeString(e,t)||L.NotSpecified,c.value=n,s.metrics=[c],s.properties=U.sanitizeProperties(e,o),s}var Te,je=(K(Re,Te=re),Re);function Re(){var e=Te.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var Ee;K(Ue,Ee=je),Ue.envelopeType="Microsoft.ApplicationInsights.{0}.Pageview",Ue.dataType="PageviewData";function Ue(e,t,n,r,a,i,o){var s=Ee.call(this)||this;return s.aiDataContract={ver:h.Required,name:h.Default,url:h.Default,duration:h.Default,properties:h.Default,measurements:h.Default,id:h.Default},s.id=U.sanitizeId(e,o),s.url=U.sanitizeUrl(e,n),s.name=U.sanitizeString(e,t)||L.NotSpecified,isNaN(r)||(s.duration=L.msToTimeSpan(r)),s.properties=U.sanitizeProperties(e,a),s.measurements=U.sanitizeMeasurements(e,i),s}var qe,Le=(K(ke,qe=te),ke);function ke(){var e=qe.call(this)||this;return e.ver=2,e.success=!0,e.properties={},e.measurements={},e}var Fe,He=(K(Oe,Fe=Le),Oe.envelopeType="Microsoft.ApplicationInsights.{0}.RemoteDependency",Oe.dataType="RemoteDependencyData",Oe);function Oe(e,t,n,r,a,i,o,s,c,l,u){void 0===c&&(c="Ajax");var d=Fe.call(this)||this;d.aiDataContract={id:h.Required,ver:h.Required,name:h.Default,resultCode:h.Default,duration:h.Default,success:h.Default,data:h.Default,target:h.Default,type:h.Default,properties:h.Default,measurements:h.Default,kind:h.Default,value:h.Default,count:h.Default,min:h.Default,max:h.Default,stdDev:h.Default,dependencyKind:h.Default,dependencySource:h.Default,commandName:h.Default,dependencyTypeName:h.Default},d.id=t,d.duration=L.msToTimeSpan(a),d.success=i,d.resultCode=o+"",d.type=U.sanitizeString(e,c);var p=G.ParseDependencyPath(e,n,s,r);return d.data=U.sanitizeUrl(e,r)||p.data,d.target=U.sanitizeString(e,p.target),d.name=U.sanitizeString(e,p.name),d.properties=U.sanitizeProperties(e,l),d.measurements=U.sanitizeMeasurements(e,u),d}var ze,Ge=(K(Pe,ze=te),Pe);function Pe(){var e=ze.call(this)||this;return e.ver=2,e.properties={},e}var Xe;K(We,Xe=Ge),We.envelopeType="Microsoft.ApplicationInsights.{0}.Message",We.dataType="MessageData";function We(e,t,n,r){var a=Xe.call(this)||this;return a.aiDataContract={ver:h.Required,message:h.Required,severityLevel:h.Default,properties:h.Default},t=t||L.NotSpecified,a.message=U.sanitizeMessage(e,t),a.properties=U.sanitizeProperties(e,r),n&&(a.severityLevel=n),a}var Be,Ve=(K(Ke,Be=je),Ke);function Ke(){var e=Be.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var Qe;K(Je,Qe=Ve),Je.envelopeType="Microsoft.ApplicationInsights.{0}.PageviewPerformance",Je.dataType="PageviewPerformanceData";function Je(e,t,n,r,a,i,o){var s=Qe.call(this)||this;return s.aiDataContract={ver:h.Required,name:h.Default,url:h.Default,duration:h.Default,perfTotal:h.Default,networkConnect:h.Default,sentRequest:h.Default,receivedResponse:h.Default,domProcessing:h.Default,properties:h.Default,measurements:h.Default},s.url=U.sanitizeUrl(e,n),s.name=U.sanitizeString(e,t)||L.NotSpecified,s.properties=U.sanitizeProperties(e,a),s.measurements=U.sanitizeMeasurements(e,i),o&&(s.domProcessing=o.domProcessing,s.duration=o.duration,s.networkConnect=o.networkConnect,s.perfTotal=o.perfTotal,s.receivedResponse=o.receivedResponse,s.sentRequest=o.sentRequest),s}var Ye,$e,Ze;K(et,Ye=Y);function et(e,t){var n=Ye.call(this)||this;return n.aiDataContract={baseType:h.Required,baseData:h.Required},n.baseType=e,n.baseData=t,n}(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=(nt.getConfig=function(e,t,n,r){var a;return void 0===r&&(r=!1),a=n&&e.extensionConfig&&e.extensionConfig[n]&&!c.isNullOrUndefined(e.extensionConfig[n][t])?e.extensionConfig[n][t]:e[t],c.isNullOrUndefined(a)?r:a},nt);function nt(){}var rt=(at.create=function(e,t,n,r,a,i){if(n=U.sanitizeString(r,n)||L.NotSpecified,c.isNullOrUndefined(e)||c.isNullOrUndefined(t)||c.isNullOrUndefined(n))throw Error("Input doesn't contain all required fields");var o={name:n,time:(new Date).toISOString(),iKey:"",ext:i||{},tags:[],data:{},baseType:t,baseData:e};if(!c.isNullOrUndefined(a))for(var s in a)a.hasOwnProperty(s)&&(o.data[s]=a[s]);return o},at);function at(){}var it=function(){this.openDone=!1,this.setRequestHeaderDone=!1,this.sendDone=!1,this.abortDone=!1,this.onreadystatechangeCallbackAttached=!1},ot=(st.prototype.getAbsoluteUrl=function(){return this.requestUrl?F.getAbsoluteUrl(this.requestUrl):null},st.prototype.getPathName=function(){return this.requestUrl?U.sanitizeUrl(this._logger,F.getCompleteUrl(this.method,this.requestUrl)):null},st);function st(e,t){this.completed=!1,this.requestHeadersSize=null,this.ttfb=null,this.responseReceivingDuration=null,this.callbackDuration=null,this.ajaxTotalDuration=null,this.aborted=null,this.pageUrl=null,this.requestUrl=null,this.requestSize=0,this.method=null,this.status=null,this.requestSentTime=null,this.responseStartedTime=null,this.responseFinishedTime=null,this.callbackFinishedTime=null,this.endTime=null,this.originalOnreadystatechage=null,this.xhrMonitoringState=new it,this.clientFailure=0,this.CalculateMetrics=function(){this.ajaxTotalDuration=Math.round(1e3*X.GetDuration(this.requestSentTime,this.responseFinishedTime))/1e3},this.id=e,this._logger=t}var ct=(lt.AttachEvent=function(e,t,n){var r=!1;return c.isNullOrUndefined(e)||(c.isNullOrUndefined(e.attachEvent)?c.isNullOrUndefined(e.addEventListener)||(e.addEventListener(t,n,!1),r=!0):(e.attachEvent("on"+t,n),r=!0)),r},lt.DetachEvent=function(e,t,n){c.isNullOrUndefined(e)||(c.isNullOrUndefined(e.detachEvent)?c.isNullOrUndefined(e.removeEventListener)||e.removeEventListener(t,n,!1):e.detachEvent("on"+t,n))},lt);function lt(){}var ut=(dt.prototype.isMonitoredInstance=function(e,t,n,r){var a=!1,i=!0,o=!1;return void 0!==n?(o=this._fetchInitialized,a="object"==typeof n&&!0===n[B]||!!r&&!0===r[B]):void 0!==e&&(o=this.initialized,a=!0===e[B],i=!0===t||!c.isNullOrUndefined(e.ajaxData)),o&&i&&!a},dt.prototype.supportsAjaxMonitoring=function(){var e=!0;return(c.isNullOrUndefined(XMLHttpRequest)||c.isNullOrUndefined(XMLHttpRequest.prototype)||c.isNullOrUndefined(XMLHttpRequest.prototype.open)||c.isNullOrUndefined(XMLHttpRequest.prototype.send)||c.isNullOrUndefined(XMLHttpRequest.prototype.abort))&&(e=!1),e},dt.prototype.instrumentOpen=function(){var r=XMLHttpRequest.prototype.open,a=this;XMLHttpRequest.prototype.open=function(e,t,n){try{!a.isMonitoredInstance(this,!0)||this.ajaxData&&this.ajaxData.xhrMonitoringState.openDone||a.openHandler(this,e,t,n)}catch(e){a._core.logger.throwInternal(i.CRITICAL,x,"Failed to monitor XMLHttpRequest.open, monitoring data for this ajax call may be incorrect.",{ajaxDiagnosticsMessage:dt.getFailedAjaxDiagnosticsMessage(this),exception:L.dump(e)})}return r.apply(this,arguments)}},dt.prototype.openHandler=function(e,t,n,r){var a;a=this._context&&this._context.telemetryTrace&&this._context.telemetryTrace.traceID?"|"+this._context.telemetryTrace.traceID+"."+L.newId():L.newId();var i=new ot(a,this._core.logger);i.method=t,i.requestUrl=n,i.xhrMonitoringState.openDone=!0,e.ajaxData=i,this.attachToOnReadyStateChange(e)},dt.getFailedAjaxDiagnosticsMessage=function(e){var t="";try{c.isNullOrUndefined(e)||c.isNullOrUndefined(e.ajaxData)||c.isNullOrUndefined(e.ajaxData.requestUrl)||(t+="(url: '"+e.ajaxData.requestUrl+"')")}catch(e){}return t},dt.prototype.instrumentSend=function(){var t=XMLHttpRequest.prototype.send,n=this;XMLHttpRequest.prototype.send=function(e){try{n.isMonitoredInstance(this)&&!this.ajaxData.xhrMonitoringState.sendDone&&n.sendHandler(this,e)}catch(e){n._core.logger.throwInternal(i.CRITICAL,D,"Failed to monitor XMLHttpRequest, monitoring data for this ajax call may be incorrect.",{ajaxDiagnosticsMessage:dt.getFailedAjaxDiagnosticsMessage(this),exception:L.dump(e)})}return t.apply(this,arguments)}},dt.prototype.sendHandler=function(e,t){e.ajaxData.requestSentTime=X.Now(),(e=this.includeCorrelationHeaders(e.ajaxData,void 0,void 0,e)).ajaxData.xhrMonitoringState.sendDone=!0},dt.prototype.instrumentAbort=function(){var e=XMLHttpRequest.prototype.abort,t=this;XMLHttpRequest.prototype.abort=function(){try{t.isMonitoredInstance(this)&&!this.ajaxData.xhrMonitoringState.abortDone&&(this.ajaxData.aborted=1,this.ajaxData.xhrMonitoringState.abortDone=!0)}catch(e){t._core.logger.throwInternal(i.CRITICAL,m,"Failed to monitor XMLHttpRequest.abort, monitoring data for this ajax call may be incorrect.",{ajaxDiagnosticsMessage:dt.getFailedAjaxDiagnosticsMessage(this),exception:L.dump(e)})}return e.apply(this,arguments)}},dt.prototype.attachToOnReadyStateChange=function(n){var r=this;n.ajaxData.xhrMonitoringState.onreadystatechangeCallbackAttached=ct.AttachEvent(n,"readystatechange",function(){try{r.isMonitoredInstance(n)&&4===n.readyState&&r.onAjaxComplete(n)}catch(e){var t=L.dump(e);t&&-1!=t.toLowerCase().indexOf("c00c023f")||r._core.logger.throwInternal(i.CRITICAL,y,"Failed to monitor XMLHttpRequest 'readystatechange' event handler, monitoring data for this ajax call may be incorrect.",{ajaxDiagnosticsMessage:dt.getFailedAjaxDiagnosticsMessage(n),exception:L.dump(e)})}})},dt.prototype.onAjaxComplete=function(e){if(e.ajaxData.responseFinishedTime=X.Now(),e.ajaxData.status=e.status,e.ajaxData.CalculateMetrics(),e.ajaxData.ajaxTotalDuration<0)this._core.logger.throwInternal(i.WARNING,v,"Failed to calculate the duration of the ajax call, monitoring data for this ajax call won't be sent.",{ajaxDiagnosticsMessage:dt.getFailedAjaxDiagnosticsMessage(e),requestSentTime:e.ajaxData.requestSentTime,responseFinishedTime:e.ajaxData.responseFinishedTime});else{var t={id:e.ajaxData.id,target:e.ajaxData.getAbsoluteUrl(),name:e.ajaxData.getPathName(),type:"Ajax",duration:e.ajaxData.ajaxTotalDuration,success:200<=+e.ajaxData.status&&+e.ajaxData.status<400,responseCode:+e.ajaxData.status,method:e.ajaxData.method},n=this.getAjaxCorrelationContext(e);n&&(t.correlationContext=n),this.trackDependencyDataInternal(t),e.ajaxData=null}},dt.prototype.getAjaxCorrelationContext=function(t){try{var e=t.getAllResponseHeaders();if(null!==e&&-1!==e.toLowerCase().indexOf(R.requestContextHeaderLowerCase)){var n=t.getResponseHeader(R.requestContextHeader);return O.getCorrelationContext(n)}}catch(e){this._core.logger.throwInternal(i.WARNING,S,"Failed to get Request-Context correlation header as it may be not included in the response or not accessible.",{ajaxDiagnosticsMessage:dt.getFailedAjaxDiagnosticsMessage(t),exception:L.dump(e)})}},dt.prototype.trackDependencyDataInternal=function(e,t,n){if(-1===this._config.maxAjaxCallsPerView||this._trackAjaxAttempts<this._config.maxAjaxCallsPerView){var r=rt.create(e,He.dataType,He.envelopeType,this._core.logger,t,n);this._core.track(r)}else this._trackAjaxAttempts===this._config.maxAjaxCallsPerView&&this._core.logger.throwInternal(i.CRITICAL,N,"Maximum ajax per page view limit reached, ajax monitoring is paused until the next trackPageView(). In order to increase the limit set the maxAjaxCallsPerView configuration parameter.",!0);++this._trackAjaxAttempts},dt.prototype.trackDependencyData=function(e,t){this.trackDependencyDataInternal(e,t)},dt.prototype.processTelemetry=function(e){this._nextPlugin&&this._nextPlugin.processTelemetry&&this._nextPlugin.processTelemetry(e)},dt.prototype.setNextPlugin=function(e){e&&(this._nextPlugin=e)},dt.prototype.instrumentFetch=function(){if(this.supportsFetch()&&!this._fetchInitialized){var r=window.fetch,a=this;window.fetch=function(t,e){var n;if(a.isFetchInstrumented(t)&&a.isMonitoredInstance(void 0,void 0,t,e))try{n=a.createFetchRecord(t,e),e=a.includeCorrelationHeaders(n,t,e)}catch(e){a._core.logger.throwInternal(i.CRITICAL,x,"Failed to monitor Window.fetch, monitoring data for this fetch call may be incorrect.",{ajaxDiagnosticsMessage:this.getFailedFetchDiagnosticsMessage(t),exception:L.dump(e)})}return r(t,e).then(function(e){return a.onFetchComplete(e,n),e}).catch(function(e){throw a.onFetchFailed(t,n,e),e})},this._fetchInitialized=!0}},dt.prototype.isFetchInstrumented=function(e){return this._fetchInitialized&&!0!==e[B]},dt.prototype.supportsFetch=function(){var e=!0;return(!window||c.isNullOrUndefined(window.Request)||c.isNullOrUndefined(window.Request.prototype)||c.isNullOrUndefined(window.fetch))&&(e=!1),e},dt.prototype.createFetchRecord=function(e,t){var n;n=this._context&&this._context.telemetryTrace&&this._context.telemetryTrace.traceID?"|"+this._context.telemetryTrace.traceID+"."+L.newId():L.newId();var r=new ot(n,this._core.logger);return r.requestSentTime=X.Now(),e instanceof Request?r.requestUrl=e?e.url:"":r.requestUrl=e,t&&t.method?r.method=t.method:e&&e instanceof Request?r.method=e.method:r.method="GET",r},dt.prototype.includeCorrelationHeaders=function(e,t,n,r){if(t){if(O.canIncludeCorrelationHeader(this._config,e.getAbsoluteUrl(),this.currentWindowHost)){n||(n={}),n.headers=new Headers(n.headers||t instanceof Request&&t.headers||{}),n.headers.set(R.requestIdHeader,e.id);var a=this._config.appId||this._context.appId();return a&&n.headers.set(R.requestContextHeader,R.requestContextAppIdFormat+a),n}return n}if(r){if(this.currentWindowHost&&O.canIncludeCorrelationHeader(this._config,r.ajaxData.getAbsoluteUrl(),this.currentWindowHost)){r.setRequestHeader(R.requestIdHeader,r.ajaxData.id);var i=this._config.appId||this._context.appId();i&&r.setRequestHeader(R.requestContextHeader,R.requestContextAppIdFormat+i)}return r}},dt.prototype.getFailedFetchDiagnosticsMessage=function(e){var t="";try{c.isNullOrUndefined(e)||(t+="string"==typeof e?"(url: '"+e+"')":"(url: '"+e.url+"')")}catch(e){this._core.logger.throwInternal(i.CRITICAL,x,"Failed to grab failed fetch diagnostics message",{exception:L.dump(e)})}return t},dt.prototype.onFetchComplete=function(t,e){if(e)try{if(e.responseFinishedTime=X.Now(),e.CalculateMetrics(),e.ajaxTotalDuration<0)this._core.logger.throwInternal(i.WARNING,v,"Failed to calculate the duration of the fetch call, monitoring data for this fetch call won't be sent.",{fetchDiagnosticsMessage:this.getFailedFetchDiagnosticsMessage(t),requestSentTime:e.requestSentTime,responseFinishedTime:e.responseFinishedTime});else{var n={id:e.id,target:e.getAbsoluteUrl(),name:e.getPathName(),type:"Fetch",duration:e.ajaxTotalDuration,success:200<=t.status&&t.status<400,responseCode:t.status,properties:{HttpMethod:e.method}},r=this.getFetchCorrelationContext(t);r&&(n.correlationContext=r),this.trackDependencyDataInternal(n)}}catch(e){this._core.logger.throwInternal(i.WARNING,S,"Failed to calculate the duration of the fetch call, monitoring data for this fetch call won't be sent.",{fetchDiagnosticsMessage:this.getFailedFetchDiagnosticsMessage(t),exception:L.dump(e)})}},dt.prototype.onFetchFailed=function(t,e,n){if(e)try{if(e.responseFinishedTime=X.Now(),e.CalculateMetrics(),e.ajaxTotalDuration<0)this._core.logger.throwInternal(i.WARNING,v,"Failed to calculate the duration of the failed fetch call, monitoring data for this fetch call won't be sent.",{fetchDiagnosticsMessage:this.getFailedFetchDiagnosticsMessage(t),requestSentTime:e.requestSentTime,responseFinishedTime:e.responseFinishedTime});else{var r={id:e.id,target:e.getAbsoluteUrl(),name:e.getPathName(),type:"Fetch",duration:e.ajaxTotalDuration,success:!1,responseCode:0,properties:{HttpMethod:e.method}};this.trackDependencyDataInternal(r,{error:n.message})}}catch(e){this._core.logger.throwInternal(i.WARNING,S,"Failed to calculate the duration of the failed fetch call, monitoring data for this fetch call won't be sent.",{fetchDiagnosticsMessage:this.getFailedFetchDiagnosticsMessage(t),exception:L.dump(e)})}},dt.prototype.getFetchCorrelationContext=function(t){try{var e=t.headers.get(R.requestContextHeader);return O.getCorrelationContext(e)}catch(e){this._core.logger.throwInternal(i.WARNING,S,"Failed to get Request-Context correlation header as it may be not included in the response or not accessible.",{fetchDiagnosticsMessage:this.getFailedFetchDiagnosticsMessage(t),exception:L.dump(e)})}},dt.prototype.instrumentXhr=function(){this.supportsAjaxMonitoring()&&!this.initialized&&(this.instrumentOpen(),this.instrumentSend(),this.instrumentAbort(),this.initialized=!0)},dt.getDefaultConfig=function(){return{maxAjaxCallsPerView:500,disableAjaxTracking:!1,disableFetchTracking:!0,disableCorrelationHeaders:!1,correlationHeaderExcludedDomains:["*.blob.core.windows.net","*.blob.core.chinacloudapi.cn","*.blob.core.cloudapi.de","*.blob.core.usgovcloudapi.net"],correlationHeaderDomains:void 0,appId:void 0,enableCorsCorrelation:!1}},dt.getEmptyConfig=function(){return{maxAjaxCallsPerView:void 0,disableAjaxTracking:void 0,disableFetchTracking:void 0,disableCorrelationHeaders:void 0,correlationHeaderExcludedDomains:void 0,appId:void 0,enableCorsCorrelation:void 0,correlationHeaderDomains:void 0}},dt.prototype.initialize=function(e,t,n){if(!this.initialized&&!this._fetchInitialized){this._core=t;var r=dt.getDefaultConfig();for(var a in this._config=dt.getEmptyConfig(),r)this._config[a]=tt.getConfig(e,a,dt.identifier,r[a]);if(!1===this._config.disableAjaxTracking&&this.instrumentXhr(),!1===this._config.disableFetchTracking&&this.instrumentFetch(),0<n.length&&n){for(var i=void 0,o=0;!i&&o<n.length;)n[o]&&"AppInsightsPropertiesPlugin"===n[o].identifier&&(i=n[o]),o++;i&&(this._context=i.context)}}},dt.identifier="AjaxDependencyPlugin",dt);function dt(){this._trackAjaxAttempts=0,this.identifier=dt.identifier,this.priority=120,this.currentWindowHost=window&&window.location&&window.location.host&&window.location.host.toLowerCase(),this.initialized=!1,this._fetchInitialized=!1}e.AjaxPlugin=ut,e.ajaxRecord=ot,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 a,t,h,n,s,r;(t=a=a||{})[t.LocalStorage=0]="LocalStorage",t[t.SessionStorage=1]="SessionStorage",(n=h=h||{})[n.Default=0]="Default",n[n.Required=1]="Required",n[n.Array=2]="Array",n[n.Hidden=4]="Hidden",(r=s=s||{})[r.AI=0]="AI",r[r.AI_AND_W3C=1]="AI_AND_W3C",r[r.W3C=2]="W3C";var c=(i.isNullOrUndefined=function(e){return null==e},i.disableCookies=function(){i._canUseCookies=!1},i.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(l,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},i);function i(){}var o,u,l=/[xy]/g;(u=o=o||{})[u.CRITICAL=1]="CRITICAL",u[u.WARNING=2]="WARNING";var d=1,p=2,f=3,g=4,m=5,v=6,x=13,y=14,I=15,D=16,S=17,C=18,_=49,A=52,N=55,b=56,w=57,T=61,M=66,H=68,R=69,q=71;j.prototype.processTelemetry=function(t){this.channelQueue.forEach(function(e){0<e.length&&e[0].processTelemetry(t)})},Object.defineProperty(j.prototype,"ChannelControls",{get:function(){return this.channelQueue},enumerable:!0,configurable:!0}),j.prototype.initialize=function(n,r,a){var i=this;if(n.isCookieUseDisabled&&c.disableCookies(),this.channelQueue=new Array,n.channels){var o=void 0;n.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&&(o=e.identifier),e.initialize(n,r,a)}),o)throw Error("Channel has invalid priority"+o);i.channelQueue.push(e)}})}for(var e=new Array,t=0;t<a.length;t++){var s=a[t];500<s.priority&&e.push(s)}if(0<e.length){for((e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){return e.initialize(n,r,a)}),t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);this.channelQueue.push(e)}};function j(){this.identifier="ChannelControllerPlugin",this.priority=500}var E=(U.requestContextHeader="Request-Context",U.requestContextTargetKey="appId",U.requestContextAppIdFormat="appId=cid-v1:",U.requestIdHeader="Request-Id",U.traceParentHeader="traceparent",U.sdkContextHeader="Sdk-Context",U.sdkContextHeaderAppIdRequest="appId",U.requestContextHeaderLowerCase="request-context",U);function U(){}var k=(L.sanitizeKeyAndAddUniqueness=function(e,t,n){var r=t.length,a=L.sanitizeKey(e,t);if(a.length!==r){for(var i=0,o=a;void 0!==n[o];)i++,o=a.substring(0,L.MAX_NAME_LENGTH-3)+L.padNumber(i);a=o}return a},L.sanitizeKey=function(e,t){var n;return t&&(t=L.trim(t.toString())).length>L.MAX_NAME_LENGTH&&(n=t.substring(0,L.MAX_NAME_LENGTH),e.throwInternal(o.WARNING,w,"name is too long. It has been truncated to "+L.MAX_NAME_LENGTH+" characters.",{name:t},!0)),n||t},L.sanitizeString=function(e,t,n){var r;return void 0===n&&(n=L.MAX_STRING_LENGTH),t&&(n=n||L.MAX_STRING_LENGTH,(t=L.trim(t)).toString().length>n&&(r=t.toString().substring(0,n),e.throwInternal(o.WARNING,T,"string value is too long. It has been truncated to "+n+" characters.",{value:t},!0))),r||t},L.sanitizeUrl=function(e,t){return L.sanitizeInput(e,t,L.MAX_URL_LENGTH,M)},L.sanitizeMessage=function(e,t){var n;return t&&t.length>L.MAX_MESSAGE_LENGTH&&(n=t.substring(0,L.MAX_MESSAGE_LENGTH),e.throwInternal(o.WARNING,b,"message is too long, it has been truncated to "+L.MAX_MESSAGE_LENGTH+" characters.",{message:t},!0)),n||t},L.sanitizeException=function(e,t){var n;return t&&t.length>L.MAX_EXCEPTION_LENGTH&&(n=t.substring(0,L.MAX_EXCEPTION_LENGTH),e.throwInternal(o.WARNING,A,"exception is too long, it has been truncated to "+L.MAX_EXCEPTION_LENGTH+" characters.",{exception:t},!0)),n||t},L.sanitizeProperties=function(t,e){if(e){var n={};for(var r in e){var a=e[r];if("object"==typeof a&&"undefined"!=typeof JSON)try{a=JSON.stringify(a)}catch(e){t.throwInternal(o.WARNING,_,"custom property is not valid",{exception:e},!0)}a=L.sanitizeString(t,a,L.MAX_PROPERTY_LENGTH),n[r=L.sanitizeKeyAndAddUniqueness(t,r,n)]=a}e=n}return e},L.sanitizeMeasurements=function(e,t){if(t){var n={};for(var r in t){var a=t[r];n[r=L.sanitizeKeyAndAddUniqueness(e,r,n)]=a}t=n}return t},L.sanitizeId=function(e,t){return t?L.sanitizeInput(e,t,L.MAX_ID_LENGTH,R).toString():t},L.sanitizeInput=function(e,t,n,r){var a;return t&&(t=L.trim(t)).length>n&&(a=t.substring(0,n),e.throwInternal(o.WARNING,r,"input is too long, it has been truncated to "+n+" characters.",{data:t},!0)),a||t},L.padNumber=function(e){var t="00"+e;return t.substr(t.length-3)},L.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},L.MAX_NAME_LENGTH=150,L.MAX_ID_LENGTH=128,L.MAX_PROPERTY_LENGTH=8192,L.MAX_STRING_LENGTH=1024,L.MAX_URL_LENGTH=2048,L.MAX_MESSAGE_LENGTH=32768,L.MAX_EXCEPTION_LENGTH=32768,L);function L(){}var F=(O.createDomEvent=function(e){var t=null;return"function"==typeof Event?t=new Event(e):(t=document.createEvent("Event")).initEvent(e,!0,!0),t},O.disableStorage=function(){O._canUseLocalStorage=!1,O._canUseSessionStorage=!1},O._getLocalStorageObject=function(){return O.canUseLocalStorage()?O._getVerifiedStorageObject(a.LocalStorage):null},O._getVerifiedStorageObject=function(e){var t,n,r=null;try{if("undefined"==typeof window)return null;n=new Date,(r=e===a.LocalStorage?window.localStorage:window.sessionStorage).setItem(n,n),t=r.getItem(n)!=n,r.removeItem(n),t&&(r=null)}catch(e){r=null}return r},O.isInternalApplicationInsightsEndpoint=function(e){return-1!==O._internalEndpoints.indexOf(e.toLowerCase())},O.canUseLocalStorage=function(){return void 0===O._canUseLocalStorage&&(O._canUseLocalStorage=!!O._getVerifiedStorageObject(a.LocalStorage)),O._canUseLocalStorage},O.getStorage=function(t,e){var n=O._getLocalStorageObject();if(null!==n)try{return n.getItem(e)}catch(e){O._canUseLocalStorage=!1,t.throwInternal(o.WARNING,d,"Browser failed read of local storage. "+O.getExceptionName(e),{exception:O.dump(e)})}return null},O.setStorage=function(t,e,n){var r=O._getLocalStorageObject();if(null!==r)try{return r.setItem(e,n),!0}catch(e){O._canUseLocalStorage=!1,t.throwInternal(o.WARNING,f,"Browser failed write to local storage. "+O.getExceptionName(e),{exception:O.dump(e)})}return!1},O.removeStorage=function(t,e){var n=O._getLocalStorageObject();if(null!==n)try{return n.removeItem(e),!0}catch(e){O._canUseLocalStorage=!1,t.throwInternal(o.WARNING,m,"Browser failed removal of local storage item. "+O.getExceptionName(e),{exception:O.dump(e)})}return!1},O._getSessionStorageObject=function(){return O.canUseSessionStorage()?O._getVerifiedStorageObject(a.SessionStorage):null},O.canUseSessionStorage=function(){return void 0===O._canUseSessionStorage&&(O._canUseSessionStorage=!!O._getVerifiedStorageObject(a.SessionStorage)),O._canUseSessionStorage},O.getSessionStorageKeys=function(){var e=[];if(O.canUseSessionStorage())for(var t in window.sessionStorage)e.push(t);return e},O.getSessionStorage=function(t,e){var n=O._getSessionStorageObject();if(null!==n)try{return n.getItem(e)}catch(e){O._canUseSessionStorage=!1,t.throwInternal(o.WARNING,p,"Browser failed read of session storage. "+O.getExceptionName(e),{exception:O.dump(e)})}return null},O.setSessionStorage=function(t,e,n){var r=O._getSessionStorageObject();if(null!==r)try{return r.setItem(e,n),!0}catch(e){O._canUseSessionStorage=!1,t.throwInternal(o.WARNING,g,"Browser failed write to session storage. "+O.getExceptionName(e),{exception:O.dump(e)})}return!1},O.removeSessionStorage=function(t,e){var n=O._getSessionStorageObject();if(null!==n)try{return n.removeItem(e),!0}catch(e){O._canUseSessionStorage=!1,t.throwInternal(o.WARNING,v,"Browser failed removal of session storage item. "+O.getExceptionName(e),{exception:O.dump(e)})}return!1},O.disableCookies=function(){c.disableCookies()},O.canUseCookies=function(t){if(void 0===c._canUseCookies){c._canUseCookies=!1;try{c._canUseCookies=void 0!==O.document.cookie}catch(e){t.throwInternal(o.WARNING,H,"Cannot access document.cookie - "+O.getExceptionName(e),{exception:O.dump(e)})}}return c._canUseCookies},O.setCookie=function(e,t,n,r){var a="",i="";r&&(a=";domain="+r),O.document.location&&"https:"===O.document.location.protocol&&(i=";secure"),O.canUseCookies(e)&&(O.document.cookie=t+"="+n+a+";path=/"+i)},O.stringToBoolOrDefault=function(e,t){return void 0===t&&(t=!1),null==e?t:"true"===e.toString().toLowerCase()},O.getCookie=function(e,t){if(O.canUseCookies(e)){var n="";if(t&&t.length)for(var r=t+"=",a=O.document.cookie.split(";"),i=0;i<a.length;i++){var o=a[i];if((o=O.trim(o))&&0===o.indexOf(r)){n=o.substring(r.length,a[i].length);break}}return n}},O.deleteCookie=function(e,t){O.canUseCookies(e)&&(O.document.cookie=t+"=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;")},O.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},O.newId=function(){for(var e="",t=1073741824*Math.random();0<t;)e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t%64),t=Math.floor(t/64);return e},O.random32=function(){return 4294967296*Math.random()|0},O.generateW3CId=function(){for(var e,t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],n="",r=0;r<4;r++)n+=t[15&(e=O.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 a=t[8+4*Math.random()|0];return n.substr(0,8)+n.substr(9,4)+"4"+n.substr(13,3)+a+n.substr(16,3)+n.substr(19,12)},O.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},O.isError=function(e){return"[object Error]"===Object.prototype.toString.call(e)},O.isDate=function(e){return"[object Date]"===Object.prototype.toString.call(e)},O.toISOStringForIE8=function(e){if(O.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"}},O.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},O.msToTimeSpan=function(e){(isNaN(e)||e<0)&&(e=0);var t=""+(e=Math.round(e))%1e3,n=""+Math.floor(e/1e3)%60,r=""+Math.floor(e/6e4)%60,a=""+Math.floor(e/36e5)%24,i=Math.floor(e/864e5);return t=1===t.length?"00"+t:2===t.length?"0"+t:t,n=n.length<2?"0"+n:n,r=r.length<2?"0"+r:r,(0<i?i+".":"")+(a=a.length<2?"0"+a:a)+":"+r+":"+n+"."+t},O.isCrossOriginError=function(e,t,n,r,a){return("Script error."===e||"Script error"===e)&&!a},O.dump=function(e){var t=Object.prototype.toString.call(e),n=JSON.stringify(e);return"[object Error]"===t&&(n="{ stack: '"+e.stack+"', message: '"+e.message+"', name: '"+e.name+"'"),t+n},O.getExceptionName=function(e){return"[object Error]"===Object.prototype.toString.call(e)?e.name:""},O.addEventHandler=function(e,t){if("undefined"==typeof window||!window||"string"!=typeof e||"function"!=typeof t)return!1;var n="on"+e;if(window.addEventListener)window.addEventListener(e,t,!1);else{if(!window.attachEvent)return!1;window.attachEvent(n,t)}return!0},O.IsBeaconApiSupported=function(){return"sendBeacon"in navigator&&navigator.sendBeacon},O.getExtension=function(e,t){for(var n=null,r=0;!n&&r<e.length;)e[r]&&e[r].identifier===t&&(n=e[r]),r++;return n},O.document="undefined"!=typeof document?document:{},O._canUseLocalStorage=void 0,O._canUseSessionStorage=void 0,O._internalEndpoints=["https://dc.services.visualstudio.com/v2/track","https://breeze.aimon.applicationinsights.io/v2/track","https://dc-int.services.visualstudio.com/v2/track"],O.NotSpecified="not_specified",O);function O(){}var z=(P.parseUrl=function(e){return P.htmlAnchorElement||(P.htmlAnchorElement=P.document.createElement?P.document.createElement("a"):{host:P.parseHost(e)}),P.htmlAnchorElement.href=e,P.htmlAnchorElement},P.getAbsoluteUrl=function(e){var t,n=P.parseUrl(e);return n&&(t=n.href),t},P.getPathName=function(e){var t,n=P.parseUrl(e);return n&&(t=n.pathname),t},P.getCompleteUrl=function(e,t){return e?e.toUpperCase()+" "+t:t},P.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},P.document="undefined"!=typeof document?document:{},P);function P(){}var G=(W.canIncludeCorrelationHeader=function(e,t,n){if(e&&e.disableCorrelationHeaders)return!1;if(!t)return!1;var r=z.parseUrl(t).host.toLowerCase();if(!(e&&e.enableCorsCorrelation||r===n))return!1;var a,i=e&&e.correlationHeaderDomains;if(i&&(i.forEach(function(e){var t=new RegExp(e.toLowerCase().replace(/\./g,".").replace(/\*/g,".*"));a=a||t.test(r)}),!a))return!1;var o=e&&e.correlationHeaderExcludedDomains;if(!o||0==o.length)return!0;for(var s=0;s<o.length;s++)if(new RegExp(o[s].toLowerCase().replace(/\./g,".").replace(/\*/g,".*")).test(r))return!1;return!0},W.getCorrelationContext=function(e){if(e){var t=W.getCorrelationContextValue(e,E.requestContextTargetKey);if(t&&t!==W.correlationIdPrefix)return t}},W.getCorrelationContextValue=function(e,t){if(e)for(var n=e.split(","),r=0;r<n.length;++r){var a=n[r].split("=");if(2==a.length&&a[0]==t)return a[1]}},W.correlationIdPrefix="cid-v1:",W);function W(){}var X=(V.ParseDependencyPath=function(e,t,n,r){var a,i=r,o=r;if(t&&0<t.length){var s=z.parseUrl(t);if(a=s.host,!i)if(null!=s.pathname){var c=0===s.pathname.length?"/":s.pathname;"/"!==c.charAt(0)&&(c="/"+c),o=s.pathname,i=k.sanitizeString(e,n?n+" "+c:c)}else i=k.sanitizeString(e,t)}else i=a=r;return{target:a,name:i,data:o}},V);function V(){}var B=(K.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()},K.GetDuration=function(e,t){var n=null;return 0===e||0===t||c.isNullOrUndefined(e)||c.isNullOrUndefined(t)||(n=t-e),n},K);function K(){}var Q="Microsoft_ApplicationInsights_BypassAjaxInstrumentation",J=function(e,t){return(J=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function $(e,t){function n(){this.constructor=e}J(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var Y,Z=function(){return(Z=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)},ee=($(te,Y=function(){}),te);function te(){return Y.call(this)||this}var ne;$(re,ne=function(){this.ver=1,this.sampleRate=100,this.tags={}});function re(e,t,n){var r=ne.call(this)||this;return r.name=k.sanitizeString(e,n)||F.NotSpecified,r.data=t,r.time=F.toISOStringForIE8(new Date),r.aiDataContract={time:h.Required,iKey:h.Required,name:h.Required,sampleRate:function(){return 100==r.sampleRate?h.Hidden:h.Required},tags:h.Required,data:h.Required},r}function ae(){}var ie,oe=($(se,ie=ae),se);function se(){var e=ie.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var ce;$(ue,ce=oe),ue.envelopeType="Microsoft.ApplicationInsights.{0}.Event",ue.dataType="EventData";function ue(e,t,n,r){var a=ce.call(this)||this;return a.aiDataContract={ver:h.Required,name:h.Required,properties:h.Default,measurements:h.Default},a.name=k.sanitizeString(e,t)||F.NotSpecified,a.properties=k.sanitizeProperties(e,n),a.measurements=k.sanitizeMeasurements(e,r),a}function le(){}var de,pe=($(he,de=ae),he);function he(){var e=de.call(this)||this;return e.ver=2,e.exceptions=[],e.properties={},e.measurements={},e}function fe(){this.hasFullStack=!0,this.parsedStack=[]}var ge;$(me,ge=pe),me.CreateFromInterface=function(t,e){var n=e.exceptions&&e.exceptions.map(function(e){return xe.CreateFromInterface(t,e)});return new me(t,Z({},e,{exceptions:n}))},me.prototype.toInterface=function(){var e=this,t=e.exceptions,n=e.properties,r=e.measurements,a=e.severityLevel,i=e.ver,o=e.problemGroup,s=e.id,c=e.isManual;return{ver:i,exceptions:t instanceof Array&&t.map(function(e){return e.toInterface()})||void 0,severityLevel:a,properties:n,measurements:r,problemGroup:o,id:s,isManual:c}},me.CreateSimpleException=function(e,t,n,r,a,i){return{exceptions:[{hasFullStack:!0,message:e,stack:a,typeName:t}]}},me.envelopeType="Microsoft.ApplicationInsights.{0}.Exception",me.dataType="ExceptionData";function me(e,t,n,r,a,i){var o=ge.call(this)||this;return o.aiDataContract={ver:h.Required,exceptions:h.Required,severityLevel:h.Default,properties:h.Default,measurements:h.Default},t instanceof Error?(o.exceptions=[new xe(e,t)],o.properties=k.sanitizeProperties(e,n),o.measurements=k.sanitizeMeasurements(e,r),a&&(o.severityLevel=a),i&&(o.id=i)):(o.exceptions=t.exceptions,o.properties=t.properties,o.measurements=t.measurements,t.severityLevel&&(o.severityLevel=t.severityLevel),t.id&&(o.id=t.id),t.problemGroup&&(o.problemGroup=t.problemGroup),c.isNullOrUndefined(t.ver)||(o.ver=t.ver),c.isNullOrUndefined(t.isManual)||(o.isManual=t.isManual)),o}var ve,xe=($(ye,ve=fe),ye.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}},ye.CreateFromInterface=function(e,t){var n=t.parsedStack instanceof Array&&t.parsedStack.map(function(e){return De.CreateFromInterface(e)})||t.parsedStack;return new ye(e,Z({},t,{parsedStack:n}))},ye.parseStack=function(e){var t=void 0;if("string"==typeof e){var n=e.split("\n");t=[];for(var r=0,a=0,i=0;i<=n.length;i++){var o=n[i];if(De.regex.test(o)){var s=new De(n[i],r++);a+=s.sizeInBytes,t.push(s)}}if(32768<a)for(var c=0,u=t.length-1,l=0,d=c,p=u;c<u;){if(32768<(l+=t[c].sizeInBytes+t[u].sizeInBytes)){var h=p-d+1;t.splice(d,h);break}d=c,p=u,c++,u--}}return t},ye);function ye(e,t){var n=ve.call(this)||this;if(n.aiDataContract={id:h.Default,outerId:h.Default,typeName:h.Required,message:h.Required,hasFullStack:h.Default,stack:h.Default,parsedStack:h.Array},t instanceof Error){n.typeName=k.sanitizeString(e,t.name)||F.NotSpecified,n.message=k.sanitizeMessage(e,t.message)||F.NotSpecified;var r=t.stack;n.parsedStack=ye.parseStack(r),n.stack=k.sanitizeException(e,r),n.hasFullStack=F.isArray(n.parsedStack)&&0<n.parsedStack.length}else n.typeName=t.typeName,n.message=t.message,n.stack=t.stack,n.parsedStack=t.parsedStack,n.hasFullStack=t.hasFullStack;return n}var Ie,De=($(Se,Ie=le),Se.CreateFromInterface=function(e){return new Se(e,null)},Se.prototype.toInterface=function(){return{level:this.level,method:this.method,assembly:this.assembly,fileName:this.fileName,line:this.line}},Se.regex=/^([\s]+at)?(.*?)(\@|\s\(|\s)([^\(\@\n]+):([0-9]+):([0-9]+)(\)?)$/,Se.baseSize=58,Se);function Se(e,t){var n=Ie.call(this)||this;if(n.sizeInBytes=0,n.aiDataContract={level:h.Required,method:h.Required,assembly:h.Default,fileName:h.Default,line:h.Default},"string"==typeof e){var r=e;n.level=t,n.method="<no_method>",n.assembly=F.trim(r),n.fileName="",n.line=0;var a=r.match(Se.regex);a&&5<=a.length&&(n.method=F.trim(a[2])||n.method,n.fileName=F.trim(a[4]),n.line=parseInt(a[5])||0)}else n.level=e.level,n.method=e.method,n.assembly=e.assembly,n.fileName=e.fileName,n.line=e.line,n.sizeInBytes=0;return n.sizeInBytes+=n.method.length,n.sizeInBytes+=n.fileName.length,n.sizeInBytes+=n.assembly.length,n.sizeInBytes+=Se.baseSize,n.sizeInBytes+=n.level.toString().length,n.sizeInBytes+=n.line.toString().length,n}var Ce,_e,Ae,Ne=($(be,Ce=ae),be);function be(){var e=Ce.call(this)||this;return e.ver=2,e.metrics=[],e.properties={},e}(Ae=_e=_e||{})[Ae.Measurement=0]="Measurement",Ae[Ae.Aggregation=1]="Aggregation";var we,Te=($(Me,we=function(){this.kind=_e.Measurement}),Me);function Me(){var e=null!==we&&we.apply(this,arguments)||this;return e.aiDataContract={name:h.Required,kind:h.Default,value:h.Required,count:h.Default,min:h.Default,max:h.Default,stdDev:h.Default},e}var He;$(Re,He=Ne),Re.envelopeType="Microsoft.ApplicationInsights.{0}.Metric",Re.dataType="MetricData";function Re(e,t,n,r,a,i,o){var s=He.call(this)||this;s.aiDataContract={ver:h.Required,metrics:h.Required,properties:h.Default};var c=new Te;return c.count=0<r?r:void 0,c.max=isNaN(i)||null===i?void 0:i,c.min=isNaN(a)||null===a?void 0:a,c.name=k.sanitizeString(e,t)||F.NotSpecified,c.value=n,s.metrics=[c],s.properties=k.sanitizeProperties(e,o),s}var qe,je=($(Ee,qe=oe),Ee);function Ee(){var e=qe.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var Ue;$(ke,Ue=je),ke.envelopeType="Microsoft.ApplicationInsights.{0}.Pageview",ke.dataType="PageviewData";function ke(e,t,n,r,a,i,o){var s=Ue.call(this)||this;return s.aiDataContract={ver:h.Required,name:h.Default,url:h.Default,duration:h.Default,properties:h.Default,measurements:h.Default,id:h.Default},s.id=k.sanitizeId(e,o),s.url=k.sanitizeUrl(e,n),s.name=k.sanitizeString(e,t)||F.NotSpecified,isNaN(r)||(s.duration=F.msToTimeSpan(r)),s.properties=k.sanitizeProperties(e,a),s.measurements=k.sanitizeMeasurements(e,i),s}var Le,Fe=($(Oe,Le=ae),Oe);function Oe(){var e=Le.call(this)||this;return e.ver=2,e.success=!0,e.properties={},e.measurements={},e}var ze,Pe=($(Ge,ze=Fe),Ge.envelopeType="Microsoft.ApplicationInsights.{0}.RemoteDependency",Ge.dataType="RemoteDependencyData",Ge);function Ge(e,t,n,r,a,i,o,s,c,u,l){void 0===c&&(c="Ajax");var d=ze.call(this)||this;d.aiDataContract={id:h.Required,ver:h.Required,name:h.Default,resultCode:h.Default,duration:h.Default,success:h.Default,data:h.Default,target:h.Default,type:h.Default,properties:h.Default,measurements:h.Default,kind:h.Default,value:h.Default,count:h.Default,min:h.Default,max:h.Default,stdDev:h.Default,dependencyKind:h.Default,dependencySource:h.Default,commandName:h.Default,dependencyTypeName:h.Default},d.id=t,d.duration=F.msToTimeSpan(a),d.success=i,d.resultCode=o+"",d.type=k.sanitizeString(e,c);var p=X.ParseDependencyPath(e,n,s,r);return d.data=k.sanitizeUrl(e,r)||p.data,d.target=k.sanitizeString(e,p.target),d.name=k.sanitizeString(e,p.name),d.properties=k.sanitizeProperties(e,u),d.measurements=k.sanitizeMeasurements(e,l),d}var We,Xe=($(Ve,We=ae),Ve);function Ve(){var e=We.call(this)||this;return e.ver=2,e.properties={},e}var Be;$(Ke,Be=Xe),Ke.envelopeType="Microsoft.ApplicationInsights.{0}.Message",Ke.dataType="MessageData";function Ke(e,t,n,r){var a=Be.call(this)||this;return a.aiDataContract={ver:h.Required,message:h.Required,severityLevel:h.Default,properties:h.Default},t=t||F.NotSpecified,a.message=k.sanitizeMessage(e,t),a.properties=k.sanitizeProperties(e,r),n&&(a.severityLevel=n),a}var Qe,Je=($($e,Qe=je),$e);function $e(){var e=Qe.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var Ye;$(Ze,Ye=Je),Ze.envelopeType="Microsoft.ApplicationInsights.{0}.PageviewPerformance",Ze.dataType="PageviewPerformanceData";function Ze(e,t,n,r,a,i,o){var s=Ye.call(this)||this;return s.aiDataContract={ver:h.Required,name:h.Default,url:h.Default,duration:h.Default,perfTotal:h.Default,networkConnect:h.Default,sentRequest:h.Default,receivedResponse:h.Default,domProcessing:h.Default,properties:h.Default,measurements:h.Default},s.url=k.sanitizeUrl(e,n),s.name=k.sanitizeString(e,t)||F.NotSpecified,s.properties=k.sanitizeProperties(e,a),s.measurements=k.sanitizeMeasurements(e,i),o&&(s.domProcessing=o.domProcessing,s.duration=o.duration,s.networkConnect=o.networkConnect,s.perfTotal=o.perfTotal,s.receivedResponse=o.receivedResponse,s.sentRequest=o.sentRequest),s}var et,tt,nt;$(rt,et=ee);function rt(e,t){var n=et.call(this)||this;return n.aiDataContract={baseType:h.Required,baseData:h.Required},n.baseType=e,n.baseData=t,n}(nt=tt=tt||{})[nt.Verbose=0]="Verbose",nt[nt.Information=1]="Information",nt[nt.Warning=2]="Warning",nt[nt.Error=3]="Error",nt[nt.Critical=4]="Critical";var at=(it.getConfig=function(e,t,n,r){var a;return void 0===r&&(r=!1),a=n&&e.extensionConfig&&e.extensionConfig[n]&&!c.isNullOrUndefined(e.extensionConfig[n][t])?e.extensionConfig[n][t]:e[t],c.isNullOrUndefined(a)?r:a},it);function it(){}var ot=(st.create=function(e,t,n,r,a,i){if(n=k.sanitizeString(r,n)||F.NotSpecified,c.isNullOrUndefined(e)||c.isNullOrUndefined(t)||c.isNullOrUndefined(n))throw Error("Input doesn't contain all required fields");var o={name:n,time:(new Date).toISOString(),iKey:"",ext:i||{},tags:[],data:{},baseType:t,baseData:e};if(!c.isNullOrUndefined(a))for(var s in a)a.hasOwnProperty(s)&&(o.data[s]=a[s]);return o},st);function st(){}var ct=function(){this.openDone=!1,this.setRequestHeaderDone=!1,this.sendDone=!1,this.abortDone=!1,this.onreadystatechangeCallbackAttached=!1},ut=(lt.prototype.getAbsoluteUrl=function(){return this.requestUrl?z.getAbsoluteUrl(this.requestUrl):null},lt.prototype.getPathName=function(){return this.requestUrl?k.sanitizeUrl(this._logger,z.getCompleteUrl(this.method,this.requestUrl)):null},lt);function lt(e,t,n){this.completed=!1,this.requestHeadersSize=null,this.requestHeaders=null,this.ttfb=null,this.responseReceivingDuration=null,this.callbackDuration=null,this.ajaxTotalDuration=null,this.aborted=null,this.pageUrl=null,this.requestUrl=null,this.requestSize=0,this.method=null,this.status=null,this.requestSentTime=null,this.responseStartedTime=null,this.responseFinishedTime=null,this.callbackFinishedTime=null,this.endTime=null,this.originalOnreadystatechage=null,this.xhrMonitoringState=new ct,this.clientFailure=0,this.CalculateMetrics=function(){this.ajaxTotalDuration=Math.round(1e3*B.GetDuration(this.requestSentTime,this.responseFinishedTime))/1e3},this.traceID=e,this.spanID=t,this._logger=n}var dt=(pt.AttachEvent=function(e,t,n){var r=!1;return c.isNullOrUndefined(e)||(c.isNullOrUndefined(e.attachEvent)?c.isNullOrUndefined(e.addEventListener)||(e.addEventListener(t,n,!1),r=!0):(e.attachEvent("on"+t,n),r=!0)),r},pt.DetachEvent=function(e,t,n){c.isNullOrUndefined(e)||(c.isNullOrUndefined(e.detachEvent)?c.isNullOrUndefined(e.removeEventListener)||e.removeEventListener(t,n,!1):e.detachEvent("on"+t,n))},pt);function pt(){}var ht=(ft.isValidTraceId=function(e){return e.match(/^[0-9a-f]{32}$/)&&"00000000000000000000000000000000"!==e},ft.isValidSpanId=function(e){return e.match(/^[0-9a-f]{16}$/)&&"0000000000000000"!==e},ft.prototype.toString=function(){return this.version+"-"+this.traceId+"-"+this.spanId+"-"+this.traceFlag},ft.DEFAULT_TRACE_FLAG="00",ft.DEFAULT_VERSION="00",ft);function ft(e,t){this.traceFlag=ft.DEFAULT_TRACE_FLAG,this.version=ft.DEFAULT_VERSION,e&&ft.isValidTraceId(e)?this.traceId=e:this.traceId=F.generateW3CId(),t&&ft.isValidSpanId(t)?this.spanId=t:this.spanId=F.generateW3CId().substr(0,16)}var gt=(mt.prototype.isMonitoredInstance=function(e,t,n,r){var a=!1,i=!0,o=!1;return void 0!==n?(o=this._fetchInitialized,a="object"==typeof n&&!0===n[Q]||!!r&&!0===r[Q]):void 0!==e&&(o=this.initialized,a=!0===e[Q],i=!0===t||!c.isNullOrUndefined(e.ajaxData)),o&&i&&!a},mt.prototype.supportsAjaxMonitoring=function(){var e=!0;return(c.isNullOrUndefined(XMLHttpRequest)||c.isNullOrUndefined(XMLHttpRequest.prototype)||c.isNullOrUndefined(XMLHttpRequest.prototype.open)||c.isNullOrUndefined(XMLHttpRequest.prototype.send)||c.isNullOrUndefined(XMLHttpRequest.prototype.abort))&&(e=!1),e},mt.prototype.instrumentOpen=function(){var r=XMLHttpRequest.prototype.open,a=this;XMLHttpRequest.prototype.open=function(e,t,n){try{!a.isMonitoredInstance(this,!0)||this.ajaxData&&this.ajaxData.xhrMonitoringState.openDone||a.openHandler(this,e,t,n)}catch(e){a._core.logger.throwInternal(o.CRITICAL,I,"Failed to monitor XMLHttpRequest.open, monitoring data for this ajax call may be incorrect.",{ajaxDiagnosticsMessage:mt.getFailedAjaxDiagnosticsMessage(this),exception:F.dump(e)})}return r.apply(this,arguments)}},mt.prototype.openHandler=function(e,t,n,r){var a=this._context&&this._context.telemetryTrace&&this._context.telemetryTrace.traceID||F.generateW3CId(),i=F.generateW3CId().substr(0,16),o=new ut(a,i,this._core.logger);o.method=t,o.requestUrl=n,o.xhrMonitoringState.openDone=!0,o.requestHeaders={},e.ajaxData=o,this.attachToOnReadyStateChange(e)},mt.getFailedAjaxDiagnosticsMessage=function(e){var t="";try{c.isNullOrUndefined(e)||c.isNullOrUndefined(e.ajaxData)||c.isNullOrUndefined(e.ajaxData.requestUrl)||(t+="(url: '"+e.ajaxData.requestUrl+"')")}catch(e){}return t},mt.prototype.instrumentSend=function(){var t=XMLHttpRequest.prototype.send,n=this;XMLHttpRequest.prototype.send=function(e){try{n.isMonitoredInstance(this)&&!this.ajaxData.xhrMonitoringState.sendDone&&n.sendHandler(this,e)}catch(e){n._core.logger.throwInternal(o.CRITICAL,S,"Failed to monitor XMLHttpRequest, monitoring data for this ajax call may be incorrect.",{ajaxDiagnosticsMessage:mt.getFailedAjaxDiagnosticsMessage(this),exception:F.dump(e)})}return t.apply(this,arguments)}},mt.prototype.sendHandler=function(e,t){e.ajaxData.requestSentTime=B.Now(),(e=this.includeCorrelationHeaders(e.ajaxData,void 0,void 0,e)).ajaxData.xhrMonitoringState.sendDone=!0},mt.prototype.instrumentAbort=function(){var e=XMLHttpRequest.prototype.abort,t=this;XMLHttpRequest.prototype.abort=function(){try{t.isMonitoredInstance(this)&&!this.ajaxData.xhrMonitoringState.abortDone&&(this.ajaxData.aborted=1,this.ajaxData.xhrMonitoringState.abortDone=!0)}catch(e){t._core.logger.throwInternal(o.CRITICAL,x,"Failed to monitor XMLHttpRequest.abort, monitoring data for this ajax call may be incorrect.",{ajaxDiagnosticsMessage:mt.getFailedAjaxDiagnosticsMessage(this),exception:F.dump(e)})}return e.apply(this,arguments)}},mt.prototype.instrumentSetRequestHeader=function(){if(this._config.enableRequestHeaderTracking){var n=XMLHttpRequest.prototype.setRequestHeader,r=this;XMLHttpRequest.prototype.setRequestHeader=function(e,t){try{r.isMonitoredInstance(this)&&(this.ajaxData.requestHeaders[e]=t)}catch(e){r._core.logger.throwInternal(o.CRITICAL,q,"Failed to monitor XMLHttpRequest.setRequestHeader, monitoring data for this ajax call may be incorrect.",{ajaxDiagnosticsMessage:mt.getFailedAjaxDiagnosticsMessage(this),exception:F.dump(e)})}return n.apply(this,arguments)}}},mt.prototype.attachToOnReadyStateChange=function(n){var r=this;n.ajaxData.xhrMonitoringState.onreadystatechangeCallbackAttached=dt.AttachEvent(n,"readystatechange",function(){try{r.isMonitoredInstance(n)&&4===n.readyState&&r.onAjaxComplete(n)}catch(e){var t=F.dump(e);t&&-1!=t.toLowerCase().indexOf("c00c023f")||r._core.logger.throwInternal(o.CRITICAL,D,"Failed to monitor XMLHttpRequest 'readystatechange' event handler, monitoring data for this ajax call may be incorrect.",{ajaxDiagnosticsMessage:mt.getFailedAjaxDiagnosticsMessage(n),exception:F.dump(e)})}})},mt.prototype.onAjaxComplete=function(e){if(e.ajaxData.responseFinishedTime=B.Now(),e.ajaxData.status=e.status,e.ajaxData.CalculateMetrics(),e.ajaxData.ajaxTotalDuration<0)this._core.logger.throwInternal(o.WARNING,y,"Failed to calculate the duration of the ajax call, monitoring data for this ajax call won't be sent.",{ajaxDiagnosticsMessage:mt.getFailedAjaxDiagnosticsMessage(e),requestSentTime:e.ajaxData.requestSentTime,responseFinishedTime:e.ajaxData.responseFinishedTime});else{var t={id:"|"+e.ajaxData.traceID+"."+e.ajaxData.spanID,target:e.ajaxData.getAbsoluteUrl(),name:e.ajaxData.getPathName(),type:"Ajax",duration:e.ajaxData.ajaxTotalDuration,success:200<=+e.ajaxData.status&&+e.ajaxData.status<400,responseCode:+e.ajaxData.status,method:e.ajaxData.method},n=this.getAjaxCorrelationContext(e);if(n&&(t.correlationContext=n),this._config.enableRequestHeaderTracking&&0<Object.keys(e.ajaxData.requestHeaders).length&&(t.properties=t.properties||{},t.properties.requestHeaders={},t.properties.requestHeaders=e.ajaxData.requestHeaders),this._config.enableResponseHeaderTracking){var r=e.getAllResponseHeaders();if(r){var a=r.trim().split(/[\r\n]+/),i={};a.forEach(function(e){var t=e.split(": "),n=t.shift(),r=t.join(": ");i[n]=r}),0<Object.keys(i).length&&(t.properties=t.properties||{},t.properties.responseHeaders={},t.properties.responseHeaders=i)}}this.trackDependencyDataInternal(t),e.ajaxData=null}},mt.prototype.getAjaxCorrelationContext=function(t){try{var e=t.getAllResponseHeaders();if(null!==e&&-1!==e.toLowerCase().indexOf(E.requestContextHeaderLowerCase)){var n=t.getResponseHeader(E.requestContextHeader);return G.getCorrelationContext(n)}}catch(e){this._core.logger.throwInternal(o.WARNING,C,"Failed to get Request-Context correlation header as it may be not included in the response or not accessible.",{ajaxDiagnosticsMessage:mt.getFailedAjaxDiagnosticsMessage(t),exception:F.dump(e)})}},mt.prototype.trackDependencyDataInternal=function(e,t,n){if(-1===this._config.maxAjaxCallsPerView||this._trackAjaxAttempts<this._config.maxAjaxCallsPerView){var r=ot.create(e,Pe.dataType,Pe.envelopeType,this._core.logger,t,n);this._core.track(r)}else this._trackAjaxAttempts===this._config.maxAjaxCallsPerView&&this._core.logger.throwInternal(o.CRITICAL,N,"Maximum ajax per page view limit reached, ajax monitoring is paused until the next trackPageView(). In order to increase the limit set the maxAjaxCallsPerView configuration parameter.",!0);++this._trackAjaxAttempts},mt.prototype.trackDependencyData=function(e,t){this.trackDependencyDataInternal(e,t)},mt.prototype.processTelemetry=function(e){this._nextPlugin&&this._nextPlugin.processTelemetry&&this._nextPlugin.processTelemetry(e)},mt.prototype.setNextPlugin=function(e){e&&(this._nextPlugin=e)},mt.prototype.instrumentFetch=function(){if(this.supportsFetch()&&!this._fetchInitialized){var r=window.fetch,a=this;window.fetch=function(t,e){var n;if(a.isFetchInstrumented(t)&&a.isMonitoredInstance(void 0,void 0,t,e))try{n=a.createFetchRecord(t,e),e=a.includeCorrelationHeaders(n,t,e)}catch(e){a._core.logger.throwInternal(o.CRITICAL,I,"Failed to monitor Window.fetch, monitoring data for this fetch call may be incorrect.",{ajaxDiagnosticsMessage:this.getFailedFetchDiagnosticsMessage(t),exception:F.dump(e)})}return r(t,e).then(function(e){return a.onFetchComplete(e,n),e}).catch(function(e){throw a.onFetchFailed(t,n,e),e})},this._fetchInitialized=!0}},mt.prototype.isFetchInstrumented=function(e){return this._fetchInitialized&&!0!==e[Q]},mt.prototype.supportsFetch=function(){var e=!0;return(!window||c.isNullOrUndefined(window.Request)||c.isNullOrUndefined(window.Request.prototype)||c.isNullOrUndefined(window.fetch))&&(e=!1),e},mt.prototype.createFetchRecord=function(e,t){var n=this._context&&this._context.telemetryTrace&&this._context.telemetryTrace.traceID||F.generateW3CId(),r=F.generateW3CId().substr(0,16),a=new ut(n,r,this._core.logger);return a.requestSentTime=B.Now(),e instanceof Request?a.requestUrl=e?e.url:"":a.requestUrl=e,t&&t.method?a.method=t.method:e&&e instanceof Request?a.method=e.method:a.method="GET",t&&t.headers&&this._config.enableRequestHeaderTracking?a.requestHeaders=t.headers:a.requestHeaders={},a},mt.prototype.includeCorrelationHeaders=function(e,t,n,r){if(t){if(G.canIncludeCorrelationHeader(this._config,e.getAbsoluteUrl(),this.currentWindowHost)){if((n=n||{}).headers=new Headers(n.headers||t instanceof Request&&t.headers||{}),this._isUsingAIHeaders){var a="|"+e.traceID+"."+e.spanID;n.headers.set(E.requestIdHeader,a),this._config.enableRequestHeaderTracking&&(e.requestHeaders[E.requestIdHeader]=a)}var i=this._config.appId||this._context.appId();if(i&&(n.headers.set(E.requestContextHeader,E.requestContextAppIdFormat+i),this._config.enableRequestHeaderTracking&&(e.requestHeaders[E.requestContextHeader]=E.requestContextAppIdFormat+i)),this._isUsingW3CHeaders){var o=new ht(e.traceID,e.spanID);n.headers.set(E.traceParentHeader,o.toString()),this._config.enableRequestHeaderTracking&&(e.requestHeaders[E.traceParentHeader]=o.toString())}return n}return n}if(r){if(this.currentWindowHost&&G.canIncludeCorrelationHeader(this._config,r.ajaxData.getAbsoluteUrl(),this.currentWindowHost)){this._isUsingAIHeaders&&(a="|"+r.ajaxData.traceID+"."+r.ajaxData.spanID,r.setRequestHeader(E.requestIdHeader,a),this._config.enableRequestHeaderTracking&&(r.ajaxData.requestHeaders[E.requestIdHeader]=a));var s=this._config.appId||this._context.appId();s&&(r.setRequestHeader(E.requestContextHeader,E.requestContextAppIdFormat+s),this._config.enableRequestHeaderTracking&&(r.ajaxData.requestHeaders[E.requestContextHeader]=E.requestContextAppIdFormat+s)),this._isUsingW3CHeaders&&(o=new ht(r.ajaxData.traceID,r.ajaxData.spanID),r.setRequestHeader(E.traceParentHeader,o.toString()),this._config.enableRequestHeaderTracking&&(r.ajaxData.requestHeaders[E.traceParentHeader]=o.toString()))}return r}},mt.prototype.getFailedFetchDiagnosticsMessage=function(e){var t="";try{c.isNullOrUndefined(e)||(t+="string"==typeof e?"(url: '"+e+"')":"(url: '"+e.url+"')")}catch(e){this._core.logger.throwInternal(o.CRITICAL,I,"Failed to grab failed fetch diagnostics message",{exception:F.dump(e)})}return t},mt.prototype.onFetchComplete=function(t,e){if(e)try{if(e.responseFinishedTime=B.Now(),e.CalculateMetrics(),e.ajaxTotalDuration<0)this._core.logger.throwInternal(o.WARNING,y,"Failed to calculate the duration of the fetch call, monitoring data for this fetch call won't be sent.",{fetchDiagnosticsMessage:this.getFailedFetchDiagnosticsMessage(t),requestSentTime:e.requestSentTime,responseFinishedTime:e.responseFinishedTime});else{var n={id:"|"+e.traceID+"."+e.spanID,target:e.getAbsoluteUrl(),name:e.getPathName(),type:"Fetch",duration:e.ajaxTotalDuration,success:200<=t.status&&t.status<400,responseCode:t.status,properties:{HttpMethod:e.method}},r=this.getFetchCorrelationContext(t);if(r&&(n.correlationContext=r),this._config.enableRequestHeaderTracking&&0<Object.keys(e.requestHeaders).length&&(n.properties=n.properties||{},n.properties.requestHeaders=e.requestHeaders),this._config.enableResponseHeaderTracking){var a={};t.headers.forEach(function(e,t){a[t]=e}),0<Object.keys(a).length&&(n.properties=n.properties||{},n.properties.responseHeaders=a)}this.trackDependencyDataInternal(n)}}catch(e){this._core.logger.throwInternal(o.WARNING,C,"Failed to calculate the duration of the fetch call, monitoring data for this fetch call won't be sent.",{fetchDiagnosticsMessage:this.getFailedFetchDiagnosticsMessage(t),exception:F.dump(e)})}},mt.prototype.onFetchFailed=function(t,e,n){if(e)try{if(e.responseFinishedTime=B.Now(),e.CalculateMetrics(),e.ajaxTotalDuration<0)this._core.logger.throwInternal(o.WARNING,y,"Failed to calculate the duration of the failed fetch call, monitoring data for this fetch call won't be sent.",{fetchDiagnosticsMessage:this.getFailedFetchDiagnosticsMessage(t),requestSentTime:e.requestSentTime,responseFinishedTime:e.responseFinishedTime});else{var r={id:"|"+e.traceID+"."+e.spanID,target:e.getAbsoluteUrl(),name:e.getPathName(),type:"Fetch",duration:e.ajaxTotalDuration,success:!1,responseCode:0,properties:{HttpMethod:e.method}};this.trackDependencyDataInternal(r,{error:n.message})}}catch(e){this._core.logger.throwInternal(o.WARNING,C,"Failed to calculate the duration of the failed fetch call, monitoring data for this fetch call won't be sent.",{fetchDiagnosticsMessage:this.getFailedFetchDiagnosticsMessage(t),exception:F.dump(e)})}},mt.prototype.getFetchCorrelationContext=function(t){try{var e=t.headers.get(E.requestContextHeader);return G.getCorrelationContext(e)}catch(e){this._core.logger.throwInternal(o.WARNING,C,"Failed to get Request-Context correlation header as it may be not included in the response or not accessible.",{fetchDiagnosticsMessage:this.getFailedFetchDiagnosticsMessage(t),exception:F.dump(e)})}},mt.prototype.instrumentXhr=function(){this.supportsAjaxMonitoring()&&!this.initialized&&(this.instrumentOpen(),this.instrumentSend(),this.instrumentAbort(),this.instrumentSetRequestHeader(),this.initialized=!0)},mt.getDefaultConfig=function(){return{maxAjaxCallsPerView:500,disableAjaxTracking:!1,disableFetchTracking:!0,disableCorrelationHeaders:!1,distributedTracingMode:s.AI,correlationHeaderExcludedDomains:["*.blob.core.windows.net","*.blob.core.chinacloudapi.cn","*.blob.core.cloudapi.de","*.blob.core.usgovcloudapi.net"],correlationHeaderDomains:void 0,appId:void 0,enableCorsCorrelation:!1,enableRequestHeaderTracking:!1,enableResponseHeaderTracking:!1}},mt.getEmptyConfig=function(){return{maxAjaxCallsPerView:void 0,disableAjaxTracking:void 0,disableFetchTracking:void 0,disableCorrelationHeaders:void 0,distributedTracingMode:void 0,correlationHeaderExcludedDomains:void 0,appId:void 0,enableCorsCorrelation:void 0,correlationHeaderDomains:void 0,enableRequestHeaderTracking:void 0,enableResponseHeaderTracking:void 0}},mt.prototype.initialize=function(e,t,n){if(!this.initialized&&!this._fetchInitialized){this._core=t;var r=mt.getDefaultConfig();for(var a in this._config=mt.getEmptyConfig(),r)this._config[a]=at.getConfig(e,a,mt.identifier,r[a]);if(this._isUsingAIHeaders=this._config.distributedTracingMode===s.AI||this._config.distributedTracingMode===s.AI_AND_W3C,this._isUsingW3CHeaders=this._config.distributedTracingMode===s.AI_AND_W3C||this._config.distributedTracingMode===s.W3C,!1===this._config.disableAjaxTracking&&this.instrumentXhr(),!1===this._config.disableFetchTracking&&this.instrumentFetch(),0<n.length&&n){for(var i=void 0,o=0;!i&&o<n.length;)n[o]&&"AppInsightsPropertiesPlugin"===n[o].identifier&&(i=n[o]),o++;i&&(this._context=i.context)}}},mt.identifier="AjaxDependencyPlugin",mt);function mt(){this._trackAjaxAttempts=0,this.identifier=mt.identifier,this.priority=120,this.currentWindowHost=window&&window.location&&window.location.host&&window.location.host.toLowerCase(),this.initialized=!1,this._fetchInitialized=!1}e.AjaxPlugin=gt,e.ajaxRecord=ut,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=applicationinsights-dependencies-js.min.js.map |
{ | ||
"name": "@microsoft/applicationinsights-dependencies-js", | ||
"version": "2.1.1", | ||
"version": "2.2.0", | ||
"description": "Microsoft Application Insights XHR dependencies plugin", | ||
@@ -31,4 +31,4 @@ "main": "dist/applicationinsights-dependencies-js.js", | ||
"dependencies": { | ||
"@microsoft/applicationinsights-core-js": "2.1.1", | ||
"@microsoft/applicationinsights-common": "2.1.1", | ||
"@microsoft/applicationinsights-core-js": "2.2.0", | ||
"@microsoft/applicationinsights-common": "2.2.0", | ||
"tslib": "^1.9.3" | ||
@@ -35,0 +35,0 @@ }, |
172
src/ajax.ts
@@ -7,3 +7,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
RemoteDependencyData, DateTimeUtils, DisabledPropertyName, Data, IDependencyTelemetry, | ||
IConfig, ConfigurationManager, ITelemetryContext, PropertiesPluginIdentifier, IPropertiesPlugin | ||
IConfig, ConfigurationManager, ITelemetryContext, PropertiesPluginIdentifier, IPropertiesPlugin, DistributedTracingModes | ||
} from '@microsoft/applicationinsights-common'; | ||
@@ -16,3 +16,5 @@ import { | ||
import { EventHelper } from './ajaxUtils'; | ||
import { Traceparent } from './TraceParent'; | ||
export interface XMLHttpRequestInstrumented extends XMLHttpRequest { | ||
@@ -39,2 +41,4 @@ ajaxData: ajaxRecord; | ||
private _context: ITelemetryContext; | ||
private _isUsingW3CHeaders: boolean; | ||
private _isUsingAIHeaders: boolean; | ||
@@ -127,15 +131,10 @@ constructor() { | ||
private openHandler(xhr: XMLHttpRequestInstrumented, method, url, async) { | ||
let id: string; | ||
if (this._context && this._context.telemetryTrace && this._context.telemetryTrace.traceID) { | ||
var traceID = (this._context && this._context.telemetryTrace && this._context.telemetryTrace.traceID) || Util.generateW3CId(); | ||
var spanID = Util.generateW3CId().substr(0, 16); | ||
// this format corresponds with activity logic on server-side and is required for the correct correlation | ||
id = "|" + this._context.telemetryTrace.traceID + "." + Util.newId(); | ||
} else { | ||
id = Util.newId(); | ||
} | ||
var ajaxData = new ajaxRecord(id, this._core.logger); | ||
var ajaxData = new ajaxRecord(traceID, spanID, this._core.logger); | ||
ajaxData.method = method; | ||
ajaxData.requestUrl = url; | ||
ajaxData.xhrMonitoringState.openDone = true | ||
ajaxData.xhrMonitoringState.openDone = true; | ||
ajaxData.requestHeaders = {}; | ||
xhr.ajaxData = ajaxData; | ||
@@ -212,2 +211,28 @@ | ||
private instrumentSetRequestHeader() { | ||
if (!this._config.enableRequestHeaderTracking) { | ||
return; | ||
} | ||
var originalSetRequestHeader = XMLHttpRequest.prototype.setRequestHeader; | ||
var ajaxMonitorInstance = this; | ||
XMLHttpRequest.prototype.setRequestHeader = function (header, value) { | ||
try { | ||
if (ajaxMonitorInstance.isMonitoredInstance(this)) { | ||
this.ajaxData.requestHeaders[header] = value; | ||
} | ||
} catch (e) { | ||
ajaxMonitorInstance._core.logger.throwInternal( | ||
LoggingSeverity.CRITICAL, | ||
_InternalMessageId.FailedMonitorAjaxSetRequestHeader, | ||
"Failed to monitor XMLHttpRequest.setRequestHeader, monitoring data for this ajax call may be incorrect.", | ||
{ | ||
ajaxDiagnosticsMessage: AjaxMonitor.getFailedAjaxDiagnosticsMessage(this), | ||
exception: Util.dump(e) | ||
}); | ||
} | ||
return originalSetRequestHeader.apply(this, arguments); | ||
} | ||
} | ||
private attachToOnReadyStateChange(xhr: XMLHttpRequestInstrumented) { | ||
@@ -255,6 +280,5 @@ var ajaxMonitorInstance = this; | ||
}); | ||
} | ||
else { | ||
var dependency = <IDependencyTelemetry>{ | ||
id: xhr.ajaxData.id, | ||
} else { | ||
const dependency = <IDependencyTelemetry>{ | ||
id: "|" + xhr.ajaxData.traceID + "." + xhr.ajaxData.spanID, | ||
target: xhr.ajaxData.getAbsoluteUrl(), | ||
@@ -275,2 +299,31 @@ name: xhr.ajaxData.getPathName(), | ||
if (this._config.enableRequestHeaderTracking) { | ||
if (Object.keys(xhr.ajaxData.requestHeaders).length > 0) { | ||
dependency.properties = dependency.properties || {}; | ||
dependency.properties.requestHeaders = {}; | ||
dependency.properties.requestHeaders = xhr.ajaxData.requestHeaders; | ||
} | ||
} | ||
if (this._config.enableResponseHeaderTracking) { | ||
var headers = xhr.getAllResponseHeaders(); | ||
if (headers) { | ||
// xhr.getAllResponseHeaders() method returns all the response headers, separated by CRLF, as a string or null | ||
// the regex converts the header string into an array of individual headers | ||
var arr = headers.trim().split(/[\r\n]+/); | ||
const responseHeaderMap = {}; | ||
arr.forEach(function (line) { | ||
var parts = line.split(': '); | ||
var header = parts.shift(); | ||
var value = parts.join(': '); | ||
responseHeaderMap[header] = value; | ||
}); | ||
if (Object.keys(responseHeaderMap).length > 0) { | ||
dependency.properties = dependency.properties || {}; | ||
dependency.properties.responseHeaders = {}; | ||
dependency.properties.responseHeaders = responseHeaderMap; | ||
} | ||
} | ||
} | ||
this.trackDependencyDataInternal(dependency); | ||
@@ -402,11 +455,6 @@ | ||
private createFetchRecord(input?: Request | string, init?: RequestInit): ajaxRecord { | ||
let id: string; | ||
if (this._context && this._context.telemetryTrace && this._context.telemetryTrace.traceID) { | ||
var traceID = (this._context && this._context.telemetryTrace && this._context.telemetryTrace.traceID) || Util.generateW3CId(); | ||
var spanID = Util.generateW3CId().substr(0, 16); | ||
// this format corresponds with activity logic on server-side and is required for the correct correlation | ||
id = "|" + this._context.telemetryTrace.traceID + "." + Util.newId(); | ||
} else { | ||
id = Util.newId(); | ||
} | ||
let ajaxData: ajaxRecord = new ajaxRecord(id, this._core.logger); | ||
var ajaxData = new ajaxRecord(traceID, spanID, this._core.logger); | ||
ajaxData.requestSentTime = DateTimeUtils.Now(); | ||
@@ -427,2 +475,8 @@ | ||
} | ||
if (init && init.headers && this._config.enableRequestHeaderTracking) { | ||
ajaxData.requestHeaders = init.headers; | ||
} else { | ||
ajaxData.requestHeaders = {}; | ||
} | ||
return ajaxData; | ||
@@ -441,8 +495,23 @@ } | ||
init.headers = new Headers(init.headers || (input instanceof Request ? (input.headers || {}) : {})); | ||
init.headers.set(RequestHeaders.requestIdHeader, ajaxData.id); | ||
if (this._isUsingAIHeaders) { | ||
var id = "|" + ajaxData.traceID + "." + ajaxData.spanID; | ||
init.headers.set(RequestHeaders.requestIdHeader, id); | ||
if (this._config.enableRequestHeaderTracking) { | ||
ajaxData.requestHeaders[RequestHeaders.requestIdHeader] = id; | ||
} | ||
} | ||
let appId: string = this._config.appId || this._context.appId(); | ||
if (appId) { | ||
init.headers.set(RequestHeaders.requestContextHeader, RequestHeaders.requestContextAppIdFormat + appId); | ||
if (this._config.enableRequestHeaderTracking) { | ||
ajaxData.requestHeaders[RequestHeaders.requestContextHeader] = RequestHeaders.requestContextAppIdFormat + appId; | ||
} | ||
} | ||
if (this._isUsingW3CHeaders) { | ||
var traceparent = new Traceparent(ajaxData.traceID, ajaxData.spanID); | ||
init.headers.set(RequestHeaders.traceParentHeader, traceparent.toString()); | ||
if (this._config.enableRequestHeaderTracking) { | ||
ajaxData.requestHeaders[RequestHeaders.traceParentHeader] = traceparent.toString(); | ||
} | ||
} | ||
return init; | ||
@@ -454,7 +523,23 @@ } | ||
this.currentWindowHost)) { | ||
xhr.setRequestHeader(RequestHeaders.requestIdHeader, xhr.ajaxData.id); | ||
if (this._isUsingAIHeaders) { | ||
var id = "|" + xhr.ajaxData.traceID + "." + xhr.ajaxData.spanID; | ||
xhr.setRequestHeader(RequestHeaders.requestIdHeader, id); | ||
if (this._config.enableRequestHeaderTracking) { | ||
xhr.ajaxData.requestHeaders[RequestHeaders.requestIdHeader] = id; | ||
} | ||
} | ||
var appId = this._config.appId || this._context.appId(); | ||
if (appId) { | ||
xhr.setRequestHeader(RequestHeaders.requestContextHeader, RequestHeaders.requestContextAppIdFormat + appId); | ||
if (this._config.enableRequestHeaderTracking) { | ||
xhr.ajaxData.requestHeaders[RequestHeaders.requestContextHeader] = RequestHeaders.requestContextAppIdFormat + appId; | ||
} | ||
} | ||
if (this._isUsingW3CHeaders) { | ||
var traceparent = new Traceparent(xhr.ajaxData.traceID, xhr.ajaxData.spanID); | ||
xhr.setRequestHeader(RequestHeaders.traceParentHeader, traceparent.toString()); | ||
if (this._config.enableRequestHeaderTracking) { | ||
xhr.ajaxData.requestHeaders[RequestHeaders.traceParentHeader] = traceparent.toString(); | ||
} | ||
} | ||
} | ||
@@ -507,4 +592,4 @@ | ||
} else { | ||
let dependency: IDependencyTelemetry = { | ||
id: ajaxData.id, | ||
const dependency: IDependencyTelemetry = { | ||
id: "|" + ajaxData.traceID + "." + ajaxData.spanID, | ||
target: ajaxData.getAbsoluteUrl(), | ||
@@ -525,2 +610,19 @@ name: ajaxData.getPathName(), | ||
if (this._config.enableRequestHeaderTracking) { | ||
if (Object.keys(ajaxData.requestHeaders).length > 0) { | ||
dependency.properties = dependency.properties || {}; | ||
dependency.properties.requestHeaders = ajaxData.requestHeaders; | ||
} | ||
} | ||
if (this._config.enableResponseHeaderTracking) { | ||
const responseHeaderMap = {}; | ||
response.headers.forEach((value, name) => { | ||
responseHeaderMap[name] = value; | ||
}); | ||
if (Object.keys(responseHeaderMap).length > 0) { | ||
dependency.properties = dependency.properties || {}; | ||
dependency.properties.responseHeaders = responseHeaderMap; | ||
} | ||
} | ||
this.trackDependencyDataInternal(dependency); | ||
@@ -561,3 +663,3 @@ } | ||
let dependency: IDependencyTelemetry = { | ||
id: ajaxData.id, | ||
id: "|" + ajaxData.traceID + "." + ajaxData.spanID, | ||
target: ajaxData.getAbsoluteUrl(), | ||
@@ -607,2 +709,3 @@ name: ajaxData.getPathName(), | ||
this.instrumentAbort(); | ||
this.instrumentSetRequestHeader(); | ||
this.initialized = true; | ||
@@ -618,2 +721,3 @@ } | ||
disableCorrelationHeaders: false, | ||
distributedTracingMode: DistributedTracingModes.AI, | ||
correlationHeaderExcludedDomains: [ | ||
@@ -626,3 +730,5 @@ "*.blob.core.windows.net", | ||
appId: undefined, | ||
enableCorsCorrelation: false | ||
enableCorsCorrelation: false, | ||
enableRequestHeaderTracking: false, | ||
enableResponseHeaderTracking: false | ||
} | ||
@@ -638,2 +744,3 @@ return config; | ||
disableCorrelationHeaders: undefined, | ||
distributedTracingMode: undefined, | ||
correlationHeaderExcludedDomains: undefined, | ||
@@ -643,2 +750,4 @@ appId: undefined, | ||
correlationHeaderDomains: undefined, | ||
enableRequestHeaderTracking: undefined, | ||
enableResponseHeaderTracking: undefined | ||
} | ||
@@ -656,2 +765,5 @@ } | ||
this._isUsingAIHeaders = this._config.distributedTracingMode === DistributedTracingModes.AI || this._config.distributedTracingMode === DistributedTracingModes.AI_AND_W3C; | ||
this._isUsingW3CHeaders = this._config.distributedTracingMode === DistributedTracingModes.AI_AND_W3C || this._config.distributedTracingMode === DistributedTracingModes.W3C; | ||
if (this._config.disableAjaxTracking === false) { | ||
@@ -658,0 +770,0 @@ this.instrumentXhr(); |
@@ -20,2 +20,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
public requestHeadersSize = null; | ||
public requestHeaders = null; | ||
public ttfb = null; | ||
@@ -60,10 +61,11 @@ public responseReceivingDuration = null; | ||
public id: string; | ||
public traceID: string; | ||
public spanID: string; | ||
constructor(id: string, logger: IDiagnosticLogger) { | ||
this.id = id; | ||
constructor(traceID: string, spanID: string, logger: IDiagnosticLogger) { | ||
this.traceID = traceID; | ||
this.spanID = spanID; | ||
this._logger = logger; | ||
} | ||
public getAbsoluteUrl() { | ||
@@ -70,0 +72,0 @@ return this.requestUrl ? UrlHelper.getAbsoluteUrl(this.requestUrl) : null; |
@@ -22,2 +22,4 @@ import { ICorrelationConfig, IDependencyTelemetry, IConfig } from '@microsoft/applicationinsights-common'; | ||
private _context; | ||
private _isUsingW3CHeaders; | ||
private _isUsingAIHeaders; | ||
constructor(); | ||
@@ -32,2 +34,3 @@ private isMonitoredInstance(xhr?, excludeAjaxDataValidation?, request?, init?); | ||
private instrumentAbort(); | ||
private instrumentSetRequestHeader(); | ||
private attachToOnReadyStateChange(xhr); | ||
@@ -34,0 +37,0 @@ private onAjaxComplete(xhr); |
@@ -12,2 +12,3 @@ import { IDiagnosticLogger } from '@microsoft/applicationinsights-core-js'; | ||
requestHeadersSize: any; | ||
requestHeaders: any; | ||
ttfb: any; | ||
@@ -32,4 +33,5 @@ responseReceivingDuration: any; | ||
clientFailure: number; | ||
id: string; | ||
constructor(id: string, logger: IDiagnosticLogger); | ||
traceID: string; | ||
spanID: string; | ||
constructor(traceID: string, spanID: string, logger: IDiagnosticLogger); | ||
getAbsoluteUrl(): string; | ||
@@ -36,0 +38,0 @@ getPathName(): any; |
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 too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1378585
32
7417
+ Added@microsoft/applicationinsights-common@2.2.0(transitive)
+ Added@microsoft/applicationinsights-core-js@2.2.0(transitive)
- Removed@microsoft/applicationinsights-common@2.1.1(transitive)
- Removed@microsoft/applicationinsights-core-js@2.1.1(transitive)