@microsoft/applicationinsights-analytics-js
Advanced tools
Comparing version 2.0.1 to 2.1.0
/*! | ||
* Application Insights JavaScript SDK - Web Analytics, 2.0.1 | ||
* Application Insights JavaScript SDK - Web Analytics, 2.1.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 i,t,f,n;(t=i||(i={}))[t.LocalStorage=0]="LocalStorage",t[t.SessionStorage=1]="SessionStorage",(n=f||(f={}))[n.Default=0]="Default",n[n.Required=1]="Required",n[n.Array=2]="Array",n[n.Hidden=4]="Hidden";var u=(r.isNullOrUndefined=function(e){return null==e},r.disableCookies=function(){r._canUseCookies=!1},r.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(o,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},r);function r(){}var p,a,o=/[xy]/g;(a=p||(p={}))[a.CRITICAL=1]="CRITICAL",a[a.WARNING=2]="WARNING";var s=1,c=2,l=3,g=4,d=5,m=6,h=8,v=10,y=11,w=25,S=29,_=30,I=31,T=32,N=35,E=36,k=37,D=38,x=39,b=45,P=49,A=52,C=56,M=57,R=61,U=62,L=63,V=64,O=66,z=68,G=69;q.prototype.processTelemetry=function(t){this.channelQueue.forEach(function(e){0<e.length&&e[0].processTelemetry(t)})},Object.defineProperty(q.prototype,"ChannelControls",{get:function(){return this.channelQueue},enumerable:!0,configurable:!0}),q.prototype.initialize=function(n,r,i){var a=this;if(n.isCookieUseDisabled&&u.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<j&&(o=e.identifier),e.initialize(n,r,i)}),o)throw Error(B+o);for(var t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);a.channelQueue.push(e)}})}for(var e=new Array,t=0;t<i.length;t++){var s=i[t];s.priority>j&&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,i)}),t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);this.channelQueue.push(e)}};function q(){this.identifier="ChannelControllerPlugin",this.priority=j}var j=500,B="Channel has invalid priority",H=(K.sanitizeKeyAndAddUniqueness=function(e,t,n){var r=t.length,i=K.sanitizeKey(e,t);if(i.length!==r){for(var a=0,o=i;void 0!==n[o];)a++,o=i.substring(0,K.MAX_NAME_LENGTH-3)+K.padNumber(a);i=o}return i},K.sanitizeKey=function(e,t){var n;return t&&(t=K.trim(t.toString())).length>K.MAX_NAME_LENGTH&&(n=t.substring(0,K.MAX_NAME_LENGTH),e.throwInternal(p.WARNING,M,"name is too long. It has been truncated to "+K.MAX_NAME_LENGTH+" characters.",{name:t},!0)),n||t},K.sanitizeString=function(e,t,n){var r;return void 0===n&&(n=K.MAX_STRING_LENGTH),t&&(n=n||K.MAX_STRING_LENGTH,(t=K.trim(t)).toString().length>n&&(r=t.toString().substring(0,n),e.throwInternal(p.WARNING,R,"string value is too long. It has been truncated to "+n+" characters.",{value:t},!0))),r||t},K.sanitizeUrl=function(e,t){return K.sanitizeInput(e,t,K.MAX_URL_LENGTH,O)},K.sanitizeMessage=function(e,t){var n;return t&&t.length>K.MAX_MESSAGE_LENGTH&&(n=t.substring(0,K.MAX_MESSAGE_LENGTH),e.throwInternal(p.WARNING,C,"message is too long, it has been truncated to "+K.MAX_MESSAGE_LENGTH+" characters.",{message:t},!0)),n||t},K.sanitizeException=function(e,t){var n;return t&&t.length>K.MAX_EXCEPTION_LENGTH&&(n=t.substring(0,K.MAX_EXCEPTION_LENGTH),e.throwInternal(p.WARNING,A,"exception is too long, it has been truncated to "+K.MAX_EXCEPTION_LENGTH+" characters.",{exception:t},!0)),n||t},K.sanitizeProperties=function(t,e){if(e){var n={};for(var r in e){var i=e[r];if("object"==typeof i&&"undefined"!=typeof JSON)try{i=JSON.stringify(i)}catch(e){t.throwInternal(p.WARNING,P,"custom property is not valid",{exception:e},!0)}i=K.sanitizeString(t,i,K.MAX_PROPERTY_LENGTH),n[r=K.sanitizeKeyAndAddUniqueness(t,r,n)]=i}e=n}return e},K.sanitizeMeasurements=function(e,t){if(t){var n={};for(var r in t){var i=t[r];n[r=K.sanitizeKeyAndAddUniqueness(e,r,n)]=i}t=n}return t},K.sanitizeId=function(e,t){return t?K.sanitizeInput(e,t,K.MAX_ID_LENGTH,G).toString():t},K.sanitizeInput=function(e,t,n,r){var i;return t&&(t=K.trim(t)).length>n&&(i=t.substring(0,n),e.throwInternal(p.WARNING,r,"input is too long, it has been truncated to "+n+" characters.",{data:t},!0)),i||t},K.padNumber=function(e){var t="00"+e;return t.substr(t.length-3)},K.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},K.MAX_NAME_LENGTH=150,K.MAX_ID_LENGTH=128,K.MAX_PROPERTY_LENGTH=8192,K.MAX_STRING_LENGTH=1024,K.MAX_URL_LENGTH=2048,K.MAX_MESSAGE_LENGTH=32768,K.MAX_EXCEPTION_LENGTH=32768,K);function K(){}var X=(W.disableStorage=function(){W._canUseLocalStorage=!1,W._canUseSessionStorage=!1},W._getLocalStorageObject=function(){return W.canUseLocalStorage()?W._getVerifiedStorageObject(i.LocalStorage):null},W._getVerifiedStorageObject=function(e){var t,n,r=null;try{if("undefined"==typeof window)return null;n=new Date,(r=e===i.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},W.isInternalApplicationInsightsEndpoint=function(e){return-1!==W._internalEndpoints.indexOf(e.toLowerCase())},W.canUseLocalStorage=function(){return void 0===W._canUseLocalStorage&&(W._canUseLocalStorage=!!W._getVerifiedStorageObject(i.LocalStorage)),W._canUseLocalStorage},W.getStorage=function(t,e){var n=W._getLocalStorageObject();if(null!==n)try{return n.getItem(e)}catch(e){W._canUseLocalStorage=!1,t.throwInternal(p.WARNING,s,"Browser failed read of local storage. "+W.getExceptionName(e),{exception:W.dump(e)})}return null},W.setStorage=function(t,e,n){var r=W._getLocalStorageObject();if(null!==r)try{return r.setItem(e,n),!0}catch(e){W._canUseLocalStorage=!1,t.throwInternal(p.WARNING,l,"Browser failed write to local storage. "+W.getExceptionName(e),{exception:W.dump(e)})}return!1},W.removeStorage=function(t,e){var n=W._getLocalStorageObject();if(null!==n)try{return n.removeItem(e),!0}catch(e){W._canUseLocalStorage=!1,t.throwInternal(p.WARNING,d,"Browser failed removal of local storage item. "+W.getExceptionName(e),{exception:W.dump(e)})}return!1},W._getSessionStorageObject=function(){return W.canUseSessionStorage()?W._getVerifiedStorageObject(i.SessionStorage):null},W.canUseSessionStorage=function(){return void 0===W._canUseSessionStorage&&(W._canUseSessionStorage=!!W._getVerifiedStorageObject(i.SessionStorage)),W._canUseSessionStorage},W.getSessionStorageKeys=function(){var e=[];if(W.canUseSessionStorage())for(var t in window.sessionStorage)e.push(t);return e},W.getSessionStorage=function(t,e){var n=W._getSessionStorageObject();if(null!==n)try{return n.getItem(e)}catch(e){W._canUseSessionStorage=!1,t.throwInternal(p.WARNING,c,"Browser failed read of session storage. "+W.getExceptionName(e),{exception:W.dump(e)})}return null},W.setSessionStorage=function(t,e,n){var r=W._getSessionStorageObject();if(null!==r)try{return r.setItem(e,n),!0}catch(e){W._canUseSessionStorage=!1,t.throwInternal(p.WARNING,g,"Browser failed write to session storage. "+W.getExceptionName(e),{exception:W.dump(e)})}return!1},W.removeSessionStorage=function(t,e){var n=W._getSessionStorageObject();if(null!==n)try{return n.removeItem(e),!0}catch(e){W._canUseSessionStorage=!1,t.throwInternal(p.WARNING,m,"Browser failed removal of session storage item. "+W.getExceptionName(e),{exception:W.dump(e)})}return!1},W.disableCookies=function(){u.disableCookies()},W.canUseCookies=function(t){if(void 0===u._canUseCookies){u._canUseCookies=!1;try{u._canUseCookies=void 0!==W.document.cookie}catch(e){t.throwInternal(p.WARNING,z,"Cannot access document.cookie - "+W.getExceptionName(e),{exception:W.dump(e)})}}return u._canUseCookies},W.setCookie=function(e,t,n,r){var i="",a="";r&&(i=";domain="+r),W.document.location&&"https:"===W.document.location.protocol&&(a=";secure"),W.canUseCookies(e)&&(W.document.cookie=t+"="+n+i+";path=/"+a)},W.stringToBoolOrDefault=function(e,t){return void 0===t&&(t=!1),null==e?t:"true"===e.toString().toLowerCase()},W.getCookie=function(e,t){if(W.canUseCookies(e)){var n="";if(t&&t.length)for(var r=t+"=",i=W.document.cookie.split(";"),a=0;a<i.length;a++){var o=i[a];if((o=W.trim(o))&&0===o.indexOf(r)){n=o.substring(r.length,i[a].length);break}}return n}},W.deleteCookie=function(e,t){W.canUseCookies(e)&&(W.document.cookie=t+"=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;")},W.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},W.newId=function(){for(var e="",t=1073741824*Math.random();0<t;)e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t%64),t=Math.floor(t/64);return e},W.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},W.isError=function(e){return"[object Error]"===Object.prototype.toString.call(e)},W.isDate=function(e){return"[object Date]"===Object.prototype.toString.call(e)},W.toISOStringForIE8=function(e){if(W.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"}},W.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},W.msToTimeSpan=function(e){(isNaN(e)||e<0)&&(e=0);var t=""+(e=Math.round(e))%1e3,n=""+Math.floor(e/1e3)%60,r=""+Math.floor(e/6e4)%60,i=""+Math.floor(e/36e5)%24,a=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<a?a+".":"")+(i=i.length<2?"0"+i:i)+":"+r+":"+n+"."+t},W.isCrossOriginError=function(e,t,n,r,i){return("Script error."===e||"Script error"===e)&&!i},W.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},W.getExceptionName=function(e){return"[object Error]"===Object.prototype.toString.call(e)?e.name:""},W.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},W.IsBeaconApiSupported=function(){return"sendBeacon"in navigator&&navigator.sendBeacon},W.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},W.document="undefined"!=typeof document?document:{},W._canUseLocalStorage=void 0,W._canUseSessionStorage=void 0,W._internalEndpoints=["https://dc.services.visualstudio.com/v2/track","https://breeze.aimon.applicationinsights.io/v2/track","https://dc-int.services.visualstudio.com/v2/track"],W.NotSpecified="not_specified",W);function W(){}var F=(J.parseUrl=function(e){return J.htmlAnchorElement||(J.htmlAnchorElement=J.document.createElement?J.document.createElement("a"):{host:J.parseHost(e)}),J.htmlAnchorElement.href=e,J.htmlAnchorElement},J.getAbsoluteUrl=function(e){var t,n=J.parseUrl(e);return n&&(t=n.href),t},J.getPathName=function(e){var t,n=J.parseUrl(e);return n&&(t=n.pathname),t},J.getCompleteUrl=function(e,t){return e?e.toUpperCase()+" "+t:t},J.parseHost=function(e){var t=e.match(/:\/\/(www[0-9]?\.)?(.[^/:]+)/i);return null!=t&&2<t.length&&"string"==typeof t[2]&&0<t[2].length?t[2]:null},J.document="undefined"!=typeof document?document:{},J);function J(){}var Q=(Y.ParseDependencyPath=function(e,t,n,r){var i,a=r,o=r;if(t&&0<t.length){var s=F.parseUrl(t);if(i=s.host,!a)if(null!=s.pathname){var c=0===s.pathname.length?"/":s.pathname;"/"!==c.charAt(0)&&(c="/"+c),o=s.pathname,a=H.sanitizeString(e,n?n+" "+c:c)}else a=H.sanitizeString(e,t)}else a=i=r;return{target:i,name:a,data:o}},Y);function Y(){}var $=(Z.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()},Z.GetDuration=function(e,t){var n=null;return 0===e||0===t||u.isNullOrUndefined(e)||u.isNullOrUndefined(t)||(n=t-e),n},Z);function Z(){}var ee=function(e,t){return(ee=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 te(e,t){function n(){this.constructor=e}ee(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var ne,re=function(){return(re=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},ie=(te(ae,ne=function(){}),ae);function ae(){return ne.call(this)||this}var oe;te(se,oe=function(){this.ver=1,this.sampleRate=100,this.tags={}});function se(e,t,n){var r=oe.call(this)||this;return r.name=H.sanitizeString(e,n)||X.NotSpecified,r.data=t,r.time=X.toISOStringForIE8(new Date),r.aiDataContract={time:f.Required,iKey:f.Required,name:f.Required,sampleRate:function(){return 100==r.sampleRate?f.Hidden:f.Required},tags:f.Required,data:f.Required},r}function ce(){}var le,ue=(te(pe,le=ce),pe);function pe(){var e=le.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var ge,fe=(te(de,ge=ue),de.envelopeType="Microsoft.ApplicationInsights.{0}.Event",de.dataType="EventData",de);function de(e,t,n,r){var i=ge.call(this)||this;return i.aiDataContract={ver:f.Required,name:f.Required,properties:f.Default,measurements:f.Default},i.name=H.sanitizeString(e,t)||X.NotSpecified,i.properties=H.sanitizeProperties(e,n),i.measurements=H.sanitizeMeasurements(e,r),i}function me(){}var he,ve=(te(ye,he=ce),ye);function ye(){var e=he.call(this)||this;return e.ver=2,e.exceptions=[],e.properties={},e.measurements={},e}function we(){this.hasFullStack=!0,this.parsedStack=[]}var Se,_e=(te(Ie,Se=ve),Ie.CreateFromInterface=function(t,e){var n=e.exceptions&&e.exceptions.map(function(e){return Ne.CreateFromInterface(t,e)});return new Ie(t,re({},e,{exceptions:n}))},Ie.prototype.toInterface=function(){var e=this,t=e.exceptions,n=e.properties,r=e.measurements,i=e.severityLevel,a=e.ver,o=e.problemGroup,s=e.id,c=e.isManual;return{ver:a,exceptions:t instanceof Array&&t.map(function(e){return e.toInterface()})||void 0,severityLevel:i,properties:n,measurements:r,problemGroup:o,id:s,isManual:c}},Ie.CreateSimpleException=function(e,t,n,r,i,a){return{exceptions:[{hasFullStack:!0,message:e,stack:i,typeName:t}]}},Ie.envelopeType="Microsoft.ApplicationInsights.{0}.Exception",Ie.dataType="ExceptionData",Ie);function Ie(e,t,n,r,i,a){var o=Se.call(this)||this;return o.aiDataContract={ver:f.Required,exceptions:f.Required,severityLevel:f.Default,properties:f.Default,measurements:f.Default},t instanceof Error?(o.exceptions=[new Ne(e,t)],o.properties=H.sanitizeProperties(e,n),o.measurements=H.sanitizeMeasurements(e,r),i&&(o.severityLevel=i),a&&(o.id=a)):(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),u.isNullOrUndefined(t.ver)||(o.ver=t.ver),u.isNullOrUndefined(t.isManual)||(o.isManual=t.isManual)),o}var Te,Ne=(te(Ee,Te=we),Ee.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}},Ee.CreateFromInterface=function(e,t){var n=t.parsedStack instanceof Array&&t.parsedStack.map(function(e){return De.CreateFromInterface(e)})||t.parsedStack;return new Ee(e,re({},t,{parsedStack:n}))},Ee.parseStack=function(e){var t=void 0;if("string"==typeof e){var n=e.split("\n");t=[];for(var r=0,i=0,a=0;a<=n.length;a++){var o=n[a];if(De.regex.test(o)){var s=new De(n[a],r++);i+=s.sizeInBytes,t.push(s)}}if(32768<i)for(var c=0,l=t.length-1,u=0,p=c,g=l;c<l;){if(32768<(u+=t[c].sizeInBytes+t[l].sizeInBytes)){var f=g-p+1;t.splice(p,f);break}p=c,g=l,c++,l--}}return t},Ee);function Ee(e,t){var n=Te.call(this)||this;if(n.aiDataContract={id:f.Default,outerId:f.Default,typeName:f.Required,message:f.Required,hasFullStack:f.Default,stack:f.Default,parsedStack:f.Array},t instanceof Error){n.typeName=H.sanitizeString(e,t.name)||X.NotSpecified,n.message=H.sanitizeMessage(e,t.message)||X.NotSpecified;var r=t.stack;n.parsedStack=Ee.parseStack(r),n.stack=H.sanitizeException(e,r),n.hasFullStack=X.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 ke,De=(te(xe,ke=me),xe.CreateFromInterface=function(e){return new xe(e,null)},xe.prototype.toInterface=function(){return{level:this.level,method:this.method,assembly:this.assembly,fileName:this.fileName,line:this.line}},xe.regex=/^([\s]+at)?(.*?)(\@|\s\(|\s)([^\(\@\n]+):([0-9]+):([0-9]+)(\)?)$/,xe.baseSize=58,xe);function xe(e,t){var n=ke.call(this)||this;if(n.sizeInBytes=0,n.aiDataContract={level:f.Required,method:f.Required,assembly:f.Default,fileName:f.Default,line:f.Default},"string"==typeof e){var r=e;n.level=t,n.method="<no_method>",n.assembly=X.trim(r),n.fileName="",n.line=0;var i=r.match(xe.regex);i&&5<=i.length&&(n.method=X.trim(i[2])||n.method,n.fileName=X.trim(i[4]),n.line=parseInt(i[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+=xe.baseSize,n.sizeInBytes+=n.level.toString().length,n.sizeInBytes+=n.line.toString().length,n}var be,Pe,Ae,Ce=(te(Me,be=ce),Me);function Me(){var e=be.call(this)||this;return e.ver=2,e.metrics=[],e.properties={},e}(Ae=Pe||(Pe={}))[Ae.Measurement=0]="Measurement",Ae[Ae.Aggregation=1]="Aggregation";var Re,Ue=(te(Le,Re=function(){this.kind=Pe.Measurement}),Le);function Le(){var e=null!==Re&&Re.apply(this,arguments)||this;return e.aiDataContract={name:f.Required,kind:f.Default,value:f.Required,count:f.Default,min:f.Default,max:f.Default,stdDev:f.Default},e}var Ve,Oe=(te(ze,Ve=Ce),ze.envelopeType="Microsoft.ApplicationInsights.{0}.Metric",ze.dataType="MetricData",ze);function ze(e,t,n,r,i,a,o){var s=Ve.call(this)||this;s.aiDataContract={ver:f.Required,metrics:f.Required,properties:f.Default};var c=new Ue;return c.count=0<r?r:void 0,c.max=isNaN(a)||null===a?void 0:a,c.min=isNaN(i)||null===i?void 0:i,c.name=H.sanitizeString(e,t)||X.NotSpecified,c.value=n,s.metrics=[c],s.properties=H.sanitizeProperties(e,o),s}var Ge,qe=(te(je,Ge=ue),je);function je(){var e=Ge.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var Be,He=(te(Ke,Be=qe),Ke.envelopeType="Microsoft.ApplicationInsights.{0}.Pageview",Ke.dataType="PageviewData",Ke);function Ke(e,t,n,r,i,a,o){var s=Be.call(this)||this;return s.aiDataContract={ver:f.Required,name:f.Default,url:f.Default,duration:f.Default,properties:f.Default,measurements:f.Default,id:f.Default},s.id=H.sanitizeId(e,o),s.url=H.sanitizeUrl(e,n),s.name=H.sanitizeString(e,t)||X.NotSpecified,isNaN(r)||(s.duration=X.msToTimeSpan(r)),s.properties=H.sanitizeProperties(e,i),s.measurements=H.sanitizeMeasurements(e,a),s}var Xe,We=(te(Fe,Xe=ce),Fe);function Fe(){var e=Xe.call(this)||this;return e.ver=2,e.success=!0,e.properties={},e.measurements={},e}var Je,Qe=(te(Ye,Je=We),Ye.envelopeType="Microsoft.ApplicationInsights.{0}.RemoteDependency",Ye.dataType="RemoteDependencyData",Ye);function Ye(e,t,n,r,i,a,o,s,c,l,u){void 0===c&&(c="Ajax");var p=Je.call(this)||this;p.aiDataContract={id:f.Required,ver:f.Required,name:f.Default,resultCode:f.Default,duration:f.Default,success:f.Default,data:f.Default,target:f.Default,type:f.Default,properties:f.Default,measurements:f.Default,kind:f.Default,value:f.Default,count:f.Default,min:f.Default,max:f.Default,stdDev:f.Default,dependencyKind:f.Default,dependencySource:f.Default,commandName:f.Default,dependencyTypeName:f.Default},p.id=t,p.duration=X.msToTimeSpan(i),p.success=a,p.resultCode=o+"",p.type=H.sanitizeString(e,c);var g=Q.ParseDependencyPath(e,n,s,r);return p.data=H.sanitizeUrl(e,r)||g.data,p.target=g.target,p.name=g.name,p.properties=H.sanitizeProperties(e,l),p.measurements=H.sanitizeMeasurements(e,u),p}var $e,Ze=(te(et,$e=ce),et);function et(){var e=$e.call(this)||this;return e.ver=2,e.properties={},e}var tt,nt=(te(rt,tt=Ze),rt.envelopeType="Microsoft.ApplicationInsights.{0}.Message",rt.dataType="MessageData",rt);function rt(e,t,n,r){var i=tt.call(this)||this;return i.aiDataContract={ver:f.Required,message:f.Required,severityLevel:f.Default,properties:f.Default},t=t||X.NotSpecified,i.message=H.sanitizeMessage(e,t),i.properties=H.sanitizeProperties(e,r),n&&(i.severityLevel=n),i}var it,at=(te(ot,it=qe),ot);function ot(){var e=it.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var st,ct=(te(lt,st=at),lt.envelopeType="Microsoft.ApplicationInsights.{0}.PageviewPerformance",lt.dataType="PageviewPerformanceData",lt);function lt(e,t,n,r,i,a,o){var s=st.call(this)||this;return s.aiDataContract={ver:f.Required,name:f.Default,url:f.Default,duration:f.Default,perfTotal:f.Default,networkConnect:f.Default,sentRequest:f.Default,receivedResponse:f.Default,domProcessing:f.Default,properties:f.Default,measurements:f.Default},s.url=H.sanitizeUrl(e,n),s.name=H.sanitizeString(e,t)||X.NotSpecified,s.properties=H.sanitizeProperties(e,i),s.measurements=H.sanitizeMeasurements(e,a),o&&(s.domProcessing=o.domProcessing,s.duration=o.duration,s.networkConnect=o.networkConnect,s.perfTotal=o.perfTotal,s.receivedResponse=o.receivedResponse,s.sentRequest=o.sentRequest),s}var ut,pt,gt;te(ft,ut=ie);function ft(e,t){var n=ut.call(this)||this;return n.aiDataContract={baseType:f.Required,baseData:f.Required},n.baseType=e,n.baseData=t,n}(gt=pt||(pt={}))[gt.Verbose=0]="Verbose",gt[gt.Information=1]="Information",gt[gt.Warning=2]="Warning",gt[gt.Error=3]="Error",gt[gt.Critical=4]="Critical";var dt=(mt.getConfig=function(e,t,n,r){var i;return void 0===r&&(r=!1),i=n&&e.extensionConfig&&e.extensionConfig[n]&&!u.isNullOrUndefined(e.extensionConfig[n][t])?e.extensionConfig[n][t]:e[t],u.isNullOrUndefined(i)?r:i},mt);function mt(){}var ht=(vt.create=function(e,t,n,r,i,a){if(n=H.sanitizeString(r,n)||X.NotSpecified,u.isNullOrUndefined(e)||u.isNullOrUndefined(t)||u.isNullOrUndefined(n))throw Error("Input doesn't contain all required fields");var o={name:n,time:(new Date).toISOString(),iKey:"",ext:a||{},tags:[],data:{},baseType:t,baseData:e};if(!u.isNullOrUndefined(i))for(var s in i)i.hasOwnProperty(s)&&(o.data[s]=i[s]);return o},vt);function vt(){}var yt=(wt.prototype.trackPageView=function(t,n){var r=this,i=t.name;!u.isNullOrUndefined(i)&&"string"==typeof i||(t.name=window.document&&window.document.title||"");var a=t.uri;if(!u.isNullOrUndefined(a)&&"string"==typeof a||(t.uri=window.location&&window.location.href||""),!this._pageViewPerformanceManager.isPerformanceTimingSupported())return this.appInsights.sendPageViewInternal(t,n),this._channel().forEach(function(e){e.forEach(function(e){return e.flush(!0)})}),void this._logger.throwInternal(p.WARNING,w,"trackPageView: navigation timing API used for calculation of page duration is not supported in this browser. This page view will be collected without duration and timing info.");var o=!1,s=void 0,c=this._pageViewPerformanceManager.getPerformanceTiming().navigationStart;s=$.GetDuration(c,+new Date),this._pageViewPerformanceManager.shouldCollectDuration(s)||(s=void 0);var e=void 0;u.isNullOrUndefined(n)||u.isNullOrUndefined(n.duration)||(e=n.duration),!this.overridePageViewDuration&&isNaN(e)||(isNaN(e)&&(n||(n={}),n.duration=s),this.appInsights.sendPageViewInternal(t,n),this._channel().forEach(function(e){e.forEach(function(e){return e.flush(!0)})}),o=!0),n||(n={});var l=setInterval(function(){try{if(r._pageViewPerformanceManager.isPerformanceTimingDataReady()){clearInterval(l);var e={name:i,uri:a};r._pageViewPerformanceManager.populatePageViewPerformanceEvent(e),e.isValid||o?(o||(n.duration=e.durationMs,r.appInsights.sendPageViewInternal(t,n)),r.pageViewPerformanceSent||(r.appInsights.sendPageViewPerformanceInternal(e,n),r.pageViewPerformanceSent=!0),r._channel().forEach(function(e){e.forEach(function(e){return e.flush(!0)})})):(n.duration=s,r.appInsights.sendPageViewInternal(t,n),r._channel().forEach(function(e){e.forEach(function(e){return e.flush(!0)})}))}else 6e4<$.GetDuration(c,+new Date)&&(clearInterval(l),o||(n.duration=6e4,r.appInsights.sendPageViewInternal(t,n),r._channel().forEach(function(e){e.forEach(function(e){return e.flush(!0)})})))}catch(e){r._logger.throwInternal(p.CRITICAL,D,"trackPageView failed on page load calculation: "+X.getExceptionName(e),{exception:X.dump(e)})}},100)},wt);function wt(e,t,n,r){this.pageViewPerformanceSent=!1,this.overridePageViewDuration=!1,this.overridePageViewDuration=t,this.appInsights=e,this._pageViewPerformanceManager=r,n&&(this._channel=function(){return n.getTransmissionControls()},this._logger=n.logger)}var St=(_t.prototype.trackPreviousPageVisit=function(e,t){try{var n=this.restartPageVisitTimer(e,t);n&&this.pageVisitTimeTrackingHandler(n.pageName,n.pageUrl,n.pageVisitTime)}catch(e){this._logger.warnToConsole("Auto track page visit time failed, metric will not be collected: "+X.dump(e))}},_t.prototype.restartPageVisitTimer=function(e,t){try{var n=this.stopPageVisitTimer();return this.startPageVisitTimer(e,t),n}catch(e){return this._logger.warnToConsole("Call to restart failed: "+X.dump(e)),null}},_t.prototype.startPageVisitTimer=function(e,t){try{if(X.canUseSessionStorage()){if(null!=X.getSessionStorage(this._logger,this.prevPageVisitDataKeyName))throw new Error("Cannot call startPageVisit consecutively without first calling stopPageVisit");var n=new It(e,t),r=JSON.stringify(n);X.setSessionStorage(this._logger,this.prevPageVisitDataKeyName,r)}}catch(e){this._logger.warnToConsole("Call to start failed: "+X.dump(e))}},_t.prototype.stopPageVisitTimer=function(){try{if(X.canUseSessionStorage()){var e=Date.now(),t=X.getSessionStorage(this._logger,this.prevPageVisitDataKeyName);if(t){var n=JSON.parse(t);return n.pageVisitTime=e-n.pageVisitStartTime,X.removeSessionStorage(this._logger,this.prevPageVisitDataKeyName),n}return null}return null}catch(e){return this._logger.warnToConsole("Stop page visit timer failed: "+X.dump(e)),null}},_t);function _t(e,t){this.prevPageVisitDataKeyName="prevPageVisitData",this.pageVisitTimeTrackingHandler=t,this._logger=e}var It=function(e,t){this.pageVisitStartTime=Date.now(),this.pageName=e,this.pageUrl=t},Tt=(Nt.prototype.populatePageViewPerformanceEvent=function(e){e.isValid=!1;var t=this.getPerformanceTiming();if(t){var n=$.GetDuration(t.navigationStart,t.loadEventEnd),r=$.GetDuration(t.navigationStart,t.connectEnd),i=$.GetDuration(t.requestStart,t.responseStart),a=$.GetDuration(t.responseStart,t.responseEnd),o=$.GetDuration(t.responseEnd,t.loadEventEnd);0==n?this._logger.throwInternal(p.WARNING,v,"error calculating page view performance.",{total:n,network:r,request:i,response:a,dom:o}):this.shouldCollectDuration(n,r,i,a,o)?n<Math.floor(r)+Math.floor(i)+Math.floor(a)+Math.floor(o)?this._logger.throwInternal(p.WARNING,h,"client performance math error.",{total:n,network:r,request:i,response:a,dom:o}):(e.durationMs=n,e.perfTotal=e.duration=X.msToTimeSpan(n),e.networkConnect=X.msToTimeSpan(r),e.sentRequest=X.msToTimeSpan(i),e.receivedResponse=X.msToTimeSpan(a),e.domProcessing=X.msToTimeSpan(o),e.isValid=!0):this._logger.throwInternal(p.WARNING,b,"Invalid page load duration value. Browser perf data won't be sent.",{total:n,network:r,request:i,response:a,dom:o})}},Nt.prototype.getPerformanceTiming=function(){return this.isPerformanceTimingSupported()?window.performance.timing:null},Nt.prototype.isPerformanceTimingSupported=function(){return"undefined"!=typeof window&&window.performance&&window.performance.timing},Nt.prototype.isPerformanceTimingDataReady=function(){var e=window.performance.timing;return 0<e.domainLookupStart&&0<e.navigationStart&&0<e.responseStart&&0<e.requestStart&&0<e.loadEventEnd&&0<e.responseEnd&&0<e.connectEnd&&0<e.domLoading},Nt.prototype.shouldCollectDuration=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=["googlebot","adsbot-google","apis-google","mediapartners-google"],r=navigator.userAgent,i=!1;if(r)for(var a=0;a<n.length;a++)i=i||-1!==r.toLowerCase().indexOf(n[a]);if(i)return!1;for(var o=0;o<e.length;o++)if(e[o]>=this.MAX_DURATION_ALLOWED)return!1;return!0},Nt);function Nt(e){this.MAX_DURATION_ALLOWED=36e5,e&&(this._logger=e.logger)}var Et="duration",kt=(Dt.getDefaultConfig=function(e){return e||(e={}),e.sessionRenewalMs=18e5,e.sessionExpirationMs=864e5,e.disableExceptionTracking=X.stringToBoolOrDefault(e.disableExceptionTracking),e.autoTrackPageVisitTime=X.stringToBoolOrDefault(e.autoTrackPageVisitTime),e.overridePageViewDuration=X.stringToBoolOrDefault(e.overridePageViewDuration),(isNaN(e.samplingPercentage)||e.samplingPercentage<=0||100<=e.samplingPercentage)&&(e.samplingPercentage=100),e.isCookieUseDisabled=X.stringToBoolOrDefault(e.isCookieUseDisabled),e.isStorageUseDisabled=X.stringToBoolOrDefault(e.isStorageUseDisabled),e.isBrowserLinkTrackingEnabled=X.stringToBoolOrDefault(e.isBrowserLinkTrackingEnabled),e},Dt.prototype.processTelemetry=function(e){for(var t=!1,n=this._telemetryInitializers.length,r=0;r<n;++r){var i=this._telemetryInitializers[r];if(i)try{if(!1===i.apply(null,[e])){t=!0;break}}catch(e){this._logger.throwInternal(p.CRITICAL,V,"One of telemetry initializers failed, telemetry item will not be sent: "+X.getExceptionName(e),{exception:X.dump(e)},!0)}}t||u.isNullOrUndefined(this._nextPlugin)||this._nextPlugin.processTelemetry(e)},Dt.prototype.setNextPlugin=function(e){this._nextPlugin=e},Dt.prototype.trackEvent=function(e,t){try{var n=ht.create(e,fe.dataType,fe.envelopeType,this._logger,t);this._setTelemetryNameAndIKey(n),this.core.track(n)}catch(e){this._logger.throwInternal(p.WARNING,x,"trackTrace failed, trace will not be collected: "+X.getExceptionName(e),{exception:X.dump(e)})}},Dt.prototype.startTrackEvent=function(e){try{this._eventTracking.start(e)}catch(e){this._logger.throwInternal(p.CRITICAL,S,"startTrackEvent failed, event will not be collected: "+X.getExceptionName(e),{exception:X.dump(e)})}},Dt.prototype.stopTrackEvent=function(e,t,n){try{this._eventTracking.stop(e,void 0,t)}catch(e){this._logger.throwInternal(p.CRITICAL,_,"stopTrackEvent failed, event will not be collected: "+X.getExceptionName(e),{exception:X.dump(e)})}},Dt.prototype.trackTrace=function(e,t){try{var n=ht.create(e,nt.dataType,nt.envelopeType,this._logger,t);this._setTelemetryNameAndIKey(n),this.core.track(n)}catch(e){this._logger.throwInternal(p.WARNING,x,"trackTrace failed, trace will not be collected: "+X.getExceptionName(e),{exception:X.dump(e)})}},Dt.prototype.trackMetric=function(e,t){try{var n=ht.create(e,Oe.dataType,Oe.envelopeType,this._logger,t);this._setTelemetryNameAndIKey(n),this.core.track(n)}catch(e){this._logger.throwInternal(p.CRITICAL,E,"trackMetric failed, metric will not be collected: "+X.getExceptionName(e),{exception:X.dump(e)})}},Dt.prototype.trackPageView=function(e,t){try{var n=e||{};this._pageViewManager.trackPageView(n,t),this.config.autoTrackPageVisitTime&&this._pageVisitTimeManager.trackPreviousPageVisit(n.name,n.uri)}catch(e){this._logger.throwInternal(p.CRITICAL,k,"trackPageView failed, page view will not be collected: "+X.getExceptionName(e),{exception:X.dump(e)})}},Dt.prototype.sendPageViewInternal=function(e,t,n){"undefined"!=typeof document&&(e.refUri=e.refUri||document.referrer);var r=ht.create(e,He.dataType,He.envelopeType,this._logger,t,n);this._setTelemetryNameAndIKey(r),this.core.track(r),this._trackAjaxAttempts=0},Dt.prototype.sendPageViewPerformanceInternal=function(e,t,n){var r=ht.create(e,ct.dataType,ct.envelopeType,this._logger,t,n);this._setTelemetryNameAndIKey(r),this.core.track(r)},Dt.prototype.trackPageViewPerformance=function(e,t){try{this._pageViewPerformanceManager.populatePageViewPerformanceEvent(e),this.sendPageViewPerformanceInternal(e,t)}catch(e){this._logger.throwInternal(p.CRITICAL,k,"trackPageViewPerformance failed, page view will not be collected: "+X.getExceptionName(e),{exception:X.dump(e)})}},Dt.prototype.startTrackPage=function(e){try{"string"!=typeof e&&(e=window.document&&window.document.title||""),this._pageTracking.start(e)}catch(e){this._logger.throwInternal(p.CRITICAL,I,"startTrackPage failed, page view may not be collected: "+X.getExceptionName(e),{exception:X.dump(e)})}},Dt.prototype.stopTrackPage=function(e,t,n,r){try{"string"!=typeof e&&(e=window.document&&window.document.title||""),"string"!=typeof t&&(t=window.location&&window.location.href||""),this._pageTracking.stop(e,t,n,r),this.config.autoTrackPageVisitTime&&this._pageVisitTimeManager.trackPreviousPageVisit(e,t)}catch(e){this._logger.throwInternal(p.CRITICAL,T,"stopTrackPage failed, page view will not be collected: "+X.getExceptionName(e),{exception:X.dump(e)})}},Dt.prototype.sendExceptionInternal=function(e,t,n){var r=new _e(this._logger,e.exception||new Error(X.NotSpecified),e.properties,e.measurements,e.severityLevel,e.id).toInterface(),i=ht.create(r,_e.dataType,_e.envelopeType,this._logger,t,n);this._setTelemetryNameAndIKey(i),this.core.track(i)},Dt.prototype.trackException=function(e,t){try{this.sendExceptionInternal(e,t)}catch(e){this._logger.throwInternal(p.CRITICAL,N,"trackException failed, exception will not be collected: "+X.getExceptionName(e),{exception:X.dump(e)})}},Dt.prototype._onerror=function(t){try{var e={url:t&&t.url||document.URL,lineNumber:t.lineNumber,columnNumber:t.columnNumber,message:t.message};if(X.isCrossOriginError(t.message,t.url,t.lineNumber,t.columnNumber,t.error))this._sendCORSException(e.url);else{if(!X.isError(t.error)){var n="window.onerror@"+e.url+":"+t.lineNumber+":"+(t.columnNumber||0);t.error=new Error(t.message),t.error.stack=n}this.trackException({exception:t.error,severityLevel:pt.Error},e)}}catch(e){var r=t.error?t.error.name+", "+t.error.message:"null";this._logger.throwInternal(p.CRITICAL,y,"_onError threw exception while logging error, error will not be collected: "+X.getExceptionName(e),{exception:X.dump(e),errorString:r})}},Dt.prototype.addTelemetryInitializer=function(e){this._telemetryInitializers.push(e)},Dt.prototype._initialize=function(e,t,n){var o=this;if(!this._isInitialized){if(u.isNullOrUndefined(t))throw Error("Error initializing");this.core=t,this._logger=t.logger,this._globalconfig={instrumentationKey:e.instrumentationKey,endpointUrl:e.endpointUrl||"https://dc.services.visualstudio.com/v2/track"},this.config=e.extensionConfig&&e.extensionConfig[this.identifier]?e.extensionConfig[this.identifier]:{};var r=Dt.getDefaultConfig();if(void 0!==r){for(var i in r)this.config[i]=dt.getConfig(e,i,this.identifier,r[i]);if(this._globalconfig)for(var i in r)void 0===this._globalconfig[i]&&(this._globalconfig[i]=r[i])}this.config.isCookieUseDisabled&&X.disableCookies(),this.config.isStorageUseDisabled&&X.disableStorage();var a={instrumentationKey:function(){return e.instrumentationKey},accountId:function(){return o.config.accountId||e.accountId},sessionRenewalMs:function(){return o.config.sessionRenewalMs||e.sessionRenewalMs},sessionExpirationMs:function(){return o.config.sessionExpirationMs||e.sessionExpirationMs},sampleRate:function(){return o.config.samplingPercentage||e.samplingPercentage},cookieDomain:function(){return o.config.cookieDomain||e.cookieDomain},sdkExtension:function(){return o.config.sdkExtension||e.sdkExtension},isBrowserLinkTrackingEnabled:function(){return o.config.isBrowserLinkTrackingEnabled||e.isBrowserLinkTrackingEnabled},appId:function(){return o.config.appId||e.appId}};if(this._pageViewPerformanceManager=new Tt(this.core),this._pageViewManager=new yt(this,this.config.overridePageViewDuration,this.core,this._pageViewPerformanceManager),this._pageVisitTimeManager=new St(this._logger,function(e,t,n){return o.trackPageVisitTime(e,t,n)}),this._telemetryInitializers=[],this._addDefaultTelemetryInitializers(a),this._eventTracking=new xt(this._logger,"trackEvent"),this._eventTracking.action=function(e,t,n,r){r||(r={}),r[Et]=n.toString(),o.trackEvent({name:e,properties:r})},this._pageTracking=new xt(this._logger,"trackPageView"),!(this._pageTracking.action=function(e,t,n,r,i){u.isNullOrUndefined(r)&&(r={}),r[Et]=n.toString();var a={name:e,uri:t,properties:r,measurements:i};o.sendPageViewInternal(a)})===this.config.disableExceptionTracking&&!this.config.autoExceptionInstrumented){var s=window.onerror,c=this;window.onerror=function(e,t,n,r,i){var a=s&&s(e,t,n,r,i);return!0!==a&&c._onerror({message:e,url:t,lineNumber:n,columnNumber:r,error:i}),a},this.config.autoExceptionInstrumented=!0}this._isInitialized=!0}},Dt.prototype.trackPageVisitTime=function(e,t,n){var r={PageName:e,PageUrl:t};this.trackMetric({name:"PageVisitTime",average:n,max:n,min:n,sampleCount:1},r)},Dt.prototype._addDefaultTelemetryInitializers=function(e){if(!e.isBrowserLinkTrackingEnabled()){var r=["/browserLinkSignalR/","/__browserLink/"];this._addTelemetryInitializer(function(e){if(e.baseType===Qe.dataType){var t=e.baseData;if(t)for(var n=0;n<r.length;n++)if(t.target&&0<=t.target.indexOf(r[n]))return!1}return!0})}},Dt.prototype._addTelemetryInitializer=function(e){this._telemetryInitializers.push(e)},Dt.prototype._sendCORSException=function(e){var t={message:"Script error: The browser's same-origin policy prevents us from getting the details of this exception. Consider using the 'crossorigin' attribute.",url:e,lineNumber:0,columnNumber:0,error:void 0},n=ht.create(t,_e.dataType,_e.envelopeType,this._logger,{url:e});this.core.track(n)},Dt.prototype._setTelemetryNameAndIKey=function(e){e.iKey=this._globalconfig.instrumentationKey;var t=this._globalconfig.instrumentationKey.replace(/-/g,"");e.name=e.name.replace("{0}",t)},Dt.Version="2.0.1",Dt);function Dt(){this.identifier="ApplicationInsightsAnalytics",this.priority=160,this._isInitialized=!1,this._trackAjaxAttempts=0,this.initialize=this._initialize.bind(this)}var xt=(bt.prototype.start=function(e){void 0!==this._events[e]&&this._logger.throwInternal(p.WARNING,U,"start was called more than once for this event without calling stop.",{name:this._name,key:e},!0),this._events[e]=+new Date},bt.prototype.stop=function(e,t,n,r){var i=this._events[e];if(isNaN(i))this._logger.throwInternal(p.WARNING,L,"stop was called without a corresponding start.",{name:this._name,key:e},!0);else{var a=+new Date,o=$.GetDuration(i,a);this.action(e,t,o,n,r)}delete this._events[e],this._events[e]=void 0},bt);function bt(e,t){this._name=t,this._events={},this._logger=e}e.ApplicationInsights=kt,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 r=function(e,t){return(r=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 t(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var i,n,f,a,o=function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};(n=i||(i={}))[n.LocalStorage=0]="LocalStorage",n[n.SessionStorage=1]="SessionStorage",(a=f||(f={}))[a.Default=0]="Default",a[a.Required=1]="Required",a[a.Array=2]="Array",a[a.Hidden=4]="Hidden";var g=(s.isNullOrUndefined=function(e){return null==e},s.disableCookies=function(){s._canUseCookies=!1},s.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)})},s);function s(){}var u,c,l=/[xy]/g;(c=u||(u={}))[c.CRITICAL=1]="CRITICAL",c[c.WARNING=2]="WARNING";var p=1,d=2,h=3,m=4,v=5,w=6,y=8,S=10,_=11,I=25,T=29,N=30,E=31,k=32,x=35,D=36,P=37,b=38,A=39,C=45,M=49,R=52,L=56,U=57,V=61,O=62,z=63,G=64,q=66,j=68,B=69;H.prototype.processTelemetry=function(t){this.channelQueue.forEach(function(e){0<e.length&&e[0].processTelemetry(t)})},Object.defineProperty(H.prototype,"ChannelControls",{get:function(){return this.channelQueue},enumerable:!0,configurable:!0}),H.prototype.initialize=function(n,r,i){var a=this;if(n.isCookieUseDisabled&&g.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,i)}),o)throw Error("Channel has invalid priority"+o);for(var t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);a.channelQueue.push(e)}})}for(var e=new Array,t=0;t<i.length;t++){var s=i[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,i)}),t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);this.channelQueue.push(e)}};function H(){this.identifier="ChannelControllerPlugin",this.priority=500}var X=(W.sanitizeKeyAndAddUniqueness=function(e,t,n){var r=t.length,i=W.sanitizeKey(e,t);if(i.length!==r){for(var a=0,o=i;void 0!==n[o];)a++,o=i.substring(0,W.MAX_NAME_LENGTH-3)+W.padNumber(a);i=o}return i},W.sanitizeKey=function(e,t){var n;return t&&(t=W.trim(t.toString())).length>W.MAX_NAME_LENGTH&&(n=t.substring(0,W.MAX_NAME_LENGTH),e.throwInternal(u.WARNING,U,"name is too long. It has been truncated to "+W.MAX_NAME_LENGTH+" characters.",{name:t},!0)),n||t},W.sanitizeString=function(e,t,n){var r;return void 0===n&&(n=W.MAX_STRING_LENGTH),t&&(n=n||W.MAX_STRING_LENGTH,(t=W.trim(t)).toString().length>n&&(r=t.toString().substring(0,n),e.throwInternal(u.WARNING,V,"string value is too long. It has been truncated to "+n+" characters.",{value:t},!0))),r||t},W.sanitizeUrl=function(e,t){return W.sanitizeInput(e,t,W.MAX_URL_LENGTH,q)},W.sanitizeMessage=function(e,t){var n;return t&&t.length>W.MAX_MESSAGE_LENGTH&&(n=t.substring(0,W.MAX_MESSAGE_LENGTH),e.throwInternal(u.WARNING,L,"message is too long, it has been truncated to "+W.MAX_MESSAGE_LENGTH+" characters.",{message:t},!0)),n||t},W.sanitizeException=function(e,t){var n;return t&&t.length>W.MAX_EXCEPTION_LENGTH&&(n=t.substring(0,W.MAX_EXCEPTION_LENGTH),e.throwInternal(u.WARNING,R,"exception is too long, it has been truncated to "+W.MAX_EXCEPTION_LENGTH+" characters.",{exception:t},!0)),n||t},W.sanitizeProperties=function(t,e){if(e){var n={};for(var r in e){var i=e[r];if("object"==typeof i&&"undefined"!=typeof JSON)try{i=JSON.stringify(i)}catch(e){t.throwInternal(u.WARNING,M,"custom property is not valid",{exception:e},!0)}i=W.sanitizeString(t,i,W.MAX_PROPERTY_LENGTH),n[r=W.sanitizeKeyAndAddUniqueness(t,r,n)]=i}e=n}return e},W.sanitizeMeasurements=function(e,t){if(t){var n={};for(var r in t){var i=t[r];n[r=W.sanitizeKeyAndAddUniqueness(e,r,n)]=i}t=n}return t},W.sanitizeId=function(e,t){return t?W.sanitizeInput(e,t,W.MAX_ID_LENGTH,B).toString():t},W.sanitizeInput=function(e,t,n,r){var i;return t&&(t=W.trim(t)).length>n&&(i=t.substring(0,n),e.throwInternal(u.WARNING,r,"input is too long, it has been truncated to "+n+" characters.",{data:t},!0)),i||t},W.padNumber=function(e){var t="00"+e;return t.substr(t.length-3)},W.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},W.MAX_NAME_LENGTH=150,W.MAX_ID_LENGTH=128,W.MAX_PROPERTY_LENGTH=8192,W.MAX_STRING_LENGTH=1024,W.MAX_URL_LENGTH=2048,W.MAX_MESSAGE_LENGTH=32768,W.MAX_EXCEPTION_LENGTH=32768,W);function W(){}var K=(F.disableStorage=function(){F._canUseLocalStorage=!1,F._canUseSessionStorage=!1},F._getLocalStorageObject=function(){return F.canUseLocalStorage()?F._getVerifiedStorageObject(i.LocalStorage):null},F._getVerifiedStorageObject=function(e){var t,n,r=null;try{if("undefined"==typeof window)return null;n=new Date,(r=e===i.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},F.isInternalApplicationInsightsEndpoint=function(e){return-1!==F._internalEndpoints.indexOf(e.toLowerCase())},F.canUseLocalStorage=function(){return void 0===F._canUseLocalStorage&&(F._canUseLocalStorage=!!F._getVerifiedStorageObject(i.LocalStorage)),F._canUseLocalStorage},F.getStorage=function(t,e){var n=F._getLocalStorageObject();if(null!==n)try{return n.getItem(e)}catch(e){F._canUseLocalStorage=!1,t.throwInternal(u.WARNING,p,"Browser failed read of local storage. "+F.getExceptionName(e),{exception:F.dump(e)})}return null},F.setStorage=function(t,e,n){var r=F._getLocalStorageObject();if(null!==r)try{return r.setItem(e,n),!0}catch(e){F._canUseLocalStorage=!1,t.throwInternal(u.WARNING,h,"Browser failed write to local storage. "+F.getExceptionName(e),{exception:F.dump(e)})}return!1},F.removeStorage=function(t,e){var n=F._getLocalStorageObject();if(null!==n)try{return n.removeItem(e),!0}catch(e){F._canUseLocalStorage=!1,t.throwInternal(u.WARNING,v,"Browser failed removal of local storage item. "+F.getExceptionName(e),{exception:F.dump(e)})}return!1},F._getSessionStorageObject=function(){return F.canUseSessionStorage()?F._getVerifiedStorageObject(i.SessionStorage):null},F.canUseSessionStorage=function(){return void 0===F._canUseSessionStorage&&(F._canUseSessionStorage=!!F._getVerifiedStorageObject(i.SessionStorage)),F._canUseSessionStorage},F.getSessionStorageKeys=function(){var e=[];if(F.canUseSessionStorage())for(var t in window.sessionStorage)e.push(t);return e},F.getSessionStorage=function(t,e){var n=F._getSessionStorageObject();if(null!==n)try{return n.getItem(e)}catch(e){F._canUseSessionStorage=!1,t.throwInternal(u.WARNING,d,"Browser failed read of session storage. "+F.getExceptionName(e),{exception:F.dump(e)})}return null},F.setSessionStorage=function(t,e,n){var r=F._getSessionStorageObject();if(null!==r)try{return r.setItem(e,n),!0}catch(e){F._canUseSessionStorage=!1,t.throwInternal(u.WARNING,m,"Browser failed write to session storage. "+F.getExceptionName(e),{exception:F.dump(e)})}return!1},F.removeSessionStorage=function(t,e){var n=F._getSessionStorageObject();if(null!==n)try{return n.removeItem(e),!0}catch(e){F._canUseSessionStorage=!1,t.throwInternal(u.WARNING,w,"Browser failed removal of session storage item. "+F.getExceptionName(e),{exception:F.dump(e)})}return!1},F.disableCookies=function(){g.disableCookies()},F.canUseCookies=function(t){if(void 0===g._canUseCookies){g._canUseCookies=!1;try{g._canUseCookies=void 0!==F.document.cookie}catch(e){t.throwInternal(u.WARNING,j,"Cannot access document.cookie - "+F.getExceptionName(e),{exception:F.dump(e)})}}return g._canUseCookies},F.setCookie=function(e,t,n,r){var i="",a="";r&&(i=";domain="+r),F.document.location&&"https:"===F.document.location.protocol&&(a=";secure"),F.canUseCookies(e)&&(F.document.cookie=t+"="+n+i+";path=/"+a)},F.stringToBoolOrDefault=function(e,t){return void 0===t&&(t=!1),null==e?t:"true"===e.toString().toLowerCase()},F.getCookie=function(e,t){if(F.canUseCookies(e)){var n="";if(t&&t.length)for(var r=t+"=",i=F.document.cookie.split(";"),a=0;a<i.length;a++){var o=i[a];if((o=F.trim(o))&&0===o.indexOf(r)){n=o.substring(r.length,i[a].length);break}}return n}},F.deleteCookie=function(e,t){F.canUseCookies(e)&&(F.document.cookie=t+"=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;")},F.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},F.newId=function(){for(var e="",t=1073741824*Math.random();0<t;)e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t%64),t=Math.floor(t/64);return e},F.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},F.isError=function(e){return"[object Error]"===Object.prototype.toString.call(e)},F.isDate=function(e){return"[object Date]"===Object.prototype.toString.call(e)},F.toISOStringForIE8=function(e){if(F.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"}},F.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},F.msToTimeSpan=function(e){(isNaN(e)||e<0)&&(e=0);var t=""+(e=Math.round(e))%1e3,n=""+Math.floor(e/1e3)%60,r=""+Math.floor(e/6e4)%60,i=""+Math.floor(e/36e5)%24,a=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<a?a+".":"")+(i=i.length<2?"0"+i:i)+":"+r+":"+n+"."+t},F.isCrossOriginError=function(e,t,n,r,i){return("Script error."===e||"Script error"===e)&&!i},F.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},F.getExceptionName=function(e){return"[object Error]"===Object.prototype.toString.call(e)?e.name:""},F.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},F.IsBeaconApiSupported=function(){return"sendBeacon"in navigator&&navigator.sendBeacon},F.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},F.document="undefined"!=typeof document?document:{},F._canUseLocalStorage=void 0,F._canUseSessionStorage=void 0,F._internalEndpoints=["https://dc.services.visualstudio.com/v2/track","https://breeze.aimon.applicationinsights.io/v2/track","https://dc-int.services.visualstudio.com/v2/track"],F.NotSpecified="not_specified",F);function F(){}var J=(Q.parseUrl=function(e){return Q.htmlAnchorElement||(Q.htmlAnchorElement=Q.document.createElement?Q.document.createElement("a"):{host:Q.parseHost(e)}),Q.htmlAnchorElement.href=e,Q.htmlAnchorElement},Q.getAbsoluteUrl=function(e){var t,n=Q.parseUrl(e);return n&&(t=n.href),t},Q.getPathName=function(e){var t,n=Q.parseUrl(e);return n&&(t=n.pathname),t},Q.getCompleteUrl=function(e,t){return e?e.toUpperCase()+" "+t:t},Q.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},Q.document="undefined"!=typeof document?document:{},Q);function Q(){}var Y=($.ParseDependencyPath=function(e,t,n,r){var i,a=r,o=r;if(t&&0<t.length){var s=J.parseUrl(t);if(i=s.host,!a)if(null!=s.pathname){var c=0===s.pathname.length?"/":s.pathname;"/"!==c.charAt(0)&&(c="/"+c),o=s.pathname,a=X.sanitizeString(e,n?n+" "+c:c)}else a=X.sanitizeString(e,t)}else a=i=r;return{target:i,name:a,data:o}},$);function $(){}var Z=(ee.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()},ee.GetDuration=function(e,t){var n=null;return 0===e||0===t||g.isNullOrUndefined(e)||g.isNullOrUndefined(t)||(n=t-e),n},ee);function ee(){}var te,ne=(t(re,te=function(){}),re);function re(){return te.call(this)||this}var ie;t(ae,ie=function(){this.ver=1,this.sampleRate=100,this.tags={}});function ae(e,t,n){var r=ie.call(this)||this;return r.name=X.sanitizeString(e,n)||K.NotSpecified,r.data=t,r.time=K.toISOStringForIE8(new Date),r.aiDataContract={time:f.Required,iKey:f.Required,name:f.Required,sampleRate:function(){return 100==r.sampleRate?f.Hidden:f.Required},tags:f.Required,data:f.Required},r}function oe(){}var se,ce=(t(le,se=oe),le);function le(){var e=se.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var ue,pe=(t(ge,ue=ce),ge.envelopeType="Microsoft.ApplicationInsights.{0}.Event",ge.dataType="EventData",ge);function ge(e,t,n,r){var i=ue.call(this)||this;return i.aiDataContract={ver:f.Required,name:f.Required,properties:f.Default,measurements:f.Default},i.name=X.sanitizeString(e,t)||K.NotSpecified,i.properties=X.sanitizeProperties(e,n),i.measurements=X.sanitizeMeasurements(e,r),i}function fe(){}var de,he=(t(me,de=oe),me);function me(){var e=de.call(this)||this;return e.ver=2,e.exceptions=[],e.properties={},e.measurements={},e}function ve(){this.hasFullStack=!0,this.parsedStack=[]}var we,ye=(t(Se,we=he),Se.CreateFromInterface=function(t,e){var n=e.exceptions&&e.exceptions.map(function(e){return Ie.CreateFromInterface(t,e)});return new Se(t,o({},e,{exceptions:n}))},Se.prototype.toInterface=function(){var e=this,t=e.exceptions,n=e.properties,r=e.measurements,i=e.severityLevel,a=e.ver,o=e.problemGroup,s=e.id,c=e.isManual;return{ver:a,exceptions:t instanceof Array&&t.map(function(e){return e.toInterface()})||void 0,severityLevel:i,properties:n,measurements:r,problemGroup:o,id:s,isManual:c}},Se.CreateSimpleException=function(e,t,n,r,i,a){return{exceptions:[{hasFullStack:!0,message:e,stack:i,typeName:t}]}},Se.envelopeType="Microsoft.ApplicationInsights.{0}.Exception",Se.dataType="ExceptionData",Se);function Se(e,t,n,r,i,a){var o=we.call(this)||this;return o.aiDataContract={ver:f.Required,exceptions:f.Required,severityLevel:f.Default,properties:f.Default,measurements:f.Default},t instanceof Error?(o.exceptions=[new Ie(e,t)],o.properties=X.sanitizeProperties(e,n),o.measurements=X.sanitizeMeasurements(e,r),i&&(o.severityLevel=i),a&&(o.id=a)):(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),g.isNullOrUndefined(t.ver)||(o.ver=t.ver),g.isNullOrUndefined(t.isManual)||(o.isManual=t.isManual)),o}var _e,Ie=(t(Te,_e=ve),Te.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}},Te.CreateFromInterface=function(e,t){var n=t.parsedStack instanceof Array&&t.parsedStack.map(function(e){return Ee.CreateFromInterface(e)})||t.parsedStack;return new Te(e,o({},t,{parsedStack:n}))},Te.parseStack=function(e){var t=void 0;if("string"==typeof e){var n=e.split("\n");t=[];for(var r=0,i=0,a=0;a<=n.length;a++){var o=n[a];if(Ee.regex.test(o)){var s=new Ee(n[a],r++);i+=s.sizeInBytes,t.push(s)}}if(32768<i)for(var c=0,l=t.length-1,u=0,p=c,g=l;c<l;){if(32768<(u+=t[c].sizeInBytes+t[l].sizeInBytes)){var f=g-p+1;t.splice(p,f);break}p=c,g=l,c++,l--}}return t},Te);function Te(e,t){var n=_e.call(this)||this;if(n.aiDataContract={id:f.Default,outerId:f.Default,typeName:f.Required,message:f.Required,hasFullStack:f.Default,stack:f.Default,parsedStack:f.Array},t instanceof Error){n.typeName=X.sanitizeString(e,t.name)||K.NotSpecified,n.message=X.sanitizeMessage(e,t.message)||K.NotSpecified;var r=t.stack;n.parsedStack=Te.parseStack(r),n.stack=X.sanitizeException(e,r),n.hasFullStack=K.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 Ne,Ee=(t(ke,Ne=fe),ke.CreateFromInterface=function(e){return new ke(e,null)},ke.prototype.toInterface=function(){return{level:this.level,method:this.method,assembly:this.assembly,fileName:this.fileName,line:this.line}},ke.regex=/^([\s]+at)?(.*?)(\@|\s\(|\s)([^\(\@\n]+):([0-9]+):([0-9]+)(\)?)$/,ke.baseSize=58,ke);function ke(e,t){var n=Ne.call(this)||this;if(n.sizeInBytes=0,n.aiDataContract={level:f.Required,method:f.Required,assembly:f.Default,fileName:f.Default,line:f.Default},"string"==typeof e){var r=e;n.level=t,n.method="<no_method>",n.assembly=K.trim(r),n.fileName="",n.line=0;var i=r.match(ke.regex);i&&5<=i.length&&(n.method=K.trim(i[2])||n.method,n.fileName=K.trim(i[4]),n.line=parseInt(i[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+=ke.baseSize,n.sizeInBytes+=n.level.toString().length,n.sizeInBytes+=n.line.toString().length,n}var xe,De,Pe,be=(t(Ae,xe=oe),Ae);function Ae(){var e=xe.call(this)||this;return e.ver=2,e.metrics=[],e.properties={},e}(Pe=De||(De={}))[Pe.Measurement=0]="Measurement",Pe[Pe.Aggregation=1]="Aggregation";var Ce,Me=(t(Re,Ce=function(){this.kind=De.Measurement}),Re);function Re(){var e=null!==Ce&&Ce.apply(this,arguments)||this;return e.aiDataContract={name:f.Required,kind:f.Default,value:f.Required,count:f.Default,min:f.Default,max:f.Default,stdDev:f.Default},e}var Le,Ue=(t(Ve,Le=be),Ve.envelopeType="Microsoft.ApplicationInsights.{0}.Metric",Ve.dataType="MetricData",Ve);function Ve(e,t,n,r,i,a,o){var s=Le.call(this)||this;s.aiDataContract={ver:f.Required,metrics:f.Required,properties:f.Default};var c=new Me;return c.count=0<r?r:void 0,c.max=isNaN(a)||null===a?void 0:a,c.min=isNaN(i)||null===i?void 0:i,c.name=X.sanitizeString(e,t)||K.NotSpecified,c.value=n,s.metrics=[c],s.properties=X.sanitizeProperties(e,o),s}var Oe,ze=(t(Ge,Oe=ce),Ge);function Ge(){var e=Oe.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var qe,je=(t(Be,qe=ze),Be.envelopeType="Microsoft.ApplicationInsights.{0}.Pageview",Be.dataType="PageviewData",Be);function Be(e,t,n,r,i,a,o){var s=qe.call(this)||this;return s.aiDataContract={ver:f.Required,name:f.Default,url:f.Default,duration:f.Default,properties:f.Default,measurements:f.Default,id:f.Default},s.id=X.sanitizeId(e,o),s.url=X.sanitizeUrl(e,n),s.name=X.sanitizeString(e,t)||K.NotSpecified,isNaN(r)||(s.duration=K.msToTimeSpan(r)),s.properties=X.sanitizeProperties(e,i),s.measurements=X.sanitizeMeasurements(e,a),s}var He,Xe=(t(We,He=oe),We);function We(){var e=He.call(this)||this;return e.ver=2,e.success=!0,e.properties={},e.measurements={},e}var Ke,Fe=(t(Je,Ke=Xe),Je.envelopeType="Microsoft.ApplicationInsights.{0}.RemoteDependency",Je.dataType="RemoteDependencyData",Je);function Je(e,t,n,r,i,a,o,s,c,l,u){void 0===c&&(c="Ajax");var p=Ke.call(this)||this;p.aiDataContract={id:f.Required,ver:f.Required,name:f.Default,resultCode:f.Default,duration:f.Default,success:f.Default,data:f.Default,target:f.Default,type:f.Default,properties:f.Default,measurements:f.Default,kind:f.Default,value:f.Default,count:f.Default,min:f.Default,max:f.Default,stdDev:f.Default,dependencyKind:f.Default,dependencySource:f.Default,commandName:f.Default,dependencyTypeName:f.Default},p.id=t,p.duration=K.msToTimeSpan(i),p.success=a,p.resultCode=o+"",p.type=X.sanitizeString(e,c);var g=Y.ParseDependencyPath(e,n,s,r);return p.data=X.sanitizeUrl(e,r)||g.data,p.target=X.sanitizeString(e,g.target),p.name=X.sanitizeString(e,g.name),p.properties=X.sanitizeProperties(e,l),p.measurements=X.sanitizeMeasurements(e,u),p}var Qe,Ye=(t($e,Qe=oe),$e);function $e(){var e=Qe.call(this)||this;return e.ver=2,e.properties={},e}var Ze,et=(t(tt,Ze=Ye),tt.envelopeType="Microsoft.ApplicationInsights.{0}.Message",tt.dataType="MessageData",tt);function tt(e,t,n,r){var i=Ze.call(this)||this;return i.aiDataContract={ver:f.Required,message:f.Required,severityLevel:f.Default,properties:f.Default},t=t||K.NotSpecified,i.message=X.sanitizeMessage(e,t),i.properties=X.sanitizeProperties(e,r),n&&(i.severityLevel=n),i}var nt,rt=(t(it,nt=ze),it);function it(){var e=nt.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var at,ot=(t(st,at=rt),st.envelopeType="Microsoft.ApplicationInsights.{0}.PageviewPerformance",st.dataType="PageviewPerformanceData",st);function st(e,t,n,r,i,a,o){var s=at.call(this)||this;return s.aiDataContract={ver:f.Required,name:f.Default,url:f.Default,duration:f.Default,perfTotal:f.Default,networkConnect:f.Default,sentRequest:f.Default,receivedResponse:f.Default,domProcessing:f.Default,properties:f.Default,measurements:f.Default},s.url=X.sanitizeUrl(e,n),s.name=X.sanitizeString(e,t)||K.NotSpecified,s.properties=X.sanitizeProperties(e,i),s.measurements=X.sanitizeMeasurements(e,a),o&&(s.domProcessing=o.domProcessing,s.duration=o.duration,s.networkConnect=o.networkConnect,s.perfTotal=o.perfTotal,s.receivedResponse=o.receivedResponse,s.sentRequest=o.sentRequest),s}var ct,lt,ut;t(pt,ct=ne);function pt(e,t){var n=ct.call(this)||this;return n.aiDataContract={baseType:f.Required,baseData:f.Required},n.baseType=e,n.baseData=t,n}(ut=lt||(lt={}))[ut.Verbose=0]="Verbose",ut[ut.Information=1]="Information",ut[ut.Warning=2]="Warning",ut[ut.Error=3]="Error",ut[ut.Critical=4]="Critical";var gt=(ft.getConfig=function(e,t,n,r){var i;return void 0===r&&(r=!1),i=n&&e.extensionConfig&&e.extensionConfig[n]&&!g.isNullOrUndefined(e.extensionConfig[n][t])?e.extensionConfig[n][t]:e[t],g.isNullOrUndefined(i)?r:i},ft);function ft(){}var dt=(ht.create=function(e,t,n,r,i,a){if(n=X.sanitizeString(r,n)||K.NotSpecified,g.isNullOrUndefined(e)||g.isNullOrUndefined(t)||g.isNullOrUndefined(n))throw Error("Input doesn't contain all required fields");var o={name:n,time:(new Date).toISOString(),iKey:"",ext:a||{},tags:[],data:{},baseType:t,baseData:e};if(!g.isNullOrUndefined(i))for(var s in i)i.hasOwnProperty(s)&&(o.data[s]=i[s]);return o},ht);function ht(){}var mt=(vt.prototype.trackPageView=function(t,n){var r=this,i=t.name;!g.isNullOrUndefined(i)&&"string"==typeof i||(t.name=window.document&&window.document.title||"");var a=t.uri;if(!g.isNullOrUndefined(a)&&"string"==typeof a||(t.uri=window.location&&window.location.href||""),!this._pageViewPerformanceManager.isPerformanceTimingSupported())return this.appInsights.sendPageViewInternal(t,n),this._channel().forEach(function(e){e.forEach(function(e){return e.flush(!0)})}),void this._logger.throwInternal(u.WARNING,I,"trackPageView: navigation timing API used for calculation of page duration is not supported in this browser. This page view will be collected without duration and timing info.");var o=!1,s=void 0,c=this._pageViewPerformanceManager.getPerformanceTiming().navigationStart;s=Z.GetDuration(c,+new Date),this._pageViewPerformanceManager.shouldCollectDuration(s)||(s=void 0);var e=void 0;g.isNullOrUndefined(n)||g.isNullOrUndefined(n.duration)||(e=n.duration),!this.overridePageViewDuration&&isNaN(e)||(isNaN(e)&&(n||(n={}),n.duration=s),this.appInsights.sendPageViewInternal(t,n),this._channel().forEach(function(e){e.forEach(function(e){return e.flush(!0)})}),o=!0),n||(n={});var l=setInterval(function(){try{if(r._pageViewPerformanceManager.isPerformanceTimingDataReady()){clearInterval(l);var e={name:i,uri:a};r._pageViewPerformanceManager.populatePageViewPerformanceEvent(e),e.isValid||o?(o||(n.duration=e.durationMs,r.appInsights.sendPageViewInternal(t,n)),r.pageViewPerformanceSent||(r.appInsights.sendPageViewPerformanceInternal(e,n),r.pageViewPerformanceSent=!0),r._channel().forEach(function(e){e.forEach(function(e){return e.flush(!0)})})):(n.duration=s,r.appInsights.sendPageViewInternal(t,n),r._channel().forEach(function(e){e.forEach(function(e){return e.flush(!0)})}))}else 6e4<Z.GetDuration(c,+new Date)&&(clearInterval(l),o||(n.duration=6e4,r.appInsights.sendPageViewInternal(t,n),r._channel().forEach(function(e){e.forEach(function(e){return e.flush(!0)})})))}catch(e){r._logger.throwInternal(u.CRITICAL,b,"trackPageView failed on page load calculation: "+K.getExceptionName(e),{exception:K.dump(e)})}},100)},vt);function vt(e,t,n,r){this.pageViewPerformanceSent=!1,this.overridePageViewDuration=!1,this.overridePageViewDuration=t,this.appInsights=e,this._pageViewPerformanceManager=r,n&&(this._channel=function(){return n.getTransmissionControls()},this._logger=n.logger)}var wt=(yt.prototype.trackPreviousPageVisit=function(e,t){try{var n=this.restartPageVisitTimer(e,t);n&&this.pageVisitTimeTrackingHandler(n.pageName,n.pageUrl,n.pageVisitTime)}catch(e){this._logger.warnToConsole("Auto track page visit time failed, metric will not be collected: "+K.dump(e))}},yt.prototype.restartPageVisitTimer=function(e,t){try{var n=this.stopPageVisitTimer();return this.startPageVisitTimer(e,t),n}catch(e){return this._logger.warnToConsole("Call to restart failed: "+K.dump(e)),null}},yt.prototype.startPageVisitTimer=function(e,t){try{if(K.canUseSessionStorage()){if(null!=K.getSessionStorage(this._logger,this.prevPageVisitDataKeyName))throw new Error("Cannot call startPageVisit consecutively without first calling stopPageVisit");var n=new St(e,t),r=JSON.stringify(n);K.setSessionStorage(this._logger,this.prevPageVisitDataKeyName,r)}}catch(e){this._logger.warnToConsole("Call to start failed: "+K.dump(e))}},yt.prototype.stopPageVisitTimer=function(){try{if(K.canUseSessionStorage()){var e=Date.now(),t=K.getSessionStorage(this._logger,this.prevPageVisitDataKeyName);if(t){var n=JSON.parse(t);return n.pageVisitTime=e-n.pageVisitStartTime,K.removeSessionStorage(this._logger,this.prevPageVisitDataKeyName),n}return null}return null}catch(e){return this._logger.warnToConsole("Stop page visit timer failed: "+K.dump(e)),null}},yt);function yt(e,t){this.prevPageVisitDataKeyName="prevPageVisitData",this.pageVisitTimeTrackingHandler=t,this._logger=e}var St=function(e,t){this.pageVisitStartTime=Date.now(),this.pageName=e,this.pageUrl=t},_t=(It.prototype.populatePageViewPerformanceEvent=function(e){e.isValid=!1;var t=this.getPerformanceTiming();if(t){var n=Z.GetDuration(t.navigationStart,t.loadEventEnd),r=Z.GetDuration(t.navigationStart,t.connectEnd),i=Z.GetDuration(t.requestStart,t.responseStart),a=Z.GetDuration(t.responseStart,t.responseEnd),o=Z.GetDuration(t.responseEnd,t.loadEventEnd);0==n?this._logger.throwInternal(u.WARNING,S,"error calculating page view performance.",{total:n,network:r,request:i,response:a,dom:o}):this.shouldCollectDuration(n,r,i,a,o)?n<Math.floor(r)+Math.floor(i)+Math.floor(a)+Math.floor(o)?this._logger.throwInternal(u.WARNING,y,"client performance math error.",{total:n,network:r,request:i,response:a,dom:o}):(e.durationMs=n,e.perfTotal=e.duration=K.msToTimeSpan(n),e.networkConnect=K.msToTimeSpan(r),e.sentRequest=K.msToTimeSpan(i),e.receivedResponse=K.msToTimeSpan(a),e.domProcessing=K.msToTimeSpan(o),e.isValid=!0):this._logger.throwInternal(u.WARNING,C,"Invalid page load duration value. Browser perf data won't be sent.",{total:n,network:r,request:i,response:a,dom:o})}},It.prototype.getPerformanceTiming=function(){return this.isPerformanceTimingSupported()?window.performance.timing:null},It.prototype.isPerformanceTimingSupported=function(){return"undefined"!=typeof window&&window.performance&&window.performance.timing},It.prototype.isPerformanceTimingDataReady=function(){var e=window.performance.timing;return 0<e.domainLookupStart&&0<e.navigationStart&&0<e.responseStart&&0<e.requestStart&&0<e.loadEventEnd&&0<e.responseEnd&&0<e.connectEnd&&0<e.domLoading},It.prototype.shouldCollectDuration=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=["googlebot","adsbot-google","apis-google","mediapartners-google"],r=navigator.userAgent,i=!1;if(r)for(var a=0;a<n.length;a++)i=i||-1!==r.toLowerCase().indexOf(n[a]);if(i)return!1;for(var o=0;o<e.length;o++)if(e[o]>=this.MAX_DURATION_ALLOWED)return!1;return!0},It);function It(e){this.MAX_DURATION_ALLOWED=36e5,e&&(this._logger=e.logger)}var Tt="duration",Nt=(Et.getDefaultConfig=function(e){return e||(e={}),e.sessionRenewalMs=18e5,e.sessionExpirationMs=864e5,e.disableExceptionTracking=K.stringToBoolOrDefault(e.disableExceptionTracking),e.autoTrackPageVisitTime=K.stringToBoolOrDefault(e.autoTrackPageVisitTime),e.overridePageViewDuration=K.stringToBoolOrDefault(e.overridePageViewDuration),(isNaN(e.samplingPercentage)||e.samplingPercentage<=0||100<=e.samplingPercentage)&&(e.samplingPercentage=100),e.isCookieUseDisabled=K.stringToBoolOrDefault(e.isCookieUseDisabled),e.isStorageUseDisabled=K.stringToBoolOrDefault(e.isStorageUseDisabled),e.isBrowserLinkTrackingEnabled=K.stringToBoolOrDefault(e.isBrowserLinkTrackingEnabled),e.enableAutoRouteTracking=K.stringToBoolOrDefault(e.enableAutoRouteTracking),e.namePrefix=e.namePrefix||"",e},Et.prototype.processTelemetry=function(e){for(var t=!1,n=this._telemetryInitializers.length,r=0;r<n;++r){var i=this._telemetryInitializers[r];if(i)try{if(!1===i.apply(null,[e])){t=!0;break}}catch(e){this._logger.throwInternal(u.CRITICAL,G,"One of telemetry initializers failed, telemetry item will not be sent: "+K.getExceptionName(e),{exception:K.dump(e)},!0)}}t||g.isNullOrUndefined(this._nextPlugin)||this._nextPlugin.processTelemetry(e)},Et.prototype.setNextPlugin=function(e){this._nextPlugin=e},Et.prototype.trackEvent=function(e,t){try{var n=dt.create(e,pe.dataType,pe.envelopeType,this._logger,t);this.core.track(n)}catch(e){this._logger.throwInternal(u.WARNING,A,"trackTrace failed, trace will not be collected: "+K.getExceptionName(e),{exception:K.dump(e)})}},Et.prototype.startTrackEvent=function(e){try{this._eventTracking.start(e)}catch(e){this._logger.throwInternal(u.CRITICAL,T,"startTrackEvent failed, event will not be collected: "+K.getExceptionName(e),{exception:K.dump(e)})}},Et.prototype.stopTrackEvent=function(e,t,n){try{this._eventTracking.stop(e,void 0,t)}catch(e){this._logger.throwInternal(u.CRITICAL,N,"stopTrackEvent failed, event will not be collected: "+K.getExceptionName(e),{exception:K.dump(e)})}},Et.prototype.trackTrace=function(e,t){try{var n=dt.create(e,et.dataType,et.envelopeType,this._logger,t);this.core.track(n)}catch(e){this._logger.throwInternal(u.WARNING,A,"trackTrace failed, trace will not be collected: "+K.getExceptionName(e),{exception:K.dump(e)})}},Et.prototype.trackMetric=function(e,t){try{var n=dt.create(e,Ue.dataType,Ue.envelopeType,this._logger,t);this.core.track(n)}catch(e){this._logger.throwInternal(u.CRITICAL,D,"trackMetric failed, metric will not be collected: "+K.getExceptionName(e),{exception:K.dump(e)})}},Et.prototype.trackPageView=function(e,t){try{var n=e||{};this._pageViewManager.trackPageView(n,o({},n.properties,n.measurements,t)),this.config.autoTrackPageVisitTime&&this._pageVisitTimeManager.trackPreviousPageVisit(n.name,n.uri)}catch(e){this._logger.throwInternal(u.CRITICAL,P,"trackPageView failed, page view will not be collected: "+K.getExceptionName(e),{exception:K.dump(e)})}},Et.prototype.sendPageViewInternal=function(e,t,n){"undefined"!=typeof document&&(e.refUri=e.refUri||document.referrer);var r=dt.create(e,je.dataType,je.envelopeType,this._logger,t,n);this.core.track(r),this._trackAjaxAttempts=0},Et.prototype.sendPageViewPerformanceInternal=function(e,t,n){var r=dt.create(e,ot.dataType,ot.envelopeType,this._logger,t,n);this.core.track(r)},Et.prototype.trackPageViewPerformance=function(e,t){try{this._pageViewPerformanceManager.populatePageViewPerformanceEvent(e),this.sendPageViewPerformanceInternal(e,t)}catch(e){this._logger.throwInternal(u.CRITICAL,P,"trackPageViewPerformance failed, page view will not be collected: "+K.getExceptionName(e),{exception:K.dump(e)})}},Et.prototype.startTrackPage=function(e){try{"string"!=typeof e&&(e=window.document&&window.document.title||""),this._pageTracking.start(e)}catch(e){this._logger.throwInternal(u.CRITICAL,E,"startTrackPage failed, page view may not be collected: "+K.getExceptionName(e),{exception:K.dump(e)})}},Et.prototype.stopTrackPage=function(e,t,n,r){try{"string"!=typeof e&&(e=window.document&&window.document.title||""),"string"!=typeof t&&(t=window.location&&window.location.href||""),this._pageTracking.stop(e,t,n,r),this.config.autoTrackPageVisitTime&&this._pageVisitTimeManager.trackPreviousPageVisit(e,t)}catch(e){this._logger.throwInternal(u.CRITICAL,k,"stopTrackPage failed, page view will not be collected: "+K.getExceptionName(e),{exception:K.dump(e)})}},Et.prototype.sendExceptionInternal=function(e,t,n){var r=new ye(this._logger,e.exception||new Error(K.NotSpecified),e.properties,e.measurements,e.severityLevel,e.id).toInterface(),i=dt.create(r,ye.dataType,ye.envelopeType,this._logger,t,n);this.core.track(i)},Et.prototype.trackException=function(e,t){try{this.sendExceptionInternal(e,t)}catch(e){this._logger.throwInternal(u.CRITICAL,x,"trackException failed, exception will not be collected: "+K.getExceptionName(e),{exception:K.dump(e)})}},Et.prototype._onerror=function(t){try{var e={url:t&&t.url||document.URL,lineNumber:t.lineNumber,columnNumber:t.columnNumber,message:t.message};if(K.isCrossOriginError(t.message,t.url,t.lineNumber,t.columnNumber,t.error))this._sendCORSException(e.url);else{if(!K.isError(t.error)){var n="window.onerror@"+e.url+":"+t.lineNumber+":"+(t.columnNumber||0);t.error=new Error(t.message),t.error.stack=n}this.trackException({exception:t.error,severityLevel:lt.Error},e)}}catch(e){var r=t.error?t.error.name+", "+t.error.message:"null";this._logger.throwInternal(u.CRITICAL,_,"_onError threw exception while logging error, error will not be collected: "+K.getExceptionName(e),{exception:K.dump(e),errorString:r})}},Et.prototype.addTelemetryInitializer=function(e){this._telemetryInitializers.push(e)},Et.prototype._initialize=function(e,t,n){var o=this;if(!this._isInitialized){if(g.isNullOrUndefined(t))throw Error("Error initializing");this.core=t,this._logger=t.logger,this._globalconfig={instrumentationKey:e.instrumentationKey,endpointUrl:e.endpointUrl||"https://dc.services.visualstudio.com/v2/track"},this.config=e.extensionConfig&&e.extensionConfig[this.identifier]?e.extensionConfig[this.identifier]:{};var r=Et.getDefaultConfig();if(void 0!==r){for(var i in r)this.config[i]=gt.getConfig(e,i,this.identifier,r[i]);if(this._globalconfig)for(var i in r)void 0===this._globalconfig[i]&&(this._globalconfig[i]=r[i])}this.config.isCookieUseDisabled&&K.disableCookies(),this.config.isStorageUseDisabled&&K.disableStorage();var a={instrumentationKey:function(){return e.instrumentationKey},accountId:function(){return o.config.accountId||e.accountId},sessionRenewalMs:function(){return o.config.sessionRenewalMs||e.sessionRenewalMs},sessionExpirationMs:function(){return o.config.sessionExpirationMs||e.sessionExpirationMs},sampleRate:function(){return o.config.samplingPercentage||e.samplingPercentage},cookieDomain:function(){return o.config.cookieDomain||e.cookieDomain},sdkExtension:function(){return o.config.sdkExtension||e.sdkExtension},isBrowserLinkTrackingEnabled:function(){return o.config.isBrowserLinkTrackingEnabled||e.isBrowserLinkTrackingEnabled},appId:function(){return o.config.appId||e.appId}};this._pageViewPerformanceManager=new _t(this.core),this._pageViewManager=new mt(this,this.config.overridePageViewDuration,this.core,this._pageViewPerformanceManager),this._pageVisitTimeManager=new wt(this._logger,function(e,t,n){return o.trackPageVisitTime(e,t,n)}),this._telemetryInitializers=[],this._addDefaultTelemetryInitializers(a),this._eventTracking=new kt(this._logger,"trackEvent"),this._eventTracking.action=function(e,t,n,r){r||(r={}),r[Tt]=n.toString(),o.trackEvent({name:e,properties:r})},this._pageTracking=new kt(this._logger,"trackPageView"),this._pageTracking.action=function(e,t,n,r,i){g.isNullOrUndefined(r)&&(r={}),r[Tt]=n.toString();var a={name:e,uri:t,properties:r,measurements:i};o.sendPageViewInternal(a)};var s,c,l=this;if(!1===this.config.disableExceptionTracking&&!this.config.autoExceptionInstrumented){var u=window.onerror;window.onerror=function(e,t,n,r,i){var a=u&&u(e,t,n,r,i);return!0!==a&&l._onerror({message:e,url:t,lineNumber:n,columnNumber:r,error:i}),a},this.config.autoExceptionInstrumented=!0}if(!0===this.config.enableAutoRouteTracking&&"object"==typeof history&&"function"==typeof history.pushState&&"function"==typeof history.replaceState&&"object"==typeof window){var p=this;n.forEach(function(e){"AppInsightsPropertiesPlugin"===e.identifier&&(o._properties=e)}),history.pushState=(c=history.pushState,function(){var e=c.apply(this,arguments);return window.dispatchEvent(new Event(p.config.namePrefix+"pushState")),window.dispatchEvent(new Event(p.config.namePrefix+"locationchange")),e}),history.replaceState=(s=history.replaceState,function(){var e=s.apply(this,arguments);return window.dispatchEvent(new Event(p.config.namePrefix+"replaceState")),window.dispatchEvent(new Event(p.config.namePrefix+"locationchange")),e}),window.addEventListener(p.config.namePrefix+"popstate",function(){window.dispatchEvent(new Event(p.config.namePrefix+"locationchange"))}),window.addEventListener(p.config.namePrefix+"locationchange",function(){p._properties&&p._properties.context&&p._properties.context.telemetryTrace&&(p._properties.context.telemetryTrace.traceID=K.newId(),p._properties.context.telemetryTrace.name=window.location.pathname),p.trackPageView({properties:{duration:0}})})}this._isInitialized=!0}},Et.prototype.trackPageVisitTime=function(e,t,n){var r={PageName:e,PageUrl:t};this.trackMetric({name:"PageVisitTime",average:n,max:n,min:n,sampleCount:1},r)},Et.prototype._addDefaultTelemetryInitializers=function(e){if(!e.isBrowserLinkTrackingEnabled()){var r=["/browserLinkSignalR/","/__browserLink/"];this._addTelemetryInitializer(function(e){if(e.baseType===Fe.dataType){var t=e.baseData;if(t)for(var n=0;n<r.length;n++)if(t.target&&0<=t.target.indexOf(r[n]))return!1}return!0})}},Et.prototype._addTelemetryInitializer=function(e){this._telemetryInitializers.push(e)},Et.prototype._sendCORSException=function(e){var t={message:"Script error: The browser's same-origin policy prevents us from getting the details of this exception. Consider using the 'crossorigin' attribute.",url:e,lineNumber:0,columnNumber:0,error:void 0},n=dt.create(t,ye.dataType,ye.envelopeType,this._logger,{url:e});this.core.track(n)},Et.Version="2.1.0",Et);function Et(){this.identifier="ApplicationInsightsAnalytics",this.priority=180,this._isInitialized=!1,this._trackAjaxAttempts=0,this.initialize=this._initialize.bind(this)}var kt=(xt.prototype.start=function(e){void 0!==this._events[e]&&this._logger.throwInternal(u.WARNING,O,"start was called more than once for this event without calling stop.",{name:this._name,key:e},!0),this._events[e]=+new Date},xt.prototype.stop=function(e,t,n,r){var i=this._events[e];if(isNaN(i))this._logger.throwInternal(u.WARNING,z,"stop was called without a corresponding start.",{name:this._name,key:e},!0);else{var a=+new Date,o=Z.GetDuration(i,a);this.action(e,t,o,n,r)}delete this._events[e],this._events[e]=void 0},xt);function xt(e,t){this._name=t,this._events={},this._logger=e}e.ApplicationInsights=Nt,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=applicationinsights-analytics-js.min.js.map |
@@ -5,3 +5,4 @@ /** | ||
*/ | ||
import { Util, PageViewPerformance, PageView, RemoteDependencyData, Event, TelemetryItemCreator, Metric, Exception, SeverityLevel, Trace, ConfigurationManager, DateTimeUtils } from "@microsoft/applicationinsights-common"; | ||
import * as tslib_1 from "tslib"; | ||
import { Util, PageViewPerformance, PageView, RemoteDependencyData, Event as EventTelemetry, TelemetryItemCreator, Metric, Exception, SeverityLevel, Trace, ConfigurationManager, DateTimeUtils, PropertiesPluginIdentifier } from "@microsoft/applicationinsights-common"; | ||
import { CoreUtils, LoggingSeverity, _InternalMessageId, } from "@microsoft/applicationinsights-core-js"; | ||
@@ -16,3 +17,3 @@ import { PageViewManager } from "./Telemetry/PageViewManager"; | ||
this.identifier = "ApplicationInsightsAnalytics"; // do not change name or priority | ||
this.priority = 160; // take from reserved priority range 100- 200 | ||
this.priority = 180; // take from reserved priority range 100- 200 | ||
this._isInitialized = false; | ||
@@ -42,2 +43,4 @@ // Counts number of trackAjax invokations. | ||
config.isBrowserLinkTrackingEnabled = Util.stringToBoolOrDefault(config.isBrowserLinkTrackingEnabled); | ||
config.enableAutoRouteTracking = Util.stringToBoolOrDefault(config.enableAutoRouteTracking); | ||
config.namePrefix = config.namePrefix || ""; | ||
return config; | ||
@@ -73,4 +76,3 @@ }; | ||
try { | ||
var telemetryItem = TelemetryItemCreator.create(event, Event.dataType, Event.envelopeType, this._logger, customProperties); | ||
this._setTelemetryNameAndIKey(telemetryItem); | ||
var telemetryItem = TelemetryItemCreator.create(event, EventTelemetry.dataType, EventTelemetry.envelopeType, this._logger, customProperties); | ||
this.core.track(telemetryItem); | ||
@@ -117,3 +119,2 @@ } | ||
var telemetryItem = TelemetryItemCreator.create(trace, Trace.dataType, Trace.envelopeType, this._logger, customProperties); | ||
this._setTelemetryNameAndIKey(telemetryItem); | ||
this.core.track(telemetryItem); | ||
@@ -139,3 +140,2 @@ } | ||
var telemetryItem = TelemetryItemCreator.create(metric, Metric.dataType, Metric.envelopeType, this._logger, customProperties); | ||
this._setTelemetryNameAndIKey(telemetryItem); | ||
this.core.track(telemetryItem); | ||
@@ -156,3 +156,3 @@ } | ||
var inPv = pageView || {}; | ||
this._pageViewManager.trackPageView(inPv, customProperties); | ||
this._pageViewManager.trackPageView(inPv, tslib_1.__assign({}, inPv.properties, inPv.measurements, customProperties)); | ||
if (this.config.autoTrackPageVisitTime) { | ||
@@ -177,4 +177,2 @@ this._pageVisitTimeManager.trackPreviousPageVisit(inPv.name, inPv.uri); | ||
var telemetryItem = TelemetryItemCreator.create(pageView, PageView.dataType, PageView.envelopeType, this._logger, properties, systemProperties); | ||
// set instrumentation key | ||
this._setTelemetryNameAndIKey(telemetryItem); | ||
this.core.track(telemetryItem); | ||
@@ -191,4 +189,2 @@ // reset ajaxes counter | ||
var telemetryItem = TelemetryItemCreator.create(pageViewPerformance, PageViewPerformance.dataType, PageViewPerformance.envelopeType, this._logger, properties, systemProperties); | ||
// set instrumentation key | ||
this._setTelemetryNameAndIKey(telemetryItem); | ||
this.core.track(telemetryItem); | ||
@@ -261,3 +257,2 @@ }; | ||
var telemetryItem = TelemetryItemCreator.create(exceptionPartB, Exception.dataType, Exception.envelopeType, this._logger, customProperties, systemProperties); | ||
this._setTelemetryNameAndIKey(telemetryItem); | ||
this.core.track(telemetryItem); | ||
@@ -289,3 +284,3 @@ }; | ||
try { | ||
var properties = { | ||
var properties_1 = { | ||
url: (exception && exception.url) || document.URL, | ||
@@ -297,11 +292,11 @@ lineNumber: exception.lineNumber, | ||
if (Util.isCrossOriginError(exception.message, exception.url, exception.lineNumber, exception.columnNumber, exception.error)) { | ||
this._sendCORSException(properties.url); | ||
this._sendCORSException(properties_1.url); | ||
} | ||
else { | ||
if (!Util.isError(exception.error)) { | ||
var stack = "window.onerror@" + properties.url + ":" + exception.lineNumber + ":" + (exception.columnNumber || 0); | ||
var stack = "window.onerror@" + properties_1.url + ":" + exception.lineNumber + ":" + (exception.columnNumber || 0); | ||
exception.error = new Error(exception.message); | ||
exception.error.stack = stack; | ||
} | ||
this.trackException({ exception: exception.error, severityLevel: SeverityLevel.Error }, properties); | ||
this.trackException({ exception: exception.error, severityLevel: SeverityLevel.Error }, properties_1); | ||
} | ||
@@ -399,2 +394,3 @@ } | ||
}; | ||
var instance = this; | ||
if (this.config.disableExceptionTracking === false && | ||
@@ -405,7 +401,6 @@ !this.config.autoExceptionInstrumented) { | ||
var originalOnError_1 = window[onerror_1]; | ||
var instance_1 = this; | ||
window.onerror = function (message, url, lineNumber, columnNumber, error) { | ||
var handled = originalOnError_1 && originalOnError_1(message, url, lineNumber, columnNumber, error); | ||
if (handled !== true) { | ||
instance_1._onerror({ | ||
instance._onerror({ | ||
message: message, | ||
@@ -422,2 +417,38 @@ url: url, | ||
} | ||
/** | ||
* Create a custom "locationchange" event which is triggered each time the history object is changed | ||
*/ | ||
if (this.config.enableAutoRouteTracking === true | ||
&& typeof history === "object" && typeof history.pushState === "function" && typeof history.replaceState === "function" | ||
&& typeof window === "object") { | ||
var _self_1 = this; | ||
// Find the properties plugin | ||
extensions.forEach(function (extension) { | ||
if (extension.identifier === PropertiesPluginIdentifier) { | ||
_this._properties = extension; | ||
} | ||
}); | ||
history.pushState = (function (f) { return function pushState() { | ||
var ret = f.apply(this, arguments); | ||
window.dispatchEvent(new Event(_self_1.config.namePrefix + "pushState")); | ||
window.dispatchEvent(new Event(_self_1.config.namePrefix + "locationchange")); | ||
return ret; | ||
}; })(history.pushState); | ||
history.replaceState = (function (f) { return function replaceState() { | ||
var ret = f.apply(this, arguments); | ||
window.dispatchEvent(new Event(_self_1.config.namePrefix + "replaceState")); | ||
window.dispatchEvent(new Event(_self_1.config.namePrefix + "locationchange")); | ||
return ret; | ||
}; })(history.replaceState); | ||
window.addEventListener(_self_1.config.namePrefix + "popstate", function () { | ||
window.dispatchEvent(new Event(_self_1.config.namePrefix + "locationchange")); | ||
}); | ||
window.addEventListener(_self_1.config.namePrefix + "locationchange", function () { | ||
if (_self_1._properties && _self_1._properties.context && _self_1._properties.context.telemetryTrace) { | ||
_self_1._properties.context.telemetryTrace.traceID = Util.newId(); | ||
_self_1._properties.context.telemetryTrace.name = window.location.pathname; | ||
} | ||
_self_1.trackPageView({ properties: { duration: 0 } }); // SPA route change loading durations are undefined, so send 0 | ||
}); | ||
} | ||
this._isInitialized = true; | ||
@@ -473,9 +504,3 @@ }; | ||
}; | ||
// Mutate telemetryItem inplace to add boilerplate iKey & name info | ||
ApplicationInsights.prototype._setTelemetryNameAndIKey = function (telemetryItem) { | ||
telemetryItem.iKey = this._globalconfig.instrumentationKey; | ||
var iKeyNoDashes = this._globalconfig.instrumentationKey.replace(/-/g, ""); | ||
telemetryItem.name = telemetryItem.name.replace("{0}", iKeyNoDashes); | ||
}; | ||
ApplicationInsights.Version = "2.0.1"; // Not currently used anywhere | ||
ApplicationInsights.Version = "2.1.0"; // Not currently used anywhere | ||
return ApplicationInsights; | ||
@@ -482,0 +507,0 @@ }()); |
/*! | ||
* Application Insights JavaScript SDK - Web Analytics, 2.0.1 | ||
* Application Insights JavaScript SDK - Web Analytics, 2.1.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 i,t,f,n;(t=i||(i={}))[t.LocalStorage=0]="LocalStorage",t[t.SessionStorage=1]="SessionStorage",(n=f||(f={}))[n.Default=0]="Default",n[n.Required=1]="Required",n[n.Array=2]="Array",n[n.Hidden=4]="Hidden";var u=(r.isNullOrUndefined=function(e){return null==e},r.disableCookies=function(){r._canUseCookies=!1},r.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(o,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},r);function r(){}var p,a,o=/[xy]/g;(a=p||(p={}))[a.CRITICAL=1]="CRITICAL",a[a.WARNING=2]="WARNING";var s=1,c=2,l=3,g=4,d=5,m=6,h=8,v=10,y=11,w=25,S=29,_=30,I=31,T=32,N=35,E=36,k=37,D=38,x=39,b=45,P=49,A=52,C=56,M=57,R=61,U=62,L=63,V=64,O=66,z=68,G=69;q.prototype.processTelemetry=function(t){this.channelQueue.forEach(function(e){0<e.length&&e[0].processTelemetry(t)})},Object.defineProperty(q.prototype,"ChannelControls",{get:function(){return this.channelQueue},enumerable:!0,configurable:!0}),q.prototype.initialize=function(n,r,i){var a=this;if(n.isCookieUseDisabled&&u.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<j&&(o=e.identifier),e.initialize(n,r,i)}),o)throw Error(B+o);for(var t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);a.channelQueue.push(e)}})}for(var e=new Array,t=0;t<i.length;t++){var s=i[t];s.priority>j&&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,i)}),t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);this.channelQueue.push(e)}};function q(){this.identifier="ChannelControllerPlugin",this.priority=j}var j=500,B="Channel has invalid priority",H=(K.sanitizeKeyAndAddUniqueness=function(e,t,n){var r=t.length,i=K.sanitizeKey(e,t);if(i.length!==r){for(var a=0,o=i;void 0!==n[o];)a++,o=i.substring(0,K.MAX_NAME_LENGTH-3)+K.padNumber(a);i=o}return i},K.sanitizeKey=function(e,t){var n;return t&&(t=K.trim(t.toString())).length>K.MAX_NAME_LENGTH&&(n=t.substring(0,K.MAX_NAME_LENGTH),e.throwInternal(p.WARNING,M,"name is too long. It has been truncated to "+K.MAX_NAME_LENGTH+" characters.",{name:t},!0)),n||t},K.sanitizeString=function(e,t,n){var r;return void 0===n&&(n=K.MAX_STRING_LENGTH),t&&(n=n||K.MAX_STRING_LENGTH,(t=K.trim(t)).toString().length>n&&(r=t.toString().substring(0,n),e.throwInternal(p.WARNING,R,"string value is too long. It has been truncated to "+n+" characters.",{value:t},!0))),r||t},K.sanitizeUrl=function(e,t){return K.sanitizeInput(e,t,K.MAX_URL_LENGTH,O)},K.sanitizeMessage=function(e,t){var n;return t&&t.length>K.MAX_MESSAGE_LENGTH&&(n=t.substring(0,K.MAX_MESSAGE_LENGTH),e.throwInternal(p.WARNING,C,"message is too long, it has been truncated to "+K.MAX_MESSAGE_LENGTH+" characters.",{message:t},!0)),n||t},K.sanitizeException=function(e,t){var n;return t&&t.length>K.MAX_EXCEPTION_LENGTH&&(n=t.substring(0,K.MAX_EXCEPTION_LENGTH),e.throwInternal(p.WARNING,A,"exception is too long, it has been truncated to "+K.MAX_EXCEPTION_LENGTH+" characters.",{exception:t},!0)),n||t},K.sanitizeProperties=function(t,e){if(e){var n={};for(var r in e){var i=e[r];if("object"==typeof i&&"undefined"!=typeof JSON)try{i=JSON.stringify(i)}catch(e){t.throwInternal(p.WARNING,P,"custom property is not valid",{exception:e},!0)}i=K.sanitizeString(t,i,K.MAX_PROPERTY_LENGTH),n[r=K.sanitizeKeyAndAddUniqueness(t,r,n)]=i}e=n}return e},K.sanitizeMeasurements=function(e,t){if(t){var n={};for(var r in t){var i=t[r];n[r=K.sanitizeKeyAndAddUniqueness(e,r,n)]=i}t=n}return t},K.sanitizeId=function(e,t){return t?K.sanitizeInput(e,t,K.MAX_ID_LENGTH,G).toString():t},K.sanitizeInput=function(e,t,n,r){var i;return t&&(t=K.trim(t)).length>n&&(i=t.substring(0,n),e.throwInternal(p.WARNING,r,"input is too long, it has been truncated to "+n+" characters.",{data:t},!0)),i||t},K.padNumber=function(e){var t="00"+e;return t.substr(t.length-3)},K.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},K.MAX_NAME_LENGTH=150,K.MAX_ID_LENGTH=128,K.MAX_PROPERTY_LENGTH=8192,K.MAX_STRING_LENGTH=1024,K.MAX_URL_LENGTH=2048,K.MAX_MESSAGE_LENGTH=32768,K.MAX_EXCEPTION_LENGTH=32768,K);function K(){}var X=(W.disableStorage=function(){W._canUseLocalStorage=!1,W._canUseSessionStorage=!1},W._getLocalStorageObject=function(){return W.canUseLocalStorage()?W._getVerifiedStorageObject(i.LocalStorage):null},W._getVerifiedStorageObject=function(e){var t,n,r=null;try{if("undefined"==typeof window)return null;n=new Date,(r=e===i.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},W.isInternalApplicationInsightsEndpoint=function(e){return-1!==W._internalEndpoints.indexOf(e.toLowerCase())},W.canUseLocalStorage=function(){return void 0===W._canUseLocalStorage&&(W._canUseLocalStorage=!!W._getVerifiedStorageObject(i.LocalStorage)),W._canUseLocalStorage},W.getStorage=function(t,e){var n=W._getLocalStorageObject();if(null!==n)try{return n.getItem(e)}catch(e){W._canUseLocalStorage=!1,t.throwInternal(p.WARNING,s,"Browser failed read of local storage. "+W.getExceptionName(e),{exception:W.dump(e)})}return null},W.setStorage=function(t,e,n){var r=W._getLocalStorageObject();if(null!==r)try{return r.setItem(e,n),!0}catch(e){W._canUseLocalStorage=!1,t.throwInternal(p.WARNING,l,"Browser failed write to local storage. "+W.getExceptionName(e),{exception:W.dump(e)})}return!1},W.removeStorage=function(t,e){var n=W._getLocalStorageObject();if(null!==n)try{return n.removeItem(e),!0}catch(e){W._canUseLocalStorage=!1,t.throwInternal(p.WARNING,d,"Browser failed removal of local storage item. "+W.getExceptionName(e),{exception:W.dump(e)})}return!1},W._getSessionStorageObject=function(){return W.canUseSessionStorage()?W._getVerifiedStorageObject(i.SessionStorage):null},W.canUseSessionStorage=function(){return void 0===W._canUseSessionStorage&&(W._canUseSessionStorage=!!W._getVerifiedStorageObject(i.SessionStorage)),W._canUseSessionStorage},W.getSessionStorageKeys=function(){var e=[];if(W.canUseSessionStorage())for(var t in window.sessionStorage)e.push(t);return e},W.getSessionStorage=function(t,e){var n=W._getSessionStorageObject();if(null!==n)try{return n.getItem(e)}catch(e){W._canUseSessionStorage=!1,t.throwInternal(p.WARNING,c,"Browser failed read of session storage. "+W.getExceptionName(e),{exception:W.dump(e)})}return null},W.setSessionStorage=function(t,e,n){var r=W._getSessionStorageObject();if(null!==r)try{return r.setItem(e,n),!0}catch(e){W._canUseSessionStorage=!1,t.throwInternal(p.WARNING,g,"Browser failed write to session storage. "+W.getExceptionName(e),{exception:W.dump(e)})}return!1},W.removeSessionStorage=function(t,e){var n=W._getSessionStorageObject();if(null!==n)try{return n.removeItem(e),!0}catch(e){W._canUseSessionStorage=!1,t.throwInternal(p.WARNING,m,"Browser failed removal of session storage item. "+W.getExceptionName(e),{exception:W.dump(e)})}return!1},W.disableCookies=function(){u.disableCookies()},W.canUseCookies=function(t){if(void 0===u._canUseCookies){u._canUseCookies=!1;try{u._canUseCookies=void 0!==W.document.cookie}catch(e){t.throwInternal(p.WARNING,z,"Cannot access document.cookie - "+W.getExceptionName(e),{exception:W.dump(e)})}}return u._canUseCookies},W.setCookie=function(e,t,n,r){var i="",a="";r&&(i=";domain="+r),W.document.location&&"https:"===W.document.location.protocol&&(a=";secure"),W.canUseCookies(e)&&(W.document.cookie=t+"="+n+i+";path=/"+a)},W.stringToBoolOrDefault=function(e,t){return void 0===t&&(t=!1),null==e?t:"true"===e.toString().toLowerCase()},W.getCookie=function(e,t){if(W.canUseCookies(e)){var n="";if(t&&t.length)for(var r=t+"=",i=W.document.cookie.split(";"),a=0;a<i.length;a++){var o=i[a];if((o=W.trim(o))&&0===o.indexOf(r)){n=o.substring(r.length,i[a].length);break}}return n}},W.deleteCookie=function(e,t){W.canUseCookies(e)&&(W.document.cookie=t+"=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;")},W.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},W.newId=function(){for(var e="",t=1073741824*Math.random();0<t;)e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t%64),t=Math.floor(t/64);return e},W.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},W.isError=function(e){return"[object Error]"===Object.prototype.toString.call(e)},W.isDate=function(e){return"[object Date]"===Object.prototype.toString.call(e)},W.toISOStringForIE8=function(e){if(W.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"}},W.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},W.msToTimeSpan=function(e){(isNaN(e)||e<0)&&(e=0);var t=""+(e=Math.round(e))%1e3,n=""+Math.floor(e/1e3)%60,r=""+Math.floor(e/6e4)%60,i=""+Math.floor(e/36e5)%24,a=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<a?a+".":"")+(i=i.length<2?"0"+i:i)+":"+r+":"+n+"."+t},W.isCrossOriginError=function(e,t,n,r,i){return("Script error."===e||"Script error"===e)&&!i},W.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},W.getExceptionName=function(e){return"[object Error]"===Object.prototype.toString.call(e)?e.name:""},W.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},W.IsBeaconApiSupported=function(){return"sendBeacon"in navigator&&navigator.sendBeacon},W.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},W.document="undefined"!=typeof document?document:{},W._canUseLocalStorage=void 0,W._canUseSessionStorage=void 0,W._internalEndpoints=["https://dc.services.visualstudio.com/v2/track","https://breeze.aimon.applicationinsights.io/v2/track","https://dc-int.services.visualstudio.com/v2/track"],W.NotSpecified="not_specified",W);function W(){}var F=(J.parseUrl=function(e){return J.htmlAnchorElement||(J.htmlAnchorElement=J.document.createElement?J.document.createElement("a"):{host:J.parseHost(e)}),J.htmlAnchorElement.href=e,J.htmlAnchorElement},J.getAbsoluteUrl=function(e){var t,n=J.parseUrl(e);return n&&(t=n.href),t},J.getPathName=function(e){var t,n=J.parseUrl(e);return n&&(t=n.pathname),t},J.getCompleteUrl=function(e,t){return e?e.toUpperCase()+" "+t:t},J.parseHost=function(e){var t=e.match(/:\/\/(www[0-9]?\.)?(.[^/:]+)/i);return null!=t&&2<t.length&&"string"==typeof t[2]&&0<t[2].length?t[2]:null},J.document="undefined"!=typeof document?document:{},J);function J(){}var Q=(Y.ParseDependencyPath=function(e,t,n,r){var i,a=r,o=r;if(t&&0<t.length){var s=F.parseUrl(t);if(i=s.host,!a)if(null!=s.pathname){var c=0===s.pathname.length?"/":s.pathname;"/"!==c.charAt(0)&&(c="/"+c),o=s.pathname,a=H.sanitizeString(e,n?n+" "+c:c)}else a=H.sanitizeString(e,t)}else a=i=r;return{target:i,name:a,data:o}},Y);function Y(){}var $=(Z.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()},Z.GetDuration=function(e,t){var n=null;return 0===e||0===t||u.isNullOrUndefined(e)||u.isNullOrUndefined(t)||(n=t-e),n},Z);function Z(){}var ee=function(e,t){return(ee=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 te(e,t){function n(){this.constructor=e}ee(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var ne,re=function(){return(re=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},ie=(te(ae,ne=function(){}),ae);function ae(){return ne.call(this)||this}var oe;te(se,oe=function(){this.ver=1,this.sampleRate=100,this.tags={}});function se(e,t,n){var r=oe.call(this)||this;return r.name=H.sanitizeString(e,n)||X.NotSpecified,r.data=t,r.time=X.toISOStringForIE8(new Date),r.aiDataContract={time:f.Required,iKey:f.Required,name:f.Required,sampleRate:function(){return 100==r.sampleRate?f.Hidden:f.Required},tags:f.Required,data:f.Required},r}function ce(){}var le,ue=(te(pe,le=ce),pe);function pe(){var e=le.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var ge,fe=(te(de,ge=ue),de.envelopeType="Microsoft.ApplicationInsights.{0}.Event",de.dataType="EventData",de);function de(e,t,n,r){var i=ge.call(this)||this;return i.aiDataContract={ver:f.Required,name:f.Required,properties:f.Default,measurements:f.Default},i.name=H.sanitizeString(e,t)||X.NotSpecified,i.properties=H.sanitizeProperties(e,n),i.measurements=H.sanitizeMeasurements(e,r),i}function me(){}var he,ve=(te(ye,he=ce),ye);function ye(){var e=he.call(this)||this;return e.ver=2,e.exceptions=[],e.properties={},e.measurements={},e}function we(){this.hasFullStack=!0,this.parsedStack=[]}var Se,_e=(te(Ie,Se=ve),Ie.CreateFromInterface=function(t,e){var n=e.exceptions&&e.exceptions.map(function(e){return Ne.CreateFromInterface(t,e)});return new Ie(t,re({},e,{exceptions:n}))},Ie.prototype.toInterface=function(){var e=this,t=e.exceptions,n=e.properties,r=e.measurements,i=e.severityLevel,a=e.ver,o=e.problemGroup,s=e.id,c=e.isManual;return{ver:a,exceptions:t instanceof Array&&t.map(function(e){return e.toInterface()})||void 0,severityLevel:i,properties:n,measurements:r,problemGroup:o,id:s,isManual:c}},Ie.CreateSimpleException=function(e,t,n,r,i,a){return{exceptions:[{hasFullStack:!0,message:e,stack:i,typeName:t}]}},Ie.envelopeType="Microsoft.ApplicationInsights.{0}.Exception",Ie.dataType="ExceptionData",Ie);function Ie(e,t,n,r,i,a){var o=Se.call(this)||this;return o.aiDataContract={ver:f.Required,exceptions:f.Required,severityLevel:f.Default,properties:f.Default,measurements:f.Default},t instanceof Error?(o.exceptions=[new Ne(e,t)],o.properties=H.sanitizeProperties(e,n),o.measurements=H.sanitizeMeasurements(e,r),i&&(o.severityLevel=i),a&&(o.id=a)):(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),u.isNullOrUndefined(t.ver)||(o.ver=t.ver),u.isNullOrUndefined(t.isManual)||(o.isManual=t.isManual)),o}var Te,Ne=(te(Ee,Te=we),Ee.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}},Ee.CreateFromInterface=function(e,t){var n=t.parsedStack instanceof Array&&t.parsedStack.map(function(e){return De.CreateFromInterface(e)})||t.parsedStack;return new Ee(e,re({},t,{parsedStack:n}))},Ee.parseStack=function(e){var t=void 0;if("string"==typeof e){var n=e.split("\n");t=[];for(var r=0,i=0,a=0;a<=n.length;a++){var o=n[a];if(De.regex.test(o)){var s=new De(n[a],r++);i+=s.sizeInBytes,t.push(s)}}if(32768<i)for(var c=0,l=t.length-1,u=0,p=c,g=l;c<l;){if(32768<(u+=t[c].sizeInBytes+t[l].sizeInBytes)){var f=g-p+1;t.splice(p,f);break}p=c,g=l,c++,l--}}return t},Ee);function Ee(e,t){var n=Te.call(this)||this;if(n.aiDataContract={id:f.Default,outerId:f.Default,typeName:f.Required,message:f.Required,hasFullStack:f.Default,stack:f.Default,parsedStack:f.Array},t instanceof Error){n.typeName=H.sanitizeString(e,t.name)||X.NotSpecified,n.message=H.sanitizeMessage(e,t.message)||X.NotSpecified;var r=t.stack;n.parsedStack=Ee.parseStack(r),n.stack=H.sanitizeException(e,r),n.hasFullStack=X.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 ke,De=(te(xe,ke=me),xe.CreateFromInterface=function(e){return new xe(e,null)},xe.prototype.toInterface=function(){return{level:this.level,method:this.method,assembly:this.assembly,fileName:this.fileName,line:this.line}},xe.regex=/^([\s]+at)?(.*?)(\@|\s\(|\s)([^\(\@\n]+):([0-9]+):([0-9]+)(\)?)$/,xe.baseSize=58,xe);function xe(e,t){var n=ke.call(this)||this;if(n.sizeInBytes=0,n.aiDataContract={level:f.Required,method:f.Required,assembly:f.Default,fileName:f.Default,line:f.Default},"string"==typeof e){var r=e;n.level=t,n.method="<no_method>",n.assembly=X.trim(r),n.fileName="",n.line=0;var i=r.match(xe.regex);i&&5<=i.length&&(n.method=X.trim(i[2])||n.method,n.fileName=X.trim(i[4]),n.line=parseInt(i[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+=xe.baseSize,n.sizeInBytes+=n.level.toString().length,n.sizeInBytes+=n.line.toString().length,n}var be,Pe,Ae,Ce=(te(Me,be=ce),Me);function Me(){var e=be.call(this)||this;return e.ver=2,e.metrics=[],e.properties={},e}(Ae=Pe||(Pe={}))[Ae.Measurement=0]="Measurement",Ae[Ae.Aggregation=1]="Aggregation";var Re,Ue=(te(Le,Re=function(){this.kind=Pe.Measurement}),Le);function Le(){var e=null!==Re&&Re.apply(this,arguments)||this;return e.aiDataContract={name:f.Required,kind:f.Default,value:f.Required,count:f.Default,min:f.Default,max:f.Default,stdDev:f.Default},e}var Ve,Oe=(te(ze,Ve=Ce),ze.envelopeType="Microsoft.ApplicationInsights.{0}.Metric",ze.dataType="MetricData",ze);function ze(e,t,n,r,i,a,o){var s=Ve.call(this)||this;s.aiDataContract={ver:f.Required,metrics:f.Required,properties:f.Default};var c=new Ue;return c.count=0<r?r:void 0,c.max=isNaN(a)||null===a?void 0:a,c.min=isNaN(i)||null===i?void 0:i,c.name=H.sanitizeString(e,t)||X.NotSpecified,c.value=n,s.metrics=[c],s.properties=H.sanitizeProperties(e,o),s}var Ge,qe=(te(je,Ge=ue),je);function je(){var e=Ge.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var Be,He=(te(Ke,Be=qe),Ke.envelopeType="Microsoft.ApplicationInsights.{0}.Pageview",Ke.dataType="PageviewData",Ke);function Ke(e,t,n,r,i,a,o){var s=Be.call(this)||this;return s.aiDataContract={ver:f.Required,name:f.Default,url:f.Default,duration:f.Default,properties:f.Default,measurements:f.Default,id:f.Default},s.id=H.sanitizeId(e,o),s.url=H.sanitizeUrl(e,n),s.name=H.sanitizeString(e,t)||X.NotSpecified,isNaN(r)||(s.duration=X.msToTimeSpan(r)),s.properties=H.sanitizeProperties(e,i),s.measurements=H.sanitizeMeasurements(e,a),s}var Xe,We=(te(Fe,Xe=ce),Fe);function Fe(){var e=Xe.call(this)||this;return e.ver=2,e.success=!0,e.properties={},e.measurements={},e}var Je,Qe=(te(Ye,Je=We),Ye.envelopeType="Microsoft.ApplicationInsights.{0}.RemoteDependency",Ye.dataType="RemoteDependencyData",Ye);function Ye(e,t,n,r,i,a,o,s,c,l,u){void 0===c&&(c="Ajax");var p=Je.call(this)||this;p.aiDataContract={id:f.Required,ver:f.Required,name:f.Default,resultCode:f.Default,duration:f.Default,success:f.Default,data:f.Default,target:f.Default,type:f.Default,properties:f.Default,measurements:f.Default,kind:f.Default,value:f.Default,count:f.Default,min:f.Default,max:f.Default,stdDev:f.Default,dependencyKind:f.Default,dependencySource:f.Default,commandName:f.Default,dependencyTypeName:f.Default},p.id=t,p.duration=X.msToTimeSpan(i),p.success=a,p.resultCode=o+"",p.type=H.sanitizeString(e,c);var g=Q.ParseDependencyPath(e,n,s,r);return p.data=H.sanitizeUrl(e,r)||g.data,p.target=g.target,p.name=g.name,p.properties=H.sanitizeProperties(e,l),p.measurements=H.sanitizeMeasurements(e,u),p}var $e,Ze=(te(et,$e=ce),et);function et(){var e=$e.call(this)||this;return e.ver=2,e.properties={},e}var tt,nt=(te(rt,tt=Ze),rt.envelopeType="Microsoft.ApplicationInsights.{0}.Message",rt.dataType="MessageData",rt);function rt(e,t,n,r){var i=tt.call(this)||this;return i.aiDataContract={ver:f.Required,message:f.Required,severityLevel:f.Default,properties:f.Default},t=t||X.NotSpecified,i.message=H.sanitizeMessage(e,t),i.properties=H.sanitizeProperties(e,r),n&&(i.severityLevel=n),i}var it,at=(te(ot,it=qe),ot);function ot(){var e=it.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var st,ct=(te(lt,st=at),lt.envelopeType="Microsoft.ApplicationInsights.{0}.PageviewPerformance",lt.dataType="PageviewPerformanceData",lt);function lt(e,t,n,r,i,a,o){var s=st.call(this)||this;return s.aiDataContract={ver:f.Required,name:f.Default,url:f.Default,duration:f.Default,perfTotal:f.Default,networkConnect:f.Default,sentRequest:f.Default,receivedResponse:f.Default,domProcessing:f.Default,properties:f.Default,measurements:f.Default},s.url=H.sanitizeUrl(e,n),s.name=H.sanitizeString(e,t)||X.NotSpecified,s.properties=H.sanitizeProperties(e,i),s.measurements=H.sanitizeMeasurements(e,a),o&&(s.domProcessing=o.domProcessing,s.duration=o.duration,s.networkConnect=o.networkConnect,s.perfTotal=o.perfTotal,s.receivedResponse=o.receivedResponse,s.sentRequest=o.sentRequest),s}var ut,pt,gt;te(ft,ut=ie);function ft(e,t){var n=ut.call(this)||this;return n.aiDataContract={baseType:f.Required,baseData:f.Required},n.baseType=e,n.baseData=t,n}(gt=pt||(pt={}))[gt.Verbose=0]="Verbose",gt[gt.Information=1]="Information",gt[gt.Warning=2]="Warning",gt[gt.Error=3]="Error",gt[gt.Critical=4]="Critical";var dt=(mt.getConfig=function(e,t,n,r){var i;return void 0===r&&(r=!1),i=n&&e.extensionConfig&&e.extensionConfig[n]&&!u.isNullOrUndefined(e.extensionConfig[n][t])?e.extensionConfig[n][t]:e[t],u.isNullOrUndefined(i)?r:i},mt);function mt(){}var ht=(vt.create=function(e,t,n,r,i,a){if(n=H.sanitizeString(r,n)||X.NotSpecified,u.isNullOrUndefined(e)||u.isNullOrUndefined(t)||u.isNullOrUndefined(n))throw Error("Input doesn't contain all required fields");var o={name:n,time:(new Date).toISOString(),iKey:"",ext:a||{},tags:[],data:{},baseType:t,baseData:e};if(!u.isNullOrUndefined(i))for(var s in i)i.hasOwnProperty(s)&&(o.data[s]=i[s]);return o},vt);function vt(){}var yt=(wt.prototype.trackPageView=function(t,n){var r=this,i=t.name;!u.isNullOrUndefined(i)&&"string"==typeof i||(t.name=window.document&&window.document.title||"");var a=t.uri;if(!u.isNullOrUndefined(a)&&"string"==typeof a||(t.uri=window.location&&window.location.href||""),!this._pageViewPerformanceManager.isPerformanceTimingSupported())return this.appInsights.sendPageViewInternal(t,n),this._channel().forEach(function(e){e.forEach(function(e){return e.flush(!0)})}),void this._logger.throwInternal(p.WARNING,w,"trackPageView: navigation timing API used for calculation of page duration is not supported in this browser. This page view will be collected without duration and timing info.");var o=!1,s=void 0,c=this._pageViewPerformanceManager.getPerformanceTiming().navigationStart;s=$.GetDuration(c,+new Date),this._pageViewPerformanceManager.shouldCollectDuration(s)||(s=void 0);var e=void 0;u.isNullOrUndefined(n)||u.isNullOrUndefined(n.duration)||(e=n.duration),!this.overridePageViewDuration&&isNaN(e)||(isNaN(e)&&(n||(n={}),n.duration=s),this.appInsights.sendPageViewInternal(t,n),this._channel().forEach(function(e){e.forEach(function(e){return e.flush(!0)})}),o=!0),n||(n={});var l=setInterval(function(){try{if(r._pageViewPerformanceManager.isPerformanceTimingDataReady()){clearInterval(l);var e={name:i,uri:a};r._pageViewPerformanceManager.populatePageViewPerformanceEvent(e),e.isValid||o?(o||(n.duration=e.durationMs,r.appInsights.sendPageViewInternal(t,n)),r.pageViewPerformanceSent||(r.appInsights.sendPageViewPerformanceInternal(e,n),r.pageViewPerformanceSent=!0),r._channel().forEach(function(e){e.forEach(function(e){return e.flush(!0)})})):(n.duration=s,r.appInsights.sendPageViewInternal(t,n),r._channel().forEach(function(e){e.forEach(function(e){return e.flush(!0)})}))}else 6e4<$.GetDuration(c,+new Date)&&(clearInterval(l),o||(n.duration=6e4,r.appInsights.sendPageViewInternal(t,n),r._channel().forEach(function(e){e.forEach(function(e){return e.flush(!0)})})))}catch(e){r._logger.throwInternal(p.CRITICAL,D,"trackPageView failed on page load calculation: "+X.getExceptionName(e),{exception:X.dump(e)})}},100)},wt);function wt(e,t,n,r){this.pageViewPerformanceSent=!1,this.overridePageViewDuration=!1,this.overridePageViewDuration=t,this.appInsights=e,this._pageViewPerformanceManager=r,n&&(this._channel=function(){return n.getTransmissionControls()},this._logger=n.logger)}var St=(_t.prototype.trackPreviousPageVisit=function(e,t){try{var n=this.restartPageVisitTimer(e,t);n&&this.pageVisitTimeTrackingHandler(n.pageName,n.pageUrl,n.pageVisitTime)}catch(e){this._logger.warnToConsole("Auto track page visit time failed, metric will not be collected: "+X.dump(e))}},_t.prototype.restartPageVisitTimer=function(e,t){try{var n=this.stopPageVisitTimer();return this.startPageVisitTimer(e,t),n}catch(e){return this._logger.warnToConsole("Call to restart failed: "+X.dump(e)),null}},_t.prototype.startPageVisitTimer=function(e,t){try{if(X.canUseSessionStorage()){if(null!=X.getSessionStorage(this._logger,this.prevPageVisitDataKeyName))throw new Error("Cannot call startPageVisit consecutively without first calling stopPageVisit");var n=new It(e,t),r=JSON.stringify(n);X.setSessionStorage(this._logger,this.prevPageVisitDataKeyName,r)}}catch(e){this._logger.warnToConsole("Call to start failed: "+X.dump(e))}},_t.prototype.stopPageVisitTimer=function(){try{if(X.canUseSessionStorage()){var e=Date.now(),t=X.getSessionStorage(this._logger,this.prevPageVisitDataKeyName);if(t){var n=JSON.parse(t);return n.pageVisitTime=e-n.pageVisitStartTime,X.removeSessionStorage(this._logger,this.prevPageVisitDataKeyName),n}return null}return null}catch(e){return this._logger.warnToConsole("Stop page visit timer failed: "+X.dump(e)),null}},_t);function _t(e,t){this.prevPageVisitDataKeyName="prevPageVisitData",this.pageVisitTimeTrackingHandler=t,this._logger=e}var It=function(e,t){this.pageVisitStartTime=Date.now(),this.pageName=e,this.pageUrl=t},Tt=(Nt.prototype.populatePageViewPerformanceEvent=function(e){e.isValid=!1;var t=this.getPerformanceTiming();if(t){var n=$.GetDuration(t.navigationStart,t.loadEventEnd),r=$.GetDuration(t.navigationStart,t.connectEnd),i=$.GetDuration(t.requestStart,t.responseStart),a=$.GetDuration(t.responseStart,t.responseEnd),o=$.GetDuration(t.responseEnd,t.loadEventEnd);0==n?this._logger.throwInternal(p.WARNING,v,"error calculating page view performance.",{total:n,network:r,request:i,response:a,dom:o}):this.shouldCollectDuration(n,r,i,a,o)?n<Math.floor(r)+Math.floor(i)+Math.floor(a)+Math.floor(o)?this._logger.throwInternal(p.WARNING,h,"client performance math error.",{total:n,network:r,request:i,response:a,dom:o}):(e.durationMs=n,e.perfTotal=e.duration=X.msToTimeSpan(n),e.networkConnect=X.msToTimeSpan(r),e.sentRequest=X.msToTimeSpan(i),e.receivedResponse=X.msToTimeSpan(a),e.domProcessing=X.msToTimeSpan(o),e.isValid=!0):this._logger.throwInternal(p.WARNING,b,"Invalid page load duration value. Browser perf data won't be sent.",{total:n,network:r,request:i,response:a,dom:o})}},Nt.prototype.getPerformanceTiming=function(){return this.isPerformanceTimingSupported()?window.performance.timing:null},Nt.prototype.isPerformanceTimingSupported=function(){return"undefined"!=typeof window&&window.performance&&window.performance.timing},Nt.prototype.isPerformanceTimingDataReady=function(){var e=window.performance.timing;return 0<e.domainLookupStart&&0<e.navigationStart&&0<e.responseStart&&0<e.requestStart&&0<e.loadEventEnd&&0<e.responseEnd&&0<e.connectEnd&&0<e.domLoading},Nt.prototype.shouldCollectDuration=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=["googlebot","adsbot-google","apis-google","mediapartners-google"],r=navigator.userAgent,i=!1;if(r)for(var a=0;a<n.length;a++)i=i||-1!==r.toLowerCase().indexOf(n[a]);if(i)return!1;for(var o=0;o<e.length;o++)if(e[o]>=this.MAX_DURATION_ALLOWED)return!1;return!0},Nt);function Nt(e){this.MAX_DURATION_ALLOWED=36e5,e&&(this._logger=e.logger)}var Et="duration",kt=(Dt.getDefaultConfig=function(e){return e||(e={}),e.sessionRenewalMs=18e5,e.sessionExpirationMs=864e5,e.disableExceptionTracking=X.stringToBoolOrDefault(e.disableExceptionTracking),e.autoTrackPageVisitTime=X.stringToBoolOrDefault(e.autoTrackPageVisitTime),e.overridePageViewDuration=X.stringToBoolOrDefault(e.overridePageViewDuration),(isNaN(e.samplingPercentage)||e.samplingPercentage<=0||100<=e.samplingPercentage)&&(e.samplingPercentage=100),e.isCookieUseDisabled=X.stringToBoolOrDefault(e.isCookieUseDisabled),e.isStorageUseDisabled=X.stringToBoolOrDefault(e.isStorageUseDisabled),e.isBrowserLinkTrackingEnabled=X.stringToBoolOrDefault(e.isBrowserLinkTrackingEnabled),e},Dt.prototype.processTelemetry=function(e){for(var t=!1,n=this._telemetryInitializers.length,r=0;r<n;++r){var i=this._telemetryInitializers[r];if(i)try{if(!1===i.apply(null,[e])){t=!0;break}}catch(e){this._logger.throwInternal(p.CRITICAL,V,"One of telemetry initializers failed, telemetry item will not be sent: "+X.getExceptionName(e),{exception:X.dump(e)},!0)}}t||u.isNullOrUndefined(this._nextPlugin)||this._nextPlugin.processTelemetry(e)},Dt.prototype.setNextPlugin=function(e){this._nextPlugin=e},Dt.prototype.trackEvent=function(e,t){try{var n=ht.create(e,fe.dataType,fe.envelopeType,this._logger,t);this._setTelemetryNameAndIKey(n),this.core.track(n)}catch(e){this._logger.throwInternal(p.WARNING,x,"trackTrace failed, trace will not be collected: "+X.getExceptionName(e),{exception:X.dump(e)})}},Dt.prototype.startTrackEvent=function(e){try{this._eventTracking.start(e)}catch(e){this._logger.throwInternal(p.CRITICAL,S,"startTrackEvent failed, event will not be collected: "+X.getExceptionName(e),{exception:X.dump(e)})}},Dt.prototype.stopTrackEvent=function(e,t,n){try{this._eventTracking.stop(e,void 0,t)}catch(e){this._logger.throwInternal(p.CRITICAL,_,"stopTrackEvent failed, event will not be collected: "+X.getExceptionName(e),{exception:X.dump(e)})}},Dt.prototype.trackTrace=function(e,t){try{var n=ht.create(e,nt.dataType,nt.envelopeType,this._logger,t);this._setTelemetryNameAndIKey(n),this.core.track(n)}catch(e){this._logger.throwInternal(p.WARNING,x,"trackTrace failed, trace will not be collected: "+X.getExceptionName(e),{exception:X.dump(e)})}},Dt.prototype.trackMetric=function(e,t){try{var n=ht.create(e,Oe.dataType,Oe.envelopeType,this._logger,t);this._setTelemetryNameAndIKey(n),this.core.track(n)}catch(e){this._logger.throwInternal(p.CRITICAL,E,"trackMetric failed, metric will not be collected: "+X.getExceptionName(e),{exception:X.dump(e)})}},Dt.prototype.trackPageView=function(e,t){try{var n=e||{};this._pageViewManager.trackPageView(n,t),this.config.autoTrackPageVisitTime&&this._pageVisitTimeManager.trackPreviousPageVisit(n.name,n.uri)}catch(e){this._logger.throwInternal(p.CRITICAL,k,"trackPageView failed, page view will not be collected: "+X.getExceptionName(e),{exception:X.dump(e)})}},Dt.prototype.sendPageViewInternal=function(e,t,n){"undefined"!=typeof document&&(e.refUri=e.refUri||document.referrer);var r=ht.create(e,He.dataType,He.envelopeType,this._logger,t,n);this._setTelemetryNameAndIKey(r),this.core.track(r),this._trackAjaxAttempts=0},Dt.prototype.sendPageViewPerformanceInternal=function(e,t,n){var r=ht.create(e,ct.dataType,ct.envelopeType,this._logger,t,n);this._setTelemetryNameAndIKey(r),this.core.track(r)},Dt.prototype.trackPageViewPerformance=function(e,t){try{this._pageViewPerformanceManager.populatePageViewPerformanceEvent(e),this.sendPageViewPerformanceInternal(e,t)}catch(e){this._logger.throwInternal(p.CRITICAL,k,"trackPageViewPerformance failed, page view will not be collected: "+X.getExceptionName(e),{exception:X.dump(e)})}},Dt.prototype.startTrackPage=function(e){try{"string"!=typeof e&&(e=window.document&&window.document.title||""),this._pageTracking.start(e)}catch(e){this._logger.throwInternal(p.CRITICAL,I,"startTrackPage failed, page view may not be collected: "+X.getExceptionName(e),{exception:X.dump(e)})}},Dt.prototype.stopTrackPage=function(e,t,n,r){try{"string"!=typeof e&&(e=window.document&&window.document.title||""),"string"!=typeof t&&(t=window.location&&window.location.href||""),this._pageTracking.stop(e,t,n,r),this.config.autoTrackPageVisitTime&&this._pageVisitTimeManager.trackPreviousPageVisit(e,t)}catch(e){this._logger.throwInternal(p.CRITICAL,T,"stopTrackPage failed, page view will not be collected: "+X.getExceptionName(e),{exception:X.dump(e)})}},Dt.prototype.sendExceptionInternal=function(e,t,n){var r=new _e(this._logger,e.exception||new Error(X.NotSpecified),e.properties,e.measurements,e.severityLevel,e.id).toInterface(),i=ht.create(r,_e.dataType,_e.envelopeType,this._logger,t,n);this._setTelemetryNameAndIKey(i),this.core.track(i)},Dt.prototype.trackException=function(e,t){try{this.sendExceptionInternal(e,t)}catch(e){this._logger.throwInternal(p.CRITICAL,N,"trackException failed, exception will not be collected: "+X.getExceptionName(e),{exception:X.dump(e)})}},Dt.prototype._onerror=function(t){try{var e={url:t&&t.url||document.URL,lineNumber:t.lineNumber,columnNumber:t.columnNumber,message:t.message};if(X.isCrossOriginError(t.message,t.url,t.lineNumber,t.columnNumber,t.error))this._sendCORSException(e.url);else{if(!X.isError(t.error)){var n="window.onerror@"+e.url+":"+t.lineNumber+":"+(t.columnNumber||0);t.error=new Error(t.message),t.error.stack=n}this.trackException({exception:t.error,severityLevel:pt.Error},e)}}catch(e){var r=t.error?t.error.name+", "+t.error.message:"null";this._logger.throwInternal(p.CRITICAL,y,"_onError threw exception while logging error, error will not be collected: "+X.getExceptionName(e),{exception:X.dump(e),errorString:r})}},Dt.prototype.addTelemetryInitializer=function(e){this._telemetryInitializers.push(e)},Dt.prototype._initialize=function(e,t,n){var o=this;if(!this._isInitialized){if(u.isNullOrUndefined(t))throw Error("Error initializing");this.core=t,this._logger=t.logger,this._globalconfig={instrumentationKey:e.instrumentationKey,endpointUrl:e.endpointUrl||"https://dc.services.visualstudio.com/v2/track"},this.config=e.extensionConfig&&e.extensionConfig[this.identifier]?e.extensionConfig[this.identifier]:{};var r=Dt.getDefaultConfig();if(void 0!==r){for(var i in r)this.config[i]=dt.getConfig(e,i,this.identifier,r[i]);if(this._globalconfig)for(var i in r)void 0===this._globalconfig[i]&&(this._globalconfig[i]=r[i])}this.config.isCookieUseDisabled&&X.disableCookies(),this.config.isStorageUseDisabled&&X.disableStorage();var a={instrumentationKey:function(){return e.instrumentationKey},accountId:function(){return o.config.accountId||e.accountId},sessionRenewalMs:function(){return o.config.sessionRenewalMs||e.sessionRenewalMs},sessionExpirationMs:function(){return o.config.sessionExpirationMs||e.sessionExpirationMs},sampleRate:function(){return o.config.samplingPercentage||e.samplingPercentage},cookieDomain:function(){return o.config.cookieDomain||e.cookieDomain},sdkExtension:function(){return o.config.sdkExtension||e.sdkExtension},isBrowserLinkTrackingEnabled:function(){return o.config.isBrowserLinkTrackingEnabled||e.isBrowserLinkTrackingEnabled},appId:function(){return o.config.appId||e.appId}};if(this._pageViewPerformanceManager=new Tt(this.core),this._pageViewManager=new yt(this,this.config.overridePageViewDuration,this.core,this._pageViewPerformanceManager),this._pageVisitTimeManager=new St(this._logger,function(e,t,n){return o.trackPageVisitTime(e,t,n)}),this._telemetryInitializers=[],this._addDefaultTelemetryInitializers(a),this._eventTracking=new xt(this._logger,"trackEvent"),this._eventTracking.action=function(e,t,n,r){r||(r={}),r[Et]=n.toString(),o.trackEvent({name:e,properties:r})},this._pageTracking=new xt(this._logger,"trackPageView"),!(this._pageTracking.action=function(e,t,n,r,i){u.isNullOrUndefined(r)&&(r={}),r[Et]=n.toString();var a={name:e,uri:t,properties:r,measurements:i};o.sendPageViewInternal(a)})===this.config.disableExceptionTracking&&!this.config.autoExceptionInstrumented){var s=window.onerror,c=this;window.onerror=function(e,t,n,r,i){var a=s&&s(e,t,n,r,i);return!0!==a&&c._onerror({message:e,url:t,lineNumber:n,columnNumber:r,error:i}),a},this.config.autoExceptionInstrumented=!0}this._isInitialized=!0}},Dt.prototype.trackPageVisitTime=function(e,t,n){var r={PageName:e,PageUrl:t};this.trackMetric({name:"PageVisitTime",average:n,max:n,min:n,sampleCount:1},r)},Dt.prototype._addDefaultTelemetryInitializers=function(e){if(!e.isBrowserLinkTrackingEnabled()){var r=["/browserLinkSignalR/","/__browserLink/"];this._addTelemetryInitializer(function(e){if(e.baseType===Qe.dataType){var t=e.baseData;if(t)for(var n=0;n<r.length;n++)if(t.target&&0<=t.target.indexOf(r[n]))return!1}return!0})}},Dt.prototype._addTelemetryInitializer=function(e){this._telemetryInitializers.push(e)},Dt.prototype._sendCORSException=function(e){var t={message:"Script error: The browser's same-origin policy prevents us from getting the details of this exception. Consider using the 'crossorigin' attribute.",url:e,lineNumber:0,columnNumber:0,error:void 0},n=ht.create(t,_e.dataType,_e.envelopeType,this._logger,{url:e});this.core.track(n)},Dt.prototype._setTelemetryNameAndIKey=function(e){e.iKey=this._globalconfig.instrumentationKey;var t=this._globalconfig.instrumentationKey.replace(/-/g,"");e.name=e.name.replace("{0}",t)},Dt.Version="2.0.1",Dt);function Dt(){this.identifier="ApplicationInsightsAnalytics",this.priority=160,this._isInitialized=!1,this._trackAjaxAttempts=0,this.initialize=this._initialize.bind(this)}var xt=(bt.prototype.start=function(e){void 0!==this._events[e]&&this._logger.throwInternal(p.WARNING,U,"start was called more than once for this event without calling stop.",{name:this._name,key:e},!0),this._events[e]=+new Date},bt.prototype.stop=function(e,t,n,r){var i=this._events[e];if(isNaN(i))this._logger.throwInternal(p.WARNING,L,"stop was called without a corresponding start.",{name:this._name,key:e},!0);else{var a=+new Date,o=$.GetDuration(i,a);this.action(e,t,o,n,r)}delete this._events[e],this._events[e]=void 0},bt);function bt(e,t){this._name=t,this._events={},this._logger=e}e.ApplicationInsights=kt,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 r=function(e,t){return(r=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 t(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var i,n,f,a,o=function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};(n=i||(i={}))[n.LocalStorage=0]="LocalStorage",n[n.SessionStorage=1]="SessionStorage",(a=f||(f={}))[a.Default=0]="Default",a[a.Required=1]="Required",a[a.Array=2]="Array",a[a.Hidden=4]="Hidden";var g=(s.isNullOrUndefined=function(e){return null==e},s.disableCookies=function(){s._canUseCookies=!1},s.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)})},s);function s(){}var u,c,l=/[xy]/g;(c=u||(u={}))[c.CRITICAL=1]="CRITICAL",c[c.WARNING=2]="WARNING";var p=1,d=2,h=3,m=4,v=5,w=6,y=8,S=10,_=11,I=25,T=29,N=30,E=31,k=32,x=35,D=36,P=37,b=38,A=39,C=45,M=49,R=52,L=56,U=57,V=61,O=62,z=63,G=64,q=66,j=68,B=69;H.prototype.processTelemetry=function(t){this.channelQueue.forEach(function(e){0<e.length&&e[0].processTelemetry(t)})},Object.defineProperty(H.prototype,"ChannelControls",{get:function(){return this.channelQueue},enumerable:!0,configurable:!0}),H.prototype.initialize=function(n,r,i){var a=this;if(n.isCookieUseDisabled&&g.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,i)}),o)throw Error("Channel has invalid priority"+o);for(var t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);a.channelQueue.push(e)}})}for(var e=new Array,t=0;t<i.length;t++){var s=i[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,i)}),t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);this.channelQueue.push(e)}};function H(){this.identifier="ChannelControllerPlugin",this.priority=500}var X=(W.sanitizeKeyAndAddUniqueness=function(e,t,n){var r=t.length,i=W.sanitizeKey(e,t);if(i.length!==r){for(var a=0,o=i;void 0!==n[o];)a++,o=i.substring(0,W.MAX_NAME_LENGTH-3)+W.padNumber(a);i=o}return i},W.sanitizeKey=function(e,t){var n;return t&&(t=W.trim(t.toString())).length>W.MAX_NAME_LENGTH&&(n=t.substring(0,W.MAX_NAME_LENGTH),e.throwInternal(u.WARNING,U,"name is too long. It has been truncated to "+W.MAX_NAME_LENGTH+" characters.",{name:t},!0)),n||t},W.sanitizeString=function(e,t,n){var r;return void 0===n&&(n=W.MAX_STRING_LENGTH),t&&(n=n||W.MAX_STRING_LENGTH,(t=W.trim(t)).toString().length>n&&(r=t.toString().substring(0,n),e.throwInternal(u.WARNING,V,"string value is too long. It has been truncated to "+n+" characters.",{value:t},!0))),r||t},W.sanitizeUrl=function(e,t){return W.sanitizeInput(e,t,W.MAX_URL_LENGTH,q)},W.sanitizeMessage=function(e,t){var n;return t&&t.length>W.MAX_MESSAGE_LENGTH&&(n=t.substring(0,W.MAX_MESSAGE_LENGTH),e.throwInternal(u.WARNING,L,"message is too long, it has been truncated to "+W.MAX_MESSAGE_LENGTH+" characters.",{message:t},!0)),n||t},W.sanitizeException=function(e,t){var n;return t&&t.length>W.MAX_EXCEPTION_LENGTH&&(n=t.substring(0,W.MAX_EXCEPTION_LENGTH),e.throwInternal(u.WARNING,R,"exception is too long, it has been truncated to "+W.MAX_EXCEPTION_LENGTH+" characters.",{exception:t},!0)),n||t},W.sanitizeProperties=function(t,e){if(e){var n={};for(var r in e){var i=e[r];if("object"==typeof i&&"undefined"!=typeof JSON)try{i=JSON.stringify(i)}catch(e){t.throwInternal(u.WARNING,M,"custom property is not valid",{exception:e},!0)}i=W.sanitizeString(t,i,W.MAX_PROPERTY_LENGTH),n[r=W.sanitizeKeyAndAddUniqueness(t,r,n)]=i}e=n}return e},W.sanitizeMeasurements=function(e,t){if(t){var n={};for(var r in t){var i=t[r];n[r=W.sanitizeKeyAndAddUniqueness(e,r,n)]=i}t=n}return t},W.sanitizeId=function(e,t){return t?W.sanitizeInput(e,t,W.MAX_ID_LENGTH,B).toString():t},W.sanitizeInput=function(e,t,n,r){var i;return t&&(t=W.trim(t)).length>n&&(i=t.substring(0,n),e.throwInternal(u.WARNING,r,"input is too long, it has been truncated to "+n+" characters.",{data:t},!0)),i||t},W.padNumber=function(e){var t="00"+e;return t.substr(t.length-3)},W.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},W.MAX_NAME_LENGTH=150,W.MAX_ID_LENGTH=128,W.MAX_PROPERTY_LENGTH=8192,W.MAX_STRING_LENGTH=1024,W.MAX_URL_LENGTH=2048,W.MAX_MESSAGE_LENGTH=32768,W.MAX_EXCEPTION_LENGTH=32768,W);function W(){}var K=(F.disableStorage=function(){F._canUseLocalStorage=!1,F._canUseSessionStorage=!1},F._getLocalStorageObject=function(){return F.canUseLocalStorage()?F._getVerifiedStorageObject(i.LocalStorage):null},F._getVerifiedStorageObject=function(e){var t,n,r=null;try{if("undefined"==typeof window)return null;n=new Date,(r=e===i.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},F.isInternalApplicationInsightsEndpoint=function(e){return-1!==F._internalEndpoints.indexOf(e.toLowerCase())},F.canUseLocalStorage=function(){return void 0===F._canUseLocalStorage&&(F._canUseLocalStorage=!!F._getVerifiedStorageObject(i.LocalStorage)),F._canUseLocalStorage},F.getStorage=function(t,e){var n=F._getLocalStorageObject();if(null!==n)try{return n.getItem(e)}catch(e){F._canUseLocalStorage=!1,t.throwInternal(u.WARNING,p,"Browser failed read of local storage. "+F.getExceptionName(e),{exception:F.dump(e)})}return null},F.setStorage=function(t,e,n){var r=F._getLocalStorageObject();if(null!==r)try{return r.setItem(e,n),!0}catch(e){F._canUseLocalStorage=!1,t.throwInternal(u.WARNING,h,"Browser failed write to local storage. "+F.getExceptionName(e),{exception:F.dump(e)})}return!1},F.removeStorage=function(t,e){var n=F._getLocalStorageObject();if(null!==n)try{return n.removeItem(e),!0}catch(e){F._canUseLocalStorage=!1,t.throwInternal(u.WARNING,v,"Browser failed removal of local storage item. "+F.getExceptionName(e),{exception:F.dump(e)})}return!1},F._getSessionStorageObject=function(){return F.canUseSessionStorage()?F._getVerifiedStorageObject(i.SessionStorage):null},F.canUseSessionStorage=function(){return void 0===F._canUseSessionStorage&&(F._canUseSessionStorage=!!F._getVerifiedStorageObject(i.SessionStorage)),F._canUseSessionStorage},F.getSessionStorageKeys=function(){var e=[];if(F.canUseSessionStorage())for(var t in window.sessionStorage)e.push(t);return e},F.getSessionStorage=function(t,e){var n=F._getSessionStorageObject();if(null!==n)try{return n.getItem(e)}catch(e){F._canUseSessionStorage=!1,t.throwInternal(u.WARNING,d,"Browser failed read of session storage. "+F.getExceptionName(e),{exception:F.dump(e)})}return null},F.setSessionStorage=function(t,e,n){var r=F._getSessionStorageObject();if(null!==r)try{return r.setItem(e,n),!0}catch(e){F._canUseSessionStorage=!1,t.throwInternal(u.WARNING,m,"Browser failed write to session storage. "+F.getExceptionName(e),{exception:F.dump(e)})}return!1},F.removeSessionStorage=function(t,e){var n=F._getSessionStorageObject();if(null!==n)try{return n.removeItem(e),!0}catch(e){F._canUseSessionStorage=!1,t.throwInternal(u.WARNING,w,"Browser failed removal of session storage item. "+F.getExceptionName(e),{exception:F.dump(e)})}return!1},F.disableCookies=function(){g.disableCookies()},F.canUseCookies=function(t){if(void 0===g._canUseCookies){g._canUseCookies=!1;try{g._canUseCookies=void 0!==F.document.cookie}catch(e){t.throwInternal(u.WARNING,j,"Cannot access document.cookie - "+F.getExceptionName(e),{exception:F.dump(e)})}}return g._canUseCookies},F.setCookie=function(e,t,n,r){var i="",a="";r&&(i=";domain="+r),F.document.location&&"https:"===F.document.location.protocol&&(a=";secure"),F.canUseCookies(e)&&(F.document.cookie=t+"="+n+i+";path=/"+a)},F.stringToBoolOrDefault=function(e,t){return void 0===t&&(t=!1),null==e?t:"true"===e.toString().toLowerCase()},F.getCookie=function(e,t){if(F.canUseCookies(e)){var n="";if(t&&t.length)for(var r=t+"=",i=F.document.cookie.split(";"),a=0;a<i.length;a++){var o=i[a];if((o=F.trim(o))&&0===o.indexOf(r)){n=o.substring(r.length,i[a].length);break}}return n}},F.deleteCookie=function(e,t){F.canUseCookies(e)&&(F.document.cookie=t+"=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;")},F.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},F.newId=function(){for(var e="",t=1073741824*Math.random();0<t;)e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t%64),t=Math.floor(t/64);return e},F.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},F.isError=function(e){return"[object Error]"===Object.prototype.toString.call(e)},F.isDate=function(e){return"[object Date]"===Object.prototype.toString.call(e)},F.toISOStringForIE8=function(e){if(F.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"}},F.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},F.msToTimeSpan=function(e){(isNaN(e)||e<0)&&(e=0);var t=""+(e=Math.round(e))%1e3,n=""+Math.floor(e/1e3)%60,r=""+Math.floor(e/6e4)%60,i=""+Math.floor(e/36e5)%24,a=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<a?a+".":"")+(i=i.length<2?"0"+i:i)+":"+r+":"+n+"."+t},F.isCrossOriginError=function(e,t,n,r,i){return("Script error."===e||"Script error"===e)&&!i},F.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},F.getExceptionName=function(e){return"[object Error]"===Object.prototype.toString.call(e)?e.name:""},F.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},F.IsBeaconApiSupported=function(){return"sendBeacon"in navigator&&navigator.sendBeacon},F.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},F.document="undefined"!=typeof document?document:{},F._canUseLocalStorage=void 0,F._canUseSessionStorage=void 0,F._internalEndpoints=["https://dc.services.visualstudio.com/v2/track","https://breeze.aimon.applicationinsights.io/v2/track","https://dc-int.services.visualstudio.com/v2/track"],F.NotSpecified="not_specified",F);function F(){}var J=(Q.parseUrl=function(e){return Q.htmlAnchorElement||(Q.htmlAnchorElement=Q.document.createElement?Q.document.createElement("a"):{host:Q.parseHost(e)}),Q.htmlAnchorElement.href=e,Q.htmlAnchorElement},Q.getAbsoluteUrl=function(e){var t,n=Q.parseUrl(e);return n&&(t=n.href),t},Q.getPathName=function(e){var t,n=Q.parseUrl(e);return n&&(t=n.pathname),t},Q.getCompleteUrl=function(e,t){return e?e.toUpperCase()+" "+t:t},Q.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},Q.document="undefined"!=typeof document?document:{},Q);function Q(){}var Y=($.ParseDependencyPath=function(e,t,n,r){var i,a=r,o=r;if(t&&0<t.length){var s=J.parseUrl(t);if(i=s.host,!a)if(null!=s.pathname){var c=0===s.pathname.length?"/":s.pathname;"/"!==c.charAt(0)&&(c="/"+c),o=s.pathname,a=X.sanitizeString(e,n?n+" "+c:c)}else a=X.sanitizeString(e,t)}else a=i=r;return{target:i,name:a,data:o}},$);function $(){}var Z=(ee.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()},ee.GetDuration=function(e,t){var n=null;return 0===e||0===t||g.isNullOrUndefined(e)||g.isNullOrUndefined(t)||(n=t-e),n},ee);function ee(){}var te,ne=(t(re,te=function(){}),re);function re(){return te.call(this)||this}var ie;t(ae,ie=function(){this.ver=1,this.sampleRate=100,this.tags={}});function ae(e,t,n){var r=ie.call(this)||this;return r.name=X.sanitizeString(e,n)||K.NotSpecified,r.data=t,r.time=K.toISOStringForIE8(new Date),r.aiDataContract={time:f.Required,iKey:f.Required,name:f.Required,sampleRate:function(){return 100==r.sampleRate?f.Hidden:f.Required},tags:f.Required,data:f.Required},r}function oe(){}var se,ce=(t(le,se=oe),le);function le(){var e=se.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var ue,pe=(t(ge,ue=ce),ge.envelopeType="Microsoft.ApplicationInsights.{0}.Event",ge.dataType="EventData",ge);function ge(e,t,n,r){var i=ue.call(this)||this;return i.aiDataContract={ver:f.Required,name:f.Required,properties:f.Default,measurements:f.Default},i.name=X.sanitizeString(e,t)||K.NotSpecified,i.properties=X.sanitizeProperties(e,n),i.measurements=X.sanitizeMeasurements(e,r),i}function fe(){}var de,he=(t(me,de=oe),me);function me(){var e=de.call(this)||this;return e.ver=2,e.exceptions=[],e.properties={},e.measurements={},e}function ve(){this.hasFullStack=!0,this.parsedStack=[]}var we,ye=(t(Se,we=he),Se.CreateFromInterface=function(t,e){var n=e.exceptions&&e.exceptions.map(function(e){return Ie.CreateFromInterface(t,e)});return new Se(t,o({},e,{exceptions:n}))},Se.prototype.toInterface=function(){var e=this,t=e.exceptions,n=e.properties,r=e.measurements,i=e.severityLevel,a=e.ver,o=e.problemGroup,s=e.id,c=e.isManual;return{ver:a,exceptions:t instanceof Array&&t.map(function(e){return e.toInterface()})||void 0,severityLevel:i,properties:n,measurements:r,problemGroup:o,id:s,isManual:c}},Se.CreateSimpleException=function(e,t,n,r,i,a){return{exceptions:[{hasFullStack:!0,message:e,stack:i,typeName:t}]}},Se.envelopeType="Microsoft.ApplicationInsights.{0}.Exception",Se.dataType="ExceptionData",Se);function Se(e,t,n,r,i,a){var o=we.call(this)||this;return o.aiDataContract={ver:f.Required,exceptions:f.Required,severityLevel:f.Default,properties:f.Default,measurements:f.Default},t instanceof Error?(o.exceptions=[new Ie(e,t)],o.properties=X.sanitizeProperties(e,n),o.measurements=X.sanitizeMeasurements(e,r),i&&(o.severityLevel=i),a&&(o.id=a)):(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),g.isNullOrUndefined(t.ver)||(o.ver=t.ver),g.isNullOrUndefined(t.isManual)||(o.isManual=t.isManual)),o}var _e,Ie=(t(Te,_e=ve),Te.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}},Te.CreateFromInterface=function(e,t){var n=t.parsedStack instanceof Array&&t.parsedStack.map(function(e){return Ee.CreateFromInterface(e)})||t.parsedStack;return new Te(e,o({},t,{parsedStack:n}))},Te.parseStack=function(e){var t=void 0;if("string"==typeof e){var n=e.split("\n");t=[];for(var r=0,i=0,a=0;a<=n.length;a++){var o=n[a];if(Ee.regex.test(o)){var s=new Ee(n[a],r++);i+=s.sizeInBytes,t.push(s)}}if(32768<i)for(var c=0,l=t.length-1,u=0,p=c,g=l;c<l;){if(32768<(u+=t[c].sizeInBytes+t[l].sizeInBytes)){var f=g-p+1;t.splice(p,f);break}p=c,g=l,c++,l--}}return t},Te);function Te(e,t){var n=_e.call(this)||this;if(n.aiDataContract={id:f.Default,outerId:f.Default,typeName:f.Required,message:f.Required,hasFullStack:f.Default,stack:f.Default,parsedStack:f.Array},t instanceof Error){n.typeName=X.sanitizeString(e,t.name)||K.NotSpecified,n.message=X.sanitizeMessage(e,t.message)||K.NotSpecified;var r=t.stack;n.parsedStack=Te.parseStack(r),n.stack=X.sanitizeException(e,r),n.hasFullStack=K.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 Ne,Ee=(t(ke,Ne=fe),ke.CreateFromInterface=function(e){return new ke(e,null)},ke.prototype.toInterface=function(){return{level:this.level,method:this.method,assembly:this.assembly,fileName:this.fileName,line:this.line}},ke.regex=/^([\s]+at)?(.*?)(\@|\s\(|\s)([^\(\@\n]+):([0-9]+):([0-9]+)(\)?)$/,ke.baseSize=58,ke);function ke(e,t){var n=Ne.call(this)||this;if(n.sizeInBytes=0,n.aiDataContract={level:f.Required,method:f.Required,assembly:f.Default,fileName:f.Default,line:f.Default},"string"==typeof e){var r=e;n.level=t,n.method="<no_method>",n.assembly=K.trim(r),n.fileName="",n.line=0;var i=r.match(ke.regex);i&&5<=i.length&&(n.method=K.trim(i[2])||n.method,n.fileName=K.trim(i[4]),n.line=parseInt(i[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+=ke.baseSize,n.sizeInBytes+=n.level.toString().length,n.sizeInBytes+=n.line.toString().length,n}var xe,De,Pe,be=(t(Ae,xe=oe),Ae);function Ae(){var e=xe.call(this)||this;return e.ver=2,e.metrics=[],e.properties={},e}(Pe=De||(De={}))[Pe.Measurement=0]="Measurement",Pe[Pe.Aggregation=1]="Aggregation";var Ce,Me=(t(Re,Ce=function(){this.kind=De.Measurement}),Re);function Re(){var e=null!==Ce&&Ce.apply(this,arguments)||this;return e.aiDataContract={name:f.Required,kind:f.Default,value:f.Required,count:f.Default,min:f.Default,max:f.Default,stdDev:f.Default},e}var Le,Ue=(t(Ve,Le=be),Ve.envelopeType="Microsoft.ApplicationInsights.{0}.Metric",Ve.dataType="MetricData",Ve);function Ve(e,t,n,r,i,a,o){var s=Le.call(this)||this;s.aiDataContract={ver:f.Required,metrics:f.Required,properties:f.Default};var c=new Me;return c.count=0<r?r:void 0,c.max=isNaN(a)||null===a?void 0:a,c.min=isNaN(i)||null===i?void 0:i,c.name=X.sanitizeString(e,t)||K.NotSpecified,c.value=n,s.metrics=[c],s.properties=X.sanitizeProperties(e,o),s}var Oe,ze=(t(Ge,Oe=ce),Ge);function Ge(){var e=Oe.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var qe,je=(t(Be,qe=ze),Be.envelopeType="Microsoft.ApplicationInsights.{0}.Pageview",Be.dataType="PageviewData",Be);function Be(e,t,n,r,i,a,o){var s=qe.call(this)||this;return s.aiDataContract={ver:f.Required,name:f.Default,url:f.Default,duration:f.Default,properties:f.Default,measurements:f.Default,id:f.Default},s.id=X.sanitizeId(e,o),s.url=X.sanitizeUrl(e,n),s.name=X.sanitizeString(e,t)||K.NotSpecified,isNaN(r)||(s.duration=K.msToTimeSpan(r)),s.properties=X.sanitizeProperties(e,i),s.measurements=X.sanitizeMeasurements(e,a),s}var He,Xe=(t(We,He=oe),We);function We(){var e=He.call(this)||this;return e.ver=2,e.success=!0,e.properties={},e.measurements={},e}var Ke,Fe=(t(Je,Ke=Xe),Je.envelopeType="Microsoft.ApplicationInsights.{0}.RemoteDependency",Je.dataType="RemoteDependencyData",Je);function Je(e,t,n,r,i,a,o,s,c,l,u){void 0===c&&(c="Ajax");var p=Ke.call(this)||this;p.aiDataContract={id:f.Required,ver:f.Required,name:f.Default,resultCode:f.Default,duration:f.Default,success:f.Default,data:f.Default,target:f.Default,type:f.Default,properties:f.Default,measurements:f.Default,kind:f.Default,value:f.Default,count:f.Default,min:f.Default,max:f.Default,stdDev:f.Default,dependencyKind:f.Default,dependencySource:f.Default,commandName:f.Default,dependencyTypeName:f.Default},p.id=t,p.duration=K.msToTimeSpan(i),p.success=a,p.resultCode=o+"",p.type=X.sanitizeString(e,c);var g=Y.ParseDependencyPath(e,n,s,r);return p.data=X.sanitizeUrl(e,r)||g.data,p.target=X.sanitizeString(e,g.target),p.name=X.sanitizeString(e,g.name),p.properties=X.sanitizeProperties(e,l),p.measurements=X.sanitizeMeasurements(e,u),p}var Qe,Ye=(t($e,Qe=oe),$e);function $e(){var e=Qe.call(this)||this;return e.ver=2,e.properties={},e}var Ze,et=(t(tt,Ze=Ye),tt.envelopeType="Microsoft.ApplicationInsights.{0}.Message",tt.dataType="MessageData",tt);function tt(e,t,n,r){var i=Ze.call(this)||this;return i.aiDataContract={ver:f.Required,message:f.Required,severityLevel:f.Default,properties:f.Default},t=t||K.NotSpecified,i.message=X.sanitizeMessage(e,t),i.properties=X.sanitizeProperties(e,r),n&&(i.severityLevel=n),i}var nt,rt=(t(it,nt=ze),it);function it(){var e=nt.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var at,ot=(t(st,at=rt),st.envelopeType="Microsoft.ApplicationInsights.{0}.PageviewPerformance",st.dataType="PageviewPerformanceData",st);function st(e,t,n,r,i,a,o){var s=at.call(this)||this;return s.aiDataContract={ver:f.Required,name:f.Default,url:f.Default,duration:f.Default,perfTotal:f.Default,networkConnect:f.Default,sentRequest:f.Default,receivedResponse:f.Default,domProcessing:f.Default,properties:f.Default,measurements:f.Default},s.url=X.sanitizeUrl(e,n),s.name=X.sanitizeString(e,t)||K.NotSpecified,s.properties=X.sanitizeProperties(e,i),s.measurements=X.sanitizeMeasurements(e,a),o&&(s.domProcessing=o.domProcessing,s.duration=o.duration,s.networkConnect=o.networkConnect,s.perfTotal=o.perfTotal,s.receivedResponse=o.receivedResponse,s.sentRequest=o.sentRequest),s}var ct,lt,ut;t(pt,ct=ne);function pt(e,t){var n=ct.call(this)||this;return n.aiDataContract={baseType:f.Required,baseData:f.Required},n.baseType=e,n.baseData=t,n}(ut=lt||(lt={}))[ut.Verbose=0]="Verbose",ut[ut.Information=1]="Information",ut[ut.Warning=2]="Warning",ut[ut.Error=3]="Error",ut[ut.Critical=4]="Critical";var gt=(ft.getConfig=function(e,t,n,r){var i;return void 0===r&&(r=!1),i=n&&e.extensionConfig&&e.extensionConfig[n]&&!g.isNullOrUndefined(e.extensionConfig[n][t])?e.extensionConfig[n][t]:e[t],g.isNullOrUndefined(i)?r:i},ft);function ft(){}var dt=(ht.create=function(e,t,n,r,i,a){if(n=X.sanitizeString(r,n)||K.NotSpecified,g.isNullOrUndefined(e)||g.isNullOrUndefined(t)||g.isNullOrUndefined(n))throw Error("Input doesn't contain all required fields");var o={name:n,time:(new Date).toISOString(),iKey:"",ext:a||{},tags:[],data:{},baseType:t,baseData:e};if(!g.isNullOrUndefined(i))for(var s in i)i.hasOwnProperty(s)&&(o.data[s]=i[s]);return o},ht);function ht(){}var mt=(vt.prototype.trackPageView=function(t,n){var r=this,i=t.name;!g.isNullOrUndefined(i)&&"string"==typeof i||(t.name=window.document&&window.document.title||"");var a=t.uri;if(!g.isNullOrUndefined(a)&&"string"==typeof a||(t.uri=window.location&&window.location.href||""),!this._pageViewPerformanceManager.isPerformanceTimingSupported())return this.appInsights.sendPageViewInternal(t,n),this._channel().forEach(function(e){e.forEach(function(e){return e.flush(!0)})}),void this._logger.throwInternal(u.WARNING,I,"trackPageView: navigation timing API used for calculation of page duration is not supported in this browser. This page view will be collected without duration and timing info.");var o=!1,s=void 0,c=this._pageViewPerformanceManager.getPerformanceTiming().navigationStart;s=Z.GetDuration(c,+new Date),this._pageViewPerformanceManager.shouldCollectDuration(s)||(s=void 0);var e=void 0;g.isNullOrUndefined(n)||g.isNullOrUndefined(n.duration)||(e=n.duration),!this.overridePageViewDuration&&isNaN(e)||(isNaN(e)&&(n||(n={}),n.duration=s),this.appInsights.sendPageViewInternal(t,n),this._channel().forEach(function(e){e.forEach(function(e){return e.flush(!0)})}),o=!0),n||(n={});var l=setInterval(function(){try{if(r._pageViewPerformanceManager.isPerformanceTimingDataReady()){clearInterval(l);var e={name:i,uri:a};r._pageViewPerformanceManager.populatePageViewPerformanceEvent(e),e.isValid||o?(o||(n.duration=e.durationMs,r.appInsights.sendPageViewInternal(t,n)),r.pageViewPerformanceSent||(r.appInsights.sendPageViewPerformanceInternal(e,n),r.pageViewPerformanceSent=!0),r._channel().forEach(function(e){e.forEach(function(e){return e.flush(!0)})})):(n.duration=s,r.appInsights.sendPageViewInternal(t,n),r._channel().forEach(function(e){e.forEach(function(e){return e.flush(!0)})}))}else 6e4<Z.GetDuration(c,+new Date)&&(clearInterval(l),o||(n.duration=6e4,r.appInsights.sendPageViewInternal(t,n),r._channel().forEach(function(e){e.forEach(function(e){return e.flush(!0)})})))}catch(e){r._logger.throwInternal(u.CRITICAL,b,"trackPageView failed on page load calculation: "+K.getExceptionName(e),{exception:K.dump(e)})}},100)},vt);function vt(e,t,n,r){this.pageViewPerformanceSent=!1,this.overridePageViewDuration=!1,this.overridePageViewDuration=t,this.appInsights=e,this._pageViewPerformanceManager=r,n&&(this._channel=function(){return n.getTransmissionControls()},this._logger=n.logger)}var wt=(yt.prototype.trackPreviousPageVisit=function(e,t){try{var n=this.restartPageVisitTimer(e,t);n&&this.pageVisitTimeTrackingHandler(n.pageName,n.pageUrl,n.pageVisitTime)}catch(e){this._logger.warnToConsole("Auto track page visit time failed, metric will not be collected: "+K.dump(e))}},yt.prototype.restartPageVisitTimer=function(e,t){try{var n=this.stopPageVisitTimer();return this.startPageVisitTimer(e,t),n}catch(e){return this._logger.warnToConsole("Call to restart failed: "+K.dump(e)),null}},yt.prototype.startPageVisitTimer=function(e,t){try{if(K.canUseSessionStorage()){if(null!=K.getSessionStorage(this._logger,this.prevPageVisitDataKeyName))throw new Error("Cannot call startPageVisit consecutively without first calling stopPageVisit");var n=new St(e,t),r=JSON.stringify(n);K.setSessionStorage(this._logger,this.prevPageVisitDataKeyName,r)}}catch(e){this._logger.warnToConsole("Call to start failed: "+K.dump(e))}},yt.prototype.stopPageVisitTimer=function(){try{if(K.canUseSessionStorage()){var e=Date.now(),t=K.getSessionStorage(this._logger,this.prevPageVisitDataKeyName);if(t){var n=JSON.parse(t);return n.pageVisitTime=e-n.pageVisitStartTime,K.removeSessionStorage(this._logger,this.prevPageVisitDataKeyName),n}return null}return null}catch(e){return this._logger.warnToConsole("Stop page visit timer failed: "+K.dump(e)),null}},yt);function yt(e,t){this.prevPageVisitDataKeyName="prevPageVisitData",this.pageVisitTimeTrackingHandler=t,this._logger=e}var St=function(e,t){this.pageVisitStartTime=Date.now(),this.pageName=e,this.pageUrl=t},_t=(It.prototype.populatePageViewPerformanceEvent=function(e){e.isValid=!1;var t=this.getPerformanceTiming();if(t){var n=Z.GetDuration(t.navigationStart,t.loadEventEnd),r=Z.GetDuration(t.navigationStart,t.connectEnd),i=Z.GetDuration(t.requestStart,t.responseStart),a=Z.GetDuration(t.responseStart,t.responseEnd),o=Z.GetDuration(t.responseEnd,t.loadEventEnd);0==n?this._logger.throwInternal(u.WARNING,S,"error calculating page view performance.",{total:n,network:r,request:i,response:a,dom:o}):this.shouldCollectDuration(n,r,i,a,o)?n<Math.floor(r)+Math.floor(i)+Math.floor(a)+Math.floor(o)?this._logger.throwInternal(u.WARNING,y,"client performance math error.",{total:n,network:r,request:i,response:a,dom:o}):(e.durationMs=n,e.perfTotal=e.duration=K.msToTimeSpan(n),e.networkConnect=K.msToTimeSpan(r),e.sentRequest=K.msToTimeSpan(i),e.receivedResponse=K.msToTimeSpan(a),e.domProcessing=K.msToTimeSpan(o),e.isValid=!0):this._logger.throwInternal(u.WARNING,C,"Invalid page load duration value. Browser perf data won't be sent.",{total:n,network:r,request:i,response:a,dom:o})}},It.prototype.getPerformanceTiming=function(){return this.isPerformanceTimingSupported()?window.performance.timing:null},It.prototype.isPerformanceTimingSupported=function(){return"undefined"!=typeof window&&window.performance&&window.performance.timing},It.prototype.isPerformanceTimingDataReady=function(){var e=window.performance.timing;return 0<e.domainLookupStart&&0<e.navigationStart&&0<e.responseStart&&0<e.requestStart&&0<e.loadEventEnd&&0<e.responseEnd&&0<e.connectEnd&&0<e.domLoading},It.prototype.shouldCollectDuration=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=["googlebot","adsbot-google","apis-google","mediapartners-google"],r=navigator.userAgent,i=!1;if(r)for(var a=0;a<n.length;a++)i=i||-1!==r.toLowerCase().indexOf(n[a]);if(i)return!1;for(var o=0;o<e.length;o++)if(e[o]>=this.MAX_DURATION_ALLOWED)return!1;return!0},It);function It(e){this.MAX_DURATION_ALLOWED=36e5,e&&(this._logger=e.logger)}var Tt="duration",Nt=(Et.getDefaultConfig=function(e){return e||(e={}),e.sessionRenewalMs=18e5,e.sessionExpirationMs=864e5,e.disableExceptionTracking=K.stringToBoolOrDefault(e.disableExceptionTracking),e.autoTrackPageVisitTime=K.stringToBoolOrDefault(e.autoTrackPageVisitTime),e.overridePageViewDuration=K.stringToBoolOrDefault(e.overridePageViewDuration),(isNaN(e.samplingPercentage)||e.samplingPercentage<=0||100<=e.samplingPercentage)&&(e.samplingPercentage=100),e.isCookieUseDisabled=K.stringToBoolOrDefault(e.isCookieUseDisabled),e.isStorageUseDisabled=K.stringToBoolOrDefault(e.isStorageUseDisabled),e.isBrowserLinkTrackingEnabled=K.stringToBoolOrDefault(e.isBrowserLinkTrackingEnabled),e.enableAutoRouteTracking=K.stringToBoolOrDefault(e.enableAutoRouteTracking),e.namePrefix=e.namePrefix||"",e},Et.prototype.processTelemetry=function(e){for(var t=!1,n=this._telemetryInitializers.length,r=0;r<n;++r){var i=this._telemetryInitializers[r];if(i)try{if(!1===i.apply(null,[e])){t=!0;break}}catch(e){this._logger.throwInternal(u.CRITICAL,G,"One of telemetry initializers failed, telemetry item will not be sent: "+K.getExceptionName(e),{exception:K.dump(e)},!0)}}t||g.isNullOrUndefined(this._nextPlugin)||this._nextPlugin.processTelemetry(e)},Et.prototype.setNextPlugin=function(e){this._nextPlugin=e},Et.prototype.trackEvent=function(e,t){try{var n=dt.create(e,pe.dataType,pe.envelopeType,this._logger,t);this.core.track(n)}catch(e){this._logger.throwInternal(u.WARNING,A,"trackTrace failed, trace will not be collected: "+K.getExceptionName(e),{exception:K.dump(e)})}},Et.prototype.startTrackEvent=function(e){try{this._eventTracking.start(e)}catch(e){this._logger.throwInternal(u.CRITICAL,T,"startTrackEvent failed, event will not be collected: "+K.getExceptionName(e),{exception:K.dump(e)})}},Et.prototype.stopTrackEvent=function(e,t,n){try{this._eventTracking.stop(e,void 0,t)}catch(e){this._logger.throwInternal(u.CRITICAL,N,"stopTrackEvent failed, event will not be collected: "+K.getExceptionName(e),{exception:K.dump(e)})}},Et.prototype.trackTrace=function(e,t){try{var n=dt.create(e,et.dataType,et.envelopeType,this._logger,t);this.core.track(n)}catch(e){this._logger.throwInternal(u.WARNING,A,"trackTrace failed, trace will not be collected: "+K.getExceptionName(e),{exception:K.dump(e)})}},Et.prototype.trackMetric=function(e,t){try{var n=dt.create(e,Ue.dataType,Ue.envelopeType,this._logger,t);this.core.track(n)}catch(e){this._logger.throwInternal(u.CRITICAL,D,"trackMetric failed, metric will not be collected: "+K.getExceptionName(e),{exception:K.dump(e)})}},Et.prototype.trackPageView=function(e,t){try{var n=e||{};this._pageViewManager.trackPageView(n,o({},n.properties,n.measurements,t)),this.config.autoTrackPageVisitTime&&this._pageVisitTimeManager.trackPreviousPageVisit(n.name,n.uri)}catch(e){this._logger.throwInternal(u.CRITICAL,P,"trackPageView failed, page view will not be collected: "+K.getExceptionName(e),{exception:K.dump(e)})}},Et.prototype.sendPageViewInternal=function(e,t,n){"undefined"!=typeof document&&(e.refUri=e.refUri||document.referrer);var r=dt.create(e,je.dataType,je.envelopeType,this._logger,t,n);this.core.track(r),this._trackAjaxAttempts=0},Et.prototype.sendPageViewPerformanceInternal=function(e,t,n){var r=dt.create(e,ot.dataType,ot.envelopeType,this._logger,t,n);this.core.track(r)},Et.prototype.trackPageViewPerformance=function(e,t){try{this._pageViewPerformanceManager.populatePageViewPerformanceEvent(e),this.sendPageViewPerformanceInternal(e,t)}catch(e){this._logger.throwInternal(u.CRITICAL,P,"trackPageViewPerformance failed, page view will not be collected: "+K.getExceptionName(e),{exception:K.dump(e)})}},Et.prototype.startTrackPage=function(e){try{"string"!=typeof e&&(e=window.document&&window.document.title||""),this._pageTracking.start(e)}catch(e){this._logger.throwInternal(u.CRITICAL,E,"startTrackPage failed, page view may not be collected: "+K.getExceptionName(e),{exception:K.dump(e)})}},Et.prototype.stopTrackPage=function(e,t,n,r){try{"string"!=typeof e&&(e=window.document&&window.document.title||""),"string"!=typeof t&&(t=window.location&&window.location.href||""),this._pageTracking.stop(e,t,n,r),this.config.autoTrackPageVisitTime&&this._pageVisitTimeManager.trackPreviousPageVisit(e,t)}catch(e){this._logger.throwInternal(u.CRITICAL,k,"stopTrackPage failed, page view will not be collected: "+K.getExceptionName(e),{exception:K.dump(e)})}},Et.prototype.sendExceptionInternal=function(e,t,n){var r=new ye(this._logger,e.exception||new Error(K.NotSpecified),e.properties,e.measurements,e.severityLevel,e.id).toInterface(),i=dt.create(r,ye.dataType,ye.envelopeType,this._logger,t,n);this.core.track(i)},Et.prototype.trackException=function(e,t){try{this.sendExceptionInternal(e,t)}catch(e){this._logger.throwInternal(u.CRITICAL,x,"trackException failed, exception will not be collected: "+K.getExceptionName(e),{exception:K.dump(e)})}},Et.prototype._onerror=function(t){try{var e={url:t&&t.url||document.URL,lineNumber:t.lineNumber,columnNumber:t.columnNumber,message:t.message};if(K.isCrossOriginError(t.message,t.url,t.lineNumber,t.columnNumber,t.error))this._sendCORSException(e.url);else{if(!K.isError(t.error)){var n="window.onerror@"+e.url+":"+t.lineNumber+":"+(t.columnNumber||0);t.error=new Error(t.message),t.error.stack=n}this.trackException({exception:t.error,severityLevel:lt.Error},e)}}catch(e){var r=t.error?t.error.name+", "+t.error.message:"null";this._logger.throwInternal(u.CRITICAL,_,"_onError threw exception while logging error, error will not be collected: "+K.getExceptionName(e),{exception:K.dump(e),errorString:r})}},Et.prototype.addTelemetryInitializer=function(e){this._telemetryInitializers.push(e)},Et.prototype._initialize=function(e,t,n){var o=this;if(!this._isInitialized){if(g.isNullOrUndefined(t))throw Error("Error initializing");this.core=t,this._logger=t.logger,this._globalconfig={instrumentationKey:e.instrumentationKey,endpointUrl:e.endpointUrl||"https://dc.services.visualstudio.com/v2/track"},this.config=e.extensionConfig&&e.extensionConfig[this.identifier]?e.extensionConfig[this.identifier]:{};var r=Et.getDefaultConfig();if(void 0!==r){for(var i in r)this.config[i]=gt.getConfig(e,i,this.identifier,r[i]);if(this._globalconfig)for(var i in r)void 0===this._globalconfig[i]&&(this._globalconfig[i]=r[i])}this.config.isCookieUseDisabled&&K.disableCookies(),this.config.isStorageUseDisabled&&K.disableStorage();var a={instrumentationKey:function(){return e.instrumentationKey},accountId:function(){return o.config.accountId||e.accountId},sessionRenewalMs:function(){return o.config.sessionRenewalMs||e.sessionRenewalMs},sessionExpirationMs:function(){return o.config.sessionExpirationMs||e.sessionExpirationMs},sampleRate:function(){return o.config.samplingPercentage||e.samplingPercentage},cookieDomain:function(){return o.config.cookieDomain||e.cookieDomain},sdkExtension:function(){return o.config.sdkExtension||e.sdkExtension},isBrowserLinkTrackingEnabled:function(){return o.config.isBrowserLinkTrackingEnabled||e.isBrowserLinkTrackingEnabled},appId:function(){return o.config.appId||e.appId}};this._pageViewPerformanceManager=new _t(this.core),this._pageViewManager=new mt(this,this.config.overridePageViewDuration,this.core,this._pageViewPerformanceManager),this._pageVisitTimeManager=new wt(this._logger,function(e,t,n){return o.trackPageVisitTime(e,t,n)}),this._telemetryInitializers=[],this._addDefaultTelemetryInitializers(a),this._eventTracking=new kt(this._logger,"trackEvent"),this._eventTracking.action=function(e,t,n,r){r||(r={}),r[Tt]=n.toString(),o.trackEvent({name:e,properties:r})},this._pageTracking=new kt(this._logger,"trackPageView"),this._pageTracking.action=function(e,t,n,r,i){g.isNullOrUndefined(r)&&(r={}),r[Tt]=n.toString();var a={name:e,uri:t,properties:r,measurements:i};o.sendPageViewInternal(a)};var s,c,l=this;if(!1===this.config.disableExceptionTracking&&!this.config.autoExceptionInstrumented){var u=window.onerror;window.onerror=function(e,t,n,r,i){var a=u&&u(e,t,n,r,i);return!0!==a&&l._onerror({message:e,url:t,lineNumber:n,columnNumber:r,error:i}),a},this.config.autoExceptionInstrumented=!0}if(!0===this.config.enableAutoRouteTracking&&"object"==typeof history&&"function"==typeof history.pushState&&"function"==typeof history.replaceState&&"object"==typeof window){var p=this;n.forEach(function(e){"AppInsightsPropertiesPlugin"===e.identifier&&(o._properties=e)}),history.pushState=(c=history.pushState,function(){var e=c.apply(this,arguments);return window.dispatchEvent(new Event(p.config.namePrefix+"pushState")),window.dispatchEvent(new Event(p.config.namePrefix+"locationchange")),e}),history.replaceState=(s=history.replaceState,function(){var e=s.apply(this,arguments);return window.dispatchEvent(new Event(p.config.namePrefix+"replaceState")),window.dispatchEvent(new Event(p.config.namePrefix+"locationchange")),e}),window.addEventListener(p.config.namePrefix+"popstate",function(){window.dispatchEvent(new Event(p.config.namePrefix+"locationchange"))}),window.addEventListener(p.config.namePrefix+"locationchange",function(){p._properties&&p._properties.context&&p._properties.context.telemetryTrace&&(p._properties.context.telemetryTrace.traceID=K.newId(),p._properties.context.telemetryTrace.name=window.location.pathname),p.trackPageView({properties:{duration:0}})})}this._isInitialized=!0}},Et.prototype.trackPageVisitTime=function(e,t,n){var r={PageName:e,PageUrl:t};this.trackMetric({name:"PageVisitTime",average:n,max:n,min:n,sampleCount:1},r)},Et.prototype._addDefaultTelemetryInitializers=function(e){if(!e.isBrowserLinkTrackingEnabled()){var r=["/browserLinkSignalR/","/__browserLink/"];this._addTelemetryInitializer(function(e){if(e.baseType===Fe.dataType){var t=e.baseData;if(t)for(var n=0;n<r.length;n++)if(t.target&&0<=t.target.indexOf(r[n]))return!1}return!0})}},Et.prototype._addTelemetryInitializer=function(e){this._telemetryInitializers.push(e)},Et.prototype._sendCORSException=function(e){var t={message:"Script error: The browser's same-origin policy prevents us from getting the details of this exception. Consider using the 'crossorigin' attribute.",url:e,lineNumber:0,columnNumber:0,error:void 0},n=dt.create(t,ye.dataType,ye.envelopeType,this._logger,{url:e});this.core.track(n)},Et.Version="2.1.0",Et);function Et(){this.identifier="ApplicationInsightsAnalytics",this.priority=180,this._isInitialized=!1,this._trackAjaxAttempts=0,this.initialize=this._initialize.bind(this)}var kt=(xt.prototype.start=function(e){void 0!==this._events[e]&&this._logger.throwInternal(u.WARNING,O,"start was called more than once for this event without calling stop.",{name:this._name,key:e},!0),this._events[e]=+new Date},xt.prototype.stop=function(e,t,n,r){var i=this._events[e];if(isNaN(i))this._logger.throwInternal(u.WARNING,z,"stop was called without a corresponding start.",{name:this._name,key:e},!0);else{var a=+new Date,o=Z.GetDuration(i,a);this.action(e,t,o,n,r)}delete this._events[e],this._events[e]=void 0},xt);function xt(e,t){this._name=t,this._events={},this._logger=e}e.ApplicationInsights=Nt,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=applicationinsights-analytics-js.min.js.map |
{ | ||
"name": "@microsoft/applicationinsights-analytics-js", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "Microsoft Application Insights Javascript SDK apis", | ||
@@ -20,2 +20,3 @@ "main": "dist/applicationinsights-analytics-js.js", | ||
"devDependencies": { | ||
"@microsoft/applicationinsights-properties-js": "2.1.0", | ||
"typescript": "2.5.3", | ||
@@ -32,4 +33,4 @@ "rollup-plugin-node-resolve": "^3.4.0", | ||
"dependencies": { | ||
"@microsoft/applicationinsights-core-js": "2.0.1", | ||
"@microsoft/applicationinsights-common": "2.0.1", | ||
"@microsoft/applicationinsights-core-js": "2.1.0", | ||
"@microsoft/applicationinsights-common": "2.1.0", | ||
"tslib": "^1.9.3" | ||
@@ -36,0 +37,0 @@ }, |
@@ -7,3 +7,3 @@ /** | ||
import { | ||
IConfig, Util, PageViewPerformance, IAppInsights, PageView, RemoteDependencyData, Event, IEventTelemetry, | ||
IConfig, Util, PageViewPerformance, IAppInsights, PageView, RemoteDependencyData, Event as EventTelemetry, IEventTelemetry, | ||
TelemetryItemCreator, Metric, Exception, SeverityLevel, Trace, IDependencyTelemetry, | ||
@@ -13,3 +13,4 @@ IExceptionTelemetry, ITraceTelemetry, IMetricTelemetry, IAutoExceptionTelemetry, | ||
ConfigurationManager, DateTimeUtils, | ||
IExceptionInternal | ||
IExceptionInternal, | ||
PropertiesPluginIdentifier | ||
} from "@microsoft/applicationinsights-common"; | ||
@@ -27,2 +28,5 @@ | ||
// For types only | ||
import * as properties from "@microsoft/applicationinsights-properties-js"; | ||
"use strict"; | ||
@@ -33,6 +37,6 @@ | ||
export class ApplicationInsights implements IAppInsights, ITelemetryPlugin, IAppInsightsInternal { | ||
public static Version = "2.0.1"; // Not currently used anywhere | ||
public static Version = "2.1.0"; // Not currently used anywhere | ||
public initialize: (config: IConfiguration, core: IAppInsightsCore, extensions: IPlugin[]) => void; | ||
public identifier: string = "ApplicationInsightsAnalytics"; // do not change name or priority | ||
public priority: number = 160;// take from reserved priority range 100- 200 | ||
public priority: number = 180; // take from reserved priority range 100- 200 | ||
public config: IConfig; | ||
@@ -46,2 +50,3 @@ public core: IAppInsightsCore; | ||
private _pageTracking: Timing; | ||
private _properties: properties.PropertiesPlugin; | ||
protected _nextPlugin: ITelemetryPlugin; | ||
@@ -83,2 +88,4 @@ protected _logger: IDiagnosticLogger; // Initialized by Core | ||
config.isBrowserLinkTrackingEnabled = Util.stringToBoolOrDefault(config.isBrowserLinkTrackingEnabled); | ||
config.enableAutoRouteTracking = Util.stringToBoolOrDefault(config.enableAutoRouteTracking); | ||
config.namePrefix = config.namePrefix || ""; | ||
@@ -122,4 +129,4 @@ return config; | ||
event, | ||
Event.dataType, | ||
Event.envelopeType, | ||
EventTelemetry.dataType, | ||
EventTelemetry.envelopeType, | ||
this._logger, | ||
@@ -129,3 +136,2 @@ customProperties | ||
this._setTelemetryNameAndIKey(telemetryItem); | ||
this.core.track(telemetryItem); | ||
@@ -187,3 +193,2 @@ } catch (e) { | ||
this._setTelemetryNameAndIKey(telemetryItem); | ||
this.core.track(telemetryItem); | ||
@@ -219,3 +224,2 @@ } catch (e) { | ||
this._setTelemetryNameAndIKey(telemetryItem); | ||
this.core.track(telemetryItem); | ||
@@ -239,3 +243,3 @@ } catch (e) { | ||
const inPv = pageView || {}; | ||
this._pageViewManager.trackPageView(inPv, customProperties); | ||
this._pageViewManager.trackPageView(inPv, {...inPv.properties, ...inPv.measurements, ...customProperties}); | ||
@@ -273,4 +277,2 @@ if (this.config.autoTrackPageVisitTime) { | ||
// set instrumentation key | ||
this._setTelemetryNameAndIKey(telemetryItem); | ||
this.core.track(telemetryItem); | ||
@@ -296,5 +298,2 @@ | ||
// set instrumentation key | ||
this._setTelemetryNameAndIKey(telemetryItem); | ||
this.core.track(telemetryItem); | ||
@@ -400,3 +399,2 @@ } | ||
); | ||
this._setTelemetryNameAndIKey(telemetryItem); | ||
this.core.track(telemetryItem); | ||
@@ -566,2 +564,3 @@ } | ||
const instance: IAppInsights = this; | ||
if (this.config.disableExceptionTracking === false && | ||
@@ -572,3 +571,2 @@ !this.config.autoExceptionInstrumented) { | ||
const originalOnError = window[onerror]; | ||
const instance: IAppInsights = this; | ||
window.onerror = function (message, url, lineNumber, columnNumber, error) { | ||
@@ -591,2 +589,43 @@ const handled = originalOnError && <any>originalOnError(message, url, lineNumber, columnNumber, error); | ||
/** | ||
* Create a custom "locationchange" event which is triggered each time the history object is changed | ||
*/ | ||
if (this.config.enableAutoRouteTracking === true | ||
&& typeof history === "object" && typeof history.pushState === "function" && typeof history.replaceState === "function" | ||
&& typeof window === "object") { | ||
const _self = this; | ||
// Find the properties plugin | ||
extensions.forEach(extension => { | ||
if (extension.identifier === PropertiesPluginIdentifier) { | ||
this._properties = extension as properties.PropertiesPlugin; | ||
} | ||
}); | ||
history.pushState = ( f => function pushState() { | ||
var ret = f.apply(this, arguments); | ||
window.dispatchEvent(new Event(_self.config.namePrefix + "pushState")); | ||
window.dispatchEvent(new Event(_self.config.namePrefix + "locationchange")); | ||
return ret; | ||
})(history.pushState); | ||
history.replaceState = ( f => function replaceState(){ | ||
var ret = f.apply(this, arguments); | ||
window.dispatchEvent(new Event(_self.config.namePrefix + "replaceState")); | ||
window.dispatchEvent(new Event(_self.config.namePrefix + "locationchange")); | ||
return ret; | ||
})(history.replaceState); | ||
window.addEventListener(_self.config.namePrefix + "popstate",()=>{ | ||
window.dispatchEvent(new Event(_self.config.namePrefix + "locationchange")); | ||
}); | ||
window.addEventListener(_self.config.namePrefix + "locationchange", () => { | ||
if (_self._properties && _self._properties.context && _self._properties.context.telemetryTrace) { | ||
_self._properties.context.telemetryTrace.traceID = Util.newId(); | ||
_self._properties.context.telemetryTrace.name = window.location.pathname; | ||
} | ||
_self.trackPageView({ properties: { duration: 0 } }); // SPA route change loading durations are undefined, so send 0 | ||
}); | ||
} | ||
this._isInitialized = true; | ||
@@ -655,10 +694,2 @@ } | ||
} | ||
// Mutate telemetryItem inplace to add boilerplate iKey & name info | ||
private _setTelemetryNameAndIKey(telemetryItem: ITelemetryItem): void { | ||
telemetryItem.iKey = this._globalconfig.instrumentationKey; | ||
var iKeyNoDashes = this._globalconfig.instrumentationKey.replace(/-/g, ""); | ||
telemetryItem.name = telemetryItem.name.replace("{0}", iKeyNoDashes); | ||
} | ||
} | ||
@@ -665,0 +696,0 @@ |
@@ -22,2 +22,3 @@ /** | ||
private _pageTracking; | ||
private _properties; | ||
protected _nextPlugin: ITelemetryPlugin; | ||
@@ -164,3 +165,2 @@ protected _logger: IDiagnosticLogger; | ||
private _sendCORSException(url); | ||
private _setTelemetryNameAndIKey(telemetryItem); | ||
} |
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 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
Mixed license
License(Experimental) Package contains multiple licenses.
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
7763
1433977
10
1
+ Added@microsoft/applicationinsights-common@2.1.0(transitive)
+ Added@microsoft/applicationinsights-core-js@2.1.0(transitive)
- Removed@microsoft/applicationinsights-common@2.0.1(transitive)
- Removed@microsoft/applicationinsights-core-js@2.0.1(transitive)